wayland: handle pending resizes immediately, not on SwapWindow.

This was originally a workaround for an old Mesa bug, since fixed, apparently,
and causes other problems.

Fixes #4326.
This commit is contained in:
Ryan C. Gordon 2021-07-27 18:24:09 -04:00
parent 51c61d7cdf
commit 871c11191b
3 changed files with 7 additions and 16 deletions

View File

@ -148,9 +148,6 @@ Wayland_GLES_SwapWindow(_THIS, SDL_Window *window)
return SDL_EGL_SetError("unable to show color buffer in an OS-native window", "eglSwapBuffers");
}
// Wayland-EGL forbids drawing calls in-between SwapBuffers and wl_egl_window_resize
Wayland_HandlePendingResize(window);
WAYLAND_wl_display_flush( data->waylandData->display );
return 0;

View File

@ -164,6 +164,9 @@ static const struct wl_callback_listener surface_frame_listener = {
handle_surface_frame_done
};
static void Wayland_HandlePendingResize(SDL_Window *window);
static void
handle_configure_xdg_shell_surface(void *data, struct xdg_surface *xdg, uint32_t serial)
{
@ -198,9 +201,7 @@ handle_configure_xdg_shell_surface(void *data, struct xdg_surface *xdg, uint32_t
wind->resize.pending = SDL_TRUE;
wind->resize.configure = SDL_TRUE;
wind->resize.serial = serial;
if (!(window->flags & SDL_WINDOW_OPENGL)) {
Wayland_HandlePendingResize(window); /* OpenGL windows handle this in SwapWindow */
}
Wayland_HandlePendingResize(window);
}
}
@ -457,9 +458,7 @@ update_scale_factor(SDL_WindowData *window)
window->resize.height = window->sdlwindow->h;
window->resize.scale_factor = new_factor;
window->resize.pending = SDL_TRUE;
if (!(window->sdlwindow->flags & SDL_WINDOW_OPENGL)) {
Wayland_HandlePendingResize(window->sdlwindow); /* OpenGL windows handle this in SwapWindow */
}
Wayland_HandlePendingResize(window->sdlwindow);
}
}
@ -929,10 +928,7 @@ Wayland_SetWindowFullscreen(_THIS, SDL_Window * window,
wind->resize.width = window->windowed.w;
wind->resize.height = window->windowed.h;
wind->resize.pending = SDL_TRUE;
if (!(window->flags & SDL_WINDOW_OPENGL)) {
Wayland_HandlePendingResize(window);
}
Wayland_HandlePendingResize(window);
}
}
@ -1204,7 +1200,7 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window)
}
void
static void
Wayland_HandlePendingResize(SDL_Window *window)
{
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;

View File

@ -114,8 +114,6 @@ Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info);
extern int Wayland_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
extern int Wayland_FlashWindow(_THIS, SDL_Window * window, SDL_FlashOperation operation);
extern void Wayland_HandlePendingResize(SDL_Window *window);
extern SDL_bool SDL_WAYLAND_own_surface(struct wl_surface *surface);
#endif /* SDL_waylandwindow_h_ */