work around OS X bug, fixes #16292

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76614 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor 2014-05-27 21:09:39 +00:00
parent 498f07a5b2
commit 28207132ce

View File

@ -324,6 +324,9 @@ static NSResponder* s_formerFirstResponder = NULL;
- (void)windowDidMove:(NSNotification *)notification;
- (BOOL)windowShouldClose:(id)window;
- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame;
#if wxHAS_FULL_SCREEN_API
- (void)windowWillEnterFullScreen:(NSNotification *)notification;
#endif
@end
@ -558,6 +561,30 @@ extern int wxOSXGetIdFromSelector(SEL action );
return true;
}
#if wxHAS_FULL_SCREEN_API
// work around OS X bug, on a secondary monitor an already fully sized window
// (eg maximized) will not be correctly put to full screen size and keeps a 22px
// title band at the top free, therefore we force the correct content size
- (void)windowWillEnterFullScreen:(NSNotification *)notification
{
NSWindow* window = (NSWindow*) [notification object];
NSView* view = [window contentView];
NSRect windowframe = [window frame];
NSRect viewframe = [view frame];
NSUInteger stylemask = [window styleMask] | NSFullScreenWindowMask;
NSRect expectedframerect = [NSWindow contentRectForFrameRect: windowframe styleMask: stylemask];
if ( !NSEqualSizes(expectedframerect.size, viewframe.size) )
{
[view setFrameSize: expectedframerect.size];
}
}
#endif
@end
IMPLEMENT_DYNAMIC_CLASS( wxNonOwnedWindowCocoaImpl , wxNonOwnedWindowImpl )