(wayland sever/client) multiple binding to a global resources.

Pekka Paalanen ppaalanen at gmail.com
Thu Feb 4 09:15:58 UTC 2016


Hi

On Thu, 4 Feb 2016 16:28:14 +0900
nicesj at nicesj.com wrote:

> Dear all,
> 
> I'm still learning of the philosphy of the wayland world.
> 
> while seeing and writing some codes, I got a question regarding
> mutiple binding to a global objects.
> 
> The client should register a event callback for global registry.
> 
> also the server will announce its global resources.
> 
> in this corner, when a client gets global registry event callback, it
> checks interface string and then tries to bind it to a specific
> resource such as wl_compositor.
> 
> at this time, if our lovely client developer tries to bind one
> several times, how the server handles this request?
> 
> just bind and create them? (ex, wl_compositor_interface,
> wl_shm_interface, and so on)

Yes.

> 
> or should it be deat as an error case?

No, it is perfectly valid.

> 
> I'm newbie, so my question could be a dummy silly ugly question.
> please let me know it to not be a dummer ;)

No worries. :-)

Binding multiple times to the same global is ok. The result is that you
get multiple protocol objects, all referring to the same underlying
global "thing".

Code wise it would be possible to specify that binding a particular
global interface creates a new instance of something rather than
referring to a single global "thing", but we do not tend to do that
because it does not quite fit the semantical model. A practical
reason is that you cannot pass extra arguments to the bind request.

Wayland-aware libraries can use this to get their own "copies" of
globals so that the library user does not need to provide them (which
would be quite labourious as then the user also needs to relay events
and agree on destruction). Often this happens by passing the wl_display
to the library, and then the library creates its own wl_registry.

It does not matter to the compositor which instance of wl_registry is
used to bind a global.

Also note, that a compositor can advertise multiple globals of the same
interface. Probably the most common case is advertising several
wl_output globals, one per monitor.


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 811 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20160204/c465c6c4/attachment.sig>


More information about the wayland-devel mailing list