mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-26 14:49:07 -04:00
Android: Add further scancode conversions (#4023)
Firefox' source at: https://searchfox.org/mozilla-central/rev/c597e9c789ad36af84a0370d395be066b7dc94f4/widget/NativeKeyToDOMCodeName.h Seems to use some other form of scan code? So instead we try to map as many of the codes available on `Keycode` that they do as possible.
This commit is contained in:
@@ -109,6 +109,7 @@ pub fn to_physical_key(keycode: Keycode) -> PhysicalKey {
|
|||||||
Keycode::MediaStop => KeyCode::MediaStop,
|
Keycode::MediaStop => KeyCode::MediaStop,
|
||||||
Keycode::MediaNext => KeyCode::MediaTrackNext,
|
Keycode::MediaNext => KeyCode::MediaTrackNext,
|
||||||
Keycode::MediaPrevious => KeyCode::MediaTrackPrevious,
|
Keycode::MediaPrevious => KeyCode::MediaTrackPrevious,
|
||||||
|
Keycode::MediaEject => KeyCode::Eject,
|
||||||
|
|
||||||
Keycode::Plus => KeyCode::Equal,
|
Keycode::Plus => KeyCode::Equal,
|
||||||
Keycode::Minus => KeyCode::Minus,
|
Keycode::Minus => KeyCode::Minus,
|
||||||
@@ -131,7 +132,11 @@ pub fn to_physical_key(keycode: Keycode) -> PhysicalKey {
|
|||||||
// These are exactly the same
|
// These are exactly the same
|
||||||
Keycode::ScrollLock => KeyCode::ScrollLock,
|
Keycode::ScrollLock => KeyCode::ScrollLock,
|
||||||
|
|
||||||
|
Keycode::Eisu => KeyCode::Lang2,
|
||||||
|
Keycode::Muhenkan => KeyCode::NonConvert,
|
||||||
|
Keycode::Henkan => KeyCode::Convert,
|
||||||
Keycode::Yen => KeyCode::IntlYen,
|
Keycode::Yen => KeyCode::IntlYen,
|
||||||
|
Keycode::Ro => KeyCode::IntlRo,
|
||||||
Keycode::Kana => KeyCode::Lang1,
|
Keycode::Kana => KeyCode::Lang1,
|
||||||
Keycode::KatakanaHiragana => KeyCode::KanaMode,
|
Keycode::KatakanaHiragana => KeyCode::KanaMode,
|
||||||
|
|
||||||
@@ -154,6 +159,14 @@ pub fn to_physical_key(keycode: Keycode) -> PhysicalKey {
|
|||||||
Keycode::Sleep => KeyCode::Sleep, // what about SoftSleep?
|
Keycode::Sleep => KeyCode::Sleep, // what about SoftSleep?
|
||||||
Keycode::Wakeup => KeyCode::WakeUp,
|
Keycode::Wakeup => KeyCode::WakeUp,
|
||||||
|
|
||||||
|
Keycode::CapsLock => KeyCode::CapsLock,
|
||||||
|
Keycode::Help => KeyCode::Help,
|
||||||
|
|
||||||
|
Keycode::Back => KeyCode::BrowserBack,
|
||||||
|
Keycode::Forward => KeyCode::BrowserForward,
|
||||||
|
Keycode::Refresh => KeyCode::BrowserRefresh,
|
||||||
|
Keycode::Search => KeyCode::BrowserSearch,
|
||||||
|
|
||||||
keycode => return PhysicalKey::Unidentified(NativeKeyCode::Android(keycode.into())),
|
keycode => return PhysicalKey::Unidentified(NativeKeyCode::Android(keycode.into())),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ changelog entry.
|
|||||||
- On Redox, add support for missing keyboard scancodes.
|
- On Redox, add support for missing keyboard scancodes.
|
||||||
- Implement `Send` and `Sync` for `OwnedDisplayHandle`.
|
- Implement `Send` and `Sync` for `OwnedDisplayHandle`.
|
||||||
- Use new macOS 15 cursors for resize icons.
|
- Use new macOS 15 cursors for resize icons.
|
||||||
|
- On Android, added scancode conversions for more obscure key codes.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user