You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Extend special popup window handling to any non-popup child of a popup.
This commit is contained in:
@@ -3608,8 +3608,23 @@ Rect2i DisplayServerX11::window_get_popup_safe_rect(WindowID p_window) const {
|
|||||||
void DisplayServerX11::popup_open(WindowID p_window) {
|
void DisplayServerX11::popup_open(WindowID p_window) {
|
||||||
_THREAD_SAFE_METHOD_
|
_THREAD_SAFE_METHOD_
|
||||||
|
|
||||||
|
bool has_popup_ancestor = false;
|
||||||
|
WindowID transient_root = p_window;
|
||||||
|
while (true) {
|
||||||
|
WindowID parent = windows[transient_root].transient_parent;
|
||||||
|
if (parent == INVALID_WINDOW_ID) {
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
transient_root = parent;
|
||||||
|
if (windows[parent].is_popup) {
|
||||||
|
has_popup_ancestor = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WindowData &wd = windows[p_window];
|
WindowData &wd = windows[p_window];
|
||||||
if (wd.is_popup) {
|
if (wd.is_popup || has_popup_ancestor) {
|
||||||
// Find current popup parent, or root popup if new window is not transient.
|
// Find current popup parent, or root popup if new window is not transient.
|
||||||
List<WindowID>::Element *C = nullptr;
|
List<WindowID>::Element *C = nullptr;
|
||||||
List<WindowID>::Element *E = popup_list.back();
|
List<WindowID>::Element *E = popup_list.back();
|
||||||
|
|||||||
@@ -3681,8 +3681,23 @@ Rect2i DisplayServerMacOS::window_get_popup_safe_rect(WindowID p_window) const {
|
|||||||
void DisplayServerMacOS::popup_open(WindowID p_window) {
|
void DisplayServerMacOS::popup_open(WindowID p_window) {
|
||||||
_THREAD_SAFE_METHOD_
|
_THREAD_SAFE_METHOD_
|
||||||
|
|
||||||
|
bool has_popup_ancestor = false;
|
||||||
|
WindowID transient_root = p_window;
|
||||||
|
while (true) {
|
||||||
|
WindowID parent = windows[transient_root].transient_parent;
|
||||||
|
if (parent == INVALID_WINDOW_ID) {
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
transient_root = parent;
|
||||||
|
if (windows[parent].is_popup) {
|
||||||
|
has_popup_ancestor = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WindowData &wd = windows[p_window];
|
WindowData &wd = windows[p_window];
|
||||||
if (wd.is_popup) {
|
if (wd.is_popup || has_popup_ancestor) {
|
||||||
bool was_empty = popup_list.is_empty();
|
bool was_empty = popup_list.is_empty();
|
||||||
// Find current popup parent, or root popup if new window is not transient.
|
// Find current popup parent, or root popup if new window is not transient.
|
||||||
List<WindowID>::Element *C = nullptr;
|
List<WindowID>::Element *C = nullptr;
|
||||||
|
|||||||
@@ -2396,8 +2396,23 @@ Rect2i DisplayServerWindows::window_get_popup_safe_rect(WindowID p_window) const
|
|||||||
void DisplayServerWindows::popup_open(WindowID p_window) {
|
void DisplayServerWindows::popup_open(WindowID p_window) {
|
||||||
_THREAD_SAFE_METHOD_
|
_THREAD_SAFE_METHOD_
|
||||||
|
|
||||||
const WindowData &wd = windows[p_window];
|
bool has_popup_ancestor = false;
|
||||||
if (wd.is_popup) {
|
WindowID transient_root = p_window;
|
||||||
|
while (true) {
|
||||||
|
WindowID parent = windows[transient_root].transient_parent;
|
||||||
|
if (parent == INVALID_WINDOW_ID) {
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
transient_root = parent;
|
||||||
|
if (windows[parent].is_popup) {
|
||||||
|
has_popup_ancestor = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WindowData &wd = windows[p_window];
|
||||||
|
if (wd.is_popup || has_popup_ancestor) {
|
||||||
// Find current popup parent, or root popup if new window is not transient.
|
// Find current popup parent, or root popup if new window is not transient.
|
||||||
List<WindowID>::Element *C = nullptr;
|
List<WindowID>::Element *C = nullptr;
|
||||||
List<WindowID>::Element *E = popup_list.back();
|
List<WindowID>::Element *E = popup_list.back();
|
||||||
|
|||||||
Reference in New Issue
Block a user