From: John Lindgren Date: Sat, 8 Jan 2022 07:47:30 +0000 (-0500) Subject: cursor: More reliably clear "pressed" status of mouse bindings X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=4e3a03586aa72eefce893e9865b97248be0e0f53;p=proto%2Flabwc.git cursor: More reliably clear "pressed" status of mouse bindings The "pressed" status of the mouse button is stored per-binding, and the first binding activated causes us to break out of the loop that cleared the "pressed" status -- as a result, some statused weren't cleared when another binding was activated. The bug could be seen when clicking the maximize button on a window and then moving the mouse: the DRAG action would continue to move the window (unmaximizing it) even though the mouse button was no longer held. --- diff --git a/src/cursor.c b/src/cursor.c index 12d72981..fd9b6e31 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -481,10 +481,8 @@ handle_release_mousebinding(struct view *view, struct server *server, case MOUSE_ACTION_RELEASE: break; case MOUSE_ACTION_CLICK: - if (mousebind->pressed_in_context) { - mousebind->pressed_in_context = false; + if (mousebind->pressed_in_context) break; - } continue; default: continue; @@ -493,8 +491,14 @@ handle_release_mousebinding(struct view *view, struct server *server, activated_any_frame |= mousebind->context == LAB_SSD_FRAME; action(view, server, &mousebind->actions, resize_edges); } - /* For the drag events */ - mousebind->pressed_in_context = false; + } + /* + * Clear "pressed" status for all bindings of this mouse button, + * regardless of whether activated or not + */ + wl_list_for_each(mousebind, &rc.mousebinds, link) { + if (mousebind->button == button) + mousebind->pressed_in_context = false; } return activated_any && activated_any_frame; }