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: 8730ca9661
This commit is contained in:
Kirill Primak 2024-08-10 09:55:17 +03:00
parent 0a388a14f1
commit 08e779bd85

View File

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