diff --git a/native/Avalonia.Native/src/OSX/WindowBaseImpl.mm b/native/Avalonia.Native/src/OSX/WindowBaseImpl.mm index 59102e15a6..dba5daf90b 100644 --- a/native/Avalonia.Native/src/OSX/WindowBaseImpl.mm +++ b/native/Avalonia.Native/src/OSX/WindowBaseImpl.mm @@ -273,6 +273,7 @@ HRESULT WindowBaseImpl::Resize(double x, double y, AvnPlatformResizeReason reaso auto resizeBlock = ResizeScope(View, reason); @autoreleasepool { + auto screenSize = [Window screen].visibleFrame.size; auto maxSize = lastMaxSize; auto minSize = lastMinSize; @@ -292,6 +293,15 @@ HRESULT WindowBaseImpl::Resize(double x, double y, AvnPlatformResizeReason reaso y = maxSize.height; } + if(x > screenSize.width){ + x = screenSize.width; + } + + if(y > screenSize.height) + { + y = screenSize.height; + } + @try { if(x != lastSize.width || y != lastSize.height) { lastSize = NSSize{x, y};