]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix the top-level window client size setting code such that the window position does...
authorDavid Elliott <dfe@tgwbd.org>
Tue, 14 Aug 2007 22:38:32 +0000 (22:38 +0000)
committerDavid Elliott <dfe@tgwbd.org>
Tue, 14 Aug 2007 22:38:32 +0000 (22:38 +0000)
Copyright 2007 Software 2000 Ltd.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48074 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/cocoa/toplevel.mm

index 8cce120e0018a140dfd64956c1fddfb42cbb8ce9..3e73b00ceb987ff5b635c5742ca1b6179bc55a3e 100644 (file)
@@ -385,16 +385,22 @@ void wxTopLevelWindowCocoa::CocoaSetWxWindowSize(int width, int height)
 {
     // Set the NSView size by setting the frame size to enclose it
     unsigned int styleMask = [m_cocoaNSWindow styleMask];
-    NSRect frameRect = [m_cocoaNSWindow frame];
+    NSRect oldFrameRect = [m_cocoaNSWindow frame];
     NSRect contentRect = [NSWindow
-        contentRectForFrameRect: frameRect
+        contentRectForFrameRect: oldFrameRect
         styleMask: styleMask];
     contentRect.size.width = width;
     contentRect.size.height = height;
-    frameRect = [NSWindow
+    NSRect newFrameRect = [NSWindow
         frameRectForContentRect: contentRect
         styleMask: styleMask];
-    [m_cocoaNSWindow setFrame: frameRect display: NO];
+
+    // Cocoa uses +y is up but wxWidgets uses +y is down.  We want an increase/decrease in height
+    // to not effect where the top of the window is placed so we set the new y origin relative the
+    // old one taking the height change into account.
+    newFrameRect.origin.y = oldFrameRect.origin.y + oldFrameRect.size.height - newFrameRect.size.height;
+    
+    [m_cocoaNSWindow setFrame: newFrameRect display: NO];
 }
 
 void wxTopLevelWindowCocoa::DoMoveWindow(int x, int y, int width, int height)