From ad6380d84b02f95bb6723b38f7189794f45c09ca Mon Sep 17 00:00:00 2001 From: Vestimir Markov Date: Fri, 14 Nov 2014 21:50:20 +0100 Subject: [PATCH] Rearanges animation so there's no blank lines when entering fullscreen on Yosemite --- src/MacVim/MMWindowController.m | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/MacVim/MMWindowController.m b/src/MacVim/MMWindowController.m index b6c6786bf1..44dad1b69c 100644 --- a/src/MacVim/MMWindowController.m +++ b/src/MacVim/MMWindowController.m @@ -58,7 +58,7 @@ * * The window is always kept centered and resizing works more or less the same * way as in windowed mode. - * + * */ #import "MMAppController.h" @@ -170,7 +170,7 @@ - (id)initWithVimController:(MMVimController *)controller [win setDelegate:self]; [win setInitialFirstResponder:[vimView textView]]; - + if ([win styleMask] & NSTexturedBackgroundWindowMask) { // On Leopard, we want to have a textured window to have nice // looking tabs. But the textured window look implies rounded @@ -479,7 +479,7 @@ - (void)createScrollbarWithIdentifier:(int32_t)ident type:(int)type - (BOOL)destroyScrollbarWithIdentifier:(int32_t)ident { - BOOL scrollbarHidden = [vimView destroyScrollbarWithIdentifier:ident]; + BOOL scrollbarHidden = [vimView destroyScrollbarWithIdentifier:ident]; shouldResizeVimView = shouldResizeVimView || scrollbarHidden; shouldMaximizeWindow = shouldMaximizeWindow || scrollbarHidden; @@ -1130,12 +1130,13 @@ - (void)window:(NSWindow *)window // Fade out window, remove title bar and maximize, then fade back in. // (There is a small delay before window is maximized but usually this is // not noticeable on a relatively modern Mac.) + [window setStyleMask:([window styleMask] | NSFullScreenWindowMask)]; + [[vimView tabBarControl] setStyleNamed:@"Unified"]; + [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) { [context setDuration:0.5*duration]; [[window animator] setAlphaValue:0]; } completionHandler:^{ - [window setStyleMask:([window styleMask] | NSFullScreenWindowMask)]; - [[vimView tabBarControl] setStyleNamed:@"Unified"]; [self updateTablineSeparator]; [self maximizeWindow:fullScreenOptions]; @@ -1143,9 +1144,10 @@ - (void)window:(NSWindow *)window [context setDuration:0.5*duration]; [[window animator] setAlphaValue:1]; } completionHandler:^{ - // Do nothing + [self resizeWindowToFitContentSize:[vimView desiredSize] keepOnScreen:YES]; }]; }]; + } - (void)windowWillEnterFullScreen:(NSNotification *)notification @@ -1397,7 +1399,7 @@ - (NSTabViewItem *)addNewTabViewItem } - (BOOL)askBackendForStarRegister:(NSPasteboard *)pb -{ +{ // TODO: Can this be done with evaluateExpression: instead? BOOL reply = NO; id backendProxy = [vimController backendProxy]; @@ -1479,7 +1481,7 @@ - (void)doFindNext:(BOOL)next input = [NSString stringWithFormat:@":let @/='%@'%c", query, next ? 'n' : 'N']; } else { - input = next ? @"n" : @"N"; + input = next ? @"n" : @"N"; } [vimController addVimInput:input];