Recompute current pointer focus for focus-follows-mouse
Browse files at this commitde6caec685a304045b04db16e23eb5928685de6cParent: c8411e51 changed file +7 -3
- src/niri.rs +7 -3
src/niri.rsmodified+7 -3
| @@ -4144,18 +4144,22 @@ impl Niri { | |||
| 4144 | return; | 4144 | return; |
| 4145 | } | 4145 | } |
| 4146 | 4146 | ||
| 4147 | - if self.seat.get_pointer().unwrap().is_grabbed() { | 4147 | + let pointer = &self.seat.get_pointer().unwrap(); |
| 4148 | + if pointer.is_grabbed() { | ||
| 4148 | return; | 4149 | return; |
| 4149 | } | 4150 | } |
| 4150 | 4151 | ||
| 4152 | + // Recompute the current pointer focus because we don't update it during animations. | ||
| 4153 | + let current_focus = self.surface_under_and_global_space(pointer.current_location()); | ||
| 4154 | + | ||
| 4151 | if let Some(output) = &new_focus.output { | 4155 | if let Some(output) = &new_focus.output { |
| 4152 | - if self.pointer_focus.output.as_ref() != Some(output) { | 4156 | + if current_focus.output.as_ref() != Some(output) { |
| 4153 | self.layout.focus_output(output); | 4157 | self.layout.focus_output(output); |
| 4154 | } | 4158 | } |
| 4155 | } | 4159 | } |
| 4156 | 4160 | ||
| 4157 | if let Some(window) = &new_focus.window { | 4161 | if let Some(window) = &new_focus.window { |
| 4158 | - if self.pointer_focus.window.as_ref() != Some(window) { | 4162 | + if current_focus.window.as_ref() != Some(window) { |
| 4159 | self.layout.activate_window(window); | 4163 | self.layout.activate_window(window); |
| 4160 | } | 4164 | } |
| 4161 | } | 4165 | } |