Skip to content

Commit 131715d

Browse files
committed
refactor: ⬆️ Upgrade egui and other deps
1 parent 2d487b0 commit 131715d

File tree

10 files changed

+307
-214
lines changed

10 files changed

+307
-214
lines changed

Cargo.lock

+269-183
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

alvr/audio/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ serde = "1"
1717

1818
[target.'cfg(windows)'.dependencies]
1919
widestring = "1"
20-
windows = { version = "0.51", features = [
20+
windows = { version = "0.52", features = [
2121
"Win32_Devices_FunctionDiscovery",
2222
"Win32_Foundation",
2323
"Win32_Media_Audio_Endpoints",

alvr/client_mock/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ alvr_client_core.workspace = true
1212
alvr_packets.workspace = true
1313
alvr_session.workspace = true
1414

15-
eframe = "0.23"
15+
eframe = "0.24"
1616
env_logger = "0.10"
1717
rand = "0.8"

alvr/client_mock/src/main.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use alvr_common::{
77
use alvr_packets::Tracking;
88
use alvr_session::CodecType;
99
use eframe::{
10-
egui::{self, CentralPanel, Context, RichText, Slider},
10+
egui::{CentralPanel, Context, RichText, Slider, ViewportBuilder},
1111
Frame, NativeOptions,
1212
};
1313
use std::{
@@ -308,7 +308,7 @@ fn main() {
308308
eframe::run_native(
309309
"Mock client",
310310
NativeOptions {
311-
initial_window_size: Some(egui::vec2(400.0, 400.0)),
311+
viewport: ViewportBuilder::default().with_inner_size((400.0, 400.0)),
312312
..Default::default()
313313
},
314314
Box::new(|_| Box::new(Window::new(input_sender, output_receiver))),

alvr/dashboard/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ alvr_gui_common.workspace = true
1616

1717
bincode = "1"
1818
chrono = "0.4"
19-
eframe = "0.23"
19+
eframe = "0.24"
2020
env_logger = "0.10"
2121
ico = "0.3"
2222
rand = "0.8"

alvr/dashboard/src/dashboard/mod.rs

+10-9
Original file line numberDiff line numberDiff line change
@@ -336,22 +336,23 @@ impl eframe::App for Dashboard {
336336
for request in requests {
337337
self.data_sources.request(request);
338338
}
339-
}
340339

341-
#[cfg(not(target_arch = "wasm32"))]
342-
fn on_close_event(&mut self) -> bool {
343-
if crate::data_sources::get_local_data_source()
344-
.settings()
345-
.steamvr_launcher
346-
.open_close_steamvr_with_dashboard
340+
if context.input(|state| state.viewport().close_requested())
341+
&& self
342+
.session
343+
.as_ref()
344+
.map(|s| {
345+
s.to_settings()
346+
.steamvr_launcher
347+
.open_close_steamvr_with_dashboard
348+
})
349+
.unwrap_or(false)
347350
{
348351
self.data_sources.request(ServerRequest::ShutdownSteamvr);
349352

350353
crate::steamvr_launcher::LAUNCHER
351354
.lock()
352355
.ensure_steamvr_shutdown()
353356
}
354-
355-
true
356357
}
357358
}

alvr/dashboard/src/main.rs

+11-7
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ use dashboard::Dashboard;
2222
#[cfg(not(target_arch = "wasm32"))]
2323
fn main() {
2424
use alvr_common::ALVR_VERSION;
25-
use eframe::{egui, IconData, NativeOptions};
25+
use eframe::{
26+
egui::{IconData, ViewportBuilder},
27+
NativeOptions,
28+
};
2629
use ico::IconDir;
2730
use std::{env, fs};
2831
use std::{io::Cursor, sync::mpsc};
@@ -85,12 +88,13 @@ fn main() {
8588
eframe::run_native(
8689
&format!("ALVR Dashboard (streamer v{})", *ALVR_VERSION),
8790
NativeOptions {
88-
icon_data: Some(IconData {
89-
rgba: image.rgba_data().to_owned(),
90-
width: image.width(),
91-
height: image.height(),
92-
}),
93-
initial_window_size: Some(egui::vec2(870.0, 600.0)),
91+
viewport: ViewportBuilder::default()
92+
.with_inner_size((870.0, 600.0))
93+
.with_icon(IconData {
94+
rgba: image.rgba_data().to_owned(),
95+
width: image.width(),
96+
height: image.height(),
97+
}),
9498
centered: true,
9599
..Default::default()
96100
},

alvr/gui_common/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ license.workspace = true
99
[dependencies]
1010
alvr_common.workspace = true
1111

12-
egui = "0.23"
12+
egui = "0.24"

alvr/launcher/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ alvr_common.workspace = true
1010
alvr_gui_common.workspace = true
1111

1212
anyhow = "1"
13-
eframe = "0.23"
13+
eframe = "0.24"
1414
futures-util = "0.3.28"
1515
open = "5"
1616
reqwest = { version = "0.11", default-features = false, features = ["rustls-tls", "stream", "json"] }

alvr/launcher/src/main.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ use std::{
1313
};
1414

1515
use eframe::{
16-
egui::{Button, CentralPanel, ComboBox, Context, Frame, Grid, Layout, ProgressBar, Window},
16+
egui::{
17+
Button, CentralPanel, ComboBox, Context, Frame, Grid, Layout, ProgressBar, ViewportCommand,
18+
Window,
19+
},
1720
emath::{Align, Align2},
1821
epaint::Color32,
1922
};
@@ -423,7 +426,7 @@ impl Launcher {
423426
}
424427

425428
impl eframe::App for Launcher {
426-
fn update(&mut self, ctx: &Context, frame: &mut eframe::Frame) {
429+
fn update(&mut self, ctx: &Context, _: &mut eframe::Frame) {
427430
while let Ok(msg) = self.rx.try_recv() {
428431
match msg {
429432
WorkerMsg::VersionData(data) => self.version_data = Some(data),
@@ -470,7 +473,7 @@ impl eframe::App for Launcher {
470473
}
471474
}
472475
self.tx.send(GuiMsg::Quit).unwrap();
473-
frame.close();
476+
ctx.send_viewport_cmd(ViewportCommand::Close);
474477
}
475478
if ui
476479
.add_enabled(
@@ -548,11 +551,10 @@ impl eframe::App for Launcher {
548551
});
549552
}
550553
});
551-
}
552554

553-
fn on_close_event(&mut self) -> bool {
554-
self.tx.send(GuiMsg::Quit).unwrap();
555-
true
555+
if ctx.input(|i| i.viewport().close_requested()) {
556+
self.tx.send(GuiMsg::Quit).unwrap();
557+
}
556558
}
557559
}
558560

@@ -756,7 +758,7 @@ async fn install(
756758

757759
let buffer = download(tx, "Downloading Streamer", &url, client).await?;
758760

759-
let mut installation_dir = data_dir().extended(VERSIONS_SUBDIR).extended(&release.tag);
761+
let installation_dir = data_dir().extended(VERSIONS_SUBDIR).extended(&release.tag);
760762

761763
fs::create_dir_all(&installation_dir)?;
762764

0 commit comments

Comments
 (0)