wayvr: clippy, update example config.yaml; wgui: fix booleans (#733)

This commit is contained in:
oo8dev authored and GitHub committed 2026-11-16 17:52:28 +01:00
1 parent 721e5a7790
commit 489386d067
26 files changed
+65 -82

No files matched your search

+1
View File
@@ -493,6 +493,7 @@ fn is_side_agnostic_action(action: &str) -> bool {
matches!(action, "show_hide" | "toggle_dashboard")
}
#[allow(clippy::too_many_arguments)]
fn chord_controls_for_output(
mp: &mut MacroParams,
parent: WidgetID,
+1
View File
@@ -359,6 +359,7 @@ impl OpenVrInputSource {
}
}
#[allow(clippy::too_many_arguments)]
fn update_handsfree(
pointer: &mut Pointer,
mode: HandsfreePointer,
+2 -1
View File
@@ -324,7 +324,7 @@ impl OpenXrInputSource {
let physical_inputs = &self.physical_inputs;
self.head
.update_head(&mut app.input_state.head, &xr, physical_inputs)?;
.update_head(&mut app.input_state.head, xr, physical_inputs)?;
app.input_state.eye_gaze = if xr.extra_exts.ext_eye_gaze_interaction {
self.handsfree_pointer.locate_tracked_pose(xr)?
@@ -505,6 +505,7 @@ impl OpenXrPointer {
.then(|| posef_to_transform(&location.pose)))
}
#[allow(clippy::too_many_arguments)]
pub(super) fn update_handsfree(
&mut self,
pointer: &mut Pointer,
+1
View File
@@ -110,6 +110,7 @@ pub enum SpawnPos {
/// Automatically spread out for user experience
Spread,
/// Spawn relative to a different overlay
#[allow(dead_code)] /* FIXME: unused */
Parent(OverlaySelector),
/// Resolve parent or app-id at the point of spawn
WlDefault(wvr::window::WindowHandle, Option<OverlayID>),
+1
View File
@@ -261,6 +261,7 @@ impl compositor::CompositorHandler for Application {
&client.get_data::<ClientState>().unwrap().compositor_state
}
#[allow(clippy::tuple_array_conversions)]
fn commit(&mut self, surface: &WlSurface) {
if let Some(icon) = self.pending_icon_changes.remove(&surface.id()) {
if icon.is_empty() {
+1
View File
@@ -320,6 +320,7 @@ pub fn rendered_surfaces_dirty(old: &[RenderedSurface], new: &[RenderedSurface])
return true;
}
#[allow(clippy::float_cmp)]
old.iter().zip(new).any(|(a, b)| {
a.surface_id != b.surface_id
|| a.pos != b.pos
+2 -2
View File
@@ -105,7 +105,7 @@ impl InputCapture {
init_tx,
dbus_session_address,
capture_input,
)
);
})?;
match init_rx.recv() {
@@ -372,7 +372,7 @@ fn worker_main(
log::debug!("input capture worker started");
let dbus = dbus_session_address.map_or_default(|s| DbusConnector::new(s));
let dbus = dbus_session_address.map_or_default(DbusConnector::new);
let mut grabbed = false;
// when set, arms a grab as soon as no keys are held
+3 -3
View File
@@ -198,6 +198,7 @@ const KEY_REPEAT_RATE: i32 = 50;
const WAYVR_SCREEN_RES: [i32; 2] = [2560, 1440];
impl WvrServerState {
#[allow(clippy::tuple_array_conversions)]
pub fn new(
gfx_extras: &WGfxExtras,
config: &GeneralConfig,
@@ -510,10 +511,9 @@ impl WvrServerState {
name.as_deref(),
restore_on_spawn,
)
.map(|size| {
.map_or(fallback_size, |size| {
client_size_from_overlay_size(size, ssd).clamp(min_size, max_size)
})
.unwrap_or(fallback_size);
});
let initial_overlay_size = overlay_size_from_client_size(
[initial_size.w as u32, initial_size.h as u32],
ssd,
+13 -32
View File
@@ -33,30 +33,20 @@ pub struct Window {
}
impl Window {
fn new(
toplevel: Rc<ToplevelSurface>,
process: process::ProcessHandle,
bounds: Size<i32, Logical>,
min_size: Size<i32, Logical>,
max_size: Size<i32, Logical>,
app_id: Option<Arc<str>>,
parent: Option<WindowHandle>,
name: Option<Arc<str>>,
restore_on_spawn: bool,
) -> Self {
fn new(par: CreateWindowParams) -> Self {
Self {
bounds,
min_size,
max_size: max_size.clamp(Size::new(160, 160), bounds),
bounds: par.bounds,
min_size: par.min_size,
max_size: par.max_size.clamp(Size::new(160, 160), par.bounds),
size_x: 0,
size_y: 0,
visible: true,
toplevel,
process,
app_id,
parent,
name,
restore_on_spawn,
toplevel: par.toplevel,
process: par.process,
app_id: par.app_id,
parent: par.parent,
name: par.name,
restore_on_spawn: par.restore_on_spawn,
pending_configure: None,
}
}
@@ -185,18 +175,9 @@ impl WindowManager {
}
pub fn create_window(&mut self, par: CreateWindowParams) -> WindowHandle {
let mut window = Window::new(
par.toplevel,
par.process,
par.bounds,
par.min_size,
par.max_size,
par.app_id,
par.parent,
par.name,
par.restore_on_spawn,
);
window.remember_committed_size(Size::new(par.size_x as i32, par.size_y as i32), None);
let (size_x, size_y) = (par.size_x, par.size_y);
let mut window = Window::new(par);
window.remember_committed_size(Size::new(size_x as i32, size_y as i32), None);
self.windows.insert(window)
}
+2
View File
@@ -9,6 +9,7 @@
clippy::default_trait_access,
clippy::doc_markdown,
clippy::match_wildcard_for_single_variants,
clippy::missing_errors_doc,
clippy::multiple_crate_versions,
clippy::needless_pass_by_ref_mut,
clippy::needless_pass_by_value,
@@ -151,6 +152,7 @@ fn init_run_params(no_audio: bool, session: bool, capture_input: bool) -> backen
}
}
#[must_use]
pub fn get_version_string() -> String {
format!(
"{} v. {}{}",
+1 -1
View File
@@ -196,7 +196,7 @@ impl OverlayBackend for EditModeBackendWrapper {
if !matches!(inner, ShouldRender::Unable)
&& let Some(ref frame_meta) = self.inner.frame_meta()
{
let (width_px, height_px) = (frame_meta.extent[0], frame_meta.extent[1]);
let (width_px, height_px) = frame_meta.extent.into();
let new_size = vec2(width_px as _, height_px as _);
if !self.panel.max_size.abs_diff_eq(new_size, 0.1) {
+4 -3
View File
@@ -55,9 +55,10 @@ impl Layout {
self.non_modifier_keys = self
.non_modifiers
.iter()
.filter_map(|key| match VirtualKey::from_str(key) {
Ok(vk) => Some(vk),
Err(_) => {
.filter_map(|key| {
if let Ok(vk) = VirtualKey::from_str(key) {
Some(vk)
} else {
log::error!("keyboard.yaml: Unknown non-modifier key '{key}'");
None
}
+1 -1
View File
@@ -985,7 +985,7 @@ impl<T> MainThreadWlxCapture<T>
where
T: WlxCapture<DmaExporterProxy, MainThreadFrame>,
{
pub fn new(inner: T, pool: CommandPool) -> Self {
pub const fn new(inner: T, pool: CommandPool) -> Self {
Self {
inner,
data: None,
+1 -1
View File
@@ -311,7 +311,7 @@ impl BakedToast {
self.id
}
pub fn with_id(mut self, id: ToastId) -> Self {
pub const fn with_id(mut self, id: ToastId) -> Self {
self.id = id;
self
}
+3 -2
View File
@@ -157,6 +157,7 @@ const BLEND_WAYLAND_ALPHA: AttachmentBlend = AttachmentBlend {
alpha_blend_op: BlendOp::Add,
};
#[allow(clippy::too_many_arguments)]
pub fn create_wl_window_overlay(
name: Arc<str>,
title: Arc<str>,
@@ -774,8 +775,8 @@ impl OverlayBackend for WvrWindowBackend {
}
let inner_extent = meta.extent;
let committed_window_extent = window_geometry.map_or(
[surface_size.w.max(1) as u32, surface_size.h.max(1) as u32],
let committed_window_extent = window_geometry.map_or_else(
|| [surface_size.w.max(1) as u32, surface_size.h.max(1) as u32],
|geometry| [geometry.size.w.max(1) as u32, geometry.size.h.max(1) as u32],
);
self.window_size = Some(overlay_size_from_client_size(
+12 -20
View File
@@ -3,7 +3,7 @@
# Default values are shown unless noted otherwise.
# In case you're not getting the expected result,
# check the logs at /tmp/wlx.log for parsing errors.
# check the logs at /tmp/wayvr.log for parsing errors.
## Only if built with `osc` feature. What port to send OSC messages to.
#osc_out_port: 9000
@@ -24,13 +24,6 @@
## Path to read the custom theme from, relative to `~/.config/wayvr`
#theme_path: "theme"
## These can be used to control the color theme of WayVR.
#color_text: "#ffffff"
#color_accent: "#008cff"
#color_danger: "#ff3300"
#color_faded: "#668299"
#color_background: "#010206"
## Path to custom skybox texture, relative to `~/.config/wayvr`
#skybox_texture: ""
@@ -64,9 +57,6 @@
# XSNotification: Center
# IpdChange: Hide
## Path to a custom notification sound, relative to `~/.config/wayvr`
#notification_sound: ""
## If `screen_render_down` is enabled,
## controls the maximum height of the screen
#screen_max_height: 1440
@@ -92,11 +82,13 @@
#sets_on_watch: false
## Force an alternative method for Wayland desktop capture.
## `auto`: default
## `pw_fallback`: Pipewire-based software capture
## `screencopy`: Software capture that works on some Wayland compositors
## `Auto`: default
## `PipeWire`: Pipewire-based GPU capture
## `PipeWireCpu`: Pipewire-based software (CPU) capture
## `ScreenCopyGpu`: Screencopy-based GPU capture
## `ScreenCopyCpu`: Screencopy-based CPU capture
## Other values that were previously here are no longer supported.
#capture_method: auto
#capture_method: Auto
## Monado/WiVRn only. Do not send controller input to other VR apps
## while WayVR is being hovered. Either hand will block both hand inputs!
@@ -144,10 +136,10 @@
#use_skybox: true
## Monado/WiVRn only. Opacity of the floor grid if use_skybox is enabled.
#grid_opacity: true
#grid_opacity: 1.0
## Hide the help popup that appears on your hand while grabbing an overlay
#hide_grab_help: false
## Show/hide the help popup that appears on your hand while grabbing an overlay
#show_grab_help: true
## Smoothing applied to the pointer.
## 1.0 → no smoothing
@@ -173,10 +165,10 @@
#keyboard_sound_enabled: true
## Multiplier for animation speed. 2.0 → double speed, 0.5 → half speed
#animation_speed: 1.0
#ui_animation_speed: 1.0
## Adjust this between 0..1 for a more rectangular feel.
#round_multiplier: 1.0
#ui_round_multiplier: 1.0
## Render screens & mirrors at a lower resolution.
## Avoids aliasing on 4K+ screens, and also saves VRAM
+1 -1
View File
@@ -9,7 +9,7 @@ impl SystemTaskManager {
pub fn handle_task(task: SystemTask) -> anyhow::Result<()> {
match task {
SystemTask::ChangeVolume(increase) => {
Self::update_volume(if increase { VOLUME_STEP } else { -VOLUME_STEP })
Self::update_volume(if increase { VOLUME_STEP } else { -VOLUME_STEP });
}
}
Ok(())
+2 -2
View File
@@ -176,7 +176,7 @@ pub fn overlay_scale_from_extent(size: [u32; 2]) -> (f32, f32) {
((w * h).sqrt() / RELATIVE_SIZE, w / 1920.0)
}
pub(crate) fn client_size_from_overlay_size(
pub fn client_size_from_overlay_size(
size: [u32; 2],
server_side_decorations: bool,
) -> Size<i32, Logical> {
@@ -194,7 +194,7 @@ pub(crate) fn client_size_from_overlay_size(
)
}
pub(crate) fn overlay_size_from_client_size(
pub const fn overlay_size_from_client_size(
size: [u32; 2],
server_side_decorations: bool,
) -> [u32; 2] {
+2
View File
@@ -107,6 +107,8 @@ impl CommandBufferBuilder {
})
}
// FIXME?
#[allow(clippy::arc_with_non_send_sync)]
pub fn build(mut self) -> anyhow::Result<Arc<BuiltCommandBuffer>> {
self.raw.finish()?;
Ok(Arc::new(BuiltCommandBuffer {
+1
View File
@@ -59,6 +59,7 @@ pub fn upload_quad_vertices(
upload_quad_vertices_uv(buf, width, height, x, y, w, h, [0.0, 0.0, 1.0, 1.0])
}
#[allow(clippy::too_many_arguments)]
pub fn upload_quad_vertices_uv(
buf: &Buffer<Vert2Uv>,
width: f32,
+1 -1
View File
@@ -2861,7 +2861,7 @@ impl Drop for RawCommandBuffer {
self
.context
.device
.free_command_buffers(self.pool.handle, &[self.handle])
.free_command_buffers(self.pool.handle, &[self.handle]);
};
}
}
+3 -3
View File
@@ -6,7 +6,7 @@ use std::{
sync::Arc,
};
use anyhow::{Context as _, bail};
use anyhow::bail;
use parking_lot::MutexGuard;
use super::{
@@ -224,8 +224,8 @@ pub fn spirv_words(bytes: &[u8]) -> anyhow::Result<Vec<u32>> {
}
let mut words = Vec::with_capacity(bytes.len() / 4);
for chunk in bytes.chunks_exact(4) {
let word = u32::from_le_bytes(chunk.try_into().context("invalid SPIR-V word")?);
for chunk in bytes.as_chunks::<4>().0 {
let word = u32::from_le_bytes(*chunk);
words.push(word);
}
+2 -6
View File
@@ -4,7 +4,7 @@ use crate::{
layout::WidgetID,
parser::{
AttribPair, ParseChildResult, ParserContext, ParserFile, get_asset_path_from_kv, parse_children, parse_f32,
parse_i32, process_component, style::parse_style,
process_component, style::parse_style,
},
};
@@ -29,11 +29,7 @@ pub fn parse_component_video<'a>(
speed = parse_f32(value).unwrap_or(speed);
}
"looping" => {
if let Some(v) = parse_i32(value)
&& v != 0
{
looping = true;
}
ctx.parse_check_bool(tag_name, key, value, &mut looping);
}
"src" | "src_ext" | "src_builtin" | "src_internal" => {
let asset_path = get_asset_path_from_kv(file, "", key, value);
+2 -2
View File
@@ -1478,8 +1478,8 @@ pub fn parse_from_assets(
if let Some(extra) = doc_params.extra {
ctx.populate_extra_variables(&extra.extra_vars);
root_dir = extra.root_dir.clone();
};
root_dir.clone_from(&extra.root_dir);
}
let root_dir = root_dir.unwrap_or_else(|| xml_path.replace_path(Path::new("/").into()));
+1 -1
View File
@@ -3,7 +3,7 @@ use crate::{
i18n::Translation,
layout::WidgetID,
parser::{
AttribPair, ParseChildResult, ParserContext, ParserFile, parse_children, parse_i32, parse_widget_universal,
AttribPair, ParseChildResult, ParserContext, ParserFile, parse_children, parse_widget_universal,
style::{parse_style, parse_text_style},
},
widget::label::{WidgetLabel, WidgetLabelParams},
+1
View File
@@ -185,6 +185,7 @@ where
fn request_new_frame(&mut self) {}
}
#[allow(clippy::too_many_arguments)]
fn main_loop<U, R>(
name: Arc<str>,
node_id: u32,