diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2025-02-08 13:33:28 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-02-10 07:29:33 -0800 |
| commit | 4f05a74aa84bca74b650cffdc7ad889413f621cf (patch) | |
| tree | 9bf496dde8954c60fb5ba232a2f2b10babcd9de5 /src/layout/focus_ring.rs | |
| parent | c30f522ef28ed01744f5c90150af8a9c4da558f1 (diff) | |
| download | niri-4f05a74aa84bca74b650cffdc7ad889413f621cf.tar.gz niri-4f05a74aa84bca74b650cffdc7ad889413f621cf.tar.bz2 niri-4f05a74aa84bca74b650cffdc7ad889413f621cf.zip | |
Add alpha parameter to shaders
Lets us add extra opacity.
Diffstat (limited to 'src/layout/focus_ring.rs')
| -rw-r--r-- | src/layout/focus_ring.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/layout/focus_ring.rs b/src/layout/focus_ring.rs index 3d97cb02..411a73a5 100644 --- a/src/layout/focus_ring.rs +++ b/src/layout/focus_ring.rs @@ -2,7 +2,7 @@ use std::iter::zip; use arrayvec::ArrayVec; use niri_config::{CornerRadius, Gradient, GradientRelativeTo}; -use smithay::backend::renderer::element::Kind; +use smithay::backend::renderer::element::{Element as _, Kind}; use smithay::utils::{Logical, Point, Rectangle, Size}; use crate::niri_render_elements; @@ -53,6 +53,7 @@ impl FocusRing { } } + #[allow(clippy::too_many_arguments)] pub fn update_render_elements( &mut self, win_size: Size<f64, Logical>, @@ -61,6 +62,7 @@ impl FocusRing { view_rect: Rectangle<f64, Logical>, radius: CornerRadius, scale: f64, + alpha: f32, ) { let width = self.config.width.0; self.full_size = win_size + Size::from((width, width)).upscale(2.); @@ -181,6 +183,7 @@ impl FocusRing { rounded_corner_border_width, radius, scale as f32, + alpha, ); } } else { @@ -199,6 +202,7 @@ impl FocusRing { rounded_corner_border_width, radius, scale as f32, + alpha, ); } @@ -229,7 +233,9 @@ impl FocusRing { let elem = if self.use_border_shader && has_border_shader { border.clone().with_location(location).into() } else { - SolidColorRenderElement::from_buffer(buffer, location, 1., Kind::Unspecified).into() + let alpha = border.alpha(); + SolidColorRenderElement::from_buffer(buffer, location, alpha, Kind::Unspecified) + .into() }; rv.push(elem); }; |
