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 @@
- (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. )
return proposedFrameSize;
NSRect viewRect = [o_view convertRect:[o_view bounds] toView: nil];
NSRect contentRect = [self contentRectForFrameRect:[self frame]];
float marginy = viewRect.origin.y + [self frame].size.height - contentRect.size.height;
float marginx = contentRect.size.width - viewRect.size.width;
proposedFrameSize.height = (proposedFrameSize.width - marginx) * videoRatio.height / videoRatio.width + marginy;
if( [[[VLCMain sharedInstance] controls] aspectRatioIsLocked] )
{
NSRect viewRect = [o_view convertRect:[o_view bounds] toView: nil];
NSRect contentRect = [self contentRectForFrameRect:[self frame]];
float marginy = viewRect.origin.y + [self frame].size.height - contentRect.size.height;
float marginx = contentRect.size.width - viewRect.size.width;
proposedFrameSize.height = (proposedFrameSize.width - marginx) * videoRatio.height / videoRatio.width + marginy;
}
return proposedFrameSize;
}
......
......@@ -146,7 +146,7 @@ int OpenVideoGL ( vlc_object_t * p_this )
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 )
......@@ -363,7 +363,7 @@ static void Unlock( vout_thread_t * p_vout )
#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;
......@@ -505,12 +505,12 @@ static void Unlock( vout_thread_t * p_vout )
- (void) renewGState
{
NSWindow *window = [self window];
if ([window respondsToSelector:@selector(disableScreenUpdatesUntilFlush)])
{
[window disableScreenUpdatesUntilFlush];
}
[super renewGState];
}
......@@ -530,7 +530,7 @@ static int aglInit( vout_thread_t * p_vout )
{
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);
......@@ -675,10 +675,10 @@ static int aglManage( vout_thread_t * p_vout )
{
/* Go into fullscreen */
Rect deviceRect;
GDHandle deviceHdl = GetMainDevice();
deviceRect = (*deviceHdl)->gdRect;
if( !p_vout->p_sys->theWindow )
{
/* Create a window */
......@@ -688,7 +688,7 @@ static int aglManage( vout_thread_t * p_vout )
| kWindowStandardHandlerAttribute
| kWindowLiveResizeAttribute
| kWindowNoShadowAttribute;
windowAttrs &= (~kWindowResizableAttribute);
CreateNewWindow(kDocumentWindowClass, windowAttrs, &deviceRect, &p_vout->p_sys->theWindow);
......@@ -698,14 +698,14 @@ static int aglManage( vout_thread_t * p_vout )
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 },
......@@ -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.bottom = va_arg( args, int);
clipBounds.right = va_arg( args, int);
if( !p_vout->b_fullscreen )
{
/*
......@@ -881,7 +881,7 @@ static pascal OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, Event
{
HICommand theHICommand;
GetEventParameter( event, kEventParamDirectObject, typeHICommand, NULL, sizeof( HICommand ), NULL, &theHICommand );
switch ( theHICommand.commandID )
{
default:
......@@ -892,7 +892,7 @@ static pascal OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, Event
{
WindowRef window;
Rect rectPort = {0,0,0,0};
GetEventParameter(event, kEventParamDirectObject, typeWindowRef, NULL, sizeof(WindowRef), NULL, &window);
if(window)
......@@ -906,7 +906,7 @@ static pascal OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, Event
case kEventWindowZoomed:
case kEventWindowBoundsChanged:
break;
default:
result = eventNotHandledErr;
}
......@@ -918,7 +918,7 @@ static pascal OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, Event
case kEventMouseDown:
{
UInt16 button;
GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button);
switch (button)
{
......@@ -958,7 +958,7 @@ static pascal OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, Event
case kEventMouseUp:
{
UInt16 button;
GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button);
switch (button)
{
......@@ -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);
GetEventParameter(event, kEventParamWindowMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &ml);
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;
}
......
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