[vlc-commits] macosx: use an updated API to set the behavior of menu bar and Dock in fullscreen mode on 10 .6&later

Felix Paul Kühne git at videolan.org
Tue Aug 16 11:10:53 CEST 2011


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Tue Aug 16 11:10:18 2011 +0200| [11b25c5bd08b4c90c05d5a164288a2365d1e1dc5] | committer: Felix Paul Kühne

macosx: use an updated API to set the behavior of menu bar and Dock in fullscreen mode on 10.6&later

this allows the user to access the Dock while in fullscreen mode in contrast to the previous implementation. behavior on 10.5 did not change.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=11b25c5bd08b4c90c05d5a164288a2365d1e1dc5
---

 modules/gui/macosx/MainWindow.m |   24 ++++++++++++++++++++----
 modules/gui/macosx/misc.h       |    3 +++
 modules/gui/macosx/misc.m       |   15 +++++++++++++--
 3 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index b0aa59c..d3ec6ac 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -972,7 +972,12 @@ static VLCMainWindow *_o_sharedInstance = nil;
             }
 
             if ([screen isMainScreen])
-                SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
+            {
+                if (NSAppKitVersionNumber < 1038) // Leopard
+                    SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
+                else
+                    [NSApp setPresentationOptions:(NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)];
+            }
 
             [[o_video_view superview] replaceSubview:o_video_view with:o_temp_view];
             [o_temp_view setFrame:[o_video_view frame]];
@@ -1026,7 +1031,12 @@ static VLCMainWindow *_o_sharedInstance = nil;
     }
 
     if ([screen isMainScreen])
-        SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
+    {
+        if (NSAppKitVersionNumber < 1038) // Leopard
+            SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
+        else
+            [NSApp setPresentationOptions:(NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)];
+    }
 
     dict1 = [[NSMutableDictionary alloc] initWithCapacity:2];
     dict2 = [[NSMutableDictionary alloc] initWithCapacity:3];
@@ -1131,7 +1141,10 @@ static VLCMainWindow *_o_sharedInstance = nil;
         }
 
         [o_fspanel setNonActive: nil];
-        SetSystemUIMode( kUIModeNormal, kUIOptionAutoShowMenuBar);
+        if (NSAppKitVersionNumber < 1038) // Leopard
+            SetSystemUIMode( kUIModeNormal, kUIOptionAutoShowMenuBar);
+        else
+            [NSApp setPresentationOptions:(NSApplicationPresentationDefault)];
 
         /* Will release the lock */
         [self hasEndedFullscreen];
@@ -1154,7 +1167,10 @@ static VLCMainWindow *_o_sharedInstance = nil;
     [[o_video_view window] orderFront: self];
 
     [o_fspanel setNonActive: nil];
-    SetSystemUIMode( kUIModeNormal, kUIOptionAutoShowMenuBar);
+    if (NSAppKitVersionNumber < 1038) // Leopard
+        SetSystemUIMode( kUIModeNormal, kUIOptionAutoShowMenuBar);
+    else
+        [NSApp setPresentationOptions:(NSApplicationPresentationDefault)];
 
     if (o_fullscreen_anim1)
     {
diff --git a/modules/gui/macosx/misc.h b/modules/gui/macosx/misc.h
index 93530e6..0a657b6 100644
--- a/modules/gui/macosx/misc.h
+++ b/modules/gui/macosx/misc.h
@@ -27,6 +27,9 @@
 
 #ifndef MAC_OS_X_VERSION_10_6
 @protocol NSWindowDelegate <NSObject> @end
+NSUInteger NSApplicationPresentationAutoHideDock;
+NSUInteger NSApplicationPresentationAutoHideMenuBar;
+NSUInteger NSApplicationPresentationDefault;
 #endif
 
 /*****************************************************************************
diff --git a/modules/gui/macosx/misc.m b/modules/gui/macosx/misc.m
index ecd05e4..4b1abe2 100644
--- a/modules/gui/macosx/misc.m
+++ b/modules/gui/macosx/misc.m
@@ -144,7 +144,15 @@ static NSMutableArray *blackoutWindows = NULL;
         [blackoutWindow release];
 
         if( [screen isMainScreen ] )
-           SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
+        {
+            if ([screen isMainScreen])
+            {
+                if (NSAppKitVersionNumber < 1038) // Leopard
+                    SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
+                else
+                    [NSApp setPresentationOptions:(NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)];
+            }
+        }
     }
 }
 
@@ -158,7 +166,10 @@ static NSMutableArray *blackoutWindows = NULL;
         [blackoutWindow closeAndAnimate: YES];
     }
 
-   SetSystemUIMode( kUIModeNormal, 0);
+    if (NSAppKitVersionNumber < 1038) // Leopard
+        SetSystemUIMode( kUIModeNormal, kUIOptionAutoShowMenuBar);
+    else
+        [NSApp setPresentationOptions:(NSApplicationPresentationDefault)];
 }
 
 @end



More information about the vlc-commits mailing list