Skip to content
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

Parse more missing Key / Code values #2044

Merged
merged 1 commit into from
Nov 18, 2021
Merged

Conversation

CryZe
Copy link
Contributor

@CryZe CryZe commented Nov 17, 2021

This completes the Code parsing and also adds F13 - F24 to the Key parsing code.

This completes the `Code` parsing and also adds F13 - F24 to the `Key`
parsing code.
Copy link
Collaborator

@maan2003 maan2003 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approve the changes in web, x11 and gtk backends. But someone else will have to review the mac and windows changes

@CryZe
Copy link
Contributor Author

CryZe commented Nov 18, 2021

I sourced these values from:

MDN, but it turns out to be wrong in many ways (I actually have one merged and one open PR to fix it):
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values

Chromium's sources:
https://github.com/chromium/chromium/blob/fd8a8914ca0183f0add65ae55f04e287543c7d4a/ui/events/keycodes/dom/dom_code_data.inc

Firefox's sources:
https://github.com/mozilla/gecko-dev/blob/25002b534963ad95ff0c1a3dd0f906ba023ddc8e/widget/NativeKeyToDOMCodeName.h

Safari's sources:
Windows:
https://github.com/WebKit/WebKit/blob/8afe31a018b11741abdf9b4d5bb973d7c1d9ff05/Source/WebCore/platform/win/WindowsKeyNames.cpp
macOS:
https://github.com/WebKit/WebKit/blob/main/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm
Linux GTK:
https://github.com/WebKit/WebKit/blob/8afe31a018b11741abdf9b4d5bb973d7c1d9ff05/Source/WebCore/platform/gtk/PlatformKeyboardEventGtk.cpp
WPE:
https://github.com/WebKit/WebKit/blob/8afe31a018b11741abdf9b4d5bb973d7c1d9ff05/Source/WebCore/platform/libwpe/PlatformKeyboardEventLibWPE.cpp

(also Linux's source code which contains the evdev constants, which are the linux scancodes - 8 and the USB HID spec)

Chrome has by far the most accurate implementation with Firefox missing a few things and being wrong in a few places and Safari copying bugs from either Firefox or (old) Chrome sources.

Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great thanks! I'm not going to try and test all of these, but it looks sane and I'm happy to merge. I'm sure any issues will shake out eventually. :)

@cmyr cmyr merged commit 0a82b12 into linebender:master Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants