Improvement: Reduce transmit mouse move message

This commit is contained in:
yuanyuanxiang
2025-07-13 18:34:10 +08:00
parent 92ded3a6c1
commit 7794ef236d
6 changed files with 39 additions and 0 deletions

View File

@@ -1987,6 +1987,10 @@ VOID CMy2015RemoteDlg::MessageHandle(CONTEXT_OBJECT* ContextObject)
g_2015RemoteDlg->SendMessage(WM_OPENWEBCAMDIALOG, 0, (LPARAM)ContextObject);
break;
}
case CMD_PADDING: {
Mprintf("Receive padding command '%s' [%d]: Len=%d\n", ContextObject->PeerName.c_str(), cmd, len);
break;
}
default: {
Mprintf("Receive unknown command '%s' [%d]: Len=%d\n", ContextObject->PeerName.c_str(), cmd, len);
}

View File

@@ -759,6 +759,19 @@ void CHideScreenSpyDlg::SendScaledMouseMessage(MSG* pMsg, bool makeLP) {
if (!m_bIsCtrl)
return;
if (pMsg->message == WM_MOUSEMOVE) {
auto now = clock();
auto time_elapsed = now - m_lastMouseMove;
int dx = abs(pMsg->pt.x - m_lastMousePoint.x);
int dy = abs(pMsg->pt.y - m_lastMousePoint.y);
int dist_sq = dx * dx + dy * dy;
if (time_elapsed < 200 && dist_sq < 18 * 18) {
return;
}
m_lastMouseMove = now;
m_lastMousePoint = pMsg->pt;
}
MYMSG msg(*pMsg);
auto low = ((LONG)LOWORD(pMsg->lParam)) * m_wZoom;
auto high = ((LONG)HIWORD(pMsg->lParam)) * m_hZoom;

View File

@@ -81,6 +81,9 @@ protected:
BYTE m_bCursorIndex;
CString m_strTip;
clock_t m_lastMouseMove; // <20><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD>ʱ<EFBFBD><CAB1>
POINT m_lastMousePoint;// <20>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
private:
CString m_aviFile;
CBmpToAvi m_aviStream;

View File

@@ -34,6 +34,8 @@ extern "C" char* __imp_strtok(char* str, const char* delim) { return strtok(str,
CScreenSpyDlg::CScreenSpyDlg(CWnd* Parent, Server* IOCPServer, CONTEXT_OBJECT* ContextObject)
: DialogBase(CScreenSpyDlg::IDD, Parent, IOCPServer, ContextObject, 0)
{
m_lastMouseMove = 0;
m_lastMousePoint = {};
m_pCodec = nullptr;
m_pCodecContext = nullptr;
memset(&m_AVPacket, 0, sizeof(AVPacket));
@@ -556,6 +558,19 @@ VOID CScreenSpyDlg::SendCommand(const MSG64* Msg)
if (!m_bIsCtrl)
return;
if (Msg->message == WM_MOUSEMOVE) {
auto now = clock();
auto time_elapsed = now - m_lastMouseMove;
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) {
return;
}
m_lastMouseMove = now;
m_lastMousePoint = Msg->pt;
}
const int length = sizeof(MSG64) + 1;
BYTE szData[length + 3];
szData[0] = COMMAND_SCREEN_CONTROL;

View File

@@ -89,6 +89,9 @@ public:
AVPacket m_AVPacket;
AVFrame m_AVFrame;
clock_t m_lastMouseMove; // <20><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD>ʱ<EFBFBD><CAB1>
POINT m_lastMousePoint;// <20>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
bool Decode(LPBYTE Buffer, int size);
void EnterFullScreen();
bool LeaveFullScreen();