From 08e779bd85b738d993007fa6a7f3f32bebc19649 Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Sat, 10 Aug 2024 09:55:17 +0300 Subject: [PATCH] seat/pointer: reset pressed buttons on focus change This fixes two problems: - A surface could get unexpected release events for buttons pressed while other surface was focused; - Clearing focus while a button is pressed would lead to the button getting "stuck". Fixes: 8730ca9661eaaab83954bca033745b65c60cf4f8 --- types/seat/wlr_seat_pointer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/seat/wlr_seat_pointer.c b/types/seat/wlr_seat_pointer.c index 15075f61..31113c81 100644 --- a/types/seat/wlr_seat_pointer.c +++ b/types/seat/wlr_seat_pointer.c @@ -179,6 +179,9 @@ void wlr_seat_pointer_enter(struct wlr_seat *wlr_seat, seat_client_send_pointer_leave_raw(focused_client, focused_surface); } + // The current surface doesn't know about pressed buttons + wlr_seat->pointer_state.button_count = 0; + // enter the current surface if (client != NULL && surface != NULL) { uint32_t serial = wlr_seat_client_next_serial(client);