From a7d345958d06567f34d11b6c8ddf504157b22ba4 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Sat, 3 Sep 2022 13:11:29 -0400 Subject: [PATCH] wayland: Trigger a commit on fullscreen update If additional fullscreen requests are received when the window is already fullscreen, it is typically due to the fullscreen flags or emulated video mode being changed. A commit must be explicitly triggered or the requested changes won't take effect until some other event, such as a resize or focus change, causes the changes to be committed. --- src/video/wayland/SDL_waylandwindow.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index 7abdcc4e5..9b8547c5a 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -1678,6 +1678,28 @@ Wayland_SetWindowFullscreen(_THIS, SDL_Window * window, wind->is_fullscreen = fullscreen; SetFullscreen(window, fullscreen ? output : NULL, SDL_TRUE); + /* Roundtrip required to receive the updated window dimensions */ + WAYLAND_wl_display_roundtrip(viddata->display); + } else if (wind->is_fullscreen) { + /* + * If the window is already fullscreen, this is likely a request to switch between + * fullscreen and fullscreen desktop, or to change the video mode. Update the + * geometry and trigger a commit. + */ + ConfigureWindowGeometry(window); + +#ifdef HAVE_LIBDECOR_H + if (WINDOW_IS_LIBDECOR(data, window) && wind->shell_surface.libdecor.frame) { + struct libdecor_state *state = libdecor_state_new(GetWindowWidth(window), GetWindowHeight(window)); + libdecor_frame_commit(wind->shell_surface.libdecor.frame, state, NULL); + libdecor_state_free(state); + } else +#endif + if(viddata->shell.xdg && wind->shell_surface.xdg.surface) { + xdg_surface_set_window_geometry(wind->shell_surface.xdg.surface, 0, 0, + GetWindowWidth(window), GetWindowHeight(window)); + } + /* Roundtrip required to receive the updated window dimensions */ WAYLAND_wl_display_roundtrip(viddata->display); }