Commit 54f9263f authored by Marco Trevisan's avatar Marco Trevisan 🎺 Committed by William Hua

mir: implement stub _gdk_mir_keymap_key_is_modifier

Using IsModifierKey for now
parent a8b1e818
......@@ -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);
......
......@@ -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:
......
......@@ -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)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment