From d2952af18b907a5b18fccd26468a74aabe49bb2f Mon Sep 17 00:00:00 2001 From: srdusr <99972264+srdusr@users.noreply.github.com> Date: Tue, 9 Jul 2024 14:43:00 +0200 Subject: Rounded corners on udev/Pixman backend, opt-in and off by default CPU-side rounded corners for the software-only udev/Pixman renderer, which has no shader stage to hook the existing GLES version into. Reads a window's own committed wl_shm buffer, punches premultiplied- alpha holes into the four corner regions, and hands the masked copy to MemoryRenderBuffer - the same path already used for titlebar/ border/shadow bitmaps, so it composites through the ordinary unmasked path and the corners genuinely disappear rather than being painted over. Cached per window, invalidated by a per-commit content_epoch counter rather than rebuilt every frame, so an idle window costs nothing once masked. general.rounded_corners now defaults per backend instead of one global true: on for GLES/winit (a real GPU shader, no measurable cost), off for udev/Pixman (an untested-on-real-hardware CPU cost for constantly-repainting clients) - WindowManager.rounded_corners_enabled is Option so the backend can tell "unset" from "explicitly off". --- crates/config/src/lib.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'crates/config/src') diff --git a/crates/config/src/lib.rs b/crates/config/src/lib.rs index 43577f8..2c57b0a 100644 --- a/crates/config/src/lib.rs +++ b/crates/config/src/lib.rs @@ -1008,7 +1008,15 @@ fn default_config() -> HashMap { set("general.animation_duration", Number(200.0)); set("general.shadows", Bool(true)); set("general.resize_margin", Number(6.0)); - set("general.rounded_corners", Bool(true)); + // Deliberately *not* seeded here, unlike every other `general.*` key -- + // its actual default differs by backend (GLES/winit: on; udev/Pixman: + // off, an untested-on-real-hardware CPU cost too real to default to on + // - see `crates/wayland/src/rounded_corners.rs`), and neither backend + // is known yet at the point `default_config` runs. Leaving the key + // genuinely absent (rather than pre-seeded `true`/`false`) is what lets + // `main.rs`'s `apply_general_settings` tell "user never touched this" + // apart from "user explicitly chose a value" and hand the *unset* case + // to whichever backend ends up connecting instead of deciding for it. set("general.focus_follows_mouse", Bool(false)); set("general.mouse_follows_focus", Bool(true)); set("general.auto_raise", Bool(false)); -- cgit v1.2.3