|
| 1 | +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| 2 | +From: GloriousEggroll <gloriouseggroll@gmail.com> |
| 3 | +Date: Sun, 30 Aug 2026 16:30:00 -0600 |
| 4 | +Subject: [PATCH] winewayland: Preserve fullscreen clients across transient hide |
| 5 | + |
| 6 | +Some fullscreen games issue an explicit SWP_HIDEWINDOW while transferring |
| 7 | +focus during alt-tab, then show the same window again immediately. Clearing |
| 8 | +the xdg_toplevel role in between tears down its managed client surfaces and |
| 9 | +can leave the restored window with no producer attached. |
| 10 | + |
| 11 | +Keep an established, client-rendered fullscreen toplevel mapped across this |
| 12 | +specific hide transition when the window is not actually minimized. Real |
| 13 | +minimization still unmaps the surface, as do explicit hides for ordinary |
| 14 | +windows, launchers, and popups. |
| 15 | +--- |
| 16 | + dlls/winewayland.drv/window.c | 15 ++++++++++++--- |
| 17 | + 1 file changed, 12 insertions(+), 3 deletions(-) |
| 18 | + |
| 19 | +diff --git a/dlls/winewayland.drv/window.c b/dlls/winewayland.drv/window.c |
| 20 | +--- a/dlls/winewayland.drv/window.c |
| 21 | ++++ b/dlls/winewayland.drv/window.c |
| 22 | +@@ -263,15 +263,24 @@ static BOOL rect_intersects_virtual_screen(const RECT *rect) |
| 23 | + return intersect_rect(&intersect, rect, &virtual_rect); |
| 24 | + } |
| 25 | + |
| 26 | +-static BOOL should_keep_toplevel_mapped(struct wayland_surface *surface, |
| 27 | ++static BOOL should_keep_toplevel_mapped(struct wayland_win_data *data, |
| 28 | + DWORD style, UINT swp_flags) |
| 29 | + { |
| 30 | ++ struct wayland_surface *surface = data->wayland_surface; |
| 31 | ++ |
| 32 | + if (!surface || surface->role != WAYLAND_SURFACE_ROLE_TOPLEVEL) return FALSE; |
| 33 | +- if (swp_flags & SWP_HIDEWINDOW) return FALSE; |
| 34 | ++ |
| 35 | ++ /* A fullscreen renderer may hide and show the same HWND synchronously |
| 36 | ++ * while focus changes. Preserve its established presentation tree, but |
| 37 | ++ * continue to unmap minimized windows and non-rendering launchers. */ |
| 38 | ++ if (swp_flags & SWP_HIDEWINDOW) |
| 39 | ++ return data->is_fullscreen && !(style & WS_MINIMIZE) && |
| 40 | ++ (data->client_surface || |
| 41 | ++ wayland_surface_has_hwnd_dmabuf_content(surface)); |
| 42 | + |
| 43 | + /* Invisible without an explicit hide is presumed transient; visible |
| 44 | + * windows map through the normal path. */ |
| 45 | + if (!(style & WS_MINIMIZE)) return !(style & WS_VISIBLE); |
| 46 | + |
| 47 | + return !surface->current.caps || |
| 48 | + (surface->current.caps & WAYLAND_SURFACE_WM_CAPS_MINIMIZE); |
| 49 | +@@ -314,7 +323,7 @@ static BOOL wayland_win_data_create_wayland_surface(struct wayland_win_data *dat |
| 50 | + |
| 51 | + TRACE("hwnd=%p\n", data->hwnd); |
| 52 | + |
| 53 | + surface = data->wayland_surface; |
| 54 | +- keep_mapped = should_keep_toplevel_mapped(surface, style, swp_flags); |
| 55 | ++ keep_mapped = should_keep_toplevel_mapped(data, style, swp_flags); |
| 56 | + |
| 57 | + layer_set = !(exstyle & WS_EX_LAYERED) || data->layered_attribs_set; |
| 58 | + visible = ((style & WS_VISIBLE) == WS_VISIBLE); |
| 59 | +-- |
| 60 | +2.53.0 |
0 commit comments