diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2014-02-11 13:50:08 -0800 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2014-02-11 16:22:10 -0800 |
commit | 239902b323fc545c68469b465bf4af60e6655d02 (patch) | |
tree | 43cfc9f0a83a3c4466872e743d65917d6827bebe /clients/simple-shm.c | |
parent | 2bff94e057f91f6a483b34421bec2e24b9765f4f (diff) | |
download | weston-239902b323fc545c68469b465bf4af60e6655d02.tar.gz |
client: Fix shell unstable version check
Use a static assert to catch mismatch between implementation and
interface version. Fix window.c to not use XDG_SHELL_VERSION_CURRENT,
which will fail to catch version mismatches. The implementation version
must updated manually when the implementation is updated to use the new
interface.
Diffstat (limited to 'clients/simple-shm.c')
-rw-r--r-- | clients/simple-shm.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/clients/simple-shm.c b/clients/simple-shm.c index 820e8a2d..2dbe7cb5 100644 --- a/clients/simple-shm.c +++ b/clients/simple-shm.c @@ -331,6 +331,12 @@ static const struct xdg_shell_listener xdg_shell_listener = { xdg_shell_ping, }; +#define XDG_VERSION 2 /* The version of xdg-shell that we implement */ +#ifdef static_assert +static_assert(XDG_VERSION == XDG_SHELL_VERSION_CURRENT, + "Interface version doesn't match implementation version"); +#endif + static void registry_handle_global(void *data, struct wl_registry *registry, uint32_t id, const char *interface, uint32_t version) @@ -344,7 +350,7 @@ registry_handle_global(void *data, struct wl_registry *registry, } else if (strcmp(interface, "xdg_shell") == 0) { d->shell = wl_registry_bind(registry, id, &xdg_shell_interface, 1); - xdg_shell_use_unstable_version(d->shell, 1); + xdg_shell_use_unstable_version(d->shell, XDG_VERSION); xdg_shell_add_listener(d->shell, &xdg_shell_listener, d); } else if (strcmp(interface, "wl_shm") == 0) { d->shm = wl_registry_bind(registry, |