-
Notifications
You must be signed in to change notification settings - Fork 903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent virtual_keycode on macOS and OpenBSD #2032
Labels
Comments
kchibisov
added a commit
that referenced
this issue
May 28, 2023
Overhaul the keyboard API in winit to mimic the W3C specification to achieve better crossplatform parity. The `KeyboardInput` event is now uses `KeyEvent` which consists of: - `physical_key` - a cross platform way to refer to scancodes; - `logical_key` - keysym value, which shows your key respecting the layout; - `text` - the text produced by this keypress; - `location` - the location of the key on the keyboard; - `repeat` - whether the key was produced by the repeat. And also a `platform_specific` field which encapsulates extra information on desktop platforms, like key without modifiers and text with all modifiers. The `Modifiers` were also slightly reworked as in, the information whether the left or right modifier is pressed is now also exposed on platforms where it could be queried reliably. The support was also added for the web and orbital platforms finishing the API change. This change made the `OptionAsAlt` API on macOS redundant thus it was removed all together. Co-Authored-By: Artúr Kovács <kovacs.artur.barnabas@gmail.com> Co-Authored-By: Kirill Chibisov <contact@kchibisov.com> Co-Authored-By: daxpedda <daxpedda@gmail.com> Fixes: #2631. Fixes: #2055. Fixes: #2032. Fixes: #1904. Fixes: #1810. Fixes: #1700. Fixes: #1443. Fixes: #1343. Fixes: #1208. Fixes: #1151. Fixes: #812. Fixes: #600. Fixes: #361. Fixes: #343.
Thanks you so very much for addressing this! 🎉 I look forward to the next release of winit and update software (e.g. alacritty) using winit. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
While using alacritty on macOS and OpenBSD I notice a difference in the keybinding configuration, where some keybindings working on macOS are not working on OpenBSD.
The helpful folks in the
#alacritty
Libera.Chat channel pointed me to this repository and suggested that the issue that I run into might be related to a missing (platform) mapping in this repository, which alacritty uses as a dependency.I modified the
examples/resizable.rs
in order to provide a Minimal Working Example (MWE) (see below).Note that on OpenBSD I am using the
us.swapctrlcaps
keyboard layout, have assigned the physical Control left of the spacebar toHyper_L
usingkeycode 37 = Hyper_L
in~/.Xmodmap
(this should not matter though as the tests below only use the Command key), and have swapped the left logo key with the left alt key in order to match macOS' layout where the left Command key is left of the space bar and the left Alt (Option) key is to the left of the left Command key resulting in: Alt Command Spacesw_vers -productVersion
uname -r
rustc --version
I've tested the MWE on both macOS and OpenBSD as follows:
Cargo.toml
andsrc/main.rs
files (see below) in a separate directory for testingcargo build && ./target/debug/winit-key-test
on macOS and OpenBSDAsterisk
Key8
Asterisk
Key8
None
LBracket
None
RBracket
None
LBracket
None
RBracket
Detailed MWE Keycode Comparison Between OpenBSD and macOS
Minimal Working Example
Cargo.toml
src/main.rs
The text was updated successfully, but these errors were encountered: