Set pointer contents straight to nothing when disabling pointer
Browse files at this commitef44adea69fe891d5b2837740536d6c0f86fa691Parent: 7fdb9181 changed file +9 -1
- src/niri.rs +9 -1
src/niri.rsmodified+9 -1
| @@ -929,7 +929,7 @@ impl State { | |||
| 929 | 929 | ||
| 930 | let pointer = &self.niri.seat.get_pointer().unwrap(); | 930 | let pointer = &self.niri.seat.get_pointer().unwrap(); |
| 931 | let location = pointer.current_location(); | 931 | let location = pointer.current_location(); |
| 932 | - let under = match self.niri.pointer_visibility { | 932 | + let mut under = match self.niri.pointer_visibility { |
| 933 | PointerVisibility::Disabled => PointContents::default(), | 933 | PointerVisibility::Disabled => PointContents::default(), |
| 934 | _ => self.niri.contents_under(location), | 934 | _ => self.niri.contents_under(location), |
| 935 | }; | 935 | }; |
| @@ -943,6 +943,14 @@ impl State { | |||
| 943 | // Disable the hidden pointer if the contents underneath have changed. | 943 | // Disable the hidden pointer if the contents underneath have changed. |
| 944 | if !self.niri.pointer_visibility.is_visible() { | 944 | if !self.niri.pointer_visibility.is_visible() { |
| 945 | self.niri.pointer_visibility = PointerVisibility::Disabled; | 945 | self.niri.pointer_visibility = PointerVisibility::Disabled; |
| 946 | + | ||
| 947 | + // When setting PointerVisibility::Hidden together with pointer contents changing, | ||
| 948 | + // we can change straight to nothing to avoid one frame of hover. Notably, this can | ||
| 949 | + // be triggered through warp-mouse-to-focus combined with hide-when-typing. | ||
| 950 | + under = PointContents::default(); | ||
| 951 | + if self.niri.pointer_contents == under { | ||
| 952 | + return false; | ||
| 953 | + } | ||
| 946 | } | 954 | } |
| 947 | 955 | ||
| 948 | self.niri.pointer_contents.clone_from(&under); | 956 | self.niri.pointer_contents.clone_from(&under); |