fix WINGs dialog input: match XDG toplevel clicks to WINGs frame buffers by bounds

This commit is contained in:
Window Maker 2026-06-04 09:58:16 +02:00
parent 1e09e5e35f
commit ef45983b5b
2 changed files with 22 additions and 6 deletions

View File

@ -206,7 +206,9 @@ frame_buf_at(int px, int py)
return fb; return fb;
} }
/* Step 6: topmost node was a client surface — not a WM frame. */
/* Step 7: topmost node was a client surface — not a WM frame. */
return NULL; return NULL;
} }

View File

@ -219,16 +219,30 @@ handle_pointer_button(struct wl_listener *listener, void *data)
wev.u.button.y = wl_state.pointer_y - fb->y; wev.u.button.y = wl_state.pointer_y - fb->y;
} else { } else {
/* No frame buffer — check if the click landed on an XDG toplevel /* No frame buffer — check if the click landed on an XDG toplevel
* (WINGs dialog, popup, etc.) and use its view ID as the window. */ * and look up its WINGs view ID from the frame list. */
double _sx, _sy; double _sx, _sy;
struct wl_toplevel_view *_tv = NULL; struct wl_toplevel_view *_tv = NULL;
view_surface_at(wl_state.pointer_x, wl_state.pointer_y, view_surface_at(wl_state.pointer_x, wl_state.pointer_y,
&_sx, &_sy, &_tv); &_sx, &_sy, &_tv);
if (_tv) { if (_tv) {
wev.window = _tv->id; /* Try to find a WINGs view frame buffer at this position.
wev.u.button.window = _tv->id; * The compositor's view ID (_tv->id) is synthetic and not
wev.u.button.x = (int)_sx; * known to WINGs, so we match by bounds against frame_buf
wev.u.button.y = (int)_sy; * entries with WINGs view IDs (>= 0x20000000). */
struct wl_frame_buf *_wtb = NULL;
wl_list_for_each(_wtb, &wl_state.frame_list, link) {
if (_wtb->id >= 0x20000000 &&
wl_state.pointer_x >= _wtb->x &&
wl_state.pointer_x < _wtb->x + _wtb->width &&
wl_state.pointer_y >= _wtb->y &&
wl_state.pointer_y < _wtb->y + _wtb->height) {
break;
}
}
wev.window = _wtb ? _wtb->id : _tv->id;
wev.u.button.window = wev.window;
wev.u.button.x = _wtb ? (wl_state.pointer_x - _wtb->x) : (int)_sx;
wev.u.button.y = _wtb ? (wl_state.pointer_y - _wtb->y) : (int)_sy;
} else { } else {
WScreen *scr0 = wScreenWithNumber(0); WScreen *scr0 = wScreenWithNumber(0);
WNativeWindow root = scr0 ? scr0->root_win : (WNativeWindow)0x0FFFFFFF; WNativeWindow root = scr0 ? scr0->root_win : (WNativeWindow)0x0FFFFFFF;