Skip to content

Commit b6bc72b

Browse files
committed
Fix starting up in non-native fullscreen resulting in black screen
Fix issues related to starting up in fullscreen mode (by setting `set fullscreen` in gvimrc). Fix black screen when starting in non-native fullscreen: - Fix #804 - Non-native fullscreen has an old behavior where it sets CGLayer mode on core text renderer to address rendering artifacts in pre-Mojave, and we have an insufficient block against it (by checking cgContext). In Mojave, we use buffered draws instead and prevent setting CGLayer by checking cgContext, but it is not yet initialized yet in this situation (since it's lazily initialized). Block against cgBufferDrawEnabled instead. - The CGLayer renderer is really deprecated at this point so ideally we could clean up the code a little bit in the future. Setting MMUseCGLayerAlways no longer results in black screen: - Fix #801 - CGLayer renderer is basically deprecated doesn't actually work in Mojave. Make sure setting MMUseCGLayerAlways won't trigger it if we are already using buffered draw (which is automatically the case in Mojave). Fix starting up in fullscreen resulting in a small Vim window: - When starting MacVim in fullscreen mode, the presentation is delayed until the window is made. need to make sure to set shouldResizeVimView in this code path too. Before the guioption-k fixes, there were a lot of random calls to recalculate sizes which was why this happened implicitly. Now need to make sure we do the right thing and call it.
1 parent 67754cb commit b6bc72b

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/MacVim/MMCoreTextView.m

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,13 @@ - (id)initWithFrame:(NSRect)frame
137137
boolForKey:MMBufferedDrawingKey];
138138
cgBufferDrawNeedsUpdateContext = NO;
139139

140-
cgLayerEnabled = [[NSUserDefaults standardUserDefaults]
141-
boolForKey:MMUseCGLayerAlwaysKey];
140+
cgLayerEnabled = NO;
141+
if (!cgBufferDrawEnabled) {
142+
// Buffered draw supercedes the CGLayer renderer, which is deprecated
143+
// and doesn't actually work in 10.14+.
144+
cgLayerEnabled = [[NSUserDefaults standardUserDefaults]
145+
boolForKey:MMUseCGLayerAlwaysKey];
146+
}
142147
cgLayerLock = [NSLock new];
143148

144149
// NOTE! It does not matter which font is set here, Vim will set its
@@ -795,7 +800,7 @@ - (void)performBatchDrawWithData:(NSData *)data
795800

796801
- (void)setCGLayerEnabled:(BOOL)enabled
797802
{
798-
if (cgContext)
803+
if (cgContext || cgBufferDrawEnabled)
799804
return;
800805

801806
cgLayerEnabled = enabled;

src/MacVim/MMWindowController.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ - (BOOL)presentWindow:(id)unused
348348
// GUIEnter auto command could cause this).
349349
[fullScreenWindow enterFullScreen];
350350
fullScreenEnabled = YES;
351+
shouldResizeVimView = YES;
351352
} else if (delayEnterFullScreen) {
352353
// Set alpha to zero so that the decorated window doesn't pop up
353354
// before we enter full-screen.

0 commit comments

Comments
 (0)