Commit 4da94b39 authored by Damien Fouilleul's avatar Damien Fouilleul

voutgl.m: hopefully, a stable Fullscreen mode for mozilla plugin, mouse...

voutgl.m: hopefully, a stable Fullscreen mode for mozilla plugin, mouse double-click to toggle b/w windowed/fullscreen now works
parent 8b79d0d3
...@@ -574,7 +574,6 @@ static int aglManage( vout_thread_t * p_vout ) ...@@ -574,7 +574,6 @@ static int aglManage( vout_thread_t * p_vout )
SetSystemUIMode( kUIModeNormal, 0); SetSystemUIMode( kUIModeNormal, 0);
//CGDisplayShowCursor(kCGDirectMainDisplay); //CGDisplayShowCursor(kCGDirectMainDisplay);
//DisposeWindow( p_vout->p_sys->theWindow ); //DisposeWindow( p_vout->p_sys->theWindow );
} }
else else
{ {
...@@ -612,12 +611,13 @@ static int aglManage( vout_thread_t * p_vout ) ...@@ -612,12 +611,13 @@ static int aglManage( vout_thread_t * p_vout )
CFRelease(windowTitle); CFRelease(windowTitle);
//Install event handler //Install event handler
const EventTypeSpec win_events[] = { static const EventTypeSpec win_events[] = {
{ kEventClassMouse, kEventMouseUp },
{ kEventClassWindow, kEventWindowClosed }, { kEventClassWindow, kEventWindowClosed },
{ kEventClassWindow, kEventWindowBoundsChanged }, { kEventClassWindow, kEventWindowBoundsChanged },
{ kEventClassCommand, kEventCommandProcess } { kEventClassCommand, kEventCommandProcess }
}; };
InstallWindowEventHandler (p_vout->p_sys->theWindow, NewEventHandlerUPP (WindowEventHandler), GetEventTypeCount(win_events), win_events, p_vout->p_sys->theWindow, NULL); InstallWindowEventHandler (p_vout->p_sys->theWindow, NewEventHandlerUPP (WindowEventHandler), GetEventTypeCount(win_events), win_events, p_vout, NULL);
ShowWindow (p_vout->p_sys->theWindow); ShowWindow (p_vout->p_sys->theWindow);
glClear( GL_COLOR_BUFFER_BIT ); glClear( GL_COLOR_BUFFER_BIT );
...@@ -625,9 +625,10 @@ static int aglManage( vout_thread_t * p_vout ) ...@@ -625,9 +625,10 @@ static int aglManage( vout_thread_t * p_vout )
aglSetDrawable(p_vout->p_sys->agl_ctx, p_vout->p_sys->agl_drawable); aglSetDrawable(p_vout->p_sys->agl_ctx, p_vout->p_sys->agl_drawable);
aglSetCurrentContext(p_vout->p_sys->agl_ctx); aglSetCurrentContext(p_vout->p_sys->agl_ctx);
aglSetViewport(p_vout, deviceRect, deviceRect); aglSetViewport(p_vout, deviceRect, deviceRect);
//aglSetFullScreen(p_vout->p_sys->agl_ctx, device_width, device_height, 0, 0);
SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar); SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
//CGDisplayHideCursor(kCGDirectMainDisplay); CGDisplayHideCursor(kCGDirectMainDisplay);
} }
p_vout->b_fullscreen = !p_vout->b_fullscreen; p_vout->b_fullscreen = !p_vout->b_fullscreen;
p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE; p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
...@@ -722,13 +723,14 @@ static void aglSetViewport( vout_thread_t *p_vout, Rect viewBounds, Rect clipBou ...@@ -722,13 +723,14 @@ static void aglSetViewport( vout_thread_t *p_vout, Rect viewBounds, Rect clipBou
} }
//default window event handler //default window event handler
static OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData) static pascal OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData)
{ {
OSStatus result = noErr; OSStatus result = noErr;
uint32_t d_width; uint32_t d_width;
uint32_t d_height; uint32_t d_height;
UInt32 class = GetEventClass (event); UInt32 class = GetEventClass (event);
UInt32 kind = GetEventKind (event); UInt32 kind = GetEventKind (event);
vout_thread_t *p_vout = (vout_thread_t *)userData;
result = CallNextEventHandler(nextHandler, event); result = CallNextEventHandler(nextHandler, event);
if(class == kEventClassCommand) if(class == kEventClassCommand)
...@@ -738,7 +740,6 @@ static OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, EventRef eve ...@@ -738,7 +740,6 @@ static OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, EventRef eve
switch ( theHICommand.commandID ) switch ( theHICommand.commandID )
{ {
default: default:
result = eventNotHandledErr; result = eventNotHandledErr;
break; break;
...@@ -768,6 +769,40 @@ static OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, EventRef eve ...@@ -768,6 +769,40 @@ static OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, EventRef eve
break; break;
} }
} }
else if(class == kEventClassMouse)
{
UInt16 button;
switch (kind)
{
case kEventMouseUp:
GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button);
switch (button)
{
case kEventMouseButtonPrimary:
{
UInt32 clickCount = 0;
GetEventParameter(event, kEventParamClickCount, typeUInt32, NULL, sizeof(clickCount), NULL, &clickCount);
if( clickCount > 1 )
{
vlc_value_t val;
val.b_bool = VLC_FALSE;
var_Set((vout_thread_t *) p_vout->p_parent, "fullscreen", val);
}
break;
}
default:
result = eventNotHandledErr;
break;
}
break;
default:
result = eventNotHandledErr;
break;
}
}
return result; return result;
} }
......
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