aboutsummaryrefslogtreecommitdiff
path: root/src/layout/mod.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-04-13 14:16:07 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-04-13 14:16:07 +0400
commit9d5f1c7ef7e1b038fe6242aaa04009bf21463d2a (patch)
treec766cd95b619175ba748ca7d804a19adf505d70f /src/layout/mod.rs
parent71be19b234d58f4ec447e921633506beb81a52c0 (diff)
downloadniri-9d5f1c7ef7e1b038fe6242aaa04009bf21463d2a.tar.gz
niri-9d5f1c7ef7e1b038fe6242aaa04009bf21463d2a.tar.bz2
niri-9d5f1c7ef7e1b038fe6242aaa04009bf21463d2a.zip
Unify Animation- and RenderSnapshot
Diffstat (limited to 'src/layout/mod.rs')
-rw-r--r--src/layout/mod.rs32
1 files changed, 12 insertions, 20 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs
index efcc8167..afb101c8 100644
--- a/src/layout/mod.rs
+++ b/src/layout/mod.rs
@@ -50,7 +50,8 @@ pub use self::monitor::MonitorRenderElement;
use self::workspace::{compute_working_area, Column, ColumnWidth, OutputId, Workspace};
use crate::niri_render_elements;
use crate::render_helpers::renderer::NiriRenderer;
-use crate::render_helpers::{BakedBuffer, RenderSnapshot, RenderTarget};
+use crate::render_helpers::snapshot::RenderSnapshot;
+use crate::render_helpers::{BakedBuffer, RenderTarget};
use crate::utils::output_size;
use crate::window::ResolvedWindowRules;
@@ -73,15 +74,6 @@ niri_render_elements! {
pub type LayoutElementRenderSnapshot =
RenderSnapshot<BakedBuffer<TextureBuffer<GlesTexture>>, BakedBuffer<SolidColorBuffer>>;
-/// Snapshot of an element for animation.
-#[derive(Debug)]
-pub struct AnimationSnapshot {
- /// Snapshot of the render.
- pub render: LayoutElementRenderSnapshot,
- /// Visual size of the element at the point of the snapshot.
- pub size: Size<i32, Logical>,
-}
-
pub trait LayoutElement {
/// Type that can be used as a unique ID of this element.
type Id: PartialEq;
@@ -118,8 +110,6 @@ pub trait LayoutElement {
target: RenderTarget,
) -> Vec<LayoutElementRenderElement<R>>;
- fn take_last_render(&self) -> LayoutElementRenderSnapshot;
-
fn request_size(&mut self, size: Size<i32, Logical>, animate: bool);
fn request_fullscreen(&self, size: Size<i32, Logical>);
fn min_size(&self) -> Size<i32, Logical>;
@@ -150,8 +140,10 @@ pub trait LayoutElement {
/// Runs periodic clean-up tasks.
fn refresh(&self);
- fn animation_snapshot(&self) -> Option<&AnimationSnapshot>;
- fn take_animation_snapshot(&mut self) -> Option<AnimationSnapshot>;
+ fn take_unmap_snapshot(&self) -> Option<LayoutElementRenderSnapshot>;
+
+ fn animation_snapshot(&self) -> Option<&LayoutElementRenderSnapshot>;
+ fn take_animation_snapshot(&mut self) -> Option<LayoutElementRenderSnapshot>;
}
#[derive(Debug)]
@@ -1966,10 +1958,6 @@ mod tests {
vec![]
}
- fn take_last_render(&self) -> LayoutElementRenderSnapshot {
- RenderSnapshot::default()
- }
-
fn request_size(&mut self, size: Size<i32, Logical>, _animate: bool) {
self.0.requested_size.set(Some(size));
self.0.pending_fullscreen.set(false);
@@ -2024,11 +2012,15 @@ mod tests {
&EMPTY
}
- fn animation_snapshot(&self) -> Option<&AnimationSnapshot> {
+ fn take_unmap_snapshot(&self) -> Option<LayoutElementRenderSnapshot> {
+ None
+ }
+
+ fn animation_snapshot(&self) -> Option<&LayoutElementRenderSnapshot> {
None
}
- fn take_animation_snapshot(&mut self) -> Option<AnimationSnapshot> {
+ fn take_animation_snapshot(&mut self) -> Option<LayoutElementRenderSnapshot> {
None
}
}