summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-01-07 16:15:09 +0100
committerGitHub <noreply@github.com>2022-01-07 16:15:09 +0100
commit07d2dfef7b357adb23727a182e80c55b74799a71 (patch)
treee12e2110ad53fed6751564a9d60dee3fb0e66571
parent6a27d7361ac2055cd432a98922a7d002326878fb (diff)
parentacb90ed0201f2964f3b870ad8a93d066cd77c8cf (diff)
Merge pull request #53419 from TechnoPorg/rework-subwindows
-rw-r--r--scene/main/viewport.cpp4
-rw-r--r--scene/main/viewport.h3
2 files changed, 2 insertions, 5 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 3e63ba7869..abbd7ba5a0 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -372,8 +372,6 @@ void Viewport::_sub_window_remove(Window *p_window) {
void Viewport::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
- gui.embedding_subwindows = gui.embed_subwindows_hint;
-
if (get_parent()) {
parent = get_parent()->get_viewport();
RenderingServer::get_singleton()->viewport_set_parent_viewport(viewport, parent->get_viewport_rid());
@@ -2546,7 +2544,7 @@ bool Viewport::_sub_windows_forward_input(const Ref<InputEvent> &p_event) {
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
bool click_on_window = false;
for (int i = gui.sub_windows.size() - 1; i >= 0; i--) {
- SubWindow &sw = gui.sub_windows.write[i];
+ SubWindow sw = gui.sub_windows.write[i];
// Clicked inside window?
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index 57e1100521..a3127811f5 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -362,7 +362,6 @@ private:
bool dragging = false;
bool drag_successful = false;
bool embed_subwindows_hint = false;
- bool embedding_subwindows = false;
Window *subwindow_focused = nullptr;
SubWindowDrag subwindow_drag = SUB_WINDOW_DRAG_DISABLED;
@@ -373,7 +372,7 @@ private:
SubWindowResize subwindow_resize_mode;
Rect2i subwindow_resize_from_rect;
- Vector<SubWindow> sub_windows;
+ Vector<SubWindow> sub_windows; // Don't obtain references or pointers to the elements, as their location can change.
} gui;
DefaultCanvasItemTextureFilter default_canvas_item_texture_filter = DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR;