[[NSNotificationCenter defaultCenter] removeObserver: self];
[o_sidebaritems release];
+
+ if( o_extra_video_window )
+ [o_extra_video_window release];
+
[super dealloc];
}
[o_playlist_table setHidden: NO];
[o_video_view setHidden: !b_activeVideo];
if( b_activeVideo && [[o_video_view subviews] count] > 0 )
- [o_detached_video_window makeFirstResponder: [[o_video_view subviews] objectAtIndex:0]];
+ [[o_video_view window] makeFirstResponder: [[o_video_view subviews] objectAtIndex:0]];
}
}
}
- (id)setupVideoView
{
- vout_thread_t *p_vout = getVout();
- if ((config_GetInt( VLCIntf, "embedded-video" ) || b_nativeFullscreenMode) && b_video_deco)
+ if( config_GetInt( VLCIntf, "macosx-background" ) )
{
- if ([o_video_view window] != self)
- {
+ msg_Dbg( VLCIntf, "Creating background window" );
+ NSScreen *screen = [NSScreen screenWithDisplayID:(CGDirectDisplayID)config_GetInt( VLCIntf, "macosx-vdev" )];
+ if( !screen )
+ screen = [self screen];
+ NSRect screen_rect = [screen frame];
+
+ if( o_extra_video_window )
+ [o_extra_video_window release];
+
+ o_extra_video_window = [[VLCWindow alloc] initWithContentRect:screen_rect styleMask: NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
+ [o_extra_video_window setLevel: CGWindowLevelForKey(kCGDesktopWindowLevelKey) + 1];
+ [o_extra_video_window setBackgroundColor: [NSColor blackColor]];
+ [o_extra_video_window setCanBecomeKeyWindow: NO];
+ [o_extra_video_window setCanBecomeMainWindow: NO];
+ [o_extra_video_window useOptimizedDrawing: YES];
+ [o_extra_video_window setMovableByWindowBackground: NO];
+
+ [o_video_view retain];
+ if ([o_video_view superview] != NULL)
[o_video_view removeFromSuperviewWithoutNeedingDisplay];
- [o_video_view setFrame: [o_split_view frame]];
- [[self contentView] addSubview:o_video_view positioned:NSWindowAbove relativeTo:nil];
- }
- b_nonembedded = NO;
+ screen_rect.origin.x = screen_rect.origin.y = 0;
+ [o_video_view setFrame: screen_rect];
+ [[o_extra_video_window contentView] addSubview: o_video_view positioned:NSWindowAbove relativeTo:nil];
+ [o_video_view release];
+
+ [o_extra_video_window orderBack:nil];
+
+ b_nonembedded = YES;
}
else
{
- if ([o_video_view superview] != NULL)
- [o_video_view removeFromSuperviewWithoutNeedingDisplay];
-
- NSRect frame = [o_detached_video_window frame];
- NSRect videoFrame = [o_video_view frame];
- 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;
+ if ((config_GetInt( VLCIntf, "embedded-video" ) || b_nativeFullscreenMode) && b_video_deco)
+ {
+ if ([o_video_view window] != self)
+ {
+ [o_video_view removeFromSuperviewWithoutNeedingDisplay];
+ [o_video_view setFrame: [o_split_view frame]];
+ [[self contentView] addSubview:o_video_view positioned:NSWindowAbove relativeTo:nil];
+ }
+ b_nonembedded = NO;
+ }
else
{
- frame.size.height = videoFrame.size.height;
- videoFrame.origin.y = .0;
- videoFrame.origin.x = .0;
- [o_video_view setFrame: videoFrame];
+ if ([o_video_view superview] != NULL)
+ [o_video_view removeFromSuperviewWithoutNeedingDisplay];
+
+ NSRect frame = [o_detached_video_window frame];
+ NSRect videoFrame = [o_video_view frame];
+ 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;
+ 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 contentView] addSubview: o_video_view positioned:NSWindowAbove relativeTo:nil];
+ [o_detached_video_window setLevel:NSNormalWindowLevel];
+ [o_detached_video_window useOptimizedDrawing: YES];
+ [o_detached_video_window center];
+ b_nonembedded = YES;
+ }
+
+ [[o_video_view window] makeKeyAndOrderFront: self];
+
+ vout_thread_t *p_vout = getVout();
+ if (p_vout)
+ {
+ if( var_GetBool( p_vout, "video-on-top" ) )
+ [[o_video_view window] setLevel: NSStatusWindowLevel];
+ else
+ [[o_video_view window] setLevel: NSNormalWindowLevel];
+ vlc_object_release( p_vout );
}
- [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 setLevel:NSNormalWindowLevel];
- [o_detached_video_window useOptimizedDrawing: YES];
- [o_detached_video_window center];
- b_nonembedded = YES;
}
- [[o_video_view window] makeKeyAndOrderFront: self];
- [[o_video_view window] setAlphaValue: config_GetFloat( VLCIntf, "macosx-opaqueness" )];
- if (p_vout)
- {
- if( var_GetBool( p_vout, "video-on-top" ) )
- [[o_video_view window] setLevel: NSStatusWindowLevel];
- else
- [[o_video_view window] setLevel: NSNormalWindowLevel];
- vlc_object_release( p_vout );
- }
+ [[o_video_view window] setAlphaValue: config_GetFloat( VLCIntf, "macosx-opaqueness" )];
return o_video_view;
}
{
[self makeFirstResponder: nil];
[o_detached_video_window orderOut: nil];
+ if( o_extra_video_window )
+ [o_extra_video_window orderOut: nil];
if( [self level] != NSNormalWindowLevel )
[self setLevel: NSNormalWindowLevel];
{
nativeVideoSize = size;
- if( config_GetInt( VLCIntf, "macosx-video-autoresize" ) && !b_fullscreen )
+ if( config_GetInt( VLCIntf, "macosx-video-autoresize" ) && !b_fullscreen && !config_GetInt( VLCIntf, "macosx-background" ) )
[self performSelectorOnMainThread:@selector(resizeWindow) withObject:nil waitUntilDone:NO];
}
#define PLAYMODEBUTTONS_TEXT N_( "Show play mode control buttons" )
#define PLAYMODEBUTTONS_LONGTEXT N_( "Shows the shuffle and repeat buttons in the main window" )
+#define BACKGROUND_TEXT N_( "Use as desktop background" )
+#define BACKGROUND_LONGTEXT N_( "Use the video as the desktop background." )
+
vlc_module_begin ()
set_description( N_("Mac OS X interface") )
set_capability( "interface", 200 )
add_bool( "macosx-interfacestyle", false, INTERFACE_STYLE_TEXT, INTERFACE_STYLE_LONGTEXT, false )
add_bool( "macosx-nativefullscreenmode", false, NATIVE_FULLSCREEN_MODE_ON_LION_TEXT, NATIVE_FULLSCREEN_MODE_ON_LION_LONGTEXT, false )
add_obsolete_bool( "macosx-stretch" ) /* since 2.0.0 */
- add_obsolete_bool( "macosx-background" ) /* since 2.0.0 */
add_obsolete_bool( "macosx-eq-keep" ) /* since 2.0.0 */
add_obsolete_bool( "macosx-autosave-volume" ) /* since 2.1.0 */
add_bool( "macosx-video-autoresize", true, KEEPSIZE_TEXT, KEEPSIZE_LONGTEXT, false )
add_bool( "macosx-icon-change", true, ICONCHANGE_TEXT, ICONCHANGE_LONGTEXT, true )
add_bool( "macosx-show-playback-buttons", false, JUMPBUTTONS_TEXT, JUMPBUTTONS_LONGTEXT, false )
add_bool( "macosx-show-playmode-buttons", true, PLAYMODEBUTTONS_TEXT, PLAYMODEBUTTONS_LONGTEXT, false )
+ add_bool( "macosx-background", false, BACKGROUND_TEXT, BACKGROUND_LONGTEXT, false )
add_submodule ()
set_description( "Mac OS X Video Output Provider" )