fix: stop_running function

Use stop_running to set the global is_running AtomicBool to false, and to also, on a seperate thread, enable & then disable mouse capture, as was experience strange issue on Linux & WSL with mouse movements being piped to stdout
This commit is contained in:
Jack Wills
2023-02-28 18:10:24 +00:00
parent 31bfaa7a95
commit 2626250ace
3 changed files with 31 additions and 37 deletions
+2 -6
View File
@@ -21,6 +21,7 @@ use crate::{
app_data::{AppData, DockerControls, Header},
app_error::AppError,
docker_data::DockerMessage,
stop_running,
ui::{GuiState, SelectablePanel, Status},
};
pub use message::InputMessages;
@@ -134,12 +135,7 @@ impl InputHandler {
.lock()
.status_contains(&[Status::Error, Status::Init]);
if error_init || self.docker_sender.send(DockerMessage::Quit).await.is_err() {
// This is a fix for a weird bug on Linux + WSL which will output mouse movement to the stdout
std::thread::spawn(||{
execute!(std::io::stdout(), DisableMouseCapture).unwrap_or(());
});
self.is_running.store(false, Ordering::SeqCst);
stop_running(&self.is_running);
}
}