@@ -1693,6 +1693,7 @@ bitflags! {
16931693 ///
16941694 /// Note that the modifier key can be physically released with the modifier
16951695 /// still being marked as active, as in the case of sticky modifiers.
1696+ /// See [`ModifiersKeyState`] for more details on what "sticky" means.
16961697 #[ derive( Default , Debug , Clone , Copy , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
16971698 #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
16981699 pub struct ModifiersState : u32 {
@@ -1732,6 +1733,29 @@ impl ModifiersState {
17321733}
17331734
17341735/// The logical state of the particular modifiers key.
1736+ ///
1737+ /// NOTE: while the modifier can only be in a binary active/inactive state, it might be helpful to
1738+ /// note the context re. how its state changes by physical key events.
1739+ ///
1740+ /// `↓` / `↑` denote physical press/release[^1]:
1741+ ///
1742+ /// | Type | Activated | Deactivated | Comment |
1743+ /// | ----------------- | :-----------------: | :---------: | ------- |
1744+ /// | __Regular__ | `↓` | `↑` | Active while being held |
1745+ /// | __Sticky__ | `↓` | `↓` unless lock is enabled<br>`↓`/`↑`[^2] __non__-sticky key | Temporarily "stuck"; other `Sticky` keys have no effect |
1746+ /// | __Sticky Locked__ | `↓` <br>if `Sticky` | `↓` | Similar to `Toggle`, but deactivating `↓` turns on `Regular` effect |
1747+ /// | __Toggle__ | `↓` | `↓` | `↑` from the activating `↓` has no effect |
1748+ ///
1749+ /// `Sticky` effect avoids the need to press and hold multiple modifiers for a single shortcut and
1750+ /// is usually a platform-wide option that affects modifiers _commonly_ used in shortcuts:
1751+ /// <kbd>Shift</kbd>, <kbd>Control</kbd>, <kbd>Alt</kbd>, <kbd>Meta</kbd>.
1752+ ///
1753+ /// `Toggle` type is typically a property of a modifier, for example, <kbd>Caps Lock</kbd>.
1754+ ///
1755+ /// These active states are __not__ differentiated here.
1756+ ///
1757+ /// [^1]: For virtual/on-screen keyboards physical press/release can be a mouse click or a finger tap or a voice command.
1758+ /// [^2]: platform-dependent
17351759#[ derive( Default , Debug , Clone , Copy , PartialEq , Eq , Hash , PartialOrd , Ord ) ]
17361760#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
17371761pub enum ModifiersKeyState {
0 commit comments