SDL: wayland: Scale-to-display mode requires both viewports and xdg-output for proper functionality

From c0325862624694d68ece13950b37816f1cf5a080 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Mon, 10 Feb 2025 15:47:28 -0500
Subject: [PATCH] wayland: Scale-to-display mode requires both viewports and
 xdg-output for proper functionality

---
 src/video/wayland/SDL_waylandvideo.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c
index fc8edc1e025a5..944d0d91494d8 100644
--- a/src/video/wayland/SDL_waylandvideo.c
+++ b/src/video/wayland/SDL_waylandvideo.c
@@ -1366,10 +1366,16 @@ bool Wayland_VideoInit(SDL_VideoDevice *_this)
     // First roundtrip to receive all registry objects.
     WAYLAND_wl_display_roundtrip(data->display);
 
-    // Require viewports for display scaling.
-    if (data->scale_to_display_enabled && !data->viewporter) {
-        SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "wayland: Display scaling requires the missing 'wp_viewporter' protocol: disabling");
-        data->scale_to_display_enabled = false;
+    // Require viewports and xdg-output for display scaling.
+    if (data->scale_to_display_enabled) {
+        if (!data->viewporter) {
+            SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "wayland: Display scaling requires the missing 'wp_viewporter' protocol: disabling");
+            data->scale_to_display_enabled = false;
+        }
+        if (!data->xdg_output_manager) {
+            SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "wayland: Display scaling requires the missing 'zxdg_output_manager_v1' protocol: disabling");
+            data->scale_to_display_enabled = false;
+        }
     }
 
     // Now that we have all the protocols, load libdecor if applicable