cursor: clean up cursor_process_button_{press,release}()

This should not change any behaviors.
This commit is contained in:
tokyo4j 2025-10-30 03:10:42 +09:00
parent 0f62648d39
commit df09678631

View file

@ -953,10 +953,6 @@ static void
process_release_mousebinding(struct server *server, process_release_mousebinding(struct server *server,
struct cursor_context *ctx, uint32_t button) struct cursor_context *ctx, uint32_t button)
{ {
if (server->input_mode == LAB_INPUT_STATE_WINDOW_SWITCHER) {
return;
}
struct mousebind *mousebind; struct mousebind *mousebind;
uint32_t modifiers = keyboard_get_all_modifiers(&server->seat); uint32_t modifiers = keyboard_get_all_modifiers(&server->seat);
@ -1022,10 +1018,6 @@ static bool
process_press_mousebinding(struct server *server, struct cursor_context *ctx, process_press_mousebinding(struct server *server, struct cursor_context *ctx,
uint32_t button) uint32_t button)
{ {
if (server->input_mode == LAB_INPUT_STATE_WINDOW_SWITCHER) {
return false;
}
struct mousebind *mousebind; struct mousebind *mousebind;
bool double_click = is_double_click(rc.doubleclick_time, button, ctx); bool double_click = is_double_click(rc.doubleclick_time, button, ctx);
bool consumed_by_frame_context = false; bool consumed_by_frame_context = false;
@ -1115,8 +1107,11 @@ cursor_process_button_press(struct seat *seat, uint32_t button, uint32_t time_ms
* so subsequent release always closes menu or selects menu item. * so subsequent release always closes menu or selects menu item.
*/ */
press_msec = 0; press_msec = 0;
lab_set_add(&seat->bound_buttons, button); goto consumed;
return false; }
if (server->input_mode != LAB_INPUT_STATE_PASSTHROUGH) {
goto consumed;
} }
/* /*
@ -1148,8 +1143,7 @@ cursor_process_button_press(struct seat *seat, uint32_t button, uint32_t time_ms
* Note: This does not work for XWayland clients * Note: This does not work for XWayland clients
*/ */
wlr_seat_pointer_end_grab(seat->seat); wlr_seat_pointer_end_grab(seat->seat);
lab_set_add(&seat->bound_buttons, button); goto consumed;
return false;
} }
/* Bindings to the Frame context swallow mouse events if activated */ /* Bindings to the Frame context swallow mouse events if activated */
@ -1161,6 +1155,7 @@ cursor_process_button_press(struct seat *seat, uint32_t button, uint32_t time_ms
return true; return true;
} }
consumed:
lab_set_add(&seat->bound_buttons, button); lab_set_add(&seat->bound_buttons, button);
return false; return false;
} }