cursor: Do not clamp motion coordinates for XWayland surfaces.

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.
This commit is contained in:
John Lindgren 2022-08-13 11:36:07 -04:00 committed by Johan Malm
parent 19dea7450b
commit 8e6d37772e

View file

@ -296,8 +296,16 @@ process_cursor_motion(struct server *server, uint32_t time)
} }
sx = server->seat.cursor->x - view->x; sx = server->seat.cursor->x - view->x;
sy = server->seat.cursor->y - view->y; 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) { if (view->type == LAB_XDG_SHELL_VIEW && view->xdg_surface) {
/* Take into account invisible CSD borders */ /* Take into account invisible CSD borders */
struct wlr_box geo; struct wlr_box geo;