Skip to content

Fix non-native full screen to support 'blurradius' #1546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/MacVim/MMWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 6 additions & 1 deletion src/MacVim/MMWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ - (void)setContentSize:(NSSize)size
}

- (void)setBlurRadius:(int)radius
{
[MMWindow setBlurRadius:radius onWindow:self];
}

+ (void)setBlurRadius:(int)radius onWindow:(NSWindow *)win
{
if (radius >= 0) {
CGSConnectionID con = CGSMainConnectionID();
Expand All @@ -170,7 +175,7 @@ - (void)setBlurRadius:(int)radius
}
CGSSetWindowBackgroundBlurRadiusFunction* function = GetCGSSetWindowBackgroundBlurRadiusFunction();
if (function) {
function(con, (int)[self windowNumber], radius);
function(con, (int)[win windowNumber], radius);
}
}
}
Expand Down
17 changes: 15 additions & 2 deletions src/MacVim/MMWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,8 @@ - (BOOL)presentWindow:(id)unused
// 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];
Expand Down Expand Up @@ -1017,6 +1019,9 @@ - (void)setBlurRadius:(int)radius
blurRadius = radius;
if (windowPresented) {
[decoratedWindow setBlurRadius:radius];
if (fullScreenWindow) {
[MMWindow setBlurRadius:radius onWindow:fullScreenWindow];
}
}
}

Expand Down Expand Up @@ -1045,8 +1050,9 @@ - (void)enterFullScreen:(int)fuoptions backgroundColor:(NSColor *)back

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];
}
Expand All @@ -1069,6 +1075,13 @@ - (void)enterFullScreen:(int)fuoptions backgroundColor:(NSColor *)back
[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;
Expand Down