diff options
| author | srdusr <[email protected]> | 2024-06-20 16:08:00 +0200 |
|---|---|---|
| committer | srdusr <[email protected]> | 2024-06-20 16:08:00 +0200 |
| commit | ab0916391532031376817ed4ab6ab234428559a2 (patch) | |
| tree | 169e7799fbb6dd5d225b01ed645b1fa5cbf179de /crates/config/src/lib.rs | |
| parent | 20cdd47b39f09aa19317d9d29fef6511b98c1233 (diff) | |
| download | srdwm-ab0916391532031376817ed4ab6ab234428559a2.tar.gz srdwm-ab0916391532031376817ed4ab6ab234428559a2.zip | |
Add drop shadows and shrink the resize grab margin that was eating content clicks
Two independent daily-driving gaps closed in one pass, both from MISSING.md
and live user feedback:
Drop shadows (general.shadows, default true). Reuses the exact "bitmap
drawn outside geometry, cached like the border" technique border_strips/
render_border_top already established - decoration::shadow_bitmap rasterizes
a linear alpha falloff (Chebyshev/square-ring distance, not a true blur --
no blur primitive exists without a GPU shader, and the udev backend's
PixmanRenderer is software-only) from SHADOW_MAX_ALPHA (90/255, deliberately
subtle) at the window's own edge down to fully transparent SHADOW_SIZE (12px)
out. Cached in CompState::shadow_buffers, rebuilt at the same trigger points
as border_top_decorations (redraw_decoration_buffer), for the identical
damage-tracking reason: a fresh Id every frame means OutputDamageTracker
never finds a previous-frame match. No shadow for a maximized or fullscreen
window, matching the Hyprland/GNOME convention MISSING.md measures against.
Resize grab margin: 10px -> 6px (general.resize_margin, now configurable,
same call-site-count-preserving change as threading a new parameter through
one indirection point: ResizeEdge::hit_test's only production caller is
WindowManager::hit_test, so this didn't need touching every backend despite
hit_test being shared verbatim across X11/Wayland/Windows/macOS). Reported
live: ordinary clicks near any window edge - a link near a browser's edge,
a button near a panel's edge - regularly registered as a resize-edge grab
instead of reaching the client, not just an occasional near-miss, because
the 10px band was measured inward from the client's own content rect. 6px
stays comfortably grabbable while giving content back most of its edge.
Verified: cargo build --workspace (all 9 crates including the windows/macos
stub backends), cargo clippy --workspace (0 new warnings), cargo test across
core/wayland/config/x11 (188 tests, 0 failed). Shadow rendering verified at
the render-element level live in a nested session (correct geometry, alpha,
buffer contents) - grim/screencopy itself turned out to route through
winit.rs's separate capture_offscreen path, which only ever drew
`decorations` (titlebars), never borders or shadows, so screenshots taken
this way have never shown either; a real gap, not fixed in this pass.
Diffstat (limited to 'crates/config/src/lib.rs')
| -rw-r--r-- | crates/config/src/lib.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/crates/config/src/lib.rs b/crates/config/src/lib.rs index 57fe582..12ba397 100644 --- a/crates/config/src/lib.rs +++ b/crates/config/src/lib.rs @@ -933,6 +933,7 @@ fn validate(s: &SharedState) -> Vec<String> { check_range("general.border_width", 0.0, 20.0); check_range("theme.decorations.border.width", 0.0, 20.0); check_range("general.animation_duration", 0.0, 1000.0); + check_range("general.resize_margin", 1.0, 50.0); check_range("performance.max_fps", 30.0, 240.0); check_range("performance.window_cache_size", 10.0, 10000.0); @@ -989,6 +990,8 @@ fn default_config() -> HashMap<String, ConfigValue> { set("general.border_width", Number(2.0)); set("general.animations", Bool(true)); set("general.animation_duration", Number(200.0)); + set("general.shadows", Bool(true)); + set("general.resize_margin", Number(6.0)); set("general.focus_follows_mouse", Bool(false)); set("general.mouse_follows_focus", Bool(true)); set("general.auto_raise", Bool(false)); |