- (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;
}
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 )
#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;
- (void) renewGState
{
NSWindow *window = [self window];
-
+
if ([window respondsToSelector:@selector(disableScreenUpdatesUntilFlush)])
{
[window disableScreenUpdatesUntilFlush];
}
-
+
[super renewGState];
}
{
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)
{
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;
}