fix WINGs dialog button clicks: resolve WINGs view via WWindow client_leader when frame_buf_hit returns WM fake_leader

This commit is contained in:
Window Maker 2026-06-04 14:55:43 +02:00
parent 340e23ddc6
commit fb95ffc450
1 changed files with 18 additions and 2 deletions

View File

@ -269,12 +269,28 @@ handle_pointer_button(struct wl_listener *listener, void *data)
case 0x112: wev.u.button.button = 2; break;
default: wev.u.button.button = (ev->button - 0x110) + 1; break;
}
/* For WINGs views, resolve the child widget at click coordinates */
/* For WINGs views, resolve the child widget at click coordinates.
* Two cases:
* 1. fb->id >= 0x20000000 — fb IS a WINGs view frame_buf, use directly.
* 2. fb->id < 0x20000000 but has a WWindow with client_leader —
* the fb is a WM fake_leader; look up the WINGs panel via leader. */
struct W_View *target = NULL;
WNativeWindow wings_id = 0;
if (fb && fb->id >= 0x20000000) {
wings_id = fb->id;
} else if (fb) {
/* Try to find a WWindow whose client_leader is a WINGs view */
WObjDescriptor *desc = wm_backend->context_find(fb->id, WM_CTX_CLIENT_WIN);
if (desc && desc->parent_type == WCLASS_WINDOW) {
WWindow *wwin = (WWindow *)desc->parent;
if (wwin->client_leader >= 0x20000000)
wings_id = wwin->client_leader;
}
}
if (wings_id) {
extern W_View *W_GetViewForWindow(unsigned long id);
extern struct W_View *W_FindViewAtPoint(struct W_View *parent, int x, int y);
W_View *toplevel = W_GetViewForWindow((unsigned long)fb->id);
W_View *toplevel = W_GetViewForWindow((unsigned long)wings_id);
if (toplevel) {
target = W_FindViewAtPoint(toplevel,
wev.u.button.x, wev.u.button.y);