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

+4 -1
View File
@@ -2344,7 +2344,7 @@ void CWebService::NotifyAudioState(uint64_t device_id, bool enabled) {
}
}
void CWebService::BroadcastCursor(uint64_t device_id, uint8_t cursor_index) {
void CWebService::BroadcastCursor(uint64_t device_id, uint8_t cursor_index, int x, int y) {
if (m_bStopping) return;
// Build JSON message
@@ -2352,6 +2352,9 @@ void CWebService::BroadcastCursor(uint64_t device_id, uint8_t cursor_index) {
res["cmd"] = "cursor";
res["id"] = std::to_string(device_id);
res["index"] = cursor_index;
// 位置是发送位图(即浏览器 canvas)坐标系;老页面忽略这两个字段。
res["x"] = x;
res["y"] = y;
Json::StreamWriterBuilder builder;
builder["indentation"] = "";