From 91937c4ada7766b796c5bb4195588907e670de6e Mon Sep 17 00:00:00 2001 From: Matt Robenolt Date: Tue, 12 Dec 2023 17:01:50 -0800 Subject: [PATCH] Apply feedback --- macos/Sources/Ghostty/SurfaceView.swift | 18 +++++------------- src/config/Config.zig | 3 ++- src/config/c_get.zig | 6 +++--- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/macos/Sources/Ghostty/SurfaceView.swift b/macos/Sources/Ghostty/SurfaceView.swift index 082406774..b8ad52f34 100644 --- a/macos/Sources/Ghostty/SurfaceView.swift +++ b/macos/Sources/Ghostty/SurfaceView.swift @@ -60,30 +60,22 @@ extension Ghostty { var opacity: Double = 0.85 let key = "unfocused-split-opacity" _ = ghostty_config_get(ghostty.config, &opacity, key, UInt(key.count)) - AppDelegate.logger.warning("ghostty_config_get(\(key))=\(opacity)") return 1 - opacity } + // The color for the rectable overlay when unfocused. private var unfocusedFill: Color { var rgb: UInt32 = 16777215 // white default let key = "unfocused-split-fill" _ = ghostty_config_get(ghostty.config, &rgb, key, UInt(key.count)) - AppDelegate.logger.warning("ghostty_config_get(\(key))=\(rgb)") let red = Double((rgb >> 16) & 0xff) let green = Double((rgb >> 8) & 0xff) let blue = Double(rgb & 0xff) - AppDelegate.logger.warning("red=\(red) green=\(green) blue=\(blue)") - return Color.init( - red: 255, - green: 0, - blue: 0 + return Color( + red: red / 255, + green: green / 255, + blue: blue / 255 ) -// return Color.init( -// red: red, -// green: green, -// blue: blue, -// opacity: unfocusedOpacity -// ) } var body: some View { diff --git a/src/config/Config.zig b/src/config/Config.zig index 778d6c70e..d468cf0e1 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -314,7 +314,8 @@ palette: Palette = .{}, /// clamped to the nearest valid value. @"unfocused-split-opacity": f64 = 0.85, -@"unfocused-split-fill": ?Color = null, +// The color to dim the unfocused split. +@"unfocused-split-fill": Color = Color{ .r = 255, .g = 255, .b = 255 }, /// The command to run, usually a shell. If this is not an absolute path, /// it'll be looked up in the PATH. If this is not set, a default will diff --git a/src/config/c_get.zig b/src/config/c_get.zig index 4a123674d..8032dce46 100644 --- a/src/config/c_get.zig +++ b/src/config/c_get.zig @@ -39,9 +39,9 @@ pub fn get(config: *const Config, k: Key, ptr_raw: *anyopaque) bool { ptr.* = @floatCast(value); }, - ?Color => { - const ptr: *?c_uint = @ptrCast(@alignCast(ptr_raw)); - ptr.* = if (value) |c| c.toInt() else null; + Color => { + const ptr: *c_uint = @ptrCast(@alignCast(ptr_raw)); + ptr.* = value.toInt(); }, else => |T| switch (@typeInfo(T)) {