SDL: wayland: Flush in SetWindowFullscreen

From 2506729893c0fcbe5875750043d7cb695313ea1d Mon Sep 17 00:00:00 2001
From: Sebastian Krzyszkowiak <[EMAIL REDACTED]>
Date: Mon, 2 Aug 2021 08:15:10 +0200
Subject: [PATCH] wayland: Flush in SetWindowFullscreen

The flush has been removed in e5f9fae034df8ca305241c5a666e7702fcf9958f.
Unfortunately, even though ideally the flush shouldn't be necessary,
our resize sequence isn't... well, perfect, and removing that flush causes
tons of troubles.

We're also still flushing in other paths where the window size can be
changed by the compositor and where we may potentially have to obey that
change, like in Wayland_MaximizeWindow.

This also removes the hack introduced in 7f261d3b7667978ced93a4fdc6aec2380df3d87f,
which introduces problems with protocol violations and seems to not be
necessary when flushing.
---
 src/video/wayland/SDL_waylandwindow.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index eb1e78a0a..4ffc5425d 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -924,15 +924,10 @@ Wayland_SetWindowFullscreen(_THIS, SDL_Window * window,
                             SDL_VideoDisplay * _display, SDL_bool fullscreen)
 {
     struct wl_output *output = ((SDL_WaylandOutputData*) _display->driverdata)->output;
+    SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata;
     SetFullscreen(window, fullscreen ? output : NULL);
 
-    /* The window may have been resized to the output size, so reset this when
-     * returning to a window
-     */
-    if (!fullscreen) {
-        SDL_WindowData *wind = (SDL_WindowData*) window->driverdata;
-        Wayland_HandleResize(window, window->windowed.w, window->windowed.h, wind->scale_factor);
-    }
+    WAYLAND_wl_display_flush( viddata->display );
 }
 
 void