summaryrefslogtreecommitdiff
path: root/platform/windows/os_windows.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/windows/os_windows.cpp')
-rw-r--r--platform/windows/os_windows.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 5d27fae148..20129299a1 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -1075,6 +1075,10 @@ Error OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
}
};
+ if (video_mode.always_on_top) {
+ SetWindowPos(hWnd, video_mode.always_on_top ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+ }
+
#if defined(OPENGL_ENABLED)
gl_context = memnew(ContextGL_Win(hWnd, true));
gl_context->initialize();
@@ -1614,6 +1618,19 @@ bool OS_Windows::is_window_maximized() const {
return maximized;
}
+void OS_Windows::set_window_always_on_top(bool p_enabled) {
+ if (video_mode.always_on_top == p_enabled)
+ return;
+
+ video_mode.always_on_top = p_enabled;
+
+ _update_window_style();
+}
+
+bool OS_Windows::is_window_always_on_top() const {
+ return video_mode.always_on_top;
+}
+
void OS_Windows::set_borderless_window(bool p_borderless) {
if (video_mode.borderless_window == p_borderless)
return;
@@ -1638,6 +1655,8 @@ void OS_Windows::_update_window_style(bool repaint) {
}
}
+ SetWindowPos(hWnd, video_mode.always_on_top ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+
if (repaint) {
RECT rect;
GetWindowRect(hWnd, &rect);