Skip to content

Commit

Permalink
Merge pull request #6407 from AvaloniaUI/fixes/6399-osx-minimized-state
Browse files Browse the repository at this point in the history
OSX: Fix a couple of minimized WindowState bugs
  • Loading branch information
Dan Walmsley committed Aug 16, 2021
1 parent 4b42bba commit 531709b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions native/Avalonia.Native/src/OSX/window.mm
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,12 @@ virtual HRESULT SetParent (IAvnWindow* parent) override
if(cparent == nullptr)
return E_INVALIDARG;

// If one tries to show a child window with a minimized parent window, then the parent window will be
// restored but MacOS isn't kind enough to *tell* us that, so the window will be left in a non-interactive
// state. Detect this and explicitly restore the parent window ourselves to avoid this situation.
if (cparent->WindowState() == Minimized)
cparent->SetWindowState(Normal);

[cparent->Window addChildWindow:Window ordered:NSWindowAbove];

UpdateStyle();
Expand Down Expand Up @@ -1181,6 +1187,7 @@ virtual HRESULT SetWindowState (AvnWindowState state) override
}

_actualWindowState = _lastWindowState;
WindowEvents->WindowStateChanged(_actualWindowState);
}


Expand Down

0 comments on commit 531709b

Please sign in to comment.