diff --git a/src/wayland/meta-wayland-keyboard.c b/src/wayland/meta-wayland-keyboard.c index 5403f8c04..e98831947 100644 --- a/src/wayland/meta-wayland-keyboard.c +++ b/src/wayland/meta-wayland-keyboard.c @@ -272,7 +272,19 @@ static gboolean notify_key (MetaWaylandKeyboard *keyboard, const ClutterEvent *event) { - return keyboard->grab->interface->key (keyboard->grab, event); + gboolean is_press = clutter_event_type (event) == CLUTTER_KEY_PRESS; + guint32 code = 0; + + /* Ignore autorepeat events, as autorepeat in Wayland is done on the client + * side. */ + if (clutter_event_get_flags (event) & CLUTTER_EVENT_FLAG_REPEATED) + return FALSE; + + code = clutter_event_get_event_code (event); + + return meta_wayland_keyboard_broadcast_key (keyboard, + clutter_event_get_time (event), + code, is_press); } static xkb_mod_mask_t @@ -359,11 +371,7 @@ meta_wayland_keyboard_broadcast_modifiers (MetaWaylandKeyboard *keyboard) static void notify_modifiers (MetaWaylandKeyboard *keyboard) { - struct xkb_state *state; - - state = keyboard->xkb_info.state; - keyboard->grab->interface->modifiers (keyboard->grab, - xkb_state_serialize_mods (state, XKB_STATE_MODS_EFFECTIVE)); + meta_wayland_keyboard_broadcast_modifiers (keyboard); } static void @@ -494,38 +502,6 @@ settings_changed (GSettings *settings, notify_key_repeat (keyboard); } -static gboolean -default_grab_key (MetaWaylandKeyboardGrab *grab, - const ClutterEvent *event) -{ - MetaWaylandKeyboard *keyboard = grab->keyboard; - gboolean is_press = clutter_event_type (event) == CLUTTER_KEY_PRESS; - guint32 code = 0; - - /* Ignore autorepeat events, as autorepeat in Wayland is done on the client - * side. */ - if (clutter_event_get_flags (event) & CLUTTER_EVENT_FLAG_REPEATED) - return FALSE; - - code = clutter_event_get_event_code (event); - - return meta_wayland_keyboard_broadcast_key (keyboard, - clutter_event_get_time (event), - code, is_press); -} - -static void -default_grab_modifiers (MetaWaylandKeyboardGrab *grab, - ClutterModifierType modifiers) -{ - meta_wayland_keyboard_broadcast_modifiers (grab->keyboard); -} - -static const MetaWaylandKeyboardGrabInterface default_keyboard_grab_interface = { - default_grab_key, - default_grab_modifiers -}; - void meta_wayland_keyboard_enable (MetaWaylandKeyboard *keyboard) { @@ -571,7 +547,6 @@ meta_wayland_keyboard_disable (MetaWaylandKeyboard *keyboard) g_signal_handlers_disconnect_by_func (backend, on_keymap_changed, keyboard); g_signal_handlers_disconnect_by_func (backend, on_keymap_layout_group_changed, keyboard); - meta_wayland_keyboard_end_grab (keyboard); meta_wayland_keyboard_set_focus (keyboard, NULL); wl_list_remove (&keyboard->resource_list); @@ -887,31 +862,12 @@ meta_wayland_keyboard_can_popup (MetaWaylandKeyboard *keyboard, keyboard->key_up_serial == serial)); } -void -meta_wayland_keyboard_start_grab (MetaWaylandKeyboard *keyboard, - MetaWaylandKeyboardGrab *grab) -{ - meta_wayland_keyboard_set_focus (keyboard, NULL); - keyboard->grab = grab; - grab->keyboard = keyboard; -} - -void -meta_wayland_keyboard_end_grab (MetaWaylandKeyboard *keyboard) -{ - keyboard->grab = &keyboard->default_grab; -} - static void meta_wayland_keyboard_init (MetaWaylandKeyboard *keyboard) { wl_list_init (&keyboard->resource_list); wl_list_init (&keyboard->focus_resource_list); - keyboard->default_grab.interface = &default_keyboard_grab_interface; - keyboard->default_grab.keyboard = keyboard; - keyboard->grab = &keyboard->default_grab; - keyboard->focus_surface_listener.notify = keyboard_handle_focus_surface_destroy; } @@ -933,9 +889,3 @@ meta_wayland_keyboard_class_init (MetaWaylandKeyboardClass *klass) object_class->finalize = meta_wayland_keyboard_finalize; } - -gboolean -meta_wayland_keyboard_is_grabbed (MetaWaylandKeyboard *keyboard) -{ - return keyboard->grab != &keyboard->default_grab; -} diff --git a/src/wayland/meta-wayland-keyboard.h b/src/wayland/meta-wayland-keyboard.h index 03eb7fabf..885d67b38 100644 --- a/src/wayland/meta-wayland-keyboard.h +++ b/src/wayland/meta-wayland-keyboard.h @@ -54,20 +54,6 @@ G_DECLARE_FINAL_TYPE (MetaWaylandKeyboard, meta_wayland_keyboard, META, WAYLAND_KEYBOARD, MetaWaylandInputDevice) -struct _MetaWaylandKeyboardGrabInterface -{ - gboolean (*key) (MetaWaylandKeyboardGrab *grab, - const ClutterEvent *event); - void (*modifiers) (MetaWaylandKeyboardGrab *grab, - ClutterModifierType modifiers); -}; - -struct _MetaWaylandKeyboardGrab -{ - const MetaWaylandKeyboardGrabInterface *interface; - MetaWaylandKeyboard *keyboard; -}; - typedef struct { struct xkb_keymap *keymap; @@ -99,9 +85,6 @@ struct _MetaWaylandKeyboard xkb_mod_mask_t kbd_a11y_latched_mods; xkb_mod_mask_t kbd_a11y_locked_mods; - MetaWaylandKeyboardGrab *grab; - MetaWaylandKeyboardGrab default_grab; - GSettings *settings; }; @@ -134,9 +117,3 @@ gboolean meta_wayland_keyboard_can_grab_surface (MetaWaylandKeyboard *keyboard, uint32_t serial); gboolean meta_wayland_keyboard_can_popup (MetaWaylandKeyboard *keyboard, uint32_t serial); - -void meta_wayland_keyboard_start_grab (MetaWaylandKeyboard *keyboard, - MetaWaylandKeyboardGrab *grab); -void meta_wayland_keyboard_end_grab (MetaWaylandKeyboard *keyboard); - -gboolean meta_wayland_keyboard_is_grabbed (MetaWaylandKeyboard *keyboard); diff --git a/src/wayland/meta-wayland-seat.c b/src/wayland/meta-wayland-seat.c index b3088a111..0f4c2712b 100644 --- a/src/wayland/meta-wayland-seat.c +++ b/src/wayland/meta-wayland-seat.c @@ -669,10 +669,6 @@ meta_wayland_seat_is_grabbed (MetaWaylandSeat *seat) meta_wayland_pointer_is_grabbed (seat->pointer)) return TRUE; - if (meta_wayland_seat_has_keyboard (seat) && - meta_wayland_keyboard_is_grabbed (seat->keyboard)) - return TRUE; - if (!meta_wayland_input_is_current_handler (seat->input_handler, seat->default_handler)) return TRUE; diff --git a/src/wayland/meta-wayland-types.h b/src/wayland/meta-wayland-types.h index c14b340f4..478cfe1d2 100644 --- a/src/wayland/meta-wayland-types.h +++ b/src/wayland/meta-wayland-types.h @@ -28,8 +28,6 @@ typedef struct _MetaWaylandPopupGrab MetaWaylandPopupGrab; typedef struct _MetaWaylandPopup MetaWaylandPopup; typedef struct _MetaWaylandPopupSurface MetaWaylandPopupSurface; typedef struct _MetaWaylandKeyboard MetaWaylandKeyboard; -typedef struct _MetaWaylandKeyboardGrab MetaWaylandKeyboardGrab; -typedef struct _MetaWaylandKeyboardGrabInterface MetaWaylandKeyboardGrabInterface; typedef struct _MetaWaylandTouch MetaWaylandTouch; typedef struct _MetaWaylandDragDestFuncs MetaWaylandDragDestFuncs; typedef struct _MetaWaylandDataOffer MetaWaylandDataOffer;