mirror of
https://github.com/yuanyuanxiang/SimpleRemoter.git
synced 2026-01-21 15:03:09 +08:00
Improve: Reduce mouse operation lag during remote control
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user