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
dev
Kristian Høgsberg 12 years ago
parent 191e0eee77
commit 7330862f9e
  1. 17
      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);

Loading…
Cancel
Save