mirror of https://github.com/wayvr-org/wayvr.git
add watch toggle setting (#526)
* add watch toggle setting * previous commit broke monado workaround, this fixes it * use active_state to toggle watch * use the other monado workaround * fix whitespace * cargo fmt
This commit is contained in:
parent
066f033a91
commit
9806027e19
|
|
@ -100,6 +100,7 @@
|
|||
"SCREEN_RENDER_DOWN_HELP": "Helps with aliasing on high-res screens",
|
||||
"SCROLL_SPEED": "Scroll speed",
|
||||
"SELECT_VARIANT": "Select variant",
|
||||
"ENABLE_WATCH": "Enable watch",
|
||||
"SETS_ON_WATCH": "Sets on watch",
|
||||
"SKYBOX": "Skybox",
|
||||
"SKYMAP_ALREADY_DOWNLOADED": "This skymap is already downloaded. Select desired action.",
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
"USE_SKYBOX_HELP": "Wyświetlaj niebo, jeśli nie ma aplikacji sceny lub passthrough",
|
||||
"USE_PASSTHROUGH_HELP": "Pozwól na passthrough, jeśli runtime XR to obsługuje",
|
||||
"SCREEN_RENDER_DOWN_HELP": "Pomaga redukować aliasing na ekranach o wysokiej rozdzielczości",
|
||||
"ENABLE_WATCH": "Włącz zegarek",
|
||||
"SETS_ON_WATCH": "Lista zestawów na zegarku",
|
||||
"TROUBLESHOOTING": "Rozwiązywanie problemów",
|
||||
"CLEAR_SAVED_STATE": "Wyczyść zapisany stan",
|
||||
|
|
|
|||
|
|
@ -274,6 +274,7 @@ enum SettingType {
|
|||
PointerLerpFactor,
|
||||
ScreenRenderDown,
|
||||
ScrollSpeed,
|
||||
EnableWatch,
|
||||
SetsOnWatch,
|
||||
SpaceDragMultiplier,
|
||||
SpaceDragUnlocked,
|
||||
|
|
@ -309,6 +310,7 @@ impl SettingType {
|
|||
Self::KeyboardSoundEnabled => &mut config.keyboard_sound_enabled,
|
||||
Self::UprightScreenFix => &mut config.upright_screen_fix,
|
||||
Self::DoubleCursorFix => &mut config.double_cursor_fix,
|
||||
Self::EnableWatch => &mut config.enable_watch,
|
||||
Self::SetsOnWatch => &mut config.sets_on_watch,
|
||||
Self::HideGrabHelp => &mut config.hide_grab_help,
|
||||
Self::AllowSliding => &mut config.allow_sliding,
|
||||
|
|
@ -435,6 +437,7 @@ impl SettingType {
|
|||
Self::PointerLerpFactor => Ok("APP_SETTINGS.POINTER_LERP_FACTOR"),
|
||||
Self::ScreenRenderDown => Ok("APP_SETTINGS.SCREEN_RENDER_DOWN"),
|
||||
Self::ScrollSpeed => Ok("APP_SETTINGS.SCROLL_SPEED"),
|
||||
Self::EnableWatch => Ok("APP_SETTINGS.ENABLE_WATCH"),
|
||||
Self::SetsOnWatch => Ok("APP_SETTINGS.SETS_ON_WATCH"),
|
||||
Self::SpaceDragMultiplier => Ok("APP_SETTINGS.SPACE_DRAG_MULTIPLIER"),
|
||||
Self::SpaceDragUnlocked => Ok("APP_SETTINGS.SPACE_DRAG_UNLOCKED"),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::tab::settings::{
|
||||
macros::{options_category, options_checkbox, options_range_f32, options_slider_f32},
|
||||
SettingType, SettingsMountParams, SettingsTab,
|
||||
macros::{options_category, options_checkbox, options_range_f32, options_slider_f32},
|
||||
};
|
||||
|
||||
pub struct State {}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ impl State {
|
|||
options_slider_f32(par.mp, c, SettingType::UiAnimationSpeed, 0.5, 5.0, 0.1)?; // min, max, step
|
||||
options_slider_f32(par.mp, c, SettingType::UiGradientIntensity, 0.0, 1.0, 0.05)?; // min, max, step
|
||||
options_slider_f32(par.mp, c, SettingType::UiRoundMultiplier, 0.1, 5.0, 0.1)?;
|
||||
options_checkbox(par.mp, c, SettingType::EnableWatch)?;
|
||||
options_checkbox(par.mp, c, SettingType::SetsOnWatch)?;
|
||||
options_checkbox(par.mp, c, SettingType::Clock12h)?;
|
||||
Ok(State {})
|
||||
|
|
|
|||
|
|
@ -346,9 +346,12 @@ pub fn openxr_run(
|
|||
app.hid_provider.inner.commit();
|
||||
|
||||
let watch = overlays.mut_by_id(watch_id).unwrap(); // want panic
|
||||
if watch.config.active_state.is_none() {
|
||||
watch.config.activate(&mut app);
|
||||
}
|
||||
let watch_state = watch.config.active_state.as_mut().unwrap();
|
||||
let watch_transform = watch_state.transform;
|
||||
if watch_state.alpha < 0.05 {
|
||||
if watch_state.alpha < 0.05 || !app.session.config.enable_watch {
|
||||
//FIXME: Temporary workaround for Monado bug
|
||||
watch_state.transform = Affine3A::from_scale(Vec3 {
|
||||
x: 0.001,
|
||||
|
|
@ -510,7 +513,13 @@ pub fn openxr_run(
|
|||
|
||||
//FIXME: Temporary workaround for Monado bug
|
||||
let watch = overlays.mut_by_id(watch_id).unwrap(); // want panic
|
||||
watch.config.active_state.as_mut().unwrap().transform = watch_transform;
|
||||
|
||||
if let Some(state) = watch.config.active_state.as_mut() {
|
||||
state.transform = watch_transform
|
||||
}
|
||||
if !app.session.config.enable_watch {
|
||||
watch.config.deactivate();
|
||||
}
|
||||
} // main_loop
|
||||
|
||||
if let (Some(blocker), Some(monado)) = (blocker, app.monado_state.as_mut()) {
|
||||
|
|
|
|||
|
|
@ -145,6 +145,7 @@ pub struct AutoSettings {
|
|||
pub keyboard_sound_enabled: bool,
|
||||
pub upright_screen_fix: bool,
|
||||
pub double_cursor_fix: bool,
|
||||
pub enable_watch: bool,
|
||||
pub sets_on_watch: bool,
|
||||
pub hide_grab_help: bool,
|
||||
pub xr_click_sensitivity: f32,
|
||||
|
|
@ -200,6 +201,7 @@ pub fn save_settings(config: &GeneralConfig) -> anyhow::Result<()> {
|
|||
keyboard_sound_enabled: config.keyboard_sound_enabled,
|
||||
upright_screen_fix: config.upright_screen_fix,
|
||||
double_cursor_fix: config.double_cursor_fix,
|
||||
enable_watch: config.enable_watch,
|
||||
sets_on_watch: config.sets_on_watch,
|
||||
hide_grab_help: config.hide_grab_help,
|
||||
xr_click_sensitivity: config.xr_click_sensitivity,
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ pub fn create_watch(app: &mut AppState) -> anyhow::Result<OverlayWindowConfig> {
|
|||
angle_fade: true,
|
||||
..OverlayWindowState::default()
|
||||
},
|
||||
show_on_spawn: true,
|
||||
show_on_spawn: app.session.config.enable_watch,
|
||||
global: true,
|
||||
..OverlayWindowConfig::from_backend(Box::new(panel))
|
||||
})
|
||||
|
|
|
|||
|
|
@ -85,6 +85,9 @@
|
|||
# The settings are here for reference only.
|
||||
# Probably don't include them in your config file.
|
||||
|
||||
## The watch will be enabled
|
||||
#enable_watch: true
|
||||
|
||||
## The bottom of the watch will list sets instead of overlays.
|
||||
#sets_on_watch: false
|
||||
|
||||
|
|
|
|||
|
|
@ -288,6 +288,16 @@ where
|
|||
self.sets_changed(app);
|
||||
}
|
||||
OverlayTask::SettingsChanged => {
|
||||
if let Some(watch) = self.mut_by_id(self.watch_id) {
|
||||
if app.session.config.enable_watch != watch.config.active_state.is_some() {
|
||||
if watch.config.active_state.is_some() {
|
||||
watch.config.deactivate();
|
||||
} else {
|
||||
watch.config.activate(app);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for o in self.overlays.values_mut() {
|
||||
let _ = o
|
||||
.config
|
||||
|
|
|
|||
|
|
@ -273,6 +273,9 @@ pub struct GeneralConfig {
|
|||
#[serde(default = "def_false")]
|
||||
pub double_cursor_fix: bool,
|
||||
|
||||
#[serde(default = "def_true")]
|
||||
pub enable_watch: bool,
|
||||
|
||||
#[serde(default = "def_false")]
|
||||
pub sets_on_watch: bool,
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue