aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/layer/mapped.rs2
-rw-r--r--src/layout/focus_ring.rs10
-rw-r--r--src/layout/insert_hint_element.rs2
-rw-r--r--src/layout/shadow.rs3
-rw-r--r--src/layout/tile.rs4
-rw-r--r--src/render_helpers/border.rs8
-rw-r--r--src/render_helpers/shader_element.rs2
-rw-r--r--src/render_helpers/shadow.rs8
-rw-r--r--src/window/mapped.rs1
9 files changed, 36 insertions, 4 deletions
diff --git a/src/layer/mapped.rs b/src/layer/mapped.rs
index 493bbc58..5e62d033 100644
--- a/src/layer/mapped.rs
+++ b/src/layer/mapped.rs
@@ -74,7 +74,7 @@ impl MappedLayer {
let radius = self.rules.geometry_corner_radius.unwrap_or_default();
// FIXME: is_active based on keyboard focus?
self.shadow
- .update_render_elements(size, true, radius, scale.x);
+ .update_render_elements(size, true, radius, scale.x, 1.);
}
pub fn surface(&self) -> &LayerSurface {
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);
};
diff --git a/src/layout/insert_hint_element.rs b/src/layout/insert_hint_element.rs
index 5f70295c..89dfcd14 100644
--- a/src/layout/insert_hint_element.rs
+++ b/src/layout/insert_hint_element.rs
@@ -48,7 +48,7 @@ impl InsertHintElement {
scale: f64,
) {
self.inner
- .update_render_elements(size, true, false, view_rect, radius, scale);
+ .update_render_elements(size, true, false, view_rect, radius, scale, 1.);
}
pub fn render(
diff --git a/src/layout/shadow.rs b/src/layout/shadow.rs
index 3e0605c4..d91986d1 100644
--- a/src/layout/shadow.rs
+++ b/src/layout/shadow.rs
@@ -38,6 +38,7 @@ impl Shadow {
is_active: bool,
radius: CornerRadius,
scale: f64,
+ alpha: f32,
) {
let ceil = |logical: f64| (logical * scale).ceil() / scale;
@@ -129,6 +130,7 @@ impl Shadow {
scale as f32,
Rectangle::new(window_geo.loc - offset - rect.loc, window_geo.size),
win_radius,
+ alpha,
);
rect.loc += offset;
@@ -147,6 +149,7 @@ impl Shadow {
scale as f32,
Rectangle::zero(),
Default::default(),
+ alpha,
);
self.shader_rects[0].loc += offset;
diff --git a/src/layout/tile.rs b/src/layout/tile.rs
index b8d049b0..ad3f7ff9 100644
--- a/src/layout/tile.rs
+++ b/src/layout/tile.rs
@@ -336,6 +336,7 @@ impl<W: LayoutElement> Tile<W> {
),
radius,
self.scale,
+ 1.,
);
let radius = if self.is_fullscreen {
@@ -350,6 +351,7 @@ impl<W: LayoutElement> Tile<W> {
is_active,
radius,
self.scale,
+ 1.,
);
let draw_focus_ring_with_background = if self.effective_border_width().is_some() {
@@ -365,6 +367,7 @@ impl<W: LayoutElement> Tile<W> {
view_rect,
radius,
self.scale,
+ 1.,
);
}
@@ -880,6 +883,7 @@ impl<W: LayoutElement> Tile<W> {
0.,
radius,
scale.x as f32,
+ 1.,
)
.with_location(geo.loc)
.into();
diff --git a/src/render_helpers/border.rs b/src/render_helpers/border.rs
index c0ab6663..588e53b1 100644
--- a/src/render_helpers/border.rs
+++ b/src/render_helpers/border.rs
@@ -39,6 +39,7 @@ struct Parameters {
corner_radius: CornerRadius,
// Should only be used for visual improvements, i.e. corner radius anti-aliasing.
scale: f32,
+ alpha: f32,
}
impl BorderRenderElement {
@@ -54,6 +55,7 @@ impl BorderRenderElement {
border_width: f32,
corner_radius: CornerRadius,
scale: f32,
+ alpha: f32,
) -> Self {
let inner = ShaderRenderElement::empty(ProgramType::Border, Kind::Unspecified);
let mut rv = Self {
@@ -69,6 +71,7 @@ impl BorderRenderElement {
border_width,
corner_radius,
scale,
+ alpha,
},
};
rv.update_inner();
@@ -90,6 +93,7 @@ impl BorderRenderElement {
border_width: 0.,
corner_radius: Default::default(),
scale: 1.,
+ alpha: 1.,
},
}
}
@@ -111,6 +115,7 @@ impl BorderRenderElement {
border_width: f32,
corner_radius: CornerRadius,
scale: f32,
+ alpha: f32,
) {
let params = Parameters {
size,
@@ -123,6 +128,7 @@ impl BorderRenderElement {
border_width,
corner_radius,
scale,
+ alpha,
};
if self.params == params {
return;
@@ -144,6 +150,7 @@ impl BorderRenderElement {
border_width,
corner_radius,
scale,
+ alpha,
} = self.params;
let grad_offset = geometry.loc - gradient_area.loc;
@@ -189,6 +196,7 @@ impl BorderRenderElement {
size,
None,
scale,
+ alpha,
vec![
Uniform::new("colorspace", colorspace),
Uniform::new("hue_interpolation", hue_interpolation),
diff --git a/src/render_helpers/shader_element.rs b/src/render_helpers/shader_element.rs
index 2ec100ba..be3ccec6 100644
--- a/src/render_helpers/shader_element.rs
+++ b/src/render_helpers/shader_element.rs
@@ -227,12 +227,14 @@ impl ShaderRenderElement {
size: Size<f64, Logical>,
opaque_regions: Option<Vec<Rectangle<f64, Logical>>>,
scale: f32,
+ alpha: f32,
uniforms: Vec<Uniform<'static>>,
textures: HashMap<String, GlesTexture>,
) {
self.area.size = size;
self.opaque_regions = opaque_regions.unwrap_or_default();
self.scale = scale;
+ self.alpha = alpha;
self.additional_uniforms = uniforms;
self.textures = textures;
diff --git a/src/render_helpers/shadow.rs b/src/render_helpers/shadow.rs
index b98202e4..332703a0 100644
--- a/src/render_helpers/shadow.rs
+++ b/src/render_helpers/shadow.rs
@@ -28,6 +28,7 @@ struct Parameters {
corner_radius: CornerRadius,
// Should only be used for visual improvements, i.e. corner radius anti-aliasing.
scale: f32,
+ alpha: f32,
window_geometry: Rectangle<f64, Logical>,
window_corner_radius: CornerRadius,
@@ -44,6 +45,7 @@ impl ShadowRenderElement {
scale: f32,
window_geometry: Rectangle<f64, Logical>,
window_corner_radius: CornerRadius,
+ alpha: f32,
) -> Self {
let inner = ShaderRenderElement::empty(ProgramType::Shadow, Kind::Unspecified);
let mut rv = Self {
@@ -55,6 +57,7 @@ impl ShadowRenderElement {
sigma,
corner_radius,
scale,
+ alpha,
window_geometry,
window_corner_radius,
},
@@ -74,6 +77,7 @@ impl ShadowRenderElement {
sigma: 0.,
corner_radius: Default::default(),
scale: 1.,
+ alpha: 1.,
window_geometry: Default::default(),
window_corner_radius: Default::default(),
},
@@ -95,12 +99,14 @@ impl ShadowRenderElement {
scale: f32,
window_geometry: Rectangle<f64, Logical>,
window_corner_radius: CornerRadius,
+ alpha: f32,
) {
let params = Parameters {
size,
geometry,
color,
sigma,
+ alpha,
corner_radius,
scale,
window_geometry,
@@ -120,6 +126,7 @@ impl ShadowRenderElement {
geometry,
color,
sigma,
+ alpha,
corner_radius,
scale,
window_geometry,
@@ -145,6 +152,7 @@ impl ShadowRenderElement {
size,
None,
scale,
+ alpha,
vec![
Uniform::new("shadow_color", color.to_array_premul()),
Uniform::new("sigma", sigma),
diff --git a/src/window/mapped.rs b/src/window/mapped.rs
index 559b4641..2a1764f8 100644
--- a/src/window/mapped.rs
+++ b/src/window/mapped.rs
@@ -403,6 +403,7 @@ impl Mapped {
0.,
radius,
scale.x as f32,
+ 1.,
)
.with_location(geo.loc)
.into();