From d6a66096739c7426fd38ae64a8c77ac946b15baf Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Fri, 27 Dec 2019 12:46:09 -0600 Subject: [PATCH] Eliminate `yield` in favor of `_process`. --- Accessible.gd | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Accessible.gd b/Accessible.gd index 8641b7b..ea09eb1 100644 --- a/Accessible.gd +++ b/Accessible.gd @@ -494,10 +494,7 @@ var timer func unfocused(): print_debug("Unfocused") position_in_children = 0 - timer = weakref(node.get_tree().create_timer(1)) - yield(timer.get_ref(), "timeout") - if node.is_inside_tree() and not node.get_focus_owner(): - node.get_tree().root.warp_mouse(node.rect_global_position) + timer = node.get_tree().create_timer(1) func click_focused(): if node.has_focus(): @@ -626,7 +623,8 @@ func _init(node): node.connect("item_selected", self, "tree_item_selected") node.connect("tree_exiting", self, "queue_free", [], Object.CONNECT_DEFERRED) -func _exit_tree(): - if timer != null and timer.get_ref(): - timer.get_ref().emit_signal("timeout") - timer.get_ref().unreference() +func _process(delta): + if timer and timer.time_left <= 0: + if node.is_inside_tree() and not node.get_focus_owner(): + node.get_tree().root.warp_mouse(node.rect_global_position) + timer = null