[PATCH] client: "Ex" versions of constructors, alternative to proxy_wrapper
spitzak at gmail.com
Tue May 3 18:08:31 UTC 2016
On Mon, May 2, 2016 at 10:42 PM, <spitzak at gmail.com> wrote:
> From: Bill Spitzak <spitzak at gmail.com>
> Scanner produces a xyz_create() for each object that wraps the
> wl_proxy_create function. For each constructor request a new "Ex" version
> is created that takes the created object. This allows the queue to be set
> before creation. The existing code using proxy_wrapper changed to use this.
> wl_registry_bindEx is nyi and is needed
The comment (the proxy_wrapper does not fix this either) is for the events
and was added to the wrong paragraph:
You cannot use create for an object provided by an event, and I see no good
> way to achieve this. Not very important unless static wl_proxy is
(the proxy_wrapper does not fix this either)
It may be better for the create function to take an actual factory proxy
> rather than a wl_proxy*, to avoid casts.
I now think trying to reuse wl_proxy_create is a mistake. That function is
not being used by any other Wayland code and I guess is legacy. Instead
data from the factory object can be copied when the request is made, so no
factory has to be passed to create (which would not call wl_proxy_create
and would not need the lock). The example using the wl_callback would then
look like this:
callback = wl_callback_create(); /* sets interface and refcount */
wl_proxy_set_queue((struct wl_proxy *) callback, queue); /* sets
wl_callback_add_listener(callback, &sync_listener, &done); /* sets
wl_display_syncEx(display, callback); /* sets display, version, id
If set_queue was not called it could also copy the queue from the factory
object, but I'm not sure if that is necessary.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the wayland-devel