Commit f3ccaec1 authored by Benjamin Pracht's avatar Benjamin Pracht

* Apply changed made to the 0.8.5 branch to trunk.

* Embedded Vout should work now
* To create an embedded vout, just create a custom view of type VLCEmbeddedVoutView in interface builder
* Just make sure you define the view as resizeable
* Hotkeys and mose events should work
* Tests with the mozilla plugin are welcome

parent 3371c10f
......@@ -34,6 +34,7 @@
OUTLETS = {"o_btn_fullscreen" = id; "o_main" = id; "o_volumeslider" = id; };
SUPERCLASS = NSObject;
},
{CLASS = VLCEmbeddedVoutView; LANGUAGE = ObjC; SUPERCLASS = VLCVoutView; },
{
ACTIONS = {
bandSliderUpdated = id;
......@@ -287,7 +288,8 @@
};
SUPERCLASS = NSObject;
},
{CLASS = VLCPlaylistView; LANGUAGE = ObjC; SUPERCLASS = NSOutlineView; }
{CLASS = VLCPlaylistView; LANGUAGE = ObjC; SUPERCLASS = NSOutlineView; },
{CLASS = VLCVoutView; LANGUAGE = ObjC; SUPERCLASS = NSView; }
);
IBVersion = 1;
}
\ No newline at end of file
}
......@@ -7,6 +7,7 @@
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
* Derk-Jan Hartman <hartman at videolan dot org>
* Benjamin Pracht <bigben at videolan doit org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -268,18 +269,31 @@
if( p_vout != NULL )
{
id o_embedded_vout_list = [[VLCMain sharedInstance] getEmbeddedList];
while ((o_window = [o_enumerator nextObject]))
{
if( [[o_window className] isEqualToString: @"VLCWindow"] )
id o_vout_view = nil;
/* We have an embedded vout */
if( [o_embedded_vout_list windowContainsEmbedded: o_window] )
{
o_vout_view = [o_embedded_vout_list getViewForWindow: o_window];
}
/* We have a detached Vout */
else if( [[o_window className] isEqualToString: @"VLCWindow"] )
{
o_vout_view = [o_window getVoutView];
}
if( o_vout_view )
{
if( [o_title isEqualToString: _NS("Half Size") ] )
[o_window scaleWindowWithFactor: 0.5];
[o_vout_view scaleWindowWithFactor: 0.5];
else if( [o_title isEqualToString: _NS("Normal Size") ] )
[o_window scaleWindowWithFactor: 1.0];
[o_vout_view scaleWindowWithFactor: 1.0];
else if( [o_title isEqualToString: _NS("Double Size") ] )
[o_window scaleWindowWithFactor: 2.0];
[o_vout_view scaleWindowWithFactor: 2.0];
else if( [o_title isEqualToString: _NS("Float on Top") ] )
[o_window toggleFloatOnTop];
[o_vout_view toggleFloatOnTop];
else if( [o_title isEqualToString: _NS("Fit to Screen") ] )
{
if( ![o_window isZoomed] )
......@@ -287,11 +301,11 @@
}
else if( [o_title isEqualToString: _NS("Snapshot") ] )
{
[o_window snapshot];
[o_vout_view snapshot];
}
else
{
[o_window toggleFullscreen];
[o_vout_view toggleFullscreen];
}
break;
}
......@@ -470,7 +484,7 @@
Value: another_val ofType: i_type];
[o_lmi setRepresentedObject: [NSValue valueWithPointer:[o_data retain]]];
[o_lmi setTarget: self];
if( !strcmp( val.psz_string, val_list.p_list->p_values[i].psz_string ) && !( i_type & VLC_VAR_ISCOMMAND ) )
[o_lmi setState: TRUE ];
......@@ -497,7 +511,7 @@
break;
}
}
/* clean up everything */
if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string );
var_Change( p_object, psz_variable, VLC_VAR_FREELIST, &val_list, &text_list );
......@@ -640,7 +654,9 @@
while( (o_window = [o_enumerator nextObject]))
{
if( [[o_window className] isEqualToString: @"VLCWindow"] )
if( [[o_window className] isEqualToString: @"VLCWindow"] ||
[[[VLCMain sharedInstance] getEmbeddedList]
windowContainsEmbedded: o_window])
{
bEnabled = TRUE;
break;
......
......@@ -79,6 +79,7 @@ struct intf_sys_t
/* The messages window */
msg_subscription_t * p_sub;
};
/*****************************************************************************
......@@ -93,6 +94,7 @@ struct intf_sys_t
id o_wizard; /* VLCWizard */
id o_extended; /* VLCExtended */
id o_bookmarks; /* VLCBookmarks */
id o_embedded_list; /* VLCEmbeddedList*/
id o_sfilters; /* VLCsFilters */
/*id o_update; VLCUpdate */
BOOL nib_main_loaded; /* reference to the main-nib */
......@@ -278,6 +280,7 @@ struct intf_sys_t
- (id)getInfo;
- (id)getWizard;
- (id)getBookmarks;
- (id)getEmbeddedList;
- (void)terminate;
- (NSString *)localizedString:(char *)psz;
- (char *)delocalizeString:(NSString *)psz;
......
......@@ -304,6 +304,7 @@ static VLCMain *_o_sharedMainInstance = nil;
o_wizard = [[VLCWizard alloc] init];
o_extended = nil;
o_bookmarks = [[VLCBookmarks alloc] init];
o_embedded_list = [[VLCEmbeddedList alloc] init];
o_sfilters = nil;
/*o_update = [[VLCUpdate alloc] init];*/
......@@ -804,6 +805,15 @@ static VLCMain *_o_sharedMainInstance = nil;
return nil;
}
- (id)getEmbeddedList
{
if( o_embedded_list )
{
return o_embedded_list;
}
return nil;
}
- (void)manage
{
playlist_t * p_playlist;
......
......@@ -8,6 +8,7 @@
* Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
* Eric Petit <titer@m0k.org>
* Benjamin Pracht <bigben at videolan dot org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -25,35 +26,99 @@
*****************************************************************************/
/*****************************************************************************
* VLCWindow interface
* VLCEmbeddedList interface
*****************************************************************************/
@interface VLCWindow : NSWindow
@interface VLCEmbeddedList : NSObject
{
NSMutableArray * o_embedded_array;
}
- (id)getEmbeddedVout;
- (void)releaseEmbeddedVout: (id)o_vout_view;
- (void)addEmbeddedVout: (id)o_vout_view;
- (BOOL)windowContainsEmbedded: (id)o_window;
- (id)getViewForWindow: (id)o_window;
@end
/*****************************************************************************
* VLCVoutView interface
*****************************************************************************/
@interface VLCVoutView : NSView
{
vout_thread_t * p_vout;
NSView * o_view;
NSRect * s_frame;
vout_thread_t * p_real_vout;
Ptr p_fullscreen_state;
mtime_t i_time_mouse_last_moved;
vlc_bool_t b_init_ok;
id o_window;
}
- (id) initWithVout: (vout_thread_t *) p_vout view: (NSView *) view
frame: (NSRect *) s_frame;
- (id) initReal: (id) sender;
- (void) close;
- (id) closeReal: (id) sender;
- (void)setOnTop:(BOOL)b_on_top;
- (void)hideMouse:(BOOL)b_hide;
- (BOOL)setVout: (vout_thread_t *) p_arg_vout subView: (NSView *) view
frame: (NSRect *) s_arg_frame;
- (void)closeVout;
- (void)manage;
- (void)scaleWindowWithFactor: (float)factor;
- (void)setOnTop:(BOOL)b_on_top;
- (void)toggleFloatOnTop;
- (void)toggleFullscreen;
- (BOOL)isFullscreen;
- (void)snapshot;
- (id)getWindow;
+ (id)getVoutView: (vout_thread_t *)p_vout subView: (NSView *) view
frame: (NSRect *) s_frame;
+ (vout_thread_t *)getRealVout: (vout_thread_t *)p_vout;
@end
/*****************************************************************************
* VLCVoutDetachedView interface
*****************************************************************************/
@interface VLCDetachedVoutView : VLCVoutView
{
mtime_t i_time_mouse_last_moved;
}
- (void)hideMouse: (BOOL)b_hide;
@end
/*****************************************************************************
* VLCEmbeddedView interface
*****************************************************************************/
@interface VLCEmbeddedVoutView : VLCVoutView
{
BOOL b_used;
}
- (void)setUsed: (BOOL)b_new_used;
- (BOOL)isUsed;
@end
/*****************************************************************************
* VLCWindow interface
*****************************************************************************/
@interface VLCWindow : NSWindow
{
vout_thread_t * p_vout;
VLCVoutView * o_view;
NSRect * s_frame;
vout_thread_t * p_real_vout;
Ptr p_fullscreen_state;
vlc_bool_t b_init_ok;
}
- (id) initWithVout: (vout_thread_t *) p_vout view: (VLCVoutView *) view
frame: (NSRect *) s_frame;
- (id)initReal: (id) sender;
- (void)close;
- (void)closeWindow;
- (id)closeReal: (id) sender;
- (id)getVoutView;
- (void)updateTitle;
- (BOOL)windowShouldClose:(id)sender;
......
......@@ -9,12 +9,13 @@
* Jon Lech Johansen <jon-vl@nanocrew.net>
* Derk-Jan Hartman <hartman at videolan dot org>
* Eric Petit <titer@m0k.org>
* Benjamin Pracht <bigben at videolan dot org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -49,11 +50,11 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
{
vlc_value_t val;
vout_thread_t *p_vout = (vout_thread_t *)p_this;
msg_Dbg( p_vout, "set %d", new_val.i_int );
var_Create( p_vout->p_vlc, "video-device", VLC_VAR_INTEGER );
var_Set( p_vout->p_vlc, "video-device", new_val );
val.b_bool = VLC_TRUE;
var_Set( p_vout, "intf-change", val );
return VLC_SUCCESS;
......@@ -61,90 +62,110 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
/*****************************************************************************
* VLCWindow implementation
* VLCEmbeddedList implementation
*****************************************************************************/
@implementation VLCWindow
@implementation VLCEmbeddedList
- (id) initWithVout: (vout_thread_t *) vout view: (NSView *) view
frame: (NSRect *) frame
- (id)init
{
p_vout = vout;
o_view = view;
s_frame = frame;
[self performSelectorOnMainThread: @selector(initReal:)
withObject: NULL waitUntilDone: YES];
if( !b_init_ok )
{
return NULL;
}
[super init];
o_embedded_array = [NSMutableArray array];
return self;
}
- (id) initReal: (id) sender
- (id)getEmbeddedVout
{
NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
NSArray *o_screens = [NSScreen screens];
NSScreen *o_screen;
vlc_bool_t b_menubar_screen = VLC_FALSE;
int i_timeout, i_device;
vlc_value_t value_drawable;
b_init_ok = VLC_FALSE;
var_Get( p_vout->p_vlc, "drawable", &value_drawable );
unsigned int i;
/* We only wait for NSApp to initialise if we're not embedded (as in the
* case of the Mozilla plugin). We can tell whether we're embedded or not
* by examining the "drawable" value: if it's zero, we're running in the
* main Mac intf; if it's non-zero, we're embedded. */
if( value_drawable.i_int == 0 )
for( i = 0; i < [o_embedded_array count]; i++ )
{
/* Wait for a MacOS X interface to appear. Timeout is 2 seconds. */
for( i_timeout = 20 ; i_timeout-- ; )
id o_vout_view = [o_embedded_array objectAtIndex: i];
if( ![o_vout_view isUsed] )
{
if( NSApp == NULL )
{
msleep( INTF_IDLE_SLEEP );
}
[o_vout_view setUsed: YES];
return o_vout_view;
}
}
return nil;
}
if( NSApp == NULL )
{
/* No MacOS X intf, unable to communicate with MT */
msg_Err( p_vout, "no MacOS X interface present" );
return NULL;
}
- (void)releaseEmbeddedVout: (id)o_vout_view
{
if( [o_embedded_array containsObject: o_vout_view] )
{
[o_vout_view setUsed: NO];
}
if( [o_screens count] <= 0 )
else
{
msg_Err( p_vout, "no OSX screens available" );
return NULL;
msg_Warn( VLCIntf, "Cannot find Video Output");
}
}
/* p_real_vout: the vout we have to use to check for video-on-top
and a few other things. If we are the QuickTime output, it's us.
It we are the OpenGL provider, it is our parent. */
if( p_vout->i_object_type == VLC_OBJECT_OPENGL )
- (void)addEmbeddedVout: (id)o_vout_view
{
if( ![o_embedded_array containsObject: o_vout_view] )
{
p_real_vout = (vout_thread_t *) p_vout->p_parent;
[o_embedded_array addObject: o_vout_view];
}
else
}
- (BOOL)windowContainsEmbedded: (id)o_window
{
return ([self getViewForWindow: o_window] == nil ? NO : YES);
}
- (id)getViewForWindow: (id)o_window
{
id o_enumerator = [o_embedded_array objectEnumerator];
id o_current_embedded;
while( (o_current_embedded = [o_enumerator nextObject]) )
{
p_real_vout = p_vout;
if( [o_current_embedded getWindow] == o_window )
{
return o_current_embedded;
}
}
return nil;
}
p_fullscreen_state = NULL;
i_time_mouse_last_moved = mdate();
@end
var_Create( p_vout, "macosx-vdev", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_vout, "macosx-fill", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_vout, "macosx-stretch", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_vout, "macosx-opaqueness", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT );
var_Create( p_vout, "macosx-background", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
/*****************************************************************************
* VLCVoutView implementation
*****************************************************************************/
@implementation VLCVoutView
- (id)initWithFrame:(NSRect)frameRect
{
[super initWithFrame: frameRect];
p_vout = NULL;
o_view = nil;
s_frame = &frameRect;
p_real_vout = NULL;
o_window = nil;
return self;
}
- (BOOL)setVout: (vout_thread_t *) vout subView: (NSView *) view
frame: (NSRect *) frame
{
int i_device;
NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
NSArray *o_screens = [NSScreen screens];
p_vout = vout;
o_view = view;
s_frame = frame;
if( [o_screens count] <= 0 )
{
msg_Err( p_vout, "no OSX screens available" );
return NO;
}
p_real_vout = [VLCVoutView getRealVout: p_vout];
/* Get the pref value when this is the first time, otherwise retrieve the device from the top level video-device var */
if( var_Type( p_real_vout->p_vlc, "video-device" ) == 0 )
......@@ -203,172 +224,40 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
var_Set( p_real_vout, "intf-change", val2 );
}
/* Find out on which screen to open the window */
if( i_device <= 0 || i_device > (int)[o_screens count] )
{
/* No preference specified. Use the main screen */
o_screen = [NSScreen mainScreen];
if( o_screen == [o_screens objectAtIndex: 0] )
b_menubar_screen = VLC_TRUE;
}
else
{
i_device--;
o_screen = [o_screens objectAtIndex: i_device];
b_menubar_screen = ( i_device == 0 );
}
if( p_vout->b_fullscreen )
{
NSRect screen_rect = [o_screen frame];
screen_rect.origin.x = screen_rect.origin.y = 0;
/* Creates a window with size: screen_rect on o_screen */
[self initWithContentRect: screen_rect
styleMask: NSBorderlessWindowMask
backing: NSBackingStoreBuffered
defer: YES screen: o_screen];
if( b_menubar_screen )
{
BeginFullScreen( &p_fullscreen_state, NULL, 0, 0,
NULL, NULL, fullScreenAllowEvents );
}
}
else if( var_GetBool( p_real_vout, "macosx-background" ) )
{
NSRect screen_rect = [o_screen frame];
screen_rect.origin.x = screen_rect.origin.y = 0;
/* Creates a window with size: screen_rect on o_screen */
[self initWithContentRect: screen_rect
styleMask: NSBorderlessWindowMask
backing: NSBackingStoreBuffered
defer: YES screen: o_screen];
[self setLevel: CGWindowLevelForKey(kCGDesktopWindowLevelKey)];
}
else
{
unsigned int i_stylemask = NSTitledWindowMask |
NSMiniaturizableWindowMask |
NSClosableWindowMask |
NSResizableWindowMask;
NSRect s_rect;
if( !s_frame )
{
s_rect.size.width = p_vout->i_window_width;
s_rect.size.height = p_vout->i_window_height;
}
else
{
s_rect = *s_frame;
}
[self initWithContentRect: s_rect
styleMask: i_stylemask
backing: NSBackingStoreBuffered
defer: YES screen: o_screen];
[self setAlphaValue: var_GetFloat( p_vout, "macosx-opaqueness" )];
if( var_GetBool( p_real_vout, "video-on-top" ) )
{
[self setLevel: NSStatusWindowLevel];
}
if( !s_frame )
{
[self center];
}
}
[self updateTitle];
[self makeKeyAndOrderFront: nil];
[self setReleasedWhenClosed: YES];
/* We'll catch mouse events */
[self setAcceptsMouseMovedEvents: YES];
[self makeFirstResponder: self];
/* Add the view. It's automatically resized to fit the window */
[self setContentView: o_view];
[self addSubview: o_view];
[self setAutoresizesSubviews: YES];
[o_pool release];
b_init_ok = VLC_TRUE;
return self;
return YES;
}
- (void) close
- (void)resizeSubviewsWithOldSize:(NSSize)oldBoundsSize
{
/* XXX waitUntilDone = NO to avoid a possible deadlock when hitting
Command-Q */
[self setAcceptsMouseMovedEvents: NO];
[self setContentView: NULL];
[self performSelectorOnMainThread: @selector(closeReal:)
withObject: NULL waitUntilDone: NO];
[super resizeSubviewsWithOldSize: oldBoundsSize];
[o_view setFrameSize: [self frame].size];
}
- (id) closeReal: (id) sender
- (void)closeVout
{
[super close];
if( p_fullscreen_state )
{
EndFullScreen( p_fullscreen_state, 0 );
}
return NULL;
[o_view removeFromSuperview];
o_view = nil;
p_vout = NULL;
s_frame = nil;
o_window = nil;
p_real_vout = NULL;
}
- (void)setOnTop:(BOOL)b_on_top
{
if( b_on_top )
{
[self setLevel: NSStatusWindowLevel];
}
else
{
[self setLevel: NSNormalWindowLevel];
}
}
- (void)hideMouse:(BOOL)b_hide
{
BOOL b_inside;
NSPoint ml;
NSView *o_contents = [self contentView];
ml = [self convertScreenToBase:[NSEvent mouseLocation]];
ml = [o_contents convertPoint:ml fromView:nil];
b_inside = [o_contents mouse: ml inRect: [o_contents bounds]];
if( b_hide && b_inside )
{
[NSCursor setHiddenUntilMouseMoves: YES];
}
else if( !b_hide )
{
[NSCursor setHiddenUntilMouseMoves: NO];
}
}
- (void)manage
{
if( p_fullscreen_state )
{
if( mdate() - i_time_mouse_last_moved > 3000000 )
{
[self hideMouse: YES];
}
[o_window setLevel: NSStatusWindowLevel];
}
else
{
[self hideMouse: NO];
[o_window setLevel: NSNormalWindowLevel];
}
/* Disable screensaver */
UpdateSystemActivity( UsrActivity );
}
- (void)scaleWindowWithFactor: (float)factor
......@@ -377,14 +266,15 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
int i_corrected_height, i_corrected_width;
NSPoint topleftbase;
NSPoint topleftscreen;
if ( !p_vout->b_fullscreen )
{
NSRect new_frame;
topleftbase.x = 0;
topleftbase.y = [self frame].size.height;
topleftscreen = [self convertBaseToScreen: topleftbase];
if( p_vout->render.i_height * p_vout->render.i_aspect >
topleftbase.y = [o_window frame].size.height;
topleftscreen = [o_window convertBaseToScreen: topleftbase];
if( p_vout->render.i_height * p_vout->render.i_aspect >
p_vout->render.i_width * VOUT_ASPECT_FACTOR )
{
i_corrected_width = p_vout->render.i_height * p_vout->render.i_aspect /
......@@ -399,10 +289,18 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
newsize.width = (int) ( p_vout->render.i_width * factor );
newsize.height = (int) ( i_corrected_height * factor );
}
[self setContentSize: newsize];
[self setFrameTopLeftPoint: topleftscreen];
/* Calculate the window's new size */
new_frame.size.width = [o_window frame].size.width -
[self frame].size.width + newsize.width;
new_frame.size.height = [o_window frame].size.height -
[self frame].size.height + newsize.height;
new_frame.origin.x = topleftscreen.x;
new_frame.origin.y = topleftscreen.y - new_frame.size.height;
[o_window setFrame: new_frame display: YES];
p_vout->i_changes |= VOUT_SIZE_CHANGE;
}
}
......@@ -442,16 +340,16 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
vout_Control( p_real_vout, VOUT_SNAPSHOT );
}
- (BOOL)canBecomeKeyWindow
- (void)manage
{
return YES;
/* Disable Screensaver */
UpdateSystemActivity( UsrActivity );
}
/* Sometimes crashes VLC....
- (BOOL)performKeyEquivalent:(NSEvent *)o_event
- (id)getWindow
{
return [[VLCMain sharedInstance] hasDefinedShortcutKey:o_event];
}*/
return o_window;
}
- (void)keyDown:(NSEvent *)o_event
{
......@@ -459,7 +357,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
vlc_value_t val;
unsigned int i_pressed_modifiers = 0;
val.i_int = 0;
i_pressed_modifiers = [o_event modifierFlags];
if( i_pressed_modifiers & NSShiftKeyMask )
......@@ -501,65 +399,205 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
}
}
- (void)updateTitle
- (void)mouseDown:(NSEvent *)o_event
{
NSMutableString * o_title = NULL, * o_mrl = NULL;
input_thread_t * p_input;
if( p_vout == NULL )
vlc_value_t val;
if( p_vout )
{
return;
switch( [o_event type] )
{
case NSLeftMouseDown:
{
var_Get( p_vout, "mouse-button-down", &val );
val.i_int |= 1;
var_Set( p_vout, "mouse-button-down", val );
}
break;
default:
[super mouseDown: o_event];
break;
}
}
p_input = vlc_object_find( p_vout, VLC_OBJECT_INPUT, FIND_PARENT );
if( p_input == NULL )
}
- (void)otherMouseDown:(NSEvent *)o_event
{
vlc_value_t val;
if( p_vout )
{
return;
switch( [o_event type] )
{
case NSOtherMouseDown:
{
var_Get( p_vout, "mouse-button-down", &val );
val.i_int |= 2;
var_Set( p_vout, "mouse-button-down", val );
}
break;
default:
[super mouseDown: o_event];
break;
}
}
}
if( p_input->input.p_item->psz_name != NULL )
o_title = [NSMutableString stringWithUTF8String:
p_input->input.p_item->psz_name];
if( p_input->input.p_item->psz_uri != NULL )
o_mrl = [NSMutableString stringWithUTF8String:
p_input->input.p_item->psz_uri];
if( o_title == nil )
o_title = o_mrl;
- (void)rightMouseDown:(NSEvent *)o_event
{
vlc_value_t val;
if( o_mrl != nil )
if( p_vout )
{
if( p_input->input.p_access && !strcmp( p_input->input.p_access->p_module->psz_shortname, "File" ) )
switch( [o_event type] )
{
NSRange prefix_range = [o_mrl rangeOfString: @"file:"];
if( prefix_range.location != NSNotFound )
[o_mrl deleteCharactersInRange: prefix_range];
[self setRepresentedFilename: o_mrl];
case NSRightMouseDown:
{
var_Get( p_vout, "mouse-button-down", &val );
val.i_int |= 4;
var_Set( p_vout, "mouse-button-down", val );
}
break;
default:
[super mouseDown: o_event];
break;
}
[self setTitle: o_title];
}
else
}
- (void)mouseUp:(NSEvent *)o_event
{
vlc_value_t val;
if( p_vout )
{
[self setTitle: [NSString stringWithCString: VOUT_TITLE]];
switch( [o_event type] )
{
case NSLeftMouseUp:
{
vlc_value_t b_val;
b_val.b_bool = VLC_TRUE;
var_Set( p_vout, "mouse-clicked", b_val );
var_Get( p_vout, "mouse-button-down", &val );
val.i_int &= ~1;
var_Set( p_vout, "mouse-button-down", val );
}
break;
default:
[super mouseUp: o_event];
break;
}
}
vlc_object_release( p_input );
}
/* This is actually the same as VLCControls::stop. */
- (BOOL)windowShouldClose:(id)sender
- (void)otherMouseUp:(NSEvent *)o_event
{
playlist_t * p_playlist = vlc_object_find( p_vout, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
vlc_value_t val;
if( p_vout )
{
return NO;
switch( [o_event type] )
{
case NSOtherMouseUp:
{
var_Get( p_vout, "mouse-button-down", &val );
val.i_int &= ~2;
var_Set( p_vout, "mouse-button-down", val );
}
break;
default:
[super mouseUp: o_event];
break;
}
}
}
playlist_Stop( p_playlist );
vlc_object_release( p_playlist );
- (void)rightMouseUp:(NSEvent *)o_event
{
vlc_value_t val;
/* The window will be closed by the intf later. */
return NO;
if( p_vout )
{
switch( [o_event type] )
{
case NSRightMouseUp:
{
var_Get( p_vout, "mouse-button-down", &val );
val.i_int &= ~4;
var_Set( p_vout, "mouse-button-down", val );
}
break;
default:
[super mouseUp: o_event];
break;
}
}
}
- (void)mouseDragged:(NSEvent *)o_event
{
[self mouseMoved: o_event];
}
- (void)otherMouseDragged:(NSEvent *)o_event
{
[self mouseMoved: o_event];
}
- (void)rightMouseDragged:(NSEvent *)o_event
{
[self mouseMoved: o_event];
}
- (void)mouseMoved:(NSEvent *)o_event
{
NSPoint ml;
NSRect s_rect;
BOOL b_inside;
if( p_vout )
{
s_rect = [o_view bounds];
ml = [o_view convertPoint: [o_event locationInWindow] fromView: nil];
b_inside = [o_view mouse: ml inRect: s_rect];
if( b_inside )
{
vlc_value_t val;
unsigned int i_width, i_height, i_x, i_y;
vout_PlacePicture( p_vout, (unsigned int)s_rect.size.width,
(unsigned int)s_rect.size.height,
&i_x, &i_y, &i_width, &i_height );
val.i_int = ( ((int)ml.x) - i_x ) *
p_vout->render.i_width / i_width;
var_Set( p_vout, "mouse-x", val );
if( [[o_view className] isEqualToString: @"VLCGLView"] )
{
val.i_int = ( ((int)(s_rect.size.height - ml.y)) - i_y ) *
p_vout->render.i_height / i_height;
}
else
{
val.i_int = ( ((int)ml.y) - i_y ) *
p_vout->render.i_height / i_height;
}
var_Set( p_vout, "mouse-y", val );
val.b_bool = VLC_TRUE;
var_Set( p_vout, "mouse-moved", val );
}
}
[super mouseMoved: o_event];
}
- (BOOL)acceptsFirstResponder
......@@ -579,187 +617,449 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
return NO;
}
- (void)mouseDown:(NSEvent *)o_event
{
vlc_value_t val;
/* Class methods used by the different vout modules */
switch( [o_event type] )
+ (vout_thread_t *)getRealVout: (vout_thread_t *)p_vout
{
/* p_real_vout: the vout we have to use to check for video-on-top
and a few other things. If we are the QuickTime output, it's us.
It we are the OpenGL provider, it is our parent. */
if( p_vout->i_object_type == VLC_OBJECT_OPENGL )
{
case NSLeftMouseDown:
{
var_Get( p_vout, "mouse-button-down", &val );
val.i_int |= 1;
var_Set( p_vout, "mouse-button-down", val );
}
break;
default:
[super mouseDown: o_event];
break;
return (vout_thread_t *) p_vout->p_parent;
}
else
{
return p_vout;
}
}
- (void)otherMouseDown:(NSEvent *)o_event
+ (id)getVoutView: (vout_thread_t *)p_vout subView: (NSView *)view
frame: (NSRect *)s_frame
{
vlc_value_t val;
vlc_value_t value_drawable;
int i_timeout;
id o_return = nil;
vout_thread_t * p_real_vout = [VLCVoutView getRealVout: p_vout];
var_Get( p_vout->p_vlc, "drawable", &value_drawable );
var_Create( p_vout, "macosx-vdev", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_vout, "macosx-fill", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_vout, "macosx-stretch", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_vout, "macosx-opaqueness", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT );
var_Create( p_vout, "macosx-background", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
switch( [o_event type] )
/* We only wait for NSApp to initialise if we're not embedded (as in the
* case of the Mozilla plugin). We can tell whether we're embedded or not
* by examining the "drawable" value: if it's zero, we're running in the
* main Mac intf; if it's non-zero, we're embedded. */
if( value_drawable.i_int == 0 )
{
case NSOtherMouseDown:
/* Wait for a MacOS X interface to appear. Timeout is 2 seconds. */
for( i_timeout = 20 ; i_timeout-- ; )
{
var_Get( p_vout, "mouse-button-down", &val );
val.i_int |= 2;
var_Set( p_vout, "mouse-button-down", val );
if( NSApp == NULL )
{
msleep( INTF_IDLE_SLEEP );
}
}
if( NSApp == NULL )
{
/* No MacOS X intf, unable to communicate with MT */
msg_Err( p_vout, "no MacOS X interface present" );
return nil;
}
break;
else
{
if ( VLCIntf && !(p_vout->b_fullscreen) &&
!(var_GetBool( p_real_vout, "macosx-background" )) )
{
o_return = [[[VLCMain sharedInstance] getEmbeddedList]
getEmbeddedVout];
}
}
}
default:
[super mouseDown: o_event];
break;
/* No embedded vout is available */
if( o_return == nil )
{
NSRect null_rect;
bzero( &null_rect, sizeof( NSRect ) );
o_return = [[VLCDetachedVoutView alloc] initWithFrame: null_rect ];
}
[o_return setVout: p_vout subView: view frame: s_frame];
return o_return;
}
- (void)rightMouseDown:(NSEvent *)o_event
@end
/*****************************************************************************
* VLCDetachedVoutView implementation
*****************************************************************************/
@implementation VLCDetachedVoutView
- (id)initWithFrame: (NSRect)frameRect
{
vlc_value_t val;
[super initWithFrame: frameRect];
i_time_mouse_last_moved = 0;
return self;
}
switch( [o_event type] )
- (bool)setVout: (vout_thread_t *) p_arg_vout subView: (NSView *) view
frame: (NSRect *) s_arg_frame
{
BOOL b_return = [super setVout: p_arg_vout subView: view frame:s_arg_frame];
i_time_mouse_last_moved = mdate();
o_window = [[VLCWindow alloc] initWithVout: p_arg_vout view: self
frame: s_arg_frame];
[view setFrame: [self frame]];
[o_window setAcceptsMouseMovedEvents: TRUE];
return b_return;
}
- (void)closeVout
{
[o_window closeWindow];
[o_window setAcceptsMouseMovedEvents: NO];
i_time_mouse_last_moved = 0;
[super closeVout];
}
- (void)mouseMoved:(NSEvent *)o_event
{
i_time_mouse_last_moved = mdate();
[super mouseMoved: o_event];
}
- (void)hideMouse:(BOOL)b_hide
{
BOOL b_inside;
NSPoint ml;
NSView *o_contents = [o_window contentView];
ml = [o_window convertScreenToBase:[NSEvent mouseLocation]];
ml = [o_contents convertPoint:ml fromView:nil];
b_inside = [o_contents mouse: ml inRect: [o_contents bounds]];
if( b_hide && b_inside )
{
[NSCursor setHiddenUntilMouseMoves: YES];
}
else if( !b_hide )
{
[NSCursor setHiddenUntilMouseMoves: NO];
}
}
- (void)manage
{
[super manage];
if( p_vout->b_fullscreen )
{
case NSRightMouseDown:
if( mdate() - i_time_mouse_last_moved > 3000000 )
{
var_Get( p_vout, "mouse-button-down", &val );
val.i_int |= 4;
var_Set( p_vout, "mouse-button-down", val );
[self hideMouse: YES];
}
break;
default:
[super mouseDown: o_event];
break;
}
else
{
[self hideMouse: NO];
}
}
- (void)mouseUp:(NSEvent *)o_event
@end
/*****************************************************************************
* VLCEmbeddedVoutView implementation
*****************************************************************************/
@implementation VLCEmbeddedVoutView
- (id)initWithFrame: (NSRect)frameRect
{
vlc_value_t val;
[super initWithFrame: frameRect];
b_used = NO;
[[[VLCMain sharedInstance] getEmbeddedList] addEmbeddedVout: self];
return self;
}
- (BOOL)setVout: (vout_thread_t *) p_arg_vout subView: (NSView *) view
frame: (NSRect *) s_arg_frame
switch( [o_event type] )
{
BOOL b_return;
b_return = [super setVout: p_arg_vout subView: view frame: s_arg_frame];
if( b_return )
{
case NSLeftMouseUp:
{
vlc_value_t b_val;
b_val.b_bool = VLC_TRUE;
var_Set( p_vout, "mouse-clicked", b_val );
o_window = [self window];
[o_window makeKeyAndOrderFront: self];
[o_window setAcceptsMouseMovedEvents: TRUE];
[view setFrameSize: [self frame].size];
}
return b_return;
}
var_Get( p_vout, "mouse-button-down", &val );
val.i_int &= ~1;
var_Set( p_vout, "mouse-button-down", val );
}
break;
- (void)setUsed: (BOOL)b_new_used
{
b_used = b_new_used;
}
- (BOOL)isUsed
{
return b_used;
}
- (void)closeVout
{
[super closeVout];
[o_window setAcceptsMouseMovedEvents: NO];
[[[VLCMain sharedInstance] getEmbeddedList] releaseEmbeddedVout: self];
}
@end
/*****************************************************************************
* VLCWindow implementation
*****************************************************************************/
@implementation VLCWindow
- (id) initWithVout: (vout_thread_t *) vout view: (VLCVoutView *) view
frame: (NSRect *) frame
{
p_vout = vout;
o_view = view;
s_frame = frame;
[self performSelectorOnMainThread: @selector(initReal:)
withObject: NULL waitUntilDone: YES];
default:
[super mouseUp: o_event];
break;
if( !b_init_ok )
{
return NULL;
}
return self;
}
- (void)otherMouseUp:(NSEvent *)o_event
- (id) initReal: (id) sender
{
vlc_value_t val;
NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
NSArray *o_screens = [NSScreen screens];
NSScreen *o_screen;
vlc_bool_t b_menubar_screen = VLC_FALSE;
int i_device;
b_init_ok = VLC_FALSE;
p_fullscreen_state = NULL;
switch( [o_event type] )
p_real_vout = [VLCVoutView getRealVout: p_vout];
i_device = var_GetInteger( p_real_vout->p_vlc, "video-device" );
/* Find out on which screen to open the window */
if( i_device <= 0 || i_device > (int)[o_screens count] )
{
case NSOtherMouseUp:
/* No preference specified. Use the main screen */
o_screen = [NSScreen mainScreen];
if( o_screen == [o_screens objectAtIndex: 0] )
b_menubar_screen = VLC_TRUE;
}
else
{
i_device--;
o_screen = [o_screens objectAtIndex: i_device];
b_menubar_screen = ( i_device == 0 );
}
if( p_vout->b_fullscreen )
{
NSRect screen_rect = [o_screen frame];
screen_rect.origin.x = screen_rect.origin.y = 0;
/* Creates a window with size: screen_rect on o_screen */
[self initWithContentRect: screen_rect
styleMask: NSBorderlessWindowMask
backing: NSBackingStoreBuffered
defer: YES screen: o_screen];
if( b_menubar_screen )
{
var_Get( p_vout, "mouse-button-down", &val );
val.i_int &= ~2;
var_Set( p_vout, "mouse-button-down", val );
BeginFullScreen( &p_fullscreen_state, NULL, 0, 0,
NULL, NULL, fullScreenAllowEvents );
}
break;
default:
[super mouseUp: o_event];
break;
}
}
else if( var_GetBool( p_real_vout, "macosx-background" ) )
{
NSRect screen_rect = [o_screen frame];
screen_rect.origin.x = screen_rect.origin.y = 0;
- (void)rightMouseUp:(NSEvent *)o_event
{
vlc_value_t val;
/* Creates a window with size: screen_rect on o_screen */
[self initWithContentRect: screen_rect
styleMask: NSBorderlessWindowMask
backing: NSBackingStoreBuffered
defer: YES screen: o_screen];
switch( [o_event type] )
[self setLevel: CGWindowLevelForKey(kCGDesktopWindowLevelKey)];
}
else
{
case NSRightMouseUp:
unsigned int i_stylemask = NSTitledWindowMask |
NSMiniaturizableWindowMask |
NSClosableWindowMask |
NSResizableWindowMask;
NSRect s_rect;
if( !s_frame )
{
s_rect.size.width = p_vout->i_window_width;
s_rect.size.height = p_vout->i_window_height;
}
else
{
s_rect = *s_frame;
}
[self initWithContentRect: s_rect
styleMask: i_stylemask
backing: NSBackingStoreBuffered
defer: YES screen: o_screen];
[self setAlphaValue: var_GetFloat( p_vout, "macosx-opaqueness" )];
if( var_GetBool( p_real_vout, "video-on-top" ) )
{
var_Get( p_vout, "mouse-button-down", &val );
val.i_int &= ~4;
var_Set( p_vout, "mouse-button-down", val );
[self setLevel: NSStatusWindowLevel];
}
break;
default:
[super mouseUp: o_event];
break;
if( !s_frame )
{
[self center];
}
}
[self updateTitle];
[self makeKeyAndOrderFront: nil];
[self setReleasedWhenClosed: YES];
/* We'll catch mouse events */
[self makeFirstResponder: o_view];
/* Add the view. It's automatically resized to fit the window */
[self setContentView: o_view];
[o_pool release];
b_init_ok = VLC_TRUE;
return self;
}
- (void)mouseDragged:(NSEvent *)o_event
- (void)close
{
[self mouseMoved: o_event];
[o_view closeVout];
}
- (void)otherMouseDragged:(NSEvent *)o_event
- (void) closeWindow
{
[self mouseMoved: o_event];
/* XXX waitUntilDone = NO to avoid a possible deadlock when hitting
Command-Q */
[self setContentView: NULL];
[self performSelectorOnMainThread: @selector(closeReal:)
withObject: NULL waitUntilDone: NO];
}
- (void)rightMouseDragged:(NSEvent *)o_event
- (id) closeReal: (id) sender
{
[self mouseMoved: o_event];
[super close];
if( p_fullscreen_state )
{
EndFullScreen( p_fullscreen_state, 0 );
}
return NULL;
}
- (void)mouseMoved:(NSEvent *)o_event
{
NSPoint ml;
NSRect s_rect;
BOOL b_inside;
- (id)getVoutView
{
return o_view;
}
i_time_mouse_last_moved = mdate();
- (BOOL)canBecomeKeyWindow
{
return YES;
}
s_rect = [o_view bounds];
ml = [o_view convertPoint: [o_event locationInWindow] fromView: nil];
b_inside = [o_view mouse: ml inRect: s_rect];
/* Sometimes crashes VLC....
- (BOOL)performKeyEquivalent:(NSEvent *)o_event
{
return [[VLCMain sharedInstance] hasDefinedShortcutKey:o_event];
}*/
/* This is actually the same as VLCControls::stop. */
- (void)updateTitle /*not modified yey ! */
{
NSMutableString * o_title = NULL, * o_mrl = NULL;
input_thread_t * p_input;
if( b_inside )
if( p_vout == NULL )
{
vlc_value_t val;
unsigned int i_width, i_height, i_x, i_y;
return;
}
vout_PlacePicture( p_vout, (unsigned int)s_rect.size.width,
(unsigned int)s_rect.size.height,
&i_x, &i_y, &i_width, &i_height );
p_input = vlc_object_find( p_vout, VLC_OBJECT_INPUT, FIND_PARENT );
val.i_int = ( ((int)ml.x) - i_x ) *
p_vout->render.i_width / i_width;
var_Set( p_vout, "mouse-x", val );
if( p_input == NULL )
{
return;
}
if( [[o_view className] isEqualToString: @"VLCGLView"] )
{
val.i_int = ( ((int)(s_rect.size.height - ml.y)) - i_y ) *
p_vout->render.i_height / i_height;
}
else
if( p_input->input.p_item->psz_name != NULL )
o_title = [NSMutableString stringWithUTF8String:
p_input->input.p_item->psz_name];
if( p_input->input.p_item->psz_uri != NULL )
o_mrl = [NSMutableString stringWithUTF8String:
p_input->input.p_item->psz_uri];
if( o_title == nil )
o_title = o_mrl;
if( o_mrl != nil )
{
if( p_input->input.p_access && !strcmp( p_input->input.p_access->p_module->psz_shortname, "File" ) )
{
val.i_int = ( ((int)ml.y) - i_y ) *
p_vout->render.i_height / i_height;
NSRange prefix_range = [o_mrl rangeOfString: @"file:"];
if( prefix_range.location != NSNotFound )
[o_mrl deleteCharactersInRange: prefix_range];
[self setRepresentedFilename: o_mrl];
}
var_Set( p_vout, "mouse-y", val );
val.b_bool = VLC_TRUE;
var_Set( p_vout, "mouse-moved", val );
[self setTitle: o_title];
}
else
{
[self setTitle: [NSString stringWithCString: VOUT_TITLE]];
}
vlc_object_release( p_input );
}
[super mouseMoved: o_event];
- (BOOL)windowShouldClose:(id)sender
{
playlist_t * p_playlist = vlc_object_find( p_vout, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return NO;
}
playlist_Stop( p_playlist );
vlc_object_release( p_playlist );
/* The window will be closed by the intf later. */
return NO;
}
@end
......@@ -9,6 +9,7 @@
* Jon Lech Johansen <jon-vl@nanocrew.net>
* Derk-Jan Hartman <hartman at videolan dot org>
* Eric Petit <titer@m0k.org>
* Benjamin Pracht <bigben at videolan dot org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -54,8 +55,8 @@
struct vout_sys_t
{
NSAutoreleasePool * o_pool;
VLCWindow * o_window;
VLCGLView * o_glview;
VLCVoutView * o_vout_view;
vlc_bool_t b_saved_frame;
NSRect s_frame;
vlc_bool_t b_got_frame;
......@@ -102,14 +103,15 @@ int E_(OpenVideoGL) ( vlc_object_t * p_this )
[p_vout->p_sys->o_glview autorelease];
/* Spawn the window */
p_vout->p_sys->b_got_frame = VLC_FALSE;
p_vout->p_sys->o_window = [[VLCWindow alloc] initWithVout: p_vout
view: p_vout->p_sys->o_glview frame: nil];
if( !p_vout->p_sys->o_window )
if( !(p_vout->p_sys->o_vout_view = [VLCVoutView getVoutView: p_vout
subView: p_vout->p_sys->o_glview frame: nil]) )
{
return VLC_EGENERIC;
}
p_vout->p_sys->b_got_frame = VLC_FALSE;
p_vout->pf_init = Init;
p_vout->pf_end = End;
p_vout->pf_manage = Manage;
......@@ -127,7 +129,7 @@ void E_(CloseVideoGL) ( vlc_object_t * p_this )
NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
/* Close the window */
[p_vout->p_sys->o_window close];
[p_vout->p_sys->o_vout_view closeVout];
/* Clean up */
vlc_mutex_destroy( &p_vout->p_sys->lock );
......@@ -156,12 +158,12 @@ static int Manage( vout_thread_t * p_vout )
{
/* Save window size and position */
p_vout->p_sys->s_frame.size =
[[p_vout->p_sys->o_window contentView] frame].size;
[p_vout->p_sys->o_vout_view frame].size;
p_vout->p_sys->s_frame.origin =
[p_vout->p_sys->o_window frame].origin;
[[p_vout->p_sys->o_vout_view getWindow ]frame].origin;
p_vout->p_sys->b_saved_frame = VLC_TRUE;
}
[p_vout->p_sys->o_window close];
[p_vout->p_sys->o_vout_view closeVout];
p_vout->b_fullscreen = !p_vout->b_fullscreen;
......@@ -171,14 +173,15 @@ static int Manage( vout_thread_t * p_vout )
if( p_vout->p_sys->b_saved_frame )
{
p_vout->p_sys->o_window = [[VLCWindow alloc]
initWithVout: p_vout view: o_glview
frame: &p_vout->p_sys->s_frame];
p_vout->p_sys->o_vout_view = [VLCVoutView getVoutView: p_vout
subView: o_glview
frame: &p_vout->p_sys->s_frame];
}
else
{
p_vout->p_sys->o_window = [[VLCWindow alloc]
initWithVout: p_vout view: o_glview frame: nil];
p_vout->p_sys->o_vout_view = [VLCVoutView getVoutView: p_vout
subView: o_glview frame: nil];
}
[[o_glview openGLContext] makeCurrentContext];
......@@ -188,7 +191,7 @@ static int Manage( vout_thread_t * p_vout )
p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
}
[p_vout->p_sys->o_window manage];
[p_vout->p_sys->o_vout_view manage];
return VLC_SUCCESS;
}
......@@ -203,7 +206,7 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args )
{
case VOUT_SET_STAY_ON_TOP:
b_arg = va_arg( args, vlc_bool_t );
[p_vout->p_sys->o_window setOnTop: b_arg];
[p_vout->p_sys->o_vout_view setOnTop: b_arg];
return VLC_SUCCESS;
case VOUT_CLOSE:
......
......@@ -57,8 +57,8 @@
struct vout_sys_t
{
NSAutoreleasePool *o_pool;
VLCWindow * o_window;
VLCQTView * o_qtview;
VLCVoutView * o_vout_view;
vlc_bool_t b_saved_frame;
vlc_bool_t b_altivec;
......@@ -215,9 +215,9 @@ int E_(OpenVideoQT) ( vlc_object_t *p_this )
else
{
/* Spawn window */
p_vout->p_sys->o_window = [[VLCWindow alloc]
initWithVout: p_vout view: o_qtview frame: nil];
if( !p_vout->p_sys->o_window )
p_vout->p_sys->o_vout_view = [VLCVoutView getVoutView: p_vout
subView: o_qtview frame: nil];
if( !p_vout->p_sys->o_vout_view )
{
return VLC_EGENERIC;
}
......@@ -247,11 +247,11 @@ int E_(OpenVideoQT) ( vlc_object_t *p_this )
*****************************************************************************/
void E_(CloseVideoQT) ( vlc_object_t *p_this )
{
NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
vout_thread_t * p_vout = (vout_thread_t *)p_this;
if( !p_vout->p_sys->b_embedded )
[p_vout->p_sys->o_window close];
[p_vout->p_sys->o_vout_view closeVout];
/* Clean Up Quicktime environment */
ExitMovies();
......@@ -386,7 +386,7 @@ static int ManageVideo( vout_thread_t *p_vout )
p_vout->i_changes &= ~VOUT_SIZE_CHANGE;
}
[p_vout->p_sys->o_window manage];
[p_vout->p_sys->o_vout_view manage];
return( 0 );
}
......@@ -463,7 +463,7 @@ static int ControlVideo( vout_thread_t *p_vout, int i_query, va_list args )
{
case VOUT_SET_STAY_ON_TOP:
b_arg = va_arg( args, vlc_bool_t );
[p_vout->p_sys->o_window setOnTop: b_arg];
[p_vout->p_sys->o_vout_view setOnTop: b_arg];
return VLC_SUCCESS;
case VOUT_CLOSE:
......@@ -488,12 +488,12 @@ static int CoToggleFullscreen( vout_thread_t *p_vout )
{
/* Save window size and position */
p_vout->p_sys->s_frame.size =
[[p_vout->p_sys->o_window contentView] frame].size;
[p_vout->p_sys->o_vout_view frame].size;
p_vout->p_sys->s_frame.origin =
[p_vout->p_sys->o_window frame].origin;
[[p_vout->p_sys->o_vout_view getWindow] frame].origin;
p_vout->p_sys->b_saved_frame = VLC_TRUE;
}
[p_vout->p_sys->o_window close];
[p_vout->p_sys->o_vout_view closeVout];
p_vout->b_fullscreen = !p_vout->b_fullscreen;
......@@ -503,14 +503,14 @@ static int CoToggleFullscreen( vout_thread_t *p_vout )
if( p_vout->p_sys->b_saved_frame )
{
p_vout->p_sys->o_window = [[VLCWindow alloc]
initWithVout: p_vout view: o_qtview
p_vout->p_sys->o_vout_view = [VLCVoutView getVoutView: p_vout
subView: o_qtview
frame: &p_vout->p_sys->s_frame];
}
else
{
p_vout->p_sys->o_window = [[VLCWindow alloc]
initWithVout: p_vout view: o_qtview frame: nil];
p_vout->p_sys->o_vout_view = [VLCVoutView getVoutView: p_vout
subView: o_qtview frame: nil];
}
/* Retrieve the QuickDraw port */
......
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