macos: detect renderer health failures and show error view

This commit is contained in:
Mitchell Hashimoto
2024-01-16 11:27:18 -08:00
parent 0277a0fb4c
commit 376345dcae
8 changed files with 120 additions and 8 deletions

View File

@@ -197,6 +197,24 @@ extension Ghostty {
_ = ghostty_config_get(config, &v, key, UInt(key.count))
return v
}
var backgroundColor: Color {
var rgb: UInt32 = 0
let bg_key = "background"
if (!ghostty_config_get(config, &rgb, bg_key, UInt(bg_key.count))) {
return Color(NSColor.windowBackgroundColor)
}
let red = Double(rgb & 0xff)
let green = Double((rgb >> 8) & 0xff)
let blue = Double((rgb >> 16) & 0xff)
return Color(
red: red / 255,
green: green / 255,
blue: blue / 255
)
}
var backgroundOpacity: Double {
guard let config = self.config else { return 1 }