From d522fc87c5cc89d73f3b57f2827a5f62c7e83b45 Mon Sep 17 00:00:00 2001 From: Window Maker Date: Mon, 25 May 2026 13:33:30 +0200 Subject: [PATCH] wayland: use non-blocking read_events for client dispatch The poll-based wlclient_dispatch with timeout 0 missed events that were already buffered. Use prepare_read/read_events/dispatch_pending which reads whatever is available on the socket without polling. --- WINGs/wclient_wl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/WINGs/wclient_wl.c b/WINGs/wclient_wl.c index 83240ad..8001b66 100644 --- a/WINGs/wclient_wl.c +++ b/WINGs/wclient_wl.c @@ -1191,8 +1191,12 @@ wlclient_dispatch(int timeout_ms, void *userdata) * main loop. */ void W_WLClientDispatchPending(void) { - if (g_wlclient_ctx) - wlclient_dispatch(0, g_wlclient_ctx); + if (!g_wlclient_ctx || !g_wlclient_ctx->display) return; + /* Read any pending data from the socket and dispatch events */ + while (wl_display_prepare_read(g_wlclient_ctx->display) != 0) + wl_display_dispatch_pending(g_wlclient_ctx->display); + wl_display_read_events(g_wlclient_ctx->display); + wl_display_dispatch_pending(g_wlclient_ctx->display); } /* ------------------------------------------------------------------ */