Skip to content

Commit

Permalink
Even morer more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
elkowar committed Aug 16, 2023
1 parent 96829fe commit 0cec067
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions crates/eww/src/display_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ mod platform_x11 {
let mon_end_y = scale_factor * (monitor_rect.y() + monitor_rect.height()) as u32 - 1u32;

let dist = match strut_def.side {
Side::Left | Side::Right => strut_def.dist.pixels_relative_to(monitor_rect.width()) as u32,
Side::Top | Side::Bottom => strut_def.dist.pixels_relative_to(monitor_rect.height()) as u32,
Side::Left | Side::Right => strut_def.distance.pixels_relative_to(monitor_rect.width()) as u32,
Side::Top | Side::Bottom => strut_def.distance.pixels_relative_to(monitor_rect.height()) as u32,
};

// don't question it,.....
Expand Down
1 change: 0 additions & 1 deletion crates/yuck/src/config/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ impl Attributes {
}
}


/// Specification of an argument to a widget or window
#[derive(Debug, PartialEq, Eq, Clone, serde::Serialize)]
pub struct AttrSpec {
Expand Down
12 changes: 7 additions & 5 deletions crates/yuck/src/config/backend_window_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ pub enum Error {
EvalError(#[from] EvalError),
}

/// Backend-specific options of a window that are backend
/// Backend-specific options of a window
/// Unevaluated form of [`BackendWindowOptions`]
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize)]
pub struct BackendWindowOptionsDef {
pub wayland: WlBackendWindowOptionsDef,
Expand Down Expand Up @@ -194,10 +195,11 @@ impl std::str::FromStr for Side {
}
}

/// Unevaluated form of [`X11StrutDefinition`]
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize)]
pub struct X11StrutDefinitionExpr {
pub side: Option<SimplExpr>,
pub dist: SimplExpr,
pub distance: SimplExpr,
}

impl X11StrutDefinitionExpr {
Expand All @@ -207,7 +209,7 @@ impl X11StrutDefinitionExpr {
Some(expr) => Side::from_dynval(&expr.eval(local_variables)?)?,
None => Side::default(),
},
dist: NumWithUnit::from_dynval(&self.dist.eval(local_variables)?)?,
distance: NumWithUnit::from_dynval(&self.distance.eval(local_variables)?)?,
})
}
}
Expand All @@ -218,12 +220,12 @@ impl FromAstElementContent for X11StrutDefinitionExpr {
fn from_tail<I: Iterator<Item = Ast>>(_span: Span, mut iter: AstIterator<I>) -> DiagResult<Self> {
let mut attrs = iter.expect_key_values()?;
iter.expect_done().map_err(DiagError::from).note("Check if you are missing a colon in front of a key")?;
Ok(X11StrutDefinitionExpr { side: attrs.ast_optional("side")?, dist: attrs.ast_required("distance")? })
Ok(X11StrutDefinitionExpr { side: attrs.ast_optional("side")?, distance: attrs.ast_required("distance")? })
}
}

#[derive(Debug, Clone, Copy, PartialEq, Default, serde::Serialize)]
pub struct X11StrutDefinition {
pub side: Side,
pub dist: NumWithUnit,
pub distance: NumWithUnit,
}
2 changes: 1 addition & 1 deletion crates/yuck/src/config/widget_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{
};
use eww_shared_util::{Span, Spanned};

use super::{widget_use::WidgetUse, attributes::AttrSpec};
use super::{attributes::AttrSpec, widget_use::WidgetUse};

#[derive(Debug, PartialEq, Eq, Clone, serde::Serialize)]
pub struct WidgetDefinition {
Expand Down
2 changes: 2 additions & 0 deletions crates/yuck/src/config/window_geometry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ impl std::str::FromStr for AnchorPoint {
}
}

/// Unevaluated variant of [`Coords`]
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct CoordsDef {
pub x: Option<SimplExpr>,
Expand Down Expand Up @@ -144,6 +145,7 @@ fn convert_to_num_with_unit(
})
}

/// Unevaluated variant of [`WindowGeometry`]
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct WindowGeometryDef {
pub anchor_point: Option<SimplExpr>,
Expand Down

0 comments on commit 0cec067

Please sign in to comment.