[vlc-commits] macosx: reactivate no animation path for start in fullscreen
David Fuhrmann
git at videolan.org
Thu Mar 20 20:30:12 CET 2014
vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Wed Mar 19 20:14:51 2014 +0100| [113917a45b1e934d1498e5b935a350b4196dd58d] | committer: David Fuhrmann
macosx: reactivate no animation path for start in fullscreen
This fixes several glitches like concurent animation of window resize
and fullscreen resize.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=113917a45b1e934d1498e5b935a350b4196dd58d
---
modules/gui/macosx/CoreInteraction.m | 2 +-
modules/gui/macosx/VLCVoutWindowController.h | 2 +-
modules/gui/macosx/VLCVoutWindowController.m | 56 ++++++++++----------------
modules/gui/macosx/Windows.h | 2 +-
modules/gui/macosx/Windows.m | 22 +++++-----
modules/gui/macosx/intf.m | 4 +-
6 files changed, 39 insertions(+), 49 deletions(-)
diff --git a/modules/gui/macosx/CoreInteraction.m b/modules/gui/macosx/CoreInteraction.m
index a65d38d..2329416 100644
--- a/modules/gui/macosx/CoreInteraction.m
+++ b/modules/gui/macosx/CoreInteraction.m
@@ -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];
}
}
diff --git a/modules/gui/macosx/VLCVoutWindowController.h b/modules/gui/macosx/VLCVoutWindowController.h
index 77a7f7d..c555b73 100644
--- a/modules/gui/macosx/VLCVoutWindowController.h
+++ b/modules/gui/macosx/VLCVoutWindowController.h
@@ -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;
diff --git a/modules/gui/macosx/VLCVoutWindowController.m b/modules/gui/macosx/VLCVoutWindowController.m
index de86df7..ba08b18 100644
--- a/modules/gui/macosx/VLCVoutWindowController.m
+++ b/modules/gui/macosx/VLCVoutWindowController.m
@@ -156,37 +156,8 @@
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
@@ -221,8 +192,6 @@
[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]];
@@ -238,6 +207,23 @@
[[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];
}
@@ -325,7 +311,7 @@
[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];
@@ -367,7 +353,7 @@
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)
diff --git a/modules/gui/macosx/Windows.h b/modules/gui/macosx/Windows.h
index ce3f714..db4171e 100644
--- a/modules/gui/macosx/Windows.h
+++ b/modules/gui/macosx/Windows.h
@@ -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 */
diff --git a/modules/gui/macosx/Windows.m b/modules/gui/macosx/Windows.m
index 2e58b6f..2ef91de 100644
--- a/modules/gui/macosx/Windows.m
+++ b/modules/gui/macosx/Windows.m
@@ -832,7 +832,7 @@
#pragma mark -
#pragma mark Fullscreen Logic
-- (void)enterFullscreen
+- (void)enterFullscreenWithAnimation:(BOOL)b_animation
{
NSMutableDictionary *dict1, *dict2;
NSScreen *screen;
@@ -882,7 +882,11 @@
[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;
@@ -892,18 +896,20 @@
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) {
@@ -917,10 +923,6 @@
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];
diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index 450455f..8d8ddd4 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -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];
More information about the vlc-commits
mailing list