[gnome-boxes/keep-display-shortcuts-to-minimum] app-window: Keep shortcuts to a minimum while showing a display



commit dc5b4de1a5efd81e7d889182a46ab5862c48d974
Author: Felipe Borges <felipeborges gnome org>
Date:   Thu Jun 4 16:16:50 2020 +0200

    app-window: Keep shortcuts to a minimum while showing a display
    
    So our overview shortcuts don't conflict with shortcuts that should
    be propagated to the guest.
    
    Fixes #549

 src/app-window.vala | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/src/app-window.vala b/src/app-window.vala
index 03ec5243..9acbdf96 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -402,7 +402,19 @@ public bool on_key_pressed (Widget widget, Gdk.EventKey event) {
             fullscreened = !fullscreened;
 
             return true;
-        } else if (event.keyval == Gdk.Key.F1) {
+        } else if (((direction == Gtk.TextDirection.LTR && // LTR
+                     event.keyval == Gdk.Key.Left) ||      // ALT + Left -> back
+                    (direction == Gtk.TextDirection.RTL && // RTL
+                     event.keyval == Gdk.Key.Right)) &&    // ALT + Right -> back
+                   (event.state & default_modifiers) == Gdk.ModifierType.MOD1_MASK) {
+            topbar.click_back_button ();
+            return true;
+        }
+
+        if (ui_state == UIState.DISPLAY)
+            return false;
+
+        if (event.keyval == Gdk.Key.F1) {
             App.app.activate_action ("help", null);
 
             return true;
@@ -412,9 +424,6 @@ public bool on_key_pressed (Widget widget, Gdk.EventKey event) {
             return true;
         } else if (event.keyval == Gdk.Key.q &&
                    (event.state & default_modifiers) == Gdk.ModifierType.CONTROL_MASK) {
-            if (ui_state == UIState.DISPLAY)
-                return false;
-
             App.app.quit_app ();
 
             return true;
@@ -443,13 +452,6 @@ public bool on_key_pressed (Widget widget, Gdk.EventKey event) {
                    (event.state & default_modifiers) == (Gdk.ModifierType.CONTROL_MASK | 
Gdk.ModifierType.SHIFT_MASK)) {
             foreach_view ((view) => { view.unselect_all (); });
 
-            return true;
-        } else if (((direction == Gtk.TextDirection.LTR && // LTR
-                     event.keyval == Gdk.Key.Left) ||      // ALT + Left -> back
-                    (direction == Gtk.TextDirection.RTL && // RTL
-                     event.keyval == Gdk.Key.Right)) &&    // ALT + Right -> back
-                   (event.state & default_modifiers) == Gdk.ModifierType.MOD1_MASK) {
-            topbar.click_back_button ();
             return true;
         } else if (event.keyval == Gdk.Key.Escape) { // ESC -> cancel
             topbar.click_cancel_button ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]