[gtk+] wayland: Implement gdk_keymap_get_modifier_state
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] wayland: Implement gdk_keymap_get_modifier_state
- Date: Sun, 7 Apr 2013 01:16:56 +0000 (UTC)
commit 6629e839d0f9f9812ec52dbcf487ff35af09ad5b
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Apr 6 21:16:38 2013 -0400
wayland: Implement gdk_keymap_get_modifier_state
gdk/wayland/gdkdevice-wayland.c | 18 +-----------------
gdk/wayland/gdkkeys-wayland.c | 13 +++++++++++++
2 files changed, 14 insertions(+), 17 deletions(-)
---
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index b793b92..8cf8447 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -903,22 +903,6 @@ keyboard_handle_leave (void *data,
static gboolean
keyboard_repeat (gpointer data);
-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_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;
-}
-
static void
translate_keyboard_string (GdkEventKey *event)
{
@@ -1024,7 +1008,7 @@ deliver_key_event(GdkWaylandDeviceData *device,
sym = xkb_state_key_get_one_sym (xkb_state, key);
device->time = time;
- device->modifiers = get_modifier (xkb_state);
+ device->modifiers = gdk_keymap_get_modifier_state (keymap);
event = gdk_event_new (state ? GDK_KEY_PRESS : GDK_KEY_RELEASE);
event->key.window = device->keyboard_focus?g_object_ref (device->keyboard_focus):NULL;
diff --git a/gdk/wayland/gdkkeys-wayland.c b/gdk/wayland/gdkkeys-wayland.c
index 6af2985..4e8e739 100644
--- a/gdk/wayland/gdkkeys-wayland.c
+++ b/gdk/wayland/gdkkeys-wayland.c
@@ -333,6 +333,18 @@ gdk_wayland_keymap_translate_keyboard_state (GdkKeymap *keymap,
return TRUE;
}
+static guint
+gdk_wayland_keymap_get_modifier_state (GdkKeymap *keymap)
+{
+ struct xkb_keymap *xkb_keymap = GDK_WAYLAND_KEYMAP (keymap)->xkb_keymap;
+ struct xkb_state *xkb_state = GDK_WAYLAND_KEYMAP (keymap)->xkb_state;
+ xkb_mod_mask_t mods;
+
+ mods = xkb_state_serialize_mods (xkb_state, XKB_STATE_MODS_EFFECTIVE);
+
+ return get_gdk_modifiers (xkb_keymap, mods);
+}
+
static void
gdk_wayland_keymap_add_virtual_modifiers (GdkKeymap *keymap,
GdkModifierType *state)
@@ -363,6 +375,7 @@ _gdk_wayland_keymap_class_init (GdkWaylandKeymapClass *klass)
keymap_class->get_entries_for_keycode = gdk_wayland_keymap_get_entries_for_keycode;
keymap_class->lookup_key = gdk_wayland_keymap_lookup_key;
keymap_class->translate_keyboard_state = gdk_wayland_keymap_translate_keyboard_state;
+ keymap_class->get_modifier_state = gdk_wayland_keymap_get_modifier_state;
keymap_class->add_virtual_modifiers = gdk_wayland_keymap_add_virtual_modifiers;
keymap_class->map_virtual_modifiers = gdk_wayland_keymap_map_virtual_modifiers;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]