From e090b929a49783d12228d56ab4d854fad31bb262 Mon Sep 17 00:00:00 2001 From: Window Maker Date: Thu, 4 Jun 2026 13:42:27 +0200 Subject: [PATCH] bridge WINGs dialog XDG toplevel to WINGs view ID: set view->frame_id and adopt WINGs window ID in handle_toplevel_map --- src/backend/wayland/wl_xdg.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/backend/wayland/wl_xdg.c b/src/backend/wayland/wl_xdg.c index 1c176b1..a1c80d3 100644 --- a/src/backend/wayland/wl_xdg.c +++ b/src/backend/wayland/wl_xdg.c @@ -264,6 +264,31 @@ handle_toplevel_map(struct wl_listener *listener, void *data) * (auto_focus=1 set in wl_screen_create_internals); the * direct wl_focus_set() call is no longer needed here. */ + /* Bridge to WINGs view: if this XDG toplevel belongs to + * a WINGs dialog, adopt the WINGs view window ID so + * view_surface_at returns an ID that event dispatch can + * route back to the correct WINGs W_View. */ + { + const char *_app = view->xdg_surface->toplevel->app_id; + if (_app && (strcmp(_app, "WINGs") == 0 || + strcmp(_app, "wings-popup") == 0)) { + /* Find the WINGs frame buffer created by + * wl_client_reparent that hasn't been claimed yet. */ + struct wl_frame_buf *_fb; + wl_list_for_each(_fb, &wl_state.frame_list, link) { + if (_fb->id >= 0x20000000 && !wl_find_view_by_id(_fb->id)) { + wwarning("wl_backend: WINGs dialog id 0x%lx -> view", + (unsigned long)_fb->id); + view->id = _fb->id; + view->frame_id = _fb->parent_id; + view->frame_rel_x = _fb->rel_x; + view->frame_rel_y = _fb->rel_y; + break; + } + } + } + } + /* Phase 18: add XDG surface to the scene graph. * * ORDERING: wManageWindow (above) calls wl_client_reparent