Opened 11 years ago
Last modified 11 years ago
#2043 closed enhancement
[PATCH] Adding some azerty keymapping for the hotkeys — at Version 6
Reported by: | lsdh | Owned by: | |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 14 |
Component: | Core engine | Keywords: | simple patch |
Cc: | Patch: |
Description (last modified by )
On Linux (tested on Ubuntu 13.4 with gnome shell); the hotkeys ctrl+1 to ctrl+0 did not work natively in my case (but does in Windows 7, same computer). I have a Belgian keyboard, so default keymapping is really different from the US one.
A ~/.config/0ad/config/local.cfg can receive modifications to have custom hotkeys, but some keys I needed where not available: § à ç è é
Theses keys are also present in the French keyboards (the only change for theses places is at place 6: "-" instead of "§").
To have a full ctrl+1 to ctrl+0 bar, I added theses entries in the /0ad/source/ps/Keyname.cpp list :
{ SDLK_WORLD_7, "World7", "W7" }, // § { SDLK_WORLD_64, "World64", "W64" }, // à { SDLK_WORLD_71, "World71", "W71" }, // ç { SDLK_WORLD_72, "World72", "W72" }, // è { SDLK_WORLD_73, "World73", "W73" }, // é
And configured the ~/.config/0ad/config/local.cfg like this:
hotkey.selection.group.select.0 = W64 hotkey.selection.group.save.0 = "Ctrl+W64" hotkey.selection.group.add.0 = "Shift+W64" hotkey.selection.group.select.1 = Ampersand hotkey.selection.group.save.1 = "Ctrl+Ampersand" hotkey.selection.group.add.1 = "Shift+Ampersand" hotkey.selection.group.select.2 = W73 hotkey.selection.group.save.2 = "Ctrl+W73" hotkey.selection.group.add.2 = "Shift+W73" hotkey.selection.group.select.3 = DoubleQuote hotkey.selection.group.save.3 = "Ctrl+DoubleQuote" hotkey.selection.group.add.3 = "Shift+DoubleQuote" hotkey.selection.group.select.4 = SingleQuote hotkey.selection.group.save.4 = "Ctrl+SingleQuote" hotkey.selection.group.add.4 = "Shift+SingleQuote" hotkey.selection.group.select.5 = LeftParen hotkey.selection.group.save.5 = "Ctrl+LeftParen" hotkey.selection.group.add.5 = "Shift+LeftParen" hotkey.selection.group.select.6 = W7 hotkey.selection.group.save.6 = "Ctrl+W7" hotkey.selection.group.add.6 = "Shift+W7" hotkey.selection.group.select.7 = W72 hotkey.selection.group.save.7 = "Ctrl+W72" hotkey.selection.group.add.7 = "Shift+W72" hotkey.selection.group.select.8 = Exclaim hotkey.selection.group.save.8 = "Ctrl+Exclaim" hotkey.selection.group.add.8 = "Shift+Exclaim" hotkey.selection.group.select.9 = W71 hotkey.selection.group.save.9 = "Ctrl+W71" hotkey.selection.group.add.9 = "Shift+W71"
The /0ad/binaries/data/config/keys.txt could also be updated.
I could manage to do this changes thanks to Philip` and RedFox| on the IRC, so a big thanks to them.
(to add other keys, you can temporary add the line
printf("%d %d\n", ev->ev.type, (int)ev->ev.key.keysym.sym);
in the HotkeyInputHandler function of /0ad/source/ps/Hotkey.cpp then compile and lauch the game in a terminal. an integer will be displayed when the key is pressed:
2 224 3 224
The second number (224 here) correspond to the key and this http://www-personal.umich.edu/~bazald/l/api/_s_d_l__keysym_8h.html will give you the SDLK name corresponding).
Change History (6)
comment:1 by , 11 years ago
Description: | modified (diff) |
---|
comment:2 by , 11 years ago
Description: | modified (diff) |
---|
comment:3 by , 11 years ago
comment:4 by , 11 years ago
Keywords: | patch added; Keyname removed |
---|---|
Priority: | If Time Permits → Should Have |
Summary: | Adding some Belgian keymapping for the hotkeys → [PATCH] Adding some Belgian keymapping for the hotkeys |
comment:5 by , 11 years ago
I'll update tomorrow.
In fact, the only two files that should be in the snv diff are the KeyName.cpp and the keys.txt. the .cfg file is there if people wants to easily have it to works and the Hotkey.cpp can be deleted from the list (it only contain the commented line, so it does not helps).
With theses changes, the keys would be right for Belgian and French azerty keyboards (with little double usage of - as this key is already used for zoom-).
I see that most qwerty keyboards have the numbers at this place, so not causing problem I guess, but some special keyboards still exist, like the Lithuanian one.
Does it worth I add their specials keys?
Thanks for your interest :-)
comment:6 by , 11 years ago
Description: | modified (diff) |
---|---|
Summary: | [PATCH] Adding some Belgian keymapping for the hotkeys → [PATCH] Adding some azerty keymapping for the hotkeys |
Some comments:
But thanks for the time, it's certainly worth supporting extra keys.