From 35f97ebe6f90bd2a5994b294231738ef4a6b998c Mon Sep 17 00:00:00 2001 From: Manolis Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Thu, 25 Feb 2021 07:00:50 -0800 Subject: [PATCH] Fix issue where the window regains focus and draws immediatly The issue occurred when the cursor exited the application window very fast while still on the canvas, thus Global.has_focus was still true, then lost focus. When Pixelorama regained focus, it would draw the tool even if the user clicked outside of the drawing canvas. --- src/Main.gd | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Main.gd b/src/Main.gd index 0c016b731..646c59b7e 100644 --- a/src/Main.gd +++ b/src/Main.gd @@ -151,6 +151,7 @@ func _notification(what : int) -> void: MainLoop.NOTIFICATION_WM_QUIT_REQUEST: # Handle exit show_quit_dialog() MainLoop.NOTIFICATION_WM_FOCUS_OUT: # Called when the mouse isn't in the window anymore + Global.has_focus = false if Global.fps_limit_focus: Engine.set_target_fps(1) # then set the fps to 1 to relieve the cpu MainLoop.NOTIFICATION_WM_MOUSE_ENTER: # Opposite of the above