Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/immersion/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
28 changes: 10 additions & 18 deletions crates/immersion/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -1135,10 +1128,7 @@ impl RootView {
impl Render for RootView {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> 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);
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -1205,7 +1195,9 @@ impl RootView {
fn set_hue_from_ratio(&mut self, ratio: f32, cx: &mut Context<Self>) {
// 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;
}
Expand All @@ -1219,7 +1211,7 @@ impl RootView {
fn set_saturation_from_ratio(&mut self, ratio: f32, cx: &mut Context<Self>) {
// 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;
}
Expand Down
12 changes: 6 additions & 6 deletions packaging/flatpak/cargo-sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
{
Expand Down Expand Up @@ -9521,4 +9521,4 @@
"dest": "cargo",
"dest-filename": "config"
}
]
]
Loading