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.
}
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;