mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-03-22 09:29:24 +01:00
Following the changes I witnessed in the invisible window border size following an OS update, this commit makes the invisible border offset configurable via a new komorebic command 'invisible-borders'. When sending a new set of invisible border offset dimensions via komorebic, a full retile across all monitors will take place after the new values have been set. The default values have been set to what is currently correct for my machine, and will likely be updated again in the same way in the future if further changes occur in subsequent OS updates. This commit also updates some dependencies to their latest releases, and removes from the CI workflow a line that attempts to delete the rustup-init.exe binary after installation which has been causing builds to fail. resolve #35
43 lines
1.0 KiB
Rust
43 lines
1.0 KiB
Rust
use serde::Deserialize;
|
|
use serde::Serialize;
|
|
|
|
use bindings::Windows::Win32::Foundation::RECT;
|
|
|
|
#[derive(Debug, Default, Clone, Copy, Serialize, Deserialize, Eq, PartialEq)]
|
|
pub struct Rect {
|
|
pub left: i32,
|
|
pub top: i32,
|
|
pub right: i32,
|
|
pub bottom: i32,
|
|
}
|
|
|
|
impl From<RECT> for Rect {
|
|
fn from(rect: RECT) -> Self {
|
|
Self {
|
|
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;
|
|
}
|
|
}
|
|
|
|
#[must_use]
|
|
pub const 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
|
|
}
|
|
}
|