Commit ab9a1c5f authored by Felix Paul Kühne's avatar Felix Paul Kühne Committed by Jean-Baptiste Kempf

macosx: reimplement 'fullscreen video device' (fixes #5831)

(cherry picked from commit b9e10880)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent e7c027a1
...@@ -212,6 +212,7 @@ ...@@ -212,6 +212,7 @@
- (IBAction)resizeVideoWindow:(id)sender; - (IBAction)resizeVideoWindow:(id)sender;
- (IBAction)floatOnTop:(id)sender; - (IBAction)floatOnTop:(id)sender;
- (IBAction)createVideoSnapshot:(id)sender; - (IBAction)createVideoSnapshot:(id)sender;
- (IBAction)toggleFullscreenDevice:(id)sender;
- (IBAction)showWizard:(id)sender; - (IBAction)showWizard:(id)sender;
- (IBAction)showVideoEffects:(id)sender; - (IBAction)showVideoEffects:(id)sender;
......
...@@ -445,9 +445,6 @@ static VLCMainMenu *_o_sharedInstance = nil; ...@@ -445,9 +445,6 @@ static VLCMainMenu *_o_sharedInstance = nil;
[self setupVarMenuItem: o_mi_crop target: (vlc_object_t *) p_vout [self setupVarMenuItem: o_mi_crop target: (vlc_object_t *) p_vout
var: "crop" selector: @selector(toggleVar:)]; 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 [self setupVarMenuItem: o_mi_deinterlace target: (vlc_object_t *)p_vout
var: "deinterlace" selector: @selector(toggleVar:)]; var: "deinterlace" selector: @selector(toggleVar:)];
...@@ -460,6 +457,9 @@ static VLCMainMenu *_o_sharedInstance = nil; ...@@ -460,6 +457,9 @@ static VLCMainMenu *_o_sharedInstance = nil;
@selector(toggleVar:)]; @selector(toggleVar:)];
#endif #endif
vlc_object_release( (vlc_object_t *)p_vout ); vlc_object_release( (vlc_object_t *)p_vout );
[self refreshVoutDeviceMenu:nil];
[self setSubmenusEnabled: YES];
} }
vlc_object_release( p_input ); vlc_object_release( p_input );
} }
...@@ -471,25 +471,37 @@ static VLCMainMenu *_o_sharedInstance = nil; ...@@ -471,25 +471,37 @@ static VLCMainMenu *_o_sharedInstance = nil;
- (void)refreshVoutDeviceMenu:(NSNotification *)o_notification - (void)refreshVoutDeviceMenu:(NSNotification *)o_notification
{ {
int x, y = 0; NSUInteger count = [o_mu_screen numberOfItems];
vout_thread_t * p_vout = getVout(); NSMenu * o_submenu = o_mu_screen;
if( !p_vout ) if (count > 0)
return;
/* clean the menu before adding new entries */
if( [o_mi_screen hasSubmenu] )
{ {
y = [[o_mi_screen submenu] numberOfItems] - 1; if (OSX_LEOPARD)
while( x != y )
{ {
[[o_mi_screen submenu] removeItemAtIndex: x]; NSUInteger count = [o_submenu numberOfItems];
x++; 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 NSArray * o_screens = [NSScreen screens];
var: "video-device" selector: @selector(toggleVar:)]; count = [o_screens count];
vlc_object_release( (vlc_object_t *)p_vout ); [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 - (void)setSubmenusEnabled:(BOOL)b_enabled
...@@ -624,6 +636,12 @@ static VLCMainMenu *_o_sharedInstance = nil; ...@@ -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 - (id)voutMenu
{ {
return o_vout_menu; return o_vout_menu;
......
...@@ -1285,7 +1285,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1285,7 +1285,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
BOOL blackout_other_displays = config_GetInt( VLCIntf, "macosx-black" ); BOOL blackout_other_displays = config_GetInt( VLCIntf, "macosx-black" );
if( p_vout ) if( p_vout )
screen = [NSScreen screenWithDisplayID:(CGDirectDisplayID)var_GetInteger( p_vout, "video-device" )]; screen = [NSScreen screenWithDisplayID:(CGDirectDisplayID)config_GetInt( VLCIntf, "macosx-vdev" )];
[self lockFullscreenAnimation]; [self lockFullscreenAnimation];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment