summaryrefslogtreecommitdiff
blob: 6603f7e221736f0148811d706679dd72426aca33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
From bc6561d2b2adbe39e928528dfaba2d129b143952 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Fri, 01 Jul 2011 12:32:30 +0000
Subject: 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
---
diff --git a/plugins/common/gsd-keygrab.c b/plugins/common/gsd-keygrab.c
index 17e287c..31c1ba6 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 ("");
--
cgit v0.9