winit-core/keyboard: clarify modifier docs

Emphasize the difference between logical and physical state, reference sticky mods.
This commit is contained in:
Evgeny 2025-05-21 15:40:28 +07:00 committed by GitHub
parent 5190472bee
commit 38fd3c6a99
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 29 additions and 20 deletions

View file

@ -153,12 +153,13 @@ impl Drop for XkbState {
}
}
/// Represents the current state of the keyboard modifiers
/// Represents the current logical state of the keyboard modifiers
///
/// Each field of this struct represents a modifier and is `true` if this modifier is active.
///
/// For some modifiers, this means that the key is currently pressed, others are toggled
/// (like caps lock).
/// For some modifiers, this means that the key is logically pressed, others are toggled (like Caps
/// Lock). But physically the key can be in any state (for example, released Shift when
/// it's active as a sticky modifier or released Caps Lock when it's toggled on)
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
pub struct ModifiersState {
/// The "control" key