refact: show my cursor (#12765)

1. Show not supported on Win7.
2. Enabling "Show my cursor" automatically enables "View mode".

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou
2025-08-29 01:06:37 +08:00
committed by GitHub
parent a98852e279
commit 7ca8e0d437
2 changed files with 38 additions and 14 deletions

View File

@@ -3703,9 +3703,26 @@ impl Connection {
use crate::whiteboard;
self.show_my_cursor = q == BoolOption::Yes;
if q == BoolOption::Yes {
whiteboard::register_whiteboard(whiteboard::get_key_cursor(self.inner.id));
if crate::platform::windows::is_win_10_or_greater() {
whiteboard::register_whiteboard(whiteboard::get_key_cursor(self.inner.id));
} else {
let mut msg_out = Message::new();
let res = MessageBox {
msgtype: "nook-nocancel-hasclose".to_owned(),
title: "Show my cursor".to_owned(),
text: "Windows 10 or greater is required.".to_owned(),
link: "".to_owned(),
..Default::default()
};
msg_out.set_message_box(res);
self.send(msg_out).await;
}
} else {
whiteboard::unregister_whiteboard(whiteboard::get_key_cursor(self.inner.id));
if crate::platform::windows::is_win_10_or_greater() {
whiteboard::unregister_whiteboard(whiteboard::get_key_cursor(
self.inner.id,
));
}
}
}
}