Skip to content

Commit eb15b4e

Browse files
flibitijibiboslouken
authored andcommitted
wayland: Drop SwapWindow calls for hidden windows
1 parent 37d35a3 commit eb15b4e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/video/wayland/SDL_waylandopengles.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,18 @@ Wayland_GLES_SwapWindow(_THIS, SDL_Window *window)
114114
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
115115
const int swap_interval = _this->egl_data->egl_swapinterval;
116116

117+
/* For windows that we know are hidden, skip swaps entirely, if we don't do
118+
* this compositors will intentionally stall us indefinitely and there's no
119+
* way for an end user to show the window, unlike other situations (i.e.
120+
* the window is minimized, behind another window, etc.).
121+
*
122+
* FIXME: Request EGL_WAYLAND_swap_buffers_with_timeout.
123+
* -flibit
124+
*/
125+
if (window->flags & SDL_WINDOW_HIDDEN) {
126+
return 0;
127+
}
128+
117129
/* Control swap interval ourselves. See comments on Wayland_GLES_SetSwapInterval */
118130
if (swap_interval != 0) {
119131
struct wl_display *display = ((SDL_VideoData *)_this->driverdata)->display;

0 commit comments

Comments
 (0)