Skip to content

Commit

Permalink
fix: blank ui after exit
Browse files Browse the repository at this point in the history
  • Loading branch information
Blooym committed Nov 4, 2024
1 parent 174695e commit 2a67f14
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "xlm"
description = "A painless way to use XIVLauncher on Steam Deck & Linux."
authors = ["Blooym"]
repository = "https://github.com/Blooym/xlm"
version = "0.2.2"
version = "0.2.3"
edition = "2021"

[dependencies]
Expand Down
16 changes: 8 additions & 8 deletions src/ui/launchui.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
use eframe::egui::{
Align, CentralPanel, Direction, Layout, Spinner, TopBottomPanel, ViewportBuilder,
ViewportCommand,
};
use std::sync::{Arc, RwLock};
use std::sync::{
atomic::{AtomicBool, Ordering},
Arc, RwLock,
};
use winit::platform::wayland::EventLoopBuilderExtWayland;

#[derive(Default)]
pub struct LaunchUI {
/// Whether all egui windows should close next frame.
should_close: Arc<RwLock<bool>>,
should_close: Arc<AtomicBool>,
/// The progress text to show while XLM is performing a setup.
pub progress_text: Arc<RwLock<&'static str>>,
}
Expand All @@ -27,17 +29,15 @@ impl LaunchUI {
event_loop_builder: Some(Box::new(|event_loop_builder| {
event_loop_builder.with_any_thread(true);
})),
run_and_return: true,
viewport: ViewportBuilder::default()
.with_inner_size([800.0, 500.0])
.with_resizable(false)
.with_decorations(false),
..Default::default()
},
move |ctx, _frame| {
if *close_copy.read().unwrap() {
ctx.send_viewport_cmd(ViewportCommand::Close);
return;
if close_copy.load(Ordering::Relaxed) {
std::process::exit(0);
}

ctx.set_pixels_per_point(1.5);
Expand Down Expand Up @@ -65,6 +65,6 @@ impl LaunchUI {

/// Closes any running egui windows regardless of the thread they're running on.
pub fn kill(self) {
*self.should_close.write().unwrap() = true;
self.should_close.store(true, Ordering::Relaxed);
}
}

0 comments on commit 2a67f14

Please sign in to comment.