diff options
| author | srdusr <[email protected]> | 2024-07-09 14:43:00 +0200 |
|---|---|---|
| committer | srdusr <[email protected]> | 2024-07-09 14:43:00 +0200 |
| commit | d2952af18b907a5b18fccd26468a74aabe49bb2f (patch) | |
| tree | 9bc553b83eed57ff62e2cbe308e496f641d32d5b /crates/wayland/src/winit.rs | |
| parent | 2cc10b0704d7352198374597075ef184253026be (diff) | |
| download | srdwm-d2952af18b907a5b18fccd26468a74aabe49bb2f.tar.gz srdwm-d2952af18b907a5b18fccd26468a74aabe49bb2f.zip | |
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<bool> so the backend can tell "unset" from "explicitly off".
Diffstat (limited to 'crates/wayland/src/winit.rs')
| -rw-r--r-- | crates/wayland/src/winit.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/crates/wayland/src/winit.rs b/crates/wayland/src/winit.rs index 5f072b6..f50d095 100644 --- a/crates/wayland/src/winit.rs +++ b/crates/wayland/src/winit.rs @@ -242,6 +242,8 @@ impl WaylandPlatform { border_top_decorations: HashMap::new(), shadow_buffers: HashMap::new(), rounded_corners_program, + content_epoch: HashMap::new(), + rounded_content_buffers: HashMap::new(), border_side_buffers: HashMap::new(), last_synced_size: HashMap::new(), pending: pending.clone(), @@ -406,7 +408,12 @@ impl WaylandPlatform { // The bar/dock/launcher, skipped entirely for a fullscreen window -- // see `udev.rs`'s matching push for the full reasoning. let hide_top_layers = self.wm.borrow().visible_windows_front_to_back().any(|w| w.fullscreen); - let rounded_corners_enabled = self.wm.borrow().rounded_corners_enabled; + // `None` (the user's config never touched `general.rounded_corners`) + // defaults to *on* here - this backend has an actual GPU shader + // behind the feature (see `rounded_corners.rs`), no untested + // per-frame CPU cost to weigh the way the udev backend's own + // default has to. + let rounded_corners_enabled = self.wm.borrow().rounded_corners_enabled.unwrap_or(true); if !hide_top_layers { custom_elements.extend( crate::elements::output_layer_elements(renderer, &self.output, (0, 0), |layer| matches!(layer, Layer::Top | Layer::Overlay)) |