oxwm

https://git.tonybtw.com/oxwm.git git://git.tonybtw.com/oxwm.git
1,122 bytes raw
1
use super::{GapConfig, Layout, WindowGeometry};
2
use x11rb::protocol::xproto::Window;
3
4
pub struct NormieLayout;
5
6
// This layout should return a no-op similar to DWM.C's "null" mode.
7
impl Layout for NormieLayout {
8
    fn name(&self) -> &'static str {
9
        super::NORMIE
10
    }
11
12
    fn arrange(
13
        &self,
14
        windows: &[Window],
15
        screen_width: u32,
16
        screen_height: u32,
17
        _gaps: &GapConfig,
18
    ) -> Vec<WindowGeometry> {
19
        const DEFAULT_WIDTH_RATIO: f32 = 0.6;
20
        const DEFAULT_HEIGHT_RATIO: f32 = 0.6;
21
22
        windows
23
            .iter()
24
            .map(|_| {
25
                let width = ((screen_width as f32) * DEFAULT_WIDTH_RATIO) as u32;
26
                let height = ((screen_height as f32) * DEFAULT_HEIGHT_RATIO) as u32;
27
28
                let x = ((screen_width - width) / 2) as i32;
29
                let y = ((screen_height - height) / 2) as i32;
30
31
                WindowGeometry {
32
                    x_coordinate: x,
33
                    y_coordinate: y,
34
                    width,
35
                    height,
36
                }
37
            })
38
            .collect()
39
    }
40
}