srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/crates/core/src/window.rs
diff options
context:
space:
mode:
authorsrdusr <[email protected]>2024-08-22 16:06:00 +0200
committersrdusr <[email protected]>2024-08-22 16:06:00 +0200
commit78da614d67c09e197dffc1cebb1c5ce2357c7128 (patch)
treea39694108f7d1192276a0ea8956e458dc2595d79 /crates/core/src/window.rs
parent8d94ca5d77d6e2a189d299b8b88a461ba2e621c6 (diff)
downloadsrdwm-78da614d67c09e197dffc1cebb1c5ce2357c7128.tar.gz
srdwm-78da614d67c09e197dffc1cebb1c5ce2357c7128.zip
Add per-window resize-margin override (Hyprland's extend_border_grab_area)
MISSING.md had listed this as needing to touch srdwm_core::window:: hit_test's signature at every call site, including the honest-stub Windows/macOS backends - overstated on closer inspection: that shared function already takes a plain resize_margin: i32 parameter, agnostic to where the value comes from. The only real change needed was reading Window.resize_margin.unwrap_or(wm-wide default) instead of always the WM-wide value, at the single call site inside WindowManager::hit_test in core - no backend touched at all. Window.resize_margin: Option<i32>, WindowRuleActions.resize_margin to match, applied in add_window/reapply_rules_if_pending the same way opacity already is. Settable via a rule action or srd.window.set_resize_margin(n) on the focused window.
Diffstat (limited to 'crates/core/src/window.rs')
-rw-r--r--crates/core/src/window.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/core/src/window.rs b/crates/core/src/window.rs
index b79151d..850b936 100644
--- a/crates/core/src/window.rs
+++ b/crates/core/src/window.rs
@@ -97,6 +97,11 @@ pub struct Window {
/// effect still keeps its frame legible. Set via `srd.window.
/// set_opacity()` or a rule's `opacity` action.
pub opacity: f32,
+ /// Per-window override of `WindowManager::resize_margin`, `None` to
+ /// just inherit it. Hyprland's `extend_border_grab_area` is per-window
+ /// (a `windowrule`); this is the equivalent, set via a rule's
+ /// `resize_margin` action or `srd.window.set_resize_margin()`.
+ pub resize_margin: Option<i32>,
pub workspace: usize,
pub monitor: u32,
/// Whether `WindowManager`'s class/title-matched rules have already
@@ -143,6 +148,7 @@ impl Window {
border_color: (136, 192, 208), // Nord accent, matches legacy theme default
border_width: 2,
opacity: 1.0,
+ resize_margin: None,
workspace: 0,
monitor: 0,
rules_applied: false,