4242#endif
4343
4444static void
45- CommitMinMaxDimensions (SDL_Window * window )
45+ SetMinMaxDimensions (SDL_Window * window , SDL_bool commit )
4646{
4747 SDL_WindowData * wind = window -> driverdata ;
4848 SDL_VideoData * viddata = wind -> waylandData ;
@@ -88,20 +88,22 @@ CommitMinMaxDimensions(SDL_Window *window)
8888 xdg_toplevel_set_max_size (wind -> shell_surface .xdg .roleobj .toplevel ,
8989 max_width ,
9090 max_height );
91- wl_surface_commit (wind -> surface );
91+ if (commit ) {
92+ wl_surface_commit (wind -> surface );
93+ }
9294 }
9395}
9496
9597static void
96- SetFullscreen (SDL_Window * window , struct wl_output * output )
98+ SetFullscreen (SDL_Window * window , struct wl_output * output , SDL_bool commit )
9799{
98100 SDL_WindowData * wind = window -> driverdata ;
99101 SDL_VideoData * viddata = wind -> waylandData ;
100102
101103 /* The desktop may try to enforce min/max sizes here, so turn them off for
102104 * fullscreen and on (if applicable) for windowed
103105 */
104- CommitMinMaxDimensions (window );
106+ SetMinMaxDimensions (window , SDL_FALSE );
105107
106108#ifdef HAVE_LIBDECOR_H
107109 if (viddata -> shell .libdecor ) {
@@ -134,6 +136,9 @@ SetFullscreen(SDL_Window *window, struct wl_output *output)
134136 } else {
135137 xdg_toplevel_unset_fullscreen (wind -> shell_surface .xdg .roleobj .toplevel );
136138 }
139+ if (commit ) {
140+ wl_surface_commit (wind -> surface );
141+ }
137142 }
138143}
139144
@@ -215,7 +220,7 @@ handle_configure_xdg_toplevel(void *data,
215220 if (!fullscreen ) {
216221 if (window -> flags & SDL_WINDOW_FULLSCREEN ) {
217222 /* We might need to re-enter fullscreen after being restored from minimized */
218- SetFullscreen (window , driverdata -> output );
223+ SetFullscreen (window , driverdata -> output , SDL_FALSE );
219224
220225 /* Foolishly do what the compositor says here. If it's wrong, don't
221226 * blame us, we were explicitly instructed to do this.
@@ -364,7 +369,7 @@ decoration_frame_configure(struct libdecor_frame *frame,
364369 if (!fullscreen ) {
365370 if (window -> flags & SDL_WINDOW_FULLSCREEN ) {
366371 /* We might need to re-enter fullscreen after being restored from minimized */
367- SetFullscreen (window , driverdata -> output );
372+ SetFullscreen (window , driverdata -> output , SDL_FALSE );
368373 fullscreen = SDL_TRUE ;
369374 floating = SDL_FALSE ;
370375 }
@@ -779,7 +784,7 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window)
779784 * -flibit
780785 */
781786 SDL_WaylandOutputData * odata = SDL_GetDisplayForWindow (window )-> driverdata ;
782- SetFullscreen (window , (window -> flags & SDL_WINDOW_FULLSCREEN ) ? odata -> output : NULL );
787+ SetFullscreen (window , (window -> flags & SDL_WINDOW_FULLSCREEN ) ? odata -> output : NULL , SDL_TRUE );
783788 if (data -> shell_surface .xdg .surface ) {
784789 while (!data -> shell_surface .xdg .initial_configure_seen ) {
785790 WAYLAND_wl_display_flush (c -> display );
@@ -791,6 +796,9 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window)
791796 if (data -> shell_surface .xdg .roleobj .toplevel && c -> decoration_manager ) {
792797 data -> server_decoration = zxdg_decoration_manager_v1_get_toplevel_decoration (c -> decoration_manager , data -> shell_surface .xdg .roleobj .toplevel );
793798 }
799+ } else {
800+ /* Nothing to see here, just commit. */
801+ wl_surface_commit (data -> surface );
794802 }
795803
796804 /* Unlike the rest of window state we have to set this _after_ flushing the
@@ -1053,7 +1061,7 @@ Wayland_SetWindowFullscreen(_THIS, SDL_Window * window,
10531061{
10541062 struct wl_output * output = ((SDL_WaylandOutputData * ) _display -> driverdata )-> output ;
10551063 SDL_VideoData * viddata = (SDL_VideoData * ) _this -> driverdata ;
1056- SetFullscreen (window , fullscreen ? output : NULL );
1064+ SetFullscreen (window , fullscreen ? output : NULL , SDL_TRUE );
10571065
10581066 WAYLAND_wl_display_flush (viddata -> display );
10591067}
@@ -1125,7 +1133,7 @@ Wayland_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable)
11251133 } else
11261134#endif
11271135 {
1128- CommitMinMaxDimensions (window );
1136+ SetMinMaxDimensions (window , SDL_TRUE );
11291137 }
11301138}
11311139
@@ -1338,7 +1346,7 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window)
13381346 Wayland_input_lock_pointer (c -> input );
13391347 }
13401348
1341- wl_surface_commit (data -> surface );
1349+ /* Moved this call to ShowWindow: wl_surface_commit(data->surface); */
13421350 WAYLAND_wl_display_flush (c -> display );
13431351
13441352 /* We may need to create an idle inhibitor for this new window */
@@ -1393,13 +1401,13 @@ Wayland_HandleResize(SDL_Window *window, int width, int height, float scale)
13931401void
13941402Wayland_SetWindowMinimumSize (_THIS , SDL_Window * window )
13951403{
1396- CommitMinMaxDimensions (window );
1404+ SetMinMaxDimensions (window , SDL_TRUE );
13971405}
13981406
13991407void
14001408Wayland_SetWindowMaximumSize (_THIS , SDL_Window * window )
14011409{
1402- CommitMinMaxDimensions (window );
1410+ SetMinMaxDimensions (window , SDL_TRUE );
14031411}
14041412
14051413void Wayland_SetWindowSize (_THIS , SDL_Window * window )
0 commit comments