]> git.mdlowis.com Git - proto/labwc.git/commitdiff
view: validate move/resize request from clients
authortokyo4j <hrak1529@gmail.com>
Thu, 7 Mar 2024 15:53:39 +0000 (00:53 +0900)
committerJohan Malm <johanmalm@users.noreply.github.com>
Thu, 7 Mar 2024 20:30:50 +0000 (20:30 +0000)
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.

include/labwc.h
src/xdg.c
src/xwayland.c

index 38fd5c9fe64ab3b3f3538d85d244e6b12f4b268f..0510cff26dae9118bfd027048ea22d7c6066e164 100644 (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 {
index a2de7f533735e542ec2c7b9f91dfe5126872f173..8a9d2d5260459624503e7f8e684693c0e866c059 100644 (file)
--- a/src/xdg.c
+++ b/src/xdg.c
@@ -241,7 +241,9 @@ handle_request_move(struct wl_listener *listener, void *data)
         * want.
         */
        struct view *view = wl_container_of(listener, view, request_move);
-       interactive_begin(view, LAB_INPUT_STATE_MOVE, 0);
+       if (view == view->server->seat.pressed.view) {
+               interactive_begin(view, LAB_INPUT_STATE_MOVE, 0);
+       }
 }
 
 static void
@@ -257,7 +259,9 @@ 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);
-       interactive_begin(view, LAB_INPUT_STATE_RESIZE, event->edges);
+       if (view == view->server->seat.pressed.view) {
+               interactive_begin(view, LAB_INPUT_STATE_RESIZE, event->edges);
+       }
 }
 
 static void
index 85e57f29af101029c071c5886769e97173087179..398de0c29bfd0dff43d6fd97ddca1dc8bd372635 100644 (file)
@@ -228,7 +228,9 @@ handle_request_move(struct wl_listener *listener, void *data)
         * want.
         */
        struct view *view = wl_container_of(listener, view, request_move);
-       interactive_begin(view, LAB_INPUT_STATE_MOVE, 0);
+       if (view == view->server->seat.pressed.view) {
+               interactive_begin(view, LAB_INPUT_STATE_MOVE, 0);
+       }
 }
 
 static void
@@ -244,7 +246,9 @@ 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);
-       interactive_begin(view, LAB_INPUT_STATE_RESIZE, event->edges);
+       if (view == view->server->seat.pressed.view) {
+               interactive_begin(view, LAB_INPUT_STATE_RESIZE, event->edges);
+       }
 }
 
 static void