Re: [hatari-devel] Enhanced keymap support

[ Thread Index | Date Index | More Archives ]

Am Fri, 5 Nov 2021 03:13:57 +0200
schrieb Eero Tamminen <oak@xxxxxxxxxxxxxx>:
> Hatari maps either SDL scancodes or keycodes (symbolic host dependent 
> character mappings).
> --- scancodes ---
> Locations for SDL scancodes are based on the USB standard, see 
> "Keyboard/Keypad Page" section in USB HID section:
> Which maps fairly closely to PC keyboard US layout (just using
> different codes):
> When those PC scancodes are converted to ST scancodes, user should
> get ST key that is in same location on the keyboard, which sidesteps
> the issue of the ST keyboard layout, because all ST keyboards are
> shaped the same.
> With scancodes, the problem is host keyboards that do not having keys
> in locations that have keys on ST.  When locations do not match, keys 
> cannot be mapped.  For such PC keyboards, one needs to use symbolic
> mapping.
> (Hatari already uses symbolic SDL keycode mapping, if it does not 
> recognize the scancode. I do not know whether AlGr combos & dead keys 
> belong to that category.)
> --- keycodes ---
> Problems:
> 1. Hatari symbolic key handling should have support for all keys in
> the Atari ST layout, but it does not.  E.g. several of them do not
> have SDL defines.
>    => key names could be used for mapping those  
> 2. Hatari ignores everything using AltGr, although that's needed e.g. 
> for @, [] and {} keys on Finnish keyboard.
> 3. mapping some of the keycodes properly requires knowing the current 
> TOS keyboard layout (US, French etc) to inject correct ST scancode,
> but Hatari currently hardcodes US layout.
>    => Could Hatari infer keyboard layout from TOS version,
> multilanguage TOS header, and NVRAM?

I think that just doesn't scale. Hatari could guess the right keys in
the most common cases, but IIRC there are also Atari programs that
change the layout during runtime...

Honestly, I think we should get completely rid of the symbolic keyboard
mapping nowadays (apart from the loadable keymappings). The symbolic
key mapping was mainly included since you could not rely on the scancode
layout with SDL1 (e.g. on macOS the layout was completely different
there), but with SDL2, we now have the guarantee that the scancode
layout it fixed (based on the USB standard, as you've mentioned it).

We then should teach users to think of the Atari keyboard layout when
typing keys (especially non-letters), and maybe provide some pictures
of the Atari keyboard with the keys and corresponding scancodes in
the manual.

For people who want to type special characters in a way that rather
matches their host keyboard, they then could use the key mapping
functionality (which should still be based on symbolic host key names,
of course, I don't mean to get rid of these - i.e. the loadable key
mapping with symbolic host keys should be done on top of "hard-coded"
scancode key mapping that is included in Hatari).

Makes sense?


Mail converted by MHonArc 2.6.19+