summaryrefslogtreecommitdiff
path: root/scene/main/viewport.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/main/viewport.cpp')
-rw-r--r--scene/main/viewport.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 23b7c072be..244e0d5b93 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -166,6 +166,24 @@ ViewportTexture::~ViewportTexture() {
}
void Viewport::_sub_window_update_order() {
+ if (gui.sub_windows.size() < 2) {
+ return;
+ }
+
+ if (!gui.sub_windows[gui.sub_windows.size() - 1].window->get_flag(Window::FLAG_ALWAYS_ON_TOP)) {
+ int index = gui.sub_windows.size() - 1;
+
+ while (index > 0 && gui.sub_windows[index - 1].window->get_flag(Window::FLAG_ALWAYS_ON_TOP)) {
+ --index;
+ }
+
+ if (index != (gui.sub_windows.size() - 1)) {
+ SubWindow sw = gui.sub_windows[gui.sub_windows.size() - 1];
+ gui.sub_windows.remove_at(gui.sub_windows.size() - 1);
+ gui.sub_windows.insert(index, sw);
+ }
+ }
+
for (int i = 0; i < gui.sub_windows.size(); i++) {
RS::get_singleton()->canvas_item_set_draw_index(gui.sub_windows[i].canvas_item, i);
}
@@ -1312,7 +1330,7 @@ void Viewport::_gui_show_tooltip() {
Window *window = gui.tooltip_popup->get_parent_visible_window();
Rect2i vr;
if (gui.tooltip_popup->is_embedded()) {
- vr = gui.tooltip_popup->_get_embedder()->get_visible_rect();
+ vr = gui.tooltip_popup->get_embedder()->get_visible_rect();
} else {
vr = window->get_usable_parent_rect();
}
@@ -1833,7 +1851,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
Window *w = Object::cast_to<Window>(this);
if (w) {
if (w->is_embedded()) {
- embedder = w->_get_embedder();
+ embedder = w->get_embedder();
viewport_pos = get_final_transform().xform(mpos) + w->get_position(); // To parent coords.
}