wayland: pump client display in main loop for close button support

In-process WINGs clients have their own wl_display connection that
needs to be dispatched for xdg_toplevel.close to be received. Add
W_WLClientDispatchPending() and call it each main loop iteration
so protocol events reach the client-side handlers promptly.
This commit is contained in:
Window Maker 2026-05-25 13:32:59 +02:00
parent 94157394d7
commit fe2ec1fb9e
2 changed files with 11 additions and 0 deletions

View File

@ -1186,6 +1186,15 @@ wlclient_dispatch(int timeout_ms, void *userdata)
wl_display_dispatch_pending(ctx->display);
}
/* Pump the client-side Wayland display so pending events (like
* xdg_toplevel.close) are dispatched. Called from the compositor
* main loop. */
void W_WLClientDispatchPending(void)
{
if (g_wlclient_ctx)
wlclient_dispatch(0, g_wlclient_ctx);
}
/* ------------------------------------------------------------------ */
/* Public API */
/* ------------------------------------------------------------------ */

View File

@ -3675,6 +3675,8 @@ wl_event_loop_run(void)
struct wl_event_loop *loop = wl_display_get_event_loop(wl_state.display);
while (!wl_state.terminate) {
wl_display_flush_clients(wl_state.display);
extern void W_WLClientDispatchPending(void);
W_WLClientDispatchPending();
wl_event_loop_dispatch(loop, 16);
/* Schedule frame AFTER dispatch so the frame event on the next
* iteration renders content from commits processed above. */