fix: destroy scene graph nodes when WINGs views close on Wayland

When a WINGs toplevel (modal dialog, info panel, etc.) is destroyed,
   wl_destroy() now calls W_ViewDestroyBackingFn, which invokes
   wl_view_destroy_backing_impl() to remove the frame_buf from the
   frame list and destroy the wlr_scene_node. This ensures closed
   WINGs windows actually disappear from screen.
This commit is contained in:
ollie 2026-05-17 19:34:30 +02:00
parent 15bec04b1b
commit 3f9182b24a
3 changed files with 18 additions and 1 deletions

View File

@ -484,6 +484,7 @@ Bool W_IsValidView(struct W_View *view);
void W_WL_EnqueueEvent(struct W_Screen *scr, const WMEvent *ev, struct W_View *target);
void W_WL_InvalidateView(struct W_Screen *scr, struct W_View *target);
extern void (*W_ViewDestroyBackingFn)(unsigned long id);
void W_WL_SetLoopDispatch(struct W_Screen *scr,
int loop_fd,
void (*dispatch_fn)(int timeout_ms, void *ud),

View File

@ -14,6 +14,9 @@ static unsigned int wl_view_next_id = WL_VIEW_ID_BASE;
/* Callback set by WM backend to commit frame_buf after paint */
void (*W_ViewCommitBackingFn)(unsigned long id) = NULL;
void (*W_ViewDestroyBackingFn)(unsigned long id) = NULL;
extern void wl_view_destroy_backing_impl(unsigned long id);
/* Simple view lookup table (ID → W_View*) */
#define VIEW_TABLE_SIZE 256
@ -246,7 +249,8 @@ static void wl_destroy(void *vctx, W_View *view)
{
(void)vctx;
W_WL_InvalidateView(view->screen, view);
/* Nothing to free — synthetic ID only */
if (view->flags.topLevel && W_ViewDestroyBackingFn)
W_ViewDestroyBackingFn((unsigned long)view->window);
}
static void wl_set_background_color(void *vctx, W_View *view, WMColor *color)

View File

@ -2302,7 +2302,10 @@ wl_display_open(const char *name)
{
extern void (*W_ViewCommitBackingFn)(unsigned long id);
extern void wl_view_commit_backing_impl(unsigned long id);
extern void wl_view_destroy_backing_impl(unsigned long id);
W_ViewCommitBackingFn = wl_view_commit_backing_impl;
extern void (*W_ViewDestroyBackingFn)(unsigned long id);
W_ViewDestroyBackingFn = wl_view_destroy_backing_impl;
}
if (wl_state.scene) {
wwarning("wl_backend: scene graph created");
@ -6711,6 +6714,15 @@ void wl_view_commit_backing_impl(unsigned long id)
}
}
void wl_view_destroy_backing_impl(unsigned long id)
{
struct wl_frame_buf *fb = frame_buf_find((WNativeWindow)id);
if (!fb) return;
wl_list_remove(&fb->link);
wlr_scene_node_destroy(&fb->scene_buf->node);
wlr_buffer_drop(&fb->base);
}
static void
wl_client_synth_configure(WNativeWindow client_win,
int x, int y, int width, int height,