summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Fourdan <ofourdan@redhat.com>2017-09-01 09:35:33 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2017-09-04 14:22:28 +1000
commit3fbc3c3eefd3803d0c4e86e42595d8a891aeb5f2 (patch)
treeca8b9046e8c550d10d3797e67d7787cd0061cf4b
parentaabf65d2a0206bd1a9c6e9a9f3153ded873dfd43 (diff)
xwayland: No grab handler without protocol support
If the compositor has no support for the Xwayland keyboard grab protocol, there is no need to set-up our keyboard grab handler. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--hw/xwayland/xwayland-input.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 92e530d0d..0ef073f64 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -1050,11 +1050,10 @@ set_grab(struct xwl_seat *xwl_seat, struct xwl_window *xwl_window)
release_grab (xwl_seat);
xwl_screen = xwl_seat->xwl_screen;
- if (xwl_screen->wp_grab)
- xwl_seat->keyboard_grab =
- zwp_xwayland_keyboard_grab_manager_v1_grab_keyboard(xwl_screen->wp_grab,
- xwl_window->surface,
- xwl_seat->seat);
+ xwl_seat->keyboard_grab =
+ zwp_xwayland_keyboard_grab_manager_v1_grab_keyboard(xwl_screen->wp_grab,
+ xwl_window->surface,
+ xwl_seat->seat);
}
static void
@@ -1197,14 +1196,18 @@ init_keyboard(struct xwl_seat *xwl_seat)
EnableDevice(xwl_seat->keyboard, TRUE);
xwl_seat->keyboard->key->xkbInfo->checkRepeat = keyboard_check_repeat;
- master = GetMaster(xwl_seat->keyboard, MASTER_KEYBOARD);
- if (master)
- setup_keyboard_grab_handler(master);
+ if (xwl_seat->xwl_screen->wp_grab) {
+ /* We have Xwayland grab protocol supported by the compositor */
+ master = GetMaster(xwl_seat->keyboard, MASTER_KEYBOARD);
+ if (master)
+ setup_keyboard_grab_handler(master);
+ }
}
static void
release_keyboard(struct xwl_seat *xwl_seat)
{
+ release_grab(xwl_seat);
wl_keyboard_release(xwl_seat->wl_keyboard);
xwl_seat->wl_keyboard = NULL;
@@ -1257,7 +1260,6 @@ seat_handle_capabilities(void *data, struct wl_seat *seat,
if (caps & WL_SEAT_CAPABILITY_KEYBOARD && xwl_seat->wl_keyboard == NULL) {
init_keyboard(xwl_seat);
} else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && xwl_seat->wl_keyboard) {
- release_grab(xwl_seat);
release_keyboard(xwl_seat);
}
@@ -2401,10 +2403,21 @@ static void
init_keyboard_grab(struct xwl_screen *xwl_screen,
uint32_t id, uint32_t version)
{
+ struct xwl_seat *xwl_seat;
+ DeviceIntPtr master;
+
xwl_screen->wp_grab =
wl_registry_bind(xwl_screen->registry, id,
&zwp_xwayland_keyboard_grab_manager_v1_interface,
1);
+
+ xorg_list_for_each_entry(xwl_seat, &xwl_screen->seat_list, link) {
+ if (xwl_seat->keyboard) {
+ master = GetMaster(xwl_seat->keyboard, MASTER_KEYBOARD);
+ if (master)
+ setup_keyboard_grab_handler(master);
+ }
+ }
}
static void