x11/keymap: Silence deprecation warnings around a fallback
authorEmmanuele Bassi <ebassi@linux.intel.com>
Mon, 19 Mar 2012 14:40:46 +0000 (14:40 +0000)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Mon, 19 Mar 2012 14:40:46 +0000 (14:40 +0000)
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

index 57e8a8d..d4bbf2c 100644 (file)
@@ -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;