diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-12-15 10:30:32 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-12-30 20:12:37 +0300 |
| commit | 14b1003c627cb6ceddfb29ef3298e0b9481f91e6 (patch) | |
| tree | b1cc8fed18c93e7c5a3425a3fd8943325cfdd3f6 /src | |
| parent | 43a4bae010b814089fe96b9c70c30bdf04b697a4 (diff) | |
| download | niri-14b1003c627cb6ceddfb29ef3298e0b9481f91e6.tar.gz niri-14b1003c627cb6ceddfb29ef3298e0b9481f91e6.tar.bz2 niri-14b1003c627cb6ceddfb29ef3298e0b9481f91e6.zip | |
layout: Implement focus_right_or_first() generically
Diffstat (limited to 'src')
| -rw-r--r-- | src/layout/scrolling.rs | 22 | ||||
| -rw-r--r-- | src/layout/workspace.rs | 12 |
2 files changed, 4 insertions, 30 deletions
diff --git a/src/layout/scrolling.rs b/src/layout/scrolling.rs index a3b22360..83c597aa 100644 --- a/src/layout/scrolling.rs +++ b/src/layout/scrolling.rs @@ -1316,28 +1316,6 @@ impl<W: LayoutElement> ScrollingSpace<W> { self.activate_column(self.columns.len() - 1); } - pub fn focus_column_right_or_first(&mut self) { - if self.columns.is_empty() { - return; - } - - let column_idx = (self.active_column_idx + 1) % self.columns.len(); - self.activate_column(column_idx); - } - - pub fn focus_column_left_or_last(&mut self) { - if self.columns.is_empty() { - return; - } - - let column_idx = if self.active_column_idx == 0 { - self.columns.len() - 1 - } else { - self.active_column_idx - 1 - }; - self.activate_column(column_idx); - } - pub fn focus_down(&mut self) -> bool { if self.columns.is_empty() { return false; diff --git a/src/layout/workspace.rs b/src/layout/workspace.rs index 9ad72cd1..3b3e28ee 100644 --- a/src/layout/workspace.rs +++ b/src/layout/workspace.rs @@ -779,19 +779,15 @@ impl<W: LayoutElement> Workspace<W> { } pub fn focus_column_right_or_first(&mut self) { - // TODO - if self.floating_is_active { - return; + if !self.focus_right() { + self.focus_column_first(); } - self.scrolling.focus_column_right_or_first(); } pub fn focus_column_left_or_last(&mut self) { - // TODO - if self.floating_is_active { - return; + if !self.focus_left() { + self.focus_column_last(); } - self.scrolling.focus_column_left_or_last(); } pub fn focus_down(&mut self) -> bool { |
