On Mon, Feb 15, 2016 at 7:48 PM, Jonas Ådahl <[email protected]> wrote:
The proxy wrapper approach can be tested out by appling this patch: > https://lists.freedesktop.org/archives/wayland-devel/2015-June/023054.html Paraphrased here: > In short, instead of > > bar = wl_foo_get_bar(foo); > wl_proxy_set_queue((struct wl_proxy *) bar, queue); > wl_bar_add_listener(bar, ...); > > with this RFC a client does > > foo_wrapper = wl_proxy_create_wrapper((struct wl_proxy *) foo); > wl_proxy_set_queue((struct wl_proxy *) foo_wrapper, queue); > bar = wl_foo_get(foo_wrapper); > wl_bar_add_listener(bar, ...); 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): bar = wl_bar_new(); wl_proxy_set_queue((struct wl_proxy*)bar, queue); wl_bar_add_listener(bar, ...); wl_foo_get_bar_id(foo, bar, ...);
_______________________________________________ wayland-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/wayland-devel
