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:
1 parent
6236ed1eb4
commit
bfb17d0d25
12 files changed
+322
-65
No files matched your search
+8
-5
@@ -351,15 +351,18 @@ func (h *wsHub) OnDeviceOffline(id string) {
|
||||
}
|
||||
}
|
||||
|
||||
// OnCursorChange relays the remote cursor index to every viewer of this
|
||||
// device. The browser maps the index to a CSS cursor (desktop) or overlay
|
||||
// SVG variant (touch). Hub already de-duplicates so we always have a real
|
||||
// transition here.
|
||||
func (h *wsHub) OnCursorChange(deviceID string, index byte) {
|
||||
// OnCursorChange relays the remote cursor's shape and position to every viewer
|
||||
// of this device. The browser draws the cursor itself while it is not in
|
||||
// control mode (captured frames never contain one) and maps the index to a CSS
|
||||
// cursor on desktop while in control mode. x/y are in frame/canvas space.
|
||||
// Hub already de-duplicates and throttles, so we always have a real transition.
|
||||
func (h *wsHub) OnCursorChange(deviceID string, index byte, x, y int) {
|
||||
msg := mustJSON(map[string]any{
|
||||
"cmd": "cursor",
|
||||
"id": deviceID,
|
||||
"index": index,
|
||||
"x": x,
|
||||
"y": y,
|
||||
})
|
||||
h.mu.RLock()
|
||||
defer h.mu.RUnlock()
|
||||
|
||||
Reference in new issue
Block a user