]> git.sesse.net Git - vlc/commitdiff
macosx: added native fullscreen support for OS X Lion
authorFelix Paul Kühne <fkuehne@videolan.org>
Tue, 16 Aug 2011 12:09:30 +0000 (14:09 +0200)
committerFelix Paul Kühne <fkuehne@videolan.org>
Tue, 16 Aug 2011 12:09:30 +0000 (14:09 +0200)
16 files changed:
NEWS
modules/gui/macosx/AudioEffects.m
modules/gui/macosx/CoreInteraction.m
modules/gui/macosx/MainWindow.m
modules/gui/macosx/TrackSynchronization.m
modules/gui/macosx/VideoEffects.m
modules/gui/macosx/about.m
modules/gui/macosx/bookmarks.m
modules/gui/macosx/fspanel.m
modules/gui/macosx/intf.h
modules/gui/macosx/intf.m
modules/gui/macosx/open.m
modules/gui/macosx/playlistinfo.m
modules/gui/macosx/prefs.m
modules/gui/macosx/simple_prefs.m
modules/gui/macosx/wizard.m

diff --git a/NEWS b/NEWS
index 7e846a008667a5570869d9f7f2666dc7c1d37af5..8fe68810d796a0f0edc2165b93d6975b9ae120e6 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -83,6 +83,7 @@ Interfaces:
  * Mac OS X: new Track Synchronization panel
  * Mac OS X: new Video Effects panel for color and geometry adjustments
  * Mac OS X: re-written Open Disc functionality with automatic media detection
+ * Mac OS X: support for the native fullscreen mode on OS X Lion
  * The rc and telnet lua interfaces were merged into a new "cli" interface
  * dbus: Rewrite of the main loop to use a more efficient poll-based model
  * dbus: Upgrade to an mpris2 compliant interface, see http://www.mpris.org
@@ -99,6 +100,7 @@ Video Output:
    chroma conversion
  * New video output for Android platform, based on Surface
  * Support for 9/10bits output in the OpenGL output
+ * Updated OpenGL video output for Mac, which requires a Quartz Extreme capable Mac
 
 Audio Output:
  * New audio output based on AudioQueue API for iOS
index d64a54c64fe4d2656d9bb59968f9ff6302d57e93..1af0c44fc569ab88b1b219139796328d63fe200c 100644 (file)
@@ -102,6 +102,8 @@ static VLCAudioEffects *_o_sharedInstance = nil;
     [[o_tableView tabViewItemAtIndex:[o_tableView indexOfTabViewItemWithIdentifier:@"filter"]] setLabel:_NS("Filter")];
     [o_window setTitle:_NS("Audio Effects")];
     [o_window setExcludedFromWindowsMenu:YES];
+    if (NSAppKitVersionNumber >= 1115.2)
+        [o_window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
 
     [self setupEqualizer];
     [self resetCompressor];
index bef0158d6d8f720a055581eb3a85118721e5768e..cc2af1e165f1b9ac3a89c9e184ebc039a8291468 100644 (file)
@@ -278,14 +278,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
 
 - (void)toggleFullscreen
 {
-    input_thread_t * p_input = pl_CurrentInput( VLCIntf );
-
-    if( p_input != NULL )
-    {
-        playlist_t * p_playlist = pl_Get( VLCIntf );
-        var_ToggleBool( p_playlist, "fullscreen" );
-
-        vlc_object_release( p_input );
-    }
+    playlist_t * p_playlist = pl_Get( VLCIntf );
+    var_ToggleBool( p_playlist, "fullscreen" );
 }
 @end
index d3ec6aca40ff1d055d7d407dfbfd71c390a14972..2c9790ff061bfa1178845d7ba4ee22f2332acbfd 100644 (file)
@@ -218,6 +218,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
     o_temp_view = [[NSView alloc] init];
     [o_temp_view setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];
     [o_dropzone_view setFrame: [o_playlist_table frame]];
+    if (NSAppKitVersionNumber >= 1115.2)
+        [self setCollectionBehavior: NSWindowCollectionBehaviorFullScreenPrimary];
 
     /* create the sidebar */
     o_sidebaritems = [[NSMutableArray alloc] init];
@@ -803,7 +805,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
         {
             [o_video_view removeFromSuperviewWithoutNeedingDisplay];
             [o_video_view setFrame: [o_split_view frame]];
-            [[self contentView] addSubview: o_video_view];
+            [[self contentView] addSubview:o_video_view positioned:NSWindowAbove relativeTo:nil];
         }
         b_nonembedded = NO;
     }
@@ -1313,8 +1315,6 @@ static VLCMainWindow *_o_sharedInstance = nil;
     /* fullscreenAnimation will be unlocked when animation ends */
 }
 
-
-
 /* Make sure setFrame gets executed on main thread especially if we are animating.
  * (Thus we won't block the video output thread) */
 - (void)setFrame:(NSRect)frame display:(BOOL)display animate:(BOOL)animate
index 73da112874b6d6f2fc7cacaefbffff9125511ace..848f7529fe8701b2bddee694468a50d0e871396f 100644 (file)
@@ -61,6 +61,9 @@ static VLCTrackSynchronization *_o_sharedInstance = nil;
     [o_sv_speed_lbl setStringValue: _NS("Speed of the subtitles:")];
     [[o_sv_speed_value_fld formatter] setFormat:[NSString stringWithFormat:@"#,##0.000 %@", _NS("fps")]];
 
+    if (NSAppKitVersionNumber >= 1115.2)
+        [o_window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
+
     [self resetValues:self];
 }
 
index 00744f01f02c9119f3e8dc2f3d8a1c08d7f3b587..47aaf637adbc266a99c3f6421f12bfc4d7af238c 100644 (file)
@@ -60,6 +60,9 @@ static VLCVideoEffects *_o_sharedInstance = nil;
 {
     [o_window setTitle: _NS("Video Effects")];
     [o_window setExcludedFromWindowsMenu:YES];
+    if (NSAppKitVersionNumber >= 1115.2)
+        [o_window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
+
     [[o_tableView tabViewItemAtIndex:[o_tableView indexOfTabViewItemWithIdentifier:@"basic"]] setLabel:_NS("Basic")];
     [[o_tableView tabViewItemAtIndex:[o_tableView indexOfTabViewItemWithIdentifier:@"crop"]] setLabel:_NS("Crop")];
     [[o_tableView tabViewItemAtIndex:[o_tableView indexOfTabViewItemWithIdentifier:@"geometry"]] setLabel:_NS("Geometry")];
index 30ad0cb70a900c606dc21cc04f77214018c9f524..bbd0b67477311f0f014289875d4af585970cdab8 100644 (file)
@@ -67,6 +67,12 @@ static VLAboutBox *_o_sharedInstance = nil;
     [super dealloc];
 }
 
+- (void)awakeFromNib
+{
+    if (NSAppKitVersionNumber >= 1115.2)
+        [o_about_window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
+}
+
 /*****************************************************************************
 * VLC About Window
 *****************************************************************************/
index 7d0f9efbae2350e7927c3ef528c145cd383670a3..412c0f2952a7bdc9690e0fc9c4504f507ab5e5d0 100644 (file)
@@ -71,6 +71,9 @@ static VLCBookmarks *_o_sharedInstance = nil;
 
 - (void)awakeFromNib
 {
+    if (NSAppKitVersionNumber >= 1115.2)
+        [o_bookmarks_window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
+
     [self initStrings];
 }
 
index 7802af910c78011dfbae4d4aff91873f55270439..85fabc1a86dddd1a0e99dbc65f79f54bc8c3c7d3 100644 (file)
@@ -49,7 +49,9 @@
     [win setOpaque:NO];
     [win setHasShadow: NO];
     [win setBackgroundColor:[NSColor clearColor]];
-    
+    if (NSAppKitVersionNumber >= 1115.2)
+        [win setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
+
     /* let the window sit on top of everything else and start out completely transparent */
     [win setLevel:NSModalPanelWindowLevel];
     i_device = 0;
index 917dc6dc048196d9d49c6f1fefb9f2f1fac9c1f1..83a7391856ba655936978cd297ecb9986d9a896c 100644 (file)
@@ -38,6 +38,7 @@
 #include <Cocoa/Cocoa.h>
 #import "SPMediaKeyTap.h"                   /* for the media key support */
 #import "misc.h"
+#import "MainWindow.h"
 
 /*****************************************************************************
  * Local prototypes.
@@ -108,7 +109,7 @@ struct intf_sys_t
     BOOL nib_bookmarks_loaded;   /* Bookmarks nibfile */
     BOOL b_active_videoplayback;
 
-    id o_mainwindow;            /* VLCMainWindow */
+    VLCMainWindow *o_mainwindow;            /* VLCMainWindow */
 
     IBOutlet VLCControls * o_controls;     /* VLCControls    */
     IBOutlet VLCPlaylist * o_playlist;     /* VLCPlaylist    */
index 54ae70f347b146c4ff9a783c11fa1801c1a099ed..0642480bdcf2d3903ed3077222ea8f530298c64a 100644 (file)
@@ -41,7 +41,6 @@
 
 #import "intf.h"
 #import "MainMenu.h"
-#import "MainWindow.h"
 #import "vout.h"
 #import "prefs.h"
 #import "playlist.h"
@@ -260,7 +259,6 @@ static int InputEvent( vlc_object_t *p_this, const char *psz_var,
         case INPUT_EVENT_ES:
             break;
         case INPUT_EVENT_TELETEXT:
-            NSLog( @"teletext" );
             break;
         case INPUT_EVENT_AOUT:
             break;
@@ -563,6 +561,9 @@ static VLCMain *_o_sharedMainInstance = nil;
     var_AddCallback(p_playlist, "volume", VolumeUpdated, self);
     var_AddCallback(p_playlist, "mute", VolumeUpdated, self);
 
+    if ([NSApp currentSystemPresentationOptions] == NSApplicationPresentationFullScreen)
+        var_SetBool( p_playlist, "fullscreen", YES );
+
     /* load our Core Dialogs nib */
     nib_coredialogs_loaded = [NSBundle loadNibNamed:@"CoreDialogs" owner: NSApp];
 
@@ -1229,10 +1230,30 @@ unsigned int CocoaKeyToVLC( unichar i_key )
 #pragma mark Interface updaters
 - (void)fullscreenChanged
 {
-    if(! [o_mainwindow isFullscreen] )
-        [o_mainwindow performSelectorOnMainThread:@selector(enterFullscreen) withObject:nil waitUntilDone:NO];
+    playlist_t * p_playlist = pl_Get( VLCIntf );
+    BOOL b_fullscreen = var_GetBool( p_playlist, "fullscreen" );
+
+    if (NSAppKitVersionNumber >= 1115.2)
+    {
+        [o_mainwindow toggleFullScreen: self];
+        if(b_fullscreen)
+            [NSApp setPresentationOptions:(NSApplicationPresentationFullScreen)];
+        else
+            [NSApp setPresentationOptions:(NSApplicationPresentationDefault)];
+    }
     else
-        [o_mainwindow performSelectorOnMainThread:@selector(leaveFullscreen) withObject:nil waitUntilDone:NO];
+    {
+        input_thread_t * p_input = pl_CurrentInput( VLCIntf );
+
+        if( p_input != NULL )
+        {
+            if(b_fullscreen)
+                [o_mainwindow performSelectorOnMainThread:@selector(enterFullscreen) withObject:nil waitUntilDone:NO];
+            else
+                [o_mainwindow performSelectorOnMainThread:@selector(leaveFullscreen) withObject:nil waitUntilDone:NO];
+            vlc_object_release( p_input );
+        }
+    }
 }
 
 - (void)PlaylistItemChanged
index f5a87182c43fb163c8db01a91b02be34f812db59..d47f59329c4c9175a71533db7cc00be6f2f52083 100644 (file)
@@ -104,6 +104,9 @@ static VLCOpen *_o_sharedMainInstance = nil;
 
 - (void)awakeFromNib
 {
+    if (NSAppKitVersionNumber >= 1115.2)
+        [o_panel setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
+
     [o_panel setTitle: _NS("Open Source")];
     [o_mrl_lbl setStringValue: _NS("Media Resource Locator (MRL)")];
 
index f40a06fe4ef9ab13234ee29b3eaeda61f22c5885..77e3c303e298c74c75634fe0ad9e0a5eae7cb238 100644 (file)
@@ -69,6 +69,8 @@ static VLCInfo *_o_sharedInstance = nil;
 {
     [o_info_window setExcludedFromWindowsMenu: YES];
     [o_info_window setFloatingPanel: NO];
+    if (NSAppKitVersionNumber >= 1115.2)
+        [o_info_window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
 
     [o_info_window setTitle: _NS("Media Information")];
     [o_uri_lbl setStringValue: _NS("Location")];
index 1bf3080886a77d4d3e7a130f80486fa5cb83ef05..03f977ba31ec7cf228b1ef0c5fed4d52ea399b74 100644 (file)
@@ -175,6 +175,9 @@ static VLCPrefs *_o_sharedMainInstance = nil;
 {
     p_intf = VLCIntf;
 
+    if (NSAppKitVersionNumber >= 1115.2)
+        [o_prefs_window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
+
     [self initStrings];
     [o_prefs_view setBorderType: NSGrooveBorder];
     [o_prefs_view setHasVerticalScroller: YES];
index cd5b4dbb20752b75852a5b3f76d00985c4397eaa..edf4f6e02dbb6a485fe24c1fb1def4bc433bb6e2 100644 (file)
@@ -104,6 +104,9 @@ static VLCSimplePrefs *_o_sharedInstance = nil;
     [o_sprefs_toolbar setDelegate: self];
     [o_sprefs_win setToolbar: o_sprefs_toolbar];
 
+    if (NSAppKitVersionNumber >= 1115.2)
+        [o_sprefs_win setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
+
     /* setup useful stuff */
     o_hotkeysNonUseableKeys = [[NSArray arrayWithObjects: @"Command-c", @"Command-x", @"Command-v", @"Command-a", @"Command-," , @"Command-h", @"Command-Alt-h", @"Command-Shift-o", @"Command-o", @"Command-d", @"Command-n", @"Command-s", @"Command-z", @"Command-l", @"Command-r", @"Command-3", @"Command-m", @"Command-w", @"Command-Shift-w", @"Command-Shift-c", @"Command-Shift-p", @"Command-i", @"Command-e", @"Command-Shift-e", @"Command-b", @"Command-Shift-m", @"Command-Ctrl-m", @"Command-?", @"Command-Alt-?", nil] retain];
 }
index 5c462dfd0fc9b801d2d674d2e0c943e17c2b5fd1..6cb06af4f0e3c6b71046d598292fc84d2be630e8 100644 (file)
@@ -71,6 +71,9 @@ static VLCWizard *_o_sharedInstance = nil;
 
 - (void)awakeFromNib
 {
+    if (NSAppKitVersionNumber >= 1115.2)
+        [o_wizard_window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
+
     /* some minor cleanup */
     [o_t2_tbl_plst setEnabled:NO];
     o_userSelections = [[NSMutableDictionary alloc] init];