diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-05-04 09:49:32 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-05-04 09:49:32 +0400 |
| commit | 69aeba2a4d93b34eb24319c3694ad354dc608a87 (patch) | |
| tree | b335e96feaa41792f4ec8d54a78213209daf029a /src/layout | |
| parent | 7aab41304860a7b3a5db89d3dd0657e7d4f89989 (diff) | |
| download | niri-69aeba2a4d93b34eb24319c3694ad354dc608a87.tar.gz niri-69aeba2a4d93b34eb24319c3694ad354dc608a87.tar.bz2 niri-69aeba2a4d93b34eb24319c3694ad354dc608a87.zip | |
shader_element: Store and set location separately
Diffstat (limited to 'src/layout')
| -rw-r--r-- | src/layout/focus_ring.rs | 11 | ||||
| -rw-r--r-- | src/layout/tile.rs | 8 |
2 files changed, 12 insertions, 7 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 } diff --git a/src/layout/tile.rs b/src/layout/tile.rs index d5237ae7..b5b40df0 100644 --- a/src/layout/tile.rs +++ b/src/layout/tile.rs @@ -720,16 +720,18 @@ impl<W: LayoutElement> Tile<W> { // user-provided radius, so our blocked-out rendering should match that // radius. if radius != CornerRadius::default() && has_border_shader { + let elem_geo = elem.geometry(Scale::from(1.)).to_logical(1); return BorderRenderElement::new( - elem.geometry(Scale::from(1.)).to_logical(1), - Rectangle::from_loc_and_size(Point::from((0, 0)), geo.size), + elem_geo.size, + Rectangle::from_loc_and_size((0, 0), elem_geo.size), elem.color(), elem.color(), 0., - elem.geometry(Scale::from(1.)).to_logical(1), + Rectangle::from_loc_and_size(geo.loc - elem_geo.loc, geo.size), 0., radius, ) + .with_location(elem_geo.loc) .into(); } |
