Repository: alacritty/alacritty (language: rust)

Issue:
Numpad up/left arrow mixup
### Issue

There seems to be a mixup where the numpad up arrow is interpreted as a left arrow.

Here's the output from `alacritty --print-events | grep Numpad` when I press the numpad arrow keys in clockwise order. As you see, both `Numpad8` and `Numpad4` are being interpreted as `ArrowLeft`.


````
[1.693534113s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(94267818674144)), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), event: KeyEvent { physical_key: Code(Numpad8), logical_key: Named(ArrowLeft), text: None, location: Numpad, state: Pressed, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Named(ArrowLeft), text_with_all_modifiers: None } }, is_synthetic: false } }
[1.818030063s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(94267818674144)), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), event: KeyEvent { physical_key: Code(Numpad8), logical_key: Named(ArrowLeft), text: None, location: Numpad, state: Released, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Named(ArrowLeft), text_with_all_modifiers: None } }, is_synthetic: false } }
[2.183437954s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(94267818674144)), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), event: KeyEvent { physical_key: Code(Numpad6), logical_key: Named(ArrowRight), text: None, location: Numpad, state: Pressed, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Named(ArrowRight), text_with_all_modifiers: None } }, is_synthetic: false } }
[2.281193344s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(94267818674144)), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), event: KeyEvent { physical_key: Code(Numpad6), logical_key: Named(ArrowRight), text: None, location: Numpad, state: Released, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Named(ArrowRight), text_with_all_modifiers: None } }, is_synthetic: false } }
[2.552385010s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(94267818674144)), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), event: KeyEvent { physical_key: Code(Numpad2), logical_key: Named(ArrowDown), text: None, location: Numpad, state: Pressed, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Named(ArrowDown), text_with_all_modifiers: None } }, is_synthetic: false } }
[2.674907529s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(94267818674144)), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), event: KeyEvent { physical_key: Code(Numpad2), logical_key: Named(ArrowDown), text: None, location: Numpad, state: Released, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Named(ArrowDown), text_with_all_modifiers: None } }, is_synthetic: false } }
[3.081043834s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(94267818674144)), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), event: KeyEvent { physical_key: Code(Numpad4), logical_key: Named(ArrowLeft), text: None, location: Numpad, state: Pressed, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Named(ArrowLeft), text_with_all_modifiers: None } }, is_synthetic: false } }
[3.168097783s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(94267818674144)), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), event: KeyEvent { physical_key: Code(Numpad4), logical_key: Named(ArrowLeft), text: None, location: Numpad, state: Released, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Named(ArrowLeft), text_with_all_modifiers: None } }, is_synthetic: false } }
````

### System

OS: Linux
Version: alacritty 0.13.0 (78fa4d6f)
Linux: Wayland (sway)

### Logs

Output from `alacritty --print-events` included above.

### Version/Commit History

- Numpad arrow keys work fine in v0.12.3, up to commit 09c4471b
- From commit db903503 onward, numpad arrow keys don't work at all, until...
- From commit cb03806e onward, numpad arrow keys work again, but with up/left mixup described above.



Discussion / hints:
Which layout are you using? We use libxkbcommon to get stuff like that. Could you also try `wev` and what you are getting in it?
Layout from `swaymsg -t get_inputs`

````
Input device: AT Translated Set 2 keyboard
  Type: Keyboard
  Identifier: 1:1:AT_Translated_Set_2_keyboard
  Product ID: 1
  Vendor ID: 1
  Active Keyboard Layout: English (US)
  Libinput Send Events: enabled
````

`wev` output, again going around the numpad arrow keys in clockwise order from top:

````
[14:     wl_keyboard] key: serial: 1135; time: 322394; key: 80; state: 1 (pressed)
                      sym: KP_Up        (65431), utf8: ''
[14:     wl_keyboard] key: serial: 1136; time: 322476; key: 80; state: 0 (released)
                      sym: KP_Up        (65431), utf8: ''
[14:     wl_keyboard] key: serial: 1137; time: 333487; key: 85; state: 1 (pressed)
                      sym: KP_Right     (65432), utf8: ''
[14:     wl_keyboard] key: serial: 1138; time: 333628; key: 85; state: 0 (released)
                      sym: KP_Right     (65432), utf8: ''
[14:     wl_keyboard] key: serial: 1139; time: 335326; key: 88; state: 1 (pressed)
                      sym: KP_Down      (65433), utf8: ''
[14:     wl_keyboard] key: serial: 1140; time: 335489; key: 88; state: 0 (released)
                      sym: KP_Down      (65433), utf8: ''
[14:     wl_keyboard] key: serial: 1141; time: 337495; key: 83; state: 1 (pressed)
                      sym: KP_Left      (65430), utf8: ''
[14:     wl_keyboard] key: serial: 1142; time: 337585; key: 83; state: 0 (released)
                      sym: KP_Left      (65430), utf8: ''
````

I'm using `libxkbcommon 1.6.0-1` on ArchLinux.
So the output in `wev` is correct?
Also, could you test alacritty under `XWayland` and tell whether it has the same issue.
> So the output in `wev` is correct?

Yes, `Numpad8` with `Numlock` off gives correct symbol `KP_Up` while `Numpad4` gives correct symbol `KP_Left` in `wev`. Also haven't encountered any other apps (yet) where numpad up arrow goes left instead of up, only in alacritty so far. For example, as I type this in a Firefox browser window, numpad 8 and 2 with numlock off correctly scroll the window up/down. Another example: in the terminator terminal emulator numpad 8 with numlock off correctly goes to the previous command.
> Also, could you test alacritty under `XWayland` and tell whether it has the same issue.

Yes, `Numpad8` still registers as `ArrowLeft` under `Xwayland`. (Verified using `xeyes` that the new alacritty window was operating under `Xwayland`.)

````
% env -u WAYLAND_DISPLAY alacritty --print-events | grep Numpad                                                                                                                                                                 %[11:46AM]
[2.411444150s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(6291459)), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), event: KeyEvent { physical_key: Code(Numpad8), logical_key: Named(ArrowLeft), text: None, location: Numpad, state: Pressed, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Named(ArrowLeft), text_with_all_modifiers: None } }, is_synthetic: false } }
[2.521889496s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(6291459)), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), event: KeyEvent { physical_key: Code(Numpad8), logical_key: Named(ArrowLeft), text: None, location: Numpad, state: Released, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Named(ArrowLeft), text_with_all_modifiers: None } }, is_synthetic: false } }
[4.972415743s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(6291459)), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), event: KeyEvent { physical_key: Code(Numpad6), logical_key: Named(ArrowRight), text: None, location: Numpad, state: Pressed, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Named(ArrowRight), text_with_all_modifiers: None } }, is_synthetic: false } }
[5.099409636s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(6291459)), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), event: KeyEvent { physical_key: Code(Numpad6), logical_key: Named(ArrowRight), text: None, location: Numpad, state: Released, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Named(ArrowRight), text_with_all_modifiers: None } }, is_synthetic: false } }
[5.822823354s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(6291459)), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), event: KeyEvent { physical_key: Code(Numpad2), logical_key: Named(ArrowDown), text: None, location: Numpad, state: Pressed, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Named(ArrowDown), text_with_all_modifiers: None } }, is_synthetic: false } }
[5.945324282s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(6291459)), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), event: KeyEvent { physical_key: Code(Numpad2), logical_key: Named(ArrowDown), text: None, location: Numpad, state: Released, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Named(ArrowDown), text_with_all_modifiers: None } }, is_synthetic: false } }
[6.534771068s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(6291459)), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), event: KeyEvent { physical_key: Code(Numpad4), logical_key: Named(ArrowLeft), text: None, location: Numpad, state: Pressed, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Named(ArrowLeft), text_with_all_modifiers: None } }, is_synthetic: false } }
[6.654828221s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(6291459)), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), event: KeyEvent { physical_key: Code(Numpad4), logical_key: Named(ArrowLeft), text: None, location: Numpad, state: Released, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Named(ArrowLeft), text_with_all_modifiers: None } }, is_synthetic: false } }
````
Just to be sure this isn't some weirdness with my laptop keyboard, just verified that I also see the same behaviour on my desktop computer after updating to `v0.13`.
Awesome, thanks! I figured it was probably just a copy-paste error in `winit` but I didn't know where to look for it.

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 94d6a9268df..c3010190783 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -31,6 +31,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
 - xdotool modifiers input not working correctly on X11
 - Parsing numbers fails for mouse bindings
 - Some config options overriding each other in CLI/IPC
+- Numpad `Left` used for numpad `Up`
 
 ## 0.13.0
 
diff --git a/Cargo.lock b/Cargo.lock
index 5c094025f69..1b301253214 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2310,9 +2310,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
 
 [[package]]
 name = "winit"
-version = "0.29.8"
+version = "0.29.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0dc1a7ae1076890701c7dd71ea35b2aebaf9aeb7b8868ac2d33b1c7e8ef93c00"
+checksum = "c2376dab13e09c01ad8b679f0dbc7038af4ec43d9a91344338e37bd686481550"
 dependencies = [
  "ahash",
  "android-activity",
diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml
index d0d6ab35a7c..41921ac14c6 100644
--- a/alacritty/Cargo.toml
+++ b/alacritty/Cargo.toml
@@ -39,7 +39,7 @@ serde_json = "1"
 serde_yaml = "0.9.25"
 toml = "0.8.2"
 unicode-width = "0.1"
-winit = { version = "0.29.8", default-features = false, features = ["rwh_05", "serde"] }
+winit = { version = "0.29.9", default-features = false, features = ["rwh_05", "serde"] }
 
 [build-dependencies]
 gl_generator = "0.14.0"


Test patch: