From b13892ca637cccfb496e3204b2793c069af17ccb Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Thu, 28 Dec 2023 08:45:12 +0400 Subject: Activate windows when clicking on the border --- src/niri.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/niri.rs') 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) -> 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(), -- cgit