]> git.sesse.net Git - vlc/commitdiff
macosx: reactivate no animation path for start in fullscreen
authorDavid Fuhrmann <david.fuhrmann@googlemail.com>
Wed, 19 Mar 2014 19:14:51 +0000 (20:14 +0100)
committerDavid Fuhrmann <david.fuhrmann@googlemail.com>
Thu, 20 Mar 2014 19:29:11 +0000 (20:29 +0100)
This fixes several glitches like concurent animation of window resize
and fullscreen resize.

modules/gui/macosx/CoreInteraction.m
modules/gui/macosx/VLCVoutWindowController.h
modules/gui/macosx/VLCVoutWindowController.m
modules/gui/macosx/Windows.h
modules/gui/macosx/Windows.m
modules/gui/macosx/intf.m

index a65d38daf1ded7a9cd5ea6d71f1f08efce38ae3d..23294161e843436424bb2389a916a04cdf4051ea 100644 (file)
@@ -621,7 +621,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
         vlc_object_release(p_vout);
     } else { // e.g. lion fullscreen toggle
         BOOL b_fs = var_ToggleBool(pl_Get(p_intf), "fullscreen");
-        [[[VLCMain sharedInstance] voutController] setFullscreen:b_fs forWindow:nil];
+        [[[VLCMain sharedInstance] voutController] setFullscreen:b_fs forWindow:nil withAnimation:YES];
     }
 }
 
index 77a7f7dc96724f22aeaa13019647c6e632e4d41f..c555b73e78bd6241786a7a96508b2b94410dbf94 100644 (file)
@@ -48,7 +48,7 @@
 - (void)removeVoutforDisplay:(NSValue *)o_key;
 - (void)setNativeVideoSize:(NSSize)size forWindow:(vout_window_t *)p_wnd;
 - (void)setWindowLevel:(NSInteger)i_level forWindow:(vout_window_t *)p_wnd;
-- (void)setFullscreen:(int)i_full forWindow:(vout_window_t *)p_wnd;
+- (void)setFullscreen:(int)i_full forWindow:(vout_window_t *)p_wnd withAnimation:(BOOL)b_animation;
 
 - (void)updateWindowsControlsBarWithSelector:(SEL)aSel;
 - (void)updateWindowsUsingBlock:(void (^)(VLCVideoWindowCommon *o_window))windowUpdater;
index de86df76f43d4a291a435a43a18706fdb9434bd5..ba08b18548c2503494ea27b34b06e51b35cda39a 100644 (file)
 
     NSSize videoViewSize = NSMakeSize(videoViewPosition.size.width, videoViewPosition.size.height);
 
-    // TODO: find a cleaner way for "start in fullscreen"
-    // Start in fs, because either prefs settings, or fullscreen button was pressed before
-
-    char *psz_splitter = var_GetString(pl_Get(VLCIntf), "video-splitter");
-    BOOL b_have_splitter = psz_splitter != NULL && *psz_splitter != '\0';
-    free(psz_splitter);
-
-    if (!b_have_splitter && (var_InheritBool(VLCIntf, "fullscreen") || var_GetBool(pl_Get(VLCIntf), "fullscreen"))) {
-
-        // this is not set when we start in fullscreen because of
-        // fullscreen settings in video prefs the second time
-        var_SetBool(p_wnd->p_parent, "fullscreen", 1);
-
-        int i_full = 1;
-
-        SEL sel = @selector(setFullscreen:forWindow:);
-        NSInvocation *inv = [NSInvocation invocationWithMethodSignature:[self methodSignatureForSelector:sel]];
-        [inv setTarget:self];
-        [inv setSelector:sel];
-        [inv setArgument:&i_full atIndex:2];
-        [inv setArgument:&p_wnd atIndex:3];
-
-        NSTimeInterval resizeTime = 0.;
-        if(!b_nonembedded && !b_video_wallpaper) {
-            NSRect window_rect = [o_new_video_window getWindowRectForProposedVideoViewSize:videoViewSize];
-            resizeTime = [o_new_video_window animationResizeTime:window_rect];
-            resizeTime += 0.1;
-        }
-        
-        [NSTimer scheduledTimerWithTimeInterval:resizeTime invocation:inv repeats:NO];
-    }
+    // Avoid flashes if video will directly start in fullscreen
+    NSDisableScreenUpdates();
 
     if (!b_video_wallpaper) {
         // set (only!) window origin if specified
 
     [o_new_video_window setAlphaValue: config_GetFloat(VLCIntf, "macosx-opaqueness")];
 
-
-
     [o_vout_view setVoutThread:(vout_thread_t *)p_wnd->p_parent];
     [o_new_video_window setHasActiveVideo: YES];
     [o_vout_dict setObject:[o_new_video_window autorelease] forKey:[NSValue valueWithPointer:p_wnd]];
         [[VLCMain sharedInstance] playlistUpdated];
     }
 
+    // TODO: find a cleaner way for "start in fullscreen"
+    // Start in fs, because either prefs settings, or fullscreen button was pressed before
+    char *psz_splitter = var_GetString(pl_Get(VLCIntf), "video-splitter");
+    BOOL b_have_splitter = psz_splitter != NULL && *psz_splitter != '\0';
+    free(psz_splitter);
+
+    if (!b_have_splitter && (var_InheritBool(VLCIntf, "fullscreen") || var_GetBool(pl_Get(VLCIntf), "fullscreen"))) {
+
+        // this is not set when we start in fullscreen because of
+        // fullscreen settings in video prefs the second time
+        var_SetBool(p_wnd->p_parent, "fullscreen", 1);
+
+        [self setFullscreen:1 forWindow:p_wnd withAnimation:NO];
+    }
+
+    NSEnableScreenUpdates();
+
     return [o_vout_view autorelease];
 }
 
     [o_window setWindowLevel:i_level];
 }
 
-- (void)setFullscreen:(int)i_full forWindow:(vout_window_t *)p_wnd
+- (void)setFullscreen:(int)i_full forWindow:(vout_window_t *)p_wnd withAnimation:(BOOL)b_animation
 {
     intf_thread_t *p_intf = VLCIntf;
     BOOL b_nativeFullscreenMode = [[VLCMain sharedInstance] nativeFullscreenMode];
             if (p_input != NULL && [[VLCMain sharedInstance] activeVideoPlayback]) {
                 // activate app, as method can also be triggered from outside the app (prevents nasty window layout)
                 [NSApp activateIgnoringOtherApps:YES];
-                [o_current_window enterFullscreen];
+                [o_current_window enterFullscreenWithAnimation:b_animation];
 
             }
             if (p_input)
index ce3f71427b51a37bfdd60f1e71e0a844232323fb..db4171e600415060718cf8349c57b66b9c4ad155 100644 (file)
@@ -126,7 +126,7 @@ static const float f_min_video_height = 70.0;
 - (void)setTitle:(NSString *)title;
 
 /* fullscreen handling */
-- (void)enterFullscreen;
+- (void)enterFullscreenWithAnimation:(BOOL)b_animation;
 - (void)leaveFullscreenWithAnimation:(BOOL)b_animation;
 
 /* lion fullscreen handling */
index 2e58b6f84090f27fa0a6bbb31104351f3e450511..2ef91dea128d0240c07334612dafaadd26b47ea3 100644 (file)
 #pragma mark -
 #pragma mark Fullscreen Logic
 
-- (void)enterFullscreen
+- (void)enterFullscreenWithAnimation:(BOOL)b_animation
 {
     NSMutableDictionary *dict1, *dict2;
     NSScreen *screen;
         [o_fullscreen_window setHasActiveVideo: YES];
         [o_fullscreen_window setFullscreen: YES];
 
-        if (![self isVisible] || [self alphaValue] == 0.0) {
+        /* Make sure video view gets visible in case the playlist was visible before */
+        b_video_view_was_hidden = [o_video_view isHidden];
+        [o_video_view setHidden: NO];
+
+        if (!b_animation) {
             /* We don't animate if we are not visible, instead we
              * simply fade the display */
             CGDisplayFadeReservationToken token;
                 CGDisplayFade(token, 0.5, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0, 0, 0, YES);
             }
 
-            [screen setFullscreenPresentationOptions];
-
+            NSDisableScreenUpdates();
             [o_video_view retain];
             [[o_video_view superview] replaceSubview:o_video_view with:o_temp_view];
             [o_temp_view setFrame:[o_video_view frame]];
             [o_fullscreen_window setContentView:o_video_view];
             [o_video_view release];
+            NSEnableScreenUpdates();
+
+            [screen setFullscreenPresentationOptions];
+
+            [o_fullscreen_window setFrame:screen_rect display:YES animate:NO];
 
-            [o_fullscreen_window makeKeyAndOrderFront:self];
             [o_fullscreen_window orderFront:self animate:YES];
 
-            [o_fullscreen_window setFrame:screen_rect display:YES animate:YES];
             [o_fullscreen_window setLevel:NSNormalWindowLevel];
 
             if (blackout_other_displays) {
             return;
         }
 
-        /* Make sure video view gets visible in case the playlist was visible before */
-        b_video_view_was_hidden = [o_video_view isHidden];
-        [o_video_view setHidden: NO];
-
         /* Make sure we don't see the o_video_view disappearing of the screen during this operation */
         NSDisableScreenUpdates();
         [o_video_view retain];
index 450455f29501715cf1e7082981278fa774c02543..8d8ddd46c95a67a6b11d038e29aef464488179cf 100644 (file)
@@ -217,13 +217,15 @@ static int WindowControl(vout_window_t *p_wnd, int i_query, va_list args)
         case VOUT_WINDOW_SET_FULLSCREEN:
         {
             int i_full = va_arg(args, int);
+            BOOL b_animation = YES;
 
-            SEL sel = @selector(setFullscreen:forWindow:);
+            SEL sel = @selector(setFullscreen:forWindow:withAnimation:);
             NSInvocation *inv = [NSInvocation invocationWithMethodSignature:[o_vout_controller methodSignatureForSelector:sel]];
             [inv setTarget:o_vout_controller];
             [inv setSelector:sel];
             [inv setArgument:&i_full atIndex:2]; // starting at 2!
             [inv setArgument:&p_wnd atIndex:3];
+            [inv setArgument:&b_animation atIndex:4];
             [inv performSelectorOnMainThread:@selector(invoke) withObject:nil
                                waitUntilDone:NO];