Who generate the headers?

Philipp Kerling pkerling at casix.org
Sat Dec 2 12:02:52 UTC 2017


Hi,

2017-12-02 (土) の 06:05 -0500 に ferreiradaselva さんは書きました:
> Hello, everyone
> 
> I'm still learning how the distribution to the access of the API
> works. I'm making a library like GLFW/SDL2 with Wayland as one of the
> backends.
> 
> I have in my system `/usr/include` the headers of my interest
> `wayland-client-protocol.h` and `wayland-client.h`. However, the
> protocols header doesn't have the XDG Shell API, since it's just
> recently declared stable.
I think there is a fundamental misunderstanding here: wayland-client-
protocol.h only includes the Wayland core protocol, which XDG Shell is
not part of. All other more-or-less-standardized stuff is in wayland-
protocols, which is separate. XDG Shell will (presumably) never be
available in wayland-client-protocol.h, also in future versions.

Only the protocol XML files are installed as part of wayland-protocols
(to /usr/share/wayland-protocols or similar). If you want to use them
in your application, you will have to call wayland-scanner and generate
the header and code files yourself (see below).

> The questions:
> 
> 1. If I wanted to have access to the unstable features (could be any,
> like XDG output, tablet, text input), could I generate the headers
> myself and I would have access to them by just linking my sources
> with `-lwayland-client`?
You have to generate the headers yourself if what you want to use is
not part of the core protocol, no matter whether the extension protocol
is stable or unstable. You also have to generate the code. Linking with
wayland-client is not enough as it also only contains the core protocol
symbols.

> 2. Is there some header generator available, anywhere, that is
> recommended?
wayland-scanner is part of core wayland. You hvae to generate the
"client-header" (.h) and "code" (.c) parts out of the XML(s) you want
to use.

Regards,
Philipp


More information about the wayland-devel mailing list