1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use std::fmt;

/// A type holding the transformation properties of a `wmctrl::Window`
pub struct Transformation {
    pub gravity: u16,
    pub x: u16,
    pub y: u16,
    pub width: u16,
    pub height: u16,
}

impl Transformation {
    pub fn new(x: u16, y: u16, width: u16, height: u16) -> Transformation {
        Transformation {
            gravity: 0,
            x,
            y,
            width,
            height,
        }
    }
}

impl fmt::Display for Transformation {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(
            f,
            "{},{},{},{},{}",
            self.gravity, self.x, self.y, self.width, self.height
        )
    }
}