cursor: let the hide reason tighten, and clear timer state when suppressed
The hidden.is_some() guard dropped a hide-reason upgrade: an Idle-hidden cursor that received a touch stayed Idle, so a later click or scroll revealed it where the spec says a touch-hidden cursor waits for real movement. Reachable on the default config — fullscreen video, cursor idle-hidden after 3s, tap the screen, nudge the scroll wheel. The guard itself has to stay, or every keystroke with while_typing on reschedules a render on every output; so it now returns early only when the reason is unchanged or already Touch. hide_cursor also returned before clearing idle_timer and last_armed when the pointer was grabbed, leaving both stale while on_idle_timer's neighbouring Drop arm cleared them carefully. Clearing in hide_cursor before the grab check fixes both call sites at once — hide_cursor_now removes the source itself, and the Hide arm returns TimeoutAction::Drop — rather than restating the cleanup in one match arm. Drafted with Claude (Anthropic); reviewed and tested by the committer.
This commit is contained in:
parent
115cdac039
commit
895ce91543
1 changed files with 8 additions and 8 deletions
|
|
@ -998,20 +998,20 @@ pub fn hide_cursor_now(state: &mut State, seat: &Seat<State>, reason: HideReason
|
|||
}
|
||||
|
||||
fn hide_cursor(state: &mut State, seat: &Seat<State>, reason: HideReason) {
|
||||
if let Some(ptr) = seat.get_pointer()
|
||||
&& ptr.is_grabbed()
|
||||
{
|
||||
return;
|
||||
}
|
||||
let grabbed = seat.get_pointer().is_some_and(|ptr| ptr.is_grabbed());
|
||||
let cursor_state = seat.user_data().get::<CursorState>().unwrap();
|
||||
{
|
||||
let mut inner = cursor_state.lock().unwrap();
|
||||
if inner.hidden.is_some() {
|
||||
// Every caller has already disposed of the timer source, so clear the
|
||||
// bookkeeping before the grab check rather than only on success.
|
||||
inner.idle_timer = None;
|
||||
inner.last_armed = None;
|
||||
// The reason only ever tightens: `Touch` waits for real movement, so a
|
||||
// later trigger must not relax it back to click-or-scroll.
|
||||
if grabbed || inner.hidden == Some(reason) || inner.hidden == Some(HideReason::Touch) {
|
||||
return;
|
||||
}
|
||||
inner.hidden = Some(reason);
|
||||
inner.idle_timer = None;
|
||||
inner.last_armed = None;
|
||||
}
|
||||
let outputs: Vec<_> = state.common.shell.read().outputs().cloned().collect();
|
||||
for output in outputs {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue