Skip to content

Commit 3b8499a

Browse files
danwalmsleygrokys
authored andcommitted
Merge pull request AvaloniaUI#8405 from AvaloniaUI/fixes/8335-more-macos-window-issues
Fix more macos window issues and add more integration tests.
1 parent dcd3aa5 commit 3b8499a

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

native/Avalonia.Native/src/OSX/WindowBaseImpl.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@
223223
if (ret == nullptr)
224224
return E_POINTER;
225225

226-
if(Window != nullptr){
226+
if(Window != nullptr && _shown){
227227
auto frame = [Window frame];
228228
ret->Width = frame.size.width;
229229
ret->Height = frame.size.height;

native/Avalonia.Native/src/OSX/WindowImpl.mm

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,16 @@
118118
{
119119
if(Window != nullptr)
120120
{
121-
if(IsDialog())
121+
if (![Window isMiniaturized])
122122
{
123-
Activate();
124-
}
125-
else
126-
{
127-
[Window orderFront:nullptr];
123+
if(IsDialog())
124+
{
125+
Activate();
126+
}
127+
else
128+
{
129+
[Window orderFront:nullptr];
130+
}
128131
}
129132

130133
[Window invalidateShadow];
@@ -487,6 +490,8 @@
487490
}
488491

489492
if (_shown) {
493+
_actualWindowState = _lastWindowState;
494+
490495
switch (state) {
491496
case Maximized:
492497
if (currentState == FullScreen) {
@@ -544,7 +549,6 @@
544549
break;
545550
}
546551

547-
_actualWindowState = _lastWindowState;
548552
WindowEvents->WindowStateChanged(_actualWindowState);
549553
}
550554

src/Avalonia.Controls/Window.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,10 +902,10 @@ Owner is Window ownerWindow &&
902902
{
903903
if (owner != null)
904904
{
905-
// TODO: We really need non-client size here.
905+
var ownerSize = owner.FrameSize ?? owner.ClientSize;
906906
var ownerRect = new PixelRect(
907907
owner.Position,
908-
PixelSize.FromSize(owner.ClientSize, scaling));
908+
PixelSize.FromSize(ownerSize, scaling));
909909
Position = ownerRect.CenterRect(rect).Position;
910910
}
911911
}

0 commit comments

Comments
 (0)