[clutter] x11/keymap: Silence deprecation warnings around a fallback



commit 5a77f814abfee368e4322d5dacbfce1869bc3149
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Mon Mar 19 14:40:46 2012 +0000

    x11/keymap: Silence deprecation warnings around a fallback
    
    We still use XKeycodeToKeysym() in a fallback path in case we're not
    running on a decent enough system; XKeycodeToKeysym() is deprecated as
    of version 1.12 of the X server, but since I don't want to copy a bunch
    of code from GDK or, god forbid, from Xlib, for a fallback path, it's
    probably more reasonable to just silence the compiler warnings - at
    least until we can drop all the X compatibility crap, and just use
    modern, or semi-modern, API.

 clutter/x11/clutter-keymap-x11.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/clutter/x11/clutter-keymap-x11.c b/clutter/x11/clutter-keymap-x11.c
index 57e8a8d..d4bbf2c 100644
--- a/clutter/x11/clutter-keymap-x11.c
+++ b/clutter/x11/clutter-keymap-x11.c
@@ -409,6 +409,29 @@ _clutter_keymap_x11_get_caps_lock_state (ClutterKeymapX11 *keymap)
   return keymap->caps_lock_state;
 }
 
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+
+/* XXX - yes, I know that XKeycodeToKeysym() has been deprecated; hopefully,
+ * this code will never get run on any decent system that is also able to
+ * run Clutter. I just don't want to copy the implementation inside GDK for
+ * a fallback path.
+ */
+static int
+translate_keysym (ClutterKeymapX11 *keymap,
+                  guint             hardware_keycode)
+{
+  ClutterBackendX11 *backend_x11;
+  gint retval;
+
+  backend_x11 = CLUTTER_BACKEND_X11 (keymap->backend);
+
+  retval = XKeycodeToKeysym (backend_x11->xdpy, hardware_keycode, 0);
+
+  return retval;
+}
+
+G_GNUC_END_IGNORE_DEPRECATIONS
+
 gint
 _clutter_keymap_x11_translate_key_state (ClutterKeymapX11    *keymap,
                                          guint                hardware_keycode,
@@ -440,7 +463,7 @@ _clutter_keymap_x11_translate_key_state (ClutterKeymapX11    *keymap,
     }
   else
 #endif /* HAVE_XKB */
-    retval = XKeycodeToKeysym (backend_x11->xdpy, hardware_keycode, 0);
+    retval = translate_keysym (keymap, hardware_keycode);
 
   if (mods_p)
     *mods_p = unconsumed_modifiers;



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