Skip to content

Commit

Permalink
Merge pull request AvaloniaUI#8405 from AvaloniaUI/fixes/8335-more-ma…
Browse files Browse the repository at this point in the history
…cos-window-issues

Fix more macos window issues and add more integration tests.
  • Loading branch information
danwalmsley authored and grokys committed Jun 29, 2022
1 parent dcd3aa5 commit 3b8499a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion native/Avalonia.Native/src/OSX/WindowBaseImpl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
if (ret == nullptr)
return E_POINTER;

if(Window != nullptr){
if(Window != nullptr && _shown){
auto frame = [Window frame];
ret->Width = frame.size.width;
ret->Height = frame.size.height;
Expand Down
18 changes: 11 additions & 7 deletions native/Avalonia.Native/src/OSX/WindowImpl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,16 @@
{
if(Window != nullptr)
{
if(IsDialog())
if (![Window isMiniaturized])
{
Activate();
}
else
{
[Window orderFront:nullptr];
if(IsDialog())
{
Activate();
}
else
{
[Window orderFront:nullptr];
}
}

[Window invalidateShadow];
Expand Down Expand Up @@ -487,6 +490,8 @@
}

if (_shown) {
_actualWindowState = _lastWindowState;

switch (state) {
case Maximized:
if (currentState == FullScreen) {
Expand Down Expand Up @@ -544,7 +549,6 @@
break;
}

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

Expand Down
4 changes: 2 additions & 2 deletions src/Avalonia.Controls/Window.cs
Original file line number Diff line number Diff line change
Expand Up @@ -902,10 +902,10 @@ Owner is Window ownerWindow &&
{
if (owner != null)
{
// TODO: We really need non-client size here.
var ownerSize = owner.FrameSize ?? owner.ClientSize;
var ownerRect = new PixelRect(
owner.Position,
PixelSize.FromSize(owner.ClientSize, scaling));
PixelSize.FromSize(ownerSize, scaling));
Position = ownerRect.CenterRect(rect).Position;
}
}
Expand Down

0 comments on commit 3b8499a

Please sign in to comment.