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
...@@ -569,17 +569,16 @@ static int aglManage( vout_thread_t * p_vout ) ...@@ -569,17 +569,16 @@ static int aglManage( vout_thread_t * p_vout )
aglSetCurrentContext(p_vout->p_sys->agl_ctx); aglSetCurrentContext(p_vout->p_sys->agl_ctx);
aglSetViewport(p_vout, viewBounds, clipBounds); aglSetViewport(p_vout, viewBounds, clipBounds);
HideWindow (p_vout->p_sys->theWindow); HideWindow (p_vout->p_sys->theWindow);
SetSystemUIMode( kUIModeNormal, 0); SetSystemUIMode( kUIModeNormal, 0);
//CGDisplayShowCursor(kCGDirectMainDisplay); //CGDisplayShowCursor(kCGDirectMainDisplay);
//DisposeWindow( p_vout->p_sys->theWindow ); //DisposeWindow( p_vout->p_sys->theWindow );
} }
else else
{ {
/* Create a window */ /* Create a window */
WindowAttributes windowAttrs; WindowAttributes windowAttrs;
Rect deviceRect; Rect deviceRect;
Rect viewBounds; Rect viewBounds;
Rect clipBounds; Rect clipBounds;
...@@ -590,10 +589,10 @@ static int aglManage( vout_thread_t * p_vout ) ...@@ -590,10 +589,10 @@ static int aglManage( vout_thread_t * p_vout )
int device_height = deviceRect.bottom-deviceRect.top; int device_height = deviceRect.bottom-deviceRect.top;
windowAttrs = kWindowStandardDocumentAttributes windowAttrs = kWindowStandardDocumentAttributes
| kWindowStandardHandlerAttribute | kWindowStandardHandlerAttribute
| kWindowLiveResizeAttribute | kWindowLiveResizeAttribute
| kWindowNoShadowAttribute; | kWindowNoShadowAttribute;
windowAttrs &= (~kWindowResizableAttribute); windowAttrs &= (~kWindowResizableAttribute);
if( !p_vout->p_sys->theWindow ) CreateNewWindow(kDocumentWindowClass, windowAttrs, &deviceRect, &p_vout->p_sys->theWindow); if( !p_vout->p_sys->theWindow ) CreateNewWindow(kDocumentWindowClass, windowAttrs, &deviceRect, &p_vout->p_sys->theWindow);
...@@ -605,19 +604,20 @@ static int aglManage( vout_thread_t * p_vout ) ...@@ -605,19 +604,20 @@ static int aglManage( vout_thread_t * p_vout )
SetWindowGroupParent( p_vout->p_sys->winGroup, GetWindowGroupOfClass(kDocumentWindowClass) ) ; SetWindowGroupParent( p_vout->p_sys->winGroup, GetWindowGroupOfClass(kDocumentWindowClass) ) ;
// Window title // Window title
CFStringRef titleKey = CFSTR("Fullscreen VLC media plugin"); CFStringRef titleKey = CFSTR("Fullscreen VLC media plugin");
CFStringRef windowTitle = CFCopyLocalizedString(titleKey, NULL); CFStringRef windowTitle = CFCopyLocalizedString(titleKey, NULL);
SetWindowTitleWithCFString(p_vout->p_sys->theWindow, windowTitle); SetWindowTitleWithCFString(p_vout->p_sys->theWindow, windowTitle);
CFRelease(titleKey); CFRelease(titleKey);
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,53 +723,87 @@ static void aglSetViewport( vout_thread_t *p_vout, Rect viewBounds, Rect clipBou ...@@ -722,53 +723,87 @@ 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);
if(class == kEventClassCommand) result = CallNextEventHandler(nextHandler, event);
{ if(class == kEventClassCommand)
HICommand theHICommand; {
GetEventParameter( event, kEventParamDirectObject, typeHICommand, NULL, sizeof( HICommand ), NULL, &theHICommand ); HICommand theHICommand;
GetEventParameter( event, kEventParamDirectObject, typeHICommand, NULL, sizeof( HICommand ), NULL, &theHICommand );
switch ( theHICommand.commandID )
{ switch ( theHICommand.commandID )
{
default: default:
result = eventNotHandledErr; result = eventNotHandledErr;
break; break;
} }
} }
else if(class == kEventClassWindow) else if(class == kEventClassWindow)
{ {
WindowRef window; WindowRef window;
Rect rectPort = {0,0,0,0}; Rect rectPort = {0,0,0,0};
GetEventParameter(event, kEventParamDirectObject, typeWindowRef, NULL, sizeof(WindowRef), NULL, &window); GetEventParameter(event, kEventParamDirectObject, typeWindowRef, NULL, sizeof(WindowRef), NULL, &window);
if(window) if(window)
{ {
GetPortBounds(GetWindowPort(window), &rectPort); GetPortBounds(GetWindowPort(window), &rectPort);
} }
switch (kind) switch (kind)
{ {
case kEventWindowClosed: case kEventWindowClosed:
case kEventWindowZoomed: case kEventWindowZoomed:
case kEventWindowBoundsChanged: case kEventWindowBoundsChanged:
break; break;
default: default:
result = eventNotHandledErr; result = eventNotHandledErr;
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