Skip to content

Commit 1fe10df

Browse files
authored
Fix description of GUI input propagation (#7899)
* Fix: Propagation of _gui_input() _gui_input() calls only propagate up the scene tree for mouse events with appropriate filter flags. Keyboard and controller events do not propagate through _gui_input(). Places entire description of _gui_input() propagation in one location, marks it as a note to separate it from surrounding input propagation, and updates the description to include behavior of keyboard and controller events.
1 parent 42ac7c8 commit 1fe10df

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

tutorials/inputs/inputevent.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,15 @@ and SubViewports.
123123

124124
.. image:: img/input_event_scene_flow.webp
125125

126-
This order doesn't apply to :ref:`Control._gui_input() <class_Control_private_method__gui_input>`, which uses
127-
a different method based on event location or focused Control.
126+
.. note::
127+
128+
This order doesn't apply to :ref:`Control._gui_input() <class_Control_private_method__gui_input>`, which uses
129+
a different method based on event location or focused Control. GUI **mouse** events also travel
130+
up the scene tree, subject to the :ref:`Control.mouse_filter <class_Control_property_mouse_filter>`
131+
restrictions described above. However, since these events target specific Controls, only direct ancestors of
132+
the targeted Control node receive the event. GUI **keyboard and joypad** events *do not* travel
133+
up the scene tree, and can only be handled by the Control that received them. Otherwise, they will be
134+
propagated as non-GUI events through :ref:`Node._unhandled_input() <class_Node_private_method__unhandled_input>`.
128135

129136
Since Viewports don't send events to other :ref:`SubViewports <class_SubViewport>`, one of the following
130137
methods has to be used:
@@ -134,9 +141,6 @@ methods has to be used:
134141
:ref:`Node._input() <class_Node_private_method__input>` or :ref:`Control._gui_input() <class_Control_private_method__gui_input>`.
135142
2. Implement event propagation based on the individual requirements.
136143

137-
GUI events also travel up the scene tree but, since these events target
138-
specific Controls, only direct ancestors of the targeted Control node receive the event.
139-
140144
In accordance with Godot's node-based design, this enables
141145
specialized child nodes to handle and consume particular events, while
142146
their ancestors, and ultimately the scene root, can provide more

0 commit comments

Comments
 (0)