mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-07 15:37:14 +02:00
Merge pull request #828 from ychin/fix_pre_mojave_notitlebar
Fix borderless (MMNoTitleBarWindow) mode in pre-Mojave renderers
This commit is contained in:
@@ -114,6 +114,7 @@
|
||||
- (NSRect)rectForRow:(int)row column:(int)column numRows:(int)nr
|
||||
numColumns:(int)nc;
|
||||
- (void)setCGLayerEnabled:(BOOL)enabled;
|
||||
- (BOOL)getCGLayerEnabled;
|
||||
|
||||
//
|
||||
// NSTextView methods
|
||||
|
||||
@@ -809,6 +809,11 @@ defaultAdvanceForFont(NSFont *font)
|
||||
[self releaseCGLayer];
|
||||
}
|
||||
|
||||
- (BOOL)getCGLayerEnabled
|
||||
{
|
||||
return cgLayerEnabled;
|
||||
}
|
||||
|
||||
- (void)releaseCGLayer
|
||||
{
|
||||
if (cgLayer) {
|
||||
|
||||
@@ -34,6 +34,9 @@
|
||||
// Controls the speed of the fade in and out.
|
||||
double fadeTime;
|
||||
double fadeReservationTime;
|
||||
|
||||
// For pre-10.14 we manually sets CGLayer mode, so need to remember the original state
|
||||
BOOL origCGLayerEnabled;
|
||||
}
|
||||
|
||||
- (MMFullScreenWindow *)initWithWindow:(NSWindow *)t view:(MMVimView *)v
|
||||
|
||||
@@ -113,6 +113,8 @@ enum {
|
||||
fadeTime = MIN(fadeTime, 0.5 * (kCGMaxDisplayReservationInterval - 1));
|
||||
fadeReservationTime = 2.0 * fadeTime + 1;
|
||||
|
||||
origCGLayerEnabled = NO;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -172,8 +174,11 @@ enum {
|
||||
oldPosition = [view frame].origin;
|
||||
|
||||
[view removeFromSuperviewWithoutNeedingDisplay];
|
||||
if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_12)
|
||||
if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_12) {
|
||||
// This shouldn't do much in 10.14+.
|
||||
origCGLayerEnabled = [[view textView] getCGLayerEnabled];
|
||||
[[view textView] setCGLayerEnabled:YES];
|
||||
}
|
||||
[[self contentView] addSubview:view];
|
||||
[self setInitialFirstResponder:[view textView]];
|
||||
|
||||
@@ -289,7 +294,7 @@ enum {
|
||||
[self close];
|
||||
|
||||
if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_12)
|
||||
[[view textView] setCGLayerEnabled:NO];
|
||||
[[view textView] setCGLayerEnabled:origCGLayerEnabled];
|
||||
|
||||
// Set the text view to initial first responder, otherwise the 'plus'
|
||||
// button on the tabline steals the first responder status.
|
||||
|
||||
@@ -74,4 +74,5 @@
|
||||
- (void)deleteSign:(NSString *)signName;
|
||||
- (void)setToolTipAtMousePoint:(NSString *)string;
|
||||
- (void)setCGLayerEnabled:(BOOL)enabled;
|
||||
- (BOOL)getCGLayerEnabled;
|
||||
@end
|
||||
|
||||
@@ -527,6 +527,11 @@
|
||||
// ONLY in Core Text!
|
||||
}
|
||||
|
||||
- (BOOL)getCGLayerEnabled
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)isOpaque
|
||||
{
|
||||
return NO;
|
||||
|
||||
@@ -200,6 +200,15 @@
|
||||
// Make us safe on pre-tiger OSX
|
||||
if ([win respondsToSelector:@selector(_setContentHasShadow:)])
|
||||
[win _setContentHasShadow:NO];
|
||||
|
||||
if (!(styleMask & NSWindowStyleMaskTitled)) {
|
||||
// In the no titlebar mode (aka borderless), we need to set CGLayer
|
||||
// mode since otherwise the legacy renderer would not render properly.
|
||||
// For more reference see MMFullscreenWindow's enterFullscreen:
|
||||
// This shouldn't do much in 10.14+.
|
||||
if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_12)
|
||||
[[vimView textView] setCGLayerEnabled:YES];
|
||||
}
|
||||
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
|
||||
// Building on Mac OS X 10.7 or greater.
|
||||
|
||||
Reference in New Issue
Block a user