Skip to content

Commit

Permalink
Fix window reopen issue (#51)
Browse files Browse the repository at this point in the history
Co-authored-by: c4710n <[email protected]>
  • Loading branch information
c4710n and c4710n authored Mar 7, 2024
1 parent b6507b7 commit 26bae7d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/desktop/window.ex
Original file line number Diff line number Diff line change
Expand Up @@ -523,13 +523,22 @@ defmodule Desktop.Window do

@doc false
def handle_cast(:close_window, ui = %Window{frame: frame, taskbar: taskbar}) do
# On macOS, there's no way to differentiate between following two events:
#
# * the window close event
# * the application close event
#
# So, this code assumes that if there's a closet_window event coming in while
# the window in not actually shown, then it must be an application close event.
#
# On other platforms, this code should not have any relevance.
if not :wxFrame.isShown(frame) do
OS.shutdown()
end

if taskbar == nil do
:wxFrame.hide(frame)
{:stop, :normal, ui}
OS.shutdown()
{:noreply, ui}
else
:wxFrame.hide(frame)
{:noreply, ui}
Expand Down

0 comments on commit 26bae7d

Please sign in to comment.