[RFC wayland 1/2] client: Introduce 'proxy wrapper' concept

Bill Spitzak spitzak at gmail.com
Wed Jul 1 14:50:58 PDT 2015


>
> > > > > > 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, ...);
>> > > > > >
>> > > > > > and the with other idea that is implemented anywhere yet AFAIK
>> > > > > >
>> > > > > >         bar = wl_foo_get_bar_with_queue(foo, queue)
>> > > > > >         wl_bar_add_listener(bar, ...);
>>
>> > > > wl_proxy_create_full(..., queue, listener)
>>
>
I would worry that there will be more things that can be done to a proxy
besides setting it's queue and listener. So instead of adding lots of
arguments to the get_bar wrapper, allow the proxy to be created and
everything set up *before* the server object is created:

    bar = wl_new_bar();
    wl_proxy_set_queue((struct wl_proxy*)bar, queue); // default queue if
this not done
    wl_bar_add_listener(bar, ...);
    wl_foo_get_bar(foo, bar);

Note the last function will have to be renamed to avoid a collision in C
but I don't have any good ideas what to name it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20150701/ad0bb18e/attachment.html>


More information about the wayland-devel mailing list