mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-05-11 18:36:11 +02:00
move 'swap key' and 'swap left right mouse' to keyboard menu (#6650)
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
2e146190e1
commit
c061eddf2a
3 changed files with 47 additions and 28 deletions
|
@ -486,21 +486,6 @@ Future<List<TToggleMenu>> toolbarDisplayToggle(
|
|||
},
|
||||
child: Text(translate('Lock after session end'))));
|
||||
}
|
||||
// swap key
|
||||
if (ffiModel.keyboard &&
|
||||
((Platform.isMacOS && pi.platform != kPeerPlatformMacOS) ||
|
||||
(!Platform.isMacOS && pi.platform == kPeerPlatformMacOS))) {
|
||||
final option = 'allow_swap_key';
|
||||
final value =
|
||||
bind.sessionGetToggleOptionSync(sessionId: sessionId, arg: option);
|
||||
v.add(TToggleMenu(
|
||||
value: value,
|
||||
onChanged: (value) {
|
||||
if (value == null) return;
|
||||
bind.sessionToggleOption(sessionId: sessionId, value: option);
|
||||
},
|
||||
child: Text(translate('Swap control-command key'))));
|
||||
}
|
||||
|
||||
if (useTextureRender &&
|
||||
pi.isSupportMultiDisplay &&
|
||||
|
@ -552,17 +537,8 @@ Future<List<TToggleMenu>> toolbarDisplayToggle(
|
|||
child: Text(translate('True color (4:4:4)'))));
|
||||
}
|
||||
|
||||
if (ffiModel.keyboard) {
|
||||
final option = 'swap-left-right-mouse';
|
||||
final value =
|
||||
bind.sessionGetToggleOptionSync(sessionId: sessionId, arg: option);
|
||||
v.add(TToggleMenu(
|
||||
value: value,
|
||||
onChanged: (value) {
|
||||
if (value == null) return;
|
||||
bind.sessionToggleOption(sessionId: sessionId, value: option);
|
||||
},
|
||||
child: Text(translate('swap-left-right-mouse'))));
|
||||
if (isMobile) {
|
||||
v.addAll(toolbarKeyboardToggles(ffi));
|
||||
}
|
||||
|
||||
return v;
|
||||
|
@ -633,3 +609,41 @@ List<TToggleMenu> toolbarPrivacyMode(
|
|||
}).toList();
|
||||
}
|
||||
}
|
||||
|
||||
List<TToggleMenu> toolbarKeyboardToggles(FFI ffi) {
|
||||
final ffiModel = ffi.ffiModel;
|
||||
final pi = ffiModel.pi;
|
||||
final sessionId = ffi.sessionId;
|
||||
List<TToggleMenu> v = [];
|
||||
|
||||
// swap key
|
||||
if (ffiModel.keyboard &&
|
||||
((Platform.isMacOS && pi.platform != kPeerPlatformMacOS) ||
|
||||
(!Platform.isMacOS && pi.platform == kPeerPlatformMacOS))) {
|
||||
final option = 'allow_swap_key';
|
||||
final value =
|
||||
bind.sessionGetToggleOptionSync(sessionId: sessionId, arg: option);
|
||||
v.add(TToggleMenu(
|
||||
value: value,
|
||||
onChanged: (value) {
|
||||
if (value == null) return;
|
||||
bind.sessionToggleOption(sessionId: sessionId, value: option);
|
||||
},
|
||||
child: Text(translate('Swap control-command key'))));
|
||||
}
|
||||
|
||||
// swap left right mouse
|
||||
if (!isMobile && ffiModel.keyboard) {
|
||||
final option = 'swap-left-right-mouse';
|
||||
final value =
|
||||
bind.sessionGetToggleOptionSync(sessionId: sessionId, arg: option);
|
||||
v.add(TToggleMenu(
|
||||
value: value,
|
||||
onChanged: (value) {
|
||||
if (value == null) return;
|
||||
bind.sessionToggleOption(sessionId: sessionId, value: option);
|
||||
},
|
||||
child: Text(translate('swap-left-right-mouse'))));
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
|
|
@ -1596,6 +1596,10 @@ class _KeyboardMenu extends StatelessWidget {
|
|||
modeOnly = kKeyLegacyMode;
|
||||
}
|
||||
}
|
||||
final toolbarToggles = toolbarKeyboardToggles(ffi)
|
||||
.map((e) => CkbMenuButton(
|
||||
value: e.value, onChanged: e.onChanged, child: e.child, ffi: ffi))
|
||||
.toList();
|
||||
return _IconSubmenuButton(
|
||||
tooltip: 'Keyboard Settings',
|
||||
svg: "assets/keyboard.svg",
|
||||
|
@ -1610,6 +1614,7 @@ class _KeyboardMenu extends StatelessWidget {
|
|||
viewMode(),
|
||||
Divider(),
|
||||
reverseMouseWheel(),
|
||||
...toolbarToggles,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -576,7 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||
("input_source_1_tip", "输入源 1"),
|
||||
("input_source_2_tip", "输入源 2"),
|
||||
("capture_display_elevated_connections_tip", "用户提权后,不能显示多个显示器。若要控制多显示器,请安装后再试。"),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
("Swap control-command key", "交换Control键和Command键"),
|
||||
("swap-left-right-mouse", "交换鼠标左右键"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue