mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-24 06:11:30 +11:00
Add additional numpad key mappings (#805)
* Add additional numpad key mappings Since some platforms have already used the existing `Add`, `Subtract` and `Divide` codes to map numpad keys, the X11 and Wayland platform has been updated to achieve parity between platforms. On macOS only the `Subtract` numpad key had to be added. Since the numpad key is different from the normal keys, an alternative option would be to add new `NumpadAdd`, `NumpadSubtract` and `NumpadDivide` actions, however I think in this case it should be fine to map them to the same virtual key code. * Add Numpad PageUp/Down, Home and End on Wayland
This commit is contained in:
parent
9874181ccd
commit
20b09c4514
|
@ -57,6 +57,9 @@
|
||||||
- On Windows, cursor grabs used to get perpetually canceled when the grabbing window lost focus. Now, cursor grabs automatically get re-initialized when the window regains focus and the mouse moves over the client area.
|
- On Windows, cursor grabs used to get perpetually canceled when the grabbing window lost focus. Now, cursor grabs automatically get re-initialized when the window regains focus and the mouse moves over the client area.
|
||||||
- On Windows, only vertical mouse wheel events were handled. Now, horizontal mouse wheel events are also handled.
|
- On Windows, only vertical mouse wheel events were handled. Now, horizontal mouse wheel events are also handled.
|
||||||
- On Windows, ignore the AltGr key when populating the `ModifersState` type.
|
- On Windows, ignore the AltGr key when populating the `ModifersState` type.
|
||||||
|
- On Linux, the numpad's add, subtract and divide keys are now mapped to the `Add`, `Subtract` and `Divide` virtual key codes
|
||||||
|
- On macOS, the numpad's subtract key has been added to the `Subtract` mapping
|
||||||
|
- On Wayland, the numpad's home, end, page up and page down keys are now mapped to the `Home`, `End`, `PageUp` and `PageDown` virtual key codes
|
||||||
|
|
||||||
# Version 0.18.1 (2018-12-30)
|
# Version 0.18.1 (2018-12-30)
|
||||||
|
|
||||||
|
|
|
@ -295,6 +295,13 @@ fn keysym_to_vkey(keysym: u32) -> Option<VirtualKeyCode> {
|
||||||
keysyms::XKB_KEY_KP_Separator => Some(VirtualKeyCode::NumpadComma),
|
keysyms::XKB_KEY_KP_Separator => Some(VirtualKeyCode::NumpadComma),
|
||||||
keysyms::XKB_KEY_KP_Enter => Some(VirtualKeyCode::NumpadEnter),
|
keysyms::XKB_KEY_KP_Enter => Some(VirtualKeyCode::NumpadEnter),
|
||||||
keysyms::XKB_KEY_KP_Equal => Some(VirtualKeyCode::NumpadEquals),
|
keysyms::XKB_KEY_KP_Equal => Some(VirtualKeyCode::NumpadEquals),
|
||||||
|
keysyms::XKB_KEY_KP_Add => Some(VirtualKeyCode::Add),
|
||||||
|
keysyms::XKB_KEY_KP_Subtract => Some(VirtualKeyCode::Subtract),
|
||||||
|
keysyms::XKB_KEY_KP_Divide => Some(VirtualKeyCode::Divide),
|
||||||
|
keysyms::XKB_KEY_KP_Page_Up => Some(VirtualKeyCode::PageUp),
|
||||||
|
keysyms::XKB_KEY_KP_Page_Down => Some(VirtualKeyCode::PageDown),
|
||||||
|
keysyms::XKB_KEY_KP_Home => Some(VirtualKeyCode::Home),
|
||||||
|
keysyms::XKB_KEY_KP_End => Some(VirtualKeyCode::End),
|
||||||
// => Some(VirtualKeyCode::OEM102),
|
// => Some(VirtualKeyCode::OEM102),
|
||||||
// => Some(VirtualKeyCode::Period),
|
// => Some(VirtualKeyCode::Period),
|
||||||
// => Some(VirtualKeyCode::Playpause),
|
// => Some(VirtualKeyCode::Playpause),
|
||||||
|
|
|
@ -82,11 +82,11 @@ pub fn keysym_to_element(keysym: libc::c_uint) -> Option<VirtualKeyCode> {
|
||||||
ffi::XK_KP_Delete => events::VirtualKeyCode::Delete,
|
ffi::XK_KP_Delete => events::VirtualKeyCode::Delete,
|
||||||
ffi::XK_KP_Equal => events::VirtualKeyCode::NumpadEquals,
|
ffi::XK_KP_Equal => events::VirtualKeyCode::NumpadEquals,
|
||||||
//ffi::XK_KP_Multiply => events::VirtualKeyCode::NumpadMultiply,
|
//ffi::XK_KP_Multiply => events::VirtualKeyCode::NumpadMultiply,
|
||||||
//ffi::XK_KP_Add => events::VirtualKeyCode::NumpadAdd,
|
ffi::XK_KP_Add => events::VirtualKeyCode::Add,
|
||||||
//ffi::XK_KP_Separator => events::VirtualKeyCode::Kp_separator,
|
//ffi::XK_KP_Separator => events::VirtualKeyCode::Kp_separator,
|
||||||
//ffi::XK_KP_Subtract => events::VirtualKeyCode::NumpadSubtract,
|
ffi::XK_KP_Subtract => events::VirtualKeyCode::Subtract,
|
||||||
//ffi::XK_KP_Decimal => events::VirtualKeyCode::Kp_decimal,
|
//ffi::XK_KP_Decimal => events::VirtualKeyCode::Kp_decimal,
|
||||||
//ffi::XK_KP_Divide => events::VirtualKeyCode::NumpadDivide,
|
ffi::XK_KP_Divide => events::VirtualKeyCode::Divide,
|
||||||
ffi::XK_KP_0 => events::VirtualKeyCode::Numpad0,
|
ffi::XK_KP_0 => events::VirtualKeyCode::Numpad0,
|
||||||
ffi::XK_KP_1 => events::VirtualKeyCode::Numpad1,
|
ffi::XK_KP_1 => events::VirtualKeyCode::Numpad1,
|
||||||
ffi::XK_KP_2 => events::VirtualKeyCode::Numpad2,
|
ffi::XK_KP_2 => events::VirtualKeyCode::Numpad2,
|
||||||
|
|
|
@ -683,6 +683,7 @@ pub fn scancode_to_keycode(code: c_ushort) -> Option<events::VirtualKeyCode> {
|
||||||
0x4a => events::VirtualKeyCode::VolumeDown,
|
0x4a => events::VirtualKeyCode::VolumeDown,
|
||||||
0x4b => events::VirtualKeyCode::Divide,
|
0x4b => events::VirtualKeyCode::Divide,
|
||||||
0x4c => events::VirtualKeyCode::NumpadEnter,
|
0x4c => events::VirtualKeyCode::NumpadEnter,
|
||||||
|
0x4e => events::VirtualKeyCode::Subtract,
|
||||||
//0x4d => unkown,
|
//0x4d => unkown,
|
||||||
0x4e => events::VirtualKeyCode::Subtract,
|
0x4e => events::VirtualKeyCode::Subtract,
|
||||||
0x4f => events::VirtualKeyCode::F18,
|
0x4f => events::VirtualKeyCode::F18,
|
||||||
|
|
Loading…
Reference in a new issue