aboutsummaryrefslogtreecommitdiffstats
path: root/src/wayland-client-core.h
diff options
context:
space:
mode:
authorIsaac Freund <mail@isaacfreund.com>2025-07-02 12:15:33 +0200
committerPekka Paalanen <pq@iki.fi>2025-09-16 11:48:33 +0300
commitd81525a235e48cc5de3e4005a16ddb1fbdfd9d7c (patch)
tree13a938fa46e67c22a290c52b54188db492262f62 /src/wayland-client-core.h
parentconnection: Add a thread ID to WAYLAND_DEBUG output. (diff)
downloadwayland-d81525a235e48cc5de3e4005a16ddb1fbdfd9d7c.tar
wayland-d81525a235e48cc5de3e4005a16ddb1fbdfd9d7c.tar.gz
wayland-d81525a235e48cc5de3e4005a16ddb1fbdfd9d7c.tar.bz2
wayland-d81525a235e48cc5de3e4005a16ddb1fbdfd9d7c.tar.lz
wayland-d81525a235e48cc5de3e4005a16ddb1fbdfd9d7c.tar.xz
wayland-d81525a235e48cc5de3e4005a16ddb1fbdfd9d7c.tar.zst
wayland-d81525a235e48cc5de3e4005a16ddb1fbdfd9d7c.zip
client: add wl_display_dispatch_pending_single
As well as wl_display_dispatch_queue_pending_single. The motivation is writing libwayland bindings for a dynamic language with exceptions/non-local returns. Since it is invalid for a wl_dispatcher_func_t callback provided to libwayland to not return, there is no way to prevent dispatching of further events in the case of an exception in the dynamic language event handler. Furthermore, since creating/destroying Wayland objects in an event handler affects the dispatching of subsequent events by libwayland, it is not possible to collect Wayland events in a queue outside libwayland and dispatch them one-by-one after wl_display_dispatch_pending() returns. Adding libwayland API to dispatch at most one pending event solves this problem cleanly. The bindings can have libwayland dispatch a single event, wait for wl_display_dispatch_pending_single() to return, run the dynamic language event handler (which may longjmp away), and continue the loop for as long as there are more events to dispatch. References: https://codeberg.org/ifreund/janet-wayland Signed-off-by: Isaac Freund <mail@isaacfreund.com>
Diffstat (limited to 'src/wayland-client-core.h')
-rw-r--r--src/wayland-client-core.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/wayland-client-core.h b/src/wayland-client-core.h
index 970e625..e0523e4 100644
--- a/src/wayland-client-core.h
+++ b/src/wayland-client-core.h
@@ -269,9 +269,16 @@ wl_display_dispatch_queue_pending(struct wl_display *display,
struct wl_event_queue *queue);
int
+wl_display_dispatch_queue_pending_single(struct wl_display *display,
+ struct wl_event_queue *queue);
+
+int
wl_display_dispatch_pending(struct wl_display *display);
int
+wl_display_dispatch_pending_single(struct wl_display *display);
+
+int
wl_display_get_error(struct wl_display *display);
uint32_t