From 7261f7fa1f10390e28a48216a4aa4b71df689403 Mon Sep 17 00:00:00 2001 From: galister <22305755+galister@users.noreply.github.com> Date: Thu, 30 Jul 2026 23:30:42 +0900 Subject: [PATCH] skip attrib woes --- dash-frontend/src/tab/settings/macros.rs | 4 ++-- wayvr/src/assets/gui/keyboard.xml | 10 ++++---- wayvr/src/overlays/toast.rs | 28 ----------------------- wayvr/src/overlays/wayvr.rs | 2 +- wayvr/src/windowing/manager.rs | 4 ++-- wgui/src/parser/mod.rs | 19 ++++++++++----- wlx-common/src/dash_interface_emulated.rs | 2 +- 7 files changed, 24 insertions(+), 45 deletions(-) diff --git a/dash-frontend/src/tab/settings/macros.rs b/dash-frontend/src/tab/settings/macros.rs index 53a484ec..efb0cd98 100644 --- a/dash-frontend/src/tab/settings/macros.rs +++ b/dash-frontend/src/tab/settings/macros.rs @@ -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, diff --git a/wayvr/src/assets/gui/keyboard.xml b/wayvr/src/assets/gui/keyboard.xml index 08e9eedd..0aceeef2 100644 --- a/wayvr/src/assets/gui/keyboard.xml +++ b/wayvr/src/assets/gui/keyboard.xml @@ -172,8 +172,8 @@ - - + + @@ -181,8 +181,8 @@ - - + + @@ -216,7 +216,7 @@
-
+
diff --git a/wayvr/src/overlays/toast.rs b/wayvr/src/overlays/toast.rs index 887e7af7..8ed82e84 100644 --- a/wayvr/src/overlays/toast.rs +++ b/wayvr/src/overlays/toast.rs @@ -207,31 +207,3 @@ fn new_toast(toast: Toast, app: &mut AppState) -> Option { ..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(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); -} diff --git a/wayvr/src/overlays/wayvr.rs b/wayvr/src/overlays/wayvr.rs index beb6632a..760c62b0 100644 --- a/wayvr/src/overlays/wayvr.rs +++ b/wayvr/src/overlays/wayvr.rs @@ -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)?; } diff --git a/wayvr/src/windowing/manager.rs b/wayvr/src/windowing/manager.rs index ed5c5a57..f6ce3830 100644 --- a/wayvr/src/windowing/manager.rs +++ b/wayvr/src/windowing/manager.rs @@ -691,12 +691,12 @@ impl OverlayWindowManager { 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(); } } diff --git a/wgui/src/parser/mod.rs b/wgui/src/parser/mod.rs index 4f19435d..0576d3cd 100644 --- a/wgui/src/parser/mod.rs +++ b/wgui/src/parser/mod.rs @@ -334,7 +334,7 @@ impl ParserState { let mut cells = Vec::::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); diff --git a/wlx-common/src/dash_interface_emulated.rs b/wlx-common/src/dash_interface_emulated.rs index 52603ab4..153ce13d 100644 --- a/wlx-common/src/dash_interface_emulated.rs +++ b/wlx-common/src/dash_interface_emulated.rs @@ -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},