macos: set background opacity/blur on window controller not surface

This commit is contained in:
Mitchell Hashimoto
2024-06-07 12:31:45 -07:00
parent 6dd88a1bb2
commit 25484d2ccc
5 changed files with 25 additions and 46 deletions

View File

@@ -1474,11 +1474,6 @@ pub const CAPI = struct {
return surface.app;
}
/// Returns true if the surface has transparency set.
export fn ghostty_surface_transparent(surface: *Surface) bool {
return surface.app.config.@"background-opacity" < 1.0;
}
/// Returns true if the surface needs to confirm quitting.
export fn ghostty_surface_needs_confirm_quit(surface: *Surface) bool {
return surface.core_surface.needsConfirmQuit();
@@ -1850,13 +1845,13 @@ pub const CAPI = struct {
/// This uses an undocumented, non-public API because this is what
/// every terminal appears to use, including Terminal.app.
export fn ghostty_set_window_background_blur(
ptr: *Surface,
app: *App,
window: *anyopaque,
) void {
// This is only supported on macOS
if (comptime builtin.target.os.tag != .macos) return;
const config = ptr.app.config;
const config = app.config;
// Do nothing if we don't have background transparency enabled
if (config.@"background-opacity" >= 1.0) return;

View File

@@ -368,9 +368,6 @@ palette: Palette = .{},
/// The opacity level (opposite of transparency) of the background. A value of
/// 1 is fully opaque and a value of 0 is fully transparent. A value less than 0
/// or greater than 1 will be clamped to the nearest valid value.
///
/// Changing this value at runtime (and reloading config) will only affect new
/// windows, tabs, and splits.
@"background-opacity": f64 = 1.0,
/// A positive value enables blurring of the background when background-opacity