From 9f1a7bb94cd22f7fce000b44056577b434d932a9 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Wed, 22 Feb 2023 11:38:30 -0500 Subject: [PATCH] wayland: Track the window display ID locally Track the current window display ID locally so as not to depend on specific behavior of the video layer, which may change the value at times when it isn't expected. --- src/video/wayland/SDL_waylandwindow.c | 4 +++- src/video/wayland/SDL_waylandwindow.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index f77feb7ecd..c84206baf0 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -958,6 +958,8 @@ static void Wayland_move_window(SDL_Window *window, SDL_DisplayData *driverdata) */ SDL_Rect bounds; SDL_GetDisplayBounds(displays[i], &bounds); + + window->driverdata->last_displayID = displays[i]; SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MOVED, bounds.x, bounds.y); break; } @@ -1611,7 +1613,7 @@ void Wayland_SetWindowFullscreen(_THIS, SDL_Window *window, * If the window is already positioned on the target output, just update the * window geometry. */ - if (window->last_displayID != display->id) { + if (wind->last_displayID != display->id) { wind->fullscreen_was_positioned = SDL_TRUE; SetFullscreen(window, output); } else { diff --git a/src/video/wayland/SDL_waylandwindow.h b/src/video/wayland/SDL_waylandwindow.h index 7391408ff2..9a7cc13213 100644 --- a/src/video/wayland/SDL_waylandwindow.h +++ b/src/video/wayland/SDL_waylandwindow.h @@ -111,6 +111,7 @@ struct SDL_WindowData int wl_window_width, wl_window_height; int system_min_required_width; int system_min_required_height; + SDL_DisplayID last_displayID; SDL_bool floating; SDL_bool is_fullscreen; SDL_bool in_fullscreen_transition;