Commit 57c73d74 authored by Felix Paul Kühne's avatar Felix Paul Kühne

legacy OS X intf: fixed locking the vout window's AR

parent 644bd843
...@@ -248,25 +248,17 @@ ...@@ -248,25 +248,17 @@
- (NSSize)windowWillResize:(NSWindow *)window toSize:(NSSize)proposedFrameSize - (NSSize)windowWillResize:(NSWindow *)window toSize:(NSSize)proposedFrameSize
{ {
NSView *playlist_area = [[o_vertical_split subviews] objectAtIndex:1];
NSRect newList = [playlist_area frame];
if( newList.size.height < 50 && newList.size.height > 0 ) {
[self togglePlaylist:self];
}
/* With no video open or with the playlist open the behavior is odd */
if( newList.size.height > 50 )
return proposedFrameSize;
if( videoRatio.height == 0. || videoRatio.width == 0. ) if( videoRatio.height == 0. || videoRatio.width == 0. )
return proposedFrameSize; return proposedFrameSize;
NSRect viewRect = [o_view convertRect:[o_view bounds] toView: nil]; if( [[[VLCMain sharedInstance] controls] aspectRatioIsLocked] )
NSRect contentRect = [self contentRectForFrameRect:[self frame]]; {
float marginy = viewRect.origin.y + [self frame].size.height - contentRect.size.height; NSRect viewRect = [o_view convertRect:[o_view bounds] toView: nil];
float marginx = contentRect.size.width - viewRect.size.width; NSRect contentRect = [self contentRectForFrameRect:[self frame]];
float marginy = viewRect.origin.y + [self frame].size.height - contentRect.size.height;
proposedFrameSize.height = (proposedFrameSize.width - marginx) * videoRatio.height / videoRatio.width + marginy; float marginx = contentRect.size.width - viewRect.size.width;
proposedFrameSize.height = (proposedFrameSize.width - marginx) * videoRatio.height / videoRatio.width + marginy;
}
return proposedFrameSize; return proposedFrameSize;
} }
......
...@@ -146,7 +146,7 @@ int OpenVideoGL ( vlc_object_t * p_this ) ...@@ -146,7 +146,7 @@ int OpenVideoGL ( vlc_object_t * p_this )
free( p_vout->p_sys ); free( p_vout->p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
p_vout->p_sys->agl_ctx = aglCreateContext(pixFormat, NULL); p_vout->p_sys->agl_ctx = aglCreateContext(pixFormat, NULL);
aglDestroyPixelFormat(pixFormat); aglDestroyPixelFormat(pixFormat);
if( NULL == p_vout->p_sys->agl_ctx ) if( NULL == p_vout->p_sys->agl_ctx )
...@@ -363,7 +363,7 @@ static void Unlock( vout_thread_t * p_vout ) ...@@ -363,7 +363,7 @@ static void Unlock( vout_thread_t * p_vout )
#define o_glview p_vout->p_sys->o_glview #define o_glview p_vout->p_sys->o_glview
o_glview = [[VLCGLView alloc] initWithVout: p_vout]; o_glview = [[VLCGLView alloc] initWithVout: p_vout];
[o_glview autorelease]; [o_glview autorelease];
if( p_vout->p_sys->b_saved_frame ) if( p_vout->p_sys->b_saved_frame )
{ {
id old_vout = p_vout->p_sys->o_vout_view; id old_vout = p_vout->p_sys->o_vout_view;
...@@ -505,12 +505,12 @@ static void Unlock( vout_thread_t * p_vout ) ...@@ -505,12 +505,12 @@ static void Unlock( vout_thread_t * p_vout )
- (void) renewGState - (void) renewGState
{ {
NSWindow *window = [self window]; NSWindow *window = [self window];
if ([window respondsToSelector:@selector(disableScreenUpdatesUntilFlush)]) if ([window respondsToSelector:@selector(disableScreenUpdatesUntilFlush)])
{ {
[window disableScreenUpdatesUntilFlush]; [window disableScreenUpdatesUntilFlush];
} }
[super renewGState]; [super renewGState];
} }
...@@ -530,7 +530,7 @@ static int aglInit( vout_thread_t * p_vout ) ...@@ -530,7 +530,7 @@ static int aglInit( vout_thread_t * p_vout )
{ {
Rect viewBounds; Rect viewBounds;
Rect clipBounds; Rect clipBounds;
p_vout->p_sys->agl_drawable = (AGLDrawable) p_vout->p_sys->agl_drawable = (AGLDrawable)
var_GetInteger( p_vout->p_libvlc, "drawable-agl" ); var_GetInteger( p_vout->p_libvlc, "drawable-agl" );
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);
...@@ -675,10 +675,10 @@ static int aglManage( vout_thread_t * p_vout ) ...@@ -675,10 +675,10 @@ static int aglManage( vout_thread_t * p_vout )
{ {
/* Go into fullscreen */ /* Go into fullscreen */
Rect deviceRect; Rect deviceRect;
GDHandle deviceHdl = GetMainDevice(); GDHandle deviceHdl = GetMainDevice();
deviceRect = (*deviceHdl)->gdRect; deviceRect = (*deviceHdl)->gdRect;
if( !p_vout->p_sys->theWindow ) if( !p_vout->p_sys->theWindow )
{ {
/* Create a window */ /* Create a window */
...@@ -688,7 +688,7 @@ static int aglManage( vout_thread_t * p_vout ) ...@@ -688,7 +688,7 @@ static int aglManage( vout_thread_t * p_vout )
| kWindowStandardHandlerAttribute | kWindowStandardHandlerAttribute
| kWindowLiveResizeAttribute | kWindowLiveResizeAttribute
| kWindowNoShadowAttribute; | kWindowNoShadowAttribute;
windowAttrs &= (~kWindowResizableAttribute); windowAttrs &= (~kWindowResizableAttribute);
CreateNewWindow(kDocumentWindowClass, windowAttrs, &deviceRect, &p_vout->p_sys->theWindow); CreateNewWindow(kDocumentWindowClass, windowAttrs, &deviceRect, &p_vout->p_sys->theWindow);
...@@ -698,14 +698,14 @@ static int aglManage( vout_thread_t * p_vout ) ...@@ -698,14 +698,14 @@ static int aglManage( vout_thread_t * p_vout )
SetWindowGroup(p_vout->p_sys->theWindow, p_vout->p_sys->winGroup); SetWindowGroup(p_vout->p_sys->theWindow, p_vout->p_sys->winGroup);
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
static const EventTypeSpec win_events[] = { static const EventTypeSpec win_events[] = {
{ kEventClassMouse, kEventMouseDown }, { kEventClassMouse, kEventMouseDown },
...@@ -762,7 +762,7 @@ static int aglControl( vout_thread_t *p_vout, int i_query, va_list args ) ...@@ -762,7 +762,7 @@ static int aglControl( vout_thread_t *p_vout, int i_query, va_list args )
clipBounds.left = va_arg( args, int); clipBounds.left = va_arg( args, int);
clipBounds.bottom = va_arg( args, int); clipBounds.bottom = va_arg( args, int);
clipBounds.right = va_arg( args, int); clipBounds.right = va_arg( args, int);
if( !p_vout->b_fullscreen ) if( !p_vout->b_fullscreen )
{ {
/* /*
...@@ -881,7 +881,7 @@ static pascal OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, Event ...@@ -881,7 +881,7 @@ static pascal OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, Event
{ {
HICommand theHICommand; HICommand theHICommand;
GetEventParameter( event, kEventParamDirectObject, typeHICommand, NULL, sizeof( HICommand ), NULL, &theHICommand ); GetEventParameter( event, kEventParamDirectObject, typeHICommand, NULL, sizeof( HICommand ), NULL, &theHICommand );
switch ( theHICommand.commandID ) switch ( theHICommand.commandID )
{ {
default: default:
...@@ -892,7 +892,7 @@ static pascal OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, Event ...@@ -892,7 +892,7 @@ static pascal OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, Event
{ {
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)
...@@ -906,7 +906,7 @@ static pascal OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, Event ...@@ -906,7 +906,7 @@ static pascal OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, Event
case kEventWindowZoomed: case kEventWindowZoomed:
case kEventWindowBoundsChanged: case kEventWindowBoundsChanged:
break; break;
default: default:
result = eventNotHandledErr; result = eventNotHandledErr;
} }
...@@ -918,7 +918,7 @@ static pascal OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, Event ...@@ -918,7 +918,7 @@ static pascal OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, Event
case kEventMouseDown: case kEventMouseDown:
{ {
UInt16 button; UInt16 button;
GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button); GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button);
switch (button) switch (button)
{ {
...@@ -958,7 +958,7 @@ static pascal OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, Event ...@@ -958,7 +958,7 @@ static pascal OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, Event
case kEventMouseUp: case kEventMouseUp:
{ {
UInt16 button; UInt16 button;
GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button); GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button);
switch (button) switch (button)
{ {
...@@ -1024,13 +1024,13 @@ static pascal OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, Event ...@@ -1024,13 +1024,13 @@ static pascal OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, Event
vout_PlacePicture(p_vout, i_width, i_height, &i_x, &i_y, &i_width, &i_height); 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); GetEventParameter(event, kEventParamWindowMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &ml);
x = (((int)ml.h) - i_x) * p_vout->render.i_width / i_width; 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; y = (((int)ml.v) - i_y) * p_vout->render.i_height / i_height;
var_SetCoords( p_vout, "mouse-moved", x, y ); var_SetCoords( p_vout, "mouse-moved", x, y );
break; break;
} }
default: default:
result = eventNotHandledErr; result = eventNotHandledErr;
} }
......
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