Commit 6916c8d1 authored by Felix Paul Kühne's avatar Felix Paul Kühne

minimal-macosx: switch to ARC

parent 0d4616be
......@@ -39,7 +39,7 @@ libminimal_macosx_plugin_la_SOURCES = \
gui/minimal_macosx/misc.h gui/minimal_macosx/misc.m \
gui/minimal_macosx/VLCMinimalVoutWindow.h gui/minimal_macosx/VLCMinimalVoutWindow.m \
gui/minimal_macosx/macosx.c
libminimal_macosx_plugin_la_OBJCFLAGS = $(AM_OBJCFLAGS) -fobjc-exceptions
libminimal_macosx_plugin_la_OBJCFLAGS = $(AM_OBJCFLAGS) -fobjc-arc -fobjc-exceptions
libminimal_macosx_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(guidir)' -Wl,-framework,Cocoa
EXTRA_LTLIBRARIES += libminimal_macosx_plugin.la
gui_LTLIBRARIES += $(LTLIBminimal_macosx)
......
......@@ -92,14 +92,13 @@ extern OSErr CPSSetFrontProcess(CPSProcessSerNum *psn);
static void Run(intf_thread_t *p_intf)
{
CPSProcessSerNum PSN;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool {
[NSApplication sharedApplication];
if (!CPSGetCurrentProcess(&PSN))
if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
if (!CPSSetFrontProcess(&PSN))
[NSApplication sharedApplication];
[pool release];
}
}
/*****************************************************************************
......@@ -113,8 +112,7 @@ int WindowOpen(vout_window_t *p_wnd, const vout_window_cfg_t *cfg)
&& cfg->type != VOUT_WINDOW_TYPE_NSOBJECT)
return VLC_EGENERIC;
NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool {
NSRect proposedVideoViewPosition = NSMakeRect(cfg->x, cfg->y, cfg->width, cfg->height);
VLCMinimalVoutWindow *o_window = [[VLCMinimalVoutWindow alloc] initWithContentRect:proposedVideoViewPosition];
......@@ -122,23 +120,22 @@ int WindowOpen(vout_window_t *p_wnd, const vout_window_cfg_t *cfg)
if (!o_window) {
msg_Err(p_wnd, "window creation failed");
[o_pool release];
return VLC_EGENERIC;
}
msg_Dbg(p_wnd, "returning video window with proposed position x=%i, y=%i, width=%i, height=%i", cfg->x, cfg->y, cfg->width, cfg->height);
p_wnd->handle.nsobject = [o_window contentView];
p_wnd->handle.nsobject = (void *)CFBridgingRetain([o_window contentView]);
p_wnd->type = VOUT_WINDOW_TYPE_NSOBJECT;
p_wnd->control = WindowControl;
}
[o_pool release];
return VLC_SUCCESS;
}
static int WindowControl(vout_window_t *p_wnd, int i_query, va_list args)
{
NSWindow * o_window = [(id)p_wnd->handle.nsobject window];
NSWindow * o_window = [(__bridge id)p_wnd->handle.nsobject window];
if (!o_window) {
msg_Err(p_wnd, "failed to recover cocoa window");
return VLC_EGENERIC;
......@@ -155,29 +152,26 @@ static int WindowControl(vout_window_t *p_wnd, int i_query, va_list args)
}
case VOUT_WINDOW_SET_SIZE:
{
NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool {
NSRect theFrame = [o_window frame];
unsigned int i_width = va_arg(args, unsigned int);
unsigned int i_height = va_arg(args, unsigned int);
theFrame.size.width = i_width;
theFrame.size.height = i_height;
[o_window setFrame: theFrame display: YES animate: YES];
[o_pool release];
}
return VLC_SUCCESS;
}
case VOUT_WINDOW_SET_FULLSCREEN:
{
NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool {
int i_full = va_arg(args, int);
if (i_full)
[o_window performSelectorOnMainThread:@selector(enterFullscreen) withObject:nil waitUntilDone:NO];
else
[o_window performSelectorOnMainThread:@selector(leaveFullscreen) withObject:nil waitUntilDone:NO];
[o_pool release];
}
return VLC_SUCCESS;
}
default:
......@@ -188,12 +182,9 @@ static int WindowControl(vout_window_t *p_wnd, int i_query, va_list args)
void WindowClose(vout_window_t *p_wnd)
{
NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
NSWindow * o_window = [(id)p_wnd->handle.nsobject window];
@autoreleasepool {
NSWindow * o_window = [(__bridge id)p_wnd->handle.nsobject window];
if (o_window)
[o_window release];
[o_pool release];
o_window = nil;
}
}
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