This commit is contained in:
galister
2025-12-12 20:43:31 +09:00
parent c95e4a93f6
commit e1b209410e
7 changed files with 15 additions and 17 deletions

View File

@@ -208,7 +208,7 @@ pub fn openvr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
overlays.handle_task(&mut app, task)?;
}
TaskType::Playspace(task) => {
playspace.handle_task(&mut app, &mut chaperone_mgr, task);
playspace.handle_task(&app, &mut chaperone_mgr, task);
}
TaskType::OpenVR(task) => match task {
OpenVrTask::ColorGain(channel, value) => {

View File

@@ -490,7 +490,7 @@ pub fn openxr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
}
TaskType::Playspace(task) => {
if let (Some(playspace), Some(monado)) = (playspace.as_mut(), monado.as_mut()) {
playspace.handle_task(&mut app, monado, task);
playspace.handle_task(&app, monado, task);
}
}
#[cfg(feature = "openvr")]

View File

@@ -123,7 +123,7 @@ pub(super) fn setup_custom_button<S: 'static>(
for i in 0..5 {
Toast::new(
ToastTopic::System,
format!("Fixing floor in {}", 5 - i).into(),
format!("Fixing floor in {}", 5 - i),
"Touch your controller to the floor!".into(),
)
.with_timeout(1.)
@@ -141,7 +141,7 @@ pub(super) fn setup_custom_button<S: 'static>(
Ok(EventResult::Consumed)
}),
"::ShellExec" => {
let state = Arc::new(ShellButtonState {
let state = Rc::new(ShellButtonState {
button: button.clone(),
exec: args.fold(String::new(), |c, n| c + " " + n),
mut_state: RefCell::new(ShellButtonMutableState::default()),
@@ -171,7 +171,7 @@ pub(super) fn setup_custom_button<S: 'static>(
"::OscSend" => {
use crate::subsystem::osc::parse_osc_value;
let Some(address) = args.next().map(|s| s.to_string()) else {
let Some(address) = args.next().map(std::string::ToString::to_string) else {
log::error!("{command} has missing arguments");
return;
};
@@ -248,7 +248,7 @@ fn shell_on_action(state: &ShellButtonState) -> anyhow::Result<()> {
mut_state.pid = Some(child.id());
mut_state.reader = Some(PipeReaderThread::new_from_child(child));
return Ok(());
Ok(())
}
fn shell_on_tick(state: &ShellButtonState, common: &mut event::CallbackDataCommon, piped: bool) {

View File

@@ -58,7 +58,7 @@ impl PipeReaderThread {
}
c.wait()
.inspect_err(|e| log::error!("Failed to wait for child process: {e:?}"))
.map_or(false, |c| c.success())
.is_ok_and(|c| c.success())
}
});
@@ -112,7 +112,7 @@ impl PipeReaderThread {
self.handle.is_finished()
}
pub fn is_success(self) -> bool {
pub fn check_success(self) -> bool {
self.handle.join().unwrap_or(false)
}
}

View File

@@ -210,11 +210,10 @@ fn shell_on_tick(
label.set_text(common, Translation::from_raw_text(&text));
}
if reader.is_finished() {
if !mut_state.reader.take().unwrap().is_success() {
if reader.is_finished()
&& !mut_state.reader.take().unwrap().is_success() {
mut_state.next_try = Instant::now() + Duration::from_secs(15);
}
}
return Ok(());
} else if mut_state.next_try > Instant::now() {
return Ok(());
@@ -229,7 +228,7 @@ fn shell_on_tick(
mut_state.reader = Some(PipeReaderThread::new_from_child(child));
return Ok(());
Ok(())
}
struct FifoLabelState {
@@ -303,11 +302,10 @@ fn fifo_on_tick(
label.set_text(common, Translation::from_raw_text(&text));
}
if reader.is_finished() {
if !mut_state.reader.take().unwrap().is_success() {
if reader.is_finished()
&& !mut_state.reader.take().unwrap().is_success() {
mut_state.next_try = Instant::now() + Duration::from_secs(15);
}
}
}
const BAT_LOW: drawing::Color = drawing::Color::new(0.69, 0.38, 0.38, 1.);

View File

@@ -204,7 +204,7 @@ pub fn parse_osc_value(s: &str) -> anyhow::Result<OscType> {
}
}
anyhow::bail!("Unknown OSC type literal: {}", s)
anyhow::bail!("Unknown OSC type literal: {s}")
}
}
}

View File

@@ -189,7 +189,7 @@ where
}
OverlayTask::CleanupMirrors => {
let mut ids_to_remove = vec![];
for (oid, o) in self.overlays.iter() {
for (oid, o) in &self.overlays {
if !matches!(o.config.category, OverlayCategory::Mirror) {
continue;
}