mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-09-26 03:08:37 +00:00
feat: feature flag to use libmonado or not
This commit is contained in:
parent
ab32558546
commit
4172c351e1
6 changed files with 51 additions and 19 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -289,6 +289,7 @@ dependencies = [
|
||||||
"gettext-rs",
|
"gettext-rs",
|
||||||
"git2",
|
"git2",
|
||||||
"gtk4",
|
"gtk4",
|
||||||
|
"lazy_static",
|
||||||
"libadwaita",
|
"libadwaita",
|
||||||
"libmonado-rs",
|
"libmonado-rs",
|
||||||
"libusb",
|
"libusb",
|
||||||
|
|
|
@ -14,6 +14,7 @@ git2 = "0.17.2"
|
||||||
gtk4 = { version = "0.7.2", features = [
|
gtk4 = { version = "0.7.2", features = [
|
||||||
"v4_10",
|
"v4_10",
|
||||||
] }
|
] }
|
||||||
|
lazy_static = "1.4.0"
|
||||||
libadwaita = { version = "0.5.2", features = [
|
libadwaita = { version = "0.5.2", features = [
|
||||||
"v1_3"
|
"v1_3"
|
||||||
] }
|
] }
|
||||||
|
|
|
@ -33,6 +33,12 @@ cd envision
|
||||||
./dist/appimage/build_appimage.sh
|
./dist/appimage/build_appimage.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Feature flags
|
||||||
|
|
||||||
|
|Env var|Values|Default|
|
||||||
|
|---|---|---|
|
||||||
|
|`ENVISION_FF_USE_LIBMONADO`|`1`: enabled; `0`: disabled|`0`|
|
||||||
|
|
||||||
# Common issues
|
# Common issues
|
||||||
|
|
||||||
## NOSUID with systemd-homed
|
## NOSUID with systemd-homed
|
||||||
|
|
|
@ -3,6 +3,7 @@ use super::alert::alert;
|
||||||
use super::build_window::{BuildStatus, BuildWindow};
|
use super::build_window::{BuildStatus, BuildWindow};
|
||||||
use super::debug_view::{DebugView, DebugViewMsg};
|
use super::debug_view::{DebugView, DebugViewMsg};
|
||||||
use super::fbt_config_editor::{FbtConfigEditor, FbtConfigEditorInit, FbtConfigEditorMsg};
|
use super::fbt_config_editor::{FbtConfigEditor, FbtConfigEditorInit, FbtConfigEditorMsg};
|
||||||
|
use super::feature_flags::FF_LIBMONADO_DEVICE_ENUMERATION_ENABLED;
|
||||||
use super::job_worker::internal_worker::JobWorkerOut;
|
use super::job_worker::internal_worker::JobWorkerOut;
|
||||||
use super::job_worker::job::WorkerJob;
|
use super::job_worker::job::WorkerJob;
|
||||||
use super::job_worker::JobWorker;
|
use super::job_worker::JobWorker;
|
||||||
|
@ -312,6 +313,7 @@ impl SimpleComponent for App {
|
||||||
}
|
}
|
||||||
Msg::ClockTicking => {
|
Msg::ClockTicking => {
|
||||||
self.main_view.sender().emit(MainViewMsg::ClockTicking);
|
self.main_view.sender().emit(MainViewMsg::ClockTicking);
|
||||||
|
if *FF_LIBMONADO_DEVICE_ENUMERATION_ENABLED {
|
||||||
if let Some(w) = self.xrservice_worker.as_ref() {
|
if let Some(w) = self.xrservice_worker.as_ref() {
|
||||||
if {
|
if {
|
||||||
let state = w.state.lock().unwrap();
|
let state = w.state.lock().unwrap();
|
||||||
|
@ -336,12 +338,23 @@ impl SimpleComponent for App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Msg::ParseLog(rows) => {
|
Msg::ParseLog(rows) => {
|
||||||
for row in rows {
|
for row in rows {
|
||||||
match MonadoLog::new_from_str(row.as_str()) {
|
match MonadoLog::new_from_str(row.as_str()) {
|
||||||
None => {}
|
None => {}
|
||||||
Some(parsed) => {
|
Some(parsed) => {
|
||||||
if let Some(tracker) =
|
if !*FF_LIBMONADO_DEVICE_ENUMERATION_ENABLED
|
||||||
|
&& parsed.func == "p_create_system"
|
||||||
|
{
|
||||||
|
let n_devs = XRDevice::from_log_message(parsed.message.as_str());
|
||||||
|
self.xr_devices = XRDevice::merge(&self.xr_devices, &n_devs);
|
||||||
|
self.main_view
|
||||||
|
.sender()
|
||||||
|
.emit(MainViewMsg::UpdateDevices(
|
||||||
|
self.xr_devices.clone(),
|
||||||
|
));
|
||||||
|
} else if let Some(tracker) =
|
||||||
XRDevice::generic_tracker_from_log_row(parsed.message.as_str())
|
XRDevice::generic_tracker_from_log_row(parsed.message.as_str())
|
||||||
{
|
{
|
||||||
self.xr_devices.push(tracker);
|
self.xr_devices.push(tracker);
|
||||||
|
|
10
src/ui/feature_flags.rs
Normal file
10
src/ui/feature_flags.rs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
use std::env;
|
||||||
|
use lazy_static::lazy_static;
|
||||||
|
|
||||||
|
fn get_ff_libmonado_device_enumeration_enabled() -> bool {
|
||||||
|
env::var("ENVISION_FF_USE_LIBMONADO").unwrap_or_default() == "1"
|
||||||
|
}
|
||||||
|
|
||||||
|
lazy_static! {
|
||||||
|
pub static ref FF_LIBMONADO_DEVICE_ENUMERATION_ENABLED: bool = get_ff_libmonado_device_enumeration_enabled();
|
||||||
|
}
|
|
@ -16,3 +16,4 @@ pub mod profile_editor;
|
||||||
pub mod steam_launch_options_box;
|
pub mod steam_launch_options_box;
|
||||||
pub mod util;
|
pub mod util;
|
||||||
pub mod wivrn_conf_editor;
|
pub mod wivrn_conf_editor;
|
||||||
|
pub mod feature_flags;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue