diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-04-08 19:25:45 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-04-08 19:25:45 +0400 |
| commit | 4856522a7a96f29179b5e723537d797f779c148d (patch) | |
| tree | 892e10c3ce859d1aab5c67711b097f38a391fd7f /src/layout/workspace.rs | |
| parent | c1432bfa96e40c12f2d10174f8cd23ec9c2a68b0 (diff) | |
| download | niri-4856522a7a96f29179b5e723537d797f779c148d.tar.gz niri-4856522a7a96f29179b5e723537d797f779c148d.tar.bz2 niri-4856522a7a96f29179b5e723537d797f779c148d.zip | |
Implement window open shift in terms of window-movement
This removes the quite unobvious visual size, and fixes jerking when
opening multiple windows in quick succession.
Diffstat (limited to 'src/layout/workspace.rs')
| -rw-r--r-- | src/layout/workspace.rs | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/src/layout/workspace.rs b/src/layout/workspace.rs index 40d55622..a8bc63f2 100644 --- a/src/layout/workspace.rs +++ b/src/layout/workspace.rs @@ -605,7 +605,7 @@ impl<W: LayoutElement> Workspace<W> { } /// Computes the X position of the windows in the given column, in logical coordinates. - fn column_x(&self, column_idx: usize) -> i32 { + pub fn column_x(&self, column_idx: usize) -> i32 { let mut x = 0; for column in self.columns.iter().take(column_idx) { @@ -615,16 +615,6 @@ impl<W: LayoutElement> Workspace<W> { x } - fn visual_column_x(&self, column_idx: usize) -> i32 { - let mut x = 0; - - for column in self.columns.iter().take(column_idx) { - x += column.visual_width() + self.options.gaps; - } - - x - } - pub fn add_window_at( &mut self, col_idx: usize, @@ -1164,13 +1154,13 @@ impl<W: LayoutElement> Workspace<W> { } fn tiles_in_render_order(&self) -> impl Iterator<Item = (&'_ Tile<W>, Point<i32, Logical>)> { - let view_pos = self.visual_column_x(self.active_column_idx) + self.view_offset; + let view_pos = self.view_pos(); // 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.visual_column_x(self.active_column_idx) - view_pos, + self.column_x(self.active_column_idx) - view_pos, col.tile_y(col.active_tile_idx), )) + col.render_offset(); let first = iter::once((tile, tile_pos)); @@ -1183,7 +1173,7 @@ impl<W: LayoutElement> Workspace<W> { // Keep track of column X position. .map(move |(col_idx, col)| { let rv = (col_idx, col, x); - x += col.visual_width() + self.options.gaps; + x += col.width() + self.options.gaps; rv }) .flat_map(move |(col_idx, col, x)| { @@ -1935,14 +1925,6 @@ impl<W: LayoutElement> Column<W> { .unwrap() } - fn visual_width(&self) -> i32 { - self.tiles - .iter() - .map(|tile| tile.visual_tile_size().w) - .max() - .unwrap() - } - fn focus_up(&mut self) { self.active_tile_idx = self.active_tile_idx.saturating_sub(1); } |
