<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 15, 2016 at 7:48 PM, Jonas Ådahl <span dir="ltr"><<a href="mailto:jadahl@gmail.com" target="_blank">jadahl@gmail.com</a>></span> wrote:</div><div class="gmail_quote"><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
The proxy wrapper approach can be tested out by appling this patch:<br>
<a href="https://lists.freedesktop.org/archives/wayland-devel/2015-June/023054.html" rel="noreferrer" target="_blank">https://lists.freedesktop.org/archives/wayland-devel/2015-June/023054.html</a></blockquote><div><br></div><div>Paraphrased here:</div><div> </div><div>> In short, instead of</div><div>></div><div>>         bar = wl_foo_get_bar(foo);</div><div>>         wl_proxy_set_queue((struct wl_proxy *) bar, queue);</div><div>>         wl_bar_add_listener(bar, ...);</div><div>></div><div>> with this RFC a client does</div><div>></div><div>>         foo_wrapper = wl_proxy_create_wrapper((struct wl_proxy *) foo);</div><div>>         wl_proxy_set_queue((struct wl_proxy *) foo_wrapper, queue);</div><div>>         bar = wl_foo_get(foo_wrapper);</div><div>>         wl_bar_add_listener(bar, ...);</div><div><br></div><div>This seems unnecessarily complex. Instead the wl_proxy can be in an unassigned state (identified by the id being set to a special value that will never be used otherwise). This avoids the extra object, allows the same code to be used even if there are different constructors for bar, and allows other setup before the id is assigned (for instance wl_bar_add_listener is not thread safe and above examples rely on the queue being the one belonging to the current thread):</div><div><br></div><div>   bar = wl_bar_new();</div><div>   wl_proxy_set_queue((struct wl_proxy*)bar, queue);</div><div>   wl_bar_add_listener(bar, ...);</div><div>   wl_foo_get_bar_id(foo, bar, ...);</div><div><br></div></div><br></div></div>