From 6d197f3f7f50e14ce01ac858fa6cc4a9d76ed1cc Mon Sep 17 00:00:00 2001 From: Zhehang Ding Date: Wed, 24 Nov 2021 20:00:37 -0800 Subject: [PATCH 1/7] Fix subviewports receiving gui input too early Fixes #48401 --- doc/classes/Viewport.xml | 7 ++++++ scene/2d/touch_screen_button.cpp | 2 ++ scene/gui/subviewport_container.cpp | 27 ++++++++++++++++++++++ scene/gui/subviewport_container.h | 1 + scene/main/viewport.cpp | 36 ++++++++++++++++++++++++++--- scene/main/viewport.h | 1 + scene/main/window.cpp | 1 + 7 files changed, 72 insertions(+), 3 deletions(-) diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml index 0418f2980832..d0fc6bfbc2ce 100644 --- a/doc/classes/Viewport.xml +++ b/doc/classes/Viewport.xml @@ -143,6 +143,13 @@ Returns [code]true[/code] if the viewport is currently embedding windows. + + + + + + + diff --git a/scene/2d/touch_screen_button.cpp b/scene/2d/touch_screen_button.cpp index 8bd7b696f209..866a574d4676 100644 --- a/scene/2d/touch_screen_button.cpp +++ b/scene/2d/touch_screen_button.cpp @@ -289,6 +289,7 @@ void TouchScreenButton::_press(int p_finger_pressed) { iea->set_action(action); iea->set_pressed(true); get_viewport()->push_input(iea, true); + get_viewport()->push_gui_input(iea, true); } emit_signal(SNAME("pressed")); @@ -306,6 +307,7 @@ void TouchScreenButton::_release(bool p_exiting_tree) { iea->set_action(action); iea->set_pressed(false); get_viewport()->push_input(iea, true); + get_viewport()->push_gui_input(iea, true); } } diff --git a/scene/gui/subviewport_container.cpp b/scene/gui/subviewport_container.cpp index 53ea32e1b7c4..e50a7c64effb 100644 --- a/scene/gui/subviewport_container.cpp +++ b/scene/gui/subviewport_container.cpp @@ -166,6 +166,33 @@ void SubViewportContainer::input(const Ref &p_event) { } } +void SubViewportContainer::gui_input(const Ref &p_event) { + ERR_FAIL_COND(p_event.is_null()); + + if (Engine::get_singleton()->is_editor_hint()) { + return; + } + + Transform2D xform = get_global_transform(); + + if (stretch) { + Transform2D scale_xf; + scale_xf.scale(Vector2(shrink, shrink)); + xform *= scale_xf; + } + + Ref ev = p_event; // already transformed + + for (int i = 0; i < get_child_count(); i++) { + SubViewport *c = Object::cast_to(get_child(i)); + if (!c || c->is_input_disabled()) { + continue; + } + + c->push_gui_input(ev); + } +} + void SubViewportContainer::unhandled_input(const Ref &p_event) { ERR_FAIL_COND(p_event.is_null()); diff --git a/scene/gui/subviewport_container.h b/scene/gui/subviewport_container.h index 7853f1590ea8..2d441b4f6c04 100644 --- a/scene/gui/subviewport_container.h +++ b/scene/gui/subviewport_container.h @@ -48,6 +48,7 @@ class SubViewportContainer : public Container { bool is_stretch_enabled() const; virtual void input(const Ref &p_event) override; + virtual void gui_input(const Ref &p_event) override; virtual void unhandled_input(const Ref &p_event) override; void set_stretch_shrink(int p_shrink); int get_stretch_shrink() const; diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index f9e96a078490..debcc59ced32 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2687,14 +2687,44 @@ void Viewport::push_input(const Ref &p_event, bool p_local_coords) { } if (!is_input_handled()) { - get_tree()->_call_input_pause(input_group, SceneTree::CALL_INPUT_TYPE_INPUT, ev, this); //not a bug, must happen before GUI, order is _input -> gui input -> _unhandled input + get_tree()->_call_input_pause(input_group, SceneTree::CALL_INPUT_TYPE_INPUT, ev, this); + } + + event_count++; +} + +void Viewport::push_gui_input(const Ref &p_event, bool p_local_coords) { + ERR_FAIL_COND(!is_inside_tree()); + + if (disable_input) { + return; + } + + if (Engine::get_singleton()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_ancestor_of(this)) { + return; + } + + local_input_handled = false; + + Ref ev; + if (!p_local_coords) { + ev = _make_input_local(p_event); + } else { + ev = p_event; + } + + if (is_embedding_subwindows() && _sub_windows_forward_input(p_event)) { + set_input_as_handled(); + return; + } + + if (!_can_consume_input_events()) { + return; } if (!is_input_handled()) { _gui_input_event(ev); } - - event_count++; } void Viewport::push_unhandled_input(const Ref &p_event, bool p_local_coords) { diff --git a/scene/main/viewport.h b/scene/main/viewport.h index 38d43e1e5970..61a20532bdc6 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -541,6 +541,7 @@ class Viewport : public Node { void push_text_input(const String &p_text); void push_input(const Ref &p_event, bool p_local_coords = false); + void push_gui_input(const Ref &p_event, bool p_local_coords = false); void push_unhandled_input(const Ref &p_event, bool p_local_coords = false); void set_disable_input(bool p_disable); diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 20f8b30dc6d9..d6f81495574a 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -921,6 +921,7 @@ void Window::_window_input(const Ref &p_ev) { emit_signal(SceneStringNames::get_singleton()->window_input, p_ev); push_input(p_ev); + push_gui_input(p_ev); if (!is_input_handled()) { push_unhandled_input(p_ev); } From 67bf3d36466c11d2819d8baaa80da04e059fb6f1 Mon Sep 17 00:00:00 2001 From: Zhehang Ding Date: Thu, 25 Nov 2021 00:06:27 -0800 Subject: [PATCH 2/7] Register push_gui_input method and regenerate doc --- doc/classes/Viewport.xml | 14 +++++++------- scene/main/viewport.cpp | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml index d0fc6bfbc2ce..78106b5bc339 100644 --- a/doc/classes/Viewport.xml +++ b/doc/classes/Viewport.xml @@ -129,25 +129,25 @@ - + - + - + + - Returns [code]true[/code] if the viewport is currently embedding windows. - + - - + + Returns [code]true[/code] if the viewport is currently embedding windows. diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index debcc59ced32..a1d054ad0ff3 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -3603,6 +3603,7 @@ void Viewport::_bind_methods() { ClassDB::bind_method(D_METHOD("get_viewport_rid"), &Viewport::get_viewport_rid); ClassDB::bind_method(D_METHOD("push_text_input", "text"), &Viewport::push_text_input); ClassDB::bind_method(D_METHOD("push_input", "event", "in_local_coords"), &Viewport::push_input, DEFVAL(false)); + ClassDB::bind_method(D_METHOD("push_gui_input", "event", "in_local_coords"), &Viewport::push_gui_input, DEFVAL(false)); ClassDB::bind_method(D_METHOD("push_unhandled_input", "event", "in_local_coords"), &Viewport::push_unhandled_input, DEFVAL(false)); ClassDB::bind_method(D_METHOD("get_camera_2d"), &Viewport::get_camera_2d); From 92ca7db7f9101559c4622c5fa5109e03714d434d Mon Sep 17 00:00:00 2001 From: Zhehang Ding Date: Thu, 25 Nov 2021 01:07:47 -0800 Subject: [PATCH 3/7] Unit test macros use push_gui_input --- tests/test_macros.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_macros.h b/tests/test_macros.h index b04c2117b7e1..12c800eca5fe 100644 --- a/tests/test_macros.h +++ b/tests/test_macros.h @@ -166,7 +166,7 @@ int register_test_command(String p_command, TestFunc p_function); #define SEND_GUI_MOUSE_EVENT(m_object, m_local_pos, m_input, m_mask) \ { \ _CREATE_GUI_MOUSE_EVENT(m_object, m_local_pos, m_input, m_mask); \ - m_object->get_viewport()->push_input(event); \ + m_object->get_viewport()->push_gui_input(event); \ MessageQueue::get_singleton()->flush(); \ } @@ -174,7 +174,7 @@ int register_test_command(String p_command, TestFunc p_function); { \ _CREATE_GUI_MOUSE_EVENT(m_object, m_local_pos, MouseButton::LEFT, MouseButton::LEFT); \ event->set_double_click(true); \ - m_object->get_viewport()->push_input(event); \ + m_object->get_viewport()->push_gui_input(event); \ MessageQueue::get_singleton()->flush(); \ } From c10cbbb20bf8d8870a477fe1ac4b9eb4652b8cd2 Mon Sep 17 00:00:00 2001 From: Zhehang Ding Date: Thu, 25 Nov 2021 07:22:00 -0800 Subject: [PATCH 4/7] Fix code style --- tests/test_macros.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_macros.h b/tests/test_macros.h index 12c800eca5fe..697d92bcfb2d 100644 --- a/tests/test_macros.h +++ b/tests/test_macros.h @@ -166,7 +166,7 @@ int register_test_command(String p_command, TestFunc p_function); #define SEND_GUI_MOUSE_EVENT(m_object, m_local_pos, m_input, m_mask) \ { \ _CREATE_GUI_MOUSE_EVENT(m_object, m_local_pos, m_input, m_mask); \ - m_object->get_viewport()->push_gui_input(event); \ + m_object->get_viewport()->push_gui_input(event); \ MessageQueue::get_singleton()->flush(); \ } @@ -174,7 +174,7 @@ int register_test_command(String p_command, TestFunc p_function); { \ _CREATE_GUI_MOUSE_EVENT(m_object, m_local_pos, MouseButton::LEFT, MouseButton::LEFT); \ event->set_double_click(true); \ - m_object->get_viewport()->push_gui_input(event); \ + m_object->get_viewport()->push_gui_input(event); \ MessageQueue::get_singleton()->flush(); \ } From b62a295fbbf53f9d7539a4a350e65ed832a5c915 Mon Sep 17 00:00:00 2001 From: Zhehang Ding Date: Wed, 5 Jan 2022 01:19:20 -0800 Subject: [PATCH 5/7] Add docs for push_*_input --- doc/classes/Viewport.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml index 78106b5bc339..92a87a2a51fe 100644 --- a/doc/classes/Viewport.xml +++ b/doc/classes/Viewport.xml @@ -134,6 +134,7 @@ + Pushes an input event to [method Control._gui_input] @@ -141,6 +142,7 @@ + Pushes an input event to [method Node._input] @@ -155,6 +157,7 @@ + Pushes an input event to [method Node._unhandled_input] From 62070f03fa97cfe2a0c5d7a378e49a7125ea8a6d Mon Sep 17 00:00:00 2001 From: Zhehang Ding Date: Sun, 6 Feb 2022 16:51:22 -0800 Subject: [PATCH 6/7] Allows action-type events send through subviewports --- scene/main/viewport.cpp | 45 +++++++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index a1d054ad0ff3..a1e515ea8df9 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1973,23 +1973,46 @@ void Viewport::_gui_input_event(Ref p_event) { } if (mm.is_null() && mb.is_null() && p_event->is_action_type()) { - if (gui.key_focus && !gui.key_focus->is_visible_in_tree()) { - gui.key_focus->release_focus(); + // Search all qualified subviewports (self-included) for a + // key_focus control. + Viewport *target_vp = this; + List vps; + get_tree()->get_nodes_in_group("_viewports", &vps); + for (Node *node : vps) { + Viewport *vp = Object::cast_to(node); + if (vp == nullptr) {continue;} + if (vp->gui.key_focus == nullptr) {continue;} + + Viewport *vp_parent = vp; + while (vp_parent && (vp_parent != this)) { + vp_parent = vp_parent->get_parent_viewport(); + } + if (vp_parent != this) {continue;} + + target_vp = vp; + break; } - - if (gui.key_focus) { - gui.key_event_accepted = false; - if (gui.key_focus->can_process()) { - gui.key_focus->_call_gui_input(p_event); + if (target_vp->gui.key_focus) { + Viewport::GUI &target_gui = target_vp->gui; + Control* &target_key_focus = target_vp->gui.key_focus; + if (target_key_focus && !target_key_focus->is_visible_in_tree()) { + target_key_focus->release_focus(); } - if (gui.key_event_accepted) { - set_input_as_handled(); - return; + if (target_key_focus) { + target_gui.key_event_accepted = false; + if (target_key_focus->can_process()) { + target_key_focus->_call_gui_input(p_event); + } + + if (target_gui.key_event_accepted) { + set_input_as_handled(); + return; + } } } - Control *from = gui.key_focus ? gui.key_focus : nullptr; + Control *from = target_vp->gui.key_focus; if (from && p_event->is_pressed()) { Control *next = nullptr; From bece838519607679f4c560e10de481b4a401e306 Mon Sep 17 00:00:00 2001 From: Zhehang Ding Date: Mon, 21 Feb 2022 15:33:26 -0800 Subject: [PATCH 7/7] Fix window event forwarding * Rearrange push_input/push_unhandled_input as push_input/push_local_input/ push_local_gui_input/push_local_unhandled_input * Fix extra window event forwarding in push_gui_input * Fix code format of the last commit. --- doc/classes/Viewport.xml | 24 ++++++----- editor/editor_command_palette.cpp | 4 +- scene/2d/touch_screen_button.cpp | 2 - scene/gui/subviewport_container.cpp | 6 +-- scene/main/viewport.cpp | 62 ++++++++++++++++++++++------- scene/main/viewport.h | 5 ++- scene/main/window.cpp | 6 +-- tests/test_macros.h | 4 +- 8 files changed, 73 insertions(+), 40 deletions(-) diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml index 92a87a2a51fe..1caf2a6219c4 100644 --- a/doc/classes/Viewport.xml +++ b/doc/classes/Viewport.xml @@ -129,35 +129,41 @@ - + - Pushes an input event to [method Control._gui_input] + Pushes an input event. - + - Pushes an input event to [method Node._input] - + - + + - Returns [code]true[/code] if the viewport is currently embedding windows. + The three push_local_*_input functions push an event to the three event passes respectively. Unlike push_input, they do not forward events to subwindows. - + - Pushes an input event to [method Node._unhandled_input] + + + + + + + Returns [code]true[/code] if the viewport is currently embedding windows. diff --git a/editor/editor_command_palette.cpp b/editor/editor_command_palette.cpp index 52e55de84cea..33cf3c0b416f 100644 --- a/editor/editor_command_palette.cpp +++ b/editor/editor_command_palette.cpp @@ -238,7 +238,7 @@ void EditorCommandPalette::register_shortcuts_as_command() { ev.instantiate(); ev->set_shortcut(shortcut); String shortcut_text = String(shortcut->get_as_text()); - add_command(command_name, *key, callable_mp(EditorNode::get_singleton()->get_viewport(), &Viewport::push_unhandled_input), varray(ev, false), shortcut_text); + add_command(command_name, *key, callable_mp(EditorNode::get_singleton()->get_viewport(), &Viewport::push_local_unhandled_input), varray(ev, false), shortcut_text); key = unregistered_shortcuts.next(key); } unregistered_shortcuts.clear(); @@ -260,7 +260,7 @@ Ref EditorCommandPalette::add_shortcut_command(const String &p_command ev.instantiate(); ev->set_shortcut(p_shortcut); String shortcut_text = String(p_shortcut->get_as_text()); - add_command(p_command, p_key, callable_mp(EditorNode::get_singleton()->get_viewport(), &Viewport::push_unhandled_input), varray(ev, false), shortcut_text); + add_command(p_command, p_key, callable_mp(EditorNode::get_singleton()->get_viewport(), &Viewport::push_local_unhandled_input), varray(ev, false), shortcut_text); } else { const String key_name = String(p_key); const String command_name = String(p_command); diff --git a/scene/2d/touch_screen_button.cpp b/scene/2d/touch_screen_button.cpp index 866a574d4676..8bd7b696f209 100644 --- a/scene/2d/touch_screen_button.cpp +++ b/scene/2d/touch_screen_button.cpp @@ -289,7 +289,6 @@ void TouchScreenButton::_press(int p_finger_pressed) { iea->set_action(action); iea->set_pressed(true); get_viewport()->push_input(iea, true); - get_viewport()->push_gui_input(iea, true); } emit_signal(SNAME("pressed")); @@ -307,7 +306,6 @@ void TouchScreenButton::_release(bool p_exiting_tree) { iea->set_action(action); iea->set_pressed(false); get_viewport()->push_input(iea, true); - get_viewport()->push_gui_input(iea, true); } } diff --git a/scene/gui/subviewport_container.cpp b/scene/gui/subviewport_container.cpp index e50a7c64effb..750ace1403ed 100644 --- a/scene/gui/subviewport_container.cpp +++ b/scene/gui/subviewport_container.cpp @@ -162,7 +162,7 @@ void SubViewportContainer::input(const Ref &p_event) { continue; } - c->push_input(ev); + c->push_local_input(ev); } } @@ -189,7 +189,7 @@ void SubViewportContainer::gui_input(const Ref &p_event) { continue; } - c->push_gui_input(ev); + c->push_local_gui_input(ev); } } @@ -216,7 +216,7 @@ void SubViewportContainer::unhandled_input(const Ref &p_event) { continue; } - c->push_unhandled_input(ev); + c->push_local_unhandled_input(ev); } } diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index a1e515ea8df9..38f351f910f2 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1980,21 +1980,27 @@ void Viewport::_gui_input_event(Ref p_event) { get_tree()->get_nodes_in_group("_viewports", &vps); for (Node *node : vps) { Viewport *vp = Object::cast_to(node); - if (vp == nullptr) {continue;} - if (vp->gui.key_focus == nullptr) {continue;} + if (vp == nullptr) { + continue; + } + if (vp->gui.key_focus == nullptr) { + continue; + } Viewport *vp_parent = vp; while (vp_parent && (vp_parent != this)) { vp_parent = vp_parent->get_parent_viewport(); } - if (vp_parent != this) {continue;} + if (vp_parent != this) { + continue; + } target_vp = vp; break; } if (target_vp->gui.key_focus) { Viewport::GUI &target_gui = target_vp->gui; - Control* &target_key_focus = target_vp->gui.key_focus; + Control *&target_key_focus = target_vp->gui.key_focus; if (target_key_focus && !target_key_focus->is_visible_in_tree()) { target_key_focus->release_focus(); } @@ -2705,18 +2711,19 @@ void Viewport::push_input(const Ref &p_event, bool p_local_coords) { return; } - if (!_can_consume_input_events()) { - return; + if (!is_input_handled()) { + push_local_input(ev); } - if (!is_input_handled()) { - get_tree()->_call_input_pause(input_group, SceneTree::CALL_INPUT_TYPE_INPUT, ev, this); + push_local_gui_input(ev); + } + if (!is_input_handled()) { + push_local_unhandled_input(ev); } - event_count++; } -void Viewport::push_gui_input(const Ref &p_event, bool p_local_coords) { +void Viewport::push_local_input(const Ref &p_event, bool p_local_coords) { ERR_FAIL_COND(!is_inside_tree()); if (disable_input) { @@ -2736,11 +2743,35 @@ void Viewport::push_gui_input(const Ref &p_event, bool p_local_coord ev = p_event; } - if (is_embedding_subwindows() && _sub_windows_forward_input(p_event)) { - set_input_as_handled(); + if (!_can_consume_input_events()) { return; } + if (!is_input_handled()) { + get_tree()->_call_input_pause(input_group, SceneTree::CALL_INPUT_TYPE_INPUT, ev, this); + } +} + +void Viewport::push_local_gui_input(const Ref &p_event, bool p_local_coords) { + ERR_FAIL_COND(!is_inside_tree()); + + if (disable_input) { + return; + } + + if (Engine::get_singleton()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_ancestor_of(this)) { + return; + } + + local_input_handled = false; + + Ref ev; + if (!p_local_coords) { + ev = _make_input_local(p_event); + } else { + ev = p_event; + } + if (!_can_consume_input_events()) { return; } @@ -2750,7 +2781,7 @@ void Viewport::push_gui_input(const Ref &p_event, bool p_local_coord } } -void Viewport::push_unhandled_input(const Ref &p_event, bool p_local_coords) { +void Viewport::push_local_unhandled_input(const Ref &p_event, bool p_local_coords) { ERR_FAIL_COND(p_event.is_null()); ERR_FAIL_COND(!is_inside_tree()); local_input_handled = false; @@ -3626,8 +3657,9 @@ void Viewport::_bind_methods() { ClassDB::bind_method(D_METHOD("get_viewport_rid"), &Viewport::get_viewport_rid); ClassDB::bind_method(D_METHOD("push_text_input", "text"), &Viewport::push_text_input); ClassDB::bind_method(D_METHOD("push_input", "event", "in_local_coords"), &Viewport::push_input, DEFVAL(false)); - ClassDB::bind_method(D_METHOD("push_gui_input", "event", "in_local_coords"), &Viewport::push_gui_input, DEFVAL(false)); - ClassDB::bind_method(D_METHOD("push_unhandled_input", "event", "in_local_coords"), &Viewport::push_unhandled_input, DEFVAL(false)); + ClassDB::bind_method(D_METHOD("push_local_input", "event", "in_local_coords"), &Viewport::push_local_gui_input, DEFVAL(false)); + ClassDB::bind_method(D_METHOD("push_local_gui_input", "event", "in_local_coords"), &Viewport::push_local_gui_input, DEFVAL(false)); + ClassDB::bind_method(D_METHOD("push_local_unhandled_input", "event", "in_local_coords"), &Viewport::push_local_unhandled_input, DEFVAL(false)); ClassDB::bind_method(D_METHOD("get_camera_2d"), &Viewport::get_camera_2d); ClassDB::bind_method(D_METHOD("set_as_audio_listener_2d", "enable"), &Viewport::set_as_audio_listener_2d); diff --git a/scene/main/viewport.h b/scene/main/viewport.h index 61a20532bdc6..647fc222534e 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -541,8 +541,9 @@ class Viewport : public Node { void push_text_input(const String &p_text); void push_input(const Ref &p_event, bool p_local_coords = false); - void push_gui_input(const Ref &p_event, bool p_local_coords = false); - void push_unhandled_input(const Ref &p_event, bool p_local_coords = false); + void push_local_input(const Ref &p_event, bool p_local_coords = false); + void push_local_gui_input(const Ref &p_event, bool p_local_coords = false); + void push_local_unhandled_input(const Ref &p_event, bool p_local_coords = false); void set_disable_input(bool p_disable); bool is_input_disabled() const; diff --git a/scene/main/window.cpp b/scene/main/window.cpp index d6f81495574a..dc8b1edaccf8 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -920,11 +920,7 @@ void Window::_window_input(const Ref &p_ev) { emit_signal(SceneStringNames::get_singleton()->window_input, p_ev); - push_input(p_ev); - push_gui_input(p_ev); - if (!is_input_handled()) { - push_unhandled_input(p_ev); - } + push_input(p_ev, false); } void Window::_window_input_text(const String &p_text) { diff --git a/tests/test_macros.h b/tests/test_macros.h index 697d92bcfb2d..5f203b243bb9 100644 --- a/tests/test_macros.h +++ b/tests/test_macros.h @@ -166,7 +166,7 @@ int register_test_command(String p_command, TestFunc p_function); #define SEND_GUI_MOUSE_EVENT(m_object, m_local_pos, m_input, m_mask) \ { \ _CREATE_GUI_MOUSE_EVENT(m_object, m_local_pos, m_input, m_mask); \ - m_object->get_viewport()->push_gui_input(event); \ + m_object->get_viewport()->push_local_gui_input(event); \ MessageQueue::get_singleton()->flush(); \ } @@ -174,7 +174,7 @@ int register_test_command(String p_command, TestFunc p_function); { \ _CREATE_GUI_MOUSE_EVENT(m_object, m_local_pos, MouseButton::LEFT, MouseButton::LEFT); \ event->set_double_click(true); \ - m_object->get_viewport()->push_gui_input(event); \ + m_object->get_viewport()->push_local_gui_input(event); \ MessageQueue::get_singleton()->flush(); \ }