diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-02-14 16:43:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-14 16:43:40 +0100 |
commit | e0f43e06785ea1b05a5d7c4be32b74a9995be8fe (patch) | |
tree | ed1ed82993d60083bf51384311fea8831035a4b8 /platform/windows | |
parent | 2eb7a321ba321065c135f799701efaf735142593 (diff) | |
parent | 2e8c7824c0f2946f6bf33fe0a20eabb779a91763 (diff) |
Merge pull request #15564 from RandomShaper/adpod-topmost
Add new window setting: always on top
Diffstat (limited to 'platform/windows')
-rw-r--r-- | platform/windows/os_windows.cpp | 19 | ||||
-rw-r--r-- | platform/windows/os_windows.h | 2 |
2 files changed, 21 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); diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 3437b8547b..4c4fbcf8f0 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -211,6 +211,8 @@ public: virtual bool is_window_minimized() const; virtual void set_window_maximized(bool p_enabled); virtual bool is_window_maximized() const; + virtual void set_window_always_on_top(bool p_enabled); + virtual bool is_window_always_on_top() const; virtual void request_attention(); virtual void set_borderless_window(bool p_borderless); |