wayland: Avoid calling SetFullscreen in libdecor ShowWindow.

This caused some weird stuff to happen in the libdecor path, probably because
the window hasn't actually been mapped yet. It ends up calling stuff that
should not yet apply, and so fullscreen in particular would have a really
messed up titlebar.

The good news is, libdecor is good about tracking fullscreen state, so we can
let the callback do this for us. Keep this for xdg_shell because we actually
map the window ourselves, so we know this call is valid for that path.
This commit is contained in:
Ethan Lee 2022-01-20 14:10:56 -05:00
parent ed3442d7a5
commit e1b4761c62
1 changed files with 6 additions and 2 deletions

View File

@ -724,7 +724,6 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window)
{
SDL_VideoData *c = _this->driverdata;
SDL_WindowData *data = window->driverdata;
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
/* Detach any previous buffers before resetting everything, otherwise when
* calling this a second time you'll get an annoying protocol error
@ -766,7 +765,6 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window)
if (window->flags & SDL_WINDOW_MINIMIZED) {
Wayland_MinimizeWindow(_this, window);
}
Wayland_SetWindowFullscreen(_this, window, display, (window->flags & SDL_WINDOW_FULLSCREEN) != 0);
/* We have to wait until the surface gets a "configure" event, or use of
* this surface will fail. This is a new rule for xdg_shell.
@ -782,6 +780,12 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window)
} else
#endif
if (c->shell.xdg) {
/* Unlike libdecor we need to call this explicitly to prevent a deadlock.
* libdecor will call this as part of their configure event!
* -flibit
*/
Wayland_SetWindowFullscreen(_this, window, SDL_GetDisplayForWindow(window),
(window->flags & SDL_WINDOW_FULLSCREEN) != 0);
if (data->shell_surface.xdg.surface) {
while (!data->shell_surface.xdg.initial_configure_seen) {
WAYLAND_wl_display_flush(c->display);