view: validate move/resize request from clients

Move/resize requests from xwayland views and xdg toplevels should be
ignored when the view is not pressed.

This is relevant for touchpad taps with <tapAndDrag> disabled.

When the user taps the client surface (e.g. chromium and mpv) with the
setting above, libinput sends button press & release signals so quickly
that the compositor receives move/resize request from the client AFTER
the button release signal is processed, so `interactive_finish()` is
never called.
This commit is contained in:
tokyo4j 2024-03-08 00:53:39 +09:00 committed by Johan Malm
parent f6d588507e
commit e00f7cd6db
3 changed files with 16 additions and 4 deletions

View file

@ -135,6 +135,10 @@ struct seat {
* This allows to keep dragging a scrollbar or selecting text even
* when moving outside of the window.
*
* It is also used to:
* - determine the target view for action in "Drag" mousebind
* - validate view move/resize requests from CSD clients
*
* Both (view && !surface) and (surface && !view) are possible.
*/
struct {

View file

@ -241,8 +241,10 @@ handle_request_move(struct wl_listener *listener, void *data)
* want.
*/
struct view *view = wl_container_of(listener, view, request_move);
if (view == view->server->seat.pressed.view) {
interactive_begin(view, LAB_INPUT_STATE_MOVE, 0);
}
}
static void
handle_request_resize(struct wl_listener *listener, void *data)
@ -257,8 +259,10 @@ handle_request_resize(struct wl_listener *listener, void *data)
*/
struct wlr_xdg_toplevel_resize_event *event = data;
struct view *view = wl_container_of(listener, view, request_resize);
if (view == view->server->seat.pressed.view) {
interactive_begin(view, LAB_INPUT_STATE_RESIZE, event->edges);
}
}
static void
handle_request_minimize(struct wl_listener *listener, void *data)

View file

@ -228,8 +228,10 @@ handle_request_move(struct wl_listener *listener, void *data)
* want.
*/
struct view *view = wl_container_of(listener, view, request_move);
if (view == view->server->seat.pressed.view) {
interactive_begin(view, LAB_INPUT_STATE_MOVE, 0);
}
}
static void
handle_request_resize(struct wl_listener *listener, void *data)
@ -244,8 +246,10 @@ handle_request_resize(struct wl_listener *listener, void *data)
*/
struct wlr_xwayland_resize_event *event = data;
struct view *view = wl_container_of(listener, view, request_resize);
if (view == view->server->seat.pressed.view) {
interactive_begin(view, LAB_INPUT_STATE_RESIZE, event->edges);
}
}
static void
handle_associate(struct wl_listener *listener, void *data)