Skip to content

Commit e99a95c

Browse files
patches: more fullscreen fixups for black desert #721
1 parent aac9f92 commit e99a95c

2 files changed

Lines changed: 101 additions & 0 deletions

File tree

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: GloriousEggroll <gloriouseggroll@gmail.com>
3+
Date: Sun, 30 Aug 2026 18:00:00 -0600
4+
Subject: [PATCH] winewayland: Avoid user lock from window surface flush
5+
6+
wayland_window_surface_flush() calls set_window_surface_contents() while
7+
holding the window surface mutex. Looking up the root ancestor from that path
8+
takes the global user lock. A concurrent SetWindowPos may hold the user lock
9+
while waiting for the same window surface mutex, producing an ABBA deadlock.
10+
11+
An attached client surface already records the toplevel HWND it belongs to.
12+
Reuse that value when reclassifying the client instead of querying user32 from
13+
the locked flush path. WindowPosChanged remains responsible for changing the
14+
actual attachment topology.
15+
---
16+
dlls/winewayland.drv/window.c | 4 ++--
17+
1 file changed, 2 insertions(+), 2 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+
@@ -1650,7 +1650,6 @@ BOOL set_window_surface_contents(HWND hwnd, struct wayland_shm_buffer *shm_buffe
23+
{
24+
struct wayland_surface *wayland_surface;
25+
struct wayland_win_data *data;
26+
- HWND toplevel = NtUserGetAncestor(hwnd, GA_ROOT);
27+
BOOL committed = FALSE;
28+
BOOL content_over_changed;
29+
30+
@@ -1715,7 +1714,8 @@ BOOL set_window_surface_contents(HWND hwnd, struct wayland_shm_buffer *shm_buffe
31+
{
32+
if (!shm_buffer || content_over_changed ||
33+
(content_over_producer && data->client_surface->stack_above_parent))
34+
- wayland_client_surface_attach(data->client_surface, toplevel);
35+
+ wayland_client_surface_attach(data->client_surface,
36+
+ data->client_surface->toplevel);
37+
}
38+
else if (shm_buffer)
39+
wayland_client_surface_attach(data->client_surface, NULL);
40+
--
41+
2.53.0

0 commit comments

Comments
 (0)