diff --git a/src/MacVim/MMBackend.h b/src/MacVim/MMBackend.h index bbebc7e24e..733578af76 100644 --- a/src/MacVim/MMBackend.h +++ b/src/MacVim/MMBackend.h @@ -105,7 +105,6 @@ extern NSTimeInterval MMBalloonEvalInternalDelay; - (BOOL)tabBarVisible; - (void)showTabBar:(BOOL)enable; - (void)setRows:(int)rows columns:(int)cols; -- (void)resizeView; - (void)setWindowTitle:(char *)title; - (void)setDocumentFilename:(char *)filename; - (char *)browseForFileWithAttributes:(NSDictionary *)attr; diff --git a/src/MacVim/MMBackend.m b/src/MacVim/MMBackend.m index 2146fb53ee..5b5dd2a3d2 100644 --- a/src/MacVim/MMBackend.m +++ b/src/MacVim/MMBackend.m @@ -836,11 +836,6 @@ - (void)setRows:(int)rows columns:(int)cols [self queueMessage:SetTextDimensionsMsgID data:data]; } -- (void)resizeView -{ - [self queueMessage:ResizeViewMsgID data:nil]; -} - - (void)setWindowTitle:(char *)title { NSMutableData *data = [NSMutableData data]; @@ -2002,7 +1997,6 @@ - (void)handleInputEvent:(int)msgid data:(NSData *)data tabpage_move(idx); } else if (SetTextDimensionsMsgID == msgid || LiveResizeMsgID == msgid - || SetTextDimensionsNoResizeWindowMsgID == msgid || SetTextRowsMsgID == msgid || SetTextColumnsMsgID == msgid) { if (!data) return; const void *bytes = [data bytes]; @@ -2034,8 +2028,6 @@ - (void)handleInputEvent:(int)msgid data:(NSData *)data [self queueMessage:msgid data:d]; gui_resize_shell(cols, rows); - } else if (ResizeViewMsgID == msgid) { - [self queueMessage:msgid data:data]; } else if (ExecuteMenuMsgID == msgid) { NSDictionary *attrs = [NSDictionary dictionaryWithData:data]; if (attrs) { diff --git a/src/MacVim/MMVimController.m b/src/MacVim/MMVimController.m index ea3311a8c7..4f496d9d50 100644 --- a/src/MacVim/MMVimController.m +++ b/src/MacVim/MMVimController.m @@ -629,7 +629,6 @@ - (void)handleMessage:(int)msgid data:(NSData *)data [windowController showTabBar:NO]; [self sendMessage:BackingPropertiesChangedMsgID data:nil]; } else if (SetTextDimensionsMsgID == msgid || LiveResizeMsgID == msgid || - SetTextDimensionsNoResizeWindowMsgID == msgid || SetTextDimensionsReplyMsgID == msgid) { const void *bytes = [data bytes]; int rows = *((int*)bytes); bytes += sizeof(int); @@ -639,16 +638,11 @@ - (void)handleMessage:(int)msgid data:(NSData *)data // acknowledges it with a reply message. When this happens the window // should not move (the frontend would already have moved the window). BOOL onScreen = SetTextDimensionsReplyMsgID!=msgid; - - BOOL keepGUISize = SetTextDimensionsNoResizeWindowMsgID == msgid; [windowController setTextDimensionsWithRows:rows columns:cols isLive:(LiveResizeMsgID==msgid) - keepGUISize:keepGUISize keepOnScreen:onScreen]; - } else if (ResizeViewMsgID == msgid) { - [windowController resizeView]; } else if (SetWindowTitleMsgID == msgid) { const void *bytes = [data bytes]; int len = *((int*)bytes); bytes += sizeof(int); diff --git a/src/MacVim/MMVimView.h b/src/MacVim/MMVimView.h index 8ecaa24b2c..5a8335ed1e 100644 --- a/src/MacVim/MMVimView.h +++ b/src/MacVim/MMVimView.h @@ -55,7 +55,6 @@ - (void)viewWillStartLiveResize; - (void)viewDidEndLiveResize; - (void)setFrameSize:(NSSize)size; -- (void)setFrameSizeKeepGUISize:(NSSize)size; - (void)setFrame:(NSRect)frame; @end diff --git a/src/MacVim/MMVimView.m b/src/MacVim/MMVimView.m index 6202a186f3..fd04c47e5b 100644 --- a/src/MacVim/MMVimView.m +++ b/src/MacVim/MMVimView.m @@ -60,7 +60,7 @@ - (MMScroller *)scrollbarForIdentifier:(int32_t)ident index:(unsigned *)idx; - (NSSize)vimViewSizeForTextViewSize:(NSSize)textViewSize; - (NSRect)textViewRectForVimViewSize:(NSSize)contentSize; - (NSTabView *)tabView; -- (void)frameSizeMayHaveChanged:(BOOL)keepGUISize; +- (void)frameSizeMayHaveChanged; @end @@ -610,25 +610,14 @@ - (void)setFrameSize:(NSSize)size // row will result in the vim view holding more rows than the can fit // inside the window.) [super setFrameSize:size]; - [self frameSizeMayHaveChanged:NO]; -} - -- (void)setFrameSizeKeepGUISize:(NSSize)size -{ - // NOTE: Instead of only acting when a frame was resized, we do some - // updating each time a frame may be resized. (At the moment, if we only - // respond to actual frame changes then typing ":set lines=1000" twice in a - // row will result in the vim view holding more rows than the can fit - // inside the window.) - [super setFrameSize:size]; - [self frameSizeMayHaveChanged:YES]; + [self frameSizeMayHaveChanged]; } - (void)setFrame:(NSRect)frame { // See comment in setFrameSize: above. [super setFrame:frame]; - [self frameSizeMayHaveChanged:NO]; + [self frameSizeMayHaveChanged]; } @end // MMVimView @@ -878,7 +867,7 @@ - (NSTabView *)tabView return tabView; } -- (void)frameSizeMayHaveChanged:(BOOL)keepGUISize +- (void)frameSizeMayHaveChanged { // NOTE: Whenever a call is made that may have changed the frame size we // take the opportunity to make sure all subviews are in place and that the @@ -914,7 +903,7 @@ - (void)frameSizeMayHaveChanged:(BOOL)keepGUISize if (constrained[0] != rows || constrained[1] != cols) { NSData *data = [NSData dataWithBytes:constrained length:2*sizeof(int)]; int msgid = [self inLiveResize] ? LiveResizeMsgID - : (keepGUISize ? SetTextDimensionsNoResizeWindowMsgID : SetTextDimensionsMsgID); + : SetTextDimensionsMsgID; ASLogDebug(@"Notify Vim that text dimensions changed from %dx%d to " "%dx%d (%s)", cols, rows, constrained[1], constrained[0], diff --git a/src/MacVim/MMWindowController.h b/src/MacVim/MMWindowController.h index 5e97478f9a..8c92ed537d 100644 --- a/src/MacVim/MMWindowController.h +++ b/src/MacVim/MMWindowController.h @@ -24,7 +24,6 @@ BOOL setupDone; BOOL windowPresented; BOOL shouldResizeVimView; - BOOL shouldKeepGUISize; BOOL shouldRestoreUserTopLeft; BOOL shouldMaximizeWindow; int updateToolbarFlag; @@ -60,9 +59,7 @@ - (void)updateTabsWithData:(NSData *)data; - (void)selectTabWithIndex:(int)idx; - (void)setTextDimensionsWithRows:(int)rows columns:(int)cols isLive:(BOOL)live - keepGUISize:(BOOL)keepGUISize keepOnScreen:(BOOL)onScreen; -- (void)resizeView; - (void)zoomWithRows:(int)rows columns:(int)cols state:(int)state; - (void)setTitle:(NSString *)title; - (void)setDocumentFilename:(NSString *)filename; diff --git a/src/MacVim/MMWindowController.m b/src/MacVim/MMWindowController.m index a9437379ef..ae335811f4 100644 --- a/src/MacVim/MMWindowController.m +++ b/src/MacVim/MMWindowController.m @@ -174,7 +174,7 @@ - (id)initWithVimController:(MMVimController *)controller [win setDelegate:self]; [win setInitialFirstResponder:[vimView textView]]; - + if ([win styleMask] & NSWindowStyleMaskTexturedBackground) { // On Leopard, we want to have a textured window to have nice // looking tabs. But the textured window look implies rounded @@ -381,7 +381,6 @@ - (void)selectTabWithIndex:(int)idx } - (void)setTextDimensionsWithRows:(int)rows columns:(int)cols isLive:(BOOL)live - keepGUISize:(BOOL)keepGUISize keepOnScreen:(BOOL)onScreen { ASLogDebug(@"setTextDimensionsWithRows:%d columns:%d isLive:%d " @@ -400,7 +399,7 @@ - (void)setTextDimensionsWithRows:(int)rows columns:(int)cols isLive:(BOOL)live [vimView setDesiredRows:rows columns:cols]; - if (setupDone && !live && !keepGUISize) { + if (setupDone && !live) { shouldResizeVimView = YES; keepOnScreen = onScreen; } @@ -429,15 +428,6 @@ - (void)setTextDimensionsWithRows:(int)rows columns:(int)cols isLive:(BOOL)live } } -- (void)resizeView -{ - if (setupDone) - { - shouldResizeVimView = YES; - shouldKeepGUISize = YES; - } -} - - (void)zoomWithRows:(int)rows columns:(int)cols state:(int)state { [self setTextDimensionsWithRows:rows @@ -513,6 +503,9 @@ - (void)createScrollbarWithIdentifier:(int32_t)ident type:(int)type - (BOOL)destroyScrollbarWithIdentifier:(int32_t)ident { BOOL scrollbarHidden = [vimView destroyScrollbarWithIdentifier:ident]; + shouldResizeVimView = shouldResizeVimView || scrollbarHidden; + shouldMaximizeWindow = shouldMaximizeWindow || scrollbarHidden; + return scrollbarHidden; } @@ -520,6 +513,9 @@ - (BOOL)showScrollbarWithIdentifier:(int32_t)ident state:(BOOL)visible { BOOL scrollbarToggled = [vimView showScrollbarWithIdentifier:ident state:visible]; + shouldResizeVimView = shouldResizeVimView || scrollbarToggled; + shouldMaximizeWindow = shouldMaximizeWindow || scrollbarToggled; + return scrollbarToggled; } @@ -604,18 +600,7 @@ - (void)processInputQueueDidFinish fullScreenWindow ? [fullScreenWindow frame].size : fullScreenEnabled ? desiredWindowSize : [self constrainContentSizeToScreenSize:[vimView desiredSize]]]; - - // Setting 'guioptions+=k' will make shouldKeepGUISize true, which - // means avoid resizing the window. Instead, resize the view instead - // to keep the GUI window's size consistent. - bool avoidWindowResize = shouldKeepGUISize && !fullScreenEnabled; - - if (!avoidWindowResize) { - [vimView setFrameSize:contentSize]; - } - else { - [vimView setFrameSizeKeepGUISize:originalSize]; - } + [vimView setFrameSize:contentSize]; if (fullScreenWindow) { // NOTE! Don't mark the full-screen content view as needing an @@ -628,15 +613,12 @@ - (void)processInputQueueDidFinish [fullScreenWindow centerView]; } } else { - if (!avoidWindowResize) { - [self resizeWindowToFitContentSize:contentSize - keepOnScreen:keepOnScreen]; - } + [self resizeWindowToFitContentSize:contentSize + keepOnScreen:keepOnScreen]; } } keepOnScreen = NO; - shouldKeepGUISize = NO; } } @@ -675,6 +657,7 @@ - (void)adjustLinespace:(int)linespace { if (vimView && [vimView textView]) { [[vimView textView] setLinespace:(float)linespace]; + shouldMaximizeWindow = shouldResizeVimView = YES; } } @@ -682,6 +665,7 @@ - (void)adjustColumnspace:(int)columnspace { if (vimView && [vimView textView]) { [[vimView textView] setColumnspace:(float)columnspace]; + shouldMaximizeWindow = shouldResizeVimView = YES; } } @@ -1203,7 +1187,7 @@ - (void)window:(NSWindow *)window [[window animator] setAlphaValue:0]; } completionHandler:^{ [self maximizeWindow:fullScreenOptions]; - + // Fade in [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) { [context setDuration:0.5*duration]; @@ -1222,7 +1206,7 @@ - (void)windowWillEnterFullScreen:(NSNotification *)notification // The separator should never be visible in fullscreen or split-screen. [decoratedWindow hideTablineSeparator:YES]; - + // ASSUMPTION: fullScreenEnabled always reflects the state of Vim's 'fu'. if (!fullScreenEnabled) { ASLogDebug(@"Full-screen out of sync, tell Vim to set 'fu'"); @@ -1324,7 +1308,7 @@ - (void)windowDidExitFullScreen:(NSNotification *)notification // full-screen by moving the window out from Split View. [vimController sendMessage:BackingPropertiesChangedMsgID data:nil]; } - + [self updateTablineSeparator]; } @@ -1552,6 +1536,7 @@ - (void)hideTablineSeparator:(BOOL)hide // The tabline separator was toggled so the content view must change // size. [self updateResizeConstraints]; + shouldResizeVimView = YES; } } diff --git a/src/MacVim/MacVim.h b/src/MacVim/MacVim.h index 118dac889c..904acf7015 100644 --- a/src/MacVim/MacVim.h +++ b/src/MacVim/MacVim.h @@ -176,10 +176,8 @@ enum { SetTextRowsMsgID, SetTextColumnsMsgID, SetTextDimensionsMsgID, - SetTextDimensionsNoResizeWindowMsgID, LiveResizeMsgID, SetTextDimensionsReplyMsgID, - ResizeViewMsgID, SetWindowTitleMsgID, ScrollWheelMsgID, MouseDownMsgID, diff --git a/src/MacVim/MacVim.m b/src/MacVim/MacVim.m index 6390a29139..b9fdeb43c9 100644 --- a/src/MacVim/MacVim.m +++ b/src/MacVim/MacVim.m @@ -30,10 +30,8 @@ "SetTextRowsMsgID", "SetTextColumnsMsgID", "SetTextDimensionsMsgID", - "SetTextDimensionsNoResizeWindowMsgID", "LiveResizeMsgID", "SetTextDimensionsReplyMsgID", - "ResizeViewMsgID", "SetWindowTitleMsgID", "ScrollWheelMsgID", "MouseDownMsgID", diff --git a/src/MacVim/gui_macvim.m b/src/MacVim/gui_macvim.m index ce2239122f..4c7c8b3701 100644 --- a/src/MacVim/gui_macvim.m +++ b/src/MacVim/gui_macvim.m @@ -1739,18 +1739,6 @@ } -/* - * Re-calculates size of the Vim view to fit within the window without having - * to resize the window. Usually happens after UI elements have changed (e.g. - * adding / removing a toolbar) when guioptions 'k' is set. - */ - void -gui_mch_resize_view() -{ - [[MMBackend sharedInstance] resizeView]; -} - - /* * Set the position of the top left corner of the window to the given * coordinates. diff --git a/src/gui.c b/src/gui.c index 323dd6e362..e4a874589d 100644 --- a/src/gui.c +++ b/src/gui.c @@ -1621,16 +1621,6 @@ gui_set_shellsize( } #endif -#ifdef FEAT_GUI_MACVIM - if (!mustset && (vim_strchr(p_go, GO_KEEPWINSIZE) != NULL)) - { - /* We don't want to resize the window, so instruct the GUI to resize - * the view to be within the constraints of the current window's size */ - gui_mch_resize_view(); - return; - } -#endif - base_width = gui_get_base_width(); base_height = gui_get_base_height(); if (fit_to_display) diff --git a/src/proto/gui_macvim.pro b/src/proto/gui_macvim.pro index 8fdab4ef70..dd75a6f2b3 100644 --- a/src/proto/gui_macvim.pro +++ b/src/proto/gui_macvim.pro @@ -174,8 +174,6 @@ gui_mch_set_shellsize( int base_height, int direction); void -gui_mch_resize_view(); - void gui_mch_set_sp_color(guicolor_T color); void gui_mch_set_text_area_pos(int x, int y, int w, int h);