hide unsupported settings depending on backend

This commit is contained in:
galister 2026-05-17 12:46:54 +09:00
parent e39085aa2b
commit 901c18520e
3 changed files with 30 additions and 17 deletions

View File

@ -23,7 +23,7 @@ use wgui::{
use wlx_common::{
config::GeneralConfig,
config_io::ConfigRoot,
dash_interface::{ConfigChangeKind, RecenterMode},
dash_interface::{ConfigChangeKind, InterfaceFeats, RecenterMode},
};
use crate::{
@ -87,6 +87,7 @@ struct SettingsMountParams<'a> {
mp: &'a mut MacroParams<'a>,
frontend_tasks: &'a FrontendTasks,
id_parent: WidgetID,
feats: InterfaceFeats,
}
trait SettingsTab {
@ -549,6 +550,8 @@ impl<T> TabSettings<T> {
let globals = frontend.layout.state.globals.clone();
self.current_tab = None;
let feats = frontend.interface.get_feats(data);
let mut mp = MacroParams {
layout: &mut frontend.layout,
parser_state: &mut self.state,
@ -562,6 +565,7 @@ impl<T> TabSettings<T> {
mp: &mut mp,
id_parent: root,
frontend_tasks: &self.frontend_tasks,
feats,
};
match name {

View File

@ -26,16 +26,19 @@ impl State {
options_checkbox(par.mp, c, SettingType::InvertScrollDirectionY)?;
options_slider_f32(par.mp, c, SettingType::ScrollSpeed, 0.1, 5.0, 0.1)?;
options_slider_f32(par.mp, c, SettingType::LongPressDuration, 0.1, 2.0, 0.1)?;
options_slider_f32(par.mp, c, SettingType::PointerLerpFactor, 0.1, 1.0, 0.1)?;
options_range_f32(
par.mp,
c,
SettingType::XrClickSensitivityRelease,
SettingType::XrClickSensitivity,
0.1,
0.9,
0.1,
)?;
if par.feats.openxr {
options_slider_f32(par.mp, c, SettingType::PointerLerpFactor, 0.1, 1.0, 0.1)?;
options_range_f32(
par.mp,
c,
SettingType::XrClickSensitivityRelease,
SettingType::XrClickSensitivity,
0.1,
0.9,
0.1,
)?;
}
options_slider_i32(par.mp, c, SettingType::ClickFreezeTimeMs, 0, 500, 50)?;
Ok(State {})

View File

@ -13,12 +13,18 @@ impl State {
options_checkbox(par.mp, c, SettingType::NotificationsEnabled)?;
options_checkbox(par.mp, c, SettingType::NotificationsSoundEnabled)?;
options_checkbox(par.mp, c, SettingType::KeyboardSoundEnabled)?;
options_checkbox(par.mp, c, SettingType::SpaceDragUnlocked)?;
options_checkbox(par.mp, c, SettingType::SpaceRotateUnlocked)?;
options_slider_f32(par.mp, c, SettingType::SpaceDragMultiplier, -10.0, 10.0, 0.5)?;
options_checkbox(par.mp, c, SettingType::BlockGameInput)?;
options_checkbox(par.mp, c, SettingType::BlockGameInputIgnoreWatch)?;
options_checkbox(par.mp, c, SettingType::BlockPosesOnKbdInteraction)?;
if !par.feats.openxr || par.feats.monado {
// monado or openvr
options_checkbox(par.mp, c, SettingType::SpaceDragUnlocked)?;
options_slider_f32(par.mp, c, SettingType::SpaceDragMultiplier, -10.0, 10.0, 0.5)?;
}
if par.feats.monado {
options_checkbox(par.mp, c, SettingType::SpaceRotateUnlocked)?;
options_checkbox(par.mp, c, SettingType::BlockGameInput)?;
options_checkbox(par.mp, c, SettingType::BlockGameInputIgnoreWatch)?;
options_checkbox(par.mp, c, SettingType::BlockPosesOnKbdInteraction)?;
}
options_range_f32(
par.mp,
c,