2 * Copyright (c) 2017-2019, 2021 Arm Limited.
4 * SPDX-License-Identifier: MIT
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 #include <wayland-client.h>
30 void registry_handler(void *data, struct wl_registry *wl_registry, uint32_t name, const char *interface,
34 * @brief Dispatch events from a Wayland event queue
36 * Dispatch events from a given Wayland display event queue, including calling event handlers, and flush out any
37 * requests the event handlers may have written. Specification of a timeout allows the wait to be bounded. If any
38 * events are already pending dispatch (have been read from the display by another thread or event queue), they
39 * will be dispatched and the function will return immediately, without waiting for new events to arrive.
41 * @param display Wayland display to dispatch events from
42 * @param queue Event queue to dispatch events from; other event queues will not have their handlers called from
43 * within this function
44 * @param timeout Maximum time to wait for events to arrive, in milliseconds
45 * @return 1 if one or more events were dispatched on this queue, 0 if the timeout was reached without any
46 * events being dispatched, or -1 on error.
48 int dispatch_queue(struct wl_display *display, struct wl_event_queue *queue, int timeout);