How to get the protocol version of the peer side

Simon Ser contact at emersion.fr
Sat Feb 20 07:41:44 UTC 2021


The version is negotiated when binding to the global. The server
indicates its maximum supported version in wl_global_create. The client
receives the version supported by the server, and indicates its own
version in wl_registry_bind. The pattern is:

    static void handle_global(void *data, struct wl_registry *registry,
                              uint32_t name, const char *interface,
                              uint32_t server_version) {
        uint32_t bind_version = min(client_version, server_version);
        wl_registry_bind(…, bind_version);
    }

All child objects inherit the version of their parent (except some
corner-cases like wl_display and wl_buffer).

The server receives the version specified by the client in the bind
callback, and should pass it to wl_resource_create.
wl_resource_get_version should return the negotiated version.


More information about the wayland-devel mailing list