wl_view_scene_node_set_enabled: find WINGs client toplevels via wl_proxy_get_id

The function only handled wl_frame_buf entries. WINGs client popup menus have
their own xdg_toplevel surface with a scene_node but no wl_frame_buf. Their
WINGs view window IDs (0x20000000+) differ from compositor view IDs
(0x10000000+), so wl_find_view_by_id could not find them.

Fix: add wlc_top_get_surface_id() in wclient_wl.c which returns the
libwayland-client proxy ID for the wl_surface. In
wl_view_scene_node_set_enabled, use this ID to iterate the compositor
toplevel_list and find the matching wlr_surface resource by object ID.
Then enable/disable the view scene_node directly.
This commit is contained in:
lkn 2026-06-07 15:00:08 +02:00
parent b30cfa31d9
commit 60efe4db78
2 changed files with 28 additions and 1 deletions

View File

@ -270,6 +270,14 @@ wlc_top_find(WNativeWindow id)
return NULL;
}
uint32_t
wlc_top_get_surface_id(WNativeWindow id)
{
WLClientToplevel *top = wlc_top_find(id);
if (!top || !top->surface) return 0;
return wl_proxy_get_id((struct wl_proxy *)top->surface);
}
static void
wlc_top_remove(WNativeWindow id)
{

View File

@ -316,12 +316,31 @@ void wl_view_commit_backing_impl(unsigned long id)
}
}
}
extern uint32_t wlc_top_get_surface_id(WNativeWindow id);
void
wl_view_scene_node_set_enabled(unsigned long id, int enabled)
{
struct wl_frame_buf *fb = frame_buf_find((WNativeWindow)id);
if (fb && fb->scene_buf)
if (fb && fb->scene_buf) {
wlr_scene_node_set_enabled(&fb->scene_buf->node, !!enabled);
return;
}
/* WINGs client toplevels (popups) have no wl_frame_buf. Match the
* client proxy ID to the compositor wlr_surface resource ID. */
uint32_t proxy_id = wlc_top_get_surface_id((WNativeWindow)id);
if (!proxy_id) return;
struct wl_toplevel_view *v;
wl_list_for_each(v, &wl_state.toplevel_list, link) {
if (v->scene_node && v->xdg_surface
&& v->xdg_surface->surface
&& v->xdg_surface->surface->resource
&& v->xdg_surface->surface->resource->object.id == proxy_id) {
wlr_scene_node_set_enabled(&v->scene_node->node, !!enabled);
return;
}
}
}