mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-04-06 02:41:29 +03:00
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:
@@ -1763,18 +1763,25 @@ class _KeyboardMenu extends StatelessWidget {
|
|||||||
final ffiModel = ffi.ffiModel;
|
final ffiModel = ffi.ffiModel;
|
||||||
return CkbMenuButton(
|
return CkbMenuButton(
|
||||||
value: ffiModel.showMyCursor,
|
value: ffiModel.showMyCursor,
|
||||||
onChanged: ffiModel.viewOnly
|
onChanged: (value) async {
|
||||||
? (value) async {
|
if (value == null) return;
|
||||||
if (value == null) return;
|
await bind.sessionToggleOption(
|
||||||
await bind.sessionToggleOption(
|
sessionId: ffi.sessionId, value: kOptionToggleShowMyCursor);
|
||||||
sessionId: ffi.sessionId,
|
final showMyCursor = await bind.sessionGetToggleOption(
|
||||||
value: kOptionToggleShowMyCursor);
|
sessionId: ffi.sessionId,
|
||||||
final showMyCursor = await bind.sessionGetToggleOption(
|
arg: kOptionToggleShowMyCursor) ??
|
||||||
sessionId: ffi.sessionId,
|
value;
|
||||||
arg: kOptionToggleShowMyCursor);
|
ffiModel.setShowMyCursor(showMyCursor);
|
||||||
ffiModel.setShowMyCursor(showMyCursor ?? value);
|
|
||||||
}
|
// Also set view only if showMyCursor is enabled and viewOnly is not enabled.
|
||||||
: null,
|
if (showMyCursor && !ffiModel.viewOnly) {
|
||||||
|
await bind.sessionToggleOption(
|
||||||
|
sessionId: ffi.sessionId, value: kOptionToggleViewOnly);
|
||||||
|
final viewOnly = await bind.sessionGetToggleOption(
|
||||||
|
sessionId: ffi.sessionId, arg: kOptionToggleViewOnly);
|
||||||
|
ffiModel.setViewOnly(id, viewOnly ?? value);
|
||||||
|
}
|
||||||
|
},
|
||||||
ffi: ffi,
|
ffi: ffi,
|
||||||
child: Text(translate('Show my cursor')))
|
child: Text(translate('Show my cursor')))
|
||||||
.paddingOnly(left: 26.0);
|
.paddingOnly(left: 26.0);
|
||||||
|
|||||||
@@ -3703,9 +3703,26 @@ impl Connection {
|
|||||||
use crate::whiteboard;
|
use crate::whiteboard;
|
||||||
self.show_my_cursor = q == BoolOption::Yes;
|
self.show_my_cursor = q == BoolOption::Yes;
|
||||||
if 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 {
|
} 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,
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user