SDL: wayland: Adjust the scaled popup position even if the dimensions didn't change

From 5579010b6aa62886f570a66cfba44a067b027db3 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Fri, 3 Jan 2025 17:11:26 -0500
Subject: [PATCH] wayland: Adjust the scaled popup position even if the
 dimensions didn't change

Otherwise, the unscaled position will be sent.
---
 src/video/wayland/SDL_waylandwindow.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index 6d463b3bdbab0..2755a43db8038 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -1042,18 +1042,21 @@ static void handle_configure_xdg_popup(void *data,
         wind->requested.logical_height = height;
 
         if (wind->scale_to_display) {
-            x = PointToPixel(wind->sdlwindow->parent, x);
-            y = PointToPixel(wind->sdlwindow->parent, y);
             wind->requested.pixel_width = PointToPixel(wind->sdlwindow, width);
             wind->requested.pixel_height = PointToPixel(wind->sdlwindow, height);
         }
     }
 
-    wind->last_configure.width = width;
-    wind->last_configure.height = height;
+    if (wind->scale_to_display) {
+        x = PointToPixel(wind->sdlwindow->parent, x);
+        y = PointToPixel(wind->sdlwindow->parent, y);
+    }
 
     SDL_SendWindowEvent(wind->sdlwindow, SDL_EVENT_WINDOW_MOVED, x, y);
 
+    wind->last_configure.width = width;
+    wind->last_configure.height = height;
+
     if (wind->shell_surface_status == WAYLAND_SHELL_SURFACE_STATUS_WAITING_FOR_CONFIGURE) {
         wind->shell_surface_status = WAYLAND_SHELL_SURFACE_STATUS_WAITING_FOR_FRAME;
     }