srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/crates/core/src/manager
diff options
context:
space:
mode:
authorsrdusr <[email protected]>2025-08-10 14:25:00 +0200
committersrdusr <[email protected]>2025-08-10 14:25:00 +0200
commit7f4740046a004a1ad06aefa5d1d6b1a351571b1a (patch)
tree9a22cd7bf999cd2645e7c10907b161f3c347ebe9 /crates/core/src/manager
parent61d01bb79c6882c950f45a1176ba1f30fbbd4824 (diff)
downloadsrdwm-7f4740046a004a1ad06aefa5d1d6b1a351571b1a.tar.gz
srdwm-7f4740046a004a1ad06aefa5d1d6b1a351571b1a.zip
Make corner resize reachable at the button corner, and widen it everywhere else
Reported live: "even where decorations are corner i should still be able to corner resize, just its... hitbox... does not get in the way of the close icon" - the titlebar corner holding Close/Maximize/Minimize had no resize target at all, by design (competing with the close button was judged worse than losing that one corner). The BUTTON_CLUSTER_MARGIN strip between the button cluster and the frame's true edge was already dead space no button claims, regardless of button_count - its own top DECORATED_TOP_RESIZE_MARGIN rows now register as the diagonal corner (TopLeft/TopRight) instead of falling through to Top/Drag, without touching the button's own hitbox at all. Also requested: widen the other three corners' own resize zone, since a user reaching for a plain edge-resize instinctively aims for the middle of that edge, not its corner - a bigger corner zone doesn't compete with that instinct the way a bigger RESIZE_MARGIN would compete with ordinary content clicks near an edge. CORNER_MARGIN raised from 3 to 5 (18px to 30px at the default resize_margin). Updated one existing test whose own per-window resize_margin override (30px) now put its plain-edge test point inside the widened corner zone on a window too short for the two to stay apart - taller geometry, same edge point relative to center, no change to what it actually verifies. Added coverage for the new button-corner resize target on both sides, and for the dead strip's own non-corner rows still just dragging as before.
Diffstat (limited to 'crates/core/src/manager')
-rw-r--r--crates/core/src/manager/tests.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/crates/core/src/manager/tests.rs b/crates/core/src/manager/tests.rs
index 9af0181..88699de 100644
--- a/crates/core/src/manager/tests.rs
+++ b/crates/core/src/manager/tests.rs
@@ -432,13 +432,21 @@
wm.set_layout(wm.current_workspace(), "tiling"); // keeps add_window from overriding geometry via SmartPlacement
let id = wm.alloc_window_id();
let mut w = Window::new(id, "a");
- w.geometry = Rect::new(100, 100, 400, 300);
+ // Tall enough that `CORNER_MARGIN * resize_margin`'s own widened
+ // corner zone (150px at this override, see `CORNER_MARGIN`'s own
+ // doc comment on why it's deliberately generous) doesn't reach
+ // anywhere near the plain-edge point tested below - a shorter
+ // window here used to work purely because the corner zone was
+ // narrower, not because this test cared about corners at all.
+ w.geometry = Rect::new(100, 100, 400, 800);
w.resize_margin = Some(30);
wm.add_window(w);
// 15px in from the left edge: well past the WM-wide default (6px),
- // but still inside this window's own wider 30px override.
- let hit = wm.hit_test(115, 250);
+ // but still inside this window's own wider 30px override. Deep in
+ // the window's own vertical middle, well clear of either corner
+ // zone.
+ let hit = wm.hit_test(115, 500);
assert_eq!(hit.map(|(_, h)| h), Some(TitlebarHit::Resize(ResizeEdge::Left)));
}