<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Aug 19, 2014 at 3:58 AM, Pekka Paalanen <span dir="ltr"><<a href="mailto:ppaalanen@gmail.com" target="_blank">ppaalanen@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On Wed, 16 Jul 2014 11:13:06 +0300<br>
Giulio Camuffo <<a href="mailto:giuliocamuffo@gmail.com">giuliocamuffo@gmail.com</a>> wrote:<br>
<br>
> 2014-07-15 20:39 GMT+03:00 Daniel Stone <<a href="mailto:daniel@fooishbar.org">daniel@fooishbar.org</a>>:<br>
> > Hi,<br>
> ><br>
> ><br>
> > On Tuesday, July 15, 2014, Giulio Camuffo <<a href="mailto:giuliocamuffo@gmail.com">giuliocamuffo@gmail.com</a>> wrote:<br>
> >><br>
> >> 2014-07-14 22:31 GMT+03:00 Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>>:<br>
> >> > Guilio,<br>
> >> > Would it be better to name it wl_event_queue_roundtrip and just have it<br>
> >> > take<br>
> >> > the wl_event_queue? I guess it is sort-of a wl_display operation, but<br>
> >> > you<br>
> >> > could argue it either way. Thoughts?<br>
> >><br>
> >> You have a point here, it makes more sense.<br>
> ><br>
> ><br>
> > TBH I'd rather steer clear of that nomenclature, since the 'queue' in an<br>
> > immediate request context implies delayed dispatch, rather than on a queue.<br>
><br>
> I didn't realize you could read it as "queue a roundtrip on a<br>
> wl_event". I think that the meaning is quite obvious once you know<br>
> that there is a wl_event_queue type in Wayland.<br>
<br>
</div>Hi,<br>
<br>
hm, that's a tricky one. Yes, the name wl_event_queue_roundtrip() is<br>
confusing when out of context, but as the argument is a wl_event_queue,<br>
that name is the logical and unfortunate result.<br>
<br>
Another problem with wl_display_roundtrip_queue() is that it gets both<br>
wl_display and wl_event_queue as arguments. Therefore the function<br>
would need to check that the wl_event_queue indeed belongs to the given<br>
wl_display. It's just a thing one can get wrong, and it has no benefits<br>
that I see.<br>
<br>
wl_display_roundtrip_queue() taking only wl_event_queue as an argument<br>
would be strange, because the name implies a wl_display method.<br>
<br>
(Up until this point, I would have agreed with Giulio and Jason...)<br>
<br>
But, now I see, that we already have:<br>
<br>
int wl_display_dispatch_queue(struct wl_display *display,<br>
struct wl_event_queue *queue);<br>
int wl_display_dispatch_queue_pending(struct wl_display *display,<br>
struct wl_event_queue *queue);<br>
int wl_display_prepare_read_queue(struct wl_display *display,<br>
struct wl_event_queue *queue);<br>
<br>
So there is precendent, that redundant arguments are ok, and<br>
wl_display_roundtrip_queue() would indeed follow the existing scheme.<br>
<br>
Btw. I do not see anywhere, where the libwayland-client code would be<br>
checking that the wl_display and the wl_event_queue would actually be<br>
related. Would be a good thing to add more checks to the public API<br>
functions for that.<br>
<br>
I think I would go with wl_display_roundtrip_queue() here. Would you<br>
agree?<br></blockquote><div><br></div><div>Yeah, you've convinced me. I don't like the name (and, by extension, don't like the others) but it goes better with the current API. Let's go with that.<br></div>
<div>--Jason <br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
Thanks,<br>
pq<br>
<div class="HOEnZb"><div class="h5"><br>
> >> > On Mon, Jul 14, 2014 at 7:15 AM, Giulio Camuffo<br>
> >> > <<a href="mailto:giuliocamuffo@gmail.com">giuliocamuffo@gmail.com</a>><br>
> >> > wrote:<br>
> >> >><br>
> >> >> wl_display_roundtrip() works on the default queue. Add a parallel<br>
> >> >> wl_display_roundtrip_queue().<br>
> >> >> ---<br>
> >> >><br>
> >> >> v3: fixed dispatch call in place of dispatch_queue<br>
> >> >> documented the queue parameter<br>
> >> >> src/wayland-client.c | 24 +++++++++++++++++++++---<br>
> >> >> src/wayland-client.h | 2 ++<br>
> >> >> 2 files changed, 23 insertions(+), 3 deletions(-)<br>
> >> >><br>
> >> >> diff --git a/src/wayland-client.c b/src/wayland-client.c<br>
> >> >> index e8aab7e..d2c1b5c 100644<br>
> >> >> --- a/src/wayland-client.c<br>
> >> >> +++ b/src/wayland-client.c<br>
> >> >> @@ -834,15 +834,16 @@ static const struct wl_callback_listener<br>
> >> >> sync_listener = {<br>
> >> >> /** Block until all pending request are processed by the server<br>
> >> >> *<br>
> >> >> * \param display The display context object<br>
> >> >> + * \param queue The queue on which to run the roundtrip<br>
> >> >> * \return The number of dispatched events on success or -1 on failure<br>
> >> >> *<br>
> >> >> * Blocks until the server process all currently issued requests and<br>
> >> >> - * sends out pending events on all event queues.<br>
> >> >> + * sends out pending events on the event queue.<br>
> >> >> *<br>
> >> >> * \memberof wl_display<br>
> >> >> */<br>
> >> >> WL_EXPORT int<br>
> >> >> -wl_display_roundtrip(struct wl_display *display)<br>
> >> >> +wl_display_roundtrip_queue(struct wl_display *display, struct<br>
> >> >> wl_event_queue *queue)<br>
> >> >> {<br>
> >> >> struct wl_callback *callback;<br>
> >> >> int done, ret = 0;<br>
> >> >> @@ -851,9 +852,10 @@ wl_display_roundtrip(struct wl_display *display)<br>
> >> >> callback = wl_display_sync(display);<br>
> >> >> if (callback == NULL)<br>
> >> >> return -1;<br>
> >> >> + wl_proxy_set_queue(callback, queue);<br>
> >> >> wl_callback_add_listener(callback, &sync_listener, &done);<br>
> >> >> while (!done && ret >= 0)<br>
> >> >> - ret = wl_display_dispatch(display);<br>
> >> >> + ret = wl_display_dispatch_queue(display, queue);<br>
> >> >><br>
> >> >> if (ret == -1 && !done)<br>
> >> >> wl_callback_destroy(callback);<br>
> >> >> @@ -861,6 +863,22 @@ wl_display_roundtrip(struct wl_display *display)<br>
> >> >> return ret;<br>
> >> >> }<br>
> >> >><br>
> >> >> +/** Block until all pending request are processed by the server<br>
> >> >> + *<br>
> >> >> + * \param display The display context object<br>
> >> >> + * \return The number of dispatched events on success or -1 on failure<br>
> >> >> + *<br>
> >> >> + * Blocks until the server process all currently issued requests and<br>
> >> >> + * sends out pending events on the default event queue.<br>
> >> >> + *<br>
> >> >> + * \memberof wl_display<br>
> >> >> + */<br>
> >> >> +WL_EXPORT int<br>
> >> >> +wl_display_roundtrip(struct wl_display *display)<br>
> >> >> +{<br>
> >> >> + wl_display_roundtrip_queue(display, &display->default_queue);<br>
> >> >> +}<br>
> >> >> +<br>
> >> >> static int<br>
> >> >> create_proxies(struct wl_proxy *sender, struct wl_closure *closure)<br>
> >> >> {<br>
> >> >> diff --git a/src/wayland-client.h b/src/wayland-client.h<br>
> >> >> index 2a32785..4377207 100644<br>
> >> >> --- a/src/wayland-client.h<br>
> >> >> +++ b/src/wayland-client.h<br>
> >> >> @@ -163,6 +163,8 @@ int wl_display_dispatch_pending(struct wl_display<br>
> >> >> *display);<br>
> >> >> int wl_display_get_error(struct wl_display *display);<br>
> >> >><br>
> >> >> int wl_display_flush(struct wl_display *display);<br>
> >> >> +int wl_display_roundtrip_queue(struct wl_display *display,<br>
> >> >> + struct wl_event_queue *queue);<br>
> >> >> int wl_display_roundtrip(struct wl_display *display);<br>
> >> >> struct wl_event_queue *wl_display_create_queue(struct wl_display<br>
> >> >> *display);<br>
> >> >><br>
> >> >> --<br>
> >> >> 2.0.1<br>
> >> >><br>
> >> >> _______________________________________________<br>
> >> >> wayland-devel mailing list<br>
> >> >> <a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
> >> >> <a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
> >> ><br>
> >> ><br>
> >> _______________________________________________<br>
> >> wayland-devel mailing list<br>
> >> <a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
> >> <a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
> _______________________________________________<br>
> wayland-devel mailing list<br>
> <a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
<br>
</div></div></blockquote></div><br></div></div>