diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/main/viewport.cpp | 39 | ||||
-rw-r--r-- | scene/main/viewport.h | 2 |
2 files changed, 37 insertions, 4 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 0633d194f7..8df007dcc7 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1533,6 +1533,35 @@ void Viewport::_gui_call_input(Control *p_control, const Ref<InputEvent> &p_inpu //_unblock(); } +void Viewport::_gui_call_notification(Control *p_control, int p_what) { + + CanvasItem *ci = p_control; + while (ci) { + + Control *control = Object::cast_to<Control>(ci); + if (control) { + + if (control->data.mouse_filter != Control::MOUSE_FILTER_IGNORE) { + control->notification(p_what); + } + + if (!control->is_inside_tree()) + break; + + if (!control->is_inside_tree() || control->is_set_as_toplevel()) + break; + if (control->data.mouse_filter == Control::MOUSE_FILTER_STOP) + break; + } + + if (ci->is_set_as_toplevel()) + break; + + ci = ci->get_parent_item(); + } + + //_unblock(); +} Control *Viewport::_gui_find_control(const Point2 &p_global) { _gui_prepare_subwindows(); @@ -1975,13 +2004,15 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { if (over != gui.mouse_over) { - if (gui.mouse_over) - gui.mouse_over->notification(Control::NOTIFICATION_MOUSE_EXIT); + if (gui.mouse_over) { + _gui_call_notification(gui.mouse_over, Control::NOTIFICATION_MOUSE_EXIT); + } _gui_cancel_tooltip(); - if (over) - over->notification(Control::NOTIFICATION_MOUSE_ENTER); + if (over) { + _gui_call_notification(over, Control::NOTIFICATION_MOUSE_ENTER); + } } gui.mouse_over = over; diff --git a/scene/main/viewport.h b/scene/main/viewport.h index 0565fd3d18..cdb9d4afb5 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -305,6 +305,8 @@ private: bool disable_input; void _gui_call_input(Control *p_control, const Ref<InputEvent> &p_input); + void _gui_call_notification(Control *p_control, int p_what); + void _gui_prepare_subwindows(); void _gui_sort_subwindows(); void _gui_sort_roots(); |