wayland: #ifdef guard code related to wl_shm_release()

This commit is contained in:
Daniel Eklöf 2024-07-18 14:27:40 +02:00
parent 87aac8708d
commit e11a4ab6af
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -1129,7 +1129,11 @@ handle_global(void *data, struct wl_registry *registry,
wayl->shm = wl_registry_bind(
wayl->registry, name, &wl_shm_interface, min(version, preferred));
wl_shm_add_listener(wayl->shm, &shm_listener, wayl);
#if defined(WL_SHM_RELEASE_SINCE_VERSION)
wayl->use_shm_release = version >= WL_SHM_RELEASE_SINCE_VERSION;
#else
wayl->use_shm_release = false;
#endif
}
else if (streq(interface, xdg_wm_base_interface.name)) {
@ -1698,9 +1702,11 @@ wayl_destroy(struct wayland *wayl)
if (wayl->primary_selection_device_manager != NULL)
zwp_primary_selection_device_manager_v1_destroy(wayl->primary_selection_device_manager);
if (wayl->shm != NULL) {
#if defined(WL_SHM_RELEASE_SINCE_VERSION)
if (wayl->use_shm_release)
wl_shm_release(wayl->shm);
else
#endif
wl_shm_destroy(wayl->shm);
}
if (wayl->sub_compositor != NULL)