Refactor KeyCode into Key and Location
This commit is contained in:
parent
534c7dd7b0
commit
64d1ce5532
24 changed files with 1277 additions and 461 deletions
|
|
@ -144,6 +144,7 @@ raw-window-handle = "0.5"
|
||||||
resvg = "0.36"
|
resvg = "0.36"
|
||||||
rustc-hash = "1.0"
|
rustc-hash = "1.0"
|
||||||
smol = "1.0"
|
smol = "1.0"
|
||||||
|
smol_str = "0.2"
|
||||||
softbuffer = "0.2"
|
softbuffer = "0.2"
|
||||||
syntect = "5.1"
|
syntect = "5.1"
|
||||||
sysinfo = "0.28"
|
sysinfo = "0.28"
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,11 @@ keywords.workspace = true
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bitflags.workspace = true
|
bitflags.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
thiserror.workspace = true
|
|
||||||
xxhash-rust.workspace = true
|
|
||||||
num-traits.workspace = true
|
num-traits.workspace = true
|
||||||
|
smol_str.workspace = true
|
||||||
|
thiserror.workspace = true
|
||||||
web-time.workspace = true
|
web-time.workspace = true
|
||||||
|
xxhash-rust.workspace = true
|
||||||
|
|
||||||
palette.workspace = true
|
palette.workspace = true
|
||||||
palette.optional = true
|
palette.optional = true
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
//! Listen to keyboard events.
|
//! Listen to keyboard events.
|
||||||
|
pub mod key;
|
||||||
|
|
||||||
mod event;
|
mod event;
|
||||||
mod key_code;
|
mod location;
|
||||||
mod modifiers;
|
mod modifiers;
|
||||||
|
|
||||||
pub use event::Event;
|
pub use event::Event;
|
||||||
pub use key_code::KeyCode;
|
pub use key::Key;
|
||||||
|
pub use location::Location;
|
||||||
pub use modifiers::Modifiers;
|
pub use modifiers::Modifiers;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use super::{KeyCode, Modifiers};
|
use crate::keyboard::{Key, Location, Modifiers};
|
||||||
|
|
||||||
/// A keyboard event.
|
/// A keyboard event.
|
||||||
///
|
///
|
||||||
|
|
@ -10,10 +10,13 @@ use super::{KeyCode, Modifiers};
|
||||||
pub enum Event {
|
pub enum Event {
|
||||||
/// A keyboard key was pressed.
|
/// A keyboard key was pressed.
|
||||||
KeyPressed {
|
KeyPressed {
|
||||||
/// The key identifier
|
/// The key pressed.
|
||||||
key_code: KeyCode,
|
key: Key,
|
||||||
|
|
||||||
/// The state of the modifier keys
|
/// The location of the key.
|
||||||
|
location: Location,
|
||||||
|
|
||||||
|
/// The state of the modifier keys.
|
||||||
modifiers: Modifiers,
|
modifiers: Modifiers,
|
||||||
|
|
||||||
/// The text produced by the key press, if any.
|
/// The text produced by the key press, if any.
|
||||||
|
|
@ -22,10 +25,13 @@ pub enum Event {
|
||||||
|
|
||||||
/// A keyboard key was released.
|
/// A keyboard key was released.
|
||||||
KeyReleased {
|
KeyReleased {
|
||||||
/// The key identifier
|
/// The key released.
|
||||||
key_code: KeyCode,
|
key: Key,
|
||||||
|
|
||||||
/// The state of the modifier keys
|
/// The location of the key.
|
||||||
|
location: Location,
|
||||||
|
|
||||||
|
/// The state of the modifier keys.
|
||||||
modifiers: Modifiers,
|
modifiers: Modifiers,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
744
core/src/keyboard/key.rs
Normal file
744
core/src/keyboard/key.rs
Normal file
|
|
@ -0,0 +1,744 @@
|
||||||
|
//! Identify keyboard keys.
|
||||||
|
use smol_str::SmolStr;
|
||||||
|
|
||||||
|
/// A key on the keyboard.
|
||||||
|
///
|
||||||
|
/// This is mostly the `Key` type found in [`winit`].
|
||||||
|
///
|
||||||
|
/// [`winit`]: https://docs.rs/winit/0.29.10/winit/keyboard/enum.Key.html
|
||||||
|
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
|
pub enum Key<C = SmolStr> {
|
||||||
|
/// A key with an established name.
|
||||||
|
Named(Named),
|
||||||
|
|
||||||
|
/// A key string that corresponds to the character typed by the user, taking into account the
|
||||||
|
/// user’s current locale setting, and any system-level keyboard mapping overrides that are in
|
||||||
|
/// effect.
|
||||||
|
Character(C),
|
||||||
|
|
||||||
|
/// An unidentified key.
|
||||||
|
Unidentified,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Key {
|
||||||
|
/// Convert `Key::Character(SmolStr)` to `Key::Character(&str)` so you can more easily match on
|
||||||
|
/// `Key`. All other variants remain unchanged.
|
||||||
|
pub fn as_ref(&self) -> Key<&str> {
|
||||||
|
match self {
|
||||||
|
Self::Named(named) => Key::Named(*named),
|
||||||
|
Self::Character(c) => Key::Character(c.as_ref()),
|
||||||
|
Self::Unidentified => Key::Unidentified,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A named key.
|
||||||
|
///
|
||||||
|
/// This is mostly the `NamedKey` type found in [`winit`].
|
||||||
|
///
|
||||||
|
/// [`winit`]: https://docs.rs/winit/0.29.10/winit/keyboard/enum.Key.html
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
|
#[allow(missing_docs)]
|
||||||
|
pub enum Named {
|
||||||
|
/// The `Alt` (Alternative) key.
|
||||||
|
///
|
||||||
|
/// This key enables the alternate modifier function for interpreting concurrent or subsequent
|
||||||
|
/// keyboard input. This key value is also used for the Apple <kbd>Option</kbd> key.
|
||||||
|
Alt,
|
||||||
|
/// The Alternate Graphics (<kbd>AltGr</kbd> or <kbd>AltGraph</kbd>) key.
|
||||||
|
///
|
||||||
|
/// This key is used enable the ISO Level 3 shift modifier (the standard `Shift` key is the
|
||||||
|
/// level 2 modifier).
|
||||||
|
AltGraph,
|
||||||
|
/// The `Caps Lock` (Capital) key.
|
||||||
|
///
|
||||||
|
/// Toggle capital character lock function for interpreting subsequent keyboard input event.
|
||||||
|
CapsLock,
|
||||||
|
/// The `Control` or `Ctrl` key.
|
||||||
|
///
|
||||||
|
/// Used to enable control modifier function for interpreting concurrent or subsequent keyboard
|
||||||
|
/// input.
|
||||||
|
Control,
|
||||||
|
/// The Function switch `Fn` key. Activating this key simultaneously with another key changes
|
||||||
|
/// that key’s value to an alternate character or function. This key is often handled directly
|
||||||
|
/// in the keyboard hardware and does not usually generate key events.
|
||||||
|
Fn,
|
||||||
|
/// The Function-Lock (`FnLock` or `F-Lock`) key. Activating this key switches the mode of the
|
||||||
|
/// keyboard to changes some keys' values to an alternate character or function. This key is
|
||||||
|
/// often handled directly in the keyboard hardware and does not usually generate key events.
|
||||||
|
FnLock,
|
||||||
|
/// The `NumLock` or Number Lock key. Used to toggle numpad mode function for interpreting
|
||||||
|
/// subsequent keyboard input.
|
||||||
|
NumLock,
|
||||||
|
/// Toggle between scrolling and cursor movement modes.
|
||||||
|
ScrollLock,
|
||||||
|
/// Used to enable shift modifier function for interpreting concurrent or subsequent keyboard
|
||||||
|
/// input.
|
||||||
|
Shift,
|
||||||
|
/// The Symbol modifier key (used on some virtual keyboards).
|
||||||
|
Symbol,
|
||||||
|
SymbolLock,
|
||||||
|
// Legacy modifier key. Also called "Super" in certain places.
|
||||||
|
Meta,
|
||||||
|
// Legacy modifier key.
|
||||||
|
Hyper,
|
||||||
|
/// Used to enable "super" modifier function for interpreting concurrent or subsequent keyboard
|
||||||
|
/// input. This key value is used for the "Windows Logo" key and the Apple `Command` or `⌘` key.
|
||||||
|
///
|
||||||
|
/// Note: In some contexts (e.g. the Web) this is referred to as the "Meta" key.
|
||||||
|
Super,
|
||||||
|
/// The `Enter` or `↵` key. Used to activate current selection or accept current input. This key
|
||||||
|
/// value is also used for the `Return` (Macintosh numpad) key. This key value is also used for
|
||||||
|
/// the Android `KEYCODE_DPAD_CENTER`.
|
||||||
|
Enter,
|
||||||
|
/// The Horizontal Tabulation `Tab` key.
|
||||||
|
Tab,
|
||||||
|
/// Used in text to insert a space between words. Usually located below the character keys.
|
||||||
|
Space,
|
||||||
|
/// Navigate or traverse downward. (`KEYCODE_DPAD_DOWN`)
|
||||||
|
ArrowDown,
|
||||||
|
/// Navigate or traverse leftward. (`KEYCODE_DPAD_LEFT`)
|
||||||
|
ArrowLeft,
|
||||||
|
/// Navigate or traverse rightward. (`KEYCODE_DPAD_RIGHT`)
|
||||||
|
ArrowRight,
|
||||||
|
/// Navigate or traverse upward. (`KEYCODE_DPAD_UP`)
|
||||||
|
ArrowUp,
|
||||||
|
/// The End key, used with keyboard entry to go to the end of content (`KEYCODE_MOVE_END`).
|
||||||
|
End,
|
||||||
|
/// The Home key, used with keyboard entry, to go to start of content (`KEYCODE_MOVE_HOME`).
|
||||||
|
/// For the mobile phone `Home` key (which goes to the phone’s main screen), use [`GoHome`].
|
||||||
|
///
|
||||||
|
/// [`GoHome`]: Self::GoHome
|
||||||
|
Home,
|
||||||
|
/// Scroll down or display next page of content.
|
||||||
|
PageDown,
|
||||||
|
/// Scroll up or display previous page of content.
|
||||||
|
PageUp,
|
||||||
|
/// Used to remove the character to the left of the cursor. This key value is also used for
|
||||||
|
/// the key labeled `Delete` on MacOS keyboards.
|
||||||
|
Backspace,
|
||||||
|
/// Remove the currently selected input.
|
||||||
|
Clear,
|
||||||
|
/// Copy the current selection. (`APPCOMMAND_COPY`)
|
||||||
|
Copy,
|
||||||
|
/// The Cursor Select key.
|
||||||
|
CrSel,
|
||||||
|
/// Cut the current selection. (`APPCOMMAND_CUT`)
|
||||||
|
Cut,
|
||||||
|
/// Used to delete the character to the right of the cursor. This key value is also used for the
|
||||||
|
/// key labeled `Delete` on MacOS keyboards when `Fn` is active.
|
||||||
|
Delete,
|
||||||
|
/// The Erase to End of Field key. This key deletes all characters from the current cursor
|
||||||
|
/// position to the end of the current field.
|
||||||
|
EraseEof,
|
||||||
|
/// The Extend Selection (Exsel) key.
|
||||||
|
ExSel,
|
||||||
|
/// Toggle between text modes for insertion or overtyping.
|
||||||
|
/// (`KEYCODE_INSERT`)
|
||||||
|
Insert,
|
||||||
|
/// The Paste key. (`APPCOMMAND_PASTE`)
|
||||||
|
Paste,
|
||||||
|
/// Redo the last action. (`APPCOMMAND_REDO`)
|
||||||
|
Redo,
|
||||||
|
/// Undo the last action. (`APPCOMMAND_UNDO`)
|
||||||
|
Undo,
|
||||||
|
/// The Accept (Commit, OK) key. Accept current option or input method sequence conversion.
|
||||||
|
Accept,
|
||||||
|
/// Redo or repeat an action.
|
||||||
|
Again,
|
||||||
|
/// The Attention (Attn) key.
|
||||||
|
Attn,
|
||||||
|
Cancel,
|
||||||
|
/// Show the application’s context menu.
|
||||||
|
/// This key is commonly found between the right `Super` key and the right `Control` key.
|
||||||
|
ContextMenu,
|
||||||
|
/// The `Esc` key. This key was originally used to initiate an escape sequence, but is
|
||||||
|
/// now more generally used to exit or "escape" the current context, such as closing a dialog
|
||||||
|
/// or exiting full screen mode.
|
||||||
|
Escape,
|
||||||
|
Execute,
|
||||||
|
/// Open the Find dialog. (`APPCOMMAND_FIND`)
|
||||||
|
Find,
|
||||||
|
/// Open a help dialog or toggle display of help information. (`APPCOMMAND_HELP`,
|
||||||
|
/// `KEYCODE_HELP`)
|
||||||
|
Help,
|
||||||
|
/// Pause the current state or application (as appropriate).
|
||||||
|
///
|
||||||
|
/// Note: Do not use this value for the `Pause` button on media controllers. Use `"MediaPause"`
|
||||||
|
/// instead.
|
||||||
|
Pause,
|
||||||
|
/// Play or resume the current state or application (as appropriate).
|
||||||
|
///
|
||||||
|
/// Note: Do not use this value for the `Play` button on media controllers. Use `"MediaPlay"`
|
||||||
|
/// instead.
|
||||||
|
Play,
|
||||||
|
/// The properties (Props) key.
|
||||||
|
Props,
|
||||||
|
Select,
|
||||||
|
/// The ZoomIn key. (`KEYCODE_ZOOM_IN`)
|
||||||
|
ZoomIn,
|
||||||
|
/// The ZoomOut key. (`KEYCODE_ZOOM_OUT`)
|
||||||
|
ZoomOut,
|
||||||
|
/// The Brightness Down key. Typically controls the display brightness.
|
||||||
|
/// (`KEYCODE_BRIGHTNESS_DOWN`)
|
||||||
|
BrightnessDown,
|
||||||
|
/// The Brightness Up key. Typically controls the display brightness. (`KEYCODE_BRIGHTNESS_UP`)
|
||||||
|
BrightnessUp,
|
||||||
|
/// Toggle removable media to eject (open) and insert (close) state. (`KEYCODE_MEDIA_EJECT`)
|
||||||
|
Eject,
|
||||||
|
LogOff,
|
||||||
|
/// Toggle power state. (`KEYCODE_POWER`)
|
||||||
|
/// Note: Note: Some devices might not expose this key to the operating environment.
|
||||||
|
Power,
|
||||||
|
/// The `PowerOff` key. Sometime called `PowerDown`.
|
||||||
|
PowerOff,
|
||||||
|
/// Initiate print-screen function.
|
||||||
|
PrintScreen,
|
||||||
|
/// The Hibernate key. This key saves the current state of the computer to disk so that it can
|
||||||
|
/// be restored. The computer will then shutdown.
|
||||||
|
Hibernate,
|
||||||
|
/// The Standby key. This key turns off the display and places the computer into a low-power
|
||||||
|
/// mode without completely shutting down. It is sometimes labelled `Suspend` or `Sleep` key.
|
||||||
|
/// (`KEYCODE_SLEEP`)
|
||||||
|
Standby,
|
||||||
|
/// The WakeUp key. (`KEYCODE_WAKEUP`)
|
||||||
|
WakeUp,
|
||||||
|
/// Initate the multi-candidate mode.
|
||||||
|
AllCandidates,
|
||||||
|
Alphanumeric,
|
||||||
|
/// Initiate the Code Input mode to allow characters to be entered by
|
||||||
|
/// their code points.
|
||||||
|
CodeInput,
|
||||||
|
/// The Compose key, also known as "Multi_key" on the X Window System. This key acts in a
|
||||||
|
/// manner similar to a dead key, triggering a mode where subsequent key presses are combined to
|
||||||
|
/// produce a different character.
|
||||||
|
Compose,
|
||||||
|
/// Convert the current input method sequence.
|
||||||
|
Convert,
|
||||||
|
/// The Final Mode `Final` key used on some Asian keyboards, to enable the final mode for IMEs.
|
||||||
|
FinalMode,
|
||||||
|
/// Switch to the first character group. (ISO/IEC 9995)
|
||||||
|
GroupFirst,
|
||||||
|
/// Switch to the last character group. (ISO/IEC 9995)
|
||||||
|
GroupLast,
|
||||||
|
/// Switch to the next character group. (ISO/IEC 9995)
|
||||||
|
GroupNext,
|
||||||
|
/// Switch to the previous character group. (ISO/IEC 9995)
|
||||||
|
GroupPrevious,
|
||||||
|
/// Toggle between or cycle through input modes of IMEs.
|
||||||
|
ModeChange,
|
||||||
|
NextCandidate,
|
||||||
|
/// Accept current input method sequence without
|
||||||
|
/// conversion in IMEs.
|
||||||
|
NonConvert,
|
||||||
|
PreviousCandidate,
|
||||||
|
Process,
|
||||||
|
SingleCandidate,
|
||||||
|
/// Toggle between Hangul and English modes.
|
||||||
|
HangulMode,
|
||||||
|
HanjaMode,
|
||||||
|
JunjaMode,
|
||||||
|
/// The Eisu key. This key may close the IME, but its purpose is defined by the current IME.
|
||||||
|
/// (`KEYCODE_EISU`)
|
||||||
|
Eisu,
|
||||||
|
/// The (Half-Width) Characters key.
|
||||||
|
Hankaku,
|
||||||
|
/// The Hiragana (Japanese Kana characters) key.
|
||||||
|
Hiragana,
|
||||||
|
/// The Hiragana/Katakana toggle key. (`KEYCODE_KATAKANA_HIRAGANA`)
|
||||||
|
HiraganaKatakana,
|
||||||
|
/// The Kana Mode (Kana Lock) key. This key is used to enter hiragana mode (typically from
|
||||||
|
/// romaji mode).
|
||||||
|
KanaMode,
|
||||||
|
/// The Kanji (Japanese name for ideographic characters of Chinese origin) Mode key. This key is
|
||||||
|
/// typically used to switch to a hiragana keyboard for the purpose of converting input into
|
||||||
|
/// kanji. (`KEYCODE_KANA`)
|
||||||
|
KanjiMode,
|
||||||
|
/// The Katakana (Japanese Kana characters) key.
|
||||||
|
Katakana,
|
||||||
|
/// The Roman characters function key.
|
||||||
|
Romaji,
|
||||||
|
/// The Zenkaku (Full-Width) Characters key.
|
||||||
|
Zenkaku,
|
||||||
|
/// The Zenkaku/Hankaku (full-width/half-width) toggle key. (`KEYCODE_ZENKAKU_HANKAKU`)
|
||||||
|
ZenkakuHankaku,
|
||||||
|
/// General purpose virtual function key, as index 1.
|
||||||
|
Soft1,
|
||||||
|
/// General purpose virtual function key, as index 2.
|
||||||
|
Soft2,
|
||||||
|
/// General purpose virtual function key, as index 3.
|
||||||
|
Soft3,
|
||||||
|
/// General purpose virtual function key, as index 4.
|
||||||
|
Soft4,
|
||||||
|
/// Select next (numerically or logically) lower channel. (`APPCOMMAND_MEDIA_CHANNEL_DOWN`,
|
||||||
|
/// `KEYCODE_CHANNEL_DOWN`)
|
||||||
|
ChannelDown,
|
||||||
|
/// Select next (numerically or logically) higher channel. (`APPCOMMAND_MEDIA_CHANNEL_UP`,
|
||||||
|
/// `KEYCODE_CHANNEL_UP`)
|
||||||
|
ChannelUp,
|
||||||
|
/// Close the current document or message (Note: This doesn’t close the application).
|
||||||
|
/// (`APPCOMMAND_CLOSE`)
|
||||||
|
Close,
|
||||||
|
/// Open an editor to forward the current message. (`APPCOMMAND_FORWARD_MAIL`)
|
||||||
|
MailForward,
|
||||||
|
/// Open an editor to reply to the current message. (`APPCOMMAND_REPLY_TO_MAIL`)
|
||||||
|
MailReply,
|
||||||
|
/// Send the current message. (`APPCOMMAND_SEND_MAIL`)
|
||||||
|
MailSend,
|
||||||
|
/// Close the current media, for example to close a CD or DVD tray. (`KEYCODE_MEDIA_CLOSE`)
|
||||||
|
MediaClose,
|
||||||
|
/// Initiate or continue forward playback at faster than normal speed, or increase speed if
|
||||||
|
/// already fast forwarding. (`APPCOMMAND_MEDIA_FAST_FORWARD`, `KEYCODE_MEDIA_FAST_FORWARD`)
|
||||||
|
MediaFastForward,
|
||||||
|
/// Pause the currently playing media. (`APPCOMMAND_MEDIA_PAUSE`, `KEYCODE_MEDIA_PAUSE`)
|
||||||
|
///
|
||||||
|
/// Note: Media controller devices should use this value rather than `"Pause"` for their pause
|
||||||
|
/// keys.
|
||||||
|
MediaPause,
|
||||||
|
/// Initiate or continue media playback at normal speed, if not currently playing at normal
|
||||||
|
/// speed. (`APPCOMMAND_MEDIA_PLAY`, `KEYCODE_MEDIA_PLAY`)
|
||||||
|
MediaPlay,
|
||||||
|
/// Toggle media between play and pause states. (`APPCOMMAND_MEDIA_PLAY_PAUSE`,
|
||||||
|
/// `KEYCODE_MEDIA_PLAY_PAUSE`)
|
||||||
|
MediaPlayPause,
|
||||||
|
/// Initiate or resume recording of currently selected media. (`APPCOMMAND_MEDIA_RECORD`,
|
||||||
|
/// `KEYCODE_MEDIA_RECORD`)
|
||||||
|
MediaRecord,
|
||||||
|
/// Initiate or continue reverse playback at faster than normal speed, or increase speed if
|
||||||
|
/// already rewinding. (`APPCOMMAND_MEDIA_REWIND`, `KEYCODE_MEDIA_REWIND`)
|
||||||
|
MediaRewind,
|
||||||
|
/// Stop media playing, pausing, forwarding, rewinding, or recording, if not already stopped.
|
||||||
|
/// (`APPCOMMAND_MEDIA_STOP`, `KEYCODE_MEDIA_STOP`)
|
||||||
|
MediaStop,
|
||||||
|
/// Seek to next media or program track. (`APPCOMMAND_MEDIA_NEXTTRACK`, `KEYCODE_MEDIA_NEXT`)
|
||||||
|
MediaTrackNext,
|
||||||
|
/// Seek to previous media or program track. (`APPCOMMAND_MEDIA_PREVIOUSTRACK`,
|
||||||
|
/// `KEYCODE_MEDIA_PREVIOUS`)
|
||||||
|
MediaTrackPrevious,
|
||||||
|
/// Open a new document or message. (`APPCOMMAND_NEW`)
|
||||||
|
New,
|
||||||
|
/// Open an existing document or message. (`APPCOMMAND_OPEN`)
|
||||||
|
Open,
|
||||||
|
/// Print the current document or message. (`APPCOMMAND_PRINT`)
|
||||||
|
Print,
|
||||||
|
/// Save the current document or message. (`APPCOMMAND_SAVE`)
|
||||||
|
Save,
|
||||||
|
/// Spellcheck the current document or selection. (`APPCOMMAND_SPELL_CHECK`)
|
||||||
|
SpellCheck,
|
||||||
|
/// The `11` key found on media numpads that
|
||||||
|
/// have buttons from `1` ... `12`.
|
||||||
|
Key11,
|
||||||
|
/// The `12` key found on media numpads that
|
||||||
|
/// have buttons from `1` ... `12`.
|
||||||
|
Key12,
|
||||||
|
/// Adjust audio balance leftward. (`VK_AUDIO_BALANCE_LEFT`)
|
||||||
|
AudioBalanceLeft,
|
||||||
|
/// Adjust audio balance rightward. (`VK_AUDIO_BALANCE_RIGHT`)
|
||||||
|
AudioBalanceRight,
|
||||||
|
/// Decrease audio bass boost or cycle down through bass boost states. (`APPCOMMAND_BASS_DOWN`,
|
||||||
|
/// `VK_BASS_BOOST_DOWN`)
|
||||||
|
AudioBassBoostDown,
|
||||||
|
/// Toggle bass boost on/off. (`APPCOMMAND_BASS_BOOST`)
|
||||||
|
AudioBassBoostToggle,
|
||||||
|
/// Increase audio bass boost or cycle up through bass boost states. (`APPCOMMAND_BASS_UP`,
|
||||||
|
/// `VK_BASS_BOOST_UP`)
|
||||||
|
AudioBassBoostUp,
|
||||||
|
/// Adjust audio fader towards front. (`VK_FADER_FRONT`)
|
||||||
|
AudioFaderFront,
|
||||||
|
/// Adjust audio fader towards rear. (`VK_FADER_REAR`)
|
||||||
|
AudioFaderRear,
|
||||||
|
/// Advance surround audio mode to next available mode. (`VK_SURROUND_MODE_NEXT`)
|
||||||
|
AudioSurroundModeNext,
|
||||||
|
/// Decrease treble. (`APPCOMMAND_TREBLE_DOWN`)
|
||||||
|
AudioTrebleDown,
|
||||||
|
/// Increase treble. (`APPCOMMAND_TREBLE_UP`)
|
||||||
|
AudioTrebleUp,
|
||||||
|
/// Decrease audio volume. (`APPCOMMAND_VOLUME_DOWN`, `KEYCODE_VOLUME_DOWN`)
|
||||||
|
AudioVolumeDown,
|
||||||
|
/// Increase audio volume. (`APPCOMMAND_VOLUME_UP`, `KEYCODE_VOLUME_UP`)
|
||||||
|
AudioVolumeUp,
|
||||||
|
/// Toggle between muted state and prior volume level. (`APPCOMMAND_VOLUME_MUTE`,
|
||||||
|
/// `KEYCODE_VOLUME_MUTE`)
|
||||||
|
AudioVolumeMute,
|
||||||
|
/// Toggle the microphone on/off. (`APPCOMMAND_MIC_ON_OFF_TOGGLE`)
|
||||||
|
MicrophoneToggle,
|
||||||
|
/// Decrease microphone volume. (`APPCOMMAND_MICROPHONE_VOLUME_DOWN`)
|
||||||
|
MicrophoneVolumeDown,
|
||||||
|
/// Increase microphone volume. (`APPCOMMAND_MICROPHONE_VOLUME_UP`)
|
||||||
|
MicrophoneVolumeUp,
|
||||||
|
/// Mute the microphone. (`APPCOMMAND_MICROPHONE_VOLUME_MUTE`, `KEYCODE_MUTE`)
|
||||||
|
MicrophoneVolumeMute,
|
||||||
|
/// Show correction list when a word is incorrectly identified. (`APPCOMMAND_CORRECTION_LIST`)
|
||||||
|
SpeechCorrectionList,
|
||||||
|
/// Toggle between dictation mode and command/control mode.
|
||||||
|
/// (`APPCOMMAND_DICTATE_OR_COMMAND_CONTROL_TOGGLE`)
|
||||||
|
SpeechInputToggle,
|
||||||
|
/// The first generic "LaunchApplication" key. This is commonly associated with launching "My
|
||||||
|
/// Computer", and may have a computer symbol on the key. (`APPCOMMAND_LAUNCH_APP1`)
|
||||||
|
LaunchApplication1,
|
||||||
|
/// The second generic "LaunchApplication" key. This is commonly associated with launching
|
||||||
|
/// "Calculator", and may have a calculator symbol on the key. (`APPCOMMAND_LAUNCH_APP2`,
|
||||||
|
/// `KEYCODE_CALCULATOR`)
|
||||||
|
LaunchApplication2,
|
||||||
|
/// The "Calendar" key. (`KEYCODE_CALENDAR`)
|
||||||
|
LaunchCalendar,
|
||||||
|
/// The "Contacts" key. (`KEYCODE_CONTACTS`)
|
||||||
|
LaunchContacts,
|
||||||
|
/// The "Mail" key. (`APPCOMMAND_LAUNCH_MAIL`)
|
||||||
|
LaunchMail,
|
||||||
|
/// The "Media Player" key. (`APPCOMMAND_LAUNCH_MEDIA_SELECT`)
|
||||||
|
LaunchMediaPlayer,
|
||||||
|
LaunchMusicPlayer,
|
||||||
|
LaunchPhone,
|
||||||
|
LaunchScreenSaver,
|
||||||
|
LaunchSpreadsheet,
|
||||||
|
LaunchWebBrowser,
|
||||||
|
LaunchWebCam,
|
||||||
|
LaunchWordProcessor,
|
||||||
|
/// Navigate to previous content or page in current history. (`APPCOMMAND_BROWSER_BACKWARD`)
|
||||||
|
BrowserBack,
|
||||||
|
/// Open the list of browser favorites. (`APPCOMMAND_BROWSER_FAVORITES`)
|
||||||
|
BrowserFavorites,
|
||||||
|
/// Navigate to next content or page in current history. (`APPCOMMAND_BROWSER_FORWARD`)
|
||||||
|
BrowserForward,
|
||||||
|
/// Go to the user’s preferred home page. (`APPCOMMAND_BROWSER_HOME`)
|
||||||
|
BrowserHome,
|
||||||
|
/// Refresh the current page or content. (`APPCOMMAND_BROWSER_REFRESH`)
|
||||||
|
BrowserRefresh,
|
||||||
|
/// Call up the user’s preferred search page. (`APPCOMMAND_BROWSER_SEARCH`)
|
||||||
|
BrowserSearch,
|
||||||
|
/// Stop loading the current page or content. (`APPCOMMAND_BROWSER_STOP`)
|
||||||
|
BrowserStop,
|
||||||
|
/// The Application switch key, which provides a list of recent apps to switch between.
|
||||||
|
/// (`KEYCODE_APP_SWITCH`)
|
||||||
|
AppSwitch,
|
||||||
|
/// The Call key. (`KEYCODE_CALL`)
|
||||||
|
Call,
|
||||||
|
/// The Camera key. (`KEYCODE_CAMERA`)
|
||||||
|
Camera,
|
||||||
|
/// The Camera focus key. (`KEYCODE_FOCUS`)
|
||||||
|
CameraFocus,
|
||||||
|
/// The End Call key. (`KEYCODE_ENDCALL`)
|
||||||
|
EndCall,
|
||||||
|
/// The Back key. (`KEYCODE_BACK`)
|
||||||
|
GoBack,
|
||||||
|
/// The Home key, which goes to the phone’s main screen. (`KEYCODE_HOME`)
|
||||||
|
GoHome,
|
||||||
|
/// The Headset Hook key. (`KEYCODE_HEADSETHOOK`)
|
||||||
|
HeadsetHook,
|
||||||
|
LastNumberRedial,
|
||||||
|
/// The Notification key. (`KEYCODE_NOTIFICATION`)
|
||||||
|
Notification,
|
||||||
|
/// Toggle between manner mode state: silent, vibrate, ring, ... (`KEYCODE_MANNER_MODE`)
|
||||||
|
MannerMode,
|
||||||
|
VoiceDial,
|
||||||
|
/// Switch to viewing TV. (`KEYCODE_TV`)
|
||||||
|
TV,
|
||||||
|
/// TV 3D Mode. (`KEYCODE_3D_MODE`)
|
||||||
|
TV3DMode,
|
||||||
|
/// Toggle between antenna and cable input. (`KEYCODE_TV_ANTENNA_CABLE`)
|
||||||
|
TVAntennaCable,
|
||||||
|
/// Audio description. (`KEYCODE_TV_AUDIO_DESCRIPTION`)
|
||||||
|
TVAudioDescription,
|
||||||
|
/// Audio description mixing volume down. (`KEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN`)
|
||||||
|
TVAudioDescriptionMixDown,
|
||||||
|
/// Audio description mixing volume up. (`KEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP`)
|
||||||
|
TVAudioDescriptionMixUp,
|
||||||
|
/// Contents menu. (`KEYCODE_TV_CONTENTS_MENU`)
|
||||||
|
TVContentsMenu,
|
||||||
|
/// Contents menu. (`KEYCODE_TV_DATA_SERVICE`)
|
||||||
|
TVDataService,
|
||||||
|
/// Switch the input mode on an external TV. (`KEYCODE_TV_INPUT`)
|
||||||
|
TVInput,
|
||||||
|
/// Switch to component input #1. (`KEYCODE_TV_INPUT_COMPONENT_1`)
|
||||||
|
TVInputComponent1,
|
||||||
|
/// Switch to component input #2. (`KEYCODE_TV_INPUT_COMPONENT_2`)
|
||||||
|
TVInputComponent2,
|
||||||
|
/// Switch to composite input #1. (`KEYCODE_TV_INPUT_COMPOSITE_1`)
|
||||||
|
TVInputComposite1,
|
||||||
|
/// Switch to composite input #2. (`KEYCODE_TV_INPUT_COMPOSITE_2`)
|
||||||
|
TVInputComposite2,
|
||||||
|
/// Switch to HDMI input #1. (`KEYCODE_TV_INPUT_HDMI_1`)
|
||||||
|
TVInputHDMI1,
|
||||||
|
/// Switch to HDMI input #2. (`KEYCODE_TV_INPUT_HDMI_2`)
|
||||||
|
TVInputHDMI2,
|
||||||
|
/// Switch to HDMI input #3. (`KEYCODE_TV_INPUT_HDMI_3`)
|
||||||
|
TVInputHDMI3,
|
||||||
|
/// Switch to HDMI input #4. (`KEYCODE_TV_INPUT_HDMI_4`)
|
||||||
|
TVInputHDMI4,
|
||||||
|
/// Switch to VGA input #1. (`KEYCODE_TV_INPUT_VGA_1`)
|
||||||
|
TVInputVGA1,
|
||||||
|
/// Media context menu. (`KEYCODE_TV_MEDIA_CONTEXT_MENU`)
|
||||||
|
TVMediaContext,
|
||||||
|
/// Toggle network. (`KEYCODE_TV_NETWORK`)
|
||||||
|
TVNetwork,
|
||||||
|
/// Number entry. (`KEYCODE_TV_NUMBER_ENTRY`)
|
||||||
|
TVNumberEntry,
|
||||||
|
/// Toggle the power on an external TV. (`KEYCODE_TV_POWER`)
|
||||||
|
TVPower,
|
||||||
|
/// Radio. (`KEYCODE_TV_RADIO_SERVICE`)
|
||||||
|
TVRadioService,
|
||||||
|
/// Satellite. (`KEYCODE_TV_SATELLITE`)
|
||||||
|
TVSatellite,
|
||||||
|
/// Broadcast Satellite. (`KEYCODE_TV_SATELLITE_BS`)
|
||||||
|
TVSatelliteBS,
|
||||||
|
/// Communication Satellite. (`KEYCODE_TV_SATELLITE_CS`)
|
||||||
|
TVSatelliteCS,
|
||||||
|
/// Toggle between available satellites. (`KEYCODE_TV_SATELLITE_SERVICE`)
|
||||||
|
TVSatelliteToggle,
|
||||||
|
/// Analog Terrestrial. (`KEYCODE_TV_TERRESTRIAL_ANALOG`)
|
||||||
|
TVTerrestrialAnalog,
|
||||||
|
/// Digital Terrestrial. (`KEYCODE_TV_TERRESTRIAL_DIGITAL`)
|
||||||
|
TVTerrestrialDigital,
|
||||||
|
/// Timer programming. (`KEYCODE_TV_TIMER_PROGRAMMING`)
|
||||||
|
TVTimer,
|
||||||
|
/// Switch the input mode on an external AVR (audio/video receiver). (`KEYCODE_AVR_INPUT`)
|
||||||
|
AVRInput,
|
||||||
|
/// Toggle the power on an external AVR (audio/video receiver). (`KEYCODE_AVR_POWER`)
|
||||||
|
AVRPower,
|
||||||
|
/// General purpose color-coded media function key, as index 0 (red). (`VK_COLORED_KEY_0`,
|
||||||
|
/// `KEYCODE_PROG_RED`)
|
||||||
|
ColorF0Red,
|
||||||
|
/// General purpose color-coded media function key, as index 1 (green). (`VK_COLORED_KEY_1`,
|
||||||
|
/// `KEYCODE_PROG_GREEN`)
|
||||||
|
ColorF1Green,
|
||||||
|
/// General purpose color-coded media function key, as index 2 (yellow). (`VK_COLORED_KEY_2`,
|
||||||
|
/// `KEYCODE_PROG_YELLOW`)
|
||||||
|
ColorF2Yellow,
|
||||||
|
/// General purpose color-coded media function key, as index 3 (blue). (`VK_COLORED_KEY_3`,
|
||||||
|
/// `KEYCODE_PROG_BLUE`)
|
||||||
|
ColorF3Blue,
|
||||||
|
/// General purpose color-coded media function key, as index 4 (grey). (`VK_COLORED_KEY_4`)
|
||||||
|
ColorF4Grey,
|
||||||
|
/// General purpose color-coded media function key, as index 5 (brown). (`VK_COLORED_KEY_5`)
|
||||||
|
ColorF5Brown,
|
||||||
|
/// Toggle the display of Closed Captions. (`VK_CC`, `KEYCODE_CAPTIONS`)
|
||||||
|
ClosedCaptionToggle,
|
||||||
|
/// Adjust brightness of device, by toggling between or cycling through states. (`VK_DIMMER`)
|
||||||
|
Dimmer,
|
||||||
|
/// Swap video sources. (`VK_DISPLAY_SWAP`)
|
||||||
|
DisplaySwap,
|
||||||
|
/// Select Digital Video Rrecorder. (`KEYCODE_DVR`)
|
||||||
|
DVR,
|
||||||
|
/// Exit the current application. (`VK_EXIT`)
|
||||||
|
Exit,
|
||||||
|
/// Clear program or content stored as favorite 0. (`VK_CLEAR_FAVORITE_0`)
|
||||||
|
FavoriteClear0,
|
||||||
|
/// Clear program or content stored as favorite 1. (`VK_CLEAR_FAVORITE_1`)
|
||||||
|
FavoriteClear1,
|
||||||
|
/// Clear program or content stored as favorite 2. (`VK_CLEAR_FAVORITE_2`)
|
||||||
|
FavoriteClear2,
|
||||||
|
/// Clear program or content stored as favorite 3. (`VK_CLEAR_FAVORITE_3`)
|
||||||
|
FavoriteClear3,
|
||||||
|
/// Select (recall) program or content stored as favorite 0. (`VK_RECALL_FAVORITE_0`)
|
||||||
|
FavoriteRecall0,
|
||||||
|
/// Select (recall) program or content stored as favorite 1. (`VK_RECALL_FAVORITE_1`)
|
||||||
|
FavoriteRecall1,
|
||||||
|
/// Select (recall) program or content stored as favorite 2. (`VK_RECALL_FAVORITE_2`)
|
||||||
|
FavoriteRecall2,
|
||||||
|
/// Select (recall) program or content stored as favorite 3. (`VK_RECALL_FAVORITE_3`)
|
||||||
|
FavoriteRecall3,
|
||||||
|
/// Store current program or content as favorite 0. (`VK_STORE_FAVORITE_0`)
|
||||||
|
FavoriteStore0,
|
||||||
|
/// Store current program or content as favorite 1. (`VK_STORE_FAVORITE_1`)
|
||||||
|
FavoriteStore1,
|
||||||
|
/// Store current program or content as favorite 2. (`VK_STORE_FAVORITE_2`)
|
||||||
|
FavoriteStore2,
|
||||||
|
/// Store current program or content as favorite 3. (`VK_STORE_FAVORITE_3`)
|
||||||
|
FavoriteStore3,
|
||||||
|
/// Toggle display of program or content guide. (`VK_GUIDE`, `KEYCODE_GUIDE`)
|
||||||
|
Guide,
|
||||||
|
/// If guide is active and displayed, then display next day’s content. (`VK_NEXT_DAY`)
|
||||||
|
GuideNextDay,
|
||||||
|
/// If guide is active and displayed, then display previous day’s content. (`VK_PREV_DAY`)
|
||||||
|
GuidePreviousDay,
|
||||||
|
/// Toggle display of information about currently selected context or media. (`VK_INFO`,
|
||||||
|
/// `KEYCODE_INFO`)
|
||||||
|
Info,
|
||||||
|
/// Toggle instant replay. (`VK_INSTANT_REPLAY`)
|
||||||
|
InstantReplay,
|
||||||
|
/// Launch linked content, if available and appropriate. (`VK_LINK`)
|
||||||
|
Link,
|
||||||
|
/// List the current program. (`VK_LIST`)
|
||||||
|
ListProgram,
|
||||||
|
/// Toggle display listing of currently available live content or programs. (`VK_LIVE`)
|
||||||
|
LiveContent,
|
||||||
|
/// Lock or unlock current content or program. (`VK_LOCK`)
|
||||||
|
Lock,
|
||||||
|
/// Show a list of media applications: audio/video players and image viewers. (`VK_APPS`)
|
||||||
|
///
|
||||||
|
/// Note: Do not confuse this key value with the Windows' `VK_APPS` / `VK_CONTEXT_MENU` key,
|
||||||
|
/// which is encoded as `"ContextMenu"`.
|
||||||
|
MediaApps,
|
||||||
|
/// Audio track key. (`KEYCODE_MEDIA_AUDIO_TRACK`)
|
||||||
|
MediaAudioTrack,
|
||||||
|
/// Select previously selected channel or media. (`VK_LAST`, `KEYCODE_LAST_CHANNEL`)
|
||||||
|
MediaLast,
|
||||||
|
/// Skip backward to next content or program. (`KEYCODE_MEDIA_SKIP_BACKWARD`)
|
||||||
|
MediaSkipBackward,
|
||||||
|
/// Skip forward to next content or program. (`VK_SKIP`, `KEYCODE_MEDIA_SKIP_FORWARD`)
|
||||||
|
MediaSkipForward,
|
||||||
|
/// Step backward to next content or program. (`KEYCODE_MEDIA_STEP_BACKWARD`)
|
||||||
|
MediaStepBackward,
|
||||||
|
/// Step forward to next content or program. (`KEYCODE_MEDIA_STEP_FORWARD`)
|
||||||
|
MediaStepForward,
|
||||||
|
/// Media top menu. (`KEYCODE_MEDIA_TOP_MENU`)
|
||||||
|
MediaTopMenu,
|
||||||
|
/// Navigate in. (`KEYCODE_NAVIGATE_IN`)
|
||||||
|
NavigateIn,
|
||||||
|
/// Navigate to next key. (`KEYCODE_NAVIGATE_NEXT`)
|
||||||
|
NavigateNext,
|
||||||
|
/// Navigate out. (`KEYCODE_NAVIGATE_OUT`)
|
||||||
|
NavigateOut,
|
||||||
|
/// Navigate to previous key. (`KEYCODE_NAVIGATE_PREVIOUS`)
|
||||||
|
NavigatePrevious,
|
||||||
|
/// Cycle to next favorite channel (in favorites list). (`VK_NEXT_FAVORITE_CHANNEL`)
|
||||||
|
NextFavoriteChannel,
|
||||||
|
/// Cycle to next user profile (if there are multiple user profiles). (`VK_USER`)
|
||||||
|
NextUserProfile,
|
||||||
|
/// Access on-demand content or programs. (`VK_ON_DEMAND`)
|
||||||
|
OnDemand,
|
||||||
|
/// Pairing key to pair devices. (`KEYCODE_PAIRING`)
|
||||||
|
Pairing,
|
||||||
|
/// Move picture-in-picture window down. (`VK_PINP_DOWN`)
|
||||||
|
PinPDown,
|
||||||
|
/// Move picture-in-picture window. (`VK_PINP_MOVE`)
|
||||||
|
PinPMove,
|
||||||
|
/// Toggle display of picture-in-picture window. (`VK_PINP_TOGGLE`)
|
||||||
|
PinPToggle,
|
||||||
|
/// Move picture-in-picture window up. (`VK_PINP_UP`)
|
||||||
|
PinPUp,
|
||||||
|
/// Decrease media playback speed. (`VK_PLAY_SPEED_DOWN`)
|
||||||
|
PlaySpeedDown,
|
||||||
|
/// Reset playback to normal speed. (`VK_PLAY_SPEED_RESET`)
|
||||||
|
PlaySpeedReset,
|
||||||
|
/// Increase media playback speed. (`VK_PLAY_SPEED_UP`)
|
||||||
|
PlaySpeedUp,
|
||||||
|
/// Toggle random media or content shuffle mode. (`VK_RANDOM_TOGGLE`)
|
||||||
|
RandomToggle,
|
||||||
|
/// Not a physical key, but this key code is sent when the remote control battery is low.
|
||||||
|
/// (`VK_RC_LOW_BATTERY`)
|
||||||
|
RcLowBattery,
|
||||||
|
/// Toggle or cycle between media recording speeds. (`VK_RECORD_SPEED_NEXT`)
|
||||||
|
RecordSpeedNext,
|
||||||
|
/// Toggle RF (radio frequency) input bypass mode (pass RF input directly to the RF output).
|
||||||
|
/// (`VK_RF_BYPASS`)
|
||||||
|
RfBypass,
|
||||||
|
/// Toggle scan channels mode. (`VK_SCAN_CHANNELS_TOGGLE`)
|
||||||
|
ScanChannelsToggle,
|
||||||
|
/// Advance display screen mode to next available mode. (`VK_SCREEN_MODE_NEXT`)
|
||||||
|
ScreenModeNext,
|
||||||
|
/// Toggle display of device settings screen. (`VK_SETTINGS`, `KEYCODE_SETTINGS`)
|
||||||
|
Settings,
|
||||||
|
/// Toggle split screen mode. (`VK_SPLIT_SCREEN_TOGGLE`)
|
||||||
|
SplitScreenToggle,
|
||||||
|
/// Switch the input mode on an external STB (set top box). (`KEYCODE_STB_INPUT`)
|
||||||
|
STBInput,
|
||||||
|
/// Toggle the power on an external STB (set top box). (`KEYCODE_STB_POWER`)
|
||||||
|
STBPower,
|
||||||
|
/// Toggle display of subtitles, if available. (`VK_SUBTITLE`)
|
||||||
|
Subtitle,
|
||||||
|
/// Toggle display of teletext, if available (`VK_TELETEXT`, `KEYCODE_TV_TELETEXT`).
|
||||||
|
Teletext,
|
||||||
|
/// Advance video mode to next available mode. (`VK_VIDEO_MODE_NEXT`)
|
||||||
|
VideoModeNext,
|
||||||
|
/// Cause device to identify itself in some manner, e.g., audibly or visibly. (`VK_WINK`)
|
||||||
|
Wink,
|
||||||
|
/// Toggle between full-screen and scaled content, or alter magnification level. (`VK_ZOOM`,
|
||||||
|
/// `KEYCODE_TV_ZOOM_MODE`)
|
||||||
|
ZoomToggle,
|
||||||
|
/// General-purpose function key.
|
||||||
|
/// Usually found at the top of the keyboard.
|
||||||
|
F1,
|
||||||
|
/// General-purpose function key.
|
||||||
|
/// Usually found at the top of the keyboard.
|
||||||
|
F2,
|
||||||
|
/// General-purpose function key.
|
||||||
|
/// Usually found at the top of the keyboard.
|
||||||
|
F3,
|
||||||
|
/// General-purpose function key.
|
||||||
|
/// Usually found at the top of the keyboard.
|
||||||
|
F4,
|
||||||
|
/// General-purpose function key.
|
||||||
|
/// Usually found at the top of the keyboard.
|
||||||
|
F5,
|
||||||
|
/// General-purpose function key.
|
||||||
|
/// Usually found at the top of the keyboard.
|
||||||
|
F6,
|
||||||
|
/// General-purpose function key.
|
||||||
|
/// Usually found at the top of the keyboard.
|
||||||
|
F7,
|
||||||
|
/// General-purpose function key.
|
||||||
|
/// Usually found at the top of the keyboard.
|
||||||
|
F8,
|
||||||
|
/// General-purpose function key.
|
||||||
|
/// Usually found at the top of the keyboard.
|
||||||
|
F9,
|
||||||
|
/// General-purpose function key.
|
||||||
|
/// Usually found at the top of the keyboard.
|
||||||
|
F10,
|
||||||
|
/// General-purpose function key.
|
||||||
|
/// Usually found at the top of the keyboard.
|
||||||
|
F11,
|
||||||
|
/// General-purpose function key.
|
||||||
|
/// Usually found at the top of the keyboard.
|
||||||
|
F12,
|
||||||
|
/// General-purpose function key.
|
||||||
|
/// Usually found at the top of the keyboard.
|
||||||
|
F13,
|
||||||
|
/// General-purpose function key.
|
||||||
|
/// Usually found at the top of the keyboard.
|
||||||
|
F14,
|
||||||
|
/// General-purpose function key.
|
||||||
|
/// Usually found at the top of the keyboard.
|
||||||
|
F15,
|
||||||
|
/// General-purpose function key.
|
||||||
|
/// Usually found at the top of the keyboard.
|
||||||
|
F16,
|
||||||
|
/// General-purpose function key.
|
||||||
|
/// Usually found at the top of the keyboard.
|
||||||
|
F17,
|
||||||
|
/// General-purpose function key.
|
||||||
|
/// Usually found at the top of the keyboard.
|
||||||
|
F18,
|
||||||
|
/// General-purpose function key.
|
||||||
|
/// Usually found at the top of the keyboard.
|
||||||
|
F19,
|
||||||
|
/// General-purpose function key.
|
||||||
|
/// Usually found at the top of the keyboard.
|
||||||
|
F20,
|
||||||
|
/// General-purpose function key.
|
||||||
|
/// Usually found at the top of the keyboard.
|
||||||
|
F21,
|
||||||
|
/// General-purpose function key.
|
||||||
|
/// Usually found at the top of the keyboard.
|
||||||
|
F22,
|
||||||
|
/// General-purpose function key.
|
||||||
|
/// Usually found at the top of the keyboard.
|
||||||
|
F23,
|
||||||
|
/// General-purpose function key.
|
||||||
|
/// Usually found at the top of the keyboard.
|
||||||
|
F24,
|
||||||
|
/// General-purpose function key.
|
||||||
|
F25,
|
||||||
|
/// General-purpose function key.
|
||||||
|
F26,
|
||||||
|
/// General-purpose function key.
|
||||||
|
F27,
|
||||||
|
/// General-purpose function key.
|
||||||
|
F28,
|
||||||
|
/// General-purpose function key.
|
||||||
|
F29,
|
||||||
|
/// General-purpose function key.
|
||||||
|
F30,
|
||||||
|
/// General-purpose function key.
|
||||||
|
F31,
|
||||||
|
/// General-purpose function key.
|
||||||
|
F32,
|
||||||
|
/// General-purpose function key.
|
||||||
|
F33,
|
||||||
|
/// General-purpose function key.
|
||||||
|
F34,
|
||||||
|
/// General-purpose function key.
|
||||||
|
F35,
|
||||||
|
}
|
||||||
|
|
@ -1,203 +0,0 @@
|
||||||
/// The symbolic name of a keyboard key.
|
|
||||||
///
|
|
||||||
/// This is mostly the `KeyCode` type found in [`winit`].
|
|
||||||
///
|
|
||||||
/// [`winit`]: https://docs.rs/winit/0.20.0-alpha3/winit/
|
|
||||||
#[derive(Debug, Hash, Ord, PartialOrd, PartialEq, Eq, Clone, Copy)]
|
|
||||||
#[repr(u32)]
|
|
||||||
#[allow(missing_docs)]
|
|
||||||
pub enum KeyCode {
|
|
||||||
/// The '1' key over the letters.
|
|
||||||
Key1,
|
|
||||||
/// The '2' key over the letters.
|
|
||||||
Key2,
|
|
||||||
/// The '3' key over the letters.
|
|
||||||
Key3,
|
|
||||||
/// The '4' key over the letters.
|
|
||||||
Key4,
|
|
||||||
/// The '5' key over the letters.
|
|
||||||
Key5,
|
|
||||||
/// The '6' key over the letters.
|
|
||||||
Key6,
|
|
||||||
/// The '7' key over the letters.
|
|
||||||
Key7,
|
|
||||||
/// The '8' key over the letters.
|
|
||||||
Key8,
|
|
||||||
/// The '9' key over the letters.
|
|
||||||
Key9,
|
|
||||||
/// The '0' key over the 'O' and 'P' keys.
|
|
||||||
Key0,
|
|
||||||
|
|
||||||
A,
|
|
||||||
B,
|
|
||||||
C,
|
|
||||||
D,
|
|
||||||
E,
|
|
||||||
F,
|
|
||||||
G,
|
|
||||||
H,
|
|
||||||
I,
|
|
||||||
J,
|
|
||||||
K,
|
|
||||||
L,
|
|
||||||
M,
|
|
||||||
N,
|
|
||||||
O,
|
|
||||||
P,
|
|
||||||
Q,
|
|
||||||
R,
|
|
||||||
S,
|
|
||||||
T,
|
|
||||||
U,
|
|
||||||
V,
|
|
||||||
W,
|
|
||||||
X,
|
|
||||||
Y,
|
|
||||||
Z,
|
|
||||||
|
|
||||||
/// The Escape key, next to F1.
|
|
||||||
Escape,
|
|
||||||
|
|
||||||
F1,
|
|
||||||
F2,
|
|
||||||
F3,
|
|
||||||
F4,
|
|
||||||
F5,
|
|
||||||
F6,
|
|
||||||
F7,
|
|
||||||
F8,
|
|
||||||
F9,
|
|
||||||
F10,
|
|
||||||
F11,
|
|
||||||
F12,
|
|
||||||
F13,
|
|
||||||
F14,
|
|
||||||
F15,
|
|
||||||
F16,
|
|
||||||
F17,
|
|
||||||
F18,
|
|
||||||
F19,
|
|
||||||
F20,
|
|
||||||
F21,
|
|
||||||
F22,
|
|
||||||
F23,
|
|
||||||
F24,
|
|
||||||
|
|
||||||
/// Print Screen/SysRq.
|
|
||||||
Snapshot,
|
|
||||||
/// Scroll Lock.
|
|
||||||
Scroll,
|
|
||||||
/// Pause/Break key, next to Scroll lock.
|
|
||||||
Pause,
|
|
||||||
|
|
||||||
/// `Insert`, next to Backspace.
|
|
||||||
Insert,
|
|
||||||
Home,
|
|
||||||
Delete,
|
|
||||||
End,
|
|
||||||
PageDown,
|
|
||||||
PageUp,
|
|
||||||
|
|
||||||
Left,
|
|
||||||
Up,
|
|
||||||
Right,
|
|
||||||
Down,
|
|
||||||
|
|
||||||
/// The Backspace key, right over Enter.
|
|
||||||
Backspace,
|
|
||||||
/// The Enter key.
|
|
||||||
Enter,
|
|
||||||
/// The space bar.
|
|
||||||
Space,
|
|
||||||
|
|
||||||
/// The "Compose" key on Linux.
|
|
||||||
Compose,
|
|
||||||
|
|
||||||
Caret,
|
|
||||||
|
|
||||||
Numlock,
|
|
||||||
Numpad0,
|
|
||||||
Numpad1,
|
|
||||||
Numpad2,
|
|
||||||
Numpad3,
|
|
||||||
Numpad4,
|
|
||||||
Numpad5,
|
|
||||||
Numpad6,
|
|
||||||
Numpad7,
|
|
||||||
Numpad8,
|
|
||||||
Numpad9,
|
|
||||||
NumpadAdd,
|
|
||||||
NumpadDivide,
|
|
||||||
NumpadDecimal,
|
|
||||||
NumpadComma,
|
|
||||||
NumpadEnter,
|
|
||||||
NumpadEquals,
|
|
||||||
NumpadMultiply,
|
|
||||||
NumpadSubtract,
|
|
||||||
|
|
||||||
AbntC1,
|
|
||||||
AbntC2,
|
|
||||||
Apostrophe,
|
|
||||||
Apps,
|
|
||||||
Asterisk,
|
|
||||||
At,
|
|
||||||
Ax,
|
|
||||||
Backslash,
|
|
||||||
Calculator,
|
|
||||||
Capital,
|
|
||||||
Colon,
|
|
||||||
Comma,
|
|
||||||
Convert,
|
|
||||||
Equals,
|
|
||||||
Grave,
|
|
||||||
Kana,
|
|
||||||
Kanji,
|
|
||||||
LAlt,
|
|
||||||
LBracket,
|
|
||||||
LControl,
|
|
||||||
LShift,
|
|
||||||
LWin,
|
|
||||||
Mail,
|
|
||||||
MediaSelect,
|
|
||||||
MediaStop,
|
|
||||||
Minus,
|
|
||||||
Mute,
|
|
||||||
MyComputer,
|
|
||||||
NavigateForward, // also called "Next"
|
|
||||||
NavigateBackward, // also called "Prior"
|
|
||||||
NextTrack,
|
|
||||||
NoConvert,
|
|
||||||
OEM102,
|
|
||||||
Period,
|
|
||||||
PlayPause,
|
|
||||||
Plus,
|
|
||||||
Power,
|
|
||||||
PrevTrack,
|
|
||||||
RAlt,
|
|
||||||
RBracket,
|
|
||||||
RControl,
|
|
||||||
RShift,
|
|
||||||
RWin,
|
|
||||||
Semicolon,
|
|
||||||
Slash,
|
|
||||||
Sleep,
|
|
||||||
Stop,
|
|
||||||
Sysrq,
|
|
||||||
Tab,
|
|
||||||
Underline,
|
|
||||||
Unlabeled,
|
|
||||||
VolumeDown,
|
|
||||||
VolumeUp,
|
|
||||||
Wake,
|
|
||||||
WebBack,
|
|
||||||
WebFavorites,
|
|
||||||
WebForward,
|
|
||||||
WebHome,
|
|
||||||
WebRefresh,
|
|
||||||
WebSearch,
|
|
||||||
WebStop,
|
|
||||||
Yen,
|
|
||||||
Copy,
|
|
||||||
Paste,
|
|
||||||
Cut,
|
|
||||||
}
|
|
||||||
12
core/src/keyboard/location.rs
Normal file
12
core/src/keyboard/location.rs
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
/// The location of a key on the keyboard.
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
pub enum Location {
|
||||||
|
/// The standard group of keys on the keyboard.
|
||||||
|
Standard,
|
||||||
|
/// The left side of the keyboard.
|
||||||
|
Left,
|
||||||
|
/// The right side of the keyboard.
|
||||||
|
Right,
|
||||||
|
/// The numpad of the keyboard.
|
||||||
|
Numpad,
|
||||||
|
}
|
||||||
|
|
@ -134,8 +134,8 @@ impl Application for Editor {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn subscription(&self) -> Subscription<Message> {
|
fn subscription(&self) -> Subscription<Message> {
|
||||||
keyboard::on_key_press(|key_code, modifiers| match key_code {
|
keyboard::on_key_press(|key, modifiers| match key.as_ref() {
|
||||||
keyboard::KeyCode::S if modifiers.command() => {
|
keyboard::Key::Character("s") if modifiers.command() => {
|
||||||
Some(Message::SaveFile)
|
Some(Message::SaveFile)
|
||||||
}
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
|
|
|
||||||
|
|
@ -278,7 +278,7 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
// Map window event to iced event
|
// Map window event to iced event
|
||||||
if let Some(event) = iced_winit::conversion::window_event(
|
if let Some(event) = iced_winit::conversion::window_event(
|
||||||
window::Id::MAIN,
|
window::Id::MAIN,
|
||||||
&event,
|
event,
|
||||||
window.scale_factor(),
|
window.scale_factor(),
|
||||||
modifiers,
|
modifiers,
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
|
|
@ -71,9 +71,13 @@ impl Application for Layout {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn subscription(&self) -> Subscription<Message> {
|
fn subscription(&self) -> Subscription<Message> {
|
||||||
keyboard::on_key_release(|key_code, _modifiers| match key_code {
|
use keyboard::key;
|
||||||
keyboard::KeyCode::Left => Some(Message::Previous),
|
|
||||||
keyboard::KeyCode::Right => Some(Message::Next),
|
keyboard::on_key_release(|key, _modifiers| match key {
|
||||||
|
keyboard::Key::Named(key::Named::ArrowLeft) => {
|
||||||
|
Some(Message::Previous)
|
||||||
|
}
|
||||||
|
keyboard::Key::Named(key::Named::ArrowRight) => Some(Message::Next),
|
||||||
_ => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
use iced::event::{self, Event};
|
use iced::event::{self, Event};
|
||||||
use iced::executor;
|
use iced::executor;
|
||||||
use iced::keyboard;
|
use iced::keyboard;
|
||||||
|
use iced::keyboard::key;
|
||||||
use iced::theme;
|
use iced::theme;
|
||||||
use iced::widget::{
|
use iced::widget::{
|
||||||
self, button, column, container, horizontal_space, pick_list, row, text,
|
self, button, column, container, horizontal_space, pick_list, row, text,
|
||||||
|
|
@ -85,7 +86,7 @@ impl Application for App {
|
||||||
}
|
}
|
||||||
Message::Event(event) => match event {
|
Message::Event(event) => match event {
|
||||||
Event::Keyboard(keyboard::Event::KeyPressed {
|
Event::Keyboard(keyboard::Event::KeyPressed {
|
||||||
key_code: keyboard::KeyCode::Tab,
|
key: keyboard::Key::Named(key::Named::Tab),
|
||||||
modifiers,
|
modifiers,
|
||||||
..
|
..
|
||||||
}) => {
|
}) => {
|
||||||
|
|
@ -96,7 +97,7 @@ impl Application for App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Event::Keyboard(keyboard::Event::KeyPressed {
|
Event::Keyboard(keyboard::Event::KeyPressed {
|
||||||
key_code: keyboard::KeyCode::Escape,
|
key: keyboard::Key::Named(key::Named::Escape),
|
||||||
..
|
..
|
||||||
}) => {
|
}) => {
|
||||||
self.hide_modal();
|
self.hide_modal();
|
||||||
|
|
|
||||||
|
|
@ -220,23 +220,26 @@ const PANE_ID_COLOR_FOCUSED: Color = Color::from_rgb(
|
||||||
0x47 as f32 / 255.0,
|
0x47 as f32 / 255.0,
|
||||||
);
|
);
|
||||||
|
|
||||||
fn handle_hotkey(key_code: keyboard::KeyCode) -> Option<Message> {
|
fn handle_hotkey(key: keyboard::Key) -> Option<Message> {
|
||||||
use keyboard::KeyCode;
|
use keyboard::key::{self, Key};
|
||||||
use pane_grid::{Axis, Direction};
|
use pane_grid::{Axis, Direction};
|
||||||
|
|
||||||
let direction = match key_code {
|
match key.as_ref() {
|
||||||
KeyCode::Up => Some(Direction::Up),
|
Key::Character("v") => Some(Message::SplitFocused(Axis::Vertical)),
|
||||||
KeyCode::Down => Some(Direction::Down),
|
Key::Character("h") => Some(Message::SplitFocused(Axis::Horizontal)),
|
||||||
KeyCode::Left => Some(Direction::Left),
|
Key::Character("w") => Some(Message::CloseFocused),
|
||||||
KeyCode::Right => Some(Direction::Right),
|
Key::Named(key) => {
|
||||||
|
let direction = match key {
|
||||||
|
key::Named::ArrowUp => Some(Direction::Up),
|
||||||
|
key::Named::ArrowDown => Some(Direction::Down),
|
||||||
|
key::Named::ArrowLeft => Some(Direction::Left),
|
||||||
|
key::Named::ArrowRight => Some(Direction::Right),
|
||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
match key_code {
|
direction.map(Message::FocusAdjacent)
|
||||||
KeyCode::V => Some(Message::SplitFocused(Axis::Vertical)),
|
}
|
||||||
KeyCode::H => Some(Message::SplitFocused(Axis::Horizontal)),
|
_ => None,
|
||||||
KeyCode::W => Some(Message::CloseFocused),
|
|
||||||
_ => direction.map(Message::FocusAdjacent),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
use iced::keyboard::KeyCode;
|
use iced::alignment;
|
||||||
use iced::theme::{Button, Container};
|
use iced::executor;
|
||||||
|
use iced::keyboard;
|
||||||
|
use iced::theme;
|
||||||
use iced::widget::{button, column, container, image, row, text, text_input};
|
use iced::widget::{button, column, container, image, row, text, text_input};
|
||||||
|
use iced::window;
|
||||||
use iced::window::screenshot::{self, Screenshot};
|
use iced::window::screenshot::{self, Screenshot};
|
||||||
use iced::{alignment, window};
|
|
||||||
use iced::{
|
use iced::{
|
||||||
event, executor, keyboard, Alignment, Application, Command, ContentFit,
|
Alignment, Application, Command, ContentFit, Element, Length, Rectangle,
|
||||||
Element, Event, Length, Rectangle, Renderer, Subscription, Theme,
|
Renderer, Subscription, Theme,
|
||||||
};
|
};
|
||||||
|
|
||||||
use ::image as img;
|
use ::image as img;
|
||||||
|
|
@ -147,7 +149,7 @@ impl Application for Example {
|
||||||
|
|
||||||
let image = container(image)
|
let image = container(image)
|
||||||
.padding(10)
|
.padding(10)
|
||||||
.style(Container::Box)
|
.style(theme::Container::Box)
|
||||||
.width(Length::FillPortion(2))
|
.width(Length::FillPortion(2))
|
||||||
.height(Length::Fill)
|
.height(Length::Fill)
|
||||||
.center_x()
|
.center_x()
|
||||||
|
|
@ -202,9 +204,10 @@ impl Application for Example {
|
||||||
self.screenshot.is_some().then(|| Message::Png),
|
self.screenshot.is_some().then(|| Message::Png),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
button(centered_text("Saving...")).style(Button::Secondary)
|
button(centered_text("Saving..."))
|
||||||
|
.style(theme::Button::Secondary)
|
||||||
}
|
}
|
||||||
.style(Button::Secondary)
|
.style(theme::Button::Secondary)
|
||||||
.padding([10, 20, 10, 20])
|
.padding([10, 20, 10, 20])
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
]
|
]
|
||||||
|
|
@ -213,7 +216,7 @@ impl Application for Example {
|
||||||
crop_controls,
|
crop_controls,
|
||||||
button(centered_text("Crop"))
|
button(centered_text("Crop"))
|
||||||
.on_press(Message::Crop)
|
.on_press(Message::Crop)
|
||||||
.style(Button::Destructive)
|
.style(theme::Button::Destructive)
|
||||||
.padding([10, 20, 10, 20])
|
.padding([10, 20, 10, 20])
|
||||||
.width(Length::Fill),
|
.width(Length::Fill),
|
||||||
]
|
]
|
||||||
|
|
@ -256,16 +259,10 @@ impl Application for Example {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn subscription(&self) -> Subscription<Self::Message> {
|
fn subscription(&self) -> Subscription<Self::Message> {
|
||||||
event::listen_with(|event, status| {
|
use keyboard::key;
|
||||||
if let event::Status::Captured = status {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Event::Keyboard(keyboard::Event::KeyPressed {
|
keyboard::on_key_press(|key, _modifiers| {
|
||||||
key_code: KeyCode::F5,
|
if let keyboard::Key::Named(key::Named::F5) = key {
|
||||||
..
|
|
||||||
}) = event
|
|
||||||
{
|
|
||||||
Some(Message::Screenshot)
|
Some(Message::Screenshot)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
|
||||||
|
|
@ -86,12 +86,16 @@ impl Application for Stopwatch {
|
||||||
};
|
};
|
||||||
|
|
||||||
fn handle_hotkey(
|
fn handle_hotkey(
|
||||||
key_code: keyboard::KeyCode,
|
key: keyboard::Key,
|
||||||
_modifiers: keyboard::Modifiers,
|
_modifiers: keyboard::Modifiers,
|
||||||
) -> Option<Message> {
|
) -> Option<Message> {
|
||||||
match key_code {
|
use keyboard::key;
|
||||||
keyboard::KeyCode::Space => Some(Message::Toggle),
|
|
||||||
keyboard::KeyCode::R => Some(Message::Reset),
|
match key.as_ref() {
|
||||||
|
keyboard::Key::Named(key::Named::Space) => {
|
||||||
|
Some(Message::Toggle)
|
||||||
|
}
|
||||||
|
keyboard::Key::Character("r") => Some(Message::Reset),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
use iced::event::{self, Event};
|
use iced::event::{self, Event};
|
||||||
use iced::executor;
|
use iced::executor;
|
||||||
use iced::keyboard;
|
use iced::keyboard;
|
||||||
|
use iced::keyboard::key;
|
||||||
use iced::widget::{
|
use iced::widget::{
|
||||||
self, button, column, container, pick_list, row, slider, text, text_input,
|
self, button, column, container, pick_list, row, slider, text, text_input,
|
||||||
};
|
};
|
||||||
|
|
@ -93,12 +94,12 @@ impl Application for App {
|
||||||
Command::none()
|
Command::none()
|
||||||
}
|
}
|
||||||
Message::Event(Event::Keyboard(keyboard::Event::KeyPressed {
|
Message::Event(Event::Keyboard(keyboard::Event::KeyPressed {
|
||||||
key_code: keyboard::KeyCode::Tab,
|
key: keyboard::Key::Named(key::Named::Tab),
|
||||||
modifiers,
|
modifiers,
|
||||||
..
|
..
|
||||||
})) if modifiers.shift() => widget::focus_previous(),
|
})) if modifiers.shift() => widget::focus_previous(),
|
||||||
Message::Event(Event::Keyboard(keyboard::Event::KeyPressed {
|
Message::Event(Event::Keyboard(keyboard::Event::KeyPressed {
|
||||||
key_code: keyboard::KeyCode::Tab,
|
key: keyboard::Key::Named(key::Named::Tab),
|
||||||
..
|
..
|
||||||
})) => widget::focus_next(),
|
})) => widget::focus_next(),
|
||||||
Message::Event(_) => Command::none(),
|
Message::Event(_) => Command::none(),
|
||||||
|
|
|
||||||
|
|
@ -260,15 +260,21 @@ impl Application for Todos {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn subscription(&self) -> Subscription<Message> {
|
fn subscription(&self) -> Subscription<Message> {
|
||||||
keyboard::on_key_press(|key_code, modifiers| {
|
use keyboard::key;
|
||||||
match (key_code, modifiers) {
|
|
||||||
(keyboard::KeyCode::Tab, _) => Some(Message::TabPressed {
|
keyboard::on_key_press(|key, modifiers| {
|
||||||
|
let keyboard::Key::Named(key) = key else {
|
||||||
|
return None;
|
||||||
|
};
|
||||||
|
|
||||||
|
match (key, modifiers) {
|
||||||
|
(key::Named::Tab, _) => Some(Message::TabPressed {
|
||||||
shift: modifiers.shift(),
|
shift: modifiers.shift(),
|
||||||
}),
|
}),
|
||||||
(keyboard::KeyCode::Up, keyboard::Modifiers::SHIFT) => {
|
(key::Named::ArrowUp, keyboard::Modifiers::SHIFT) => {
|
||||||
Some(Message::ToggleFullscreen(window::Mode::Fullscreen))
|
Some(Message::ToggleFullscreen(window::Mode::Fullscreen))
|
||||||
}
|
}
|
||||||
(keyboard::KeyCode::Down, keyboard::Modifiers::SHIFT) => {
|
(key::Named::ArrowDown, keyboard::Modifiers::SHIFT) => {
|
||||||
Some(Message::ToggleFullscreen(window::Mode::Windowed))
|
Some(Message::ToggleFullscreen(window::Mode::Windowed))
|
||||||
}
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
//! Listen to keyboard events.
|
//! Listen to keyboard events.
|
||||||
use crate::core;
|
use crate::core;
|
||||||
use crate::core::keyboard::{Event, KeyCode, Modifiers};
|
use crate::core::keyboard::{Event, Key, Modifiers};
|
||||||
use crate::subscription::{self, Subscription};
|
use crate::subscription::{self, Subscription};
|
||||||
use crate::MaybeSend;
|
use crate::MaybeSend;
|
||||||
|
|
||||||
|
|
@ -10,7 +10,7 @@ use crate::MaybeSend;
|
||||||
/// If the function returns `None`, the key press will be simply
|
/// If the function returns `None`, the key press will be simply
|
||||||
/// ignored.
|
/// ignored.
|
||||||
pub fn on_key_press<Message>(
|
pub fn on_key_press<Message>(
|
||||||
f: fn(KeyCode, Modifiers) -> Option<Message>,
|
f: fn(Key, Modifiers) -> Option<Message>,
|
||||||
) -> Subscription<Message>
|
) -> Subscription<Message>
|
||||||
where
|
where
|
||||||
Message: MaybeSend + 'static,
|
Message: MaybeSend + 'static,
|
||||||
|
|
@ -22,12 +22,10 @@ where
|
||||||
match (event, status) {
|
match (event, status) {
|
||||||
(
|
(
|
||||||
core::Event::Keyboard(Event::KeyPressed {
|
core::Event::Keyboard(Event::KeyPressed {
|
||||||
key_code,
|
key, modifiers, ..
|
||||||
modifiers,
|
|
||||||
..
|
|
||||||
}),
|
}),
|
||||||
core::event::Status::Ignored,
|
core::event::Status::Ignored,
|
||||||
) => f(key_code, modifiers),
|
) => f(key, modifiers),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -39,7 +37,7 @@ where
|
||||||
/// If the function returns `None`, the key release will be simply
|
/// If the function returns `None`, the key release will be simply
|
||||||
/// ignored.
|
/// ignored.
|
||||||
pub fn on_key_release<Message>(
|
pub fn on_key_release<Message>(
|
||||||
f: fn(KeyCode, Modifiers) -> Option<Message>,
|
f: fn(Key, Modifiers) -> Option<Message>,
|
||||||
) -> Subscription<Message>
|
) -> Subscription<Message>
|
||||||
where
|
where
|
||||||
Message: MaybeSend + 'static,
|
Message: MaybeSend + 'static,
|
||||||
|
|
@ -51,11 +49,12 @@ where
|
||||||
match (event, status) {
|
match (event, status) {
|
||||||
(
|
(
|
||||||
core::Event::Keyboard(Event::KeyReleased {
|
core::Event::Keyboard(Event::KeyReleased {
|
||||||
key_code,
|
key,
|
||||||
modifiers,
|
modifiers,
|
||||||
|
..
|
||||||
}),
|
}),
|
||||||
core::event::Status::Ignored,
|
core::event::Status::Ignored,
|
||||||
) => f(key_code, modifiers),
|
) => f(key, modifiers),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -230,7 +230,8 @@ pub mod event {
|
||||||
|
|
||||||
pub mod keyboard {
|
pub mod keyboard {
|
||||||
//! Listen and react to keyboard events.
|
//! Listen and react to keyboard events.
|
||||||
pub use crate::core::keyboard::{Event, KeyCode, Modifiers};
|
pub use crate::core::keyboard::key;
|
||||||
|
pub use crate::core::keyboard::{Event, Key, Location, Modifiers};
|
||||||
pub use iced_futures::keyboard::{on_key_press, on_key_release};
|
pub use iced_futures::keyboard::{on_key_press, on_key_release};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
//! Display a dropdown list of searchable and selectable options.
|
//! Display a dropdown list of searchable and selectable options.
|
||||||
use crate::core::event::{self, Event};
|
use crate::core::event::{self, Event};
|
||||||
use crate::core::keyboard;
|
use crate::core::keyboard;
|
||||||
|
use crate::core::keyboard::key;
|
||||||
use crate::core::layout::{self, Layout};
|
use crate::core::layout::{self, Layout};
|
||||||
use crate::core::mouse;
|
use crate::core::mouse;
|
||||||
use crate::core::overlay;
|
use crate::core::overlay;
|
||||||
|
|
@ -436,14 +437,14 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Event::Keyboard(keyboard::Event::KeyPressed {
|
if let Event::Keyboard(keyboard::Event::KeyPressed {
|
||||||
key_code,
|
key: keyboard::Key::Named(named_key),
|
||||||
modifiers,
|
modifiers,
|
||||||
..
|
..
|
||||||
}) = event
|
}) = event
|
||||||
{
|
{
|
||||||
let shift_modifer = modifiers.shift();
|
let shift_modifer = modifiers.shift();
|
||||||
match (key_code, shift_modifer) {
|
match (named_key, shift_modifer) {
|
||||||
(keyboard::KeyCode::Enter, _) => {
|
(key::Named::Enter, _) => {
|
||||||
if let Some(index) = &menu.hovered_option {
|
if let Some(index) = &menu.hovered_option {
|
||||||
if let Some(option) =
|
if let Some(option) =
|
||||||
state.filtered_options.options.get(*index)
|
state.filtered_options.options.get(*index)
|
||||||
|
|
@ -455,8 +456,7 @@ where
|
||||||
event_status = event::Status::Captured;
|
event_status = event::Status::Captured;
|
||||||
}
|
}
|
||||||
|
|
||||||
(keyboard::KeyCode::Up, _)
|
(key::Named::ArrowUp, _) | (key::Named::Tab, true) => {
|
||||||
| (keyboard::KeyCode::Tab, true) => {
|
|
||||||
if let Some(index) = &mut menu.hovered_option {
|
if let Some(index) = &mut menu.hovered_option {
|
||||||
if *index == 0 {
|
if *index == 0 {
|
||||||
*index = state
|
*index = state
|
||||||
|
|
@ -492,8 +492,8 @@ where
|
||||||
|
|
||||||
event_status = event::Status::Captured;
|
event_status = event::Status::Captured;
|
||||||
}
|
}
|
||||||
(keyboard::KeyCode::Down, _)
|
(key::Named::ArrowDown, _)
|
||||||
| (keyboard::KeyCode::Tab, false)
|
| (key::Named::Tab, false)
|
||||||
if !modifiers.shift() =>
|
if !modifiers.shift() =>
|
||||||
{
|
{
|
||||||
if let Some(index) = &mut menu.hovered_option {
|
if let Some(index) = &mut menu.hovered_option {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
//! Display a multi-line text input for text editing.
|
//! Display a multi-line text input for text editing.
|
||||||
use crate::core::event::{self, Event};
|
use crate::core::event::{self, Event};
|
||||||
use crate::core::keyboard;
|
use crate::core::keyboard;
|
||||||
|
use crate::core::keyboard::key;
|
||||||
use crate::core::layout::{self, Layout};
|
use crate::core::layout::{self, Layout};
|
||||||
use crate::core::mouse;
|
use crate::core::mouse;
|
||||||
use crate::core::renderer;
|
use crate::core::renderer;
|
||||||
|
|
@ -646,13 +647,16 @@ impl Update {
|
||||||
},
|
},
|
||||||
Event::Keyboard(event) => match event {
|
Event::Keyboard(event) => match event {
|
||||||
keyboard::Event::KeyPressed {
|
keyboard::Event::KeyPressed {
|
||||||
key_code,
|
key,
|
||||||
modifiers,
|
modifiers,
|
||||||
text,
|
text,
|
||||||
|
..
|
||||||
} if state.is_focused => {
|
} if state.is_focused => {
|
||||||
if let Some(motion) = motion(key_code) {
|
if let keyboard::Key::Named(named_key) = key.as_ref() {
|
||||||
let motion =
|
if let Some(motion) = motion(named_key) {
|
||||||
if platform::is_jump_modifier_pressed(modifiers) {
|
let motion = if platform::is_jump_modifier_pressed(
|
||||||
|
modifiers,
|
||||||
|
) {
|
||||||
motion.widen()
|
motion.widen()
|
||||||
} else {
|
} else {
|
||||||
motion
|
motion
|
||||||
|
|
@ -664,16 +668,27 @@ impl Update {
|
||||||
Action::Move(motion)
|
Action::Move(motion)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
match key_code {
|
match key.as_ref() {
|
||||||
keyboard::KeyCode::Enter => edit(Edit::Enter),
|
keyboard::Key::Named(key::Named::Enter) => {
|
||||||
keyboard::KeyCode::Backspace => edit(Edit::Backspace),
|
edit(Edit::Enter)
|
||||||
keyboard::KeyCode::Delete => edit(Edit::Delete),
|
}
|
||||||
keyboard::KeyCode::Escape => Some(Self::Unfocus),
|
keyboard::Key::Named(key::Named::Backspace) => {
|
||||||
keyboard::KeyCode::C if modifiers.command() => {
|
edit(Edit::Backspace)
|
||||||
|
}
|
||||||
|
keyboard::Key::Named(key::Named::Delete) => {
|
||||||
|
edit(Edit::Delete)
|
||||||
|
}
|
||||||
|
keyboard::Key::Named(key::Named::Escape) => {
|
||||||
|
Some(Self::Unfocus)
|
||||||
|
}
|
||||||
|
keyboard::Key::Character("c")
|
||||||
|
if modifiers.command() =>
|
||||||
|
{
|
||||||
Some(Self::Copy)
|
Some(Self::Copy)
|
||||||
}
|
}
|
||||||
keyboard::KeyCode::V
|
keyboard::Key::Character("v")
|
||||||
if modifiers.command() && !modifiers.alt() =>
|
if modifiers.command() && !modifiers.alt() =>
|
||||||
{
|
{
|
||||||
Some(Self::Paste)
|
Some(Self::Paste)
|
||||||
|
|
@ -694,16 +709,16 @@ impl Update {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn motion(key_code: keyboard::KeyCode) -> Option<Motion> {
|
fn motion(key: key::Named) -> Option<Motion> {
|
||||||
match key_code {
|
match key {
|
||||||
keyboard::KeyCode::Left => Some(Motion::Left),
|
key::Named::ArrowLeft => Some(Motion::Left),
|
||||||
keyboard::KeyCode::Right => Some(Motion::Right),
|
key::Named::ArrowRight => Some(Motion::Right),
|
||||||
keyboard::KeyCode::Up => Some(Motion::Up),
|
key::Named::ArrowUp => Some(Motion::Up),
|
||||||
keyboard::KeyCode::Down => Some(Motion::Down),
|
key::Named::ArrowDown => Some(Motion::Down),
|
||||||
keyboard::KeyCode::Home => Some(Motion::Home),
|
key::Named::Home => Some(Motion::Home),
|
||||||
keyboard::KeyCode::End => Some(Motion::End),
|
key::Named::End => Some(Motion::End),
|
||||||
keyboard::KeyCode::PageUp => Some(Motion::PageUp),
|
key::Named::PageUp => Some(Motion::PageUp),
|
||||||
keyboard::KeyCode::PageDown => Some(Motion::PageDown),
|
key::Named::PageDown => Some(Motion::PageDown),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ use editor::Editor;
|
||||||
use crate::core::alignment;
|
use crate::core::alignment;
|
||||||
use crate::core::event::{self, Event};
|
use crate::core::event::{self, Event};
|
||||||
use crate::core::keyboard;
|
use crate::core::keyboard;
|
||||||
|
use crate::core::keyboard::key;
|
||||||
use crate::core::layout;
|
use crate::core::layout;
|
||||||
use crate::core::mouse::{self, click};
|
use crate::core::mouse::{self, click};
|
||||||
use crate::core::renderer;
|
use crate::core::renderer;
|
||||||
|
|
@ -748,9 +749,7 @@ where
|
||||||
return event::Status::Captured;
|
return event::Status::Captured;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Event::Keyboard(keyboard::Event::KeyPressed {
|
Event::Keyboard(keyboard::Event::KeyPressed { key, text, .. }) => {
|
||||||
key_code, text, ..
|
|
||||||
}) => {
|
|
||||||
let state = state();
|
let state = state();
|
||||||
|
|
||||||
if let Some(focus) = &mut state.is_focused {
|
if let Some(focus) = &mut state.is_focused {
|
||||||
|
|
@ -761,14 +760,13 @@ where
|
||||||
let modifiers = state.keyboard_modifiers;
|
let modifiers = state.keyboard_modifiers;
|
||||||
focus.updated_at = Instant::now();
|
focus.updated_at = Instant::now();
|
||||||
|
|
||||||
match key_code {
|
match key.as_ref() {
|
||||||
keyboard::KeyCode::Enter
|
keyboard::Key::Named(key::Named::Enter) => {
|
||||||
| keyboard::KeyCode::NumpadEnter => {
|
|
||||||
if let Some(on_submit) = on_submit.clone() {
|
if let Some(on_submit) = on_submit.clone() {
|
||||||
shell.publish(on_submit);
|
shell.publish(on_submit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
keyboard::KeyCode::Backspace => {
|
keyboard::Key::Named(key::Named::Backspace) => {
|
||||||
if platform::is_jump_modifier_pressed(modifiers)
|
if platform::is_jump_modifier_pressed(modifiers)
|
||||||
&& state.cursor.selection(value).is_none()
|
&& state.cursor.selection(value).is_none()
|
||||||
{
|
{
|
||||||
|
|
@ -788,7 +786,7 @@ where
|
||||||
|
|
||||||
update_cache(state, value);
|
update_cache(state, value);
|
||||||
}
|
}
|
||||||
keyboard::KeyCode::Delete => {
|
keyboard::Key::Named(key::Named::Delete) => {
|
||||||
if platform::is_jump_modifier_pressed(modifiers)
|
if platform::is_jump_modifier_pressed(modifiers)
|
||||||
&& state.cursor.selection(value).is_none()
|
&& state.cursor.selection(value).is_none()
|
||||||
{
|
{
|
||||||
|
|
@ -810,7 +808,7 @@ where
|
||||||
|
|
||||||
update_cache(state, value);
|
update_cache(state, value);
|
||||||
}
|
}
|
||||||
keyboard::KeyCode::Left => {
|
keyboard::Key::Named(key::Named::ArrowLeft) => {
|
||||||
if platform::is_jump_modifier_pressed(modifiers)
|
if platform::is_jump_modifier_pressed(modifiers)
|
||||||
&& !is_secure
|
&& !is_secure
|
||||||
{
|
{
|
||||||
|
|
@ -825,7 +823,7 @@ where
|
||||||
state.cursor.move_left(value);
|
state.cursor.move_left(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
keyboard::KeyCode::Right => {
|
keyboard::Key::Named(key::Named::ArrowRight) => {
|
||||||
if platform::is_jump_modifier_pressed(modifiers)
|
if platform::is_jump_modifier_pressed(modifiers)
|
||||||
&& !is_secure
|
&& !is_secure
|
||||||
{
|
{
|
||||||
|
|
@ -840,7 +838,7 @@ where
|
||||||
state.cursor.move_right(value);
|
state.cursor.move_right(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
keyboard::KeyCode::Home => {
|
keyboard::Key::Named(key::Named::Home) => {
|
||||||
if modifiers.shift() {
|
if modifiers.shift() {
|
||||||
state
|
state
|
||||||
.cursor
|
.cursor
|
||||||
|
|
@ -849,7 +847,7 @@ where
|
||||||
state.cursor.move_to(0);
|
state.cursor.move_to(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
keyboard::KeyCode::End => {
|
keyboard::Key::Named(key::Named::End) => {
|
||||||
if modifiers.shift() {
|
if modifiers.shift() {
|
||||||
state.cursor.select_range(
|
state.cursor.select_range(
|
||||||
state.cursor.start(value),
|
state.cursor.start(value),
|
||||||
|
|
@ -859,7 +857,7 @@ where
|
||||||
state.cursor.move_to(value.len());
|
state.cursor.move_to(value.len());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
keyboard::KeyCode::C
|
keyboard::Key::Character("c")
|
||||||
if state.keyboard_modifiers.command() =>
|
if state.keyboard_modifiers.command() =>
|
||||||
{
|
{
|
||||||
if let Some((start, end)) =
|
if let Some((start, end)) =
|
||||||
|
|
@ -869,7 +867,7 @@ where
|
||||||
.write(value.select(start, end).to_string());
|
.write(value.select(start, end).to_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
keyboard::KeyCode::X
|
keyboard::Key::Character("x")
|
||||||
if state.keyboard_modifiers.command() =>
|
if state.keyboard_modifiers.command() =>
|
||||||
{
|
{
|
||||||
if let Some((start, end)) =
|
if let Some((start, end)) =
|
||||||
|
|
@ -887,7 +885,7 @@ where
|
||||||
|
|
||||||
update_cache(state, value);
|
update_cache(state, value);
|
||||||
}
|
}
|
||||||
keyboard::KeyCode::V => {
|
keyboard::Key::Character("v") => {
|
||||||
if state.keyboard_modifiers.command()
|
if state.keyboard_modifiers.command()
|
||||||
&& !state.keyboard_modifiers.alt()
|
&& !state.keyboard_modifiers.alt()
|
||||||
{
|
{
|
||||||
|
|
@ -924,12 +922,12 @@ where
|
||||||
state.is_pasting = None;
|
state.is_pasting = None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
keyboard::KeyCode::A
|
keyboard::Key::Character("a")
|
||||||
if state.keyboard_modifiers.command() =>
|
if state.keyboard_modifiers.command() =>
|
||||||
{
|
{
|
||||||
state.cursor.select_all(value);
|
state.cursor.select_all(value);
|
||||||
}
|
}
|
||||||
keyboard::KeyCode::Escape => {
|
keyboard::Key::Named(key::Named::Escape) => {
|
||||||
state.is_focused = None;
|
state.is_focused = None;
|
||||||
state.is_dragging = false;
|
state.is_dragging = false;
|
||||||
state.is_pasting = None;
|
state.is_pasting = None;
|
||||||
|
|
@ -937,9 +935,11 @@ where
|
||||||
state.keyboard_modifiers =
|
state.keyboard_modifiers =
|
||||||
keyboard::Modifiers::default();
|
keyboard::Modifiers::default();
|
||||||
}
|
}
|
||||||
keyboard::KeyCode::Tab
|
keyboard::Key::Named(
|
||||||
| keyboard::KeyCode::Up
|
key::Named::Tab
|
||||||
| keyboard::KeyCode::Down => {
|
| key::Named::ArrowUp
|
||||||
|
| key::Named::ArrowDown,
|
||||||
|
) => {
|
||||||
return event::Status::Ignored;
|
return event::Status::Ignored;
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
|
@ -971,17 +971,19 @@ where
|
||||||
return event::Status::Captured;
|
return event::Status::Captured;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Event::Keyboard(keyboard::Event::KeyReleased { key_code, .. }) => {
|
Event::Keyboard(keyboard::Event::KeyReleased { key, .. }) => {
|
||||||
let state = state();
|
let state = state();
|
||||||
|
|
||||||
if state.is_focused.is_some() {
|
if state.is_focused.is_some() {
|
||||||
match key_code {
|
match key.as_ref() {
|
||||||
keyboard::KeyCode::V => {
|
keyboard::Key::Character("v") => {
|
||||||
state.is_pasting = None;
|
state.is_pasting = None;
|
||||||
}
|
}
|
||||||
keyboard::KeyCode::Tab
|
keyboard::Key::Named(
|
||||||
| keyboard::KeyCode::Up
|
key::Named::Tab
|
||||||
| keyboard::KeyCode::Down => {
|
| key::Named::ArrowUp
|
||||||
|
| key::Named::ArrowDown,
|
||||||
|
) => {
|
||||||
return event::Status::Ignored;
|
return event::Status::Ignored;
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
|
|
|
||||||
|
|
@ -462,7 +462,7 @@ async fn run_instance<A, E, C>(
|
||||||
|
|
||||||
if let Some(event) = conversion::window_event(
|
if let Some(event) = conversion::window_event(
|
||||||
window::Id::MAIN,
|
window::Id::MAIN,
|
||||||
&window_event,
|
window_event,
|
||||||
state.scale_factor(),
|
state.scale_factor(),
|
||||||
state.modifiers(),
|
state.modifiers(),
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ pub fn window_settings(
|
||||||
/// Converts a winit window event into an iced event.
|
/// Converts a winit window event into an iced event.
|
||||||
pub fn window_event(
|
pub fn window_event(
|
||||||
id: window::Id,
|
id: window::Id,
|
||||||
event: &winit::event::WindowEvent,
|
event: winit::event::WindowEvent,
|
||||||
scale_factor: f64,
|
scale_factor: f64,
|
||||||
modifiers: winit::keyboard::ModifiersState,
|
modifiers: winit::keyboard::ModifiersState,
|
||||||
) -> Option<Event> {
|
) -> Option<Event> {
|
||||||
|
|
@ -163,7 +163,7 @@ pub fn window_event(
|
||||||
Some(Event::Mouse(mouse::Event::CursorLeft))
|
Some(Event::Mouse(mouse::Event::CursorLeft))
|
||||||
}
|
}
|
||||||
WindowEvent::MouseInput { button, state, .. } => {
|
WindowEvent::MouseInput { button, state, .. } => {
|
||||||
let button = mouse_button(*button);
|
let button = mouse_button(button);
|
||||||
|
|
||||||
Some(Event::Mouse(match state {
|
Some(Event::Mouse(match state {
|
||||||
winit::event::ElementState::Pressed => {
|
winit::event::ElementState::Pressed => {
|
||||||
|
|
@ -178,8 +178,8 @@ pub fn window_event(
|
||||||
winit::event::MouseScrollDelta::LineDelta(delta_x, delta_y) => {
|
winit::event::MouseScrollDelta::LineDelta(delta_x, delta_y) => {
|
||||||
Some(Event::Mouse(mouse::Event::WheelScrolled {
|
Some(Event::Mouse(mouse::Event::WheelScrolled {
|
||||||
delta: mouse::ScrollDelta::Lines {
|
delta: mouse::ScrollDelta::Lines {
|
||||||
x: *delta_x,
|
x: delta_x,
|
||||||
y: *delta_y,
|
y: delta_y,
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
@ -198,18 +198,33 @@ pub fn window_event(
|
||||||
logical_key,
|
logical_key,
|
||||||
state,
|
state,
|
||||||
text,
|
text,
|
||||||
|
location,
|
||||||
..
|
..
|
||||||
},
|
},
|
||||||
..
|
..
|
||||||
} => Some(Event::Keyboard({
|
} => Some(Event::Keyboard({
|
||||||
let key_code = key_code(logical_key);
|
let key = key(logical_key);
|
||||||
let modifiers = self::modifiers(modifiers);
|
let modifiers = self::modifiers(modifiers);
|
||||||
|
|
||||||
|
let location = match location {
|
||||||
|
winit::keyboard::KeyLocation::Standard => {
|
||||||
|
keyboard::Location::Standard
|
||||||
|
}
|
||||||
|
winit::keyboard::KeyLocation::Left => keyboard::Location::Left,
|
||||||
|
winit::keyboard::KeyLocation::Right => {
|
||||||
|
keyboard::Location::Right
|
||||||
|
}
|
||||||
|
winit::keyboard::KeyLocation::Numpad => {
|
||||||
|
keyboard::Location::Numpad
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
match state {
|
match state {
|
||||||
winit::event::ElementState::Pressed => {
|
winit::event::ElementState::Pressed => {
|
||||||
keyboard::Event::KeyPressed {
|
keyboard::Event::KeyPressed {
|
||||||
key_code,
|
key,
|
||||||
modifiers,
|
modifiers,
|
||||||
|
location,
|
||||||
text: text
|
text: text
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(winit::keyboard::SmolStr::to_string),
|
.map(winit::keyboard::SmolStr::to_string),
|
||||||
|
|
@ -217,8 +232,9 @@ pub fn window_event(
|
||||||
}
|
}
|
||||||
winit::event::ElementState::Released => {
|
winit::event::ElementState::Released => {
|
||||||
keyboard::Event::KeyReleased {
|
keyboard::Event::KeyReleased {
|
||||||
key_code,
|
key,
|
||||||
modifiers,
|
modifiers,
|
||||||
|
location,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -230,7 +246,7 @@ pub fn window_event(
|
||||||
}
|
}
|
||||||
WindowEvent::Focused(focused) => Some(Event::Window(
|
WindowEvent::Focused(focused) => Some(Event::Window(
|
||||||
id,
|
id,
|
||||||
if *focused {
|
if focused {
|
||||||
window::Event::Focused
|
window::Event::Focused
|
||||||
} else {
|
} else {
|
||||||
window::Event::Unfocused
|
window::Event::Unfocused
|
||||||
|
|
@ -246,7 +262,7 @@ pub fn window_event(
|
||||||
Some(Event::Window(id, window::Event::FilesHoveredLeft))
|
Some(Event::Window(id, window::Event::FilesHoveredLeft))
|
||||||
}
|
}
|
||||||
WindowEvent::Touch(touch) => {
|
WindowEvent::Touch(touch) => {
|
||||||
Some(Event::Touch(touch_event(*touch, scale_factor)))
|
Some(Event::Touch(touch_event(touch, scale_factor)))
|
||||||
}
|
}
|
||||||
WindowEvent::Moved(position) => {
|
WindowEvent::Moved(position) => {
|
||||||
let winit::dpi::LogicalPosition { x, y } =
|
let winit::dpi::LogicalPosition { x, y } =
|
||||||
|
|
@ -449,125 +465,328 @@ pub fn touch_event(
|
||||||
///
|
///
|
||||||
/// [`winit`]: https://github.com/rust-windowing/winit
|
/// [`winit`]: https://github.com/rust-windowing/winit
|
||||||
/// [`iced`]: https://github.com/iced-rs/iced/tree/0.10
|
/// [`iced`]: https://github.com/iced-rs/iced/tree/0.10
|
||||||
pub fn key_code(key: &winit::keyboard::Key) -> keyboard::KeyCode {
|
pub fn key(key: winit::keyboard::Key) -> keyboard::Key {
|
||||||
use keyboard::KeyCode;
|
use keyboard::key::Named;
|
||||||
use winit::keyboard::NamedKey;
|
use winit::keyboard::NamedKey;
|
||||||
|
|
||||||
match key {
|
match key {
|
||||||
winit::keyboard::Key::Character(c) => match c.as_str() {
|
winit::keyboard::Key::Character(c) => keyboard::Key::Character(c),
|
||||||
"1" => KeyCode::Key1,
|
winit::keyboard::Key::Named(named_key) => {
|
||||||
"2" => KeyCode::Key2,
|
keyboard::Key::Named(match named_key {
|
||||||
"3" => KeyCode::Key3,
|
NamedKey::Alt => Named::Alt,
|
||||||
"4" => KeyCode::Key4,
|
NamedKey::AltGraph => Named::AltGraph,
|
||||||
"5" => KeyCode::Key5,
|
NamedKey::CapsLock => Named::CapsLock,
|
||||||
"6" => KeyCode::Key6,
|
NamedKey::Control => Named::Control,
|
||||||
"7" => KeyCode::Key7,
|
NamedKey::Fn => Named::Fn,
|
||||||
"8" => KeyCode::Key8,
|
NamedKey::FnLock => Named::FnLock,
|
||||||
"9" => KeyCode::Key9,
|
NamedKey::NumLock => Named::NumLock,
|
||||||
"0" => KeyCode::Key0,
|
NamedKey::ScrollLock => Named::ScrollLock,
|
||||||
"a" => KeyCode::A,
|
NamedKey::Shift => Named::Shift,
|
||||||
"b" => KeyCode::B,
|
NamedKey::Symbol => Named::Symbol,
|
||||||
"c" => KeyCode::C,
|
NamedKey::SymbolLock => Named::SymbolLock,
|
||||||
"d" => KeyCode::D,
|
NamedKey::Meta => Named::Meta,
|
||||||
"e" => KeyCode::E,
|
NamedKey::Hyper => Named::Hyper,
|
||||||
"f" => KeyCode::F,
|
NamedKey::Super => Named::Super,
|
||||||
"g" => KeyCode::G,
|
NamedKey::Enter => Named::Enter,
|
||||||
"h" => KeyCode::H,
|
NamedKey::Tab => Named::Tab,
|
||||||
"i" => KeyCode::I,
|
NamedKey::Space => Named::Space,
|
||||||
"j" => KeyCode::J,
|
NamedKey::ArrowDown => Named::ArrowDown,
|
||||||
"k" => KeyCode::K,
|
NamedKey::ArrowLeft => Named::ArrowLeft,
|
||||||
"l" => KeyCode::L,
|
NamedKey::ArrowRight => Named::ArrowRight,
|
||||||
"m" => KeyCode::M,
|
NamedKey::ArrowUp => Named::ArrowUp,
|
||||||
"n" => KeyCode::N,
|
NamedKey::End => Named::End,
|
||||||
"o" => KeyCode::O,
|
NamedKey::Home => Named::Home,
|
||||||
"p" => KeyCode::P,
|
NamedKey::PageDown => Named::PageDown,
|
||||||
"q" => KeyCode::Q,
|
NamedKey::PageUp => Named::PageUp,
|
||||||
"r" => KeyCode::R,
|
NamedKey::Backspace => Named::Backspace,
|
||||||
"s" => KeyCode::S,
|
NamedKey::Clear => Named::Clear,
|
||||||
"t" => KeyCode::T,
|
NamedKey::Copy => Named::Copy,
|
||||||
"u" => KeyCode::U,
|
NamedKey::CrSel => Named::CrSel,
|
||||||
"v" => KeyCode::V,
|
NamedKey::Cut => Named::Cut,
|
||||||
"w" => KeyCode::W,
|
NamedKey::Delete => Named::Delete,
|
||||||
"x" => KeyCode::X,
|
NamedKey::EraseEof => Named::EraseEof,
|
||||||
"y" => KeyCode::Y,
|
NamedKey::ExSel => Named::ExSel,
|
||||||
"z" => KeyCode::Z,
|
NamedKey::Insert => Named::Insert,
|
||||||
_ => KeyCode::Unlabeled,
|
NamedKey::Paste => Named::Paste,
|
||||||
},
|
NamedKey::Redo => Named::Redo,
|
||||||
winit::keyboard::Key::Named(named_key) => match named_key {
|
NamedKey::Undo => Named::Undo,
|
||||||
NamedKey::Escape => KeyCode::Escape,
|
NamedKey::Accept => Named::Accept,
|
||||||
NamedKey::F1 => KeyCode::F1,
|
NamedKey::Again => Named::Again,
|
||||||
NamedKey::F2 => KeyCode::F2,
|
NamedKey::Attn => Named::Attn,
|
||||||
NamedKey::F3 => KeyCode::F3,
|
NamedKey::Cancel => Named::Cancel,
|
||||||
NamedKey::F4 => KeyCode::F4,
|
NamedKey::ContextMenu => Named::ContextMenu,
|
||||||
NamedKey::F5 => KeyCode::F5,
|
NamedKey::Escape => Named::Escape,
|
||||||
NamedKey::F6 => KeyCode::F6,
|
NamedKey::Execute => Named::Execute,
|
||||||
NamedKey::F7 => KeyCode::F7,
|
NamedKey::Find => Named::Find,
|
||||||
NamedKey::F8 => KeyCode::F8,
|
NamedKey::Help => Named::Help,
|
||||||
NamedKey::F9 => KeyCode::F9,
|
NamedKey::Pause => Named::Pause,
|
||||||
NamedKey::F10 => KeyCode::F10,
|
NamedKey::Play => Named::Play,
|
||||||
NamedKey::F11 => KeyCode::F11,
|
NamedKey::Props => Named::Props,
|
||||||
NamedKey::F12 => KeyCode::F12,
|
NamedKey::Select => Named::Select,
|
||||||
NamedKey::F13 => KeyCode::F13,
|
NamedKey::ZoomIn => Named::ZoomIn,
|
||||||
NamedKey::F14 => KeyCode::F14,
|
NamedKey::ZoomOut => Named::ZoomOut,
|
||||||
NamedKey::F15 => KeyCode::F15,
|
NamedKey::BrightnessDown => Named::BrightnessDown,
|
||||||
NamedKey::F16 => KeyCode::F16,
|
NamedKey::BrightnessUp => Named::BrightnessUp,
|
||||||
NamedKey::F17 => KeyCode::F17,
|
NamedKey::Eject => Named::Eject,
|
||||||
NamedKey::F18 => KeyCode::F18,
|
NamedKey::LogOff => Named::LogOff,
|
||||||
NamedKey::F19 => KeyCode::F19,
|
NamedKey::Power => Named::Power,
|
||||||
NamedKey::F20 => KeyCode::F20,
|
NamedKey::PowerOff => Named::PowerOff,
|
||||||
NamedKey::F21 => KeyCode::F21,
|
NamedKey::PrintScreen => Named::PrintScreen,
|
||||||
NamedKey::F22 => KeyCode::F22,
|
NamedKey::Hibernate => Named::Hibernate,
|
||||||
NamedKey::F23 => KeyCode::F23,
|
NamedKey::Standby => Named::Standby,
|
||||||
NamedKey::F24 => KeyCode::F24,
|
NamedKey::WakeUp => Named::WakeUp,
|
||||||
NamedKey::PrintScreen => KeyCode::Snapshot,
|
NamedKey::AllCandidates => Named::AllCandidates,
|
||||||
NamedKey::ScrollLock => KeyCode::Scroll,
|
NamedKey::Alphanumeric => Named::Alphanumeric,
|
||||||
NamedKey::Pause => KeyCode::Pause,
|
NamedKey::CodeInput => Named::CodeInput,
|
||||||
NamedKey::Insert => KeyCode::Insert,
|
NamedKey::Compose => Named::Compose,
|
||||||
NamedKey::Home => KeyCode::Home,
|
NamedKey::Convert => Named::Convert,
|
||||||
NamedKey::Delete => KeyCode::Delete,
|
NamedKey::FinalMode => Named::FinalMode,
|
||||||
NamedKey::End => KeyCode::End,
|
NamedKey::GroupFirst => Named::GroupFirst,
|
||||||
NamedKey::PageDown => KeyCode::PageDown,
|
NamedKey::GroupLast => Named::GroupLast,
|
||||||
NamedKey::PageUp => KeyCode::PageUp,
|
NamedKey::GroupNext => Named::GroupNext,
|
||||||
NamedKey::ArrowLeft => KeyCode::Left,
|
NamedKey::GroupPrevious => Named::GroupPrevious,
|
||||||
NamedKey::ArrowUp => KeyCode::Up,
|
NamedKey::ModeChange => Named::ModeChange,
|
||||||
NamedKey::ArrowRight => KeyCode::Right,
|
NamedKey::NextCandidate => Named::NextCandidate,
|
||||||
NamedKey::ArrowDown => KeyCode::Down,
|
NamedKey::NonConvert => Named::NonConvert,
|
||||||
NamedKey::Backspace => KeyCode::Backspace,
|
NamedKey::PreviousCandidate => Named::PreviousCandidate,
|
||||||
NamedKey::Enter => KeyCode::Enter,
|
NamedKey::Process => Named::Process,
|
||||||
NamedKey::Space => KeyCode::Space,
|
NamedKey::SingleCandidate => Named::SingleCandidate,
|
||||||
NamedKey::Compose => KeyCode::Compose,
|
NamedKey::HangulMode => Named::HangulMode,
|
||||||
NamedKey::NumLock => KeyCode::Numlock,
|
NamedKey::HanjaMode => Named::HanjaMode,
|
||||||
NamedKey::AppSwitch => KeyCode::Apps,
|
NamedKey::JunjaMode => Named::JunjaMode,
|
||||||
NamedKey::Convert => KeyCode::Convert,
|
NamedKey::Eisu => Named::Eisu,
|
||||||
NamedKey::LaunchMail => KeyCode::Mail,
|
NamedKey::Hankaku => Named::Hankaku,
|
||||||
NamedKey::MediaApps => KeyCode::MediaSelect,
|
NamedKey::Hiragana => Named::Hiragana,
|
||||||
NamedKey::MediaStop => KeyCode::MediaStop,
|
NamedKey::HiraganaKatakana => Named::HiraganaKatakana,
|
||||||
NamedKey::AudioVolumeMute => KeyCode::Mute,
|
NamedKey::KanaMode => Named::KanaMode,
|
||||||
NamedKey::MediaStepForward => KeyCode::NavigateForward,
|
NamedKey::KanjiMode => Named::KanjiMode,
|
||||||
NamedKey::MediaStepBackward => KeyCode::NavigateBackward,
|
NamedKey::Katakana => Named::Katakana,
|
||||||
NamedKey::MediaSkipForward => KeyCode::NextTrack,
|
NamedKey::Romaji => Named::Romaji,
|
||||||
NamedKey::NonConvert => KeyCode::NoConvert,
|
NamedKey::Zenkaku => Named::Zenkaku,
|
||||||
NamedKey::MediaPlayPause => KeyCode::PlayPause,
|
NamedKey::ZenkakuHankaku => Named::ZenkakuHankaku,
|
||||||
NamedKey::Power => KeyCode::Power,
|
NamedKey::Soft1 => Named::Soft1,
|
||||||
NamedKey::MediaSkipBackward => KeyCode::PrevTrack,
|
NamedKey::Soft2 => Named::Soft2,
|
||||||
NamedKey::PowerOff => KeyCode::Sleep,
|
NamedKey::Soft3 => Named::Soft3,
|
||||||
NamedKey::Tab => KeyCode::Tab,
|
NamedKey::Soft4 => Named::Soft4,
|
||||||
NamedKey::AudioVolumeDown => KeyCode::VolumeDown,
|
NamedKey::ChannelDown => Named::ChannelDown,
|
||||||
NamedKey::AudioVolumeUp => KeyCode::VolumeUp,
|
NamedKey::ChannelUp => Named::ChannelUp,
|
||||||
NamedKey::WakeUp => KeyCode::Wake,
|
NamedKey::Close => Named::Close,
|
||||||
NamedKey::BrowserBack => KeyCode::WebBack,
|
NamedKey::MailForward => Named::MailForward,
|
||||||
NamedKey::BrowserFavorites => KeyCode::WebFavorites,
|
NamedKey::MailReply => Named::MailReply,
|
||||||
NamedKey::BrowserForward => KeyCode::WebForward,
|
NamedKey::MailSend => Named::MailSend,
|
||||||
NamedKey::BrowserHome => KeyCode::WebHome,
|
NamedKey::MediaClose => Named::MediaClose,
|
||||||
NamedKey::BrowserRefresh => KeyCode::WebRefresh,
|
NamedKey::MediaFastForward => Named::MediaFastForward,
|
||||||
NamedKey::BrowserSearch => KeyCode::WebSearch,
|
NamedKey::MediaPause => Named::MediaPause,
|
||||||
NamedKey::BrowserStop => KeyCode::WebStop,
|
NamedKey::MediaPlay => Named::MediaPlay,
|
||||||
NamedKey::Copy => KeyCode::Copy,
|
NamedKey::MediaPlayPause => Named::MediaPlayPause,
|
||||||
NamedKey::Paste => KeyCode::Paste,
|
NamedKey::MediaRecord => Named::MediaRecord,
|
||||||
NamedKey::Cut => KeyCode::Cut,
|
NamedKey::MediaRewind => Named::MediaRewind,
|
||||||
_ => KeyCode::Unlabeled,
|
NamedKey::MediaStop => Named::MediaStop,
|
||||||
},
|
NamedKey::MediaTrackNext => Named::MediaTrackNext,
|
||||||
_ => KeyCode::Unlabeled,
|
NamedKey::MediaTrackPrevious => Named::MediaTrackPrevious,
|
||||||
|
NamedKey::New => Named::New,
|
||||||
|
NamedKey::Open => Named::Open,
|
||||||
|
NamedKey::Print => Named::Print,
|
||||||
|
NamedKey::Save => Named::Save,
|
||||||
|
NamedKey::SpellCheck => Named::SpellCheck,
|
||||||
|
NamedKey::Key11 => Named::Key11,
|
||||||
|
NamedKey::Key12 => Named::Key12,
|
||||||
|
NamedKey::AudioBalanceLeft => Named::AudioBalanceLeft,
|
||||||
|
NamedKey::AudioBalanceRight => Named::AudioBalanceRight,
|
||||||
|
NamedKey::AudioBassBoostDown => Named::AudioBassBoostDown,
|
||||||
|
NamedKey::AudioBassBoostToggle => Named::AudioBassBoostToggle,
|
||||||
|
NamedKey::AudioBassBoostUp => Named::AudioBassBoostUp,
|
||||||
|
NamedKey::AudioFaderFront => Named::AudioFaderFront,
|
||||||
|
NamedKey::AudioFaderRear => Named::AudioFaderRear,
|
||||||
|
NamedKey::AudioSurroundModeNext => Named::AudioSurroundModeNext,
|
||||||
|
NamedKey::AudioTrebleDown => Named::AudioTrebleDown,
|
||||||
|
NamedKey::AudioTrebleUp => Named::AudioTrebleUp,
|
||||||
|
NamedKey::AudioVolumeDown => Named::AudioVolumeDown,
|
||||||
|
NamedKey::AudioVolumeUp => Named::AudioVolumeUp,
|
||||||
|
NamedKey::AudioVolumeMute => Named::AudioVolumeMute,
|
||||||
|
NamedKey::MicrophoneToggle => Named::MicrophoneToggle,
|
||||||
|
NamedKey::MicrophoneVolumeDown => Named::MicrophoneVolumeDown,
|
||||||
|
NamedKey::MicrophoneVolumeUp => Named::MicrophoneVolumeUp,
|
||||||
|
NamedKey::MicrophoneVolumeMute => Named::MicrophoneVolumeMute,
|
||||||
|
NamedKey::SpeechCorrectionList => Named::SpeechCorrectionList,
|
||||||
|
NamedKey::SpeechInputToggle => Named::SpeechInputToggle,
|
||||||
|
NamedKey::LaunchApplication1 => Named::LaunchApplication1,
|
||||||
|
NamedKey::LaunchApplication2 => Named::LaunchApplication2,
|
||||||
|
NamedKey::LaunchCalendar => Named::LaunchCalendar,
|
||||||
|
NamedKey::LaunchContacts => Named::LaunchContacts,
|
||||||
|
NamedKey::LaunchMail => Named::LaunchMail,
|
||||||
|
NamedKey::LaunchMediaPlayer => Named::LaunchMediaPlayer,
|
||||||
|
NamedKey::LaunchMusicPlayer => Named::LaunchMusicPlayer,
|
||||||
|
NamedKey::LaunchPhone => Named::LaunchPhone,
|
||||||
|
NamedKey::LaunchScreenSaver => Named::LaunchScreenSaver,
|
||||||
|
NamedKey::LaunchSpreadsheet => Named::LaunchSpreadsheet,
|
||||||
|
NamedKey::LaunchWebBrowser => Named::LaunchWebBrowser,
|
||||||
|
NamedKey::LaunchWebCam => Named::LaunchWebCam,
|
||||||
|
NamedKey::LaunchWordProcessor => Named::LaunchWordProcessor,
|
||||||
|
NamedKey::BrowserBack => Named::BrowserBack,
|
||||||
|
NamedKey::BrowserFavorites => Named::BrowserFavorites,
|
||||||
|
NamedKey::BrowserForward => Named::BrowserForward,
|
||||||
|
NamedKey::BrowserHome => Named::BrowserHome,
|
||||||
|
NamedKey::BrowserRefresh => Named::BrowserRefresh,
|
||||||
|
NamedKey::BrowserSearch => Named::BrowserSearch,
|
||||||
|
NamedKey::BrowserStop => Named::BrowserStop,
|
||||||
|
NamedKey::AppSwitch => Named::AppSwitch,
|
||||||
|
NamedKey::Call => Named::Call,
|
||||||
|
NamedKey::Camera => Named::Camera,
|
||||||
|
NamedKey::CameraFocus => Named::CameraFocus,
|
||||||
|
NamedKey::EndCall => Named::EndCall,
|
||||||
|
NamedKey::GoBack => Named::GoBack,
|
||||||
|
NamedKey::GoHome => Named::GoHome,
|
||||||
|
NamedKey::HeadsetHook => Named::HeadsetHook,
|
||||||
|
NamedKey::LastNumberRedial => Named::LastNumberRedial,
|
||||||
|
NamedKey::Notification => Named::Notification,
|
||||||
|
NamedKey::MannerMode => Named::MannerMode,
|
||||||
|
NamedKey::VoiceDial => Named::VoiceDial,
|
||||||
|
NamedKey::TV => Named::TV,
|
||||||
|
NamedKey::TV3DMode => Named::TV3DMode,
|
||||||
|
NamedKey::TVAntennaCable => Named::TVAntennaCable,
|
||||||
|
NamedKey::TVAudioDescription => Named::TVAudioDescription,
|
||||||
|
NamedKey::TVAudioDescriptionMixDown => {
|
||||||
|
Named::TVAudioDescriptionMixDown
|
||||||
|
}
|
||||||
|
NamedKey::TVAudioDescriptionMixUp => {
|
||||||
|
Named::TVAudioDescriptionMixUp
|
||||||
|
}
|
||||||
|
NamedKey::TVContentsMenu => Named::TVContentsMenu,
|
||||||
|
NamedKey::TVDataService => Named::TVDataService,
|
||||||
|
NamedKey::TVInput => Named::TVInput,
|
||||||
|
NamedKey::TVInputComponent1 => Named::TVInputComponent1,
|
||||||
|
NamedKey::TVInputComponent2 => Named::TVInputComponent2,
|
||||||
|
NamedKey::TVInputComposite1 => Named::TVInputComposite1,
|
||||||
|
NamedKey::TVInputComposite2 => Named::TVInputComposite2,
|
||||||
|
NamedKey::TVInputHDMI1 => Named::TVInputHDMI1,
|
||||||
|
NamedKey::TVInputHDMI2 => Named::TVInputHDMI2,
|
||||||
|
NamedKey::TVInputHDMI3 => Named::TVInputHDMI3,
|
||||||
|
NamedKey::TVInputHDMI4 => Named::TVInputHDMI4,
|
||||||
|
NamedKey::TVInputVGA1 => Named::TVInputVGA1,
|
||||||
|
NamedKey::TVMediaContext => Named::TVMediaContext,
|
||||||
|
NamedKey::TVNetwork => Named::TVNetwork,
|
||||||
|
NamedKey::TVNumberEntry => Named::TVNumberEntry,
|
||||||
|
NamedKey::TVPower => Named::TVPower,
|
||||||
|
NamedKey::TVRadioService => Named::TVRadioService,
|
||||||
|
NamedKey::TVSatellite => Named::TVSatellite,
|
||||||
|
NamedKey::TVSatelliteBS => Named::TVSatelliteBS,
|
||||||
|
NamedKey::TVSatelliteCS => Named::TVSatelliteCS,
|
||||||
|
NamedKey::TVSatelliteToggle => Named::TVSatelliteToggle,
|
||||||
|
NamedKey::TVTerrestrialAnalog => Named::TVTerrestrialAnalog,
|
||||||
|
NamedKey::TVTerrestrialDigital => Named::TVTerrestrialDigital,
|
||||||
|
NamedKey::TVTimer => Named::TVTimer,
|
||||||
|
NamedKey::AVRInput => Named::AVRInput,
|
||||||
|
NamedKey::AVRPower => Named::AVRPower,
|
||||||
|
NamedKey::ColorF0Red => Named::ColorF0Red,
|
||||||
|
NamedKey::ColorF1Green => Named::ColorF1Green,
|
||||||
|
NamedKey::ColorF2Yellow => Named::ColorF2Yellow,
|
||||||
|
NamedKey::ColorF3Blue => Named::ColorF3Blue,
|
||||||
|
NamedKey::ColorF4Grey => Named::ColorF4Grey,
|
||||||
|
NamedKey::ColorF5Brown => Named::ColorF5Brown,
|
||||||
|
NamedKey::ClosedCaptionToggle => Named::ClosedCaptionToggle,
|
||||||
|
NamedKey::Dimmer => Named::Dimmer,
|
||||||
|
NamedKey::DisplaySwap => Named::DisplaySwap,
|
||||||
|
NamedKey::DVR => Named::DVR,
|
||||||
|
NamedKey::Exit => Named::Exit,
|
||||||
|
NamedKey::FavoriteClear0 => Named::FavoriteClear0,
|
||||||
|
NamedKey::FavoriteClear1 => Named::FavoriteClear1,
|
||||||
|
NamedKey::FavoriteClear2 => Named::FavoriteClear2,
|
||||||
|
NamedKey::FavoriteClear3 => Named::FavoriteClear3,
|
||||||
|
NamedKey::FavoriteRecall0 => Named::FavoriteRecall0,
|
||||||
|
NamedKey::FavoriteRecall1 => Named::FavoriteRecall1,
|
||||||
|
NamedKey::FavoriteRecall2 => Named::FavoriteRecall2,
|
||||||
|
NamedKey::FavoriteRecall3 => Named::FavoriteRecall3,
|
||||||
|
NamedKey::FavoriteStore0 => Named::FavoriteStore0,
|
||||||
|
NamedKey::FavoriteStore1 => Named::FavoriteStore1,
|
||||||
|
NamedKey::FavoriteStore2 => Named::FavoriteStore2,
|
||||||
|
NamedKey::FavoriteStore3 => Named::FavoriteStore3,
|
||||||
|
NamedKey::Guide => Named::Guide,
|
||||||
|
NamedKey::GuideNextDay => Named::GuideNextDay,
|
||||||
|
NamedKey::GuidePreviousDay => Named::GuidePreviousDay,
|
||||||
|
NamedKey::Info => Named::Info,
|
||||||
|
NamedKey::InstantReplay => Named::InstantReplay,
|
||||||
|
NamedKey::Link => Named::Link,
|
||||||
|
NamedKey::ListProgram => Named::ListProgram,
|
||||||
|
NamedKey::LiveContent => Named::LiveContent,
|
||||||
|
NamedKey::Lock => Named::Lock,
|
||||||
|
NamedKey::MediaApps => Named::MediaApps,
|
||||||
|
NamedKey::MediaAudioTrack => Named::MediaAudioTrack,
|
||||||
|
NamedKey::MediaLast => Named::MediaLast,
|
||||||
|
NamedKey::MediaSkipBackward => Named::MediaSkipBackward,
|
||||||
|
NamedKey::MediaSkipForward => Named::MediaSkipForward,
|
||||||
|
NamedKey::MediaStepBackward => Named::MediaStepBackward,
|
||||||
|
NamedKey::MediaStepForward => Named::MediaStepForward,
|
||||||
|
NamedKey::MediaTopMenu => Named::MediaTopMenu,
|
||||||
|
NamedKey::NavigateIn => Named::NavigateIn,
|
||||||
|
NamedKey::NavigateNext => Named::NavigateNext,
|
||||||
|
NamedKey::NavigateOut => Named::NavigateOut,
|
||||||
|
NamedKey::NavigatePrevious => Named::NavigatePrevious,
|
||||||
|
NamedKey::NextFavoriteChannel => Named::NextFavoriteChannel,
|
||||||
|
NamedKey::NextUserProfile => Named::NextUserProfile,
|
||||||
|
NamedKey::OnDemand => Named::OnDemand,
|
||||||
|
NamedKey::Pairing => Named::Pairing,
|
||||||
|
NamedKey::PinPDown => Named::PinPDown,
|
||||||
|
NamedKey::PinPMove => Named::PinPMove,
|
||||||
|
NamedKey::PinPToggle => Named::PinPToggle,
|
||||||
|
NamedKey::PinPUp => Named::PinPUp,
|
||||||
|
NamedKey::PlaySpeedDown => Named::PlaySpeedDown,
|
||||||
|
NamedKey::PlaySpeedReset => Named::PlaySpeedReset,
|
||||||
|
NamedKey::PlaySpeedUp => Named::PlaySpeedUp,
|
||||||
|
NamedKey::RandomToggle => Named::RandomToggle,
|
||||||
|
NamedKey::RcLowBattery => Named::RcLowBattery,
|
||||||
|
NamedKey::RecordSpeedNext => Named::RecordSpeedNext,
|
||||||
|
NamedKey::RfBypass => Named::RfBypass,
|
||||||
|
NamedKey::ScanChannelsToggle => Named::ScanChannelsToggle,
|
||||||
|
NamedKey::ScreenModeNext => Named::ScreenModeNext,
|
||||||
|
NamedKey::Settings => Named::Settings,
|
||||||
|
NamedKey::SplitScreenToggle => Named::SplitScreenToggle,
|
||||||
|
NamedKey::STBInput => Named::STBInput,
|
||||||
|
NamedKey::STBPower => Named::STBPower,
|
||||||
|
NamedKey::Subtitle => Named::Subtitle,
|
||||||
|
NamedKey::Teletext => Named::Teletext,
|
||||||
|
NamedKey::VideoModeNext => Named::VideoModeNext,
|
||||||
|
NamedKey::Wink => Named::Wink,
|
||||||
|
NamedKey::ZoomToggle => Named::ZoomToggle,
|
||||||
|
NamedKey::F1 => Named::F1,
|
||||||
|
NamedKey::F2 => Named::F2,
|
||||||
|
NamedKey::F3 => Named::F3,
|
||||||
|
NamedKey::F4 => Named::F4,
|
||||||
|
NamedKey::F5 => Named::F5,
|
||||||
|
NamedKey::F6 => Named::F6,
|
||||||
|
NamedKey::F7 => Named::F7,
|
||||||
|
NamedKey::F8 => Named::F8,
|
||||||
|
NamedKey::F9 => Named::F9,
|
||||||
|
NamedKey::F10 => Named::F10,
|
||||||
|
NamedKey::F11 => Named::F11,
|
||||||
|
NamedKey::F12 => Named::F12,
|
||||||
|
NamedKey::F13 => Named::F13,
|
||||||
|
NamedKey::F14 => Named::F14,
|
||||||
|
NamedKey::F15 => Named::F15,
|
||||||
|
NamedKey::F16 => Named::F16,
|
||||||
|
NamedKey::F17 => Named::F17,
|
||||||
|
NamedKey::F18 => Named::F18,
|
||||||
|
NamedKey::F19 => Named::F19,
|
||||||
|
NamedKey::F20 => Named::F20,
|
||||||
|
NamedKey::F21 => Named::F21,
|
||||||
|
NamedKey::F22 => Named::F22,
|
||||||
|
NamedKey::F23 => Named::F23,
|
||||||
|
NamedKey::F24 => Named::F24,
|
||||||
|
NamedKey::F25 => Named::F25,
|
||||||
|
NamedKey::F26 => Named::F26,
|
||||||
|
NamedKey::F27 => Named::F27,
|
||||||
|
NamedKey::F28 => Named::F28,
|
||||||
|
NamedKey::F29 => Named::F29,
|
||||||
|
NamedKey::F30 => Named::F30,
|
||||||
|
NamedKey::F31 => Named::F31,
|
||||||
|
NamedKey::F32 => Named::F32,
|
||||||
|
NamedKey::F33 => Named::F33,
|
||||||
|
NamedKey::F34 => Named::F34,
|
||||||
|
NamedKey::F35 => Named::F35,
|
||||||
|
_ => return keyboard::Key::Unidentified,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
_ => keyboard::Key::Unidentified,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -645,7 +645,7 @@ async fn run_instance<A, E, C>(
|
||||||
|
|
||||||
if let Some(event) = conversion::window_event(
|
if let Some(event) = conversion::window_event(
|
||||||
id,
|
id,
|
||||||
&window_event,
|
window_event,
|
||||||
window.state.scale_factor(),
|
window.state.scale_factor(),
|
||||||
window.state.modifiers(),
|
window.state.modifiers(),
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue