[mutter] keyboard: Don't use a grab interface for sending key events
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] keyboard: Don't use a grab interface for sending key events
- Date: Mon, 28 Apr 2014 20:31:26 +0000 (UTC)
commit eb0c4db46d8ba56b4e27976081b3a9fc7ad779df
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon Apr 28 16:29:28 2014 -0400
keyboard: Don't use a grab interface for sending key events
src/wayland/meta-wayland-keyboard.c | 39 ++++++++++------------------------
src/wayland/meta-wayland-keyboard.h | 26 -----------------------
src/wayland/meta-wayland-types.h | 2 -
3 files changed, 12 insertions(+), 55 deletions(-)
---
diff --git a/src/wayland/meta-wayland-keyboard.c b/src/wayland/meta-wayland-keyboard.c
index fb2065f..8626722 100644
--- a/src/wayland/meta-wayland-keyboard.c
+++ b/src/wayland/meta-wayland-keyboard.c
@@ -220,10 +220,9 @@ keyboard_handle_focus_surface_destroy (struct wl_listener *listener, void *data)
}
static gboolean
-default_grab_key (MetaWaylandKeyboardGrab *grab,
- uint32_t time, uint32_t key, uint32_t state)
+notify_key (MetaWaylandKeyboard *keyboard,
+ uint32_t time, uint32_t key, uint32_t state)
{
- MetaWaylandKeyboard *keyboard = grab->keyboard;
struct wl_resource *resource;
struct wl_list *l;
@@ -245,11 +244,10 @@ default_grab_key (MetaWaylandKeyboardGrab *grab,
}
static void
-default_grab_modifiers (MetaWaylandKeyboardGrab *grab, uint32_t serial,
- uint32_t mods_depressed, uint32_t mods_latched,
- uint32_t mods_locked, uint32_t group)
+notify_modifiers (MetaWaylandKeyboard *keyboard, uint32_t serial,
+ uint32_t mods_depressed, uint32_t mods_latched,
+ uint32_t mods_locked, uint32_t group)
{
- MetaWaylandKeyboard *keyboard = grab->keyboard;
struct wl_resource *resource;
struct wl_list *l;
@@ -261,11 +259,6 @@ default_grab_modifiers (MetaWaylandKeyboardGrab *grab, uint32_t serial,
}
}
-static const MetaWaylandKeyboardGrabInterface default_keyboard_grab_interface = {
- default_grab_key,
- default_grab_modifiers,
-};
-
void
meta_wayland_keyboard_init (MetaWaylandKeyboard *keyboard,
struct wl_display *display)
@@ -279,10 +272,6 @@ meta_wayland_keyboard_init (MetaWaylandKeyboard *keyboard,
keyboard->focus_surface_listener.notify = keyboard_handle_focus_surface_destroy;
- keyboard->default_grab.interface = &default_keyboard_grab_interface;
- keyboard->default_grab.keyboard = keyboard;
- keyboard->grab = &keyboard->default_grab;
-
wl_array_init (&keyboard->keys);
keyboard->xkb_context = xkb_context_new (0 /* flags */);
@@ -370,7 +359,6 @@ void
meta_wayland_keyboard_update (MetaWaylandKeyboard *keyboard,
const ClutterKeyEvent *event)
{
- MetaWaylandKeyboardGrab *grab = keyboard->grab;
gboolean is_press = event->type == CLUTTER_KEY_PRESS;
struct xkb_state *state = keyboard->xkb_info.state;
enum xkb_state_component changed_state;
@@ -383,12 +371,12 @@ meta_wayland_keyboard_update (MetaWaylandKeyboard *keyboard,
if (changed_state == 0)
return;
- grab->interface->modifiers (grab,
- wl_display_next_serial (keyboard->display),
- xkb_state_serialize_mods (state, XKB_STATE_MODS_DEPRESSED),
- xkb_state_serialize_mods (state, XKB_STATE_MODS_LATCHED),
- xkb_state_serialize_mods (state, XKB_STATE_MODS_LOCKED),
- xkb_state_serialize_layout (state, XKB_STATE_LAYOUT_EFFECTIVE));
+ notify_modifiers (keyboard,
+ wl_display_next_serial (keyboard->display),
+ xkb_state_serialize_mods (state, XKB_STATE_MODS_DEPRESSED),
+ xkb_state_serialize_mods (state, XKB_STATE_MODS_LATCHED),
+ xkb_state_serialize_mods (state, XKB_STATE_MODS_LOCKED),
+ xkb_state_serialize_layout (state, XKB_STATE_LAYOUT_EFFECTIVE));
}
gboolean
@@ -407,10 +395,7 @@ meta_wayland_keyboard_handle_event (MetaWaylandKeyboard *keyboard,
is_press ? "press" : "release",
event->hardware_keycode);
- handled = keyboard->grab->interface->key (keyboard->grab,
- event->time,
- evdev_code (event),
- is_press);
+ handled = notify_key (keyboard, event->time, evdev_code (event), is_press);
if (handled)
meta_verbose ("Sent event to wayland client\n");
diff --git a/src/wayland/meta-wayland-keyboard.h b/src/wayland/meta-wayland-keyboard.h
index 2a18d85..ded287d 100644
--- a/src/wayland/meta-wayland-keyboard.h
+++ b/src/wayland/meta-wayland-keyboard.h
@@ -49,23 +49,6 @@
#include <wayland-server.h>
#include <xkbcommon/xkbcommon.h>
-struct _MetaWaylandKeyboardGrabInterface
-{
- gboolean (*key) (MetaWaylandKeyboardGrab * grab, uint32_t time,
- uint32_t key, uint32_t state);
- void (*modifiers) (MetaWaylandKeyboardGrab * grab, uint32_t serial,
- uint32_t mods_depressed, uint32_t mods_latched,
- uint32_t mods_locked, uint32_t group);
-};
-
-struct _MetaWaylandKeyboardGrab
-{
- const MetaWaylandKeyboardGrabInterface *interface;
- MetaWaylandKeyboard *keyboard;
- MetaWaylandSurface *focus;
- uint32_t key;
-};
-
typedef struct
{
struct xkb_keymap *keymap;
@@ -86,19 +69,10 @@ struct _MetaWaylandKeyboard
struct wl_listener focus_surface_listener;
uint32_t focus_serial;
- MetaWaylandKeyboardGrab *grab;
- MetaWaylandKeyboardGrab default_grab;
- uint32_t grab_key;
- uint32_t grab_serial;
- uint32_t grab_time;
-
struct wl_array keys;
struct xkb_context *xkb_context;
MetaWaylandXkbInfo xkb_info;
-
- MetaWaylandKeyboardGrab input_method_grab;
- struct wl_resource *input_method_resource;
};
void meta_wayland_keyboard_init (MetaWaylandKeyboard *keyboard,
diff --git a/src/wayland/meta-wayland-types.h b/src/wayland/meta-wayland-types.h
index adecb05..177519d 100644
--- a/src/wayland/meta-wayland-types.h
+++ b/src/wayland/meta-wayland-types.h
@@ -27,8 +27,6 @@ typedef struct _MetaWaylandPointer MetaWaylandPointer;
typedef struct _MetaWaylandPointerGrab MetaWaylandPointerGrab;
typedef struct _MetaWaylandPointerGrabInterface MetaWaylandPointerGrabInterface;
typedef struct _MetaWaylandKeyboard MetaWaylandKeyboard;
-typedef struct _MetaWaylandKeyboardGrab MetaWaylandKeyboardGrab;
-typedef struct _MetaWaylandKeyboardGrabInterface MetaWaylandKeyboardGrabInterface;
typedef struct _MetaWaylandDataOffer MetaWaylandDataOffer;
typedef struct _MetaWaylandDataSource MetaWaylandDataSource;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]