Browse Source

osx obey minsize.

Dan Walmsley 5 years ago
parent
commit
5f4e4cbb3b
1 changed files with 24 additions and 0 deletions
  1. 24 0
      native/Avalonia.Native/src/OSX/window.mm

+ 24 - 0
native/Avalonia.Native/src/OSX/window.mm

@@ -27,6 +27,7 @@ public:
     AvnPoint lastPositionSet;
     NSString* _lastTitle;
     IAvnMenu* _mainMenu;
+    
     bool _shown;
     
     WindowBaseImpl(IAvnWindowBaseEvents* events, IAvnGlContext* gl)
@@ -230,6 +231,29 @@ public:
     {
         @autoreleasepool
         {
+            auto maxSize = [Window maxSize];
+            auto minSize = [Window minSize];
+            
+            if (x < minSize.width)
+            {
+                x = minSize.width;
+            }
+            
+            if (y < minSize.height)
+            {
+                y = minSize.height;
+            }
+            
+            if (x > maxSize.width)
+            {
+                x = maxSize.width;
+            }
+            
+            if (y > maxSize.height)
+            {
+                y = maxSize.height;
+            }
+            
             [Window setContentSize:NSSize{x, y}];
             
             return S_OK;