From 1b08cd20b37e0605e9b7601c147b8d1709283f99 Mon Sep 17 00:00:00 2001
From: Cameron Gutman <[EMAIL REDACTED]>
Date: Fri, 12 Aug 2022 18:55:05 -0500
Subject: [PATCH] wayland: Add roundtrip in SetWindowFullscreen() to get new
size
The video core assumes that window->w/h will be updated before returning
from SetWindowFullscreen(). This is needed to generate a resize event
with the correct window size when exiting fullscreen.
The roundtrip allows us to receive the configure callback that informs
us of the new window size before returning.
Fixes #6043
---
src/video/wayland/SDL_waylandwindow.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index f5fe5e6f584..f39036c8e08 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -1643,7 +1643,8 @@ Wayland_SetWindowFullscreen(_THIS, SDL_Window * window,
SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata;
SetFullscreen(window, fullscreen ? output : NULL, SDL_TRUE);
- WAYLAND_wl_display_flush(viddata->display);
+ /* Roundtrip required to receive the updated window dimensions */
+ WAYLAND_wl_display_roundtrip(viddata->display);
}
void