Skip to content

Commit 58381df

Browse files
committed
Fix toggling native fullscreen on/off to restore window to correct size
Previously when using native fullscreen mode, if you toggle fullscreen off, the window will end up taking up the whole screen rather than restoring back to the original size. Fix that. The real issue is because when you resize MacVim's window (which the fullscreen restore code does), then callback (windowDidResize) triggered a complicated set of callbacks by calling setFrameSize:, which in turn resizes Vim, which in turn calls windowDidResize again, which usually does the right thing, but not always. Fix the window resize handler code to always respect the new window size by calling setFrameSizeKeepGUISize: instead which doesn't resize the window.
1 parent ccf63f3 commit 58381df

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/MacVim/MMWindowController.m

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,14 +1047,10 @@ - (void)windowDidResize:(id)sender
10471047
// may resize automatically) we simply set the view to fill the entire
10481048
// window. The vim view takes care of notifying Vim if the number of
10491049
// (rows,columns) changed.
1050-
if (shouldKeepGUISize) {
1051-
// This happens when code manually call setFrame: when we are performing
1052-
// an operation that wants to preserve GUI size (e.g. in updateToolbar:).
1053-
// Respect the wish, and pass that along.
1054-
[vimView setFrameSizeKeepGUISize:[self contentSize]];
1055-
} else {
1056-
[vimView setFrameSize:[self contentSize]];
1057-
}
1050+
// Calling setFrameSizeKeepGUISize: instead of setFrameSize: prevents a
1051+
// degenerate case where frameSizeMayHaveChanged: ends up resizing the window
1052+
// *again* causing windowDidResize: to be called.
1053+
[vimView setFrameSizeKeepGUISize:[self contentSize]];
10581054
}
10591055

10601056
- (void)windowDidChangeBackingProperties:(NSNotification *)notification

0 commit comments

Comments
 (0)