Re: [hatari-devel] Enhanced keymap support

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


Hello,

My precedent patch was incorrect.
it tried to separate pc mods right and left for (SHIFT, CTRL, ALT, GUI)
but mappings do not give all expected results. For instance :

# '=' []       ===       '+' [SHIFT]      ===      '}' [RALT]
# 'π' [CTRL]   ===       '∞' [SHIFT + CTRL]
0x2e|SHIFT|CTRL,ALT_XXX|223
0x2e|RALT,0x1b|ALT|LSHIFT
0x2e|CTRL,ALT_XXX|227
0x2e|SHIFT,0x35|LSHIFT
0x2e,0x35

when you key symbol '=' with no modifier, you get '=' : OK,
when you key symbol '=' with modifier LSHIFT or RSHIFT, you get '+' : OK,
when you key symbol '=' with modifier RALT, you get '}' : OK,
when you key symbol '=' with modifier LCTRL, you get 'π' : OK,
when you key symbol '=' with modifier RCTRL, you get 'π' : OK,
when you key symbol '=' with modifiers LCTRL and LSHIFT, you get '∞' : OK,
when you key symbol '=' with modifiers RCTRL and RSHIFT, you get '∞' : OK,

But

when you key symbol '=' with modifiers LCTRL and RSHIFT, you get 'π' : KO.
when you key symbol '=' with modifiers RCTRL and LSHIFT, you get 'π' : KO.

So, to enable multiple modifiers without distinguishing if left or right
modifier was used (as in preceeding configuration example),
i changed the last patch of the serie : 0013-Remap-mod-left-or-right.patch to
0013-Remap-mod.patch. Results are those expected.
All the patches of the serie are filed in enhanced_keymap_patches.tar.gz (cf. attachment)
and must be applied to master.

Yves


Le 30/01/2022 à 23:26, Yves Le Berre a écrit :
Hello,

Continuing with enhanced keymap, i tried to adjust the code which remaps SDL key to ST key. Patch 0012-Fix-Single-Mod-Host-Parsing.patch allowed several host modifiers to be or-ed together as specified in configuration file but this was not plainly used in Keymap_RemapKeyToSTKey function where only the SHIFT modifier was tested : if (pcmod == KMOD_SHIFT)...

All the modifiers which have KMOD_Lxxx and KMOD_Rxxx have KMOD_xxx = KMOD_Lxxx | KMOD_Rxxx. So i wrote a patch allowing SHIFT, CTRL, ALT, GUI to function together as SHIFT did alone (Function GetSdlModifier already returned the good KMOD_xxx value and only comments with
'both of above' needs to be changed to 'either of above')

In attachment :
1) the serie of patches for enhanced keymap : enhanced_keymap_patches.tar.gz    containing the last patch 0013-Remap-mod-left-or-right.patch. This serie must be applied to master. 2) Keymap for french PC keyboard as i changed the documentation and some host LSHIFT
   or RSHIFT to SHIFT.

Do you agree with these changes ?

Regards,
Yves

Attachment: enhanced_keymap_patches.tar.gz
Description: application/gzip

#-------------------------------------------------------------------------------
# Hatari Key mapping for French PC Keyboard when patches for enhanced keymap
# are applied to master.
#
# These patches are :
#
# 0001-Keymap_LoadRemapFile-refactor-rewrite.patch
# 0002-Switch-to-using-KeyMapping-struct-and-KeysDown-array.patch
# 0003-Clear-KeysDown-key-mapping-state-on-reset.patch
# 0004-Add-defines-for-some-of-the-ST-scancode-values.patch
# 0005-Support-for-specifying-ST-key-modifiers-in-the-mappi.patch
# 0006-Add-ALT-XXX-sequence-insert-support-for-keymaps.patch
# 0007-Add-trace-output-for-ST-key-modifiers.patch
# 0008-Support-for-specifying-PC-SDL-key-modifiers-in-the-m.patch
# 0009-Keymap-accept-also-0x-prefixed-hex-values-for-scanco.patch
# 0010-Fix-improve-keymap-file-SDL-key-name-parsing.patch
# 0011-Fix-ALT_XXX-scancode-handling.patch
# 0012-Fix-Single-Mod-Host-Parsing.patch
# 0013-Remap-mod.patch
#
# they are filed in enhanced_keymap_patches.tar.gz.
#-------------------------------------------------------------------------------
# Mapping Format :: Host (PC) key definition , Guest (ST) key definition
#
# Key definition :: scancode | modifiers
# or (host only) :: keyname  | modifiers
#
# Host key definition is separated from guest key definition by a comma ','.
# scancode or keyname and modifiers (several possible) are separated by a
# pipe '|' and may be interverted.
#
# Scancode is decimal or hexa (prefixed with 0x)
#
# Host modifiers are  : LSHIFT (Left Shift),
#                       RSHIFT (Right Shift),
#                       SHIFT (LSHIFT or RSHIFT),
#                       LCTRL (Left Control),
#                       RCTRL (Right Control),
#                       CTRL (LCTRL or RCTRL),
#                       LALT (Left Alt),
#                       RALT (Right Alt / Alt gr),
#                       ALT (LALT or RALT),
#                       LGUI (Left Windows),
#                       RGUI (Right Windows),
#                       GUI (LGUI or RGUI),
#                       CAPS (Caps Lock),
#                       MODE (Menu),
#                       NUM (Num Lock).
#
# Guest modifiers are : CONTROL,
#                       LSHIFT,
#                       RSHIFT,
#                       ALT,
#                       ALT_XXX.
#
# ALT_XXX is a special case where ST scancode is the decimal code
# (32 to 255) in atari character table.
#
# Empty lines are ignored.
# Comments (lines beginning with a hash '#' or semicolon ';') are ignored.
#-------------------------------------------------------------------------------
# Keys are mapped in Host scancode order. If a same Host scancode
# is mapped multiple times, the associated modifiers must be ordered.
#
# For instance, a PC host scancode with three possible modifiers ;-)
# mod1, mod2, mod3 must be configured (Host key definition) like this :
#
# scancode|mod1|mod2|mod3     (1)
# scancode|mod1|mod2          (2)
# scancode|mod1|mod3          (2)
# scancode|mod2|mod3          (2)
# scancode|mod1               (3)
# scancode|mod2               (3)
# scancode|mod3               (3)
# scancode                    (4)
#
# Line marked (1) (3 modifiers) must be first,
# Then lines marked (2) (2 modifiers) in any order,
# Then lines marked (3) (1 modifier) in any order,
# Then line marked (4) (no modifier) must be last.
#-------------------------------------------------------------------------------
# Comments before mappings show host symbols and modifiers used
# for this mapping as 'symbol' [mods]   ===   'symbol' [mods]...
#-------------------------------------------------------------------------------
# Warning: remember Hatari uses shortcuts to specific functions
# in keyboard setup and number of these shortcuts use RALT modifier.
#-------------------------------------------------------------------------------

# 'q' []       ===       'Q' [SHIFT]
0x04,0x1e

# 'c' []       ===       'C' [SHIFT]      ===      '©' (LALT)
0x06|LALT,ALT_XXX|189

# 'e' []       ===       'E' [SHIFT]      ===      '€' (RALT)
0x08|RALT,ALT_XXX|238

# ',' []       ===       '?' [SHIFT]
0x10|SHIFT,0x32|LSHIFT
0x10,0x32

# 'œ' [LALT]   ===       'Œ' [SHIFT + LALT]
0x12|LALT|SHIFT,ALT_XXX|181
0x12|LALT,ALT_XXX|180

# 'æ' [LALT]   ===       'Æ' [SHIFT + LALT]
0x14|LALT|SHIFT,ALT_XXX|146
0x14|LALT,ALT_XXX|145

# 'a' []       ===       'A' [SHIFT]
0x14,0x10

# 'r' []       ===       'R' [SHIFT]      ===      '®' [LALT]
0x15|LALT,ALT_XXX|190

# 'z' []       ===       'Z' [SHIFT]
0x1a,0x11

# 'w' []       ===       'W' [SHIFT]
0x1d,0x2c

# '&' []       ===       '1' [SHIFT]
0x1e,0x02

# 'é' []       ===       '2' [SHIFT]      ===      '~' [RALT]
0x1f|RALT,0x2b|ALT|LSHIFT
0x1f|CAPS,ALT_XXX|144

# '"' []       ===       '3' [SHIFT]      ===      '#' [RALT]
0x20|RALT,0x2b
0x20,0x04

# "'" []       ===       '4' [SHIFT]      ===      '{' [RALT]
0x21|RALT,0x1a|ALT|LSHIFT
0x21,0x05

# '(' []       ===       '5' [SHIFT]      ===      '[' [RALT]
0x22|RALT,0x1a|ALT
0x22,0x06

# '-' []       ===       '6' [SHIFT]      ===      '|' [RALT]
0x23|RALT,0x2b|LSHIFT
0x23|SHIFT,0x07|LSHIFT
0x23,0x0d

# 'è' []       ===       '7' [SHIFT]      ===      '`' [RALT]
0x24|RALT,0x29

# '_' []       ===       '8' [SHIFT]      ===      '\' [RALT]
0x25|RALT,0x28|ALT
0x25|SHIFT,0x09|LSHIFT
0x25,0x0d|LSHIFT

# 'ç' []       ===       '9' [SHIFT]      ===      '^' [RALT]
0x26|RALT,ALT_XXX|94

# 'à' []       ===       '0' [SHIFT]      ===      '@' [RALT]
0x27|RALT,0x2b|ALT

# ')' []       ===       '°' [SHIFT]      ===      ']' [RALT]
0x2d|RALT,0x1b|ALT
0x2d|SHIFT,0x0c|LSHIFT

# '=' []       ===       '+' [SHIFT]      ===      '}' [RALT]
# 'π' [CTRL]   ===       '∞' [SHIFT + CTRL]
0x2e|SHIFT|CTRL,ALT_XXX|223
0x2e|RALT,0x1b|ALT|LSHIFT
0x2e|CTRL,ALT_XXX|227
0x2e|SHIFT,0x35|LSHIFT
0x2e,0x35

# followed by vowel => vowel with this accent,
# followed by space or same accent => accent alone.
# '^' []       ===       '"' [SHIFT]
0x2f|SHIFT,0x1a|LSHIFT
0x2f,0x1a

# '$' []       ===       '£' [SHIFT]      ===      '¤' [RALT]
0x30|RALT,ALT_XXX|249
0x30|SHIFT,0x29|LSHIFT
0x30,0x1b

# '*' []       ===       'µ' [SHIFT]
0x31|SHIFT,ALT_XXX|230
0x31,0x1b|LSHIFT

# 'm' []       ===       'M' [SHIFT]
0x33,0x27

# 'ù' []       ===       '%' [SHIFT]
0x34|SHIFT,0x28|LSHIFT
0x34,0x28

# '²' []       ===       '~' [SHIFT]
0x35|SHIFT,0x2b|ALT|LSHIFT
0x35,ALT_XXX|253

# ';' []       ===       '.' [SHIFT]
0x36|SHIFT,0x33|LSHIFT
0x36,0x33

# ':' []       ===       '/' [SHIFT]
0x37|SHIFT,0x34|LSHIFT
0x37,0x34

# '!' []       ===       '§' [SHIFT]
0x38|SHIFT,ALT_XXX|221
0x38,0x09

# '≤' [ALT]    ===       '≥' [SHIFT + ALT]
# '«' [CTRL]   ===       '»' [SHIFT + CTRL]
# '<' []       ===       '>' [SHIFT]
0x64|ALT|SHIFT,ALT_XXX|242
0x64|CTRL|SHIFT,ALT_XXX|175
0x64|ALT,ALT_XXX|243
0x64|CTRL,ALT_XXX|174
0x64|SHIFT,0x60|LSHIFT
0x64,0x60
#-------------------------------------------------------------------------------


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