mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-04-05 21:41:28 +03:00
refact: option, touch mode, move to local (#13055)
Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
@@ -230,7 +230,6 @@ List<(String, String)> otherDefaultSettings() {
|
|||||||
('Disable clipboard', kOptionDisableClipboard),
|
('Disable clipboard', kOptionDisableClipboard),
|
||||||
('Lock after session end', kOptionLockAfterSessionEnd),
|
('Lock after session end', kOptionLockAfterSessionEnd),
|
||||||
('Privacy mode', kOptionPrivacyMode),
|
('Privacy mode', kOptionPrivacyMode),
|
||||||
if (isMobile) ('Touch mode', kOptionTouchMode),
|
|
||||||
('True color (4:4:4)', kOptionI444),
|
('True color (4:4:4)', kOptionI444),
|
||||||
('Reverse mouse wheel', kKeyReverseMouseWheel),
|
('Reverse mouse wheel', kKeyReverseMouseWheel),
|
||||||
('swap-left-right-mouse', kOptionSwapLeftRightMouse),
|
('swap-left-right-mouse', kOptionSwapLeftRightMouse),
|
||||||
|
|||||||
@@ -803,9 +803,8 @@ class _RemotePageState extends State<RemotePage> with WidgetsBindingObserver {
|
|||||||
touchMode: gFFI.ffiModel.touchMode,
|
touchMode: gFFI.ffiModel.touchMode,
|
||||||
onTouchModeChange: (t) {
|
onTouchModeChange: (t) {
|
||||||
gFFI.ffiModel.toggleTouchMode();
|
gFFI.ffiModel.toggleTouchMode();
|
||||||
final v = gFFI.ffiModel.touchMode ? 'Y' : '';
|
final v = gFFI.ffiModel.touchMode ? 'Y' : 'N';
|
||||||
bind.sessionPeerOption(
|
bind.mainSetLocalOption(key: kOptionTouchMode, value: v);
|
||||||
sessionId: sessionId, name: kOptionTouchMode, value: v);
|
|
||||||
},
|
},
|
||||||
virtualMouseMode: gFFI.ffiModel.virtualMouseMode,
|
virtualMouseMode: gFFI.ffiModel.virtualMouseMode,
|
||||||
)));
|
)));
|
||||||
|
|||||||
@@ -1107,9 +1107,20 @@ class FfiModel with ChangeNotifier {
|
|||||||
if (isPeerAndroid) {
|
if (isPeerAndroid) {
|
||||||
_touchMode = true;
|
_touchMode = true;
|
||||||
} else {
|
} else {
|
||||||
_touchMode = await bind.sessionGetOption(
|
// `kOptionTouchMode` is originally peer option, but it is moved to local option later.
|
||||||
sessionId: sessionId, arg: kOptionTouchMode) !=
|
// We check local option first, if not set, then check peer option.
|
||||||
'';
|
// Because if local option is not empty:
|
||||||
|
// 1. User has set the touch mode explicitly.
|
||||||
|
// 2. The advanced option (custom client) is set.
|
||||||
|
// Then we choose to use the local option.
|
||||||
|
final optLocal = bind.mainGetLocalOption(key: kOptionTouchMode);
|
||||||
|
if (optLocal != '') {
|
||||||
|
_touchMode = optLocal == 'Y';
|
||||||
|
} else {
|
||||||
|
final optSession = await bind.sessionGetOption(
|
||||||
|
sessionId: sessionId, arg: kOptionTouchMode);
|
||||||
|
_touchMode = optSession != '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (isMobile) {
|
if (isMobile) {
|
||||||
virtualMouseMode.loadOptions();
|
virtualMouseMode.loadOptions();
|
||||||
|
|||||||
Reference in New Issue
Block a user