commit 7bbba58f316f50713b305d2a8a4530295c0af63e Author: Tor Lillqvist Date: Fri Jul 29 14:21:41 2011 +0300 Initial attempt at 10.7 Full-Screen feature support diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx index f6bcdc9..6dc352b 100644 --- a/vcl/aqua/source/window/salframe.cxx +++ b/vcl/aqua/source/window/salframe.cxx @@ -54,6 +54,7 @@ // needed for theming // FIXME: move theming code to salnativewidgets.cxx #include +#include #include "postmac.h" @@ -207,6 +208,31 @@ void AquaSalFrame::initWindowAndView() return; } + // On 10.7 and later, If the window has a title bar and is + // resizable, we make it full-screenable. The ideal would be to do + // it only for document windows, but how to figure out that? + if (GetSalData()->mnSystemVersion >= 0x1070) { + if ((mnStyleMask & NSTitledWindowMask) && (mnStyleMask & NSResizableWindowMask)) { + + // If compiled against a SDK version earlier than 10.7 + // NSWindowCollectionBehaviorFullScreenPrimary won't be + // defined so define it ourselves. Note that we can't use + // MAC_OS_X_VERSION_10_7 in this #if as such a macro is + // not defined in earlier SDKs... + +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070 + enum { + NSWindowCollectionBehaviorFullScreenPrimary = (1 << 7) + }; +#endif + + int behavior = (int) objc_msgSend(mpWindow, @selector(collectionBehavior)); + behavior |= NSWindowCollectionBehaviorFullScreenPrimary; + + objc_msgSend(mpWindow, @selector(setCollectionBehavior:), behavior); + } + } + if( (mnStyle & SAL_FRAME_STYLE_TOOLTIP) ) [mpWindow setIgnoresMouseEvents: YES]; else @@ -742,6 +768,20 @@ void AquaSalFrame::ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nDisplay ) return; mbFullScreen = bFullScreen; + + if (GetSalData()->mnSystemVersion >= 0x1070) { +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070 + enum { + NSFullScreenWindowMask = (1 << 14) + }; +#endif + if ((([mpWindow styleMask] & NSFullScreenWindowMask) == NSFullScreenWindowMask) == mbFullScreen) + return; + + objc_msgSend(mpWindow, @selector(toggleFullScreen:), mpWindow); + return; + } + if( bFullScreen ) { // hide the dock and the menubar if we are on the menu screen diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm index 54ebe80..6acc5ca 100644 --- a/vcl/aqua/source/window/salframeview.mm +++ b/vcl/aqua/source/window/salframeview.mm @@ -284,6 +284,18 @@ static AquaSalFrame* getMouseContainerFrame() } } +-(void)windowDidEnterFullScreen: (NSNotification*)pNotification +{ + (void)pNotification; + YIELD_GUARD; +} + +-(void)windowDidExitFullScreen: (NSNotification*)pNotification +{ + (void)pNotification; + YIELD_GUARD; +} + -(void)windowDidMiniaturize: (NSNotification*)pNotification { (void)pNotification; diff --git a/vcl/inc/aqua/salframeview.h b/vcl/inc/aqua/salframeview.h index 6420035..4014009 100644 --- a/vcl/inc/aqua/salframeview.h +++ b/vcl/inc/aqua/salframeview.h @@ -44,6 +44,8 @@ -(void)windowDidChangeScreen: (NSNotification*)pNotification; -(void)windowDidMove: (NSNotification*)pNotification; -(void)windowDidResize: (NSNotification*)pNotification; +-(void)windowDidEnterFullScreen: (NSNotification*)pNotification; +-(void)windowDidExitFullScreen: (NSNotification*)pNotification; -(void)windowDidMiniaturize: (NSNotification*)pNotification; -(void)windowDidDeminiaturize: (NSNotification*)pNotification; -(BOOL)windowShouldClose: (NSNotification*)pNotification;