Author: hdu Date: Tue Dec 18 16:25:42 2012 New Revision: 1423520 URL: http://svn.apache.org/viewvc?rev=1423520&view=rev Log: #i121406# support the OSX>=10.7 fullscreen mode based on OSX Spaces
Modified: openoffice/trunk/main/vcl/aqua/source/window/salframeview.mm Modified: openoffice/trunk/main/vcl/aqua/source/window/salframeview.mm URL: http://svn.apache.org/viewvc/openoffice/trunk/main/vcl/aqua/source/window/salframeview.mm?rev=1423520&r1=1423519&r2=1423520&view=diff ============================================================================== --- openoffice/trunk/main/vcl/aqua/source/window/salframeview.mm (original) +++ openoffice/trunk/main/vcl/aqua/source/window/salframeview.mm Tue Dec 18 16:25:42 2012 @@ -37,6 +37,14 @@ #define WHEEL_EVENT_FACTOR 1.5 +// for allowing fullscreen support on deployment targets < OSX 10.7 +#if !defined(MAC_OS_X_VERSION_10_7) + #define NSWindowCollectionBehaviorFullScreenPrimary (1 << 7) + #define NSWindowCollectionBehaviorFullScreenAuxiliary (1 << 8) +// #define NSFullScreenWindowMask (1 << 14) +#endif + + static sal_uInt16 ImplGetModifierMask( unsigned int nMask ) { sal_uInt16 nRet = 0; @@ -153,6 +161,17 @@ static AquaSalFrame* getMouseContainerFr pFrame->VCLToCocoa( aRect ); NSWindow* pNSWindow = [super initWithContentRect: aRect styleMask: mpFrame->getStyleMask() backing: NSBackingStoreBuffered defer: NO ]; [pNSWindow useOptimizedDrawing: YES]; // OSX recommendation when there are no overlapping subviews within the receiver + + bool bAllowFullScreen = (0 == (mpFrame->mnStyle & (SAL_FRAME_STYLE_DIALOG | SAL_FRAME_STYLE_TOOLTIP | SAL_FRAME_STYLE_SYSTEMCHILD | SAL_FRAME_STYLE_FLOAT | SAL_FRAME_STYLE_TOOLWINDOW | SAL_FRAME_STYLE_INTRO))); + bAllowFullScreen &= (0 == (~mpFrame->mnStyle & (SAL_FRAME_STYLE_SIZEABLE))); + bAllowFullScreen &= (mpFrame->mpParent == NULL); + const SEL setCollectionBehavior = @selector(setCollectionBehavior:); + if( bAllowFullScreen && [pNSWindow respondsToSelector: setCollectionBehavior]) + { + NSNumber* bMode = [NSNumber numberWithInt:(bAllowFullScreen ? NSWindowCollectionBehaviorFullScreenPrimary : NSWindowCollectionBehaviorFullScreenAuxiliary)]; + [pNSWindow performSelector:setCollectionBehavior withObject:bMode]; + } + return pNSWindow; } @@ -324,6 +343,50 @@ static AquaSalFrame* getMouseContainerFr return bRet; } +#if 0 // windowWillEnterFullScreen doesn't do anything useful yet +-(void)windowWillEnterFullScreen: (NSNotification*)pNotification +{ + YIELD_GUARD; + + if( !mpFrame || !AquaSalFrame::isAlive( mpFrame ) ) + return; + // TODO: implement something useful + (void)pNotification; +} +#endif + +#if 0 // windowWillExitFullScreen doesn't do anything useful yet +-(void)windowWillExitFullScreen: (NSNotification*)pNotification +{ + YIELD_GUARD; + + if( !mpFrame || !AquaSalFrame::isAlive( mpFrame ) ) + return; + // TODO: implement something useful + (void)pNotification; +} +#endif + +-(void)windowDidEnterFullScreen: (NSNotification*)pNotification +{ + YIELD_GUARD; + + if( !mpFrame || !AquaSalFrame::isAlive( mpFrame)) + return; + mpFrame->mbFullScreen = true; + (void)pNotification; +} + +-(void)windowDidExitFullScreen: (NSNotification*)pNotification +{ + YIELD_GUARD; + + if( !mpFrame || !AquaSalFrame::isAlive( mpFrame)) + return; + mpFrame->mbFullScreen = false; + (void)pNotification; +} + -(void)dockMenuItemTriggered: (id)sender { (void)sender;