Commit 113917a4 authored by David Fuhrmann's avatar David Fuhrmann

macosx: reactivate no animation path for start in fullscreen

This fixes several glitches like concurent animation of window resize
and fullscreen resize.
parent 0011c261
...@@ -621,7 +621,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -621,7 +621,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
vlc_object_release(p_vout); vlc_object_release(p_vout);
} else { // e.g. lion fullscreen toggle } else { // e.g. lion fullscreen toggle
BOOL b_fs = var_ToggleBool(pl_Get(p_intf), "fullscreen"); 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];
} }
} }
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
- (void)removeVoutforDisplay:(NSValue *)o_key; - (void)removeVoutforDisplay:(NSValue *)o_key;
- (void)setNativeVideoSize:(NSSize)size forWindow:(vout_window_t *)p_wnd; - (void)setNativeVideoSize:(NSSize)size forWindow:(vout_window_t *)p_wnd;
- (void)setWindowLevel:(NSInteger)i_level 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)updateWindowsControlsBarWithSelector:(SEL)aSel;
- (void)updateWindowsUsingBlock:(void (^)(VLCVideoWindowCommon *o_window))windowUpdater; - (void)updateWindowsUsingBlock:(void (^)(VLCVideoWindowCommon *o_window))windowUpdater;
......
...@@ -156,37 +156,8 @@ ...@@ -156,37 +156,8 @@
NSSize videoViewSize = NSMakeSize(videoViewPosition.size.width, videoViewPosition.size.height); NSSize videoViewSize = NSMakeSize(videoViewPosition.size.width, videoViewPosition.size.height);
// TODO: find a cleaner way for "start in fullscreen" // Avoid flashes if video will directly start in fullscreen
// Start in fs, because either prefs settings, or fullscreen button was pressed before NSDisableScreenUpdates();
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];
}
if (!b_video_wallpaper) { if (!b_video_wallpaper) {
// set (only!) window origin if specified // set (only!) window origin if specified
...@@ -221,8 +192,6 @@ ...@@ -221,8 +192,6 @@
[o_new_video_window setAlphaValue: config_GetFloat(VLCIntf, "macosx-opaqueness")]; [o_new_video_window setAlphaValue: config_GetFloat(VLCIntf, "macosx-opaqueness")];
[o_vout_view setVoutThread:(vout_thread_t *)p_wnd->p_parent]; [o_vout_view setVoutThread:(vout_thread_t *)p_wnd->p_parent];
[o_new_video_window setHasActiveVideo: YES]; [o_new_video_window setHasActiveVideo: YES];
[o_vout_dict setObject:[o_new_video_window autorelease] forKey:[NSValue valueWithPointer:p_wnd]]; [o_vout_dict setObject:[o_new_video_window autorelease] forKey:[NSValue valueWithPointer:p_wnd]];
...@@ -238,6 +207,23 @@ ...@@ -238,6 +207,23 @@
[[VLCMain sharedInstance] playlistUpdated]; [[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]; return [o_vout_view autorelease];
} }
...@@ -325,7 +311,7 @@ ...@@ -325,7 +311,7 @@
[o_window setWindowLevel:i_level]; [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; intf_thread_t *p_intf = VLCIntf;
BOOL b_nativeFullscreenMode = [[VLCMain sharedInstance] nativeFullscreenMode]; BOOL b_nativeFullscreenMode = [[VLCMain sharedInstance] nativeFullscreenMode];
...@@ -367,7 +353,7 @@ ...@@ -367,7 +353,7 @@
if (p_input != NULL && [[VLCMain sharedInstance] activeVideoPlayback]) { if (p_input != NULL && [[VLCMain sharedInstance] activeVideoPlayback]) {
// activate app, as method can also be triggered from outside the app (prevents nasty window layout) // activate app, as method can also be triggered from outside the app (prevents nasty window layout)
[NSApp activateIgnoringOtherApps:YES]; [NSApp activateIgnoringOtherApps:YES];
[o_current_window enterFullscreen]; [o_current_window enterFullscreenWithAnimation:b_animation];
} }
if (p_input) if (p_input)
......
...@@ -126,7 +126,7 @@ static const float f_min_video_height = 70.0; ...@@ -126,7 +126,7 @@ static const float f_min_video_height = 70.0;
- (void)setTitle:(NSString *)title; - (void)setTitle:(NSString *)title;
/* fullscreen handling */ /* fullscreen handling */
- (void)enterFullscreen; - (void)enterFullscreenWithAnimation:(BOOL)b_animation;
- (void)leaveFullscreenWithAnimation:(BOOL)b_animation; - (void)leaveFullscreenWithAnimation:(BOOL)b_animation;
/* lion fullscreen handling */ /* lion fullscreen handling */
......
...@@ -832,7 +832,7 @@ ...@@ -832,7 +832,7 @@
#pragma mark - #pragma mark -
#pragma mark Fullscreen Logic #pragma mark Fullscreen Logic
- (void)enterFullscreen - (void)enterFullscreenWithAnimation:(BOOL)b_animation
{ {
NSMutableDictionary *dict1, *dict2; NSMutableDictionary *dict1, *dict2;
NSScreen *screen; NSScreen *screen;
...@@ -882,7 +882,11 @@ ...@@ -882,7 +882,11 @@
[o_fullscreen_window setHasActiveVideo: YES]; [o_fullscreen_window setHasActiveVideo: YES];
[o_fullscreen_window setFullscreen: 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 /* We don't animate if we are not visible, instead we
* simply fade the display */ * simply fade the display */
CGDisplayFadeReservationToken token; CGDisplayFadeReservationToken token;
...@@ -892,18 +896,20 @@ ...@@ -892,18 +896,20 @@
CGDisplayFade(token, 0.5, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0, 0, 0, YES); CGDisplayFade(token, 0.5, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0, 0, 0, YES);
} }
[screen setFullscreenPresentationOptions]; NSDisableScreenUpdates();
[o_video_view retain]; [o_video_view retain];
[[o_video_view superview] replaceSubview:o_video_view with:o_temp_view]; [[o_video_view superview] replaceSubview:o_video_view with:o_temp_view];
[o_temp_view setFrame:[o_video_view frame]]; [o_temp_view setFrame:[o_video_view frame]];
[o_fullscreen_window setContentView:o_video_view]; [o_fullscreen_window setContentView:o_video_view];
[o_video_view release]; [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 orderFront:self animate:YES];
[o_fullscreen_window setFrame:screen_rect display:YES animate:YES];
[o_fullscreen_window setLevel:NSNormalWindowLevel]; [o_fullscreen_window setLevel:NSNormalWindowLevel];
if (blackout_other_displays) { if (blackout_other_displays) {
...@@ -917,10 +923,6 @@ ...@@ -917,10 +923,6 @@
return; 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 */ /* Make sure we don't see the o_video_view disappearing of the screen during this operation */
NSDisableScreenUpdates(); NSDisableScreenUpdates();
[o_video_view retain]; [o_video_view retain];
......
...@@ -217,13 +217,15 @@ static int WindowControl(vout_window_t *p_wnd, int i_query, va_list args) ...@@ -217,13 +217,15 @@ static int WindowControl(vout_window_t *p_wnd, int i_query, va_list args)
case VOUT_WINDOW_SET_FULLSCREEN: case VOUT_WINDOW_SET_FULLSCREEN:
{ {
int i_full = va_arg(args, int); 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]]; NSInvocation *inv = [NSInvocation invocationWithMethodSignature:[o_vout_controller methodSignatureForSelector:sel]];
[inv setTarget:o_vout_controller]; [inv setTarget:o_vout_controller];
[inv setSelector:sel]; [inv setSelector:sel];
[inv setArgument:&i_full atIndex:2]; // starting at 2! [inv setArgument:&i_full atIndex:2]; // starting at 2!
[inv setArgument:&p_wnd atIndex:3]; [inv setArgument:&p_wnd atIndex:3];
[inv setArgument:&b_animation atIndex:4];
[inv performSelectorOnMainThread:@selector(invoke) withObject:nil [inv performSelectorOnMainThread:@selector(invoke) withObject:nil
waitUntilDone:NO]; waitUntilDone:NO];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment