o_img_pause = [NSImage imageNamed: @"pause_embedded"];
o_img_pause_pressed = [NSImage imageNamed: @"pause_embedded_blue"];
- o_saved_frame = NSMakeRect( 0.0f, 0.0f, 0.0f, 0.0f );
-
/* Useful to save o_view frame in fullscreen mode */
o_temp_view = [[NSView alloc] init];
[o_temp_view setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];
[o_slider setEnabled: b_seekable];
}
-- (void)zoom:(id)sender
+- (BOOL)windowShouldZoom:(NSWindow *)sender toFrame:(NSRect)newFrame
{
- if( ![self isZoomed] )
- {
- NSRect zoomRect = [[self screen] frame];
- o_saved_frame = [self frame];
- /* we don't have to take care of the eventual menu bar and dock
- as zoomRect will be cropped automatically by setFrame:display:
- to the right rectangle */
- [self setFrame: zoomRect display: YES animate: YES];
- }
- else
- {
- /* unzoom to the saved_frame if the o_saved_frame coords look sound
- (just in case) */
- if( o_saved_frame.size.width > 0 && o_saved_frame.size.height > 0 )
- [self setFrame: o_saved_frame display: YES animate: YES];
- }
+ [self setFrame: newFrame display: YES animate: YES];
+ return YES;
}
- (BOOL)windowShouldClose:(id)sender
screen = [NSScreen screenWithDisplayID:(CGDirectDisplayID)var_GetInteger( p_vout, "video-device" )];
vlc_object_release( p_vout );
-
+
[self lockFullscreenAnimation];
- /* This is a recursive lock. If we are already in the middle of an animation we
- * unlock it. We don't add an extra locking here, because enter/leavefullscreen
- * are executed always in the same thread */
- if (b_animation_lock_alreadylocked)
- [self unlockFullscreenAnimation];
- b_animation_lock_alreadylocked = YES;
-
if (!screen)
screen = [self screen];
[o_btn_fullscreen setState: YES];
[NSCursor setHiddenUntilMouseMoves: YES];
-
+
if (blackout_other_displays)
[screen blackoutOtherScreens]; /* We should do something like [screen blackoutOtherScreens]; */
* Mac OS X <10.4 which doesn't support NSAnimation, instead we
* simply fade the display */
CGDisplayFadeReservationToken token;
-
+
[o_fullscreen_window setFrame:screen_rect display:NO];
-
+
CGAcquireDisplayFadeReservation(kCGMaxDisplayReservationInterval, &token);
CGDisplayFade( token, 0.3, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0, 0, 0, YES );
-
+
if ([screen isMainScreen])
SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
-
+
[[self contentView] replaceSubview:o_view with:o_temp_view];
[o_temp_view setFrame:[o_view frame]];
[o_fullscreen_window setContentView:o_view];
return;
}
-
+
/* Make sure we don't see the o_view disappearing of the screen during this operation */
DisableScreenUpdates();
[[self contentView] replaceSubview:o_view with:o_temp_view];
{
/* We were already fullscreen nothing to do when NSAnimation
* is not supported */
- [self unlockFullscreenAnimation];
b_animation_lock_alreadylocked = NO;
+ [self unlockFullscreenAnimation];
return;
}
/* We are in fullscreen (and no animation is running) */
if (b_fullscreen)
{
- [self unlockFullscreenAnimation];
+ /* Make sure we are hidden */
+ [super orderOut: self];
b_animation_lock_alreadylocked = NO;
+ [self unlockFullscreenAnimation];
return;
}
[o_fullscreen_anim2 release];
}
+ /* This is a recursive lock. If we are already in the middle of an animation we
+ * unlock it. We don't add an extra locking here, because enter/leavefullscreen
+ * are executed always in the same thread */
+ if (b_animation_lock_alreadylocked)
+ [self unlockFullscreenAnimation];
+ b_animation_lock_alreadylocked = YES;
+
if ([screen isMainScreen])
SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
/* tell the fspanel to move itself to front next time it's triggered */
[[[[VLCMain sharedInstance] getControls] getFSPanel] setVoutWasUpdated: (int)[[o_fullscreen_window screen] displayID]];
-
+
+ [super orderOut: self];
+
[[[[VLCMain sharedInstance] getControls] getFSPanel] setActive: nil];
b_fullscreen = YES;
[self unlockFullscreenAnimation];
}
- (void)leaveFullscreen
+{
+ [self leaveFullscreenAndFadeOut: NO];
+}
+
+- (void)leaveFullscreenAndFadeOut: (BOOL)fadeout
{
NSMutableDictionary *dict1, *dict2;
NSRect frame;
[self lockFullscreenAnimation];
- /* This is a recursive lock. If we are already in the middle of an animation we
- * unlock it. We don't add an extra locking here, because enter/leavefullscreen
- * are executed always in the same thread */
- if (b_animation_lock_alreadylocked)
- [self unlockFullscreenAnimation];
- b_animation_lock_alreadylocked = YES;
-
b_fullscreen = NO;
[o_btn_fullscreen setState: NO];
/* Don't do anything if o_fullscreen_window is already closed */
if (!o_fullscreen_window)
{
- [self unlockFullscreenAnimation];
b_animation_lock_alreadylocked = NO;
+ [self unlockFullscreenAnimation];
return;
}
- if (![self isVisible] || MACOS_VERSION < 10.4f)
+ if (fadeout || MACOS_VERSION < 10.4f)
{
/* We don't animate if we are not visible or if we are running on
* Mac OS X <10.4 which doesn't support NSAnimation, instead we
return;
}
+ [self setAlphaValue: 0.0];
+ [self orderFront: self];
+
[[[[VLCMain sharedInstance] getControls] getFSPanel] setNonActive: nil];
SetSystemUIMode( kUIModeNormal, kUIOptionAutoShowMenuBar);
[o_fullscreen_anim2 release];
}
+ /* This is a recursive lock. If we are already in the middle of an animation we
+ * unlock it. We don't add an extra locking here, because enter/leavefullscreen
+ * are executed always in the same thread */
+ if (b_animation_lock_alreadylocked)
+ [self unlockFullscreenAnimation];
+ b_animation_lock_alreadylocked = YES;
+
frame = [[o_temp_view superview] convertRect: [o_temp_view frame] toView: nil]; /* Convert to Window base coord */
- frame.origin.x += [self frame].origin.x;
+ frame.origin.x += [self frame].origin.x;
frame.origin.y += [self frame].origin.y;
dict2 = [[NSMutableDictionary alloc] initWithCapacity:2];
[o_fullscreen_anim1 setDuration: 0.2];
[o_fullscreen_anim1 setFrameRate: 30];
[o_fullscreen_anim2 startWhenAnimation: o_fullscreen_anim1 reachesProgress: 1.0];
+
+ /* Make sure o_fullscreen_window is the frontmost window */
+ [o_fullscreen_window orderFront: self];
+
[o_fullscreen_anim1 startAnimation];
/* fullscreenAnimation will be unlocked when animation ends */
}
[[self contentView] replaceSubview:o_temp_view with:o_view];
[o_view release];
[o_view setFrame:[o_temp_view frame]];
+ [self makeFirstResponder: o_view];
if ([self isVisible])
[self makeKeyAndOrderFront:self];
[o_fullscreen_window orderOut: self];
[o_fullscreen_window release];
o_fullscreen_window = nil;
- [self unlockFullscreenAnimation];
b_animation_lock_alreadylocked = NO;
+ [self unlockFullscreenAnimation];
}
- (void)animationDidEnd:(NSAnimation*)animation
{
[super orderOut: sender];
/* Make sure we leave fullscreen */
- [self leaveFullscreen];
+ [self leaveFullscreenAndFadeOut: YES];
}
/* Make sure setFrame gets executed on main thread especially if we are animating.