[gnome-boxes] app: Take default modifiers into account



commit 2cbbe2006aa67d6691bb49b82e90e23ec6bbadf9
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Aug 28 16:00:46 2013 +0300

    app: Take default modifiers into account
    
    When checking for particular modifier bit in a key event, we must take
    into acount any default modifiers that might be set on the event's state:
    
    https://developer.gnome.org/gtk3/stable/checklist-modifiers.html
    
    This fixes CTRL+Q and ALT+A keyboard shortcuts not working anymore.
    
    Thanks to David Kind and Paolo Borelli for pointing this out.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=706415

 src/app.vala |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index 10326d7..567f6e9 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -875,6 +875,8 @@ private class Boxes.App: Boxes.UI {
     }
 
     private bool on_key_pressed (Widget widget, Gdk.EventKey event) {
+        var default_modifiers = Gtk.accelerator_get_default_mod_mask ();
+
         if (event.keyval == Gdk.Key.F11) {
             fullscreen = !fullscreen;
             return true;
@@ -882,11 +884,11 @@ private class Boxes.App: Boxes.UI {
             if (selection_mode && ui_state == UIState.COLLECTION)
                selection_mode = false;
         } else if (event.keyval == Gdk.Key.q &&
-                   (event.state & Gdk.ModifierType.MODIFIER_MASK) == Gdk.ModifierType.CONTROL_MASK) {
+                   (event.state & default_modifiers) == Gdk.ModifierType.CONTROL_MASK) {
             quit ();
             return true;
         } else if (event.keyval == Gdk.Key.a &&
-                   (event.state & Gdk.ModifierType.MODIFIER_MASK) == Gdk.ModifierType.MOD1_MASK) {
+                   (event.state & default_modifiers) == Gdk.ModifierType.MOD1_MASK) {
             quit ();
             return true;
         }


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