Fix(macOS): restore dblclick for MAC touch, fix scroll speed (10px→40px per notch)

This commit is contained in:
yuanyuanxiang
2026-06-04 15:33:12 +02:00
parent be09b271e1
commit fc0be64880
3 changed files with 15 additions and 10 deletions

View File

@@ -217,9 +217,9 @@ void InputHandler::handleMouseWheel(int delta)
{
// Convert Windows wheel delta (120 = one notch) to macOS pixel units
// Using pixel units provides smoother scrolling than line units
// Windows: 120 = one standard notch
// macOS: approximately 10 pixels per notch feels natural
int32_t scrollAmount = (delta * 10) / 120;
// Windows: 120 = one standard notch (~3 lines * 20px = ~60px)
// macOS: 40 pixels per notch matches Windows scroll feel
int32_t scrollAmount = (delta * 40) / 120;
// Use pixel units for smoother scrolling experience
CGEventRef event = CGEventCreateScrollWheelEvent(

View File

@@ -1600,6 +1600,9 @@ std::string CWebService::BuildDeviceListJson(const std::string& username) {
device["screen"] = AnsiToUtf8(resolution); // e.g. "2:3840x1080"
}
CString clientType = ctx->GetAdditionalData(RES_CLIENT_TYPE);
device["clientType"] = AnsiToUtf8(clientType); // e.g. "MAC", "LNX", "EXE"
res["devices"].append(device);
}
LeaveCriticalSection(&m_pParentDlg->m_cs);

View File

@@ -3667,13 +3667,15 @@
// Must send first click before dblclick for Windows to recognize
console.log('[Touch] Double click');
clickAtCursor(0); // First click
// dblClickAtCursor(); // Then double click
// 强制人工延迟 20 毫秒发送第二次标准单击
// 这 20ms 的延迟在操作上完全感觉不到,但对远程桌面的网络和操作系统驱动至关重要!
// 它能完美地把两次点击在时间线上拉开,让任何操作系统都 100% 判定这是标准的“物理鼠标双击”。
if (currentDevice && currentDevice.clientType === 'MAC') {
// macOS uses a real dblclick event; two sequential clicks don't work
dblClickAtCursor(); // Then double click
} else {
// Windows/Linux: simulate physical double-click with two clicks 20ms apart
setTimeout(() => {
clickAtCursor(0);
}, 20);
}
touchState.state = T_IDLE;
} else if (touchState.state === T_FIRST_DOWN && !touchState.moved) {
// First tap released without moving = single click