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.
This commit is contained in:
John Lindgren 2022-01-08 02:47:30 -05:00 committed by Johan Malm
parent 7f8b7f0a56
commit 4e3a03586a

View file

@ -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;
}