diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2023-12-28 08:45:12 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2023-12-28 08:45:12 +0400 |
| commit | b13892ca637cccfb496e3204b2793c069af17ccb (patch) | |
| tree | 751ba2381c595baae1296eb8cbd5889418541b10 /src/layout/workspace.rs | |
| parent | 777ad4ee5c8cf84b2bfa13c6bdb0d254c24881f9 (diff) | |
| download | niri-b13892ca637cccfb496e3204b2793c069af17ccb.tar.gz niri-b13892ca637cccfb496e3204b2793c069af17ccb.tar.bz2 niri-b13892ca637cccfb496e3204b2793c069af17ccb.zip | |
Activate windows when clicking on the border
Diffstat (limited to 'src/layout/workspace.rs')
| -rw-r--r-- | src/layout/workspace.rs | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/layout/workspace.rs b/src/layout/workspace.rs index 32302187..090e27dd 100644 --- a/src/layout/workspace.rs +++ b/src/layout/workspace.rs @@ -761,7 +761,10 @@ impl<W: LayoutElement> Workspace<W> { self.column_x(self.active_column_idx) + self.view_offset } - pub fn window_under(&self, pos: Point<f64, Logical>) -> Option<(&W, Point<i32, Logical>)> { + pub fn window_under( + &self, + pos: Point<f64, Logical>, + ) -> Option<(&W, Option<Point<i32, Logical>>)> { if self.columns.is_empty() { return None; } @@ -775,8 +778,12 @@ impl<W: LayoutElement> Workspace<W> { self.column_x(self.active_column_idx) - view_pos, col.tile_y(col.active_tile_idx), )); - if active_tile.is_in_input_region(pos - tile_pos.to_f64()) { - return Some((active_tile.window(), tile_pos + active_tile.buf_loc())); + let pos_within_tile = pos - tile_pos.to_f64(); + if active_tile.is_in_input_region(pos_within_tile) { + let pos_within_surface = tile_pos + active_tile.buf_loc(); + return Some((active_tile.window(), Some(pos_within_surface))); + } else if active_tile.is_in_activation_region(pos_within_tile) { + return Some((active_tile.window(), None)); } let mut x = -view_pos; @@ -788,8 +795,12 @@ impl<W: LayoutElement> Workspace<W> { } let tile_pos = Point::from((x, y)); - if tile.is_in_input_region(pos - tile_pos.to_f64()) { - return Some((tile.window(), tile_pos + tile.buf_loc())); + let pos_within_tile = pos - tile_pos.to_f64(); + if tile.is_in_input_region(pos_within_tile) { + let pos_within_surface = tile_pos + tile.buf_loc(); + return Some((tile.window(), Some(pos_within_surface))); + } else if tile.is_in_activation_region(pos_within_tile) { + return Some((tile.window(), None)); } } |
