Skip to content

Commit

Permalink
Fix issue where the window regains focus and draws immediatly
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
OverloadedOrama authored Feb 25, 2021
1 parent 5986217 commit 35f97eb
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/Main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 35f97eb

Please sign in to comment.