summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2011-07-01 13:32:30 +0100
committerBastien Nocera <hadess@hadess.net>2011-07-01 13:33:46 +0100
commitd73063ca2ce0cb01f35cef4396876d8dd2032362 (patch)
treefcc9d8723cdeefd867ab3d13c6d9769c861ad2c6
parent96cc9c0e7e8cba15a52018043b590d94828f369a (diff)
downloadgnome-settings-daemon-d73063ca2ce0cb01f35cef4396876d8dd2032362.tar.gz
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
-rw-r--r--plugins/common/gsd-keygrab.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/plugins/common/gsd-keygrab.c b/plugins/common/gsd-keygrab.c
index 17e287c9..31c1ba67 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_KEY_F1
+#define FKEYS_RANGE_MAX GDK_KEY_F35
+
#define IN_RANGE(x, min, max) (x >= min && x <= max)
static void
@@ -139,11 +142,12 @@ 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)) {
GString *keycodes;
keycodes = g_string_new ("");