|
96 | 96 | #define SDL_WL_OUTPUT_VERSION 3
|
97 | 97 | #endif
|
98 | 98 |
|
| 99 | +#if SDL_WAYLAND_CHECK_VERSION(1, 24, 0) |
| 100 | +#define SDL_WL_SHM_VERSION 2 |
| 101 | +#else |
| 102 | +#define SDL_WL_SHM_VERSION 1 |
| 103 | +#endif |
| 104 | + |
| 105 | + |
99 | 106 | // The SDL wayland-client minimum is 1.18, which supports version 3.
|
100 | 107 | #define SDL_WL_DATA_DEVICE_VERSION 3
|
101 | 108 |
|
@@ -1280,7 +1287,7 @@ static void display_handle_global(void *data, struct wl_registry *registry, uint
|
1280 | 1287 | d->shell.xdg = wl_registry_bind(d->registry, id, &xdg_wm_base_interface, SDL_min(version, 7));
|
1281 | 1288 | xdg_wm_base_add_listener(d->shell.xdg, &shell_listener_xdg, NULL);
|
1282 | 1289 | } else if (SDL_strcmp(interface, "wl_shm") == 0) {
|
1283 |
| - d->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1); |
| 1290 | + d->shm = wl_registry_bind(registry, id, &wl_shm_interface, SDL_WL_SHM_VERSION); |
1284 | 1291 | } else if (SDL_strcmp(interface, "zwp_relative_pointer_manager_v1") == 0) {
|
1285 | 1292 | d->relative_pointer_manager = wl_registry_bind(d->registry, id, &zwp_relative_pointer_manager_v1_interface, 1);
|
1286 | 1293 | } else if (SDL_strcmp(interface, "zwp_pointer_constraints_v1") == 0) {
|
@@ -1570,7 +1577,11 @@ static void Wayland_VideoCleanup(SDL_VideoDevice *_this)
|
1570 | 1577 | }
|
1571 | 1578 |
|
1572 | 1579 | if (data->shm) {
|
1573 |
| - wl_shm_destroy(data->shm); |
| 1580 | + if (wl_shm_get_version(data->shm) >= WL_SHM_RELEASE_SINCE_VERSION) { |
| 1581 | + wl_shm_release(data->shm); |
| 1582 | + } else { |
| 1583 | + wl_shm_destroy(data->shm); |
| 1584 | + } |
1574 | 1585 | data->shm = NULL;
|
1575 | 1586 | }
|
1576 | 1587 |
|
|
0 commit comments