fix: removed semicolon form enum usage in backend win opts

This commit is contained in:
Byson94
2025-07-31 09:18:39 +05:30
parent 5d5d82b3d6
commit 01fbe1cf24
3 changed files with 22 additions and 9 deletions

View File

@@ -336,12 +336,16 @@ impl<B: DisplayBackend> App<B> {
let initiator = WindowInitiator::new(&window_def, window_args)?;
// TODO replace this
// let root_widget = crate::widgets::build_widget::build_gtk_widget(
// &mut self.scope_graph.borrow_mut(),
// Rc::new(self.ewwii_config.get_widget_definitions().clone()),
// window_scope,
// window_def.widget,
// None,
// )?;
let root_widget = crate::widgets::build_widget::build_gtk_widget(
&mut self.scope_graph.borrow_mut(),
Rc::new(self.ewwii_config.get_widget_definitions().clone()),
window_scope,
window_def.widget,
None,
window_def.windows.into()
)?;
root_widget.style_context().add_class(window_name);

View File

@@ -68,16 +68,16 @@ impl BackendWindowOptionsDef {
let focusable = Self::get_optional(map, "focusable")?;
let x11 = X11BackendWindowOptionsDef {
sticky: Self::get_optional(map, "sticky")?;
sticky: Self::get_optional(map, "sticky")?,
struts,
window_type,
wm_ignore: Self::get_optional(map, "wm-ignore")?;
wm_ignore: Self::get_optional(map, "wm-ignore")?,
};
let wayland = WlBackendWindowOptionsDef {
exclusive: Self::get_optional(map, "exclusive")?;
exclusive: Self::get_optional(map, "exclusive")?,
focusable,
namespace: Self::get_optional(map, "namespace")?;
namespace: Self::get_optional(map, "namespace")?,
};
Ok(Self { wayland, x11 })

View File

@@ -66,6 +66,15 @@ impl Coords {
}
}
impl NumWithUnit {
pub fn to_pixels(&self, container_size: i32) -> i32 {
match self {
NumWithUnit::Pixels(px) => *px,
NumWithUnit::Percent(p) => (p * container_size as f64).round() as i32,
}
}
}
/// Alignment options for anchoring
#[derive(Debug, Clone, Copy, Eq, PartialEq, SmartDefault, Serialize, Deserialize, Display)]
pub enum AnchorAlignment {