From b2b8278ffee315f6cd6e463f2eb26c213a091cf9 Mon Sep 17 00:00:00 2001 From: 404oops Date: Fri, 2 Oct 2026 22:22:13 +0200 Subject: [PATCH] Bump Vampir to 0.2.0 --- Cargo.lock | 4 ++-- crates/immersion/Cargo.toml | 2 +- crates/immersion/src/app.rs | 28 ++++++++++------------------ packaging/flatpak/cargo-sources.json | 12 ++++++------ 4 files changed, 19 insertions(+), 27 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c295d3a..57697e2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6065,9 +6065,9 @@ dependencies = [ [[package]] name = "vampir" -version = "0.1.5" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "916a9ebed013412a74e97f2bb6cd39bfe250458cc19d49322a834f32a8f4c561" +checksum = "4417e64bc5f488228a9aa3c1ca13b930310f74d3b826c9675894f282a4dbe45a" dependencies = [ "gpui-ce", "image", diff --git a/crates/immersion/Cargo.toml b/crates/immersion/Cargo.toml index 5bf9b57..5296593 100644 --- a/crates/immersion/Cargo.toml +++ b/crates/immersion/Cargo.toml @@ -13,7 +13,7 @@ winresource = "0.1" [dependencies] musit-core = { path = "../musit-core" } # The widget toolkit (https://github.com/404oops/vampir), from crates.io. -vampir = "0.1.5" +vampir = "0.2.0" gpui.workspace = true # The platform backend for gpui-ce. `runtime_shaders` compiles the Metal # shaders at startup so a machine with only the command line tools can build. diff --git a/crates/immersion/src/app.rs b/crates/immersion/src/app.rs index 8003975..39dafa3 100644 --- a/crates/immersion/src/app.rs +++ b/crates/immersion/src/app.rs @@ -5,12 +5,11 @@ use std::sync::Arc; use std::time::{Duration, Instant}; use gpui::{ - Bounds, Context, Entity, Pixels, ScrollHandle, UniformListScrollHandle, Window, - WindowAppearance, div, prelude::*, + Bounds, Context, Entity, Pixels, ScrollHandle, UniformListScrollHandle, Window, div, prelude::*, }; use musit_core::backend::{AppBackend, BackendEvent, ColorSchemeMode, PlatformHooks}; -use crate::theme::{MAX_SATURATION, Theme}; +use crate::theme::Theme; use crate::ui::controls::{ CONFIRM_DIALOG, DETAILS_SPLIT, HUE_SLIDER, LAYOUT_DIALOG, LIST_SPLIT, SATURATION_SLIDER, }; @@ -299,10 +298,7 @@ impl RootView { }; let backend = AppBackend::with_platform(platform_hooks); - let system_dark = matches!( - window.appearance(), - WindowAppearance::Dark | WindowAppearance::VibrantDark - ); + let system_dark = vampir::theme::system_dark(window); let color_scheme = backend.color_scheme_mode(); let dark = match color_scheme { ColorSchemeMode::Dark => true, @@ -407,10 +403,7 @@ impl RootView { .observe_window_appearance({ let weak = cx.entity().downgrade(); move |window, cx| { - let dark = matches!( - window.appearance(), - WindowAppearance::Dark | WindowAppearance::VibrantDark - ); + let dark = vampir::theme::system_dark(window); if let Some(root) = weak.upgrade() { root.update(cx, |root, cx| { root.system_dark = dark; @@ -1135,10 +1128,7 @@ impl RootView { impl Render for RootView { fn render(&mut self, window: &mut Window, cx: &mut Context) -> impl IntoElement { // Keep "System" scheme in sync even if the observer misses a change. - let system_dark = matches!( - window.appearance(), - WindowAppearance::Dark | WindowAppearance::VibrantDark - ); + let system_dark = vampir::theme::system_dark(window); if system_dark != self.system_dark { self.system_dark = system_dark; self.recompute_theme(cx); @@ -1169,7 +1159,7 @@ impl Render for RootView { // the graph pan is a drag of the app's own and shares the stream. let root = vampir::handle_keys(div().id("root"), self, cx) .size_full() - .font_family(".SystemUIFont") + .font_family(vampir::ui_font()) .bg(crate::ui::lighting::lit(theme.app_background, 0.035)) .text_color(theme.text_primary) .on_action(cx.listener(Self::dismiss)) @@ -1205,7 +1195,9 @@ impl RootView { fn set_hue_from_ratio(&mut self, ratio: f32, cx: &mut Context) { // Cap below 360: set_theme_hue wraps modulo 360, which would snap // the thumb from the right edge back to the left. - let value = (ratio * 360.0).round().min(359.0) as f64; + let value = vampir::theme::Theme::hue_from_track(ratio) + .round() + .min(359.0); if (self.backend.theme_hue() - value).abs() < 0.5 { return; } @@ -1219,7 +1211,7 @@ impl RootView { fn set_saturation_from_ratio(&mut self, ratio: f32, cx: &mut Context) { // Whole percent steps, so the readout beside the slider and the // saved value agree. - let value = (ratio as f64 * MAX_SATURATION * 100.0).round() / 100.0; + let value = (vampir::theme::Theme::saturation_from_track(ratio) * 100.0).round() / 100.0; if (self.backend.theme_saturation() - value).abs() < 0.005 { return; } diff --git a/packaging/flatpak/cargo-sources.json b/packaging/flatpak/cargo-sources.json index e972554..3ef703f 100644 --- a/packaging/flatpak/cargo-sources.json +++ b/packaging/flatpak/cargo-sources.json @@ -7594,14 +7594,14 @@ { "type": "archive", "archive-type": "tar-gzip", - "url": "https://static.crates.io/crates/vampir/vampir-0.1.5.crate", - "sha256": "916a9ebed013412a74e97f2bb6cd39bfe250458cc19d49322a834f32a8f4c561", - "dest": "cargo/vendor/vampir-0.1.5" + "url": "https://static.crates.io/crates/vampir/vampir-0.2.0.crate", + "sha256": "4417e64bc5f488228a9aa3c1ca13b930310f74d3b826c9675894f282a4dbe45a", + "dest": "cargo/vendor/vampir-0.2.0" }, { "type": "inline", - "contents": "{\"package\": \"916a9ebed013412a74e97f2bb6cd39bfe250458cc19d49322a834f32a8f4c561\", \"files\": {}}", - "dest": "cargo/vendor/vampir-0.1.5", + "contents": "{\"package\": \"4417e64bc5f488228a9aa3c1ca13b930310f74d3b826c9675894f282a4dbe45a\", \"files\": {}}", + "dest": "cargo/vendor/vampir-0.2.0", "dest-filename": ".cargo-checksum.json" }, { @@ -9521,4 +9521,4 @@ "dest": "cargo", "dest-filename": "config" } -] \ No newline at end of file +]