[gtk+] mir: implement stub _gdk_mir_keymap_key_is_modifier
- From: William Hua <williamhua src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] mir: implement stub _gdk_mir_keymap_key_is_modifier
- Date: Thu, 5 Feb 2015 16:27:19 +0000 (UTC)
commit 54f9263f19fe076dbc373cb4aea3d59c83e12b9f
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Tue Dec 2 17:08:00 2014 +0100
mir: implement stub _gdk_mir_keymap_key_is_modifier
Using IsModifierKey for now
gdk/mir/gdkmir-private.h | 2 ++
gdk/mir/gdkmireventsource.c | 11 ++++++-----
gdk/mir/gdkmirkeymap.c | 14 ++++++++++++++
3 files changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/gdk/mir/gdkmir-private.h b/gdk/mir/gdkmir-private.h
index 9361b72..7654e08 100644
--- a/gdk/mir/gdkmir-private.h
+++ b/gdk/mir/gdkmir-private.h
@@ -69,6 +69,8 @@ GdkDevice *_gdk_mir_device_manager_get_keyboard (GdkDeviceManager *device_manage
GdkKeymap *_gdk_mir_keymap_new (void);
+gboolean _gdk_mir_keymap_key_is_modifier (GdkKeymap *keymap, guint keycode);
+
GdkDevice *_gdk_mir_keyboard_new (GdkDeviceManager *device_manager, const gchar *name);
GdkDevice *_gdk_mir_pointer_new (GdkDeviceManager *device_manager, const gchar *name);
diff --git a/gdk/mir/gdkmireventsource.c b/gdk/mir/gdkmireventsource.c
index 3f7d9b2..9e317bc 100644
--- a/gdk/mir/gdkmireventsource.c
+++ b/gdk/mir/gdkmireventsource.c
@@ -17,7 +17,6 @@
#include "config.h"
-#include <xkbcommon/xkbcommon.h>
#include "gdkinternals.h"
#include "gdkdisplayprivate.h"
#include "gdkmir.h"
@@ -251,23 +250,25 @@ static void
handle_key_event (GdkWindow *window, const MirKeyEvent *event)
{
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
+ GdkKeymap *keymap;
guint modifier_state;
MirMotionButton button_state;
- _gdk_mir_window_impl_get_cursor_state (impl, NULL, NULL, NULL, &button_state);
- modifier_state = get_modifier_state (event->modifiers, button_state);
-
switch (event->action)
{
case mir_key_action_down:
case mir_key_action_up:
// FIXME: Convert keycode
+ _gdk_mir_window_impl_get_cursor_state (impl, NULL, NULL, NULL, &button_state);
+ modifier_state = get_modifier_state (event->modifiers, button_state);
+ keymap = gdk_keymap_get_for_display (gdk_window_get_display (window));
+
generate_key_event (window,
event->action == mir_key_action_down ? GDK_KEY_PRESS : GDK_KEY_RELEASE,
modifier_state,
event->key_code,
event->scan_code,
- IsModifierKey (event->key_code),
+ _gdk_mir_keymap_key_is_modifier (keymap, event->key_code),
NANO_TO_MILLI (event->event_time));
break;
default:
diff --git a/gdk/mir/gdkmirkeymap.c b/gdk/mir/gdkmirkeymap.c
index 3e8c829..8397db2 100644
--- a/gdk/mir/gdkmirkeymap.c
+++ b/gdk/mir/gdkmirkeymap.c
@@ -31,6 +31,12 @@ typedef struct GdkMirKeymapClass GdkMirKeymapClass;
#define GDK_IS_MIR_KEYMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_MIR_KEYMAP))
#define GDK_MIR_KEYMAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_MIR_KEYMAP,
GdkMirKeymapClass))
+#define IsModifierKey(keysym) \
+ ((keysym >= XKB_KEY_Shift_L && keysym <= XKB_KEY_Hyper_R) || \
+ (keysym >= XKB_KEY_ISO_Lock && keysym <= XKB_KEY_ISO_Last_Group_Lock) || \
+ (keysym == XKB_KEY_Mode_switch) || \
+ (keysym == XKB_KEY_Num_Lock))
+
struct GdkMirKeymap
{
GdkKeymap parent_instance;
@@ -342,6 +348,14 @@ gdk_mir_keymap_get_modifier_state (GdkKeymap *keymap)
return get_gdk_modifiers (mir_keymap->xkb_keymap, mods);
}
+gboolean
+_gdk_mir_keymap_key_is_modifier (GdkKeymap *keymap,
+ guint keycode)
+{
+ // FIXME: use xkb_state
+ return IsModifierKey (keycode);
+}
+
static void
update_direction (GdkMirKeymap *keymap)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]