wayland: Prefer our SSD implementation if available
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c
index 478fe0b..2199312 100644
--- a/src/video/wayland/SDL_waylandvideo.c
+++ b/src/video/wayland/SDL_waylandvideo.c
@@ -489,11 +489,7 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id,
Wayland_add_display(d, id);
} else if (SDL_strcmp(interface, "wl_seat") == 0) {
Wayland_display_add_input(d, id, version);
- } else if (
-#ifdef HAVE_LIBDECOR_H
- !d->shell.libdecor &&
-#endif
- SDL_strcmp(interface, "xdg_wm_base") == 0) {
+ } else if (SDL_strcmp(interface, "xdg_wm_base") == 0) {
d->shell.xdg = wl_registry_bind(d->registry, id, &xdg_wm_base_interface, 1);
xdg_wm_base_add_listener(d->shell.xdg, &shell_listener_xdg, NULL);
} else if (SDL_strcmp(interface, "wl_shm") == 0) {
@@ -553,17 +549,24 @@ Wayland_VideoInit(_THIS)
return SDL_SetError("Failed to get the Wayland registry");
}
-#ifdef HAVE_LIBDECOR_H
- if (SDL_WAYLAND_HAVE_WAYLAND_LIBDECOR) {
- data->shell.libdecor = libdecor_new(data->display, &libdecor_interface);
- }
-#endif
-
wl_registry_add_listener(data->registry, ®istry_listener, data);
// First roundtrip to receive all registry objects.
WAYLAND_wl_display_roundtrip(data->display);
+#ifdef HAVE_LIBDECOR_H
+ /* Don't have server-side decorations? Try client-side instead. */
+ if (!data->decoration_manager && SDL_WAYLAND_HAVE_WAYLAND_LIBDECOR) {
+ data->shell.libdecor = libdecor_new(data->display, &libdecor_interface);
+
+ /* If libdecor works, we don't need xdg-shell anymore. */
+ if (data->shell.libdecor && data->shell.xdg) {
+ xdg_wm_base_destroy(data->shell.xdg);
+ data->shell.xdg = NULL;
+ }
+ }
+#endif
+
// Second roundtrip to receive all output events.
WAYLAND_wl_display_roundtrip(data->display);