Add macOS fn key support. (#44410)

This adds support for the fn key on macOS. It adds it to the key mappings as a supplemental mapping that overwrites the one from the Chrome headers, since the chrome headers have a TODO, but no implementation of the key.

Also, ignore the fn key entirely on macOS. This is because On macOS laptop keyboards, the fn key is used to generate home/end and f1-f12, but it ALSO generates a separate down/up event for the fn key itself. Other platforms hide the fn key, and just produce the key that it is combined with, so to keep it possible to write cross platform code that looks at which keys are pressed, the fn key is ignored.
This commit is contained in:
Greg Spencer
2019-11-08 16:30:38 -08:00
committed by GitHub
parent 9fa0f3b2ea
commit c921c5ae67
10 changed files with 167 additions and 48 deletions

View File

@@ -66,33 +66,6 @@
"glfw": null
}
},
"fn": {
"names": {
"domkey": "Fn",
"android": [
"FUNCTION"
],
"english": "Fn",
"chromium": "fn",
"glfw": null
},
"scanCodes": {
"android": [
464
],
"usb": 18,
"linux": null,
"xkb": null,
"windows": null,
"macos": null
},
"keyCodes": {
"android": [
119
],
"glfw": null
}
},
"fnLock": {
"names": {
"domkey": "FnLock",
@@ -7222,5 +7195,32 @@
],
"glfw": null
}
},
"fn": {
"names": {
"domkey": "Fn",
"android": [
"FUNCTION"
],
"english": "Fn",
"chromium": "fn",
"glfw": null
},
"scanCodes": {
"android": [
464
],
"usb": 18,
"linux": null,
"xkb": null,
"windows": null,
"macos": 63
},
"keyCodes": {
"android": [
119
],
"glfw": null
}
}
}