Fix Editor floating windows to have link to the main window while still be in taskbar

#2800
This commit is contained in:
Wojtek Figat
2026-02-12 16:23:42 +01:00
parent cc69e5d966
commit 2a6e38e020

View File

@@ -90,7 +90,7 @@ void SDLWindow::Init()
SDLWindow::SDLWindow(const CreateWindowSettings& settings)
: WindowBase(settings)
, _handle(nullptr)
, _cachedClientRectangle(Rectangle())
, _cachedClientRectangle(Rectangle::Empty)
#if PLATFORM_LINUX
, _dragOver(false)
#endif
@@ -127,9 +127,11 @@ SDLWindow::SDLWindow(const CreateWindowSettings& settings)
if (_settings.SupportsTransparency)
flags |= SDL_WINDOW_TRANSPARENT;
#if !PLATFORM_WINDOWS // Fixed on Windows by adding WS_EX_APPWINDOW flag down below
// Disable parenting of child windows as those are always on top of the parent window and never show up in taskbar
if (_settings.Parent != nullptr && (_settings.Type != WindowType::Tooltip && _settings.Type != WindowType::Popup))
_settings.Parent = nullptr;
#endif
// The window position needs to be relative to the parent window
Int2 relativePosition(Math::TruncToInt(settings.Position.X), Math::TruncToInt(settings.Position.Y));
@@ -159,6 +161,16 @@ SDLWindow::SDLWindow(const CreateWindowSettings& settings)
_handle = GetNativeWindowPointer(_window);
ASSERT(_handle != nullptr);
#if PLATFORM_WINDOWS
// Windows that have parent are hidden in taskbar on Windows in SDL so hack it
if (_settings.ShowInTaskbar && _settings.Parent != nullptr && (_settings.Type != WindowType::Tooltip && _settings.Type != WindowType::Popup))
{
LONG lStyle = GetWindowLong((HWND)_handle, GWL_EXSTYLE);
lStyle |= WS_EX_APPWINDOW;
SetWindowLong((HWND)_handle, GWL_EXSTYLE, lStyle);
}
#endif
SDL_DisplayID display = SDL_GetDisplayForWindow(_window);
_dpiScale = SDL_GetWindowDisplayScale(_window);
_dpi = Math::TruncToInt(_dpiScale * DefaultDPI);