skip attrib woes

This commit is contained in:
galister 2026-07-30 23:30:42 +09:00
parent 7efc4bb0fc
commit 7261f7fa1f
7 changed files with 24 additions and 45 deletions

View File

@ -1,6 +1,6 @@
use std::rc::Rc;
use crate::tab::settings::{self, horiz_cell, mount_requires_restart, SettingType, Task};
use crate::tab::settings::{self, SettingType, Task, horiz_cell, mount_requires_restart};
use wgui::{
components::{
button::{ButtonClickEvent, ComponentButton},
@ -13,7 +13,7 @@ use wgui::{
widget::label::WidgetLabel,
windowing::context_menu,
};
use wlx_common::{config::GeneralConfig, dash_interface::InterfaceFeats, DesktopBackend, XrBackend};
use wlx_common::{DesktopBackend, XrBackend, config::GeneralConfig, dash_interface::InterfaceFeats};
pub fn options_category(
mp: &mut MacroParams,

View File

@ -172,8 +172,8 @@
<cell translation="BAR.HANDSFREE.NONE" _press="::HandsfreeMode None" _press2="::ContextMenuClose" />
<cell translation="BAR.HANDSFREE.HMD" _press="::HandsfreeMode Hmd" _press2="::ContextMenuClose" />
<cell translation="BAR.HANDSFREE.HMD_ONLY" _press="::HandsfreeMode HmdOnly" _press2="::ContextMenuClose" />
<cell translation="BAR.HANDSFREE.EYE_TRACKING" _press="::HandsfreeMode EyeTracking" _press2="::ContextMenuClose" skip="~openvr" />
<cell translation="BAR.HANDSFREE.EYE_ONLY" _press="::HandsfreeMode EyeTrackingOnly" _press2="::ContextMenuClose" skip="~openvr" />
<cell translation="BAR.HANDSFREE.EYE_TRACKING" _press="::HandsfreeMode EyeTracking" _press2="::ContextMenuClose" skip="${openvr}" />
<cell translation="BAR.HANDSFREE.EYE_ONLY" _press="::HandsfreeMode EyeTrackingOnly" _press2="::ContextMenuClose" skip="${openvr}" />
</context_menu>
</blueprint>
@ -181,8 +181,8 @@
<context_menu >
<cell translation="BAR.EDIT_MODE_TOGGLE" _press="::EditToggle" _press2="::ContextMenuClose" />
<cell translation="BAR.HANDSFREE.TITLE" _press="::ContextMenuOpen menu_handsfree" />
<cell translation="BAR.ADD_MIRROR" _press="::NewMirror" skip="~not_wayland" />
<cell translation="BAR.ADD_PASSTHRU" _press="::NewPassthru" skip="~openvr" />
<cell translation="BAR.ADD_MIRROR" _press="::NewMirror" skip="${not_wayland}" />
<cell translation="BAR.ADD_PASSTHRU" _press="::NewPassthru" skip="${openvr}" />
<cell translation="BAR.ADD_NEW_SET" _press="::AddSet" />
<cell translation="BAR.DELETE_CURRENT_SET" _press="::DeleteSet" />
</context_menu>
@ -216,7 +216,7 @@
<div id="panels_root" gap="6">
</div>
<VerticalSeparator />
<div id="apps_root" gap="6">
<div id="apps_root" gap="6" skip="${openvr}">
</div>
</div>
<div id="tray_root" flex_direction="row" gap="10">

View File

@ -207,31 +207,3 @@ fn new_toast(toast: Toast, app: &mut AppState) -> Option<OverlayWindowConfig> {
..OverlayWindowConfig::from_backend(Box::new(panel))
})
}
// FIXME: Will these functions be used in the future? Can they be removed?
#[allow(dead_code)]
fn msg_err(app: &mut AppState, message: &str) {
Toast::new(ToastTopic::Error, "TOAST.ERROR".into(), message.into())
.with_timeout(3.)
.submit(app);
}
// Display the same error in the terminal and as a toast in VR.
// Formatted as "Failed to XYZ: Object is not defined"
#[allow(dead_code)]
pub fn error_toast<ErrorType>(app: &mut AppState, title: &str, err: ErrorType)
where
ErrorType: std::fmt::Display + std::fmt::Debug,
{
log::error!("{title}: {err:?}"); // More detailed version (use Debug)
// Brief version (use Display)
msg_err(app, &format!("{title}: {err}"));
}
#[allow(dead_code)]
pub fn error_toast_str(app: &mut AppState, message: &str) {
log::error!("{message}");
msg_err(app, message);
}

View File

@ -731,7 +731,7 @@ impl OverlayBackend for WvrWindowBackend {
match state.cursor_image {
CursorImageStatus::Hidden => {}
CursorImageStatus::Named(_) | CursorImageStatus::Surface(_) => {
// FIXME: properly render surface?
// TODO: properly render surface?
if let Some(mouse) = self.mouse.as_ref() {
self.pipeline.as_mut().unwrap().render_mouse(mouse, rdr)?;
}

View File

@ -691,12 +691,12 @@ impl<T> OverlayWindowManager<T> {
self.wrappers
.wrap_edit_mode(id, &mut overlay.config, app)
.inspect_err(|e| log::error!("{e:?}"))
.unwrap(); // FIXME: unwrap
.unwrap();
} else {
self.wrappers
.unwrap_edit_mode(&mut overlay.config, app)
.inspect_err(|e| log::error!("{e:?}"))
.unwrap(); // FIXME: unwrap
.unwrap();
}
}

View File

@ -334,7 +334,7 @@ impl ParserState {
let mut cells = Vec::<context_menu::Cell>::new();
for child in el_context_menu.children() {
'children: for child in el_context_menu.children() {
match child.tag_name().name() {
"" => {}
"cell" => {
@ -352,8 +352,15 @@ impl ParserState {
"tooltip" => tooltip = Some(Translation::from_translation_key(value)),
"tooltip_str" => tooltip = Some(Translation::from_raw_text(value)),
"action" => action_name = Some(value.into()),
"skip" => {
let resolved = replace_vars(value, template_params);
//FIXME: this is always empty
if &*resolved == "1" {
continue 'children;
}
}
other => {
if !other.starts_with('_') && other != "skip" {
if !other.starts_with('_') {
anyhow::bail!("unexpected \"{other}\" attribute");
}
attribs.push(AttribPair::new(key, replace_vars(value, template_params)));
@ -985,12 +992,12 @@ fn parse_child<'a>(
parent_id: WidgetID,
) -> anyhow::Result<()> {
let tag_name = child_node.tag_name().name();
match child_node.attribute("skip") {
Some(val) => {
// TODO: need to resolve variables in val
if let Some(skip) = child_node.attribute("skip") {
let resolved = process_attrib(&file.template_parameters, ctx, "skip", skip).value;
//FIXME: this is always empty
if &*resolved == "1" {
return Ok(()); // do not parse this element
}
_ => {}
}
let attribs = process_attribs(file, ctx, &child_node, false);

View File

@ -1,4 +1,4 @@
use slotmap::{new_key_type, DenseSlotMap};
use slotmap::{DenseSlotMap, new_key_type};
use wayvr_ipc::{
packet_client::WvrProcessLaunchParams,
packet_server::{WvrProcess, WvrProcessHandle, WvrWindow, WvrWindowHandle},