22 lines
413 B
GDScript
22 lines
413 B
GDScript
extends Node2D
|
|
|
|
var mouse_in_window
|
|
|
|
func _ready() -> void:
|
|
Triggerer.listen("released", _on_released)
|
|
|
|
|
|
func _on_released(_data):
|
|
if mouse_in_window:
|
|
get_window().grab_focus()
|
|
|
|
|
|
func _notification(blah):
|
|
match blah:
|
|
NOTIFICATION_WM_MOUSE_EXIT:
|
|
mouse_in_window = false
|
|
NOTIFICATION_WM_MOUSE_ENTER:
|
|
mouse_in_window = true
|
|
|
|
if not Persister.get_value("grabbing"):
|
|
get_window().grab_focus()
|