diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-12-28 10:12:50 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-12-30 20:12:37 +0300 |
| commit | 8b0cb0bb57112bd15bc7ac04e6952d857dadcbca (patch) | |
| tree | c0a9cd138e768e7596d8cd324be65024fbb35756 /src/layout/scrolling.rs | |
| parent | a24a6e4e3c441389fd7731320f47e61e567e237f (diff) | |
| download | niri-8b0cb0bb57112bd15bc7ac04e6952d857dadcbca.tar.gz niri-8b0cb0bb57112bd15bc7ac04e6952d857dadcbca.tar.bz2 niri-8b0cb0bb57112bd15bc7ac04e6952d857dadcbca.zip | |
Add set-window-width action
Diffstat (limited to 'src/layout/scrolling.rs')
| -rw-r--r-- | src/layout/scrolling.rs | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/layout/scrolling.rs b/src/layout/scrolling.rs index 5d1b8234..c0de770a 100644 --- a/src/layout/scrolling.rs +++ b/src/layout/scrolling.rs @@ -1996,13 +1996,26 @@ impl<W: LayoutElement> ScrollingSpace<W> { cancel_resize_for_column(&mut self.interactive_resize, col); } - pub fn set_column_width(&mut self, change: SizeChange) { + pub fn set_window_width(&mut self, window: Option<&W::Id>, change: SizeChange) { if self.columns.is_empty() { return; } - let col = &mut self.columns[self.active_column_idx]; - col.set_column_width(change, None, true); + let (col, tile_idx) = if let Some(window) = window { + self.columns + .iter_mut() + .find_map(|col| { + col.tiles + .iter() + .position(|tile| tile.window().id() == window) + .map(|tile_idx| (col, Some(tile_idx))) + }) + .unwrap() + } else { + (&mut self.columns[self.active_column_idx], None) + }; + + col.set_column_width(change, tile_idx, true); cancel_resize_for_column(&mut self.interactive_resize, col); } |
