Skip to content

Commit 6d2e8f8

Browse files
committed
Choose how to resize the Vim view based on the full screen mode.
- Native full screen: Use the last externally-set window size. This lets Split View work without slowly growing or shrinking. - Non-native full screen: Use the size of the full screen window. - Not full screen: Use [vimView desiredSize] (unchanged). This is somewhat nasty, but the different full screen code paths behave differently enough that there doesn't seem to be one universally-correct answer. It would be great to simplify them.
1 parent 30f517f commit 6d2e8f8

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/MacVim/MMWindowController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
int userCols;
4141
NSPoint userTopLeft;
4242
NSPoint defaultTopLeft;
43+
NSSize desiredWindowSize;
4344
NSToolbar *toolbar;
4445
BOOL resizingDueToMove;
4546
int blurRadius;

src/MacVim/MMWindowController.m

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -594,11 +594,12 @@ - (void)processInputQueueDidFinish
594594
// TODO: What if the resize message fails to make it back?
595595
if (!didMaximize) {
596596
NSSize originalSize = [vimView frame].size;
597-
NSSize contentSize = [vimView desiredSize];
598-
contentSize = [self constrainContentSizeToScreenSize:contentSize];
599597
int rows = 0, cols = 0;
600-
contentSize = [vimView constrainRows:&rows columns:&cols
601-
toSize:contentSize];
598+
NSSize contentSize = [vimView constrainRows:&rows columns:&cols
599+
toSize:
600+
fullScreenWindow ? [fullScreenWindow frame].size :
601+
fullScreenEnabled ? desiredWindowSize :
602+
[self constrainContentSizeToScreenSize:[vimView desiredSize]]];
602603
[vimView setFrameSize:contentSize];
603604

604605
if (fullScreenWindow) {
@@ -1003,6 +1004,11 @@ - (void)windowDidMove:(NSNotification *)notification
10031004
[vimController sendMessage:SetWindowPositionMsgID data:data];
10041005
}
10051006

1007+
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize {
1008+
desiredWindowSize = frameSize;
1009+
return frameSize;
1010+
}
1011+
10061012
- (void)windowDidResize:(id)sender
10071013
{
10081014
if (resizingDueToMove) {

0 commit comments

Comments
 (0)