From c6417b2499a2abe54bb4df44064c4613dc09a2d2 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Thu, 2 Mar 2023 15:31:13 +0000 Subject: [PATCH] constrain window to maximum size. --- native/Avalonia.Native/src/OSX/WindowBaseImpl.mm | 10 ++++++++++ 1 file changed, 10 insertions(+) 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};