Opened 11 years ago

Last modified 11 years ago

#2043 closed enhancement

Adding some Belgian keymapping for the hotkeys — at Version 2

Reported by: lsdh Owned by:
Priority: Should Have Milestone: Alpha 14
Component: Core engine Keywords: simple patch
Cc: Patch:

Description (last modified by lsdh)

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 § is not in the same place).

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 (2)

comment:1 by lsdh, 11 years ago

Description: modified (diff)

comment:2 by lsdh, 11 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.