From: Vadim Zeitlin Date: Fri, 5 Nov 2010 21:41:56 +0000 (+0000) Subject: Fix showing the frames full screen under OS X. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/247bb51058784357741406d5a644bac2d1f21f6d Fix showing the frames full screen under OS X. 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 --- diff --git a/src/osx/cocoa/nonownedwnd.mm b/src/osx/cocoa/nonownedwnd.mm index 1cd9e84b48..d23a92aeee 100644 --- a/src/osx/cocoa/nonownedwnd.mm +++ b/src/osx/cocoa/nonownedwnd.mm @@ -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 ) {