mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-04-27 20:08:41 +03:00
Make special blending mode class more generic
This allows us to specify what kind of context we'd like our vibrant layer to exist in (light or dark).
This commit is contained in:
@ -70,7 +70,7 @@
|
||||
C159E81D2B66A06B00FDFE9C /* OSColor+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C159E81C2B66A06B00FDFE9C /* OSColor+Extension.swift */; };
|
||||
C159E89D2B69A2EF00FDFE9C /* OSColor+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C159E81C2B66A06B00FDFE9C /* OSColor+Extension.swift */; };
|
||||
C1F26EA72B738B9900404083 /* NSView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1F26EA62B738B9900404083 /* NSView+Extension.swift */; };
|
||||
C1F26EE92B76CBFC00404083 /* TerminalWindowButtonsBackdropOverlayLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = C1F26EE82B76CBFC00404083 /* TerminalWindowButtonsBackdropOverlayLayer.m */; };
|
||||
C1F26EE92B76CBFC00404083 /* VibrantLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = C1F26EE82B76CBFC00404083 /* VibrantLayer.m */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
@ -133,8 +133,8 @@
|
||||
AEF9CE232B6AD07A0017E195 /* TerminalToolbar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TerminalToolbar.swift; sourceTree = "<group>"; };
|
||||
C159E81C2B66A06B00FDFE9C /* OSColor+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "OSColor+Extension.swift"; sourceTree = "<group>"; };
|
||||
C1F26EA62B738B9900404083 /* NSView+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSView+Extension.swift"; sourceTree = "<group>"; };
|
||||
C1F26EE72B76CBFC00404083 /* TerminalWindowButtonsBackdropOverlayLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TerminalWindowButtonsBackdropOverlayLayer.h; sourceTree = "<group>"; };
|
||||
C1F26EE82B76CBFC00404083 /* TerminalWindowButtonsBackdropOverlayLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TerminalWindowButtonsBackdropOverlayLayer.m; sourceTree = "<group>"; };
|
||||
C1F26EE72B76CBFC00404083 /* VibrantLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VibrantLayer.h; sourceTree = "<group>"; };
|
||||
C1F26EE82B76CBFC00404083 /* VibrantLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VibrantLayer.m; sourceTree = "<group>"; };
|
||||
C1F26EEA2B76CC2400404083 /* ghostty-bridging-header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ghostty-bridging-header.h"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
@ -202,6 +202,8 @@
|
||||
A59FB5D02AE0DEA7009128F3 /* MetalView.swift */,
|
||||
C159E81C2B66A06B00FDFE9C /* OSColor+Extension.swift */,
|
||||
C1F26EA62B738B9900404083 /* NSView+Extension.swift */,
|
||||
C1F26EE72B76CBFC00404083 /* VibrantLayer.h */,
|
||||
C1F26EE82B76CBFC00404083 /* VibrantLayer.m */,
|
||||
A5CEAFDA29B8005900646FDA /* SplitView */,
|
||||
);
|
||||
path = Helpers;
|
||||
@ -293,8 +295,6 @@
|
||||
A5D0AF3A2B36A1DE00D21823 /* TerminalRestorable.swift */,
|
||||
A596309D2AEE1D6C00D64628 /* TerminalView.swift */,
|
||||
A51B78462AF4B58B00F3EDB9 /* TerminalWindow.swift */,
|
||||
C1F26EE72B76CBFC00404083 /* TerminalWindowButtonsBackdropOverlayLayer.h */,
|
||||
C1F26EE82B76CBFC00404083 /* TerminalWindowButtonsBackdropOverlayLayer.m */,
|
||||
AEF9CE232B6AD07A0017E195 /* TerminalToolbar.swift */,
|
||||
A535B9D9299C569B0017E2E4 /* ErrorView.swift */,
|
||||
);
|
||||
@ -488,7 +488,7 @@
|
||||
A56D58892ACDE6CA00508D2C /* ServiceProvider.swift in Sources */,
|
||||
A51BFC222B2FB6B400E92F16 /* AboutView.swift in Sources */,
|
||||
A5278A9B2AA05B2600CD3039 /* Ghostty.Input.swift in Sources */,
|
||||
C1F26EE92B76CBFC00404083 /* TerminalWindowButtonsBackdropOverlayLayer.m in Sources */,
|
||||
C1F26EE92B76CBFC00404083 /* VibrantLayer.m in Sources */,
|
||||
A59630972AEE163600D64628 /* HostingWindow.swift in Sources */,
|
||||
A59630A02AEF6AEB00D64628 /* TerminalManager.swift in Sources */,
|
||||
A51BFC2B2B30F6BE00E92F16 /* UpdateDelegate.swift in Sources */,
|
||||
|
@ -1,3 +1,3 @@
|
||||
// C imports here are exposed to Swift.
|
||||
|
||||
#import "TerminalWindowButtonsBackdropOverlayLayer.h"
|
||||
#import "VibrantLayer.h"
|
||||
|
@ -350,7 +350,7 @@ fileprivate class WindowDragView: NSView {
|
||||
|
||||
// A view that matches the color of selected and unselected tabs in the adjacent tab bar.
|
||||
fileprivate class WindowButtonsBackdropView: NSView {
|
||||
private let overlayLayer = TerminalWindowButtonsBackdropOverlayLayer()
|
||||
private let overlayLayer = VibrantLayer()
|
||||
private let isLightTheme: Bool
|
||||
|
||||
var isHighlighted: Bool = true {
|
||||
|
@ -1,4 +0,0 @@
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
@interface TerminalWindowButtonsBackdropOverlayLayer: CALayer
|
||||
@end
|
@ -1,9 +0,0 @@
|
||||
#import "TerminalWindowButtonsBackdropOverlayLayer.h"
|
||||
|
||||
@implementation TerminalWindowButtonsBackdropOverlayLayer
|
||||
|
||||
// A private compositing filter ("plus darker") that is used in titlebar
|
||||
// tab bars to create the effect of recessed, unselected tabs.
|
||||
- (id)compositingFilter { return @"plusD"; }
|
||||
|
||||
@end
|
16
macos/Sources/Helpers/VibrantLayer.h
Normal file
16
macos/Sources/Helpers/VibrantLayer.h
Normal file
@ -0,0 +1,16 @@
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
typedef NS_ENUM(NSUInteger, VibrantLayerType) {
|
||||
VibrantLayerTypeLight,
|
||||
VibrantLayerTypeDark
|
||||
};
|
||||
|
||||
// This layer can be used to recreate the "vibrant" appearance you see of
|
||||
// views placed inside `NSVisualEffectView`s. When a light NSAppearance is
|
||||
// active, we will use the private "plus darker" blend mode. For dark
|
||||
// appearances we use "plus lighter".
|
||||
@interface VibrantLayer : CALayer
|
||||
|
||||
- (id)initForAppearance:(VibrantLayerType)type;
|
||||
|
||||
@end
|
27
macos/Sources/Helpers/VibrantLayer.m
Normal file
27
macos/Sources/Helpers/VibrantLayer.m
Normal file
@ -0,0 +1,27 @@
|
||||
#import "VibrantLayer.h"
|
||||
|
||||
@interface VibrantLayer()
|
||||
|
||||
@property (nonatomic) VibrantLayerType type;
|
||||
|
||||
@end
|
||||
|
||||
@implementation VibrantLayer
|
||||
|
||||
- (id)initForAppearance:(VibrantLayerType)type {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_type = type;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)compositingFilter {
|
||||
if (self.type == VibrantLayerTypeLight) {
|
||||
return @"plusD";
|
||||
} else {
|
||||
return @"plusL";
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
Reference in New Issue
Block a user