client: Add wl_display_dispatch_queue_timeout

For dispatching messages on a queue with a timeout.

This slightly changes the samantics of wl_display_dispatch. Previously
it was possible for it to return even though there wasn't a single
dispatched event. The function correctly returned 0 in this case but it
is now used to indicate a timeout.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
This commit is contained in:
Sebastian Wick 2024-02-07 19:00:46 +01:00 committed by Derek Foreman
parent ff8b885523
commit ddd348da7e
2 changed files with 127 additions and 34 deletions

View file

@ -27,6 +27,7 @@
#define WAYLAND_CLIENT_CORE_H
#include <stdint.h>
#include <time.h>
#include "wayland-util.h"
#include "wayland-version.h"
@ -250,6 +251,11 @@ int
wl_display_dispatch_queue(struct wl_display *display,
struct wl_event_queue *queue);
int
wl_display_dispatch_queue_timeout(struct wl_display *display,
struct wl_event_queue *queue,
const struct timespec *timeout);
int
wl_display_dispatch_queue_pending(struct wl_display *display,
struct wl_event_queue *queue);