You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-14 13:41:12 +00:00
Merge pull request #15565 from RandomShaper/adpod-topmost-2.1
Add new window setting: always-on-top (2.1)
This commit is contained in:
@@ -1049,6 +1049,10 @@ void 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) || defined(GLES2_ENABLED) || defined(LEGACYGL_ENABLED)
|
||||
gl_context = memnew(ContextGL_Win(hWnd, false));
|
||||
gl_context->initialize();
|
||||
@@ -1659,6 +1663,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(int p_borderless) {
|
||||
if (video_mode.borderless_window == p_borderless)
|
||||
return;
|
||||
@@ -1683,6 +1700,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);
|
||||
|
||||
Reference in New Issue
Block a user