refactor: make handle_pending_enter fn function

This commit is contained in:
En-En 2025-11-05 13:30:30 +00:00 committed by Supreeeme
parent e8079bc072
commit 56256a1340

View file

@ -460,7 +460,12 @@ impl Event for client::wl_pointer::Event {
// Niri). Other compositors do not run into this problem because they appear to not send // Niri). Other compositors do not run into this problem because they appear to not send
// wl_pointer.enter until the user actually moves the mouse in the popup. // wl_pointer.enter until the user actually moves the mouse in the popup.
let handle_pending_enter = |target: Entity, state: &mut ServerState<C>, event_str: &str| loop { fn handle_pending_enter<C: XConnection>(
target: Entity,
state: &mut ServerState<C>,
event_str: &str,
) -> bool {
loop {
let Ok(pe) = state.world.get::<&PendingEnter>(target) else { let Ok(pe) = state.world.get::<&PendingEnter>(target) else {
return true; return true;
}; };
@ -487,12 +492,13 @@ impl Event for client::wl_pointer::Event {
}; };
drop(pe); drop(pe);
Self::handle(enter_event, target, state); Event::handle(enter_event, target, state);
} else { } else {
warn!("could not move pointer to surface: stale surface"); warn!("could not move pointer to surface: stale surface");
return false; return false;
} }
}; }
}
match self { match self {
Self::Enter { Self::Enter {