From: Namo Nath <nn.git@tuta.io> Some overlays omit WS_EX_TOPMOST at creation, relying instead on late calls to SetWindowPos(HWND_TOPMOST). Standard X11 Window Managers often deprioritize transparent or input-less windows, ignoring these runtime requests and causing overlays to spawn behind the game. Track the DWM glass state in x11drv_win_data and strictly enforce _NET_WM_STATE_ABOVE in update_net_wm_states for any window identified as a DWM Overlay, regardless of the current window style bits. --- dlls/winex11.drv/window.c | 18 +++++++++++++++++- dlls/winex11.drv/x11drv.h | 2 ++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 7750308d03b..beaeec54cc5 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1505,8 +1505,18 @@ static void update_net_wm_states( struct x11drv_win_data *data ) new_state |= (1 << NET_WM_STATE_MAXIMIZED); ex_style = NtUserGetWindowLongW( data->hwnd, GWL_EXSTYLE ); - if (ex_style & WS_EX_TOPMOST) + + /* Logic: + 1. Standard behavior: If WS_EX_TOPMOST is set, set _NET_WM_STATE_ABOVE. + 2. Strict Overlay behavior: If "Glass Mode" (-1) is active AND it is Transparent/Layered, + FORCE _NET_WM_STATE_ABOVE even if the app omits WS_EX_TOPMOST at creation. + */ + if ((ex_style & WS_EX_TOPMOST) || + (data->dwm_glass_state && (ex_style & WS_EX_LAYERED) && (ex_style & WS_EX_TRANSPARENT))) + { new_state |= (1 << NET_WM_STATE_ABOVE); + } + if (!data->add_taskbar) { if (data->skip_taskbar || (ex_style & WS_EX_NOACTIVATE) @@ -3591,6 +3601,12 @@ BOOL X11DRV_SetWindowDwmConfig( HWND hwnd, INT command, const void *data ) if (!(data_ptr = get_win_data( hwnd ))) return FALSE; + /* Store the intent so update_net_wm_states can see it later */ + if (margins->cxLeftWidth == -1) + data_ptr->dwm_glass_state = TRUE; + else + data_ptr->dwm_glass_state = FALSE; + /* Runtime Visual Upgrade */ /* If the app requests "Sheet of Glass" (-1) but we are still using the default 24-bit visual, we MUST upgrade to 32-bit ARGB now. */ diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 3266ec305f8..c9550538c87 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -694,6 +694,8 @@ struct x11drv_win_data unsigned long wm_normal_hints_serial;/* serial of last pending WM_NORMAL_HINTS request */ unsigned long configure_serial; /* serial of last pending configure request */ unsigned long net_wm_icon_serial; /* serial of last pending _NET_WM_ICON request */ + + BOOL dwm_glass_state; /* Tracks if DwmExtendFrame(-1) is active */ }; extern struct x11drv_win_data *get_win_data( HWND hwnd ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10180