mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-03-30 22:22:08 +02:00
This commit fixes issues with toggling on and off Monocle and Floating Window mode by ensuring that the relevant windows are always at the top of the Z order, and in the latter case, ensuring that the top visible window is used to search the local floating window state of the process. After some experimenting I seem to have been able to adjust to remove all of the invisible window borders by default, so if desired, a user can now have no gaps at all. Also upgraded to the latest version of the windows-rs crate since I saw it was available. Thankfully no breaking changes.
50 lines
1.1 KiB
Rust
50 lines
1.1 KiB
Rust
use bindings::Windows::Win32::Foundation::RECT;
|
|
|
|
#[derive(Debug, Clone, Copy)]
|
|
pub struct Rect {
|
|
pub left: i32,
|
|
pub top: i32,
|
|
pub right: i32,
|
|
pub bottom: i32,
|
|
}
|
|
|
|
impl Default for Rect {
|
|
fn default() -> Self {
|
|
Rect {
|
|
left: 0,
|
|
top: 0,
|
|
right: 0,
|
|
bottom: 0,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<RECT> for Rect {
|
|
fn from(rect: RECT) -> Self {
|
|
Rect {
|
|
left: rect.left,
|
|
top: rect.top,
|
|
right: rect.right - rect.left,
|
|
bottom: rect.bottom - rect.top,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl Rect {
|
|
pub fn add_padding(&mut self, padding: Option<i32>) {
|
|
if let Some(padding) = padding {
|
|
self.left += padding;
|
|
self.top += padding;
|
|
self.right -= padding * 2;
|
|
self.bottom -= padding * 2;
|
|
}
|
|
}
|
|
|
|
pub fn contains_point(&self, point: (i32, i32)) -> bool {
|
|
point.0 >= self.left
|
|
&& point.0 <= self.left + self.right
|
|
&& point.1 >= self.top
|
|
&& point.1 <= self.top + self.bottom
|
|
}
|
|
}
|