/*****************************************************************************
* Preamble
*****************************************************************************/
-#include <errno.h> /* ENOMEM */
#include <stdlib.h> /* free() */
#include <string.h>
+#include <vlc_common.h>
#include <vlc_keys.h>
#include "intf.h"
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 ) )
{
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,
free( p_vout->p_sys );
return VLC_EGENERIC;
}
-
+
p_vout->p_sys->agl_ctx = aglCreateContext(pixFormat, NULL);
aglDestroyPixelFormat(pixFormat);
if( NULL == p_vout->p_sys->agl_ctx )
{
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];
[o_pool release];
}
-#endif
/* Clean up */
free( p_vout->p_sys );
}
#define o_glview p_vout->p_sys->o_glview
o_glview = [[VLCGLView alloc] initWithVout: p_vout];
[o_glview autorelease];
-
+
if( p_vout->p_sys->b_saved_frame )
{
id old_vout = p_vout->p_sys->o_vout_view;
Unlock( p_vout );
}
+- (void) renewGState
+{
+ NSWindow *window = [self window];
+
+ if ([window respondsToSelector:@selector(disableScreenUpdatesUntilFlush)])
+ {
+ [window disableScreenUpdatesUntilFlush];
+ }
+
+ [super renewGState];
+}
+
@end
/*****************************************************************************
{
Rect viewBounds;
Rect clipBounds;
-
+
p_vout->p_sys->agl_drawable = (AGLDrawable)
var_GetInteger( p_vout->p_libvlc, "drawable-agl" );
aglSetDrawable(p_vout->p_sys->agl_ctx, p_vout->p_sys->agl_drawable);
{
/* Go into fullscreen */
Rect deviceRect;
-
+
GDHandle deviceHdl = GetMainDevice();
deviceRect = (*deviceHdl)->gdRect;
-
+
if( !p_vout->p_sys->theWindow )
{
/* Create a window */
| kWindowStandardHandlerAttribute
| kWindowLiveResizeAttribute
| kWindowNoShadowAttribute;
-
+
windowAttrs &= (~kWindowResizableAttribute);
CreateNewWindow(kDocumentWindowClass, windowAttrs, &deviceRect, &p_vout->p_sys->theWindow);
SetWindowGroup(p_vout->p_sys->theWindow, p_vout->p_sys->winGroup);
SetWindowGroupParent( p_vout->p_sys->winGroup, GetWindowGroupOfClass(kDocumentWindowClass) ) ;
}
-
+
// Window title
CFStringRef titleKey = CFSTR("Fullscreen VLC media plugin");
CFStringRef windowTitle = CFCopyLocalizedString(titleKey, NULL);
SetWindowTitleWithCFString(p_vout->p_sys->theWindow, windowTitle);
CFRelease(titleKey);
CFRelease(windowTitle);
-
+
//Install event handler
static const EventTypeSpec win_events[] = {
{ kEventClassMouse, kEventMouseDown },
clipBounds.left = va_arg( args, int);
clipBounds.bottom = va_arg( args, int);
clipBounds.right = va_arg( args, int);
-
+
if( !p_vout->b_fullscreen )
{
/*
{
HICommand theHICommand;
GetEventParameter( event, kEventParamDirectObject, typeHICommand, NULL, sizeof( HICommand ), NULL, &theHICommand );
-
+
switch ( theHICommand.commandID )
{
default:
{
WindowRef window;
Rect rectPort = {0,0,0,0};
-
+
GetEventParameter(event, kEventParamDirectObject, typeWindowRef, NULL, sizeof(WindowRef), NULL, &window);
if(window)
case kEventWindowZoomed:
case kEventWindowBoundsChanged:
break;
-
+
default:
result = eventNotHandledErr;
}
case kEventMouseDown:
{
UInt16 button;
-
+
GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button);
switch (button)
{
case kEventMouseUp:
{
UInt16 button;
-
+
GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button);
switch (button)
{
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;
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;
}
-
+
default:
result = eventNotHandledErr;
}