aboutsummaryrefslogtreecommitdiff
path: root/src/layout/tile.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-02-04 22:52:11 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-02-04 22:52:11 +0400
commit57521c69c3a406789f38d8aa672b0bc15c947819 (patch)
tree64e22533709d443ba2c77282ba9823d48cc87e2d /src/layout/tile.rs
parentda826e42aaaa6dc559db67f4708db8bc23754f46 (diff)
downloadniri-57521c69c3a406789f38d8aa672b0bc15c947819.tar.gz
niri-57521c69c3a406789f38d8aa672b0bc15c947819.tar.bz2
niri-57521c69c3a406789f38d8aa672b0bc15c947819.zip
layout: Add TileRenderElement
Diffstat (limited to 'src/layout/tile.rs')
-rw-r--r--src/layout/tile.rs15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/layout/tile.rs b/src/layout/tile.rs
index 7fa6deb2..1c25fa4a 100644
--- a/src/layout/tile.rs
+++ b/src/layout/tile.rs
@@ -6,11 +6,11 @@ use smithay::backend::renderer::element::solid::{SolidColorBuffer, SolidColorRen
use smithay::backend::renderer::element::utils::{Relocate, RelocateRenderElement};
use smithay::backend::renderer::element::Kind;
use smithay::backend::renderer::{ImportAll, Renderer};
+use smithay::render_elements;
use smithay::utils::{Logical, Point, Rectangle, Scale, Size};
use super::focus_ring::FocusRing;
-use super::workspace::WorkspaceRenderElement;
-use super::{LayoutElement, Options};
+use super::{LayoutElement, LayoutElementRenderElement, Options};
/// Toplevel window with decorations.
#[derive(Debug)]
@@ -37,6 +37,13 @@ pub struct Tile<W: LayoutElement> {
options: Rc<Options>,
}
+render_elements! {
+ #[derive(Debug)]
+ pub TileRenderElement<R> where R: ImportAll;
+ LayoutElement = LayoutElementRenderElement<R>,
+ SolidColor = RelocateRenderElement<SolidColorRenderElement>,
+}
+
impl<W: LayoutElement> Tile<W> {
pub fn new(window: W, options: Rc<Options>) -> Self {
Self {
@@ -237,7 +244,7 @@ impl<W: LayoutElement> Tile<W> {
renderer: &mut R,
location: Point<i32, Logical>,
scale: Scale<f64>,
- ) -> Vec<WorkspaceRenderElement<R>>
+ ) -> Vec<TileRenderElement<R>>
where
<R as Renderer>::TextureId: 'static,
{
@@ -274,7 +281,7 @@ impl<W: LayoutElement> Tile<W> {
1.,
Kind::Unspecified,
);
- rv.push(elem.into());
+ rv.push(RelocateRenderElement::from_element(elem, (0, 0), Relocate::Relative).into());
}
rv