From bd394ba7b49011de05a8849b671b01d05f0d9e1c Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Sun, 17 Feb 2008 20:01:19 +0100 Subject: [PATCH] Cmd-click to only maximize vertically when MMZoomBoth is set --- src/MacVim/MMWindowController.m | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/MacVim/MMWindowController.m b/src/MacVim/MMWindowController.m index 38b8d3a2b9..0628449936 100644 --- a/src/MacVim/MMWindowController.m +++ b/src/MacVim/MMWindowController.m @@ -682,15 +682,19 @@ - (NSRect)windowWillUseStandardFrame:(NSWindow *)win defaultFrame:(NSRect)frame { - // Keep old width and horizontal position unless user clicked while the - // Command key is held down, or if the MMZoomBoth user default is set. + // By default the window is maximized in the vertical direction only. + // Holding down the Cmd key maximizes the window in the horizontal + // direction. If the MMZoomBoth user default is set, then the window + // maximizes in both directions by default, unless the Cmd key is held in + // which case the window only maximizes in the vertical direction. NSEvent *event = [NSApp currentEvent]; BOOL cmdLeftClick = [event type] == NSLeftMouseUp && [event modifierFlags] & NSCommandKeyMask; BOOL zoomBoth = [[NSUserDefaults standardUserDefaults] boolForKey:MMZoomBothKey]; - if (zoomBoth || cmdLeftClick) + + if ((zoomBoth && !cmdLeftClick) || (!zoomBoth && cmdLeftClick)) return frame; NSRect currentFrame = [win frame];