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
diff --git a/src/compositor-x11.c b/src/compositor-x11.c
index 22514c9..71287e0 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -668,6 +668,23 @@
 	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);