From e887ee93a30390b641bf647d694a1424f7ce4592 Mon Sep 17 00:00:00 2001 From: Rasmus Eneman Date: Mon, 15 Jul 2024 15:51:48 +0200 Subject: Implement interactive window move --- src/layout/tile.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/layout/tile.rs') diff --git a/src/layout/tile.rs b/src/layout/tile.rs index 28b3ffd0..c9347a1d 100644 --- a/src/layout/tile.rs +++ b/src/layout/tile.rs @@ -64,6 +64,9 @@ pub struct Tile { /// The animation of a tile visually moving vertically. move_y_animation: Option, + /// Offset during the initial interactive move rubberband. + pub(super) interactive_move_offset: Point, + /// Snapshot of the last render for use in the close animation. unmap_snapshot: Option, @@ -90,7 +93,7 @@ niri_render_elements! { } } -type TileRenderSnapshot = +pub type TileRenderSnapshot = RenderSnapshot, TileRenderElement>; #[derive(Debug)] @@ -123,6 +126,7 @@ impl Tile { resize_animation: None, move_x_animation: None, move_y_animation: None, + interactive_move_offset: Point::from((0., 0.)), unmap_snapshot: None, rounded_corner_damage: Default::default(), scale, @@ -305,6 +309,8 @@ impl Tile { offset.y += move_.from * move_.anim.value(); } + offset += self.interactive_move_offset; + offset } @@ -364,6 +370,11 @@ impl Tile { }); } + pub fn stop_move_animations(&mut self) { + self.move_x_animation = None; + self.move_y_animation = None; + } + pub fn window(&self) -> &W { &self.window } -- cgit