Merge pull request #1546 from ychin/fix-blurradius-fullscreen

Fix non-native full screen to support 'blurradius'
This commit is contained in:
Yee Cheng Chin
2025-02-04 23:59:36 -08:00
committed by GitHub
3 changed files with 22 additions and 3 deletions
+1
View File
@@ -29,6 +29,7 @@
- (void)setContentMaxSize:(NSSize)size;
- (void)setContentSize:(NSSize)size;
- (void)setBlurRadius:(int)radius;
+ (void)setBlurRadius:(int)radius onWindow:(NSWindow *)win;
- (IBAction)toggleFullScreen:(id)sender;
- (IBAction)realToggleFullScreen:(id)sender;
+6 -1
View File
@@ -162,6 +162,11 @@ static CGSSetWindowBackgroundBlurRadiusFunction* GetCGSSetWindowBackgroundBlurRa
}
- (void)setBlurRadius:(int)radius
{
[MMWindow setBlurRadius:radius onWindow:self];
}
+ (void)setBlurRadius:(int)radius onWindow:(NSWindow *)win
{
if (radius >= 0) {
CGSConnectionID con = CGSMainConnectionID();
@@ -170,7 +175,7 @@ static CGSSetWindowBackgroundBlurRadiusFunction* GetCGSSetWindowBackgroundBlurRa
}
CGSSetWindowBackgroundBlurRadiusFunction* function = GetCGSSetWindowBackgroundBlurRadiusFunction();
if (function) {
function(con, (int)[self windowNumber], radius);
function(con, (int)[win windowNumber], radius);
}
}
}
+15 -2
View File
@@ -367,6 +367,8 @@
// GUIEnter auto command could cause this).
[fullScreenWindow enterFullScreen];
fullScreenEnabled = YES;
if (blurRadius != 0)
[MMWindow setBlurRadius:blurRadius onWindow:fullScreenWindow];
shouldResizeVimView = YES;
} else if (delayEnterFullScreen) {
[self enterNativeFullScreen];
@@ -1017,6 +1019,9 @@
blurRadius = radius;
if (windowPresented) {
[decoratedWindow setBlurRadius:radius];
if (fullScreenWindow) {
[MMWindow setBlurRadius:radius onWindow:fullScreenWindow];
}
}
}
@@ -1045,8 +1050,9 @@
NSColor *fullscreenBg = back;
// See setDefaultColorsBackground: for why set a transparent
// background color, and why 0.001 instead of 0.
// Copy option: 'transparency'
// See setDefaultColorsBackground: for why set a transparent
// background color, and why 0.001 instead of 0.
if ([fullscreenBg alphaComponent] != 1) {
fullscreenBg = [fullscreenBg colorWithAlphaComponent:0.001];
}
@@ -1069,6 +1075,13 @@
[fullScreenWindow enterFullScreen];
fullScreenEnabled = YES;
// Copy option: 'blurradius'
// Do this here instead of in full screen window since this
// involves calling private APIs and we want to limit where we
// do that.
if (blurRadius != 0)
[MMWindow setBlurRadius:blurRadius onWindow:fullScreenWindow];
// The resize handle disappears so the vim view needs to update the
// scrollbars.
shouldResizeVimView = YES;