aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-04-08 19:48:52 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-04-08 19:48:52 +0400
commit6aceb3a798f0abde0ec2309b599687c05b792a68 (patch)
tree9c56d6b7528635e656f790ff098a8be67c8ee23b /src
parent4856522a7a96f29179b5e723537d797f779c148d (diff)
downloadniri-6aceb3a798f0abde0ec2309b599687c05b792a68.tar.gz
niri-6aceb3a798f0abde0ec2309b599687c05b792a68.tar.bz2
niri-6aceb3a798f0abde0ec2309b599687c05b792a68.zip
Render active column in front
Rather than just the active window. This is visible on the new window movement animations.
Diffstat (limited to 'src')
-rw-r--r--src/layout/workspace.rs47
1 files changed, 31 insertions, 16 deletions
diff --git a/src/layout/workspace.rs b/src/layout/workspace.rs
index a8bc63f2..f5b425bd 100644
--- a/src/layout/workspace.rs
+++ b/src/layout/workspace.rs
@@ -1159,12 +1159,25 @@ impl<W: LayoutElement> Workspace<W> {
// Start with the active window since it's drawn on top.
let col = &self.columns[self.active_column_idx];
let tile = &col.tiles[col.active_tile_idx];
- let tile_pos = Point::from((
- self.column_x(self.active_column_idx) - view_pos,
- col.tile_y(col.active_tile_idx),
- )) + col.render_offset();
+ let tile_pos =
+ Point::from((-self.view_offset, col.tile_y(col.active_tile_idx))) + col.render_offset();
let first = iter::once((tile, tile_pos));
+ // Next, the rest of the tiles in the active column, since it should be drawn on top as a
+ // whole during animations.
+ let next =
+ zip(&col.tiles, col.tile_ys())
+ .enumerate()
+ .filter_map(move |(tile_idx, (tile, y))| {
+ if tile_idx == col.active_tile_idx {
+ // Active tile comes first.
+ return None;
+ }
+
+ let tile_pos = Point::from((-self.view_offset, y)) + col.render_offset();
+ Some((tile, tile_pos))
+ });
+
let mut x = -view_pos;
let rest = self
.columns
@@ -1176,20 +1189,22 @@ impl<W: LayoutElement> Workspace<W> {
x += col.width() + self.options.gaps;
rv
})
- .flat_map(move |(col_idx, col, x)| {
- zip(&col.tiles, col.tile_ys()).enumerate().filter_map(
- move |(tile_idx, (tile, y))| {
- if col_idx == self.active_column_idx && tile_idx == col.active_tile_idx {
- // Active tile comes first.
- return None;
- }
+ .filter_map(|(col_idx, col, x)| {
+ if col_idx == self.active_column_idx {
+ // Active column comes before.
+ return None;
+ }
- let tile_pos = Point::from((x, y)) + col.render_offset();
- Some((tile, tile_pos))
- },
- )
+ Some((col, x))
+ })
+ .flat_map(move |(col, x)| {
+ zip(&col.tiles, col.tile_ys()).map(move |(tile, y)| {
+ let tile_pos = Point::from((x, y)) + col.render_offset();
+ (tile, tile_pos)
+ })
});
- first.chain(rest)
+
+ first.chain(next).chain(rest)
}
fn active_column_ref(&self) -> Option<&Column<W>> {