SDL2/0005-wayland-Detach-hidden-surfaces-in-HideWindow-not-Sho.patch

42 lines
1.4 KiB
Diff
Raw Normal View History

From e2d74bcbe524960c17c852466130a6e0a30674a3 Mon Sep 17 00:00:00 2001
From: Ethan Lee <flibitijibibo@gmail.com>
Date: Tue, 25 Jan 2022 11:16:09 -0500
Subject: [PATCH 05/11] wayland: Detach hidden surfaces in HideWindow, not
ShowWindow
---
src/video/wayland/SDL_waylandwindow.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index 3b21af7be..2bf500a91 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -725,12 +725,6 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window)
SDL_VideoData *c = _this->driverdata;
SDL_WindowData *data = window->driverdata;
- /* Detach any previous buffers before resetting everything, otherwise when
- * calling this a second time you'll get an annoying protocol error
- */
- wl_surface_attach(data->surface, NULL, 0, 0);
- wl_surface_commit(data->surface);
-
/* Create the shell surface and map the toplevel */
#ifdef HAVE_LIBDECOR_H
if (c->shell.libdecor) {
@@ -862,6 +856,10 @@ void Wayland_HideWindow(_THIS, SDL_Window *window)
wind->shell_surface.xdg.surface = NULL;
}
}
+
+ /* Be sure to detach after this is done, otherwise ShowWindow crashes! */
+ wl_surface_attach(wind->surface, NULL, 0, 0);
+ wl_surface_commit(wind->surface);
}
static void
--
2.34.1