Commit b778e287 authored by Felix Paul Kühne's avatar Felix Paul Kühne Committed by Felix Paul Kühne

macosx: re-implement 'video-deco' support (close #6426)

disabling this option will get you a separate video output window without any visible playback controls or window border. resizing is supported through hotkeys and Lion's native mechanism if available. Control the playback through menu and main window controller. Note that 'embedded' is obviously ignored in this mode.
(cherry picked from commit f01f7eca64bd6f007afeaaeed623990e76a43de8)
parent 3d8d3fc8
...@@ -93,6 +93,7 @@ ...@@ -93,6 +93,7 @@
BOOL b_dropzone_active; BOOL b_dropzone_active;
BOOL b_splitview_removed; BOOL b_splitview_removed;
BOOL b_minimized_view; BOOL b_minimized_view;
BOOL b_video_deco;
int i_lastSplitViewHeight; int i_lastSplitViewHeight;
int i_lastShownVolume; int i_lastShownVolume;
input_state_e cachedInputState; input_state_e cachedInputState;
...@@ -204,6 +205,7 @@ ...@@ -204,6 +205,7 @@
@interface VLCDetachedVideoWindow : NSWindow @interface VLCDetachedVideoWindow : NSWindow
{ {
BOOL b_dark_interface; BOOL b_dark_interface;
BOOL b_video_deco;
NSRect previousSavedFrame; NSRect previousSavedFrame;
} }
......
...@@ -125,7 +125,11 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -125,7 +125,11 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (void)awakeFromNib - (void)awakeFromNib
{ {
BOOL b_splitviewShouldBeHidden = NO; BOOL b_splitviewShouldBeHidden = NO;
/* setup the styled interface */ /* setup the styled interface */
b_video_deco = config_GetInt( VLCIntf, "video-deco" );
if (b_video_deco)
b_nonembedded = YES;
b_nativeFullscreenMode = NO; b_nativeFullscreenMode = NO;
#ifdef MAC_OS_X_VERSION_10_7 #ifdef MAC_OS_X_VERSION_10_7
if( OSX_LION ) if( OSX_LION )
...@@ -284,16 +288,26 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -284,16 +288,26 @@ static VLCMainWindow *_o_sharedInstance = nil;
[self setExcludedFromWindowsMenu: YES]; [self setExcludedFromWindowsMenu: YES];
[self setAcceptsMouseMovedEvents: YES]; [self setAcceptsMouseMovedEvents: YES];
// Set that here as IB seems to be buggy // Set that here as IB seems to be buggy
if (b_dark_interface) if (b_dark_interface && b_video_deco)
{ {
[self setContentMinSize:NSMakeSize(604., 288. + [o_titlebar_view frame].size.height)]; [self setContentMinSize:NSMakeSize(604., 288. + [o_titlebar_view frame].size.height)];
[o_detached_video_window setContentMinSize: NSMakeSize( 363., f_min_video_height + [o_detached_bottombar_view frame].size.height + [o_detached_titlebar_view frame].size.height )]; [o_detached_video_window setContentMinSize: NSMakeSize( 363., f_min_video_height + [o_detached_bottombar_view frame].size.height + [o_detached_titlebar_view frame].size.height )];
} }
else else if( b_video_deco )
{ {
[self setContentMinSize:NSMakeSize(604., 288.)]; [self setContentMinSize:NSMakeSize(604., 288.)];
[o_detached_video_window setContentMinSize: NSMakeSize( 363., f_min_video_height + [o_detached_bottombar_view frame].size.height )]; [o_detached_video_window setContentMinSize: NSMakeSize( 363., f_min_video_height + [o_detached_bottombar_view frame].size.height )];
} }
else
{
if (b_dark_interface)
[self setContentMinSize:NSMakeSize(604., 288. + [o_titlebar_view frame].size.height)];
else
[self setContentMinSize:NSMakeSize(604., 288.)];
[o_detached_bottombar_view setHidden:YES];
[o_detached_video_window setContentMinSize: NSMakeSize( 363., f_min_video_height )];
}
[self setTitle: _NS("VLC media player")]; [self setTitle: _NS("VLC media player")];
[o_time_fld setAlignment: NSCenterTextAlignment]; [o_time_fld setAlignment: NSCenterTextAlignment];
...@@ -338,6 +352,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -338,6 +352,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
else else
{ {
[o_titlebar_view setFullscreenButtonHidden: YES]; [o_titlebar_view setFullscreenButtonHidden: YES];
if (b_video_deco)
[o_detached_titlebar_view setFullscreenButtonHidden: YES]; [o_detached_titlebar_view setFullscreenButtonHidden: YES];
} }
...@@ -508,8 +523,11 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -508,8 +523,11 @@ static VLCMainWindow *_o_sharedInstance = nil;
/* detached video window */ /* detached video window */
winrect = [o_detached_video_window frame]; winrect = [o_detached_video_window frame];
if (b_video_deco)
{
[o_detached_titlebar_view setFrame: NSMakeRect( 0, winrect.size.height - f_titleBarHeight, winrect.size.width, f_titleBarHeight )]; [o_detached_titlebar_view setFrame: NSMakeRect( 0, winrect.size.height - f_titleBarHeight, winrect.size.width, f_titleBarHeight )];
[[o_detached_video_window contentView] addSubview: o_detached_titlebar_view positioned: NSWindowAbove relativeTo: nil]; [[o_detached_video_window contentView] addSubview: o_detached_titlebar_view positioned: NSWindowAbove relativeTo: nil];
}
o_color_backdrop = [[VLCColorView alloc] initWithFrame: [o_split_view frame]]; o_color_backdrop = [[VLCColorView alloc] initWithFrame: [o_split_view frame]];
[[self contentView] addSubview: o_color_backdrop positioned: NSWindowBelow relativeTo: o_split_view]; [[self contentView] addSubview: o_color_backdrop positioned: NSWindowBelow relativeTo: o_split_view];
...@@ -927,6 +945,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -927,6 +945,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
if (b_dark_interface) if (b_dark_interface)
{ {
[o_titlebar_view setWindowTitle: title]; [o_titlebar_view setWindowTitle: title];
if (b_video_deco)
[o_detached_titlebar_view setWindowTitle: title]; [o_detached_titlebar_view setWindowTitle: title];
} }
if (b_nonembedded && [[VLCMain sharedInstance] activeVideoPlayback]) if (b_nonembedded && [[VLCMain sharedInstance] activeVideoPlayback])
...@@ -938,7 +957,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -938,7 +957,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
{ {
NSWindow *o_key_window = [NSApp keyWindow]; NSWindow *o_key_window = [NSApp keyWindow];
if (b_dark_interface) if (b_dark_interface || !b_video_deco)
{ {
[o_key_window orderOut: sender]; [o_key_window orderOut: sender];
if ( [[VLCMain sharedInstance] activeVideoPlayback] && ( !b_nonembedded || o_key_window != self )) if ( [[VLCMain sharedInstance] activeVideoPlayback] && ( !b_nonembedded || o_key_window != self ))
...@@ -1255,13 +1274,17 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1255,13 +1274,17 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_time_sld setEnabled: NO]; [o_time_sld setEnabled: NO];
[o_time_sld setHidden: YES]; [o_time_sld setHidden: YES];
[o_time_sld_fancygradient_view setHidden: YES]; [o_time_sld_fancygradient_view setHidden: YES];
if (b_video_deco)
[o_detached_time_sld_fancygradient_view setHidden: YES]; [o_detached_time_sld_fancygradient_view setHidden: YES];
} }
if (b_video_deco)
{
[o_detached_time_sld setFloatValue: [o_time_sld floatValue]]; [o_detached_time_sld setFloatValue: [o_time_sld floatValue]];
[o_detached_time_sld setEnabled: [o_time_sld isEnabled]]; [o_detached_time_sld setEnabled: [o_time_sld isEnabled]];
[o_detached_time_fld setStringValue: [o_time_fld stringValue]]; [o_detached_time_fld setStringValue: [o_time_fld stringValue]];
[o_detached_time_sld setHidden: [o_time_sld isHidden]]; [o_detached_time_sld setHidden: [o_time_sld isHidden]];
}
} }
- (void)updateVolumeSlider - (void)updateVolumeSlider
...@@ -1383,8 +1406,11 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1383,8 +1406,11 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_stop_btn setEnabled: b_input]; [o_stop_btn setEnabled: b_input];
[o_fwd_btn setEnabled: (b_seekable || b_plmul || b_chapters)]; [o_fwd_btn setEnabled: (b_seekable || b_plmul || b_chapters)];
[o_bwd_btn setEnabled: (b_seekable || b_plmul || b_chapters)]; [o_bwd_btn setEnabled: (b_seekable || b_plmul || b_chapters)];
if (b_video_deco)
{
[o_detached_fwd_btn setEnabled: (b_seekable || b_plmul || b_chapters)]; [o_detached_fwd_btn setEnabled: (b_seekable || b_plmul || b_chapters)];
[o_detached_bwd_btn setEnabled: (b_seekable || b_plmul || b_chapters)]; [o_detached_bwd_btn setEnabled: (b_seekable || b_plmul || b_chapters)];
}
[[VLCMainMenu sharedInstance] setRateControlsEnabled: b_control]; [[VLCMainMenu sharedInstance] setRateControlsEnabled: b_control];
[o_time_sld setEnabled: b_seekable]; [o_time_sld setEnabled: b_seekable];
...@@ -1405,9 +1431,12 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1405,9 +1431,12 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_play_btn setImage: o_pause_img]; [o_play_btn setImage: o_pause_img];
[o_play_btn setAlternateImage: o_pause_pressed_img]; [o_play_btn setAlternateImage: o_pause_pressed_img];
[o_play_btn setToolTip: _NS("Pause")]; [o_play_btn setToolTip: _NS("Pause")];
if (b_video_deco)
{
[o_detached_play_btn setImage: o_pause_img]; [o_detached_play_btn setImage: o_pause_img];
[o_detached_play_btn setAlternateImage: o_pause_pressed_img]; [o_detached_play_btn setAlternateImage: o_pause_pressed_img];
[o_detached_play_btn setToolTip: _NS("Pause")]; [o_detached_play_btn setToolTip: _NS("Pause")];
}
[o_fspanel setPause]; [o_fspanel setPause];
} }
...@@ -1416,9 +1445,12 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1416,9 +1445,12 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_play_btn setImage: o_play_img]; [o_play_btn setImage: o_play_img];
[o_play_btn setAlternateImage: o_play_pressed_img]; [o_play_btn setAlternateImage: o_play_pressed_img];
[o_play_btn setToolTip: _NS("Play")]; [o_play_btn setToolTip: _NS("Play")];
if (b_video_deco)
{
[o_detached_play_btn setImage: o_play_img]; [o_detached_play_btn setImage: o_play_img];
[o_detached_play_btn setAlternateImage: o_play_pressed_img]; [o_detached_play_btn setAlternateImage: o_play_pressed_img];
[o_detached_play_btn setToolTip: _NS("Play")]; [o_detached_play_btn setToolTip: _NS("Play")];
}
[o_fspanel setPlay]; [o_fspanel setPlay];
} }
...@@ -1439,7 +1471,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1439,7 +1471,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_time_sld_fancygradient_view setFrame: NSMakeRect( oldFrame.origin.x, oldFrame.origin.y, f_value, oldFrame.size.height )]; [o_time_sld_fancygradient_view setFrame: NSMakeRect( oldFrame.origin.x, oldFrame.origin.y, f_value, oldFrame.size.height )];
} }
if (b_nonembedded) if (b_nonembedded && b_video_deco)
{ {
f_value = [o_detached_time_sld knobPosition]; f_value = [o_detached_time_sld knobPosition];
oldFrame = [o_detached_time_sld_fancygradient_view frame]; oldFrame = [o_detached_time_sld_fancygradient_view frame];
...@@ -1460,11 +1492,15 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1460,11 +1492,15 @@ static VLCMainWindow *_o_sharedInstance = nil;
frame.size.width = 0; frame.size.width = 0;
[o_time_sld_fancygradient_view setFrame: frame]; [o_time_sld_fancygradient_view setFrame: frame];
if (b_video_deco)
{
frame = [o_detached_time_sld_fancygradient_view frame]; frame = [o_detached_time_sld_fancygradient_view frame];
frame.size.width = 0; frame.size.width = 0;
[o_detached_time_sld_fancygradient_view setFrame: frame]; [o_detached_time_sld_fancygradient_view setFrame: frame];
} }
}
[o_time_sld_fancygradient_view setHidden: YES]; [o_time_sld_fancygradient_view setHidden: YES];
if (b_video_deco)
[o_detached_time_sld_fancygradient_view setHidden: YES]; [o_detached_time_sld_fancygradient_view setHidden: YES];
} }
[o_pool release]; [o_pool release];
...@@ -1480,7 +1516,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1480,7 +1516,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (id)setupVideoView - (id)setupVideoView
{ {
vout_thread_t *p_vout = getVout(); vout_thread_t *p_vout = getVout();
if (config_GetInt( VLCIntf, "embedded-video" ) || b_nativeFullscreenMode) if ((config_GetInt( VLCIntf, "embedded-video" ) || b_nativeFullscreenMode) && b_video_deco)
{ {
if ([o_video_view window] != self) if ([o_video_view window] != self)
{ {
...@@ -1498,7 +1534,15 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1498,7 +1534,15 @@ static VLCMainWindow *_o_sharedInstance = nil;
NSRect frame = [o_detached_video_window frame]; NSRect frame = [o_detached_video_window frame];
NSRect videoFrame = [o_video_view frame]; NSRect videoFrame = [o_video_view frame];
frame.size.width = videoFrame.size.width; frame.size.width = videoFrame.size.width;
if (b_video_deco)
frame.size.height = videoFrame.size.height + [o_detached_bottombar_view frame].size.height + [o_titlebar_view frame].size.height; frame.size.height = videoFrame.size.height + [o_detached_bottombar_view frame].size.height + [o_titlebar_view frame].size.height;
else
{
frame.size.height = videoFrame.size.height;
videoFrame.origin.y = .0;
videoFrame.origin.x = .0;
[o_video_view setFrame: videoFrame];
}
[o_detached_video_window setFrame: frame display: NO]; [o_detached_video_window setFrame: frame display: NO];
[[o_detached_video_window contentView] addSubview: o_video_view positioned:NSWindowAbove relativeTo:nil]; [[o_detached_video_window contentView] addSubview: o_video_view positioned:NSWindowAbove relativeTo:nil];
[o_detached_video_window setLevel:NSNormalWindowLevel]; [o_detached_video_window setLevel:NSNormalWindowLevel];
...@@ -1698,6 +1742,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1698,6 +1742,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
screen_rect = [screen frame]; screen_rect = [screen frame];
[o_fullscreen_btn setState: YES]; [o_fullscreen_btn setState: YES];
if (b_video_deco)
[o_detached_fullscreen_btn setState: YES]; [o_detached_fullscreen_btn setState: YES];
[self recreateHideMouseTimer]; [self recreateHideMouseTimer];
...@@ -1871,6 +1916,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1871,6 +1916,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
[self lockFullscreenAnimation]; [self lockFullscreenAnimation];
[o_fullscreen_btn setState: NO]; [o_fullscreen_btn setState: NO];
if (b_video_deco)
[o_detached_fullscreen_btn setState: NO]; [o_detached_fullscreen_btn setState: NO];
/* We always try to do so */ /* We always try to do so */
...@@ -2471,7 +2517,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -2471,7 +2517,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
{ {
b_dark_interface = config_GetInt( VLCIntf, "macosx-interfacestyle" ); b_dark_interface = config_GetInt( VLCIntf, "macosx-interfacestyle" );
if (b_dark_interface) if (b_dark_interface || !b_video_deco)
{ {
#ifdef MAC_OS_X_VERSION_10_7 #ifdef MAC_OS_X_VERSION_10_7
if (OSX_LION) if (OSX_LION)
...@@ -2483,6 +2529,11 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -2483,6 +2529,11 @@ static VLCMainWindow *_o_sharedInstance = nil;
#endif #endif
} }
b_video_deco = config_GetInt( VLCIntf, "video-deco" );
if (b_video_deco)
self = [super initWithContentRect:contentRect styleMask:styleMask
backing:backingType defer:flag];
else
self = [super initWithContentRect:contentRect styleMask:styleMask self = [super initWithContentRect:contentRect styleMask:styleMask
backing:backingType defer:flag]; backing:backingType defer:flag];
...@@ -2527,7 +2578,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -2527,7 +2578,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (void)performClose:(id)sender - (void)performClose:(id)sender
{ {
if (b_dark_interface) if (b_dark_interface || !b_video_deco)
[[VLCMainWindow sharedInstance] performClose: sender]; [[VLCMainWindow sharedInstance] performClose: sender];
else else
[super performClose: sender]; [super performClose: sender];
...@@ -2535,7 +2586,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -2535,7 +2586,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (void)performMiniaturize:(id)sender - (void)performMiniaturize:(id)sender
{ {
if (b_dark_interface) if (b_dark_interface || !b_video_deco)
[self miniaturize: sender]; [self miniaturize: sender];
else else
[super performMiniaturize: sender]; [super performMiniaturize: sender];
...@@ -2543,7 +2594,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -2543,7 +2594,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (void)performZoom:(id)sender - (void)performZoom:(id)sender
{ {
if (b_dark_interface) if (b_dark_interface || !b_video_deco)
[self customZoom: sender]; [self customZoom: sender];
else else
[super performZoom: sender]; [super performZoom: sender];
...@@ -2551,7 +2602,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -2551,7 +2602,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (void)zoom:(id)sender - (void)zoom:(id)sender
{ {
if (b_dark_interface) if (b_dark_interface || !b_video_deco)
[self customZoom: sender]; [self customZoom: sender];
else else
[super zoom: sender]; [super zoom: sender];
......
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