wayland: fix XWayland cursor position offset by titlebar height

view_surface_at() was double-subtracting the frame_rel offset. Since
v->x/v->y already represents the client content position (frame origin
+ frame_rel), the surface-local coordinates are simply px - v->x. The
bounds check now correctly tests against 0..width/height.
This commit is contained in:
lkn 2026-06-21 16:59:58 +02:00
parent 949fc9f94a
commit 7114da35ba
1 changed files with 6 additions and 7 deletions

View File

@ -78,17 +78,16 @@ view_surface_at(int px, int py, double *sx_out, double *sy_out,
}
if (v->xw_surface && v->xw_surface->surface) {
/* v->x/v->y is the absolute client content position
* (frame origin + frame_rel offset). Check if pointer
* is within the client area. */
double sx = px - (double)v->x;
double sy = py - (double)v->y;
/* If the XWayland view has a frame, only return the surface
* when the pointer is over the client content area. */
if (v->frame_id) {
if (sx < v->frame_rel_x || sy < v->frame_rel_y ||
sx >= v->frame_rel_x + v->xw_surface->width ||
sy >= v->frame_rel_y + v->xw_surface->height)
if (sx < 0 || sy < 0 ||
sx >= v->xw_surface->width ||
sy >= v->xw_surface->height)
continue;
sx -= v->frame_rel_x;
sy -= v->frame_rel_y;
}
if (sx_out) *sx_out = sx;
if (sy_out) *sy_out = sy;