Trait tfc::traits::AsciiKeyboardContext [−][src]
A context that supports layout-dependent ASCII keyboard events.
Internally, this will map ASCII characters to Key
s and use
KeyboardContext
which means that a standard US
keyboard layout is assumed. Using this with other keyboard layouts is
unlikely to produce the desired results.
This is meant to be a fallback for platforms that don’t have
UnicodeKeyboardContext
(i.e.
Linux-Wayland). This may also be used for performance reasons as it may be
slightly faster than
UnicodeKeyboardContext
. That’s if you’re
willing to accept ASCII on a standard US keyboard layout.
All printable characters are translated as you would expect and some special characters are also handled.
ASCII | Key |
---|---|
0x08 (backspace) | Key::DeleteOrBackspace |
0x09 (tab) | Key::Tab |
0x0A (linefeed) | Key::ReturnOrEnter |
0x1B (escape) | Key::Escape |
0x7F (delete) | Key::DeleteOrBackspace |
Required methods
fn ascii_char_down(
&mut self,
ch: u8
) -> Result<(), GenericError<Self::PlatformError>>
[src]
&mut self,
ch: u8
) -> Result<(), GenericError<Self::PlatformError>>
Generate a key press event (possibly including shift) for an ASCII character.
If the shift key is necessary to type the character, then the shift key
will be pressed. For example, ascii_down(b'A')
is equivalent to
key_down(Key::Shift)
followed by key_down(Key::A)
.
Returns UnsupportedAscii
if the
given character is unsupported.
fn ascii_char_up(
&mut self,
ch: u8
) -> Result<(), GenericError<Self::PlatformError>>
[src]
&mut self,
ch: u8
) -> Result<(), GenericError<Self::PlatformError>>
Generate a key release event (possibly including shift) for an ASCII character.
If the shift key is necessary to type the character, then the shift key
will be released. For example, ascii_up(b'A')
is equivalent to
key_up(Key::A)
followed by key_up(Key::Shift)
.
Returns UnsupportedAscii
if the
given character is unsupported.
fn ascii_char(
&mut self,
ch: u8
) -> Result<(), GenericError<Self::PlatformError>>
[src]
&mut self,
ch: u8
) -> Result<(), GenericError<Self::PlatformError>>
Generate a key press and release event to type an ASCII character.
This is equivalent to calling
ascii_char_down
followed by
ascii_char_up
.
Returns UnsupportedAscii
if the
given character is unsupported.
fn ascii_string(
&mut self,
s: &[u8]
) -> Result<(), GenericError<Self::PlatformError>>
[src]
&mut self,
s: &[u8]
) -> Result<(), GenericError<Self::PlatformError>>
Generate key presses and releases such that an ASCII string is typed.
If any of the characters in the string are unsupported,
UnsupportedAscii
will be returned
and no key presses will occur.
Implementors
impl<C: KeyboardContext + FallibleContext> AsciiKeyboardContext for C
[src]
fn ascii_char_down(
&mut self,
ch: u8
) -> Result<(), GenericError<Self::PlatformError>>
[src]
&mut self,
ch: u8
) -> Result<(), GenericError<Self::PlatformError>>
fn ascii_char_up(
&mut self,
ch: u8
) -> Result<(), GenericError<Self::PlatformError>>
[src]
&mut self,
ch: u8
) -> Result<(), GenericError<Self::PlatformError>>
fn ascii_char(
&mut self,
ch: u8
) -> Result<(), GenericError<Self::PlatformError>>
[src]
&mut self,
ch: u8
) -> Result<(), GenericError<Self::PlatformError>>
fn ascii_string(
&mut self,
s: &[u8]
) -> Result<(), GenericError<Self::PlatformError>>
[src]
&mut self,
s: &[u8]
) -> Result<(), GenericError<Self::PlatformError>>