placement.rs (1163B)
1 use crate::decoration::Decoration; 2 use crate::zone::ZoneContent; 3 use crate::zone::ZoneId; 4 5 use winsys::geometry::Region; 6 use winsys::window::Window; 7 8 #[derive(Debug, PartialEq, Eq, Clone, Copy)] 9 pub enum PlacementMethod { 10 Free, 11 Tile, 12 } 13 14 #[derive(Debug, PartialEq, Eq, Clone, Copy)] 15 pub enum PlacementClass<T> { 16 Free(T), 17 Tile(T), 18 } 19 20 #[derive(Debug, Copy, Clone, PartialEq, Eq)] 21 pub enum PlacementTarget { 22 Client(Window), 23 Tab(usize), 24 Layout, 25 } 26 27 impl PlacementTarget { 28 pub fn from_zone_content(content: &ZoneContent) -> Self { 29 match content { 30 ZoneContent::Client(window) => PlacementTarget::Client(*window), 31 ZoneContent::Tab(zones) => PlacementTarget::Tab(zones.len()), 32 ZoneContent::Layout(..) => PlacementTarget::Layout, 33 } 34 } 35 } 36 37 #[derive(Debug, Copy, Clone, PartialEq, Eq)] 38 pub enum PlacementRegion { 39 NoRegion, 40 FreeRegion, 41 NewRegion(Region), 42 } 43 44 #[derive(Debug, Copy, Clone, PartialEq, Eq)] 45 pub struct Placement { 46 pub method: PlacementMethod, 47 pub kind: PlacementTarget, 48 pub zone: ZoneId, 49 pub region: PlacementRegion, 50 pub decoration: Decoration, 51 }