]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix showing the frames full screen under OS X.
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 5 Nov 2010 21:41:56 +0000 (21:41 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 5 Nov 2010 21:41:56 +0000 (21:41 +0000)
Don't leave space for the title bar when showing the frame full screen.

Closes #11701.

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

src/osx/cocoa/nonownedwnd.mm

index 1cd9e84b4866256c5cc2ba542559a7b4f9c58aaa..d23a92aeeedfbf711ec4145215afa639aa1c8502 100644 (file)
@@ -199,12 +199,22 @@ bool shouldHandleSelector(SEL selector)
 {
 }
 
+- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen;
 - (void)noResponderFor: (SEL) selector;
 - (void)sendEvent:(NSEvent *)event;
 @end
 
 @implementation wxNSPanel
 
+- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen
+{
+    wxNonOwnedWindowCocoaImpl* impl = (wxNonOwnedWindowCocoaImpl*) wxNonOwnedWindowImpl::FindFromWXWindow( self );
+    if (impl && impl->IsFullScreen())
+        return frameRect;
+    else
+        return [super constrainFrameRect:frameRect toScreen:screen];
+}
+
 - (BOOL)canBecomeKeyWindow
 {
     return YES;
@@ -787,7 +797,14 @@ bool wxNonOwnedWindowCocoaImpl::ShowFullScreen(bool show, long WXUNUSED(style))
         data->m_formerFrame = [m_macWindow frame];
         CGDisplayCapture( kCGDirectMainDisplay );
         [m_macWindow setLevel:CGShieldingWindowLevel()];
-        [m_macWindow setFrame:[[NSScreen mainScreen] frame] display:YES];
+        NSRect screenframe = [[NSScreen mainScreen] frame];
+        NSRect frame = NSMakeRect (0, 0, 100, 100);
+        NSRect contentRect;
+        contentRect = [NSWindow contentRectForFrameRect: frame
+                                styleMask: NSTitledWindowMask];
+        screenframe.origin.y += (frame.origin.y - contentRect.origin.y);
+        screenframe.size.height += (frame.size.height - contentRect.size.height);
+        [m_macWindow setFrame:screenframe display:YES];
     }
     else if ( m_macFullScreenData != NULL )
     {