From f69591d18b9796b4aae1eb07fa5434cd578c1b4f Mon Sep 17 00:00:00 2001 From: fufesou Date: Mon, 5 Oct 2026 22:05:27 -0700 Subject: [PATCH] fix(shortcuts): align recording and display routing Reject non-Apple AltGraph captures to match runtime filtering. Honor individual-display windows for next, previous, and all-display shortcuts. Signed-off-by: fufesou --- .../keyboard_shortcuts/recording_dialog.dart | 7 +++++++ flutter/lib/models/shortcut_model.dart | 18 +++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/flutter/lib/common/widgets/keyboard_shortcuts/recording_dialog.dart b/flutter/lib/common/widgets/keyboard_shortcuts/recording_dialog.dart index ec782cc03..7e5bef638 100644 --- a/flutter/lib/common/widgets/keyboard_shortcuts/recording_dialog.dart +++ b/flutter/lib/common/widgets/keyboard_shortcuts/recording_dialog.dart @@ -185,6 +185,13 @@ class _RecordingDialogState extends State<_RecordingDialog> { setState(() { _mods = mods; + if (!_isMac && + HardwareKeyboard.instance.logicalKeysPressed + .contains(LogicalKeyboardKey.altGraph)) { + _key = null; + _unsupportedKey = LogicalKeyboardKey.altGraph.keyLabel; + return; + } // Match runtime dispatch: modifiers added after a held letter do not // produce a new shortcut key-down event. _key = keyName; diff --git a/flutter/lib/models/shortcut_model.dart b/flutter/lib/models/shortcut_model.dart index 7e9377ddc..82b370534 100644 --- a/flutter/lib/models/shortcut_model.dart +++ b/flutter/lib/models/shortcut_model.dart @@ -335,6 +335,18 @@ void registerSessionShortcutActions( }); } + void openDisplay(int display, PeerInfo pi, {bool updateCursorPos = true}) { + if (isDesktop && + pi.isSupportMultiDisplay && + bind.sessionGetDisplaysAsIndividualWindows(sessionId: sessionId) == + 'Y') { + openMonitorInNewTabOrWindow(display, ffi.id, pi); + } else { + openMonitorInTheSameTab(display, ffi, pi, + updateCursorPos: updateCursorPos); + } + } + // Switch Display Next / Prev — requires the peer to have at least 2 // displays. From the "All displays" merged view, Next jumps to display 0 // and Prev to the last display, so the user can always escape the merged @@ -355,7 +367,7 @@ void registerSessionShortcutActions( } else { next = ((current + delta) % count + count) % count; } - openMonitorInTheSameTab(next, ffi, pi, updateCursorPos: isMobile); + openDisplay(next, pi, updateCursorPos: isMobile); } ffi.shortcutModel.register(kShortcutActionSwitchDisplayNext, () { @@ -371,7 +383,7 @@ void registerSessionShortcutActions( // (Switch to next/previous display, or another monitor button) takes // you back to a single display. // - // Use `openMonitorInTheSameTab(kAllDisplayValue, ...)` rather than calling + // For same-tab view, use `openMonitorInTheSameTab` rather than calling // `sessionSwitchDisplay` with `[kAllDisplayValue]` directly — the toolbar // path treats `kAllDisplayValue` as a UI sentinel and expands it to the // real display index list (`[0, 1, ...]`) before sending, then updates @@ -387,7 +399,7 @@ void registerSessionShortcutActions( } if (pi.displays.length <= 1) return; if (pi.currentDisplay == kAllDisplayValue) return; - openMonitorInTheSameTab(kAllDisplayValue, ffi, pi); + openDisplay(kAllDisplayValue, pi); }); // Switch tab next / prev — desktop only. The remote-screen tabs live in