From f6b15cb5621a35169ef92e83087ba7346d31b72c Mon Sep 17 00:00:00 2001 From: Manolis Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Thu, 4 Nov 2021 02:46:12 +0200 Subject: [PATCH] Fixes #552 --- src/Main.gd | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Main.gd b/src/Main.gd index 1141bf3b2..8896521f0 100644 --- a/src/Main.gd +++ b/src/Main.gd @@ -289,6 +289,11 @@ func _notification(what : int) -> void: MainLoop.NOTIFICATION_WM_MOUSE_EXIT: # if the mouse exits the window and another application has the focus set the fps to the idle fps if !OS.is_window_focused() and Global.fps_limit_focus: Engine.set_target_fps(Global.idle_fps) + MainLoop.NOTIFICATION_WM_FOCUS_IN: + var mouse_pos := get_global_mouse_position() + var viewport_rect := Rect2(Global.main_viewport.rect_global_position, Global.main_viewport.rect_size) + if viewport_rect.has_point(mouse_pos): + Global.has_focus = true func _on_files_dropped(_files : PoolStringArray, _screen : int) -> void: