cursor: hide while typing and after touch input
Typing hides on a real keystroke only — a bare modifier press is excluded so Super+drag keeps its cursor. Touch hides until the pointer next moves, which the reveal rule enforces via HideReason::Touch. Drafted with Claude (Anthropic); reviewed and tested by the committer.
This commit is contained in:
parent
569cfa6442
commit
295eaa8f63
1 changed files with 28 additions and 0 deletions
|
|
@ -339,6 +339,26 @@ impl State {
|
||||||
keyboard.modifier_state().num_lock;
|
keyboard.modifier_state().num_lock;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A bare modifier press changes the modifier state; a real
|
||||||
|
// keystroke does not. Super+drag moves windows, so hiding on
|
||||||
|
// Super-down would take the cursor away exactly as the user
|
||||||
|
// reaches for it. Super+1 still counts as typing.
|
||||||
|
let bare_modifier = previous_modifiers != keyboard.modifier_state();
|
||||||
|
if self.common.config.cosmic_conf.cursor_hide.while_typing
|
||||||
|
&& state == KeyState::Pressed
|
||||||
|
&& !bare_modifier
|
||||||
|
{
|
||||||
|
crate::backend::render::cursor::hide_cursor_now(
|
||||||
|
self,
|
||||||
|
&seat,
|
||||||
|
crate::backend::render::cursor::HideReason::Typing,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// Still refresh: this is how entering fullscreen by
|
||||||
|
// keyboard arms the fullscreen timeout.
|
||||||
|
crate::backend::render::cursor::refresh_idle_timer(self, &seat);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1496,6 +1516,14 @@ impl State {
|
||||||
time: event.time(),
|
time: event.time(),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if self.common.config.cosmic_conf.cursor_hide.after_touch {
|
||||||
|
crate::backend::render::cursor::hide_cursor_now(
|
||||||
|
self,
|
||||||
|
&seat,
|
||||||
|
crate::backend::render::cursor::HideReason::Touch,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
InputEvent::TouchMotion { event, .. } => {
|
InputEvent::TouchMotion { event, .. } => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue