cursor: fix button release events sometimes not being sent

When `wlr_seat_pointer_notify_button()` is called on a button press event,
that funtion must also be called on the subsequent button release event
because otherwise wlroots thinks the button is kept pressed and it
causes issues with validating DnD requests from clients, where only one
button must be pressed. This was the case when a CSD client opens a
client-menu via `show_window_menu` request after pressing its window with
the right button because we were always not notifying button release
events while a menu is open.

So let's keep track of bound (pressed but not notified) buttons and notify
button release events only when the button is not bound, like we are doing
for key-state.
This commit is contained in:
tokyo4j 2024-10-07 09:20:58 +09:00 committed by Johan Malm
parent e0848da70d
commit 7cc79edd62
2 changed files with 19 additions and 39 deletions

View file

@ -44,6 +44,7 @@
#include <wlr/types/wlr_input_method_v2.h>
#include <wlr/types/wlr_tablet_v2.h>
#include <wlr/util/log.h>
#include "common/set.h"
#include "config/keybind.h"
#include "config/rcxml.h"
#include "input/cursor.h"
@ -145,6 +146,8 @@ struct seat {
*/
struct cursor_context pressed;
struct lab_set bound_buttons;
struct {
bool active;
struct {