| 1 |
use x11rb::protocol::xproto::Window;
|
| 2 |
|
| 3 |
pub type TagMask = u32;
|
| 4 |
|
| 5 |
#[derive(Debug, Clone)]
|
| 6 |
pub struct Client {
|
| 7 |
pub name: String,
|
| 8 |
pub min_aspect: f32,
|
| 9 |
pub max_aspect: f32,
|
| 10 |
pub x_position: i16,
|
| 11 |
pub y_position: i16,
|
| 12 |
pub width: u16,
|
| 13 |
pub height: u16,
|
| 14 |
pub old_x_position: i16,
|
| 15 |
pub old_y_position: i16,
|
| 16 |
pub old_width: u16,
|
| 17 |
pub old_height: u16,
|
| 18 |
pub base_width: i32,
|
| 19 |
pub base_height: i32,
|
| 20 |
pub increment_width: i32,
|
| 21 |
pub increment_height: i32,
|
| 22 |
pub max_width: i32,
|
| 23 |
pub max_height: i32,
|
| 24 |
pub min_width: i32,
|
| 25 |
pub min_height: i32,
|
| 26 |
pub hints_valid: bool,
|
| 27 |
pub border_width: u16,
|
| 28 |
pub old_border_width: u16,
|
| 29 |
pub tags: TagMask,
|
| 30 |
pub is_fixed: bool,
|
| 31 |
pub is_floating: bool,
|
| 32 |
pub is_urgent: bool,
|
| 33 |
pub never_focus: bool,
|
| 34 |
pub old_state: bool,
|
| 35 |
pub is_fullscreen: bool,
|
| 36 |
pub next: Option<Window>,
|
| 37 |
pub stack_next: Option<Window>,
|
| 38 |
pub monitor_index: usize,
|
| 39 |
pub window: Window,
|
| 40 |
}
|
| 41 |
|
| 42 |
impl Client {
|
| 43 |
pub fn new(window: Window, monitor_index: usize, tags: TagMask) -> Self {
|
| 44 |
Self {
|
| 45 |
name: String::new(),
|
| 46 |
min_aspect: 0.0,
|
| 47 |
max_aspect: 0.0,
|
| 48 |
x_position: 0,
|
| 49 |
y_position: 0,
|
| 50 |
width: 0,
|
| 51 |
height: 0,
|
| 52 |
old_x_position: 0,
|
| 53 |
old_y_position: 0,
|
| 54 |
old_width: 0,
|
| 55 |
old_height: 0,
|
| 56 |
base_width: 0,
|
| 57 |
base_height: 0,
|
| 58 |
increment_width: 0,
|
| 59 |
increment_height: 0,
|
| 60 |
max_width: 0,
|
| 61 |
max_height: 0,
|
| 62 |
min_width: 0,
|
| 63 |
min_height: 0,
|
| 64 |
hints_valid: false,
|
| 65 |
border_width: 0,
|
| 66 |
old_border_width: 0,
|
| 67 |
tags,
|
| 68 |
is_fixed: false,
|
| 69 |
is_floating: false,
|
| 70 |
is_urgent: false,
|
| 71 |
never_focus: false,
|
| 72 |
old_state: false,
|
| 73 |
is_fullscreen: false,
|
| 74 |
next: None,
|
| 75 |
stack_next: None,
|
| 76 |
monitor_index,
|
| 77 |
window,
|
| 78 |
}
|
| 79 |
}
|
| 80 |
|
| 81 |
pub fn width_with_border(&self) -> u16 {
|
| 82 |
self.width.saturating_add(2 * self.border_width)
|
| 83 |
}
|
| 84 |
|
| 85 |
pub fn height_with_border(&self) -> u16 {
|
| 86 |
self.height.saturating_add(2 * self.border_width)
|
| 87 |
}
|
| 88 |
}
|