mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-11-24 20:59:37 +08:00
show keyboard button, on remote toolbar
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
954bedcd96
commit
77c4cce368
@ -317,6 +317,9 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
|
||||
RxBool get show => widget.state.show;
|
||||
bool get pin => widget.state.pin;
|
||||
|
||||
PeerInfo get pi => widget.ffi.ffiModel.pi;
|
||||
FfiModel get ffiModel => widget.ffi.ffiModel;
|
||||
|
||||
@override
|
||||
initState() {
|
||||
super.initState();
|
||||
@ -393,8 +396,7 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
|
||||
toolbarItems.add(_MobileActionMenu(ffi: widget.ffi));
|
||||
}
|
||||
|
||||
if (PrivacyModeState.find(widget.id).isFalse &&
|
||||
widget.ffi.ffiModel.pi.displays.length > 1) {
|
||||
if (PrivacyModeState.find(widget.id).isFalse && pi.displays.length > 1) {
|
||||
toolbarItems.add(
|
||||
bind.mainGetUserDefaultOption(key: 'show_monitors_toolbar') == 'Y'
|
||||
? _MultiMonitorMenu(id: widget.id, ffi: widget.ffi)
|
||||
@ -819,11 +821,10 @@ class _ControlMenu extends StatelessWidget {
|
||||
}
|
||||
|
||||
ctrlAltDel() {
|
||||
final perms = ffi.ffiModel.permissions;
|
||||
final viewOnly = ffi.ffiModel.viewOnly;
|
||||
final pi = ffi.ffiModel.pi;
|
||||
final visible = !viewOnly &&
|
||||
perms['keyboard'] != false &&
|
||||
ffi.ffiModel.keyboard &&
|
||||
(pi.platform == kPeerPlatformLinux || pi.sasEnabled);
|
||||
if (!visible) return Offstage();
|
||||
return _MenuItemButton(
|
||||
@ -847,9 +848,8 @@ class _ControlMenu extends StatelessWidget {
|
||||
}
|
||||
|
||||
insertLock() {
|
||||
final perms = ffi.ffiModel.permissions;
|
||||
final viewOnly = ffi.ffiModel.viewOnly;
|
||||
final visible = !viewOnly && perms['keyboard'] != false;
|
||||
final visible = !viewOnly && ffi.ffiModel.keyboard;
|
||||
if (!visible) return Offstage();
|
||||
return _MenuItemButton(
|
||||
child: Text(translate('Insert Lock')),
|
||||
@ -858,10 +858,9 @@ class _ControlMenu extends StatelessWidget {
|
||||
}
|
||||
|
||||
blockUserInput() {
|
||||
final perms = ffi.ffiModel.permissions;
|
||||
final pi = ffi.ffiModel.pi;
|
||||
final visible =
|
||||
perms['keyboard'] != false && pi.platform == kPeerPlatformWindows;
|
||||
ffi.ffiModel.keyboard && pi.platform == kPeerPlatformWindows;
|
||||
if (!visible) return Offstage();
|
||||
return _MenuItemButton(
|
||||
child: Obx(() => Text(translate(
|
||||
@ -876,9 +875,8 @@ class _ControlMenu extends StatelessWidget {
|
||||
}
|
||||
|
||||
switchSides() {
|
||||
final perms = ffi.ffiModel.permissions;
|
||||
final pi = ffi.ffiModel.pi;
|
||||
final visible = perms['keyboard'] != false &&
|
||||
final visible = ffi.ffiModel.keyboard &&
|
||||
pi.platform != kPeerPlatformAndroid &&
|
||||
pi.platform != kPeerPlatformMacOS &&
|
||||
version_cmp(pi.version, '1.2.0') >= 0;
|
||||
@ -948,6 +946,7 @@ class _DisplayMenuState extends State<_DisplayMenu> {
|
||||
Map<String, bool> get perms => widget.ffi.ffiModel.permissions;
|
||||
|
||||
PeerInfo get pi => widget.ffi.ffiModel.pi;
|
||||
FfiModel get ffiModel => widget.ffi.ffiModel;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -1419,11 +1418,10 @@ class _DisplayMenuState extends State<_DisplayMenu> {
|
||||
}
|
||||
|
||||
resolutions() {
|
||||
final resolutions = widget.ffi.ffiModel.pi.resolutions;
|
||||
final visible = widget.ffi.ffiModel.permissions["keyboard"] != false &&
|
||||
resolutions.length > 1;
|
||||
final resolutions = pi.resolutions;
|
||||
final visible = ffiModel.keyboard && resolutions.length > 1;
|
||||
if (!visible) return Offstage();
|
||||
final display = widget.ffi.ffiModel.display;
|
||||
final display = ffiModel.display;
|
||||
final groupValue = "${display.width}x${display.height}";
|
||||
onChanged(String? value) async {
|
||||
if (value == null) return;
|
||||
@ -1435,7 +1433,7 @@ class _DisplayMenuState extends State<_DisplayMenu> {
|
||||
await bind.sessionChangeResolution(
|
||||
id: widget.id, width: w, height: h);
|
||||
Future.delayed(Duration(seconds: 3), () async {
|
||||
final display = widget.ffi.ffiModel.display;
|
||||
final display = ffiModel.display;
|
||||
if (w == display.width && h == display.height) {
|
||||
if (_isWindowCanBeAdjusted()) {
|
||||
_doAdjustWindow();
|
||||
@ -1460,10 +1458,9 @@ class _DisplayMenuState extends State<_DisplayMenu> {
|
||||
}
|
||||
|
||||
showRemoteCursor() {
|
||||
if (widget.ffi.ffiModel.pi.platform == kPeerPlatformAndroid) {
|
||||
if (pi.platform == kPeerPlatformAndroid) {
|
||||
return Offstage();
|
||||
}
|
||||
final ffiModel = widget.ffi.ffiModel;
|
||||
final visible =
|
||||
!widget.ffi.canvasModel.cursorEmbedded && !ffiModel.pi.is_wayland;
|
||||
if (!visible) return Offstage();
|
||||
@ -1485,7 +1482,7 @@ class _DisplayMenuState extends State<_DisplayMenu> {
|
||||
}
|
||||
|
||||
zoomCursor() {
|
||||
if (widget.ffi.ffiModel.pi.platform == kPeerPlatformAndroid) {
|
||||
if (pi.platform == kPeerPlatformAndroid) {
|
||||
return Offstage();
|
||||
}
|
||||
final visible = widget.state.viewStyle.value != kRemoteViewStyleOriginal;
|
||||
@ -1551,8 +1548,7 @@ class _DisplayMenuState extends State<_DisplayMenu> {
|
||||
}
|
||||
|
||||
disableClipboard() {
|
||||
final ffiModel = widget.ffi.ffiModel;
|
||||
final visible = perms['keyboard'] != false && perms['clipboard'] != false;
|
||||
final visible = ffiModel.keyboard && perms['clipboard'] != false;
|
||||
if (!visible) return Offstage();
|
||||
final enabled = !ffiModel.viewOnly;
|
||||
final option = 'disable-clipboard';
|
||||
@ -1571,8 +1567,7 @@ class _DisplayMenuState extends State<_DisplayMenu> {
|
||||
}
|
||||
|
||||
lockAfterSessionEnd() {
|
||||
final visible = perms['keyboard'] != false;
|
||||
if (!visible) return Offstage();
|
||||
if (!ffiModel.keyboard) return Offstage();
|
||||
final option = 'lock-after-session-end';
|
||||
final value = bind.sessionGetToggleOptionSync(id: widget.id, arg: option);
|
||||
return _CheckboxMenuButton(
|
||||
@ -1586,7 +1581,7 @@ class _DisplayMenuState extends State<_DisplayMenu> {
|
||||
}
|
||||
|
||||
privacyMode() {
|
||||
bool visible = perms['keyboard'] != false && pi.features.privacyMode;
|
||||
bool visible = ffiModel.keyboard && pi.features.privacyMode;
|
||||
if (!visible) return Offstage();
|
||||
final option = 'privacy-mode';
|
||||
final rxValue = PrivacyModeState.find(widget.id);
|
||||
@ -1594,7 +1589,7 @@ class _DisplayMenuState extends State<_DisplayMenu> {
|
||||
value: rxValue.value,
|
||||
onChanged: (value) {
|
||||
if (value == null) return;
|
||||
if (widget.ffi.ffiModel.pi.currentDisplay != 0) {
|
||||
if (ffiModel.pi.currentDisplay != 0) {
|
||||
msgBox(
|
||||
widget.id,
|
||||
'custom-nook-nocancel-hasclose',
|
||||
@ -1611,7 +1606,7 @@ class _DisplayMenuState extends State<_DisplayMenu> {
|
||||
}
|
||||
|
||||
swapKey() {
|
||||
final visible = perms['keyboard'] != false &&
|
||||
final visible = ffiModel.keyboard &&
|
||||
((Platform.isMacOS && pi.platform != kPeerPlatformMacOS) ||
|
||||
(!Platform.isMacOS && pi.platform == kPeerPlatformMacOS));
|
||||
if (!visible) return Offstage();
|
||||
@ -1642,7 +1637,7 @@ class _KeyboardMenu extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var ffiModel = Provider.of<FfiModel>(context);
|
||||
if (ffiModel.permissions['keyboard'] == false) return Offstage();
|
||||
if (!ffiModel.keyboard) return Offstage();
|
||||
if (stateGlobal.grabKeyboard) {
|
||||
if (bind.sessionIsKeyboardModeSupported(id: id, mode: _kKeyMapMode)) {
|
||||
bind.sessionSetKeyboardMode(id: id, value: _kKeyMapMode);
|
||||
@ -1650,7 +1645,6 @@ class _KeyboardMenu extends StatelessWidget {
|
||||
id: id, mode: _kKeyLegacyMode)) {
|
||||
bind.sessionSetKeyboardMode(id: id, value: _kKeyLegacyMode);
|
||||
}
|
||||
return Offstage();
|
||||
}
|
||||
return _IconSubmenuButton(
|
||||
tooltip: 'Keyboard Settings',
|
||||
@ -1728,8 +1722,7 @@ class _KeyboardMenu extends StatelessWidget {
|
||||
|
||||
view_mode() {
|
||||
final ffiModel = ffi.ffiModel;
|
||||
final enabled = version_cmp(pi.version, '1.2.0') >= 0 &&
|
||||
ffiModel.permissions["keyboard"] != false;
|
||||
final enabled = version_cmp(pi.version, '1.2.0') >= 0 && ffiModel.keyboard;
|
||||
return _CheckboxMenuButton(
|
||||
value: ffiModel.viewOnly,
|
||||
onChanged: enabled
|
||||
|
@ -93,7 +93,7 @@ class FfiModel with ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
bool keyboard() => _permissions['keyboard'] != false;
|
||||
bool get keyboard => _permissions['keyboard'] != false;
|
||||
|
||||
clear() {
|
||||
_pi = PeerInfo();
|
||||
|
Loading…
Reference in New Issue
Block a user