From 0f5b8a99f05d749fdfc62fd404c53342d8204d0c Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Mon, 2 Aug 2021 19:48:31 -0400 Subject: [PATCH] wayland: For libdecor, dispatch immediately after setting fullscreen Reference: #4578 --- src/video/wayland/SDL_waylandwindow.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index dff4a0687..49db037a8 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -948,7 +948,24 @@ Wayland_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata; SetFullscreen(window, fullscreen ? output : NULL); - WAYLAND_wl_display_flush( viddata->display ); + WAYLAND_wl_display_flush(viddata->display); +#ifdef HAVE_LIBDECOR_H + /* For libdecor we _have_ to dispatch immediately, because libdecor state + * strongly depends on the "current" state of the window. For example, if an + * application calls SetWindowSize right after this, libdecor will still + * think the window is fullscreen and not floating because configuration has + * not yet occurred, so the call will get completely ignored! So, take the + * time penalty and ensure that libdecor state matches SDL state. + * + * TODO: If Wayland_SetWindowSize ever stops checking for floating state, + * this can be removed. + * + * -flibit + */ + if (viddata->shell.libdecor) { + WAYLAND_wl_display_dispatch(viddata->display); + } +#endif } void