[gnome-settings-daemon/rhel-6.9: 19/25] common: Fix function keys not being grabbed



commit 9af673ac353d04abc0815534faa6ff6d4bb2ca76
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Jul 1 13:32:30 2011 +0100

    common: Fix function keys not being grabbed
    
    Because they were unmodified, and we tried to avoid screwing
    up the user's keymaps for those.
    
    Bug was introduced in 469145ff59fe2a65d603cfeb5011427dc0f7c36b
    
    https://bugzilla.gnome.org/show_bug.cgi?id=649222

 plugins/common/gsd-keygrab.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/plugins/common/gsd-keygrab.c b/plugins/common/gsd-keygrab.c
index 3c0264e..01317c8 100644
--- a/plugins/common/gsd-keygrab.c
+++ b/plugins/common/gsd-keygrab.c
@@ -45,6 +45,9 @@ static GdkModifierType gsd_used_mods = 0;
 #define XF86KEYS_RANGE_MIN 0x10080001
 #define XF86KEYS_RANGE_MAX 0x1008FFFF
 
+#define FKEYS_RANGE_MIN GDK_F1
+#define FKEYS_RANGE_MAX GDK_F35
+
 #define IN_RANGE(x, min, max) (x >= min && x <= max)
 
 static void
@@ -139,11 +142,13 @@ grab_key_unsafe (Key                 *key,
         /* If key doesn't have a usable modifier, we don't want
          * to grab it, since the user might lose a useful key.
          *
-         * The exception is the XFree86 keys (which are useful to grab without
-         * a modifier).
+         * The exception is the XFree86 keys and the Function keys
+         * (which are useful to grab without a modifier).
          */
         if ((modifiers & gsd_used_mods) == 0 &&
-            (IN_RANGE(key->keysym, XF86KEYS_RANGE_MIN, XF86KEYS_RANGE_MAX))) {
+            !IN_RANGE(key->keysym, XF86KEYS_RANGE_MIN, XF86KEYS_RANGE_MAX) &&
+            !IN_RANGE(key->keysym, FKEYS_RANGE_MIN, FKEYS_RANGE_MAX) &&
+             key->keysym != GDK_Pause) {
                 GString *keycodes;
 
                 keycodes = g_string_new ("");


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