From 3d7784d2af262d96dbd6aae1df91b051d7eb1976 Mon Sep 17 00:00:00 2001 From: wraitii Date: Sun, 21 May 2017 08:05:52 +0000 Subject: [PATCH] Try to recognise unknown hotkey mappings using SDL2. This improves our international keyboard until we completely rework the hotkey system which seems to be quite legacy at this point. Reviewed by Itms. Differential Revision: https://code.wildfiregames.com/D303 This was SVN commit r19624. --- binaries/data/config/keys.txt | 100 +--------------------------------- source/ps/Hotkey.cpp | 2 + 2 files changed, 4 insertions(+), 98 deletions(-) diff --git a/binaries/data/config/keys.txt b/binaries/data/config/keys.txt index 29e261d4fe..9360d8c92e 100644 --- a/binaries/data/config/keys.txt +++ b/binaries/data/config/keys.txt @@ -1,5 +1,7 @@ ## This file documents keynames that can be used in .cfg files for specifying hotkeys ## Note: the keynames are not actually configured or implemented here +## Also note: if your keyboard supports keys that do not appear here (such as the French é letter), +## you should be able to use it directly. Backspace, BkSp Tab @@ -150,101 +152,3 @@ Mouse Wheel Down, WheelDown MouseButtonX, MouseNX # where X is a number 1-255, for extra mouse buttons ## (note that some mice start numbering their buttons at higher numbers ## so the first extra button on your mouse might be #8 here) - -## Special keys for international and non-QWERTY keyboards: -World0, W0 -World1, W1 -World2, W2 -World3, W3 -World4, W4 -World5, W5 -World6, W6 -World7, W7 -World8, W8 -World9, W9 -World10, W10 -World11, W11 -World12, W12 -World13, W13 -World14, W14 -World15, W15 -World16, W16 -World17, W17 -World18, W18 -World19, W19 -World20, W20 -World21, W21 -World22, W22 -World23, W23 -World24, W24 -World25, W25 -World26, W26 -World27, W27 -World28, W28 -World29, W29 -World30, W30 -World31, W31 -World32, W32 -World33, W33 -World34, W34 -World35, W35 -World36, W36 -World37, W37 -World38, W38 -World39, W39 -World40, W40 -World41, W41 -World42, W42 -World43, W43 -World44, W44 -World45, W45 -World46, W46 -World47, W47 -World48, W48 -World49, W49 -World50, W50 -World51, W51 -World52, W52 -World53, W53 -World54, W54 -World55, W55 -World56, W56 -World57, W57 -World58, W58 -World59, W59 -World60, W60 -World61, W61 -World62, W62 -World63, W63 -World64, W64 -World65, W65 -World66, W66 -World67, W67 -World68, W68 -World69, W69 -World70, W70 -World71, W71 -World72, W72 -World73, W73 -World74, W74 -World75, W75 -World76, W76 -World77, W77 -World78, W78 -World79, W79 -World80, W80 -World81, W81 -World82, W82 -World83, W83 -World84, W84 -World85, W85 -World86, W86 -World87, W87 -World88, W88 -World89, W89 -World90, W90 -World91, W91 -World92, W92 -World93, W93 -World94, W94 -World95, W95 diff --git a/source/ps/Hotkey.cpp b/source/ps/Hotkey.cpp index 5824c58577..dd6bf4db3c 100644 --- a/source/ps/Hotkey.cpp +++ b/source/ps/Hotkey.cpp @@ -75,6 +75,8 @@ static void LoadConfigBindings() { // Attempt decode as key name int mapping = FindKeyCode(*it); + if (!mapping) + mapping = SDL_GetKeyFromName(it->c_str()); if (!mapping) { LOGWARNING("Hotkey mapping used invalid key '%s'", hotkey.c_str());