Improve: Reduce mouse operation lag during remote control

This commit is contained in:
yuanyuanxiang
2026-01-02 12:12:35 +01:00
parent e86afe74da
commit b555b3a535
3 changed files with 11 additions and 1 deletions

View File

@@ -2573,6 +2573,7 @@ VOID CMy2015RemoteDlg::MessageHandle(CONTEXT_OBJECT* ContextObject)
break;
}
case TOKEN_BITMAPINFO_HIDE: { // 虚拟桌面【x】
ContextObject->SetNoDelay(TRUE);
g_2015RemoteDlg->SendMessage(WM_OPENHIDESCREENDLG, 0, (LPARAM)ContextObject);
break;
}
@@ -2597,6 +2598,7 @@ VOID CMy2015RemoteDlg::MessageHandle(CONTEXT_OBJECT* ContextObject)
break;
}
case TOKEN_BITMAPINFO: { // 远程桌面【x】
ContextObject->SetNoDelay(TRUE);
g_2015RemoteDlg->SendMessage(WM_OPENSCREENSPYDIALOG, 0, (LPARAM)ContextObject);
break;
}

View File

@@ -805,7 +805,11 @@ VOID CScreenSpyDlg::SendCommand(const MYMSG* Msg)
int dx = abs(Msg->pt.x - m_lastMousePoint.x);
int dy = abs(Msg->pt.y - m_lastMousePoint.y);
int dist_sq = dx * dx + dy * dy;
if (time_elapsed < 200 && dist_sq < 18 * 18) {
bool fastMove = dist_sq > 50 * 50;
int minInterval = fastMove ? 33 : 16;
int minDistSq = fastMove ? 10 * 10 : 3 * 3;
if (time_elapsed < minInterval && dist_sq < minDistSq) {
return;
}
m_lastMouseMove = now;

View File

@@ -693,6 +693,10 @@ public:
{
GroupName = group;
}
void SetNoDelay(BOOL bNoDelay = TRUE)
{
setsockopt(sClientSocket, IPPROTO_TCP, TCP_NODELAY, (char*)&bNoDelay, sizeof(BOOL));
}
} CONTEXT_OBJECT, * PCONTEXT_OBJECT;
typedef CList<PCONTEXT_OBJECT> ContextObjectList;