]> git.sesse.net Git - vlc/commitdiff
macosx: use custom animation for native fullscreen to continue video in animation
authorDavid Fuhrmann <david.fuhrmann@googlemail.com>
Sat, 15 Feb 2014 19:33:27 +0000 (20:33 +0100)
committerDavid Fuhrmann <david.fuhrmann@googlemail.com>
Sat, 15 Feb 2014 19:33:27 +0000 (20:33 +0100)
close #6347

modules/gui/macosx/Windows.h
modules/gui/macosx/Windows.m

index db652804b78436119eb0536e58548ad7a925b572..2c4273f5ab71ec06c20cf0ea64c9816b2a68378a 100644 (file)
@@ -110,6 +110,8 @@ static const float f_min_video_height = 70.0;
 
     // true when the window is in transition for entering or exiting fullscreen
     BOOL b_in_fullscreen_transition;
+
+    NSRect frameBeforeLionFullscreen;
 }
 
 @property (nonatomic, assign) VLCVoutView* videoView;
index 13182ad9b194c39596c5b0c2db5883bc84951b4c..c9962d25e0e953cb7f60683936278013450a46af 100644 (file)
     [[[VLCMainWindow sharedInstance] fsPanel] setNonActive:nil];
 }
 
+-(NSArray*)customWindowsToEnterFullScreenForWindow:(NSWindow *)window
+{
+    if (window == self) {
+        return [NSArray arrayWithObject:window];
+    }
+
+    return nil;
+}
+
+- (NSArray*)customWindowsToExitFullScreenForWindow:(NSWindow*)window
+{
+    if (window == self) {
+        return [NSArray arrayWithObject:window];
+    }
+
+    return nil;
+}
+
+- (void)window:window startCustomAnimationToEnterFullScreenWithDuration:(NSTimeInterval)duration
+{
+    [window setStyleMask:([window styleMask] | NSFullScreenWindowMask)];
+
+    NSScreen *screen = [window screen];
+    NSRect screenFrame = [screen frame];
+
+    [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) {
+        [context setDuration:0.5 * duration];
+        [[window animator] setFrame:screenFrame display:YES];
+    } completionHandler:nil];
+}
+
+- (void)window:window startCustomAnimationToExitFullScreenWithDuration:(NSTimeInterval)duration
+{
+    [window setStyleMask:([window styleMask] & ~NSFullScreenWindowMask)];
+    [[window animator] setFrame:frameBeforeLionFullscreen display:YES animate:YES];
+
+    [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) {
+        [context setDuration:0.5 * duration];
+        [[window animator] setFrame:frameBeforeLionFullscreen display:YES animate:YES];
+    } completionHandler:nil];
+}
+
 - (void)windowWillEnterFullScreen:(NSNotification *)notification
 {
     // workaround, see #6668
 
     var_SetBool(pl_Get(VLCIntf), "fullscreen", true);
 
+    frameBeforeLionFullscreen = [self frame];
+
     if ([self hasActiveVideo]) {
         vout_thread_t *p_vout = getVoutForActiveWindow();
         if (p_vout) {
     if (![o_video_view isHidden]) {
         [[o_controls_bar bottomBarView] setHidden: YES];
     }
-    
 
     [self setMovableByWindowBackground: NO];
 }