cursor: Add idle-hide timeout
Adds a cursor_hide_timeout config key (Option<u32> seconds) to CosmicCompConfig. When set, the cursor is hidden after the configured period of pointer inactivity and revealed again by any pointer event. Touch input does not count as activity (no visible cursor to surface). Implementation: - Per-seat hidden flag, calloop timer token, and last-armed Instant on CursorStateInner. - notify_cursor_activity called from each pointer-related input branch (motion, button, axis, tablet) resets the flag and reschedules the timer; rapid successive calls are coalesced behind a 100ms throttle so high-frequency mice don't churn the calloop timer source. - On timer fire, the hidden flag is set, draw_cursor short-circuits to an empty element list, and a render is scheduled. Active pointer grabs (drags, resizes) suppress the hide. - Config reload arms or cancels the timer immediately; None as the configured value collapses the cancel path into the same function. Closes #2231. Drafted with Claude (Anthropic); reviewed and tested by the committer.
This commit is contained in:
parent
6ebe2a1f04
commit
28258e5a5f
4 changed files with 124 additions and 3 deletions
|
|
@ -99,6 +99,8 @@ pub struct CosmicCompConfig {
|
|||
pub edge_snap_threshold: u32,
|
||||
pub accessibility_zoom: ZoomConfig,
|
||||
pub appearance_settings: AppearanceConfig,
|
||||
/// Hide the cursor after this many seconds of pointer inactivity (None disables)
|
||||
pub cursor_hide_timeout: Option<u32>,
|
||||
}
|
||||
|
||||
impl Default for CosmicCompConfig {
|
||||
|
|
@ -135,6 +137,7 @@ impl Default for CosmicCompConfig {
|
|||
edge_snap_threshold: 0,
|
||||
accessibility_zoom: ZoomConfig::default(),
|
||||
appearance_settings: AppearanceConfig::default(),
|
||||
cursor_hide_timeout: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue