pub enum ModifiersKeyState {
Pressed,
Unknown,
}Expand description
The logical state of the particular modifiers key.
NOTE: while the modifier can only be in a binary active/inactive state, it might be helpful to note the context re. how its state changes by physical key events.
↓ / ↑ denote physical press/release1:
| Type | Activated | Deactivated | Comment |
|---|---|---|---|
| Regular | ↓ | ↑ | Active while being held |
| Sticky | ↓ | ↓ unless lock is enabled↓/↑2 non-sticky key | Temporarily “stuck”; other Sticky keys have no effect |
| Sticky Locked | ↓ if Sticky | ↓ | Similar to Toggle, but deactivating ↓ turns on Regular effect |
| Toggle | ↓ | ↓ | ↑ from the activating ↓ has no effect |
Sticky effect avoids the need to press and hold multiple modifiers for a single shortcut and
is usually a platform-wide option that affects modifiers commonly used in shortcuts:
Shift, Control, Alt, Meta.
Toggle type is typically a property of a modifier, for example, Caps Lock.
These active states are not differentiated here.
Variants§
Pressed
The particular modifier is active or logically, but not necessarily physically, pressed.
Unknown
The state of the key is unknown.
Can include cases when the key is active or logically pressed, for example, when a sticky
Shift is active, the OS might not preserve information that it was activated by
RightShift, so the state of ModifiersKeys::RSHIFT will be unknown while the state
of ModifiersState::SHIFT will be active.
Trait Implementations§
Source§impl Clone for ModifiersKeyState
impl Clone for ModifiersKeyState
Source§fn clone(&self) -> ModifiersKeyState
fn clone(&self) -> ModifiersKeyState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more