I'm trying to determine which Control node has just changed focus. Another Control node has been set up for using focus by changing the focus mode on the node to All
. From within that node's script, I can tell if it has focus by checking has_focus
. However, I want to tell from another script if it has changed focus.
I know that there's focused_entered
and focus_exited
signals that I could listen to, but these components are pretty far away from each other on the component tree and I don't want to connect or bubble up the signals through a bunch of unrelated components.
The Control documentation says:
Only one
Control
node can be in keyboard focus.
Since there's only ever one node in focus, is there a global function that can determine what the single node currently has focus? How can I tell when the global focus has changed?