Skip to content

Parse more missing Key / Code values#2044

Merged
cmyr merged 1 commit intolinebender:masterfrom
CryZe:all-code-values
Nov 18, 2021
Merged

Parse more missing Key / Code values#2044
cmyr merged 1 commit intolinebender:masterfrom
CryZe:all-code-values

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