diff --git a/server/2015Remote/2015RemoteDlg.cpp b/server/2015Remote/2015RemoteDlg.cpp index be03c48..3dbe7a4 100644 --- a/server/2015Remote/2015RemoteDlg.cpp +++ b/server/2015Remote/2015RemoteDlg.cpp @@ -13580,6 +13580,22 @@ context* CMy2015RemoteDlg::FindHostByClientID(uint64_t clientID) return ctx; } +bool CMy2015RemoteDlg::GetHostClientType(uint64_t clientID, CString& clientType) +{ + clientType.Empty(); + bool found = false; + EnterCriticalSection(&m_cs); + auto it = m_ClientIndex.find(clientID); + if (it != m_ClientIndex.end() && it->second < m_HostList.size()) { + if (context* ctx = m_HostList[it->second]) { + clientType = ctx->GetAdditionalData(RES_CLIENT_TYPE); + found = true; + } + } + LeaveCriticalSection(&m_cs); + return found; +} + uint64_t CMy2015RemoteDlg::FindClientIDByIP(const std::string& ip) { CString clientIP(ip.c_str()); diff --git a/server/2015Remote/2015RemoteDlg.h b/server/2015Remote/2015RemoteDlg.h index d28a635..1dd5c56 100644 --- a/server/2015Remote/2015RemoteDlg.h +++ b/server/2015Remote/2015RemoteDlg.h @@ -485,6 +485,9 @@ public: std::vector m_DllList; context* FindHostByIP(const std::string& ip); context* FindHostByClientID(uint64_t clientID); // 线程安全:通过 clientID 精确查主连接 + // 线程安全:在 m_cs 内读取并返回值,避免调用方拿到裸指针后再访问附加数据; + // 找不到主连接时返回 false。 + bool GetHostClientType(uint64_t clientID, CString& clientType); uint64_t FindClientIDByIP(const std::string& ip); // 线程安全:在锁内获取ID void InjectTinyRunDll(const std::string& ip, int pid); NOTIFYICONDATA m_Nid; diff --git a/server/2015Remote/ScreenSpyDlg.cpp b/server/2015Remote/ScreenSpyDlg.cpp index 894d0e3..c10da8c 100644 --- a/server/2015Remote/ScreenSpyDlg.cpp +++ b/server/2015Remote/ScreenSpyDlg.cpp @@ -3442,7 +3442,21 @@ BOOL CScreenSpyDlg::PreTranslateMessage(MSG* pMsg) case WM_MBUTTONDBLCLK: case WM_MBUTTONDOWN: case WM_MBUTTONUP: + SendScaledMouseMessage(pMsg, true); + break; case WM_MOUSEMOVE: + // Android(含 TV/盒子)把悬停的 mousemove 翻译成焦点移动;MFC 控制端只在 + // 按住左键拖动时转发,避免鼠标划过画面时远程焦点乱跳。触摸屏浏览器的输入 + // 走 Web 前端的 touch 处理器,不经过这里。 + if (m_bIsCtrl) { + if (m_androidHost < 0 && m_ClientID != 0 && g_2015RemoteDlg) { + CString clientType; + if (g_2015RemoteDlg->GetHostClientType(m_ClientID, clientType)) + m_androidHost = clientType.CompareNoCase(_T("APK")) == 0 ? 1 : 0; + } + if (m_androidHost == 1 && !(pMsg->wParam & MK_LBUTTON)) + break; + } SendScaledMouseMessage(pMsg, true); break; case WM_MOUSEWHEEL: { diff --git a/server/2015Remote/ScreenSpyDlg.h b/server/2015Remote/ScreenSpyDlg.h index 9147aca..8d4af62 100644 --- a/server/2015Remote/ScreenSpyDlg.h +++ b/server/2015Remote/ScreenSpyDlg.h @@ -208,6 +208,9 @@ class CScreenSpyDlg : public DialogBase DECLARE_DYNAMIC(CScreenSpyDlg) CToolbarDlg* m_pToolbar = nullptr; CMy2015RemoteDlg* m_pParent = nullptr; + // -1=尚未解析, 0=非 Android, 1=Android(APK)。只在 UI 线程读写:PreTranslateMessage + // 首次用到时解析并缓存,避免每次 mousemove 都查主连接。 + int m_androidHost = -1; public: CStatusInfoWnd* m_pStatusInfoWnd = nullptr; diff --git a/server/web/index.html b/server/web/index.html index 589c6ad..514d94d 100644 --- a/server/web/index.html +++ b/server/web/index.html @@ -7558,6 +7558,18 @@ sendMouse('up', x, y, 2); } + // Android 主机(含 TV/盒子)会把悬停的 move 翻译成焦点移动;桌面鼠标 + // 只在按住左键拖动时发送 move。优先用服务端下发的 isAndroidRemote + // (client_type === "APK"),设备列表字段只作兜底,保证与导航栏/直触 + // 模式使用同一个判断。触摸路径走下面的 touch 处理器,不受影响。 + function isAndroidHost() { + if (isAndroidRemote) return true; + if (!currentDevice) return false; + const os = String(currentDevice.os || '').toLowerCase(); + const type = String(currentDevice.clientType || '').toLowerCase(); + return os.includes('android') || type === 'apk'; + } + // Desktop mouse handling let lastMouseMove = 0; let lastMouseX = 0, lastMouseY = 0; @@ -7601,6 +7613,8 @@ lastMouseMove = now; lastMouseX = pos.x; lastMouseY = pos.y; + // Android(TV): 不按键的悬停不控制远程,只更新本地光标;按住左键拖动才发 move。 + if (isAndroidHost() && !(e.buttons & 1)) return; sendMouse('move', pos.x, pos.y, 0); });