This ended up rather large...
The goal is to fix a number of issues related to hotkeys:
- No way to set them inside the game
- Default hotkeys are good for English QWERTY keyboards but may fail on other keyboards.
Design wise, this adds a simple GUI page to set up hotkeys, similar to the Options page but kept separate since it wouldn't mesh too well.
The hotkey picker is a C++ Component to be able to hook into events. This required changing how many events were sent to the GUI. Seems OK.
My system waits for 1s of the same hotkey until the combination is registered, which requires adding a Tick() function to all GUI Objects. I don't think this is a dealbreaker, but refs D2638)
This also refactors Hotkey.h somewhat, as the comments were rather outdated. It cleans up the SDL include.
Another change is that we rely on SDL functions more for names.
All hotkeys in .cfg files are now scan codes, so the default hotkeys work for all keyboards natively. Further, users can now share custom hotkey files and such. In-game, they appear as whatever key is normally typed so it's not jarring.
(see D2838)
This fixes a latent issue with how we converted std::string to JS strings. JS strings treated std::string as Latin-1, whereas we assume they are utF8. Further, FromJSVal wasn't handled correctly either. Basically, this fixes std::string.
Known issues:
- No warning about duplicated hotkeys on the main screen (though you can see conflicts in the hotkey picker). I don't think this is a deal-breaker as we have several 'conflicting' hotkeys depending on the context. ----
Fixes #2850, Fixes #2604, Refs #1810, might fix #1917 (unsure).
See D303 for earlier work on this.
Screenshots: