]> git.mdlowis.com Git - proto/labwc.git/commitdiff
cursor: Do not clamp motion coordinates for XWayland surfaces.
authorJohn Lindgren <john@jlindgren.net>
Sat, 13 Aug 2022 15:36:07 +0000 (11:36 -0400)
committerJohan Malm <johanmalm@users.noreply.github.com>
Tue, 16 Aug 2022 18:31:16 +0000 (19:31 +0100)
X11 apps expect to be able to receive motion events outside
the window area (this is necessary for client-side move/resize
handles to work properly).  So do not clamp the motion
coordinates for XWayland surfaces.

Before this change, attempting to enlarge an XWayland window
using a client-side resize handle resulted in the window size
lagging behind the mouse cursor quite severely, since each
motion event was in effect allowed to expand the window by
only a few pixels.  The closer the initial button-press was
to the edge of the window, the worse the lag would be.

src/cursor.c

index 2ced623cb388161954ed90ded92903bb562997a5..d938a4acca87b6da6fb79cb93f5190b3a2fd6455 100644 (file)
@@ -296,8 +296,16 @@ process_cursor_motion(struct server *server, uint32_t time)
                }
                sx = server->seat.cursor->x - view->x;
                sy = server->seat.cursor->y - view->y;
-               sx = sx < 0 ? 0 : (sx > view->w ? view->w : sx);
-               sy = sy < 0 ? 0 : (sy > view->h ? view->h : sy);
+               /*
+                * X11 apps expect to be able to receive motion events outside
+                * the window area (this is necessary for client-side move/resize
+                * handles to work properly).  So do not clamp the motion
+                * coordinates for XWayland surfaces.
+                */
+               if (view->type == LAB_XDG_SHELL_VIEW) {
+                       sx = sx < 0 ? 0 : (sx > view->w ? view->w : sx);
+                       sy = sy < 0 ? 0 : (sy > view->h ? view->h : sy);
+               }
                if (view->type == LAB_XDG_SHELL_VIEW && view->xdg_surface) {
                        /* Take into account invisible CSD borders */
                        struct wlr_box geo;