From 567b828e183e15d389a8d3b17f4bd5859ee2a250 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Fri, 27 Dec 2024 12:45:53 -0500
Subject: [PATCH] wayland: Use the proper popup coordinates if the position is
set while the window is hidden
---
src/video/wayland/SDL_waylandwindow.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index 31aa805cc6e0e..69dccf693889d 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -1852,8 +1852,8 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
xdg_positioner_set_size(data->shell_surface.xdg.popup.xdg_positioner, data->current.logical_width, data->current.logical_height);
// Set the popup initial position
- position_x = window->x;
- position_y = window->y;
+ position_x = window->last_position_pending ? window->pending.x : window->x;
+ position_y = window->last_position_pending ? window->pending.y : window->y;
EnsurePopupPositionIsValid(window, &position_x, &position_y);
if (data->scale_to_display) {
position_x = PixelToPoint(window->parent, position_x);