backend/wayland: Use specific wl_global versions

Explicitly use the version we support instead of accepting the
compositor's version.
This commit is contained in:
Scott Anderson 2018-11-11 17:00:51 +13:00
parent 4e03802057
commit 47545cf550
1 changed files with 21 additions and 17 deletions

View File

@ -50,24 +50,28 @@ static const struct zxdg_shell_v6_listener xdg_shell_listener = {
}; };
static void registry_global(void *data, struct wl_registry *registry, static void registry_global(void *data, struct wl_registry *registry,
uint32_t name, const char *interface, uint32_t version) { uint32_t name, const char *iface, uint32_t version) {
struct wlr_wl_backend *backend = data; struct wlr_wl_backend *wl = data;
wlr_log(WLR_DEBUG, "Remote wayland global: %s v%d", interface, version);
if (strcmp(interface, wl_compositor_interface.name) == 0) { wlr_log(WLR_DEBUG, "Remote wayland global: %s v%d", iface, version);
backend->compositor = wl_registry_bind(registry, name,
&wl_compositor_interface, version); if (strcmp(iface, wl_compositor_interface.name) == 0) {
} else if (strcmp(interface, zxdg_shell_v6_interface.name) == 0) { wl->compositor = wl_registry_bind(registry, name,
backend->shell = wl_registry_bind(registry, name, &wl_compositor_interface, 4);
&zxdg_shell_v6_interface, version);
zxdg_shell_v6_add_listener(backend->shell, &xdg_shell_listener, NULL); } else if (strcmp(iface, wl_seat_interface.name) == 0) {
} else if (strcmp(interface, wl_shm_interface.name) == 0) { wl->seat = wl_registry_bind(registry, name,
backend->shm = wl_registry_bind(registry, name, &wl_seat_interface, 2);
&wl_shm_interface, version); wl_seat_add_listener(wl->seat, &seat_listener, wl);
} else if (strcmp(interface, wl_seat_interface.name) == 0) {
backend->seat = wl_registry_bind(registry, name, } else if (strcmp(iface, wl_shm_interface.name) == 0) {
&wl_seat_interface, version); wl->shm = wl_registry_bind(registry, name,
wl_seat_add_listener(backend->seat, &seat_listener, backend); &wl_shm_interface, 1);
} else if (strcmp(iface, zxdg_shell_v6_interface.name) == 0) {
wl->shell = wl_registry_bind(registry, name,
&zxdg_shell_v6_interface, 1);
zxdg_shell_v6_add_listener(wl->shell, &xdg_shell_listener, NULL);
} }
} }