From fc0be648805969948a744defc9af9c9d44ea0bbf Mon Sep 17 00:00:00 2001 From: yuanyuanxiang <962914132@qq.com> Date: Thu, 4 Jun 2026 15:33:12 +0200 Subject: [PATCH] =?UTF-8?q?Fix(macOS):=20restore=20dblclick=20for=20MAC=20?= =?UTF-8?q?touch,=20fix=20scroll=20speed=20(10px=E2=86=9240px=20per=20notc?= =?UTF-8?q?h)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- macos/InputHandler.mm | 6 +++--- server/2015Remote/WebService.cpp | 3 +++ server/web/index.html | 16 +++++++++------- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/macos/InputHandler.mm b/macos/InputHandler.mm index e4f8901..ddcbbc8 100644 --- a/macos/InputHandler.mm +++ b/macos/InputHandler.mm @@ -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( diff --git a/server/2015Remote/WebService.cpp b/server/2015Remote/WebService.cpp index 091ffee..5b4a92c 100644 --- a/server/2015Remote/WebService.cpp +++ b/server/2015Remote/WebService.cpp @@ -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); diff --git a/server/web/index.html b/server/web/index.html index d63e7f0..545352e 100644 --- a/server/web/index.html +++ b/server/web/index.html @@ -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% 判定这是标准的“物理鼠标双击”。 - setTimeout(() => { - clickAtCursor(0); - }, 20); + 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