From 5663536b1fa2e0d5ad8c577472b310e3003da9a9 Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Mon, 30 Mar 2009 19:41:50 +0200 Subject: [PATCH] Do not hide toolbar unless requested Commit 2d497eabe995ed7f667d67166b396dff6389d12f introduced a regression where the toolbar automatically hid upon startup regardless whether 'go' included the "T" flag or not. --- src/MacVim/MMWindowController.h | 2 +- src/MacVim/MMWindowController.m | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/MacVim/MMWindowController.h b/src/MacVim/MMWindowController.h index 11b66de47f..df164d75a6 100644 --- a/src/MacVim/MMWindowController.h +++ b/src/MacVim/MMWindowController.h @@ -22,7 +22,7 @@ MMVimView *vimView; BOOL setupDone; BOOL shouldResizeVimView; - int shouldUpdateToolbar; + int updateToolbarFlag; BOOL keepOnScreen; BOOL fullscreenEnabled; NSString *windowAutosaveKey; diff --git a/src/MacVim/MMWindowController.m b/src/MacVim/MMWindowController.m index f62501d002..62f0ccf21e 100644 --- a/src/MacVim/MMWindowController.m +++ b/src/MacVim/MMWindowController.m @@ -453,10 +453,8 @@ keepOnScreen = NO; } - if (shouldUpdateToolbar != 0) { + if (updateToolbarFlag != 0) [self updateToolbar]; - shouldUpdateToolbar = 0; - } } - (void)showTabBar:(BOOL)on @@ -491,16 +489,16 @@ [toolbar setSizeMode:size]; [toolbar setDisplayMode:mode]; + // Positive flag shows toolbar, negative hides it. + updateToolbarFlag = on ? 1 : -1; + // NOTE: If the window is not visible we must toggle the toolbar // immediately, otherwise "set go-=T" in .gvimrc will lead to the toolbar // showing its hide animation every time a new window is opened. (See // processCommandQueueDidFinish for the reason why we need to delay // toggling the toolbar when the window is visible.) - if ([decoratedWindow isVisible]) { - shouldUpdateToolbar = on ? 1 : -1; - } else { + if (![decoratedWindow isVisible]) [self updateToolbar]; - } } - (void)setMouseShape:(int)shape @@ -1061,9 +1059,10 @@ - (void)updateToolbar { NSToolbar *toolbar = [decoratedWindow toolbar]; - if (!toolbar) return; + if (nil == toolbar || 0 == updateToolbarFlag) return; - BOOL on = shouldUpdateToolbar > 0 ? YES : NO; + // Positive flag shows toolbar, negative hides it. + BOOL on = updateToolbarFlag > 0 ? YES : NO; [toolbar setVisible:on]; if (([decoratedWindow styleMask] & NSTexturedBackgroundWindowMask) == 0) { @@ -1079,6 +1078,8 @@ // is visible (because it brings its own separator). [self hideTablineSeparator:![[vimView tabBarControl] isHidden]]; } + + updateToolbarFlag = 0; } @end // MMWindowController (Private)