Browse Source

Merge pull request #8405 from AvaloniaUI/fixes/8335-more-macos-window-issues

Fix more macos window issues and add more integration tests.
pull/8415/head
Dan Walmsley 4 years ago
committed by Steven Kirk
parent
commit
3b8499a356
  1. 2
      native/Avalonia.Native/src/OSX/WindowBaseImpl.mm
  2. 18
      native/Avalonia.Native/src/OSX/WindowImpl.mm
  3. 4
      src/Avalonia.Controls/Window.cs

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

@ -223,7 +223,7 @@ HRESULT WindowBaseImpl::GetFrameSize(AvnSize *ret) {
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;

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

@ -118,13 +118,16 @@ void WindowImpl::BringToFront()
{
if(Window != nullptr)
{
if(IsDialog())
if (![Window isMiniaturized])
{
Activate();
}
else
{
[Window orderFront:nullptr];
if(IsDialog())
{
Activate();
}
else
{
[Window orderFront:nullptr];
}
}
[Window invalidateShadow];
@ -487,6 +490,8 @@ HRESULT WindowImpl::SetWindowState(AvnWindowState state) {
}
if (_shown) {
_actualWindowState = _lastWindowState;
switch (state) {
case Maximized:
if (currentState == FullScreen) {
@ -544,7 +549,6 @@ HRESULT WindowImpl::SetWindowState(AvnWindowState state) {
break;
}
_actualWindowState = _lastWindowState;
WindowEvents->WindowStateChanged(_actualWindowState);
}

4
src/Avalonia.Controls/Window.cs

@ -902,10 +902,10 @@ namespace Avalonia.Controls
{
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;
}
}

Loading…
Cancel
Save