diff --git a/src/data.rs b/src/data.rs index 503716ca..cc02948d 100644 --- a/src/data.rs +++ b/src/data.rs @@ -405,7 +405,7 @@ impl Layout { let views = HashMap::from_iter( self.views.iter().map(|(name, view)| {( name.clone(), - Box::new(::layout::View { + ::layout::View { bounds: ::layout::c::Bounds { x: self.bounds.x, y: self.bounds.y, @@ -413,7 +413,7 @@ impl Layout { height: self.bounds.height, }, rows: view.iter().map(|row| { - Box::new(::layout::Row { + ::layout::Row { angle: 0, bounds: None, buttons: row.split_ascii_whitespace().map(|name| { @@ -427,9 +427,9 @@ impl Layout { &mut warning_handler, )) }).collect(), - }) + } }).collect(), - }) + } )}) ); diff --git a/src/layout.rs b/src/layout.rs index d9b43235..80dcb52c 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -74,7 +74,7 @@ pub mod c { /// Defined in eek-types.h #[repr(C)] - #[derive(Clone, Debug)] + #[derive(Clone, Debug, PartialEq)] pub struct Bounds { pub x: f64, pub y: f64, @@ -570,7 +570,7 @@ pub struct Spacing { pub struct View { /// Position relative to keyboard origin pub bounds: c::Bounds, - pub rows: Vec>, + pub rows: Vec, } impl View { @@ -665,7 +665,7 @@ pub struct Layout { // Views own the actual buttons which have state // Maybe they should own UI only, // and keys should be owned by a dedicated non-UI-State? - pub views: HashMap>, + pub views: HashMap, // Non-UI stuff /// xkb keymap applicable to the contained keys. Unchangeable @@ -684,7 +684,7 @@ pub struct Layout { /// A builder structure for picking up layout data from storage pub struct LayoutData { - pub views: HashMap>, + pub views: HashMap, pub keymap_str: CString, } @@ -706,7 +706,7 @@ impl Layout { } } - pub fn get_current_view(&self) -> &Box { + pub fn get_current_view(&self) -> &View { self.views.get(&self.current_view).expect("Selected nonexistent view") } @@ -815,7 +815,7 @@ impl Layout { mod procedures { use super::*; - type Path<'v> = (&'v Box, &'v Box