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.
This commit is contained in:
Frank Praznik 2022-09-03 13:11:29 -04:00 committed by Sam Lantinga
parent 707b561f97
commit a7d345958d
1 changed files with 22 additions and 0 deletions

View File

@ -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);
}