[PATCH wayland v3] client: add a public function to make a roundtrip on a custom queue
Giulio Camuffo
giuliocamuffo at gmail.com
Wed Aug 20 05:45:08 PDT 2014
2014-08-20 15:03 GMT+03:00 Pekka Paalanen <ppaalanen at gmail.com>:
> On Mon, 14 Jul 2014 17:15:39 +0300
> Giulio Camuffo <giuliocamuffo at gmail.com> wrote:
>
>> wl_display_roundtrip() works on the default queue. Add a parallel
>> wl_display_roundtrip_queue().
>> ---
>>
>> v3: fixed dispatch call in place of dispatch_queue
>> documented the queue parameter
>> src/wayland-client.c | 24 +++++++++++++++++++++---
>> src/wayland-client.h | 2 ++
>> 2 files changed, 23 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/wayland-client.c b/src/wayland-client.c
>> index e8aab7e..d2c1b5c 100644
>> --- a/src/wayland-client.c
>> +++ b/src/wayland-client.c
>> @@ -834,15 +834,16 @@ static const struct wl_callback_listener sync_listener = {
>> /** Block until all pending request are processed by the server
>> *
>> * \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
>> *
>> * 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
>> */
>> 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;
>> int done, ret = 0;
>> @@ -851,9 +852,10 @@ wl_display_roundtrip(struct wl_display *display)
>> callback = wl_display_sync(display);
>> if (callback == NULL)
>> return -1;
>> + wl_proxy_set_queue(callback, queue);
>> wl_callback_add_listener(callback, &sync_listener, &done);
>> while (!done && ret >= 0)
>> - ret = wl_display_dispatch(display);
>> + ret = wl_display_dispatch_queue(display, queue);
>>
>> if (ret == -1 && !done)
>> wl_callback_destroy(callback);
>> @@ -861,6 +863,22 @@ wl_display_roundtrip(struct wl_display *display)
>> 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)
>> +{
>> + wl_display_roundtrip_queue(display, &display->default_queue);
>> +}
>> +
>> static int
>> create_proxies(struct wl_proxy *sender, struct wl_closure *closure)
>> {
>> diff --git a/src/wayland-client.h b/src/wayland-client.h
>> index 2a32785..4377207 100644
>> --- a/src/wayland-client.h
>> +++ b/src/wayland-client.h
>> @@ -163,6 +163,8 @@ int wl_display_dispatch_pending(struct wl_display *display);
>> int wl_display_get_error(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);
>> struct wl_event_queue *wl_display_create_queue(struct wl_display *display);
>>
>
> Hi Giulio,
>
> the concensus became to prefer this version of the patch, but
> unfortunately:
>
> Applying: client: add a public function to make a roundtrip on a custom queue
> error: patch failed: src/wayland-client.h:163
> error: src/wayland-client.h: patch does not apply
> Patch failed at 0001 client: add a public function to make a roundtrip on a custom queue
>
> Could you rebase it, please?
Are you using 3-way merge? It applies with "git am -3" here, while it
issues that error without the -3.
>
> Would it be possible to get some tests to go with it? :-)
I'll try to find the time for it :)
--
Giulio
>
>
> Thanks,
> pq
More information about the wayland-devel
mailing list