You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-14 13:41:12 +00:00
Fix popup shows behind always_on_top parent.
(cherry picked from commit 2211b1bf91)
This commit is contained in:
@@ -1504,6 +1504,21 @@ DisplayServer::WindowID DisplayServerWindows::create_sub_window(WindowMode p_mod
|
||||
return window_id;
|
||||
}
|
||||
|
||||
bool DisplayServerWindows::_is_always_on_top_recursive(WindowID p_window) const {
|
||||
ERR_FAIL_COND_V(!windows.has(p_window), false);
|
||||
|
||||
const WindowData &wd = windows[p_window];
|
||||
if (wd.always_on_top) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (wd.transient_parent != INVALID_WINDOW_ID) {
|
||||
return _is_always_on_top_recursive(wd.transient_parent);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void DisplayServerWindows::show_window(WindowID p_id) {
|
||||
ERR_FAIL_COND(!windows.has(p_id));
|
||||
|
||||
@@ -1531,7 +1546,7 @@ void DisplayServerWindows::show_window(WindowID p_id) {
|
||||
SetForegroundWindow(wd.hWnd); // Slightly higher priority.
|
||||
SetFocus(wd.hWnd); // Set keyboard focus.
|
||||
}
|
||||
if (wd.always_on_top) {
|
||||
if (_is_always_on_top_recursive(p_id)) {
|
||||
SetWindowPos(wd.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | ((wd.no_focus || wd.is_popup) ? SWP_NOACTIVATE : 0));
|
||||
}
|
||||
}
|
||||
@@ -2108,7 +2123,7 @@ void DisplayServerWindows::_update_window_style(WindowID p_window, bool p_repain
|
||||
set_icon(icon);
|
||||
}
|
||||
|
||||
SetWindowPos(wd.hWnd, wd.always_on_top ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | ((wd.no_focus || wd.is_popup) ? SWP_NOACTIVATE : 0));
|
||||
SetWindowPos(wd.hWnd, _is_always_on_top_recursive(p_window) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | ((wd.no_focus || wd.is_popup) ? SWP_NOACTIVATE : 0));
|
||||
|
||||
if (p_repaint) {
|
||||
RECT rect;
|
||||
|
||||
Reference in New Issue
Block a user