[vlc-commits] macosx: use custom animation for native fullscreen to continue video in animation

David Fuhrmann git at videolan.org
Sat Feb 15 20:35:48 CET 2014


vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Sat Feb 15 20:33:27 2014 +0100| [e5267d38f1379979c45b9564c83f056b90e0fd90] | committer: David Fuhrmann

macosx: use custom animation for native fullscreen to continue video in animation

close #6347

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e5267d38f1379979c45b9564c83f056b90e0fd90
---

 modules/gui/macosx/Windows.h |    2 ++
 modules/gui/macosx/Windows.m |   45 +++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/modules/gui/macosx/Windows.h b/modules/gui/macosx/Windows.h
index db65280..2c4273f 100644
--- a/modules/gui/macosx/Windows.h
+++ b/modules/gui/macosx/Windows.h
@@ -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;
diff --git a/modules/gui/macosx/Windows.m b/modules/gui/macosx/Windows.m
index 13182ad..c9962d2 100644
--- a/modules/gui/macosx/Windows.m
+++ b/modules/gui/macosx/Windows.m
@@ -625,6 +625,48 @@
     [[[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
@@ -639,6 +681,8 @@
 
     var_SetBool(pl_Get(VLCIntf), "fullscreen", true);
 
+    frameBeforeLionFullscreen = [self frame];
+
     if ([self hasActiveVideo]) {
         vout_thread_t *p_vout = getVoutForActiveWindow();
         if (p_vout) {
@@ -665,7 +709,6 @@
     if (![o_video_view isHidden]) {
         [[o_controls_bar bottomBarView] setHidden: YES];
     }
-    
 
     [self setMovableByWindowBackground: NO];
 }



More information about the vlc-commits mailing list