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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
diff --git a/src/video/wayland/SDL_waylandopengles.c b/src/video/wayland/SDL_waylandopengles.c
index f4736e1..55cd789 100644
--- a/src/video/wayland/SDL_waylandopengles.c
+++ b/src/video/wayland/SDL_waylandopengles.c
@@ -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;
diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index 344de83..81d1607 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -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;
diff --git a/src/video/wayland/SDL_waylandwindow.h b/src/video/wayland/SDL_waylandwindow.h
index 01f1614..35774bc 100644
--- a/src/video/wayland/SDL_waylandwindow.h
+++ b/src/video/wayland/SDL_waylandwindow.h
@@ -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_ */