From eeeb87043c19ab1183b74cfb1d7b5f7cd0c23cd7 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Thu, 24 Sep 2026 23:34:10 +0800 Subject: [PATCH] cursor: file no macOS seeds, and send nothing for the shape already shown A macOS seed marks a change and never comes back, so filing it as a handle only filled the map; the byte ceiling still bounds the shapes there. A new handle or seed for the shape already shown, which a seed change without a new shape or an app minting handles gives, sent every connection a cursor_id for what it already showed; a shape is one message however many handles name it, so the same message is not sent again. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01EZ49AbZJYfm8NTp5yDPMab --- src/server/input_service.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/server/input_service.rs b/src/server/input_service.rs index 317994af2..3bf1ac664 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -442,6 +442,9 @@ fn run_cursor(sp: MouseCursorService, state: &mut StateCursor) -> ResultType<()> } } limit_cursor_handles(&mut state.cached_cursor_data, &msg); + // A macOS seed marks a change, never the same one twice: filing it would only + // fill the map. + #[cfg(not(target_os = "macos"))] state.cached_cursor_data.insert(cache_key, msg.clone()); super::log::trace!("Cursor data updated, hcursor: {}", cache_key); } @@ -453,8 +456,12 @@ fn run_cursor(sp: MouseCursorService, state: &mut StateCursor) -> ResultType<()> { state.hcursor = drm_served_id; } - sp.send_shared(msg.clone()); - state.cursor_data = msg; + // A new handle or seed for the shape already shown changes nothing a controller sees; + // a shape is one message however many handles name it. + if !Arc::ptr_eq(&msg, &state.cursor_data) { + sp.send_shared(msg.clone()); + state.cursor_data = msg; + } } } sp.snapshot(|sps| { @@ -562,7 +569,7 @@ fn cursor_shape_message( // filed would grow for the life of the service, each entry a u64 and an Arc even when every one // names the same shape. Past this many handles, or this many bytes of compressed shapes, however // few, the handles and the shapes start over together: a handle shown again is captured and named -// again. +// again. macOS files no handles, so there the bytes alone bound the shapes. const CURSOR_HANDLES_MAX: usize = 4096; const CURSOR_SHAPES_BYTES_MAX: usize = 32 << 20;