Re: [hatari-devel] Keyboard layout and two small bugs

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi,

On 05/06/2018 01:07 PM, Christian Zietz wrote:
Thorsten Otto schrieb:
Apropos keyboard layout: there is one conceptional problem with that mapping.
Hatari currently only allows to map one key to another. The problem with this
is that, on eg. german keyboards, there are some ascii characters physically
located on different keys on a pc keyboard compared to an Atari keyboard. For
example the left bracket is located on AltGr+8 on a pc keyboard, but Alt-ö on
an Atari. That means, theoretically, hatari should produce scancode 39 when
pressing ö, and also when pressing AltGr+8, because that is what TOS would
expect (assuming i use a german TOS version). OTOH, pressing 8 alone (or with
shift) should produce scancode 9, because the mapping of that key is
identical.

Please let's *not* go down this route with Hatari! Needing to map PC key
combinations to (different) Atari key combininations massively increases
code complexity and hence the potential for bugs and the amount of
testing required. Be aware that you have to consider N * M cases then.
What if someone with a German keyboard wants to run US TOS? Or French
keyboard, German TOS? Etc.

Also this opens up new compatibility issues. Let me give you an example:
Let's suppose you want to type a tilde ("~"), which is AltGr and "+" on
a German PC keyboard but a separate key on the Atari keyboard.

So you press AltGr (right Alt). Hatari of course cannot know of your
intention of wanting to type ~, so it'll send the scancode for "pressing
Alt" to the emulated Atari. TOS will therefore now register the Alt
modified as pressed. Now you press the "+" key. Now Hatari first has to
fake a "releasing Alt" scancode for TOS before sending the scancode of
the "~" key on the Atari keyboard. Now, let's assume some crazy Atari
program uses a shortcut of Alt and "~". How do you type that with your
proposed mapping scheme?

I think only perfectly working way is to do the mapping at the host
OS level, and use no mapping in Hatari.

On Linux that would mean configuring X server:
	https://www.x.org/releases/current/doc/xorg-docs/input/

Some of the Wayland desktops (Gnome) use same X configuration files
for configuing keyboard, so these changes might work also with Wayland.


If somebody's interested enough in this, and provides tested X key
mapping files for different Atari keyboards, we can ship them with
Hatari.


That problem currently prevents me from producing those characters in most
cases.

Why does it *prevent* you typing characters like brackets in Hatari?
Simply use Alt+ö and so on, like you would do an Atari keyboard. It
works fine.

I only have two small issues with the keyboard mapping (German PC
keyboard [1], German TOS with German Atari keyboard [2] table), which I
think are genuine bugs in Hatari.
>
On the one hand with the symbolic keyboard mapping, the key that
produces "´" and "`" is dead. I think it should map to the corresponding
key on the Atari keyboard.
On the other hand, with the scancode mapping, while the key mentioned
above works, both the "<"/">" key and the "#"/"'" key on the PC keyboard
produce "<"/">" on the Atari. There is no key on the PC keyboard that is
mapped to "#"/"^" on the Atari. This is indeed the only case where one
is actually prevented typing a character like Thorsten complained above.
This is particularly annoying when coding C. The "#"/"'" on the keyboard
should be mapped to "#"/"^".

This is with Hatari 2.1 and Windows 10.

Is this with SDL1, or SDL2 build of Hatari, or both?

(There are some differences between SDL versions also in how
keyboard is handled.)


	- Eero


Regards
Christian

[1] <https://en.wikipedia.org/wiki/QWERTZ#/media/File:KB_Germany.svg>
[2]
<http://atariage.com/forums/uploads/monthly_06_2016/post-12488-0-47583800-1466276118.jpg>




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/