aboutsummaryrefslogtreecommitdiff
path: root/src/layout/focus_ring.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-05-04 09:49:32 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-05-04 09:49:32 +0400
commit69aeba2a4d93b34eb24319c3694ad354dc608a87 (patch)
treeb335e96feaa41792f4ec8d54a78213209daf029a /src/layout/focus_ring.rs
parent7aab41304860a7b3a5db89d3dd0657e7d4f89989 (diff)
downloadniri-69aeba2a4d93b34eb24319c3694ad354dc608a87.tar.gz
niri-69aeba2a4d93b34eb24319c3694ad354dc608a87.tar.bz2
niri-69aeba2a4d93b34eb24319c3694ad354dc608a87.zip
shader_element: Store and set location separately
Diffstat (limited to 'src/layout/focus_ring.rs')
-rw-r--r--src/layout/focus_ring.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/layout/focus_ring.rs b/src/layout/focus_ring.rs
index 757b2085..a0d0acfe 100644
--- a/src/layout/focus_ring.rs
+++ b/src/layout/focus_ring.rs
@@ -194,6 +194,9 @@ impl FocusRing {
border: &mut BorderRenderElement,
location: Point<i32, Logical>,
size: Size<i32, Logical>| {
+ let full_rect = Rectangle::from_loc_and_size(full_rect.loc - location, full_rect.size);
+ let view_rect = Rectangle::from_loc_and_size(view_rect.loc - location, view_rect.size);
+
let elem = if has_border_shader {
if let Some(gradient) = gradient {
let gradient_area = match gradient.relative_to {
@@ -201,7 +204,7 @@ impl FocusRing {
GradientRelativeTo::WorkspaceView => view_rect,
};
border.update(
- Rectangle::from_loc_and_size(location, size),
+ size,
gradient_area,
gradient.from.into(),
gradient.to.into(),
@@ -210,10 +213,10 @@ impl FocusRing {
border_width,
self.radius,
);
- Some(border.clone().into())
+ Some(border.clone().with_location(location).into())
} else if self.radius != CornerRadius::default() {
border.update(
- Rectangle::from_loc_and_size(location, size),
+ size,
full_rect,
color.into(),
color.into(),
@@ -222,7 +225,7 @@ impl FocusRing {
border_width,
self.radius,
);
- Some(border.clone().into())
+ Some(border.clone().with_location(location).into())
} else {
None
}