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. We can probably clean up our existing code more now that everybody is using SDL2.
The "default hotkeys" cleverness is by processing them as scancodes (which they are really), and converting to user-keys. This seems to work very well on my Mac French keyboard, so I'm assuming it'll work OK in general.
User hotkeys are saved properly and not interpreted as scancodes, so that the user can save his own hotkey as wanted.
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.
- No handling of multiple combinations for one hotkey.
- No warning about duplicate hotkeys, though that should be easy to add.
See D303 for earlier work on this.