Another attempted fix for cases where focus is unset and nothing can be done.

When we unfocus, wait a second. If we don't have focus after the timer elapses, warp the mouse to the global coordinates.

This seems to restore some semblance of focus whenever it is unset, while not breaking the case where a focus is set and the mouse suddenly jumps, thus changing the focus again.
This commit is contained in:
Nolan Darilek 2019-09-25 09:15:49 -05:00
parent 636c275c7f
commit ca73c2f255

View File

@ -378,6 +378,9 @@ func focus():
func unfocus():
print("Unfocused")
position_in_children = 0
yield(node.get_tree().create_timer(1), "timeout")
if not node.get_focus_owner():
node.get_tree().root.warp_mouse(node.rect_global_position)
func click_focus():
if node.has_focus():