diff --git a/Source/Engine/Platform/Base/WindowBase.cpp b/Source/Engine/Platform/Base/WindowBase.cpp
index befe86246..4b91bdac0 100644
--- a/Source/Engine/Platform/Base/WindowBase.cpp
+++ b/Source/Engine/Platform/Base/WindowBase.cpp
@@ -164,6 +164,15 @@ void WindowBase::SetIsVisible(bool isVisible)
}
}
+bool WindowBase::IsAlwaysOnTop() const
+{
+ return false;
+}
+
+void WindowBase::SetIsAlwaysOnTop(bool isAlwaysOnTop)
+{
+}
+
String WindowBase::ToString() const
{
return GetTitle();
diff --git a/Source/Engine/Platform/Base/WindowBase.h b/Source/Engine/Platform/Base/WindowBase.h
index db9a83839..2d2ac9cc0 100644
--- a/Source/Engine/Platform/Base/WindowBase.h
+++ b/Source/Engine/Platform/Base/WindowBase.h
@@ -157,6 +157,17 @@ public:
return _maximized;
}
+ ///
+ /// Gets a value that indicates whether a window is always on top of other windows.
+ ///
+ API_PROPERTY() virtual bool IsAlwaysOnTop() const;
+
+ ///
+ /// Sets a value that indicates whether a window is always on top of other windows.
+ ///
+ /// True if always on top.
+ API_PROPERTY() virtual void SetIsAlwaysOnTop(bool isAlwaysOnTop);
+
///
/// Gets the native window handle.
///
diff --git a/Source/Engine/Platform/SDL/SDLWindow.cpp b/Source/Engine/Platform/SDL/SDLWindow.cpp
index 09cbcf315..3f046020d 100644
--- a/Source/Engine/Platform/SDL/SDLWindow.cpp
+++ b/Source/Engine/Platform/SDL/SDLWindow.cpp
@@ -849,6 +849,19 @@ void SDLWindow::SetIsFullscreen(bool isFullscreen)
WindowBase::SetIsFullscreen(isFullscreen);
}
+bool SDLWindow::IsAlwaysOnTop() const
+{
+ SDL_WindowFlags flags = SDL_GetWindowFlags(_window);
+ return (flags & SDL_WINDOW_ALWAYS_ON_TOP) != 0;
+}
+
+void SDLWindow::SetIsAlwaysOnTop(bool isAlwaysOnTop)
+{
+ if (!SDL_SetWindowAlwaysOnTop(_window, isAlwaysOnTop))
+ LOG(Warning, "SDL_SetWindowAlwaysOnTop failed: {0}", String(SDL_GetError()));
+ // Not sure if this should change _settings.IsTopmost to reflect the new value?
+}
+
Float2 SDLWindow::GetPosition() const
{
Int2 topLeftBorder;
diff --git a/Source/Engine/Platform/SDL/SDLWindow.h b/Source/Engine/Platform/SDL/SDLWindow.h
index 126989a6f..3cb3d4b02 100644
--- a/Source/Engine/Platform/SDL/SDLWindow.h
+++ b/Source/Engine/Platform/SDL/SDLWindow.h
@@ -90,6 +90,8 @@ public:
void SetPosition(const Float2& position) override;
void SetClientPosition(const Float2& position) override;
void SetIsFullscreen(bool isFullscreen) override;
+ bool IsAlwaysOnTop() const override;
+ void SetIsAlwaysOnTop(bool isAlwaysOnTop) override;
Float2 GetPosition() const override;
Float2 GetSize() const override;
Float2 GetClientSize() const override;