mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-31 22:25:25 -04:00
client: add a public function to make a roundtrip on a custom queue
wl_display_roundtrip() works on the default queue. Add a parallel wl_display_roundtrip_queue(). Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
parent
06472737a9
commit
77dd068d42
2 changed files with 23 additions and 3 deletions
|
|
@ -891,15 +891,16 @@ static const struct wl_callback_listener sync_listener = {
|
||||||
/** Block until all pending request are processed by the server
|
/** Block until all pending request are processed by the server
|
||||||
*
|
*
|
||||||
* \param display The display context object
|
* \param display The display context object
|
||||||
|
* \param queue The queue on which to run the roundtrip
|
||||||
* \return The number of dispatched events on success or -1 on failure
|
* \return The number of dispatched events on success or -1 on failure
|
||||||
*
|
*
|
||||||
* Blocks until the server process all currently issued requests and
|
* Blocks until the server process all currently issued requests and
|
||||||
* sends out pending events on all event queues.
|
* sends out pending events on the event queue.
|
||||||
*
|
*
|
||||||
* \memberof wl_display
|
* \memberof wl_display
|
||||||
*/
|
*/
|
||||||
WL_EXPORT int
|
WL_EXPORT int
|
||||||
wl_display_roundtrip(struct wl_display *display)
|
wl_display_roundtrip_queue(struct wl_display *display, struct wl_event_queue *queue)
|
||||||
{
|
{
|
||||||
struct wl_callback *callback;
|
struct wl_callback *callback;
|
||||||
int done, ret = 0;
|
int done, ret = 0;
|
||||||
|
|
@ -908,9 +909,10 @@ wl_display_roundtrip(struct wl_display *display)
|
||||||
callback = wl_display_sync(display);
|
callback = wl_display_sync(display);
|
||||||
if (callback == NULL)
|
if (callback == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
wl_proxy_set_queue((struct wl_proxy *) callback, queue);
|
||||||
wl_callback_add_listener(callback, &sync_listener, &done);
|
wl_callback_add_listener(callback, &sync_listener, &done);
|
||||||
while (!done && ret >= 0)
|
while (!done && ret >= 0)
|
||||||
ret = wl_display_dispatch(display);
|
ret = wl_display_dispatch_queue(display, queue);
|
||||||
|
|
||||||
if (ret == -1 && !done)
|
if (ret == -1 && !done)
|
||||||
wl_callback_destroy(callback);
|
wl_callback_destroy(callback);
|
||||||
|
|
@ -918,6 +920,22 @@ wl_display_roundtrip(struct wl_display *display)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Block until all pending request are processed by the server
|
||||||
|
*
|
||||||
|
* \param display The display context object
|
||||||
|
* \return The number of dispatched events on success or -1 on failure
|
||||||
|
*
|
||||||
|
* Blocks until the server process all currently issued requests and
|
||||||
|
* sends out pending events on the default event queue.
|
||||||
|
*
|
||||||
|
* \memberof wl_display
|
||||||
|
*/
|
||||||
|
WL_EXPORT int
|
||||||
|
wl_display_roundtrip(struct wl_display *display)
|
||||||
|
{
|
||||||
|
return wl_display_roundtrip_queue(display, &display->default_queue);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
create_proxies(struct wl_proxy *sender, struct wl_closure *closure)
|
create_proxies(struct wl_proxy *sender, struct wl_closure *closure)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -166,6 +166,8 @@ uint32_t wl_display_get_protocol_error(struct wl_display *display,
|
||||||
uint32_t *id);
|
uint32_t *id);
|
||||||
|
|
||||||
int wl_display_flush(struct wl_display *display);
|
int wl_display_flush(struct wl_display *display);
|
||||||
|
int wl_display_roundtrip_queue(struct wl_display *display,
|
||||||
|
struct wl_event_queue *queue);
|
||||||
int wl_display_roundtrip(struct wl_display *display);
|
int wl_display_roundtrip(struct wl_display *display);
|
||||||
struct wl_event_queue *wl_display_create_queue(struct wl_display *display);
|
struct wl_event_queue *wl_display_create_queue(struct wl_display *display);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue