Commit 0cdef305 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: re-implemented VLCVoutView and removed dead or outdated code

parent e3a1b511
......@@ -70,10 +70,8 @@ contrib-macosx-$(ARCH)-$(CONTRIBREV).tar.bz2:
(cd build-src && rm -rf *gecko* && $(MAKE) .gecko)
# libiconv.la is no longer present on Snow Leopard, so fix possible references to it, which would
# result in linking issues
ifdef HAVE_MACOSX_DARWIN_10
(cd $(PREFIX)/lib && sed -e 's%/usr/lib/libiconv.la%$(PREFIX)/lib/libiconv.la%g' -i.orig *.la && rm -f *.la.orig)
(cd build-src && rm -f .iconv && $(MAKE) .iconv-from-os)
endif
touch .$(CONTRIBREV)
using-bin: .$(CONTRIBREV)
......
......@@ -2,9 +2,9 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1040</int>
<string key="IBDocument.SystemVersion">11C26</string>
<string key="IBDocument.SystemVersion">11A511</string>
<string key="IBDocument.InterfaceBuilderVersion">851</string>
<string key="IBDocument.AppKitVersion">1138.11</string>
<string key="IBDocument.AppKitVersion">1138</string>
<string key="IBDocument.HIToolboxVersion">566.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<bool key="EncodedWithXMLCoder">YES</bool>
......@@ -21,14 +21,14 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="1617"/>
<integer value="2730"/>
<integer value="4682"/>
<integer value="4596"/>
<integer value="915"/>
<integer value="334"/>
<integer value="283"/>
<integer value="1617"/>
<integer value="2730"/>
<integer value="4722"/>
<integer value="283"/>
<integer value="2"/>
<integer value="334"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
......@@ -1217,7 +1217,7 @@
<bool key="CIEnabled">YES</bool>
</object>
<int key="NSViewLayerContentsRedrawPolicy">2</int>
<string key="NSClassName">NSView</string>
<string key="NSClassName">VLCVoutView</string>
</object>
</object>
<string key="NSFrameSize">{604, 310}</string>
......@@ -16238,6 +16238,25 @@ LCAuLi4</string>
<string key="superclassName">NSView</string>
<reference key="sourceIdentifier" ref="736371707"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">VLCVoutView</string>
<string key="superclassName">NSView</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">o_window</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">o_window</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<string key="name">o_window</string>
<string key="candidateClassName">id</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBDocumentRelativeSource</string>
<string key="minorKey">../../../../../modules/gui/macosx/vout.h</string>
</object>
</object>
</object>
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
<bool key="EncodedWithXMLCoder">YES</bool>
......
......@@ -56,5 +56,4 @@
- (void)setAspectRatioLocked:(BOOL)b_value;
- (BOOL)aspectRatioIsLocked;
- (void)toggleFullscreen;
- (id)voutView;
@end
......@@ -23,7 +23,6 @@
#import "CoreInteraction.h"
#import "intf.h"
#import "vout.h"
#import "open.h"
#import <vlc_playlist.h>
#import <vlc_input.h>
......@@ -93,9 +92,6 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)stop
{
var_SetInteger( VLCIntf->p_libvlc, "key-action", ACTIONID_STOP );
/* Close the window directly, because we do know that there
* won't be anymore video. It's currently waiting a bit. */
[[[self voutView] window] orderOut:self];
}
- (void)faster
......@@ -270,26 +266,4 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
vlc_object_release( p_input );
}
}
- (id)voutView
{
id o_window;
id o_voutView = nil;
id o_embeddedViewList = [[VLCMain sharedInstance] embeddedList];
NSEnumerator *o_enumerator = [[NSApp orderedWindows] objectEnumerator];
while( !o_voutView && ( o_window = [o_enumerator nextObject] ) )
{
/* We have an embedded vout */
if( [o_embeddedViewList windowContainsEmbedded: o_window] )
{
o_voutView = [o_embeddedViewList viewForWindow: o_window];
}
/* We have a detached vout */
else if( [[o_window className] isEqualToString: @"VLCVoutWindow"] )
{
o_voutView = [o_window voutView];
}
}
return [[o_voutView retain] autorelease];
}
@end
......@@ -251,6 +251,7 @@
var:(const char *)psz_variable
selector:(SEL)pf_callback;
- (id)voutMenu;
@end
/*****************************************************************************
......
......@@ -623,6 +623,11 @@ static VLCMainMenu *_o_sharedInstance = nil;
}
}
- (id)voutMenu
{
return o_vout_menu;
}
#pragma mark -
#pragma mark Panels
......@@ -1204,8 +1209,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
{
if( [o_title isEqualToString: _NS("Float on Top")] )
{
var_Get( p_vout, "video-on-top", &val );
[o_mi setState: val.b_bool ? NSOnState : NSOffState];
[o_mi setState: var_GetBool( p_vout, "video-on-top" )];
}
bEnabled = TRUE;
......@@ -1215,8 +1219,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
}
if( [o_title isEqualToString: _NS("Fullscreen")] )
{
var_Get( p_playlist, "fullscreen", &val );
[o_mi setState: val.b_bool];
[o_mi setState: var_GetBool( p_playlist, "fullscreen" )];
bEnabled = TRUE;
}
[self setupMenus]; /* Make sure video menu is up to date */
......
......@@ -157,6 +157,8 @@
- (void)hasBecomeFullscreen;
- (void)setFrameOnMainThread:(NSData*)packedargs;
- (id)fspanel;
@end
@interface VLCProgressBarGradientEffect : NSView {
......
......@@ -646,8 +646,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
int i_volume_step = 0;
i_volume_step = config_GetInt( VLCIntf->p_libvlc, "volume-step" );
[o_volume_sld setFloatValue: (float)i_lastShownVolume / i_volume_step];
if ([o_fspanel respondsToSelector:@selector(setVolumeLevel:)])
[o_fspanel setVolumeLevel: (float)i_lastShownVolume / i_volume_step];
// if ([o_fspanel respondsToSelector:@selector(setVolumeLevel:)])
// [o_fspanel setVolumeLevel: (float)i_lastShownVolume / i_volume_step];
}
}
......@@ -1292,6 +1292,10 @@ static VLCMainWindow *_o_sharedInstance = nil;
}
}
- (id)fspanel
{
return o_fspanel;
}
#pragma mark -
#pragma mark Side Bar Data handling
......
......@@ -166,19 +166,6 @@
}
}
- (IBAction)toogleFullscreen:(id)sender {
[[VLCCoreInteraction sharedInstance] toggleFullscreen];
}
- (BOOL) isFullscreen {
id o_vout_view = [[VLCCoreInteraction sharedInstance] voutView];
if( o_vout_view )
{
return [o_vout_view isFullscreen];
}
return NO;
}
- (IBAction)telxTransparent:(id)sender
{
vlc_object_t *p_vbi;
......@@ -329,11 +316,14 @@
/* Escape */
if( key == (unichar) 0x1b )
{
id o_vout_view = [[VLCCoreInteraction sharedInstance] voutView];
if( o_vout_view && [o_vout_view isFullscreen] )
vout_thread_t *p_vout = getVout();
if (p_vout)
{
[o_vout_view toggleFullscreen];
eventHandled = YES;
if (var_GetBool( p_vout, "fullscreen" ))
{
[[VLCCoreInteraction sharedInstance] toggleFullscreen];
eventHandled = YES;
}
}
}
else if( key == ' ' )
......
......@@ -38,6 +38,8 @@
/* SetSystemUIMode, ... */
#import <Carbon/Carbon.h>
#if 0
/*****************************************************************************
* VLCEmbeddedWindow Implementation
*****************************************************************************/
......@@ -1006,3 +1008,5 @@
NSRectFill(divider);*/
}
@end
#endif
......@@ -178,13 +178,15 @@
- (void)setActive:(id)noData
{
if( [[VLCCoreInteraction sharedInstance] voutView] != nil )
vout_thread_t *p_vout = getVout();
if (p_vout)
{
if( [[[VLCCoreInteraction sharedInstance] voutView] isFullscreen] )
if (var_GetBool( p_vout, "fullscreen" ))
{
b_nonActive = NO;
[self fadeIn];
}
vlc_object_release( p_vout );
}
}
......@@ -247,8 +249,13 @@
- (void)mouseExited:(NSEvent *)theEvent
{
/* give up our focus, so the vout may show us again without letting the user clicking it */
if( [[[VLCCoreInteraction sharedInstance] voutView] isFullscreen] )
[[[[VLCCoreInteraction sharedInstance] voutView] window] makeKeyWindow];
vout_thread_t *p_vout = getVout();
if (p_vout)
{
if (var_GetBool( p_vout, "fullscreen" ))
[[[[VLCCoreInteraction sharedInstance] voutView] window] makeKeyWindow];
vlc_object_release( p_vout );
}
}
- (void)hideMouse
......
......@@ -744,10 +744,6 @@ static VLCMain *_o_sharedMainInstance = nil;
[NSApp activateIgnoringOtherApps:YES];
[o_remote stopListening: self];
var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_STOP );
/* Close the window directly, because we do know that there
* won't be anymore video. It's currently waiting a bit. */
[[[o_coreinteraction voutView] window] orderOut:self];
}
#pragma mark -
......@@ -1276,6 +1272,15 @@ unsigned int CocoaKeyToVLC( unichar i_key )
- (void)updatePlaybackPosition
{
[o_mainwindow updateTimeSlider];
input_thread_t * p_input;
p_input = pl_CurrentInput( p_intf );
if( p_input )
{
if( var_GetInteger( p_input, "state" ) == PLAYING_S )
UpdateSystemActivity( UsrActivity );
vlc_object_release( p_input );
}
}
- (void)updateVolume
......
/*****************************************************************************
* vout.h: MacOS X interface module
* vout.h: MacOS X video output module
*****************************************************************************
* Copyright (C) 2001-2007 the VideoLAN team
* Copyright (C) 2002-2011 the VideoLAN team
* $Id$
*
* Authors: Colin Delacroix <colin@zoy.org>
* Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
* Authors: Derk-Jan Hartman <hartman at videolan dot org>
* Eric Petit <titer@m0k.org>
* Benjamin Pracht <bigben at videolan dot org>
* Pierre d'Herbemont <pdherbemont # videolan org>
* Felix Paul Kühne <fkuehne 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
......@@ -25,107 +25,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import "misc.h"
/*****************************************************************************
* VLCEmbeddedList interface
*****************************************************************************/
@interface VLCEmbeddedList : NSObject
{
NSMutableArray * o_embedded_array;
}
- (id)embeddedVout;
- (void)releaseEmbeddedVout: (id)o_vout_view;
- (void)addEmbeddedVout: (id)o_vout_view;
- (BOOL)windowContainsEmbedded: (id)o_window;
- (id)viewForWindow: (id)o_window;
@end
/*****************************************************************************
* VLCVoutView interface
*****************************************************************************/
@protocol VLCVoutViewResetting
+ (void)resetVout: (vout_thread_t *)p_vout;
@end
@interface VLCVoutView : NSView
{
vout_thread_t * p_vout;
NSRect * s_frame;
NSView * o_view;
NSView <VLCVoutViewResetting> * o_view;
vout_thread_t * p_real_vout;
id o_window;
}
- (BOOL)setVout: (vout_thread_t *) p_arg_vout subView: (NSView *) view
frame: (NSRect *) s_arg_frame;
- (void)closeVout;
- (void)updateTitle;
- (void)manage;
- (void)scaleWindowWithFactor: (float)factor animate: (BOOL)animate;
- (void)setOnTop:(BOOL)b_on_top;
- (void)toggleFloatOnTop;
- (void)toggleFullscreen;
- (BOOL)isFullscreen;
- (void)snapshot;
- (id)voutWindow;
+ (id)voutView: (vout_thread_t *)p_vout subView: (NSView *) view
frame: (NSRect *) s_frame;
+ (vout_thread_t *)realVout: (vout_thread_t *)p_vout;
- (void)enterFullscreen;
- (void)leaveFullscreen;
@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;
id o_embeddedwindow;
}
- (void)setUsed: (BOOL)b_new_used;
- (BOOL)isUsed;
@end
/*****************************************************************************
* VLCVoutWindow interface
*****************************************************************************/
@interface VLCVoutWindow : VLCWindow
{
vout_thread_t * p_vout;
VLCVoutView * o_view;
NSRect * s_frame;
bool b_init_ok;
BOOL fullscreen;
NSRect initialFrame;
}
- (id) initWithVout: (vout_thread_t *) p_vout view: (VLCVoutView *) view
frame: (NSRect *) s_frame;
- (id)initMainThread: (id) sender;
- (void)leaveFullscreen;
- (void)enterFullscreen;
- (id)voutView;
@end
@end
\ No newline at end of file
/*****************************************************************************
* vout.m: MacOS X video output module
*****************************************************************************
* Copyright (C) 2001-2011 the VideoLAN team
* Copyright (C) 2002-2011 the VideoLAN team
* $Id$
*
* Authors: Colin Delacroix <colin@zoy.org>
* Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
* Derk-Jan Hartman <hartman at videolan dot org>
* Authors: Derk-Jan Hartman <hartman at videolan dot org>
* Eric Petit <titer@m0k.org>
* Benjamin Pracht <bigben at videolan dot org>
* Pierre d'Herbemont <pdherbemont # videolan org>
* Felix Paul Kühne <fkuehne 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
......@@ -30,34 +28,20 @@
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdlib.h> /* free() */
#include <string.h>
/* prevent system sleep */
#import <CoreServices/CoreServices.h>
/* FIXME: HACK!! */
#ifdef __x86_64__
#import <CoreServices/../Frameworks/OSServices.framework/Headers/Power.h>
#endif
/* SystemUIMode */
#import <Carbon/Carbon.h>
#include "intf.h"
#include "fspanel.h"
#include "vout.h"
#import "controls.h"
#import "embeddedwindow.h"
#include <vlc_common.h>
#include <vlc_vout_window.h>
#include <vlc_vout_display.h>
#include <vlc_keys.h>
#include <vlc_url.h>
#if 0
#import <stdlib.h> /* free() */
#import <string.h>
#import "intf.h"
#import "fspanel.h"
#import "vout.h"
#import "CoreInteraction.h"
#import "MainMenu.h"
#import "MainWindow.h"
#import <vlc_common.h>
#import <vlc_vout_window.h>
#import <vlc_vout_display.h>
#import <vlc_keys.h>
/*****************************************************************************
* DeviceCallback: Callback triggered when the video-device variable is changed
*****************************************************************************/
......@@ -76,182 +60,90 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
return VLC_SUCCESS;
}
/*****************************************************************************
* VLCEmbeddedList implementation
*****************************************************************************/
@implementation VLCEmbeddedList
- (id)init
{
[super init];
o_embedded_array = [NSMutableArray array];
return self;
}
- (id)embeddedVout
{
unsigned int i;
for( i = 0; i < [o_embedded_array count]; i++ )
{
id o_vout_view = [o_embedded_array objectAtIndex: i];
if( ![o_vout_view isUsed] )
{
[o_vout_view setUsed: YES];
return o_vout_view;
}
}
return nil;
}
- (void)releaseEmbeddedVout: (id)o_vout_view
{
if( [o_embedded_array containsObject: o_vout_view] )
{
[o_vout_view setUsed: NO];
}
else
{
msg_Warn( VLCIntf, "cannot find Video Output");
}
}
- (void)addEmbeddedVout: (id)o_vout_view
{
if( ![o_embedded_array containsObject: o_vout_view] )
{
[o_embedded_array addObject: o_vout_view];
}
}
- (BOOL)windowContainsEmbedded: (id)o_window
{
return ([self viewForWindow: o_window] == nil ? NO : YES );
}
- (id)viewForWindow: (id)o_window
{
if( o_embedded_array != nil )
{
id o_enumerator = [o_embedded_array objectEnumerator];
id o_current_embedded;
if( o_window != nil )
{
while( (o_current_embedded = [o_enumerator nextObject]) )
{
if( [o_current_embedded voutWindow] == o_window )
{
return o_current_embedded;
}
}
}
}
return nil;
}
@end
/*****************************************************************************
* VLCVoutView implementation
*****************************************************************************/
@implementation VLCVoutView
- (id)initWithFrame: (NSRect)frameRect
- (void)setVoutView:(id)theView
{
self = [super initWithFrame: frameRect];
p_vout = NULL;
o_view = nil;
s_frame = &frameRect;
p_real_vout = NULL;
o_window = nil;
return self;
}
vout_thread_t * p_vout = getVout();
if( !p_vout )
return;
- (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( VLCIntf, "no OSX screens available" );
return NO;
return;
}
p_real_vout = [VLCVoutView realVout: 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_libvlc, "video-device" ) == 0 )
if( var_Type( p_vout->p_libvlc, "video-device" ) == 0 )
{
i_device = var_GetInteger( p_vout, "macosx-vdev" );
}
else
{
i_device = var_GetInteger( p_real_vout->p_libvlc, "video-device" );
i_device = var_GetInteger( p_vout->p_libvlc, "video-device" );
}
/* Setup the menuitem for the multiple displays. */
if( var_Type( p_real_vout, "video-device" ) == 0 )
if( var_Type( p_vout, "video-device" ) == 0 )
{
int i = 1;
vlc_value_t val2, text;
NSScreen * o_screen;
var_Create( p_real_vout, "video-device", VLC_VAR_INTEGER |
VLC_VAR_HASCHOICE );
var_Create( p_vout, "video-device", VLC_VAR_INTEGER |
VLC_VAR_HASCHOICE );
text.psz_string = _("Fullscreen Video Device");
var_Change( p_real_vout, "video-device", VLC_VAR_SETTEXT, &text, NULL );
var_Change( p_vout, "video-device", VLC_VAR_SETTEXT, &text, NULL );
NSEnumerator * o_enumerator = [o_screens objectEnumerator];
val2.i_int = 0;
text.psz_string = _("Default");
var_Change( p_real_vout, "video-device",
VLC_VAR_ADDCHOICE, &val2, &text );
var_Set( p_real_vout, "video-device", val2 );
var_Change( p_vout, "video-device", VLC_VAR_ADDCHOICE, &val2, &text );
var_Set( p_vout, "video-device", val2 );
while( (o_screen = [o_enumerator nextObject]) != NULL )
{
char psz_temp[255];
NSRect s_rect = [o_screen frame];
snprintf( psz_temp, sizeof(psz_temp)/sizeof(psz_temp[0])-1,
"%s %d (%dx%d)", _("Screen"), i,
(int)s_rect.size.width, (int)s_rect.size.height );
snprintf( psz_temp, sizeof(psz_temp)/sizeof(psz_temp[0])-1, "%s %d (%dx%d)", _("Screen"), i, (int)s_rect.size.width, (int)s_rect.size.height );
text.psz_string = psz_temp;
val2.i_int = (int)[o_screen displayID];
var_Change( p_real_vout, "video-device",
VLC_VAR_ADDCHOICE, &val2, &text );
var_Change( p_vout, "video-device", VLC_VAR_ADDCHOICE, &val2, &text );
if( (int)[o_screen displayID] == i_device )
{
var_Set( p_real_vout, "video-device", val2 );
var_Set( p_vout, "video-device", val2 );
}
i++;
}
var_AddCallback( p_real_vout, "video-device", DeviceCallback,
NULL );
var_AddCallback( p_vout, "video-device", DeviceCallback,
NULL );
val2.b_bool = true;
var_Set( p_real_vout, "intf-change", val2 );
var_Set( p_vout, "intf-change", val2 );
}
/* Add the view. It's automatically resized to fit the window */
if (o_view) {
[o_view removeFromSuperview];
[o_view release];
}
o_view = theView;
[o_view retain];
[self addSubview: o_view];
[self setAutoresizesSubviews: YES];
[o_pool release];
return YES;
/* make sure that we look alright */
[[self window] setAlphaValue: var_CreateGetFloat( p_vout, "macosx-opaqueness" )];
vlc_object_release( p_vout );
}
- (void)resizeSubviewsWithOldSize:(NSSize)oldBoundsSize
......@@ -271,200 +163,11 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
- (void)closeVout
{
[[[[VLCMain sharedInstance] controls] fspanel] fadeOut];
/* Make sure we don't see a white flash */
[[self voutWindow] disableScreenUpdatesUntilFlush];
[[o_view window] disableScreenUpdatesUntilFlush];
[o_view removeFromSuperview];
[o_view release];
o_view = nil;
p_vout = NULL;
s_frame = nil;
o_window = nil;
p_real_vout = NULL;
}
- (void)updateTitle
{
NSString * o_title = nil;
NSMutableString * o_mrl = nil;
input_thread_t * p_input;
char * psz_title;
if( !p_vout ) return;
p_input = getInput();
if( !p_input ) return;
input_item_t * p_item = input_GetItem( p_input );
psz_title = input_item_GetNowPlaying ( p_item );
if( !psz_title )
psz_title = input_item_GetName( p_item );
if( psz_title )
o_title = [NSString stringWithUTF8String: psz_title];
char *psz_uri = decode_URI( input_item_GetURI( p_item ) );
if( psz_uri )
o_mrl = [NSMutableString stringWithUTF8String: psz_uri];
free( psz_title );
free( psz_uri );
if( !o_title )
o_title = o_mrl;
if( o_mrl != nil )
{
/* FIXME once psz_access is exported, we could check if we are
* reading from a file in a smarter way. */
NSRange prefix_range = [o_mrl rangeOfString: @"file:"];
if( prefix_range.location != NSNotFound )
[o_mrl deleteCharactersInRange: prefix_range];
if( [o_mrl characterAtIndex:0] == '/' )
{
/* it's a local file */
[o_window setRepresentedFilename: o_mrl];
}
else
{
/* it's from the network or somewhere else,
* we clear the previous path */
[o_window setRepresentedFilename: @""];
}
[o_window setTitle: o_title];
}
else
{
[o_window setTitle: [NSString stringWithUTF8String: VOUT_TITLE]];
}
vlc_object_release( p_input );
}
- (void)setOnTop:(BOOL)b_on_top
{
if( b_on_top )
{
[o_window setLevel: NSStatusWindowLevel];
}
else
{
[o_window setLevel: NSNormalWindowLevel];
}
}
- (NSSize)voutSizeForFactor: (float)factor
{
int i_corrected_height, i_corrected_width;
NSSize newsize;
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 /
VOUT_ASPECT_FACTOR;
newsize.width = (int) ( i_corrected_width * factor );
newsize.height = (int) ( p_vout->render.i_height * factor );
}
else
{
i_corrected_height = p_vout->render.i_width * VOUT_ASPECT_FACTOR /
p_vout->render.i_aspect;
newsize.width = (int) ( p_vout->render.i_width * factor );
newsize.height = (int) ( i_corrected_height * factor );
}
return newsize;
}
- (void)scaleWindowWithFactor: (float)factor animate: (BOOL)animate
{
if ( !p_vout->b_fullscreen )
{
NSSize newsize;
NSPoint topleftbase;
NSPoint topleftscreen;
NSView *mainView;
NSRect new_frame;
topleftbase.x = 0;
topleftbase.y = [o_window frame].size.height;
topleftscreen = [o_window convertBaseToScreen: topleftbase];
newsize = [self voutSizeForFactor:factor];
/* In fullscreen mode we need to use a view that is different from
* ourselves, with the VLCEmbeddedWindow */
if([o_window isKindOfClass:[VLCEmbeddedWindow class]])
mainView = [o_window mainView];
else
mainView = self;
/* Calculate the window's new size */
new_frame.size.width = [o_window frame].size.width -
[mainView frame].size.width + newsize.width;
new_frame.size.height = [o_window frame].size.height -
[mainView 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:animate animate:animate];
p_vout->i_changes |= VOUT_SIZE_CHANGE;
}
}
- (void)toggleFloatOnTop
{
vlc_value_t val;
if( !p_real_vout ) return;
if( var_Get( p_real_vout, "video-on-top", &val )>=0 && val.b_bool)
{
val.b_bool = false;
}
else
{
val.b_bool = true;
}
var_Set( p_real_vout, "video-on-top", val );
}
- (void)toggleFullscreen
{
vlc_value_t val;
if( !p_real_vout ) return;
var_ToggleBool( p_real_vout, "fullscreen" );
}
- (BOOL)isFullscreen
{
vlc_value_t val;
if( !p_real_vout ) return NO;
var_Get( p_real_vout, "fullscreen", &val );
return( val.b_bool );
}
- (void)snapshot
{
var_TriggerCallback( p_real_vout, "video-snapshot" );
}
- (void)manage
{
/* Disable Screensaver, when we're playing something, but allow it on pause */
if( !VLCIntf || !VLCIntf->p_sys )
return;
if( VLCIntf->p_sys->i_play_status == PLAYING_S )
UpdateSystemActivity( UsrActivity );
}
- (id)voutWindow
{
return o_window;
}
- (void)scrollWheel:(NSEvent *)theEvent
......@@ -495,13 +198,13 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
if( key )
{
vout_thread_t * p_vout = getVout();
/* Escape should always get you out of fullscreen */
if( key == (unichar) 0x1b )
{
if( p_real_vout && [self isFullscreen] )
{
[self toggleFullscreen];
}
playlist_t * p_playlist = pl_Get( VLCIntf );
if( var_GetBool( p_playlist, "fullscreen") )
[[VLCCoreInteraction sharedInstance] toggleFullscreen];
}
else if ( p_vout )
{
......@@ -510,8 +213,10 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
else
val.i_int |= (int)CocoaKeyToVLC( key );
var_Set( p_vout->p_libvlc, "key-pressed", val );
vlc_object_release( p_vout );
}
else msg_Dbg( VLCIntf, "could not send keyevent to VLC core" );
else
msg_Dbg( VLCIntf, "could not send keyevent to VLC core" );
}
else
[super keyDown: o_event];
......@@ -519,6 +224,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
- (void)mouseDown:(NSEvent *)o_event
{
vout_thread_t * p_vout = getVout();
vlc_value_t val;
if( p_vout )
{
......@@ -535,7 +241,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
else
{
/* multiple clicking */
[self toggleFullscreen];
[[VLCCoreInteraction sharedInstance] toggleFullscreen];
}
}
else if( ( [o_event type] == NSRightMouseDown ) ||
......@@ -543,8 +249,9 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
( [o_event modifierFlags] & NSControlKeyMask ) ) )
{
msg_Dbg( p_vout, "received NSRightMouseDown (generic method) or Ctrl clic" );
[NSMenu popUpContextMenu: [[VLCMain sharedInstance] voutMenu] withEvent: o_event forView: [[[VLCMain sharedInstance] controls] voutView]];
[NSMenu popUpContextMenu: [[VLCMainMenu sharedInstance] voutMenu] withEvent: o_event forView: self];
}
vlc_object_release( p_vout );
}
[super mouseDown: o_event];
......@@ -552,13 +259,18 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
- (void)otherMouseDown:(NSEvent *)o_event
{
vlc_value_t val;
if( p_vout && [o_event type] == NSOtherMouseDown )
if( [o_event type] == NSOtherMouseDown )
{
var_Get( p_vout, "mouse-button-down", &val );
val.i_int |= 2;
var_Set( p_vout, "mouse-button-down", val );
vout_thread_t * p_vout = getVout();
vlc_value_t val;
if (p_vout)
{
var_Get( p_vout, "mouse-button-down", &val );
val.i_int |= 2;
var_Set( p_vout, "mouse-button-down", val );
}
vlc_object_release( p_vout );
}
[super mouseDown: o_event];
......@@ -566,10 +278,12 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
- (void)rightMouseDown:(NSEvent *)o_event
{
if( p_vout && [o_event type] == NSRightMouseDown )
if( [o_event type] == NSRightMouseDown )
{
msg_Dbg( p_vout, "received NSRightMouseDown (specific method)" );
[NSMenu popUpContextMenu: [[VLCMain sharedInstance] voutMenu] withEvent: o_event forView: [[[VLCMain sharedInstance] controls] voutView]];
vout_thread_t * p_vout = getVout();
if (p_vout)
[NSMenu popUpContextMenu: [[VLCMainMenu sharedInstance] voutMenu] withEvent: o_event forView: self];
vlc_object_release( p_vout );
}
[super mouseDown: o_event];
......@@ -577,18 +291,22 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
- (void)mouseUp:(NSEvent *)o_event
{
vlc_value_t val;
if( p_vout && [o_event type] == NSLeftMouseUp )
if( [o_event type] == NSLeftMouseUp )
{
int x, y;
vout_thread_t * p_vout = getVout();
if (p_vout)
{
vlc_value_t val;
int x, y;
var_GetCoords( p_vout, "mouse-moved", &x, &y );
var_SetCoords( p_vout, "mouse-clicked", x, y );
var_GetCoords( p_vout, "mouse-moved", &x, &y );
var_SetCoords( p_vout, "mouse-clicked", x, y );
var_Get( p_vout, "mouse-button-down", &val );
val.i_int &= ~1;
var_Set( p_vout, "mouse-button-down", val );
var_Get( p_vout, "mouse-button-down", &val );
val.i_int &= ~1;
var_Set( p_vout, "mouse-button-down", val );
vlc_object_release( p_vout );
}
}
[super mouseUp: o_event];
......@@ -596,13 +314,17 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
- (void)otherMouseUp:(NSEvent *)o_event
{
vlc_value_t val;
if( p_vout && [o_event type] == NSOtherMouseUp )
if( [o_event type] == NSOtherMouseUp )
{
var_Get( p_vout, "mouse-button-down", &val );
val.i_int &= ~2;
var_Set( p_vout, "mouse-button-down", val );
vout_thread_t * p_vout = getVout();
if (p_vout)
{
vlc_value_t val;
var_Get( p_vout, "mouse-button-down", &val );
val.i_int &= ~2;
var_Set( p_vout, "mouse-button-down", val );
vlc_object_release( p_vout );
}
}
[super mouseUp: o_event];
......@@ -610,12 +332,14 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
- (void)rightMouseUp:(NSEvent *)o_event
{
if( p_vout && [o_event type] == NSRightMouseUp )
if( [o_event type] == NSRightMouseUp )
{
/* FIXME: this isn't the appropriate place, but we can't receive
* NSRightMouseDown some how */
msg_Dbg( p_vout, "received NSRightMouseUp" );
[NSMenu popUpContextMenu: [[VLCMain sharedInstance] voutMenu] withEvent: o_event forView: [[[VLCMain sharedInstance] controls] voutView]];
vout_thread_t * p_vout = getVout();
if (p_vout)
{
[NSMenu popUpContextMenu: [[VLCMainMenu sharedInstance] voutMenu] withEvent: o_event forView: self];
vlc_object_release( p_vout );
}
}
[super mouseUp: o_event];
......@@ -638,44 +362,34 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
- (void)mouseMoved:(NSEvent *)o_event
{
NSPoint ml;
NSRect s_rect;
BOOL b_inside;
vout_thread_t * p_vout = getVout();
if( p_vout )
{
NSPoint ml;
NSRect s_rect;
BOOL b_inside;
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 )
{
int x, y;
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 );
x = (((int)ml.x) - i_x) * p_vout->render.i_width / i_width;
if( [[o_view className] isEqualToString: @"VLCGLView"] )
{
y = (((int)(s_rect.size.height - ml.y)) - i_y) *
p_vout->render.i_height / i_height;
}
else
{
y = (((int)ml.y) - i_y) * p_vout->render.i_height / i_height;
}
var_SetCoords( p_vout, "mouse-moved", x, y );
var_SetCoords( p_vout, "mouse-moved", ((int)ml.x), ((int)ml.y) );
}
if( self && [self isFullscreen] )
[[[[VLCMain sharedInstance] controls] fspanel] fadeIn];
// if( var_GetBool( p_vout, "fullscreen") )
[[[VLCMainWindow sharedInstance] fspanel] fadeIn];
vlc_object_release( p_vout );
}
[super mouseMoved: o_event];
}
- (BOOL)mouseDownCanMoveWindow
{
return YES;
}
- (BOOL)acceptsFirstResponder
{
return YES;
......@@ -692,462 +406,4 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
events */
return NO;
}
/* Class methods used by the different vout modules */
+ (vout_thread_t *)realVout: (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.
Since we can't be the QuickTime output anymore, we need to be
the parent.
FIXME: check with the caca and x11 vouts! */
return (vout_thread_t *) p_vout->p_parent;
}
+ (id)voutView: (vout_thread_t *)p_vout subView: (NSView *)view
frame: (NSRect *)s_frame
{
int i_drawable_gl;
int i_timeout;
id o_return = nil;
i_drawable_gl = var_GetInteger( p_vout->p_libvlc, "drawable-gl" );
var_Create( p_vout, "macosx-vdev", VLC_VAR_INTEGER | 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 );
var_Create( p_vout, "macosx-black", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_vout, "embedded-video", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
/* 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-gl" value: if it's zero, we're running in the
* main Mac intf; if it's non-zero, we're embedded. */
if( i_drawable_gl == 0 )
{
/* Wait for a MacOS X interface to appear. Timeout is 2 seconds. */
for( i_timeout = 20 ; i_timeout-- ; )
{
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;
}
else
{
if ( VLCIntf && !(p_vout->b_fullscreen) &&
!(var_GetBool( p_vout, "macosx-background" )) &&
var_GetBool( p_vout, "embedded-video") )
{
o_return = [[[VLCMain sharedInstance] embeddedList] embeddedVout];
}
}
}
/* No embedded vout is available */
if( o_return == nil )
{
NSRect null_rect;
memset( &null_rect, 0, sizeof( NSRect ) );
o_return = [[VLCDetachedVoutView alloc] initWithFrame: null_rect ];
}
[o_return setVout: p_vout subView: view frame: s_frame];
return o_return;
}
- (void)enterFullscreen
{
/* Save the settings for next playing item */
playlist_t * p_playlist = pl_Get( p_real_vout );
var_SetBool( p_playlist, "fullscreen", true );
}
- (void)leaveFullscreen
{
/* Save the settings for next playing item */
playlist_t * p_playlist = pl_Get( p_real_vout );
var_SetBool( p_playlist, "fullscreen", false );
}
@end
/*****************************************************************************
* VLCDetachedVoutView implementation
*****************************************************************************/
@implementation VLCDetachedVoutView
- (id)initWithFrame: (NSRect)frameRect
{
[super initWithFrame: frameRect];
i_time_mouse_last_moved = 0;
return self;
}
- (BOOL)mouseDownCanMoveWindow
{
return YES;
}
- (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 = [[VLCVoutWindow alloc] initWithVout: p_arg_vout view: self
frame: s_arg_frame];
[self updateTitle];
if([self isFullscreen])
[o_window performSelectorOnMainThread: @selector(enterFullscreen) withObject: NULL waitUntilDone: YES];
else
[view setFrame: [self frame]];
return b_return;
}
- (void)closeVout
{
[o_window performSelectorOnMainThread: @selector(close) withObject: NULL waitUntilDone: YES];
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
{
/* Dooh, why do we spend processor time doing this kind of stuff? */
[super manage];
unsigned int i_mouse_hide_timeout =
var_CreateGetInteger(p_vout, "mouse-hide-timeout") * 1000;
if( i_mouse_hide_timeout < 100000 )
i_mouse_hide_timeout = 100000;
if( p_vout->b_fullscreen )
{
if( mdate() - i_time_mouse_last_moved > i_mouse_hide_timeout )
{
i_time_mouse_last_moved = mdate();
[self hideMouse: YES];
}
}
else
{
[self hideMouse: NO];
}
}
- (void)enterFullscreen
{
[o_window performSelectorOnMainThread: @selector(enterFullscreen) withObject: NULL waitUntilDone: NO];
[super enterFullscreen];
}
- (void)leaveFullscreen
{
[o_window performSelectorOnMainThread: @selector(leaveFullscreen) withObject: NULL waitUntilDone: NO];
[super leaveFullscreen];
}
- (void)scaleWindowWithFactor: (float)factor animate: (BOOL)animate
{
if( p_vout->b_fullscreen )
return;
[o_window setMovableByWindowBackground: NO];
[super scaleWindowWithFactor: factor animate: animate];
[o_window setMovableByWindowBackground: YES];
}
@end
/*****************************************************************************
* VLCEmbeddedVoutView implementation
*****************************************************************************/
@implementation VLCEmbeddedVoutView
- (void)awakeFromNib
{
o_embeddedwindow = [self window];
}
- (BOOL)mouseDownCanMoveWindow
{
return YES;
}
- (id)initWithFrame: (NSRect)frameRect
{
if(self = [super initWithFrame: frameRect])
{
b_used = NO;
[[[VLCMain sharedInstance] embeddedList] addEmbeddedVout: self];
o_embeddedwindow = nil; /* Filled later on in -awakeFromNib */
}
return self;
}
- (BOOL)setVout: (vout_thread_t *) p_arg_vout subView: (NSView *) view
frame: (NSRect *)s_arg_frame
{
BOOL b_return;
[NSObject cancelPreviousPerformRequestsWithTarget:o_window];
b_return = [super setVout: p_arg_vout subView: view frame: s_arg_frame];
if( b_return )
{
o_window = [self window];
[o_window setAcceptsMouseMovedEvents: TRUE];
if( var_CreateGetBool( p_real_vout, "video-on-top" ) )
{
[o_window setLevel: NSStatusWindowLevel];
}
[view setFrameSize: [self frame].size];
}
/* o_window needs to point to our o_embeddedwindow, super might have set it
* to the fullscreen window that o_embeddedwindow setups during fullscreen */
o_window = o_embeddedwindow;
if( b_return )
{
[o_window lockFullscreenAnimation];
[o_window setAlphaValue: var_GetFloat( p_vout, "macosx-opaqueness" )];
[self updateTitle];
[NSObject cancelPreviousPerformRequestsWithTarget:o_window];
/* Make the window the front and key window before animating */
if ([o_window isVisible] && (![o_window isFullscreen]))
[o_window makeKeyAndOrderFront: self];
[self scaleWindowWithFactor: 1.0 animate: [o_window isVisible] && (![o_window isFullscreen])];
[o_embeddedwindow setVideoRatio:[self voutSizeForFactor:1.0]];
/* Make sure our window is visible, if we are not in fullscreen */
if (![o_window isFullscreen])
[o_window makeKeyAndOrderFront: self];
[o_window unlockFullscreenAnimation];
}
return b_return;
}
- (void)setUsed: (BOOL)b_new_used
{
b_used = b_new_used;
}
- (BOOL)isUsed
{
return b_used;
}
- (void)closeVout
{
[super closeVout];
/* Don't close the window yet, wait a bit to see if a new input is poping up */
/* FIXME: Probably fade the window In and Out */
/* FIXME: fix core */
[o_embeddedwindow performSelector:@selector(orderOut:) withObject:nil afterDelay:3.];
[[[VLCMain sharedInstance] embeddedList] releaseEmbeddedVout: self];
}
- (void)enterFullscreen
{
/* Save settings */
[super enterFullscreen];
/* We are in a VLCEmbeddedWindow */
[o_embeddedwindow performSelectorOnMainThread: @selector(enterFullscreen) withObject: NULL waitUntilDone: YES];
}
- (void)leaveFullscreen
{
/* Save settings */
[super leaveFullscreen];
/* We are in a VLCEmbeddedWindow */
[o_embeddedwindow performSelectorOnMainThread: @selector(leaveFullscreen) withObject: NULL waitUntilDone: YES];
}
@end
/*****************************************************************************
* VLCVoutWindow implementation
*****************************************************************************/
@implementation VLCVoutWindow
- (id) initWithVout: (vout_thread_t *) vout view: (VLCVoutView *) view
frame: (NSRect *) frame
{
p_vout = vout;
o_view = view;
s_frame = frame;
b_init_ok = NO;
[self performSelectorOnMainThread: @selector(initMainThread:)
withObject: NULL waitUntilDone: YES];
return b_init_ok ? self : nil;
}
- (id)initMainThread: (id) sender
{
NSRect rect;
rect.size.height = p_vout->i_window_height;
rect.size.width = p_vout->i_window_width;
rect.origin.x = rect.origin.y = 70.;
if( self = [super initWithContentRect:rect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO])
{
[self setBackgroundColor:[NSColor blackColor]];
[self setHasShadow:YES];
[self setMovableByWindowBackground: YES];
[self center];
[self makeKeyAndOrderFront: self];
[self setReleasedWhenClosed: YES];
[self setFrameUsingName:@"VLCVoutWindowDetached"];
[self setFrameAutosaveName:@"VLCVoutWindowDetached"];
/* We'll catch mouse events */
[self makeFirstResponder: o_view];
[self setCanBecomeKeyWindow: YES];
[self setAcceptsMouseMovedEvents: YES];
[self setIgnoresMouseEvents: NO];
if( var_CreateGetBool( p_vout, "macosx-background" ) )
{
int i_device = var_GetInteger( p_vout->p_libvlc, "video-device" );
/* Find out on which screen to open the window */
NSScreen * screen = [NSScreen screenWithDisplayID: (CGDirectDisplayID)i_device];
if( !screen ) screen = [NSScreen mainScreen];
NSRect screen_rect = [screen frame];
screen_rect.origin.x = screen_rect.origin.y = 0;
/* Creates a window with size: screen_rect on o_screen */
[self setFrame: screen_rect display: NO];
[self setLevel: CGWindowLevelForKey(kCGDesktopWindowLevelKey)];
[self setMovableByWindowBackground: NO];
}
if( var_CreateGetBool( p_vout, "video-on-top" ) )
{
[self setLevel: NSStatusWindowLevel];
}
[self setAlphaValue: var_CreateGetFloat( p_vout, "macosx-opaqueness" )];
/* Add the view. It's automatically resized to fit the window */
[self setContentView: o_view];
b_init_ok = YES;
}
return self;
}
- (void)enterFullscreen
{
if( fullscreen ) return;
NSScreen *screen;
int i_device;
BOOL b_black = NO;
i_device = var_GetInteger( p_vout->p_libvlc, "video-device" );
b_black = var_CreateGetBool( p_vout, "macosx-black" );
/* Find out on which screen to open the window */
screen = [NSScreen screenWithDisplayID: (CGDirectDisplayID)i_device];
if( !screen ) screen = [self screen];
if( b_black )
[screen blackoutOtherScreens];
[self setMovableByWindowBackground: NO];
if( [screen isMainScreen] )
SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
initialFrame = [self frame];
[self setFrame:[screen frame] display:YES animate:YES];
[self setLevel:NSNormalWindowLevel];
/* tell the fspanel to move itself to front next time it's triggered */
[[[[VLCMain sharedInstance] controls] fspanel] setVoutWasUpdated: i_device];
[[[[VLCMain sharedInstance] controls] fspanel] setActive: nil];
fullscreen = YES;
}
- (void)leaveFullscreen
{
if( !fullscreen ) return;
fullscreen = NO;
[NSScreen unblackoutScreens];
[[[[VLCMain sharedInstance] controls] fspanel] setNonActive: nil];
SetSystemUIMode( kUIModeNormal, kUIOptionAutoShowMenuBar);
[self setFrame:initialFrame display:YES animate:YES];
[self setMovableByWindowBackground: YES];
if( var_GetBool( p_vout, "video-on-top" ) )
[self setLevel: NSStatusWindowLevel];
}
- (id)voutView
{
return o_view;
}
@end
#endif
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