From 7330862f9e25d513cfcc49358b7187524a9e1940 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Tue, 30 Oct 2012 11:04:52 -0400 Subject: [PATCH] compositor-x11: Grab pointer on button press, ungrab on release This lets us confine the X pointer to the Weston X window, which corresponds better with the rendered Wayland cursor actually moves. https://bugs.freedesktop.org/show_bug.cgi?id=53558 --- src/compositor-x11.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/compositor-x11.c b/src/compositor-x11.c index 22514c98..71287e06 100644 --- a/src/compositor-x11.c +++ b/src/compositor-x11.c @@ -668,6 +668,23 @@ x11_compositor_deliver_button_event(struct x11_compositor *c, xcb_button_press_event_t *button_event = (xcb_button_press_event_t *) event; uint32_t button; + struct x11_output *output; + + output = x11_compositor_find_output(c, button_event->event); + + if (state) + xcb_grab_pointer(c->conn, 0, output->window, + XCB_EVENT_MASK_BUTTON_PRESS | + XCB_EVENT_MASK_BUTTON_RELEASE | + XCB_EVENT_MASK_POINTER_MOTION | + XCB_EVENT_MASK_ENTER_WINDOW | + XCB_EVENT_MASK_LEAVE_WINDOW, + XCB_GRAB_MODE_ASYNC, + XCB_GRAB_MODE_ASYNC, + output->window, XCB_CURSOR_NONE, + button_event->time); + else + xcb_ungrab_pointer(c->conn, button_event->time); if (!c->has_xkb) update_xkb_state_from_core(c, button_event->state);