Not logged inOpenClonk Forum
Up Topic Development / Developer's Corner / Neo2 Keyboard Layout
- - By ker [de] Date 2013-01-22 20:02
Hi,

I've added support for the neo2 keyboard layout to oc.
Git patch here

Not sure how many people will profit from this, but after I saw dvorak in there I thought I'd try to smash it in there.

greetings

/ker
Parent - - By Newton [de] Date 2013-01-23 12:54
Hi ker, thank you for your effort. You surely got into the active community fast! So, welcome to the OC community! :-)

However, I think that this doesn't make much sense. DVORAK was added in times where the key configuration feature wasn't implemented yet, now it's just in because nobody bothered to remove it again. We already talked about the issue with the key configurations as there were also some French people complaining that it doesn't work for they AZERTY keyboard layout. We resolved that the next wise thing to do is to implement the keyboard controls independently of the chosen keyboard layout. So the A key for example would be always the key that is left to the CAPS LOCK key regardless of which keyboard layout one has.
Unfortunately, noone got around to do that yet, mainly because I think nobody does know exactly how to do this.
Parent - - By Clonk-Karl [de] Date 2013-01-23 13:35

> DVORAK was added in times where the key configuration feature wasn't implemented yet, now it's just in because nobody bothered to remove it again.


Please keep as long as layout-independent controls are not yet available :)
Reply
Parent - By Newton [de] Date 2013-01-23 15:48
I won't bother
Parent - - By Sven2 [de] Date 2013-01-23 13:40

> Unfortunately, noone got around to do that yet, mainly because I think nobody does know exactly how to do this.


What? Engine support for Windows is already done (supply scan codes in hex format as $%x). I believe it's also implemented for X11. I don't know if they share the same scan codes though. Didn't we do that at the last OC release meeting?
Parent - - By ker [de] Date 2013-01-23 13:42
for gtk there's nothing in master. is there a branch I could have a look at?
Parent - - By Clonk-Karl [de] Date 2013-01-23 14:00

> I believe it's also implemented for X11. I don't know if they share the same scan codes though. Didn't we do that at the last OC release meeting?


Yes, but as we have learned at said meeting, the scancodes are different.
Reply
Parent - - By Newton [de] Date 2013-01-23 15:55 Edited 2013-01-23 15:58
So the solution we will aim for is to have a function with #ifdef each for windows and linux that translates the OC-internal keycodes into platform-dependent keycodes?

Edit: Wouldn't it make sense then to always specify keys like "A" "D" etc. in the PlayerControls.txt and internally translate those into keycodes? Otherwise the person who edits the PlayerControls.txt always has to know which (OC-)keycode is supposed to be which key.
Parent - By Newton [de] Date 2013-01-23 16:15
Hmm, diving deeper into that matter, how can the keyboard scancodes (not the virtual key codes) be different between linux and windows? I mean, that should be the code that comes from the hardware, from the keyboard, no?
Parent - By Sven2 [de] Date 2013-01-23 16:22
Yes, specifying your keys in terms of an US layout keyboard and translating them would definitely make a lot of sense. I think we discussed that at the meeting but didn't end up implementing it. It wouldn't be that much work actually.

The feature to supply scan codes would remain for people who want to specify keys not present on a US keyboard.
Parent - - By Günther [de] Date 2013-01-23 22:00
The engine support is backwards, though - it converts scancodes to virtual codes, and compares the latter. While this is the only feasible way to implement the feature for one platform only, we really should make the internal format be the scancodes, and convert the text representation in the configuration into that - or store the scancodes directly in case the user configured them. Having the text representation be what's printed on a DE or US keyboard on the key with that scancode certainly makes sense. We should probably implement this for Windows and Linux asap and let Mac catch up. See also http://bugs.openclonk.org/view.php?id=729
Reply
Parent - By Sven2 [de] Date 2013-01-24 19:11
I thought about that when I implemented the change, but ended up not doing it because it would have been a lot more places to consider. If someone else wants to do it, go ahead. I'm kinda tired of controls...
Parent - - By ker [de] Date 2013-01-23 13:41
it's actually rather trivial if you just want the keys for control.
but it would mess up entering text.
having both possible requires a switch to the us-layout on startup, creating a custom map of all useful keys, and switching back.
from then on, for control keys, the map has to be queried for every key event
Parent - By Sven2 [de] Date 2013-01-23 13:51
Text input is done separately anyway, because it might involve complicated shift handlings, modifier keys for accents, IMEs, etc.. For Windows, there's a different window message for text character input (WM_CHAR vs WM_KEYDOWN). I don't know about the other systems but I'm sure the OS provides character conversion there as well.
Parent - Date 2013-01-26 15:13
Up Topic Development / Developer's Corner / Neo2 Keyboard Layout

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill