aboutsummaryrefslogtreecommitdiff
path: root/src/layout/workspace.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-12-15 10:30:32 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2024-12-30 20:12:37 +0300
commit6a7c8fcfd529ec31d274b347f4a591ad40366c09 (patch)
treebb4bff6524e5734d576bb42b9eff9b0353ccf1d0 /src/layout/workspace.rs
parent14b1003c627cb6ceddfb29ef3298e0b9481f91e6 (diff)
downloadniri-6a7c8fcfd529ec31d274b347f4a591ad40366c09.tar.gz
niri-6a7c8fcfd529ec31d274b347f4a591ad40366c09.tar.bz2
niri-6a7c8fcfd529ec31d274b347f4a591ad40366c09.zip
floating: Implement directional focus
Diffstat (limited to 'src/layout/workspace.rs')
-rw-r--r--src/layout/workspace.rs60
1 files changed, 30 insertions, 30 deletions
diff --git a/src/layout/workspace.rs b/src/layout/workspace.rs
index 3b3e28ee..baae33c8 100644
--- a/src/layout/workspace.rs
+++ b/src/layout/workspace.rs
@@ -747,35 +747,35 @@ impl<W: LayoutElement> Workspace<W> {
}
pub fn focus_left(&mut self) -> bool {
- // TODO
if self.floating_is_active {
- return true;
+ self.floating.focus_left()
+ } else {
+ self.scrolling.focus_left()
}
- self.scrolling.focus_left()
}
pub fn focus_right(&mut self) -> bool {
- // TODO
if self.floating_is_active {
- return true;
+ self.floating.focus_right()
+ } else {
+ self.scrolling.focus_right()
}
- self.scrolling.focus_right()
}
pub fn focus_column_first(&mut self) {
- // TODO
if self.floating_is_active {
- return;
+ self.floating.focus_leftmost();
+ } else {
+ self.scrolling.focus_column_first();
}
- self.scrolling.focus_column_first();
}
pub fn focus_column_last(&mut self) {
- // TODO
if self.floating_is_active {
- return;
+ self.floating.focus_rightmost();
+ } else {
+ self.scrolling.focus_column_last();
}
- self.scrolling.focus_column_last();
}
pub fn focus_column_right_or_first(&mut self) {
@@ -791,51 +791,51 @@ impl<W: LayoutElement> Workspace<W> {
}
pub fn focus_down(&mut self) -> bool {
- // TODO
if self.floating_is_active {
- return true;
+ self.floating.focus_down()
+ } else {
+ self.scrolling.focus_down()
}
- self.scrolling.focus_down()
}
pub fn focus_up(&mut self) -> bool {
- // TODO
if self.floating_is_active {
- return true;
+ self.floating.focus_up()
+ } else {
+ self.scrolling.focus_up()
}
- self.scrolling.focus_up()
}
pub fn focus_down_or_left(&mut self) {
- // TODO
if self.floating_is_active {
- return;
+ self.floating.focus_down();
+ } else {
+ self.scrolling.focus_down_or_left();
}
- self.scrolling.focus_down_or_left();
}
pub fn focus_down_or_right(&mut self) {
- // TODO
if self.floating_is_active {
- return;
+ self.floating.focus_down();
+ } else {
+ self.scrolling.focus_down_or_right();
}
- self.scrolling.focus_down_or_right();
}
pub fn focus_up_or_left(&mut self) {
- // TODO
if self.floating_is_active {
- return;
+ self.floating.focus_up();
+ } else {
+ self.scrolling.focus_up_or_left();
}
- self.scrolling.focus_up_or_left();
}
pub fn focus_up_or_right(&mut self) {
- // TODO
if self.floating_is_active {
- return;
+ self.floating.focus_up();
+ } else {
+ self.scrolling.focus_up_or_right();
}
- self.scrolling.focus_up_or_right();
}
pub fn move_left(&mut self) -> bool {