In current compositor-x11, the mouse buttons are grabbed and ungrabbed manually that cause bugs, in particular when release event is received. For example starting a move of a window with the left mouse button then while holding it clicking the right mouse button release the grab. That allow the mouse to go out the compositor window, while the compositor still thinking that the mouse is inside. After that, if you release the mouse outside the compositor window, the compositor never release the mouse. There is several example of issues starting from this example.
The patch avoid the issue by using the simpler passive button grab, that automatically grab buttons as soon as they occur. The passive grab include an automatic ungrab when all mouse button are released. Another way to fix the issue is to implement this later behavior manually, which require a lot more code. Signed-off-by: Benoit Gschwind <gschw...@gnu-log.net> --- libweston/compositor-x11.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/libweston/compositor-x11.c b/libweston/compositor-x11.c index b6acccd..5d063b5 100644 --- a/libweston/compositor-x11.c +++ b/libweston/compositor-x11.c @@ -892,6 +892,19 @@ x11_backend_create_output(struct x11_backend *b, int x, int y, x11_output_set_wm_protocols(b, output); + /* Automatically grab and ungrab mouse buttons */ + xcb_grab_button(b->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, + XCB_BUTTON_INDEX_ANY, + XCB_MOD_MASK_ANY); + xcb_map_window(b->conn, output->window); if (fullscreen) @@ -1063,20 +1076,6 @@ x11_backend_deliver_button_event(struct x11_backend *b, if (!output) return; - if (is_button_pressed) - xcb_grab_pointer(b->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(b->conn, button_event->time); - if (!b->has_xkb) update_xkb_state_from_core(b, button_event->state); -- 2.7.3 _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel