diff options
author | Markus Sauermann <6299227+Sauermann@users.noreply.github.com> | 2023-09-01 08:40:35 +0200 |
---|---|---|
committer | Markus Sauermann <6299227+Sauermann@users.noreply.github.com> | 2023-11-14 20:29:17 +0100 |
commit | fa02d19fd170d050bb47c4e525061bf96afdb62a (patch) | |
tree | 443063d8f1bde9711f16fa5f9b5f29155d4aa3fc /scene/main | |
parent | c455cb65550c19afbbf657a1dbf9af2ca3b603da (diff) | |
download | redot-engine-fa02d19fd170d050bb47c4e525061bf96afdb62a.tar.gz |
Fix internal events not being delivered to some Window types
`AcceptDialog`, `Popup` and `PopupMenu` no longer subscribe to
"window_input" signal, because that is only sent if it is not an
internal signal.
Instead they receive events in `_input_from_window`. They ensure that
the event is also propagated to their super-function, just like
previously the signals would be treated.
Diffstat (limited to 'scene/main')
-rw-r--r-- | scene/main/window.cpp | 7 | ||||
-rw-r--r-- | scene/main/window.h | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 2c28dc31d6..0d554de6f4 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -1543,7 +1543,12 @@ void Window::_window_input(const Ref<InputEvent> &p_ev) { } } - if (p_ev->get_device() != InputEvent::DEVICE_ID_INTERNAL) { + // If the event needs to be handled in a Window-derived class, then it should overwrite + // `_input_from_window` instead of subscribing to the `window_input` signal, because the signal + // filters out internal events. + _input_from_window(p_ev); + + if (p_ev->get_device() != InputEvent::DEVICE_ID_INTERNAL && is_inside_tree()) { emit_signal(SceneStringNames::get_singleton()->window_input, p_ev); } diff --git a/scene/main/window.h b/scene/main/window.h index 8a54b6c7d3..3ef8d41b1b 100644 --- a/scene/main/window.h +++ b/scene/main/window.h @@ -239,6 +239,7 @@ protected: virtual void _post_popup() {} virtual void _update_theme_item_cache(); + virtual void _input_from_window(const Ref<InputEvent> &p_event) {} void _notification(int p_what); static void _bind_methods(); |