[gtk+] wayland: update to work with stable libxkbcommon



commit 21cf5a7e0018675585a58ed6d3d379ba7028be39
Author: Ran Benita <ran234 gmail com>
Date:   Fri Oct 26 02:52:30 2012 +0200

    wayland: update to work with stable libxkbcommon
    
    libxkbcommon has had some changes to its API. However, it now has a
    stable release (0.2.0), so this makes the necessary changes, and
    replaces all uses of the deprecated API.
    
    Signed-off-by: Ran Benita <ran234 gmail com>

 configure.ac                            |    2 +-
 gdk/wayland/gdkdevice-wayland.c         |   23 +++++++++--------------
 gdk/wayland/gdkdisplaymanager-wayland.c |    2 +-
 gdk/wayland/gdkkeys-wayland.c           |    4 ++--
 4 files changed, 13 insertions(+), 18 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 7e982de..de69ffe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -407,7 +407,7 @@ if test "x$enable_wayland_backend" = "xyes"; then
   have_gio_unix=yes
   GDK_WINDOWING="$GDK_WINDOWING
 #define GDK_WINDOWING_WAYLAND"
-  WAYLAND_PACKAGES="wayland-client >= 1.0.0 xkbcommon wayland-cursor"
+  WAYLAND_PACKAGES="wayland-client >= 1.0.0 xkbcommon >= 0.2.0 wayland-cursor"
   if test "x$enable_wayland_cairo_gl" = "xyes"; then
     WAYLAND_PACKAGES="$WAYLAND_PACKAGES wayland-egl egl"
   fi
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index cef1ddf..5126e90 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -1241,14 +1241,14 @@ static GdkModifierType
 get_modifier (struct xkb_state *state)
 {
   GdkModifierType modifiers = 0;
-  modifiers |= (xkb_state_mod_name_is_active (state, XKB_MOD_NAME_SHIFT, XKB_STATE_EFFECTIVE) > 0)?GDK_SHIFT_MASK:0;
-  modifiers |= (xkb_state_mod_name_is_active (state, XKB_MOD_NAME_CAPS, XKB_STATE_EFFECTIVE) > 0)?GDK_LOCK_MASK:0;
-  modifiers |= (xkb_state_mod_name_is_active (state, XKB_MOD_NAME_CTRL, XKB_STATE_EFFECTIVE) > 0)?GDK_CONTROL_MASK:0;
-  modifiers |= (xkb_state_mod_name_is_active (state, XKB_MOD_NAME_ALT, XKB_STATE_EFFECTIVE) > 0)?GDK_MOD1_MASK:0;
-  modifiers |= (xkb_state_mod_name_is_active (state, "Mod2", XKB_STATE_EFFECTIVE) > 0)?GDK_MOD2_MASK:0;
-  modifiers |= (xkb_state_mod_name_is_active (state, "Mod3", XKB_STATE_EFFECTIVE) > 0)?GDK_MOD3_MASK:0;
-  modifiers |= (xkb_state_mod_name_is_active (state, XKB_MOD_NAME_LOGO, XKB_STATE_EFFECTIVE) > 0)?GDK_MOD4_MASK:0;
-  modifiers |= (xkb_state_mod_name_is_active (state, "Mod5", XKB_STATE_EFFECTIVE) > 0)?GDK_MOD5_MASK:0;
+  modifiers |= (xkb_state_mod_name_is_active (state, XKB_MOD_NAME_SHIFT, XKB_STATE_MODS_EFFECTIVE) > 0)?GDK_SHIFT_MASK:0;
+  modifiers |= (xkb_state_mod_name_is_active (state, XKB_MOD_NAME_CAPS, XKB_STATE_MODS_EFFECTIVE) > 0)?GDK_LOCK_MASK:0;
+  modifiers |= (xkb_state_mod_name_is_active (state, XKB_MOD_NAME_CTRL, XKB_STATE_MODS_EFFECTIVE) > 0)?GDK_CONTROL_MASK:0;
+  modifiers |= (xkb_state_mod_name_is_active (state, XKB_MOD_NAME_ALT, XKB_STATE_MODS_EFFECTIVE) > 0)?GDK_MOD1_MASK:0;
+  modifiers |= (xkb_state_mod_name_is_active (state, "Mod2", XKB_STATE_MODS_EFFECTIVE) > 0)?GDK_MOD2_MASK:0;
+  modifiers |= (xkb_state_mod_name_is_active (state, "Mod3", XKB_STATE_MODS_EFFECTIVE) > 0)?GDK_MOD3_MASK:0;
+  modifiers |= (xkb_state_mod_name_is_active (state, XKB_MOD_NAME_LOGO, XKB_STATE_MODS_EFFECTIVE) > 0)?GDK_MOD4_MASK:0;
+  modifiers |= (xkb_state_mod_name_is_active (state, "Mod5", XKB_STATE_MODS_EFFECTIVE) > 0)?GDK_MOD5_MASK:0;
 
   return modifiers;
 }
@@ -1325,16 +1325,11 @@ deliver_key_event(GdkWaylandDevice *device,
   struct xkb_state *xkb_state;
   GdkKeymap *keymap;
   xkb_keysym_t sym;
-  uint32_t num_syms;
-  const xkb_keysym_t *syms;
 
   keymap = device->keymap;
   xkb_state = _gdk_wayland_keymap_get_xkb_state (keymap);
 
-  num_syms = xkb_key_get_syms (xkb_state, key, &syms);
-  sym = XKB_KEY_NoSymbol;
-  if (num_syms == 1)
-    sym = syms[0];
+  sym = xkb_state_key_get_one_sym (xkb_state, key);
 
   device->time = time;
   device->modifiers = get_modifier (xkb_state);
diff --git a/gdk/wayland/gdkdisplaymanager-wayland.c b/gdk/wayland/gdkdisplaymanager-wayland.c
index 1a327b3..e04a1ea 100644
--- a/gdk/wayland/gdkdisplaymanager-wayland.c
+++ b/gdk/wayland/gdkdisplaymanager-wayland.c
@@ -136,7 +136,7 @@ gdk_wayland_display_manager_lookup_keyval (GdkDisplayManager *manager,
 {
   g_return_val_if_fail (keyval_name != NULL, 0);
 
-  return xkb_keysym_from_name(keyval_name);
+  return xkb_keysym_from_name (keyval_name, 0);
 }
 
 static gchar *
diff --git a/gdk/wayland/gdkkeys-wayland.c b/gdk/wayland/gdkkeys-wayland.c
index b63079d..4d10e67 100644
--- a/gdk/wayland/gdkkeys-wayland.c
+++ b/gdk/wayland/gdkkeys-wayland.c
@@ -221,7 +221,7 @@ _gdk_wayland_keymap_new ()
   names.layout = "us";
   names.variant = "";
   names.options = "";
-  keymap->xkb_keymap = xkb_map_new_from_names(context, &names, XKB_MAP_COMPILE_PLACEHOLDER);
+  keymap->xkb_keymap = xkb_keymap_new_from_names (context, &names, 0);
   keymap->xkb_state = xkb_state_new (keymap->xkb_keymap);
   xkb_context_unref (context);
 
@@ -246,7 +246,7 @@ _gdk_wayland_keymap_new_from_fd (uint32_t format,
     return NULL;
   }
 
-  keymap->xkb_keymap = xkb_map_new_from_string (context, map_str, format, XKB_MAP_COMPILE_PLACEHOLDER);
+  keymap->xkb_keymap = xkb_keymap_new_from_string (context, map_str, format, 0);
   munmap (map_str, size);
   close (fd);
   keymap->xkb_state = xkb_state_new (keymap->xkb_keymap);



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