diff options
Diffstat (limited to 'scene/main/window.cpp')
-rw-r--r-- | scene/main/window.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 48540b7bc9..7c2350d1c0 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -246,7 +246,10 @@ void Window::_make_window() { } } + _update_window_callbacks(); + RS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), RS::VIEWPORT_UPDATE_WHEN_VISIBLE); + DisplayServer::get_singleton()->show_window(window_id); } void Window::_update_from_window() { @@ -338,6 +341,7 @@ void Window::_event_callback(DisplayServer::WindowEvent p_event) { emit_signal("go_back_requested"); } break; case DisplayServer::WINDOW_EVENT_DPI_CHANGE: { + _update_viewport_size(); _propagate_window_notification(this, NOTIFICATION_WM_DPI_CHANGE); emit_signal("dpi_changed"); } break; @@ -377,7 +381,6 @@ void Window::set_visible(bool p_visible) { } if (p_visible && window_id == DisplayServer::INVALID_WINDOW_ID) { _make_window(); - _update_window_callbacks(); } } else { if (visible) { @@ -525,11 +528,11 @@ void Window::_update_window_size() { size.x = MAX(size_limit.x, size.x); size.y = MAX(size_limit.y, size.y); - if (max_size.x > 0 && max_size.x > min_size.x && max_size.x > size.x) { + if (max_size.x > 0 && max_size.x > min_size.x && size.x > max_size.x) { size.x = max_size.x; } - if (max_size.y > 0 && max_size.y > min_size.y && max_size.y > size.y) { + if (max_size.y > 0 && max_size.y > min_size.y && size.y > max_size.y) { size.y = max_size.y; } @@ -736,7 +739,6 @@ void Window::_notification(int p_what) { //create if (visible) { _make_window(); - _update_window_callbacks(); } } } @@ -892,7 +894,12 @@ void Window::_window_input(const Ref<InputEvent> &p_ev) { } if (exclusive_child != nullptr) { - exclusive_child->grab_focus(); + Window *focus_target = exclusive_child; + while (focus_target->exclusive_child != nullptr) { + focus_target->grab_focus(); + focus_target = focus_target->exclusive_child; + } + focus_target->grab_focus(); if (!is_embedding_subwindows()) { //not embedding, no need for event return; |