X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fmacosx%2Fvoutgl.m;h=7319374e27c82510c401de42a1a245aa068dd117;hb=dcd592840d22bc93d287c9edbba72625746d1096;hp=7f88fe2b34ae0d012ab6672ed296b5fb8179e28e;hpb=89b6530d8abd99b96b9f33af022022241fe97ee2;p=vlc diff --git a/modules/gui/macosx/voutgl.m b/modules/gui/macosx/voutgl.m index 7f88fe2b34..7319374e27 100644 --- a/modules/gui/macosx/voutgl.m +++ b/modules/gui/macosx/voutgl.m @@ -30,10 +30,10 @@ /***************************************************************************** * Preamble *****************************************************************************/ -#include /* ENOMEM */ #include /* free() */ #include +#include #include #include "intf.h" @@ -103,7 +103,6 @@ static void aglUnlock ( vout_thread_t * p_vout ); int OpenVideoGL ( vlc_object_t * p_this ) { vout_thread_t * p_vout = (vout_thread_t *) p_this; - vlc_value_t value_drawable; if( !CGDisplayUsesOpenGLAcceleration( kCGDirectMainDisplay ) ) { @@ -119,8 +118,9 @@ int OpenVideoGL ( vlc_object_t * p_this ) memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) ); #ifndef __x86_64__ - var_Get( p_vout->p_libvlc, "drawable-agl", &value_drawable ); - if( value_drawable.i_int != 0 ) + int i_drawable_agl; + i_drawable_agl = var_GetInteger( p_vout->p_libvlc, "drawable-agl" ); + if( i_drawable_agl > 0 ) { static const GLint ATTRIBUTES[] = { AGL_WINDOW, @@ -208,41 +208,26 @@ void CloseVideoGL ( vlc_object_t * p_this ) { vout_thread_t * p_vout = (vout_thread_t *) p_this; - msg_Dbg( p_this, "Closing" ); #ifndef __x86_64__ - /* If the fullscreen window is still open, close it */ - if( p_vout->b_fullscreen ) + if( p_vout->p_sys->b_embedded ) { - p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE; - if( p_vout->p_sys->b_embedded ) + /* If the fullscreen window is still open, close it */ + if( p_vout->b_fullscreen ) { + p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE; aglManage( p_vout ); var_SetBool( p_vout->p_parent, "fullscreen", false ); } - else - Manage( p_vout ); - } - - if( p_vout->p_sys->b_embedded ) - { if( p_vout->p_sys->agl_ctx ) { aglEnd( p_vout ); aglDestroyContext(p_vout->p_sys->agl_ctx); } } - else if(VLCIntf && vlc_object_alive (VLCIntf)) - { - NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init]; - - /* Close the window */ - [p_vout->p_sys->o_vout_view performSelectorOnMainThread:@selector(closeVout) withObject:NULL waitUntilDone:YES]; - - [o_pool release]; - } -#else - if(VLCIntf && vlc_object_alive (VLCIntf)) + else +#endif + if(VLCIntf && vlc_object_alive (VLCIntf)) { NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init]; @@ -251,7 +236,6 @@ void CloseVideoGL ( vlc_object_t * p_this ) [o_pool release]; } -#endif /* Clean up */ free( p_vout->p_sys ); } @@ -518,6 +502,18 @@ static void Unlock( vout_thread_t * p_vout ) Unlock( p_vout ); } +- (void) renewGState +{ + NSWindow *window = [self window]; + + if ([window respondsToSelector:@selector(disableScreenUpdatesUntilFlush)]) + { + [window disableScreenUpdatesUntilFlush]; + } + + [super renewGState]; +} + @end /***************************************************************************** @@ -980,8 +976,10 @@ static pascal OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, Event else { vlc_value_t val; + int x, y; - var_SetBool( p_vout, "mouse-clicked", true ); + 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; @@ -1021,23 +1019,15 @@ static pascal OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, Event unsigned int i_x, i_y; unsigned int i_height = p_vout->p_sys->i_height; unsigned int i_width = p_vout->p_sys->i_width; + int x, y; vout_PlacePicture(p_vout, i_width, i_height, &i_x, &i_y, &i_width, &i_height); GetEventParameter(event, kEventParamWindowMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &ml); - val.i_int = ( ((int)ml.h) - i_x ) * - p_vout->render.i_width / i_width; - var_Set( p_vout, "mouse-x", val ); - - val.i_int = ( ((int)ml.v) - i_y ) * - p_vout->render.i_height / i_height; - - var_Set( p_vout, "mouse-y", val ); - - val.b_bool = true; - var_Set( p_vout, "mouse-moved", val ); - + x = (((int)ml.h) - i_x) * p_vout->render.i_width / i_width; + y = (((int)ml.v) - i_y) * p_vout->render.i_height / i_height; + var_SetCoords( p_vout, "mouse-moved", x, y ); break; }