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>
This commit is contained in:
Ran Benita 2012-10-26 02:52:30 +02:00 committed by Rob Bradford
parent 3338f6cb5b
commit 21cf5a7e00
4 changed files with 13 additions and 18 deletions

View File

@ -407,7 +407,7 @@ if test "x$enable_wayland_backend" = "xyes"; then
have_gio_unix=yes have_gio_unix=yes
GDK_WINDOWING="$GDK_WINDOWING GDK_WINDOWING="$GDK_WINDOWING
#define GDK_WINDOWING_WAYLAND" #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 if test "x$enable_wayland_cairo_gl" = "xyes"; then
WAYLAND_PACKAGES="$WAYLAND_PACKAGES wayland-egl egl" WAYLAND_PACKAGES="$WAYLAND_PACKAGES wayland-egl egl"
fi fi

View File

@ -1241,14 +1241,14 @@ static GdkModifierType
get_modifier (struct xkb_state *state) get_modifier (struct xkb_state *state)
{ {
GdkModifierType modifiers = 0; 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_SHIFT, XKB_STATE_MODS_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_CAPS, XKB_STATE_MODS_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_CTRL, XKB_STATE_MODS_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, XKB_MOD_NAME_ALT, XKB_STATE_MODS_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, "Mod2", XKB_STATE_MODS_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, "Mod3", XKB_STATE_MODS_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, XKB_MOD_NAME_LOGO, XKB_STATE_MODS_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, "Mod5", XKB_STATE_MODS_EFFECTIVE) > 0)?GDK_MOD5_MASK:0;
return modifiers; return modifiers;
} }
@ -1325,16 +1325,11 @@ deliver_key_event(GdkWaylandDevice *device,
struct xkb_state *xkb_state; struct xkb_state *xkb_state;
GdkKeymap *keymap; GdkKeymap *keymap;
xkb_keysym_t sym; xkb_keysym_t sym;
uint32_t num_syms;
const xkb_keysym_t *syms;
keymap = device->keymap; keymap = device->keymap;
xkb_state = _gdk_wayland_keymap_get_xkb_state (keymap); xkb_state = _gdk_wayland_keymap_get_xkb_state (keymap);
num_syms = xkb_key_get_syms (xkb_state, key, &syms); sym = xkb_state_key_get_one_sym (xkb_state, key);
sym = XKB_KEY_NoSymbol;
if (num_syms == 1)
sym = syms[0];
device->time = time; device->time = time;
device->modifiers = get_modifier (xkb_state); device->modifiers = get_modifier (xkb_state);

View File

@ -136,7 +136,7 @@ gdk_wayland_display_manager_lookup_keyval (GdkDisplayManager *manager,
{ {
g_return_val_if_fail (keyval_name != NULL, 0); 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 * static gchar *

View File

@ -221,7 +221,7 @@ _gdk_wayland_keymap_new ()
names.layout = "us"; names.layout = "us";
names.variant = ""; names.variant = "";
names.options = ""; 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); keymap->xkb_state = xkb_state_new (keymap->xkb_keymap);
xkb_context_unref (context); xkb_context_unref (context);
@ -246,7 +246,7 @@ _gdk_wayland_keymap_new_from_fd (uint32_t format,
return NULL; 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); munmap (map_str, size);
close (fd); close (fd);
keymap->xkb_state = xkb_state_new (keymap->xkb_keymap); keymap->xkb_state = xkb_state_new (keymap->xkb_keymap);