X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fmacosx%2Fvoutgl.m;h=5f5f5e724f5234e903502dc7a574eb2edf6c1de1;hb=4a96b022ce862494a6bcacf3a868e1de7ad1e276;hp=c3283fcff8580ca434056c91e24ff973ffbd42dc;hpb=449fd28aaf007c6411251dae9d0dbfdc65b135d1;p=vlc diff --git a/modules/gui/macosx/voutgl.m b/modules/gui/macosx/voutgl.m index c3283fcff8..5f5f5e724f 100644 --- a/modules/gui/macosx/voutgl.m +++ b/modules/gui/macosx/voutgl.m @@ -52,7 +52,7 @@ vout_thread_t * p_vout; } -+ (void)resetVout: (vout_thread_t *) p_vout; ++ (void)resetVout: (NSValue *) voutValue; - (id) initWithVout: (vout_thread_t *) p_vout; @end @@ -96,7 +96,7 @@ static void aglSwap ( vout_thread_t * p_vout ); static int aglLock ( vout_thread_t * p_vout ); static void aglUnlock ( vout_thread_t * p_vout ); -int E_(OpenVideoGL) ( vlc_object_t * p_this ) +int OpenVideoGL ( vlc_object_t * p_this ) { vout_thread_t * p_vout = (vout_thread_t *) p_this; vlc_value_t value_drawable; @@ -104,17 +104,13 @@ int E_(OpenVideoGL) ( vlc_object_t * p_this ) if( !CGDisplayUsesOpenGLAcceleration( kCGDirectMainDisplay ) ) { msg_Warn( p_vout, "no OpenGL hardware acceleration found. " - "Video display will be slow" ); - return( 1 ); + "Video display might be slow" ); } msg_Dbg( p_vout, "display is Quartz Extreme accelerated" ); p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); if( p_vout->p_sys == NULL ) - { - msg_Err( p_vout, "out of memory" ); return( 1 ); - } memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) ); @@ -197,14 +193,17 @@ int E_(OpenVideoGL) ( vlc_object_t * p_this ) return VLC_SUCCESS; } -void E_(CloseVideoGL) ( vlc_object_t * p_this ) +void CloseVideoGL ( vlc_object_t * p_this ) { vout_thread_t * p_vout = (vout_thread_t *) p_this; + + msg_Dbg( p_this, "Closing" ); + if( p_vout->p_sys->b_embedded ) { aglDestroyContext(p_vout->p_sys->agl_ctx); } - else if(VLCIntf && !VLCIntf->b_die) + else if(VLCIntf && vlc_object_alive (VLCIntf)) { NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init]; @@ -257,7 +256,8 @@ static int Manage( vout_thread_t * p_vout ) p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE; } - [p_vout->p_sys->o_vout_view manage]; + if( p_vout->p_sys->o_vout_view ) + [p_vout->p_sys->o_vout_view manage]; return VLC_SUCCESS; } @@ -316,13 +316,16 @@ static void Unlock( vout_thread_t * p_vout ) [p_vout->p_sys->o_glview autorelease]; /* Spawn the window */ - p_vout->p_sys->o_vout_view = [VLCVoutView getVoutView: p_vout - subView: p_vout->p_sys->o_glview frame: nil]; + id old_vout = p_vout->p_sys->o_vout_view; + p_vout->p_sys->o_vout_view = [[VLCVoutView voutView: p_vout + subView: p_vout->p_sys->o_glview frame: nil] retain]; + [old_vout release]; } /* This function will reset the o_vout_view. It's useful to go fullscreen. */ -+ (void)resetVout:(vout_thread_t *) p_vout ++ (void)resetVout:(NSValue *) voutValue { + vout_thread_t * p_vout = [voutValue pointerValue]; if( p_vout->b_fullscreen ) { /* Save window size and position */ @@ -341,15 +344,18 @@ static void Unlock( vout_thread_t * p_vout ) if( p_vout->p_sys->b_saved_frame ) { - p_vout->p_sys->o_vout_view = [VLCVoutView getVoutView: p_vout - subView: o_glview - frame: &p_vout->p_sys->s_frame]; + id old_vout = p_vout->p_sys->o_vout_view; + p_vout->p_sys->o_vout_view = [[VLCVoutView voutView: p_vout + subView: o_glview + frame: &p_vout->p_sys->s_frame] retain]; + [old_vout release]; } else { - p_vout->p_sys->o_vout_view = [VLCVoutView getVoutView: p_vout - subView: o_glview frame: nil]; - + id old_vout = p_vout->p_sys->o_vout_view; + p_vout->p_sys->o_vout_view = [[VLCVoutView voutView: p_vout + subView: o_glview frame: nil] retain]; + [old_vout release]; } #undef o_glview } @@ -400,6 +406,11 @@ static void Unlock( vout_thread_t * p_vout ) return self; } +- (BOOL)mouseDownCanMoveWindow +{ + return YES; +} + - (void) reshape { int x, y;