-
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
No VirtualKeyCode for question mark #812
Comments
(Tested by bashing every key on my keyboard)
|
In wayland:
Possibly assigned wrong keys:
|
@vberger What would be the appropriate course of action for fixing this issue in Wayland and X11? |
Are you sure the problem is just with Weyland and X11? It looks like the |
@stevebob This is going to be a problem on every platform, from skimming through the source. However, I've only tested it with X11 and Wayland. I'm asking @vberger for what is the appropriate solution for those two platforms. More specifically, I want to know what is the expected behavior when using Shift. Consider, Key4. Should Shift-Key4 give wengwengweng said on gitter:
Of course, the obvious issue is, what if on some keyboards the shifts aren't where we expect them. In the Albanian QWERTZ keyboard for example, Shift-Key2 is ", not @, and what if the user wants to detect when someone presses Alt-@? https://en.wikipedia.org/wiki/Keyboard_layout#/media/File:Albanian_keyboard_layout.jpg |
@stevebob What OS/keyboard layout are you using? Right now, the Despite it working with Windows and QWERTY, I'd say that the keyboard input/key-code API needs to largely get reworked - given the existence of this issue, it's pretty clear that the intents of the non-alphanumeric variants in (also I feel very strongly that Shift shouldn't change the outputted |
@Osspial I've reproduced this on both X11 and Wayland with a standard QWERTY keyboard. |
@Osspial I'm using linux with a US dvorak keyboard layout. I definitely misunderstood the intent of |
@stevebob Right now, the biggest thing that determines if a key is in On Windows, A lot of my other programming projects have hit various roadblocks, so I think I'm able to take a pass at cleaning this up. |
@zegentzy I'll do that once I have it in place - I'm still a little bit torn about what I want the API to look like, so I need to get that resolved. One catch is that I'm doing this work against the |
Okay, apparently we need to make a decision / clarification about the virtual keycodes, because we have some historical cruft. The information we get from the OS in Linux (both Wayland and X11) allows us to find the keysym (or key symbol). This is a representation of the key, including context from modifiers. For example, on my azerty keyboard, if I press the first key in my numeric row, I'll get the key symbol corresponding to In the early days, winit/glutin definitely had a more game-centric point of view, and in the context of games, you mostly want to consider physical keys, irrespective of the pressed modifiers (pressing
These rules are currently hardcoded in the wayland backend. It was not really possible to unify further, because keymaps are too different from each other past this point. From what you say in this issue, it appears these rules are not really uniformly followed with all backends of winit. So I guess it's the point where we need to clearly decide what to do. |
Alright, I've stubbed out the "dream API", which I'd like to have if it's possible to implement across all platforms, but I don't know how feasible it is. The API docs for that are here, and the source code is here. Feeback and bikeshedding on the new key-code API is encouraged. It's heavily based around the W3C UI Events key-codes, with some modifications. I'm not entirely happy with some of the choices I've made so I'd be happy to see discussion or ideas on how to improve it. EDIT: |
I'm not sure I get your intent. Is it to just remap everything on QWERTY or ignore the system keymap? On a more general tone, what about keyboard with keys that just don't exist on an US keyboard? For example the french bépo layout has keys dedicated to |
The intention is to provide APIs for both QWERTY and ignoring the system keymap, since there isn't really a one-size-fits-all approach: ignoring the keymap is ideal for games, and remapping QWERTY is ideal for desktop apps with keyboard shortcuts. Keys that don't exist on the US keyboard get remapped to the The documentation currently there is... sparse, to put it kindly, so that needs to get cleaned up to make the intent more clear. EDIT: |
I'm strugging with this problem at the moment. I'd really rather not use scancodes for this. |
I'm running into this issue as well on Linux, is there any movement on this issue? At present this is affecting |
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.
There is no question mark variant of the
VirtualKeyCode
type: https://docs.rs/winit/0.19.0/winit/enum.VirtualKeyCode.htmlTyping a question mark produces the following (
virtual_keycode
isNone
):Originally opened in glutin: rust-windowing/glutin#1104
The text was updated successfully, but these errors were encountered: