[vlc-commits] macosx: reimplement 'fullscreen video device' (fixes #5831)
Felix Paul Kühne
git at videolan.org
Thu Jan 12 00:35:26 CET 2012
vlc/vlc-1.2 | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Wed Jan 11 19:53:27 2012 +0100| [ab9a1c5fac49ac8230e503a6767abdcdf3f6ed24] | committer: Jean-Baptiste Kempf
macosx: reimplement 'fullscreen video device' (fixes #5831)
(cherry picked from commit b9e1088003e3e5c1fb6202affd63b3b6b3d914ed)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.2.git/?a=commit;h=ab9a1c5fac49ac8230e503a6767abdcdf3f6ed24
---
modules/gui/macosx/MainMenu.h | 1 +
modules/gui/macosx/MainMenu.m | 52 ++++++++++++++++++++++++++------------
modules/gui/macosx/MainWindow.m | 2 +-
3 files changed, 37 insertions(+), 18 deletions(-)
diff --git a/modules/gui/macosx/MainMenu.h b/modules/gui/macosx/MainMenu.h
index 346c9ac..7189a2f 100644
--- a/modules/gui/macosx/MainMenu.h
+++ b/modules/gui/macosx/MainMenu.h
@@ -212,6 +212,7 @@
- (IBAction)resizeVideoWindow:(id)sender;
- (IBAction)floatOnTop:(id)sender;
- (IBAction)createVideoSnapshot:(id)sender;
+- (IBAction)toggleFullscreenDevice:(id)sender;
- (IBAction)showWizard:(id)sender;
- (IBAction)showVideoEffects:(id)sender;
diff --git a/modules/gui/macosx/MainMenu.m b/modules/gui/macosx/MainMenu.m
index 3e7a2b6..657a7e3 100644
--- a/modules/gui/macosx/MainMenu.m
+++ b/modules/gui/macosx/MainMenu.m
@@ -445,9 +445,6 @@ static VLCMainMenu *_o_sharedInstance = nil;
[self setupVarMenuItem: o_mi_crop target: (vlc_object_t *) p_vout
var: "crop" selector: @selector(toggleVar:)];
- [self setupVarMenuItem: o_mi_screen target: (vlc_object_t *)p_vout
- var: "video-device" selector: @selector(toggleVar:)];
-
[self setupVarMenuItem: o_mi_deinterlace target: (vlc_object_t *)p_vout
var: "deinterlace" selector: @selector(toggleVar:)];
@@ -460,6 +457,9 @@ static VLCMainMenu *_o_sharedInstance = nil;
@selector(toggleVar:)];
#endif
vlc_object_release( (vlc_object_t *)p_vout );
+
+ [self refreshVoutDeviceMenu:nil];
+ [self setSubmenusEnabled: YES];
}
vlc_object_release( p_input );
}
@@ -471,25 +471,37 @@ static VLCMainMenu *_o_sharedInstance = nil;
- (void)refreshVoutDeviceMenu:(NSNotification *)o_notification
{
- int x, y = 0;
- vout_thread_t * p_vout = getVout();
- if( !p_vout )
- return;
-
- /* clean the menu before adding new entries */
- if( [o_mi_screen hasSubmenu] )
+ NSUInteger count = [o_mu_screen numberOfItems];
+ NSMenu * o_submenu = o_mu_screen;
+ if (count > 0)
{
- y = [[o_mi_screen submenu] numberOfItems] - 1;
- while( x != y )
+ if (OSX_LEOPARD)
{
- [[o_mi_screen submenu] removeItemAtIndex: x];
- x++;
+ NSUInteger count = [o_submenu numberOfItems];
+ for( NSUInteger i = 0; i < count; i++ )
+ [o_submenu removeItemAtIndex: 0];
}
+ else
+ [o_submenu removeAllItems];
}
- [self setupVarMenuItem: o_mi_screen target: (vlc_object_t *)p_vout
- var: "video-device" selector: @selector(toggleVar:)];
- vlc_object_release( (vlc_object_t *)p_vout );
+ NSArray * o_screens = [NSScreen screens];
+ count = [o_screens count];
+ [o_submenu addItemWithTitle: _NS("Default") action:@selector(toggleFullscreenDevice:) keyEquivalent:@""];
+ [[o_submenu itemAtIndex: 0] setTag: 0];
+ [[o_submenu itemAtIndex: 0] setEnabled: YES];
+ [[o_submenu itemAtIndex: 0] setTarget: self];
+ NSRect s_rect;
+ for (NSUInteger i = 0; i < count; i++)
+ {
+ s_rect = [[o_screens objectAtIndex: i] frame];
+ [o_submenu addItemWithTitle: [NSString stringWithFormat: @"%@ %i (%ix%i)", _NS("Screen"), i+1,
+ (int)s_rect.size.width, (int)s_rect.size.height] action:@selector(toggleFullscreenDevice:) keyEquivalent:@""];
+ [[o_submenu itemAtIndex:i+1] setTag: (int)[[o_screens objectAtIndex: i] displayID]];
+ [[o_submenu itemAtIndex:i+1] setEnabled: YES];
+ [[o_submenu itemAtIndex:i+1] setTarget: self];
+ }
+ [[o_submenu itemWithTag: config_GetInt( VLCIntf, "macosx-vdev" )] setState: NSOnState];
}
- (void)setSubmenusEnabled:(BOOL)b_enabled
@@ -624,6 +636,12 @@ static VLCMainMenu *_o_sharedInstance = nil;
}
}
+- (IBAction)toggleFullscreenDevice:(id)sender
+{
+ config_PutInt( VLCIntf, "macosx-vdev", [sender tag] );
+ [self refreshVoutDeviceMenu: nil];
+}
+
- (id)voutMenu
{
return o_vout_menu;
diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index a4bee8b..e84d180 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -1285,7 +1285,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
BOOL blackout_other_displays = config_GetInt( VLCIntf, "macosx-black" );
if( p_vout )
- screen = [NSScreen screenWithDisplayID:(CGDirectDisplayID)var_GetInteger( p_vout, "video-device" )];
+ screen = [NSScreen screenWithDisplayID:(CGDirectDisplayID)config_GetInt( VLCIntf, "macosx-vdev" )];
[self lockFullscreenAnimation];
More information about the vlc-commits
mailing list