aboutsummaryrefslogtreecommitdiff
path: root/src/niri.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2023-12-28 08:45:12 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2023-12-28 08:45:12 +0400
commitb13892ca637cccfb496e3204b2793c069af17ccb (patch)
tree751ba2381c595baae1296eb8cbd5889418541b10 /src/niri.rs
parent777ad4ee5c8cf84b2bfa13c6bdb0d254c24881f9 (diff)
downloadniri-b13892ca637cccfb496e3204b2793c069af17ccb.tar.gz
niri-b13892ca637cccfb496e3204b2793c069af17ccb.tar.bz2
niri-b13892ca637cccfb496e3204b2793c069af17ccb.zip
Activate windows when clicking on the border
Diffstat (limited to 'src/niri.rs')
-rw-r--r--src/niri.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/niri.rs b/src/niri.rs
index a0a98c90..3a3a4f4d 100644
--- a/src/niri.rs
+++ b/src/niri.rs
@@ -1035,6 +1035,10 @@ impl Niri {
Some((output, pos_within_output))
}
+ /// Returns the window under the position to be activated.
+ ///
+ /// The cursor may be inside the window's activation region, but not within the window's input
+ /// region.
pub fn window_under(&self, pos: Point<f64, Logical>) -> Option<&Window> {
if self.is_locked() || self.screenshot_ui.is_open() {
return None;
@@ -1045,6 +1049,10 @@ impl Niri {
Some(window)
}
+ /// Returns the window under the cursor to be activated.
+ ///
+ /// The cursor may be inside the window's activation region, but not within the window's input
+ /// region.
pub fn window_under_cursor(&self) -> Option<&Window> {
let pos = self.seat.get_pointer().unwrap().current_location();
self.window_under(pos)
@@ -1103,6 +1111,7 @@ impl Niri {
self.layout
.window_under(output, pos_within_output)
.and_then(|(window, win_pos_within_output)| {
+ let win_pos_within_output = win_pos_within_output?;
window
.surface_under(
pos_within_output - win_pos_within_output.to_f64(),