Clean up old warnings and set up tasks to build all active projects #287

Merged
savanni merged 9 commits from nix-build-updates into main 2025-01-19 19:57:13 +00:00
3 changed files with 16 additions and 9 deletions
Showing only changes of commit da5144caea - Show all commits

1
Cargo.lock generated
View File

@ -925,6 +925,7 @@ dependencies = [
name = "cyberpunk-splash" name = "cyberpunk-splash"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"async-std",
"cairo-rs", "cairo-rs",
"cyberpunk", "cyberpunk",
"gio", "gio",

View File

@ -7,6 +7,7 @@ license = "GPL-3.0-only"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
async-std = "1.13.0"
cairo-rs = { version = "0.18" } cairo-rs = { version = "0.18" }
cyberpunk = { path = "../cyberpunk" } cyberpunk = { path = "../cyberpunk" }
gio = { version = "0.18" } gio = { version = "0.18" }

View File

@ -497,8 +497,7 @@ fn main() {
}); });
app.connect_activate(move |app| { app.connect_activate(move |app| {
let (gtk_tx, gtk_rx) = let (gtk_tx, gtk_rx) = async_std::channel::unbounded();
gtk::glib::MainContext::channel::<State>(gtk::glib::Priority::DEFAULT);
let window = gtk::ApplicationWindow::new(app); let window = gtk::ApplicationWindow::new(app);
window.present(); window.present();
@ -529,19 +528,25 @@ fn main() {
}); });
window.add_controller(keyboard_events); window.add_controller(keyboard_events);
gtk_rx.attach(None, move |state| { glib::spawn_future_local({
let splash = splash.clone();
async move {
while let Ok(state) = gtk_rx.recv().await {
println!("received state");
splash.set_state(state); splash.set_state(state);
glib::ControlFlow::Continue }
}
}); });
std::thread::spawn({ glib::spawn_future_local({
let state = state.clone(); let state = state.clone();
move || { async move {
state.write().unwrap().start(); state.write().unwrap().start();
loop { loop {
std::thread::sleep(Duration::from_millis(1000 / 60)); async_std::task::sleep(Duration::from_millis(1000 / 60)).await;
state.write().unwrap().run(Instant::now()); state.write().unwrap().run(Instant::now());
let _ = gtk_tx.send(*state.read().unwrap()); println!("state: {:?}", state.read().unwrap());
let _ = gtk_tx.send(*state.read().unwrap()).await;
} }
} }
}); });