Feature: Draw the remote cursor in the web desktop out of control mode

Screen frames are captured without the pointer composed in (GDI SRCCOPY,
DXGI), so browsers only ever knew the cursor's shape index and could show a
cursor just in control mode, where the local pointer stands in for the remote
one. Both servers now relay the cursor position that every per-frame header
already carries: shape changes go out immediately, position changes at most
every 50 ms, and an unchanged cursor is re-sent once a second so a viewer that
joins while the pointer is idle still learns where it is.

The page hides the local pointer and draws the remote cursor at its true
position while out of control mode; entering control mode restores exactly the
old behaviour (remote-shaped CSS cursor on desktop, touchpad pointer on touch).
A server that never sends x/y leaves the page on its previous fallback.

The C++ server broadcasts from the per-frame path, so header-only frames keep a
static desktop's cursor fresh; the Go hub dedups and throttles before fanning
out. Tests cover the throttle/refresh rules and the relayed payload.

Co-Authored-By: deepseek-flash
This commit is contained in:
yuanyuanxianganddeepseek-flash committed 2026-10-26 17:44:13 +01:00
1 parent 6236ed1eb4
commit bfb17d0d25
12 files changed
+322 -65

No files matched your search

+7
View File
@@ -218,6 +218,10 @@ public:
bool IsWebSession() const { return m_bIsWebSession.load(); }
void SetWebSession(bool isWeb) { m_bIsWebSession.store(isWeb); }
// 把远程光标的位置/类型同步给 Web 客户端(非控制态由浏览器自己画光标)。
// force=true 用于类型变化,跳过节流立即发送。
void BroadcastCursorToWeb(bool force);
VOID SendNext(void);
VOID OnReceiveComplete();
HDC m_hFullDC;
@@ -264,6 +268,9 @@ public:
std::atomic<bool> m_bIsWebSession{false}; // True if this dialog was created by Web request (atomic for thread safety)
std::string m_strSaveNotice; // 截图保存路径提示
ULONGLONG m_nSaveNoticeTime = 0; // 截图提示开始时间
ULONGLONG m_nLastCursorBroadcast = 0; // 上次向 Web 广播光标的时间(50ms 节流)
BYTE m_bBroadcastCursorIndex = 0; // 上次广播的光标类型
POINT m_ptBroadcastCursor = {0, 0}; // 上次广播的光标位置
BOOL m_bUsingFRP = FALSE;
// 文件接收进度对话框(用于 Linux Ctrl+C -> 服务端 Ctrl+V)