winit::platform::modifier_supplement

Trait KeyEventExtModifierSupplement

source
pub trait KeyEventExtModifierSupplement {
    // Required methods
    fn text_with_all_modifiers(&self) -> Option<&str>;
    fn key_without_modifiers(&self) -> Key;
}
Expand description

Additional methods for the KeyEvent which cannot be implemented on all platforms.

Required Methods§

source

fn text_with_all_modifiers(&self) -> Option<&str>

Identical to KeyEvent::text but this is affected by Ctrl.

For example, pressing Ctrl+a produces Some("\x01").

source

fn key_without_modifiers(&self) -> Key

This value ignores all modifiers including, but not limited to Shift, Caps Lock, and Ctrl. In most cases this means that the unicode character in the resulting string is lowercase.

This is useful for key-bindings / shortcut key combinations.

In case logical_key reports Dead, this will still report the key as Character according to the current keyboard layout. This value cannot be Dead.

Implementors§