You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-21 14:57:09 +00:00
Add new window setting: always on top
Implemented for Windows and Linux.
(cherry picked from commit ee2c31d306)
This commit is contained in:
committed by
Hein-Pieter van Braam
parent
74e72c995d
commit
1c25e50490
@@ -1084,6 +1084,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();
|
||||
@@ -1623,6 +1627,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;
|
||||
@@ -1647,6 +1664,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