diff options
| author | Rasmus Eneman <rasmus@eneman.eu> | 2024-07-15 15:51:48 +0200 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-10-27 23:07:39 -0700 |
| commit | e887ee93a30390b641bf647d694a1424f7ce4592 (patch) | |
| tree | 94a76c90c2433ad3a0d92015d7ca6ba569ab2979 /src/layout/tile.rs | |
| parent | d640e8515899e552b845cf8f901ebeb126bb12a5 (diff) | |
| download | niri-e887ee93a30390b641bf647d694a1424f7ce4592.tar.gz niri-e887ee93a30390b641bf647d694a1424f7ce4592.tar.bz2 niri-e887ee93a30390b641bf647d694a1424f7ce4592.zip | |
Implement interactive window move
Diffstat (limited to 'src/layout/tile.rs')
| -rw-r--r-- | src/layout/tile.rs | 13 |
1 files changed, 12 insertions, 1 deletions
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<W: LayoutElement> { /// The animation of a tile visually moving vertically. move_y_animation: Option<MoveAnimation>, + /// Offset during the initial interactive move rubberband. + pub(super) interactive_move_offset: Point<f64, Logical>, + /// Snapshot of the last render for use in the close animation. unmap_snapshot: Option<TileRenderSnapshot>, @@ -90,7 +93,7 @@ niri_render_elements! { } } -type TileRenderSnapshot = +pub type TileRenderSnapshot = RenderSnapshot<TileRenderElement<GlesRenderer>, TileRenderElement<GlesRenderer>>; #[derive(Debug)] @@ -123,6 +126,7 @@ impl<W: LayoutElement> Tile<W> { 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<W: LayoutElement> Tile<W> { offset.y += move_.from * move_.anim.value(); } + offset += self.interactive_move_offset; + offset } @@ -364,6 +370,11 @@ impl<W: LayoutElement> Tile<W> { }); } + pub fn stop_move_animations(&mut self) { + self.move_x_animation = None; + self.move_y_animation = None; + } + pub fn window(&self) -> &W { &self.window } |
