@interface VLCMinimalVoutWindow : NSWindow
{
- NSRect rect;
+ NSRect initialFrame;
+ NSPoint initialLocation, initialLocationOnScreen;
+ BOOL fullscreen;
+ BOOL mouseDraggedShouldResize;
}
- (id)initWithContentRect:(NSRect)contentRect;
{
if( self = [super initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO])
{
- rect = contentRect;
+ initialFrame = contentRect;
+ fullscreen = NO;
[self setBackgroundColor:[NSColor blackColor]];
+ [self setHasShadow:YES];
[self setMovableByWindowBackground: YES];
+ [self center];
}
return self;
}
+
+/* @protocol VLCOpenGLVoutEmbedding */
- (void)addVoutSubview:(NSView *)view
{
+ [view setAutoresizingMask:NSViewHeightSizable|NSViewWidthSizable];
[[self contentView] addSubview:view];
[view setFrame:[[self contentView] bounds]];
}
- (void)enterFullscreen
{
+ fullscreen = YES;
+ initialFrame = [self frame];
SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
- [self setFrame:[[self screen] frame] display: YES];
+ [self setFrame:[[self screen] frame] display:YES animate:YES];
}
- (void)leaveFullscreen
{
+ fullscreen = NO;
SetSystemUIMode( kUIModeNormal, kUIOptionAutoShowMenuBar);
- [self setFrame:rect display: YES];
+ [self setFrame:initialFrame display:YES animate:YES];
}
- (BOOL)stretchesVideo
var_Create( p_vout, "drawable", VLC_VAR_DOINHERIT );
var_Get( p_vout, "drawable", &value_drawable );
+ p_vout->p_sys->o_pool = [[NSAutoreleasePool alloc] init];
+
o_cocoaglview_container = (id) value_drawable.i_int;
if (!o_cocoaglview_container)
{
msg_Warn( p_vout, "No drawable!, spawing a window" );
- o_cocoaglview_container = [[VLCMinimalVoutWindow alloc] initWithContentRect: NSMakeRect( 0, 0, 200, 200 )];
}
p_vout->p_sys->b_embedded = VLC_FALSE;
- p_vout->p_sys->o_pool = [[NSAutoreleasePool alloc] init];
/* Create the GL view */
struct args { vout_thread_t * p_vout; id <VLCOpenGLVoutEmbedding> container; } args = { p_vout, o_cocoaglview_container };
if( [(id)o_cocoaglview_container respondsToSelector:@selector(removeVoutSubview:)] )
[o_cocoaglview_container removeVoutSubview: p_vout->p_sys->o_glview];
+ [p_vout->p_sys->o_glview release];
+
[p_vout->p_sys->o_pool release];
}
* vout_thread_t. Must be called from main thread. */
+ (void) autoinitOpenGLVoutViewIntVoutWithContainer: (NSData *) argsAsData
{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
struct args { vout_thread_t * p_vout; id <VLCOpenGLVoutEmbedding> container; } *
args = (struct args *)[argsAsData bytes];
VLCOpenGLVoutView * oglview;
+ if( !args->container )
+ {
+ args->container = [[VLCMinimalVoutWindow alloc] initWithContentRect: NSMakeRect( 0, 0, args->p_vout->i_window_width, args->p_vout->i_window_height )];
+ [(VLCMinimalVoutWindow *)args->container makeKeyAndOrderFront: nil];
+ }
oglview = [[VLCOpenGLVoutView alloc] initWithVout: args->p_vout container: args->container];
- args->p_vout->p_sys->o_glview = [oglview autorelease];
-
+ args->p_vout->p_sys->o_glview = oglview;
[args->container addVoutSubview: oglview];
+
+ [pool release];
}
- (void)dealloc
CGLUnlockContext([[p_vout->p_sys->o_glview openGLContext] CGLContextObj]);
}
+- (BOOL)mouseDownCanMoveWindow
+{
+ return YES;
+}
@end
*****************************************************************************/
struct intf_sys_t
{
- NSAutoreleasePool * o_pool;
+ int nothing_for_now;
};
memset( p_intf->p_sys, 0, sizeof( *p_intf->p_sys ) );
- p_intf->p_sys->o_pool = [[NSAutoreleasePool alloc] init];
-
- p_intf->b_play = VLC_TRUE;
p_intf->pf_run = Run;
- return( 0 );
+ return VLC_SUCCESS;
}
/*****************************************************************************
free( p_intf->p_sys );
}
+/* Dock Connection */
+typedef struct CPSProcessSerNum
+{
+ UInt32 lo;
+ UInt32 hi;
+} CPSProcessSerNum;
+
+extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn);
+extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
+extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn);
+
/*****************************************************************************
* Run: main loop
*****************************************************************************/
sigemptyset( &set );
sigaddset( &set, SIGTERM );
pthread_sigmask( SIG_UNBLOCK, &set, NULL );
-
+ CPSProcessSerNum PSN;
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ [NSApplication sharedApplication];
+ if (!CPSGetCurrentProcess(&PSN))
+ if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
+ if (!CPSSetFrontProcess(&PSN))
+ [NSApplication sharedApplication];
[NSApp run];
+ [pool release];
}
vlc_module_begin();
/* Minimal interface. see intf.m */
+ set_shortname( _( "minimal_macosx" ));
set_description( _("Mac OS X minimal interface") );
- set_capability( "interface", 50 );
+ set_capability( "interface", 110 );
set_callbacks( E_(OpenIntf), E_(CloseIntf) );
set_category( CAT_INTERFACE );
set_subcategory( SUBCAT_INTERFACE_MAIN );
add_submodule();
/* Will be loaded even without interface module. see voutgl.m */
set_description( "Mac OS X minimal OpenGL video output (opens a borderless window)" );
- set_capability( "opengl provider", 50 );
+ set_capability( "opengl provider", 110 );
set_category( CAT_VIDEO);
set_subcategory( SUBCAT_VIDEO_VOUT );
set_callbacks( E_(OpenVideoGL), E_(CloseVideoGL) );