T19: the main window lets the desktop through while Background opacity is under 1, blurred or clear as Background blur says, set at open and as the settings change; Ely's new ColumnShell::glass grounds every column and the title bar in the palette's glass, which the opacity sets, and the Ely pin moves to it past 27 of Ely's own commits; dialogs stay solid; the terminal paints no second ground; shot names the window's AppKit views
This commit is contained in:
11 files changed
+137
-28
No files matched your search
+46
@@ -0,0 +1,46 @@
|
||||
use gpui::{Window, WindowBackgroundAppearance};
|
||||
|
||||
use crate::settings::Settings;
|
||||
|
||||
/// What the window shows of the desktop: blurred or clear while the background lets it through.
|
||||
pub fn appearance(settings: &Settings) -> WindowBackgroundAppearance {
|
||||
if settings.background_opacity >= 1.0 {
|
||||
WindowBackgroundAppearance::Opaque
|
||||
} else if settings.background_blur {
|
||||
WindowBackgroundAppearance::Blurred
|
||||
} else {
|
||||
WindowBackgroundAppearance::Transparent
|
||||
}
|
||||
}
|
||||
|
||||
/// Sets `window` to what the settings ask when it differs from `shown`; logs the way taken.
|
||||
pub fn follow(window: &Window, shown: &mut WindowBackgroundAppearance, settings: &Settings) {
|
||||
let wanted = appearance(settings);
|
||||
if wanted != *shown {
|
||||
*shown = wanted;
|
||||
window.set_background_appearance(wanted);
|
||||
log::info!("blur: the window is {wanted:?} on {}", std::env::consts::OS);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use gpui::WindowBackgroundAppearance::{Blurred, Opaque, Transparent};
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn the_desktop_shows_only_through_a_background_it_can_pass() {
|
||||
let at = |opacity, blur| {
|
||||
appearance(&Settings {
|
||||
background_opacity: opacity,
|
||||
background_blur: blur,
|
||||
..Settings::default()
|
||||
})
|
||||
};
|
||||
assert_eq!(at(1.0, true), Opaque);
|
||||
assert_eq!(at(1.0, false), Opaque);
|
||||
assert_eq!(at(0.88, true), Blurred);
|
||||
assert_eq!(at(0.3, false), Transparent);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user