📦📎-fixes, typo fixes

This commit is contained in:
Aleksander
2025-09-20 12:17:17 +02:00
parent cfb733de09
commit b9e5541971
41 changed files with 494 additions and 498 deletions

View File

@@ -61,10 +61,11 @@ fn set_clients_io_active(monado: &mut Monado, active: bool) {
}
};
if name != "wlx-overlay-s" && state.contains(ClientState::ClientSessionVisible) {
if let Err(e) = client.set_io_active(active) {
warn!("Failed to set io active for client: {e}");
}
if name != "wlx-overlay-s"
&& state.contains(ClientState::ClientSessionVisible)
&& let Err(e) = client.set_io_active(active)
{
warn!("Failed to set io active for client: {e}");
}
}
}

View File

@@ -4,7 +4,7 @@ use std::{
time::{Duration, Instant},
};
use glam::{bool, Affine3A, Quat, Vec3};
use glam::{Affine3A, Quat, Vec3, bool};
use libmonado as mnd;
use openxr::{self as xr, Quaternionf, Vector2f, Vector3f};
use serde::{Deserialize, Serialize};
@@ -15,7 +15,7 @@ use crate::{
state::{AppSession, AppState},
};
use super::{helpers::posef_to_transform, XrState};
use super::{XrState, helpers::posef_to_transform};
static CLICK_TIMES: [Duration; 3] = [
Duration::ZERO,
@@ -229,21 +229,21 @@ impl OpenXrInputSource {
role: TrackedDeviceRole,
app: &mut AppState,
) {
if let Ok(status) = device.battery_status() {
if status.present {
app.input_state.devices.push(TrackedDevice {
soc: Some(status.charge),
charging: status.charging,
role,
});
log::debug!(
"Device {} role {:#?}: {:.0}% (charging {})",
device.index,
role,
status.charge * 100.0f32,
status.charging
);
}
if let Ok(status) = device.battery_status()
&& status.present
{
app.input_state.devices.push(TrackedDevice {
soc: Some(status.charge),
charging: status.charging,
role,
});
log::debug!(
"Device {} role {:#?}: {:.0}% (charging {})",
device.index,
role,
status.charge * 100.0f32,
status.charging
);
}
}
@@ -268,11 +268,11 @@ impl OpenXrInputSource {
let mut seen = Vec::<u32>::with_capacity(32);
for (mnd_role, wlx_role) in roles {
let device = monado.device_from_role(mnd_role);
if let Ok(mut device) = device {
if !seen.contains(&device.index) {
seen.push(device.index);
Self::update_device_battery_status(&mut device, wlx_role, app);
}
if let Ok(mut device) = device
&& !seen.contains(&device.index)
{
seen.push(device.index);
Self::update_device_battery_status(&mut device, wlx_role, app);
}
}
if let Ok(devices) = monado.devices() {

View File

@@ -2,8 +2,8 @@ use std::{
collections::VecDeque,
ops::Add,
sync::{
atomic::{AtomicBool, AtomicUsize, Ordering},
Arc,
atomic::{AtomicBool, AtomicUsize, Ordering},
},
time::{Duration, Instant},
};
@@ -23,10 +23,10 @@ use crate::{
overlay::{OverlayData, ShouldRender},
task::{SystemTask, TaskType},
},
graphics::{init_openxr_graphics, CommandBuffers},
graphics::{CommandBuffers, init_openxr_graphics},
overlays::{
toast::{Toast, ToastTopic},
watch::{watch_fade, WATCH_NAME},
watch::{WATCH_NAME, watch_fade},
},
state::AppState,
subsystem::notifications::NotificationManager,
@@ -228,11 +228,11 @@ pub fn openxr_run(
}
}
if next_device_update <= Instant::now() {
if let Some(monado) = &mut monado {
OpenXrInputSource::update_devices(&mut app, monado);
next_device_update = Instant::now() + Duration::from_secs(30);
}
if next_device_update <= Instant::now()
&& let Some(monado) = &mut monado
{
OpenXrInputSource::update_devices(&mut app, monado);
next_device_update = Instant::now() + Duration::from_secs(30);
}
if !session_running {
@@ -375,10 +375,8 @@ pub fn openxr_run(
// Begin rendering
let mut buffers = CommandBuffers::default();
if !main_session_visible {
if let Some(skybox) = skybox.as_mut() {
skybox.render(&xr_state, &app, &mut buffers)?;
}
if !main_session_visible && let Some(skybox) = skybox.as_mut() {
skybox.render(&xr_state, &app, &mut buffers)?;
}
for o in overlays.iter_mut() {
@@ -427,11 +425,9 @@ pub fn openxr_run(
// Layer composition
let mut layers = vec![];
if !main_session_visible {
if let Some(skybox) = skybox.as_mut() {
for (idx, layer) in skybox.present(&xr_state, &app)?.into_iter().enumerate() {
layers.push(((idx as f32).mul_add(-50.0, 200.0), layer));
}
if !main_session_visible && let Some(skybox) = skybox.as_mut() {
for (idx, layer) in skybox.present(&xr_state, &app)?.into_iter().enumerate() {
layers.push(((idx as f32).mul_add(-50.0, 200.0), layer));
}
}
@@ -514,13 +510,13 @@ pub fn openxr_run(
});
}
TaskType::DropOverlay(sel) => {
if let Some(o) = overlays.mut_by_selector(&sel) {
if o.state.birthframe < cur_frame {
log::debug!("{}: destroy", o.state.name);
if let Some(o) = overlays.remove_by_selector(&sel) {
// set for deletion after all images are done showing
delete_queue.push((o, cur_frame + 5));
}
if let Some(o) = overlays.mut_by_selector(&sel)
&& o.state.birthframe < cur_frame
{
log::debug!("{}: destroy", o.state.name);
if let Some(o) = overlays.remove_by_selector(&sel) {
// set for deletion after all images are done showing
delete_queue.push((o, cur_frame + 5));
}
}
}

View File

@@ -5,8 +5,8 @@ use openxr as xr;
use smallvec::SmallVec;
use vulkano::{
image::{sys::RawImage, view::ImageView, ImageCreateInfo, ImageUsage},
Handle,
image::{ImageCreateInfo, ImageUsage, sys::RawImage, view::ImageView},
};
use wgui::gfx::WGfx;
@@ -109,7 +109,7 @@ impl WlxSwapchain {
Ok(())
}
pub(super) fn get_subimage(&self) -> xr::SwapchainSubImage<xr::Vulkan> {
pub(super) fn get_subimage(&self) -> xr::SwapchainSubImage<'_, xr::Vulkan> {
debug_assert!(self.ever_acquired, "swapchain was never acquired!");
xr::SwapchainSubImage::new()
.swapchain(&self.swapchain)