WINGs/wayland: handle xdg_toplevel close by synthesizing WM_DELETE_WINDOW

The close button press from the compositor sends xdg_toplevel.close,
but the handler only set a flag without notifying the WINGs event
system. Synthesize a WME_CLIENT_MESSAGE with deleteWindowAtom so
the window closeAction callback fires and the app shuts down
gracefully.
This commit is contained in:
Window Maker 2026-05-25 13:03:31 +02:00
parent 4442380d50
commit e2f73e90e5
1 changed files with 11 additions and 3 deletions

View File

@ -364,9 +364,17 @@ xdg_toplevel_handle_close(void *data, struct xdg_toplevel *xt)
{
(void)xt;
WLClientToplevel *top = data;
top->want_close = 1;
/* TODO: synthesize a WMEvent close so the WINGs app can shut down
* gracefully. For now we just exit on next event-loop turn. */
if (!top || !top->view) return;
W_Screen *scr = top->view->screen;
WMEvent ev;
memset(&ev, 0, sizeof(ev));
ev.type = WME_CLIENT_MESSAGE;
ev.window = top->view->window;
ev.u.clientMessage.message_type = scr->protocolsAtom;
ev.u.clientMessage.format = 32;
ev.u.clientMessage.data.l[0] = scr->deleteWindowAtom;
W_WL_EnqueueEvent(scr, &ev, top->view);
}
static void