Apparently, focused is triggered on mouse_enter as well, so this code isn't needed.

This commit is contained in:
Nolan Darilek 2019-12-29 21:53:35 -06:00
parent 50ea09d7f7
commit dc6186c583
2 changed files with 0 additions and 16 deletions

View File

@ -502,13 +502,6 @@ func unfocused():
position_in_children = 0 position_in_children = 0
timer = node.get_tree().create_timer(1) timer = node.get_tree().create_timer(1)
func click_focused():
if node.has_focus():
return
if node.focus_mode == Control.FOCUS_ALL:
print_debug("Grabbing focus: %s" % node)
node.grab_focus()
func gui_input(event): func gui_input(event):
if event is InputEventKey and Input.is_action_just_pressed("ui_accept") and event.control and event.alt: if event is InputEventKey and Input.is_action_just_pressed("ui_accept") and event.control and event.alt:
TTS.speak("click", false) TTS.speak("click", false)
@ -599,9 +592,7 @@ func _init(node):
if is_focusable(node): if is_focusable(node):
node.set_focus_mode(Control.FOCUS_ALL) node.set_focus_mode(Control.FOCUS_ALL)
node.connect("focus_entered", self, "focused") node.connect("focus_entered", self, "focused")
node.connect("mouse_entered", self, "click_focused")
node.connect("focus_exited", self, "unfocused") node.connect("focus_exited", self, "unfocused")
node.connect("mouse_exited", self, "unfocused")
node.connect("gui_input", self, "gui_input") node.connect("gui_input", self, "gui_input")
if node is CheckBox: if node is CheckBox:
node.connect("toggled", self, "checkbox_toggled") node.connect("toggled", self, "checkbox_toggled")

View File

@ -24,9 +24,6 @@ var focus_restore_timer
func focused(node): func focused(node):
focus_restore_timer = null focus_restore_timer = null
func click_focused(node):
pass
func unfocused(node): func unfocused(node):
focus_restore_timer = get_tree().create_timer(0.2) focus_restore_timer = get_tree().create_timer(0.2)
@ -36,12 +33,8 @@ func augment_node(node):
accessibles.append(accessible) accessibles.append(accessible)
if not node.is_connected("focus_entered", self, "focused"): if not node.is_connected("focus_entered", self, "focused"):
node.connect("focus_entered", self, "focused", [node]) node.connect("focus_entered", self, "focused", [node])
if not node.is_connected("mouse_entered", self, "click_focused"):
node.connect("mouse_entered", self, "click_focused", [node])
if not node.is_connected("focus_exited", self, "unfocused"): if not node.is_connected("focus_exited", self, "unfocused"):
node.connect("focus_exited", self, "unfocused", [node]) node.connect("focus_exited", self, "unfocused", [node])
if not node.is_connected("mouse_exited", self, "unfocused"):
node.connect("mouse_exited", self, "unfocused", [node])
func augment_tree(node): func augment_tree(node):
if node is Accessible: if node is Accessible: