[gnome-settings-daemon] common: Use defines instead of variables for ranges



commit 96cc9c0e7e8cba15a52018043b590d94828f369a
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Jul 1 13:28:51 2011 +0100

    common: Use defines instead of variables for ranges
    
    Seeing as those won't ever change.

 plugins/common/gsd-keygrab.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/plugins/common/gsd-keygrab.c b/plugins/common/gsd-keygrab.c
index 464f6e8..17e287c 100644
--- a/plugins/common/gsd-keygrab.c
+++ b/plugins/common/gsd-keygrab.c
@@ -42,8 +42,10 @@ static GdkModifierType gsd_ignored_mods = 0;
 static GdkModifierType gsd_used_mods = 0;
 
 /* Taken from a comment in XF86keysym.h */
-static guint gsd_unmodified_keysym_min = 0x10080001;
-static guint gsd_unmodified_keysym_max = 0x1008FFFF;
+#define XF86KEYS_RANGE_MIN 0x10080001
+#define XF86KEYS_RANGE_MAX 0x1008FFFF
+
+#define IN_RANGE(x, min, max) (x >= min && x <= max)
 
 static void
 setup_modifiers (void)
@@ -141,8 +143,7 @@ grab_key_unsafe (Key                 *key,
          * a modifier).
          */
         if ((modifiers & gsd_used_mods) == 0 &&
-            ((key->keysym < gsd_unmodified_keysym_min) ||
-             (key->keysym > gsd_unmodified_keysym_max))) {
+            (IN_RANGE(key->keysym, XF86KEYS_RANGE_MIN, XF86KEYS_RANGE_MAX))) {
                 GString *keycodes;
 
                 keycodes = g_string_new ("");



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