From 5e951a230e3c45522afe0bb21c9a50ac444dd9f7 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 12 Mar 2025 13:06:31 -0700
Subject: [PATCH] windows: Fix WIN_SetWindowAlwaysOnTop causing owner window
z-order changes when child windows are created or change top-level status
- WIN_SetWindowAlwaysOnTop is always called as part of window creation (normally setting HWND_NOTOPMOST) which also set the z-order for the parent
window when child windows are created. Since HWND_NOTOPMOST is above all non-topmost windows this had the effect of reordering but not focusing
the parent window.
---
src/video/windows/SDL_windowswindow.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c
index 36c8de7fdaf03..76d93f2852272 100644
--- a/src/video/windows/SDL_windowswindow.c
+++ b/src/video/windows/SDL_windowswindow.c
@@ -1249,7 +1249,7 @@ void WIN_SetWindowResizable(SDL_VideoDevice *_this, SDL_Window *window, bool res
void WIN_SetWindowAlwaysOnTop(SDL_VideoDevice *_this, SDL_Window *window, bool on_top)
{
- WIN_SetWindowPositionInternal(window, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE, SDL_WINDOWRECT_CURRENT);
+ WIN_SetWindowPositionInternal(window, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOOWNERZORDER, SDL_WINDOWRECT_CURRENT);
}
void WIN_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window)