From e6d82d3ee34a7ac225d07ca3f4f4365cf27292d1 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Fri, 25 Apr 2025 10:08:26 +0300 Subject: Implement top-left hot corner to toggle the Overview Compared to third-party implementations such as waycorner: - It works during interactive window move (no surfaces receive pointer focus in this case, so this cannot work through layer-shell). - It works during drag-and-drop. - It disables itself over fullscreen windows. - It does not prevent direct scanout. --- src/niri.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/niri.rs') diff --git a/src/niri.rs b/src/niri.rs index 225a3702..fd317f2b 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -347,6 +347,7 @@ pub struct Niri { /// Used for limiting the notify to once per iteration, so that it's not spammed with high /// resolution mice. pub notified_activity_this_iteration: bool, + pub pointer_inside_hot_corner: bool, pub tablet_cursor_location: Option>, pub gesture_swipe_3f_cumulative: Option<(f64, f64)>, pub overview_scroll_swipe_gesture: ScrollSwipeGesture, @@ -2427,6 +2428,7 @@ impl Niri { pointer_inactivity_timer: None, pointer_inactivity_timer_got_reset: false, notified_activity_this_iteration: false, + pointer_inside_hot_corner: false, tablet_cursor_location: None, gesture_swipe_3f_cumulative: None, overview_scroll_swipe_gesture: ScrollSwipeGesture::new(), @@ -2920,6 +2922,11 @@ impl Niri { return false; } + let hot_corner = Rectangle::from_size(Size::from((1., 1.))); + if hot_corner.contains(pos_within_output) { + return true; + } + if layer_popup_under(Layer::Top) || layer_toplevel_under(Layer::Top) { return true; } @@ -3175,6 +3182,11 @@ impl Niri { .or_else(|| layer_toplevel_under(Layer::Bottom)) .or_else(|| layer_toplevel_under(Layer::Background)); } else { + let hot_corner = Rectangle::from_size(Size::from((1., 1.))); + if hot_corner.contains(pos_within_output) { + return rv; + } + under = under .or_else(|| layer_popup_under(Layer::Top)) .or_else(|| layer_toplevel_under(Layer::Top)); -- cgit