mirror of
https://github.com/labwc/labwc.git
synced 2026-02-18 22:05:32 -05:00
cursor: prevent Drag mousebinds from running without button press
For `Drag` mousebinds, `pressed_in_context` is set by `cursor_process_button_press()` and cleared by `cursor_process_motion()` which runs actions bound to them. However, when `cursor_process_motion()` is called while interactive move/resize, it doesn't clear `pressed_in_context` due to the early-return and the `Drag` mousebinds are unexpectedly executed on another call to `cursor_process_motion()` after the interactive move/resize is finished by button release, even when the button is not pressed. So this commit fixes it by always clearing `pressed_in_context` on button releases.
This commit is contained in:
parent
452f45cd3d
commit
1557cb774f
3 changed files with 14 additions and 14 deletions
|
|
@ -903,15 +903,7 @@ handle_release_mousebinding(struct server *server,
|
|||
actions_run(ctx->view, server, &mousebind->actions, ctx);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Clear "pressed" status for all bindings of this mouse button,
|
||||
* regardless of whether handled or not
|
||||
*/
|
||||
wl_list_for_each(mousebind, &rc.mousebinds, link) {
|
||||
if (mousebind->button == button) {
|
||||
mousebind->pressed_in_context = false;
|
||||
}
|
||||
}
|
||||
|
||||
return consumed_by_frame_context;
|
||||
}
|
||||
|
||||
|
|
@ -1137,10 +1129,18 @@ cursor_process_button_release(struct seat *seat, uint32_t button,
|
|||
}
|
||||
|
||||
bool
|
||||
cursor_finish_button_release(struct seat *seat)
|
||||
cursor_finish_button_release(struct seat *seat, uint32_t button)
|
||||
{
|
||||
struct server *server = seat->server;
|
||||
|
||||
/* Clear "pressed" status for all bindings of this mouse button */
|
||||
struct mousebind *mousebind;
|
||||
wl_list_for_each(mousebind, &rc.mousebinds, link) {
|
||||
if (mousebind->button == button) {
|
||||
mousebind->pressed_in_context = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (server->input_mode == LAB_INPUT_STATE_MOVE
|
||||
|| server->input_mode == LAB_INPUT_STATE_RESIZE) {
|
||||
if (resize_outlines_enabled(server->grabbed_view)) {
|
||||
|
|
@ -1182,7 +1182,7 @@ cursor_button(struct wl_listener *listener, void *data)
|
|||
wlr_seat_pointer_notify_button(seat->seat, event->time_msec,
|
||||
event->button, event->state);
|
||||
}
|
||||
cursor_finish_button_release(seat);
|
||||
cursor_finish_button_release(seat, event->button);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1245,7 +1245,7 @@ cursor_emulate_button(struct seat *seat, uint32_t button,
|
|||
if (notify) {
|
||||
wlr_seat_pointer_notify_button(seat->seat, time_msec, button, state);
|
||||
}
|
||||
cursor_finish_button_release(seat);
|
||||
cursor_finish_button_release(seat, button);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue