aboutsummaryrefslogtreecommitdiff
path: root/src/layout
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-04-18 00:30:12 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-04-18 00:30:12 +0400
commit47f6c85f64a20a9e32bf402941ecb78065aff80a (patch)
treed06d8a646eabe919e8d2b149b47781c7d335c165 /src/layout
parent3b37f1a5579e9ae7eebb4c96d09b18ed8d6da8e2 (diff)
downloadniri-47f6c85f64a20a9e32bf402941ecb78065aff80a.tar.gz
niri-47f6c85f64a20a9e32bf402941ecb78065aff80a.tar.bz2
niri-47f6c85f64a20a9e32bf402941ecb78065aff80a.zip
Preserve tile move config on animation restarts
This fixes a problem where consume-into-column would use resize animation config instead of the window-movement config in most cases (since a resize comes very shortly after the move starts). A similar change to the column movement anim is more detrimental than it's worth.
Diffstat (limited to 'src/layout')
-rw-r--r--src/layout/tile.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/layout/tile.rs b/src/layout/tile.rs
index 16779c10..447a8929 100644
--- a/src/layout/tile.rs
+++ b/src/layout/tile.rs
@@ -247,8 +247,14 @@ impl<W: LayoutElement> Tile<W> {
) {
let current_offset = self.render_offset();
+ // Preserve the previous config if ongoing.
+ let anim = self.move_animation.take().map(|move_| move_.anim);
+ let anim = anim
+ .map(|anim| anim.restarted(1., 0., 0.))
+ .unwrap_or_else(|| Animation::new(1., 0., 0., config));
+
self.move_animation = Some(MoveAnimation {
- anim: Animation::new(1., 0., 0., config),
+ anim,
from: from + current_offset,
});
}