forge
Explore
Log in

Don't you dare go Hollow

Extract update_pointer_focus()

Browse files at this commit

fb866c63e5d61107efb9ced46f72ae562af74fceIvan MolodetskikhParent: bae9575
src/niri.rsmodified+17 -4
@@ -283,12 +283,26 @@ impl State {
283283 }
284284 }
285285
286+ if !self.update_pointer_focus() {
287+ return;
288+ }
289+
290+ pointer.frame(self);
291+ // FIXME: granular
292+ self.niri.queue_redraw_all();
293+ }
294+
295+ pub fn update_pointer_focus(&mut self) -> bool {
296+ let _span = tracy_client::span!("Niri::update_pointer_focus");
297+
298+ let pointer = &self.niri.seat.get_pointer().unwrap();
299+ let location = pointer.current_location();
286300 let under = self.niri.surface_under_and_global_space(location);
287301
288302 // We're not changing the global cursor location here, so if the focus did not change, then
289303 // nothing changed.
290304 if self.niri.pointer_focus == under {
291- return;
305+ return false;
292306 }
293307
294308 self.niri.pointer_focus = under.clone();
@@ -303,9 +317,8 @@ impl State {
303317 time: get_monotonic_time().as_millis() as u32,
304318 },
305319 );
306- pointer.frame(self);
307- // FIXME: granular
308- self.niri.queue_redraw_all();
320+
321+ true
309322 }
310323
311324 pub fn move_cursor_to_output(&mut self, output: &Output) {