Can I copy-paste Wayland generated header in my own library header?

Pekka Paalanen ppaalanen at
Mon Dec 4 08:45:42 UTC 2017

On Sat, 02 Dec 2017 09:39:33 -0500
ferreiradaselva <ferreiradaselva at> wrote:

> Good morning.
> I'm writing a cross-platform window framework, like GLFW, but
> containing only two files (a source and a header).
> I would like to copy and paste the content of the xdg-shell.h
> generated with wayland-scanner into my header (swfw.h), between
> #ifdef/#endif, so if the user compiles for Wayland, the user won't
> need to generate the xdg-shell.h.
> My framework is under ZLIB, and Wayland is under MIT. I would like to
> know from the team: does it affect the license of my framework by
> copying and pasting the header to make my lib easier to use? And, if
> does, any recommendations about what to do?
> This is sort of how it would look like:
> #ifndef MY_LIB
> #define MY_LIB
> /* The whole xdg-shell.h header is pasted here */
> struct window {
>     struct wl_surface *surface;
>     struct wl_buffer *buffer;
>     ...
> };
> struct context {
>     struct wl_display *display;
>     struct wl_compositor *compositor;
>     struct wl_seat *seat;
>     struct wl_pointer *pointer;
>     struct wl_keyboard *keyboard;
>     ...
> };
> #endif /* USE_WAYLAND_BACKEND */
> /* Other backends */
> #endif /* MY_LIB */


first, IANAL, of course.

The copyrights header you get in the generated headers and code comes
from the XML files. It is the license of the XML protocol
specification. I'm not sure if it applies to the generated code or not,
I'd like to think it does, but I don't see much difference given how
they are meant to be used.

Personally I would have no problem whatsoever for you to do what you
want. Also the MIT license is very liberal, and you might want to read
the dissection here:

I would add annotations in your files to clearly document which parts
are verbatim/modified copies of the generated stuff, and from where and
how they were generated - perhaps generating and piecing together the
files could be part of your project's build from source even if your
distributables are just more source. I would also keep the (generated)
license blurbs with notes on which part of the file they apply to.

I don't know ZLIB license, or why you picked that instead of MIT, for

Since the whole purpose of wayland-protocols is that you take the XML
file, run it through wayland-scanner, and include the compiled product
of that in your program binaries, there is no intention to change or
affect *your* license. Even totally closed source proprietary programs
are just fine using anything generated by wayland-scanner from

I also see no reason to even attempt to forbid e.g. modifications to
the generated code or even the XML itself.


Mind, that while libwayland-client tries hard to maintain backwards
compatiblity, it is not guaranteeing forward compatibility. Code
generated with a newer wayland-scanner may not work with an older
libwayland-client. This has been necessary to fix bugs.

We encourage all projects to run wayland-scanner as part of their build
and match the wayland-scanner with the libwayland version they require
minimum, instead of storing the generated code in VCS. That way
distributions can choose a more recent libwayland minimum version with
any bug fixes in the generated code.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the wayland-devel mailing list