Browse Source

OSX backend initial sizing now has same behavior as windows.

When window is not shown, and Resize is called, it will trigger a Resize event, that updates ClientSize.
pull/5963/head
Dan Walmsley 5 years ago
parent
commit
a194fc12e2
  1. 13
      native/Avalonia.Native/src/OSX/window.mm
  2. 1
      src/Avalonia.Controls/Window.cs

13
native/Avalonia.Native/src/OSX/window.mm

@ -25,7 +25,6 @@ public:
ComPtr<IAvnGlContext> _glContext;
NSObject<IRenderTarget>* renderTarget;
AvnPoint lastPositionSet;
CGSize _lastRequestedSize;
NSString* _lastTitle;
IAvnMenu* _mainMenu;
@ -201,11 +200,7 @@ public:
ret->Width = frame.size.width;
ret->Height = frame.size.height;
}
else
{
ret->Width = _lastRequestedSize.width;
ret->Height = _lastRequestedSize.height;
}
return S_OK;
}
}
@ -266,8 +261,10 @@ public:
y = maxSize.height;
}
_lastRequestedSize.width = x;
_lastRequestedSize.height = y;
if(!_shown)
{
BaseEvents->Resized(AvnSize{x,y});
}
[Window setContentSize:NSSize{x, y}];

1
src/Avalonia.Controls/Window.cs

@ -656,7 +656,6 @@ namespace Avalonia.Controls
if (PlatformImpl != null)
{
PlatformImpl.Resize(initialSize);
ClientSize = PlatformImpl.ClientSize;
}
}
}

Loading…
Cancel
Save