Re: [hatari-devel] Enhanced keymap support

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


Hello,

This is a new version of keymap_fr_pc.cfg giving more explanations about the mapping :

- ST modifiers are set even if Host corresponding modifiers are already set.
- NO_XXX  ST modifiers usage cases with examples.

Yves

Le 07/08/2022 à 20:53, Yves Le Berre a écrit :
Hello,

As discussed on october 2021, I tried to add NO_XXX, XXX = {CONTROL, LSHIFT, RSHIFT, ALT}
to ST modifiers.

With hatari (git master) + enhanced_keymap_patches.tar.gz + emutos512k-1.1.1 (fr) and the following mapping, the '§' key on PC side gives the '§' key on ST side :
0x38|SHIFT,0x07|NO_LSHIFT|NO_RSHIFT

Previously, the key was mapped by :
0x38|SHIFT,ALT_XXX|221

I suppose the patch '0014-Add-NO-XXX-mod.patch' miss a lot of functionnal requirements and could cause various bugs as I do not understand the whole code in keymap.c and ikbd.c.


In attachment, you'll find the files :

1) enhanced_keymap_patches.tar.gz which contains all patches to apply to master.
2) keymap_fr_pc_no_xxx.cfg which contains mapping.

Yves
#-------------------------------------------------------------------------------
# Hatari Key mapping for French PC Keyboard layout (105 keys)
#
# Following patches must be applied to master :
#
# 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
# 0014-Add-NO-XXX-mod.patch
#
# These patches are filed in enhanced_keymap_patches.tar.gz
# which has been posted to Hatari-devel@xxxxxxxxxxxxxxxxxxx
# on August 7 2022.
#-------------------------------------------------------------------------------
# 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,
#                       NO_CONTROL,
#                       NO_LSHIFT,
#                       NO_RSHIFT,
#                       NO_ALT.
#
# ALT_XXX is a special case where ST scancode is the decimal code
# (32 to 255) in atari character table. ALT_XXX cannot be set with
# another ST modifier.
#-------------------------------------------------------------------------------
# Empty lines are ignored.
# lines beginning with a hash '#' or semicolon ';' (comments) 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.
#
# This is because Hatari search the first entry where :
# input scancode = entry scancode
# and
# input mods and entry mods = entry mods.
#
# If entries are given in this order :
#
# scancode|mod1               (1)
# scancode|mod1|mod2          (2)
# scancode                    (3)
#
# and input is scancode + mod1 + mod2
#
# the entry used by Hatari will be (1) because
# input scancode = entry scancode
# and
# input mods and entry mods = entry mods.
# i-e : (mod1 + mod2) and mod1 = mod1.
#
# The worst order would be to place scancode without modifier entry
# before same scancode with any modifier entry because
# any modifier and no modifier = no modifier.
# The user could no longer use any modifier key for this scancode.
#-------------------------------------------------------------------------------
# REMEMBER : 
#
# 1) ST Key definition set modifiers keys, EVEN if corresponding
#    Host modifiers are already set (except ALT_XXX which cannot
#    be set with another ST modifier)
#
#    Example :
#
#    [_] + [SHIFT]           =>     [8]
#    0x25|SHIFT,0x09|LSHIFT|RSHIFT
#
#    LSHIFT and RSHIFT modifier are set but not needed ST side as
#    SHIFT is already set Host side.
#
# 2) NO_XXX ST modifiers disable corresponding ST modifiers.
#    NO_LSHIFT disables LSHIFT,
#    NO_RSHIFT disables RSHIFT,
#    NO_CONTROL disables CONTROL,
#    NO_ALT disables ALT.
#
#    Examples :
#
#    a) Allow a key with modifier PC side to map a key without
#       same modifier ST side :
#
#    [!] + [SHIFT]           =>     [§]
#    0x38|SHIFT,0x07|NO_LSHIFT|NO_RSHIFT
#
#    b) Disallow a key with modifier PC side to map a key with
#       same modifier ST side :
#
#    [^] + [SHIFT] + [LALT]  =>     [¨]
#    [^] + [LALT]            =>     [^]
#    [^] + [SHIFT]           =>     [¨]
#    [^]                     =>     [^]
#    0x2f|SHIFT,0x1a|LSHIFT|RSHIFT|NO_ALT
#    0x2f,0x1a|NO_ALT
#
#    instead of
#
#    [^] + [SHIFT] + [LALT]  =>     '{'
#    [^] + [LALT]            =>     '['
#    [^] + [SHIFT]           =>     ["]
#    [^]                     =>     [^]
#    0x2f|SHIFT,0x1a|LSHIFT|RSHIFT
#    0x2f,0x1a
#
# 3) Guest key definitions using ALT_XXX disable auto-repeat.
#
# 4) Hatari uses shortcuts to specific functions in keyboard
#    setup and number of these shortcuts use RALT modifier.
#    So, you must remap the key used by Hatari if you want use
#    it in your mappings.
#
#    Example : Hatari maps [g] + [RALT] to 'take screenshot' shortcut.
#    If you want to use [g] + [RALT] in your mapping, you must map
#    another key than [g] to 'take screenshot' shortcut.
# 
# 5) Any host scancode or keyname not mapped here defaults to
#    symbolic keyboard mapping (corresponding to TOS rom)
#
# 6) Mappings have been tested with a french PC keyboard (105 keys)
#    and with localized French and USA TOS roms as well as 1024K EmuTOS.
#    They all produce expected characters (and display expected symbols)
#    on Hatari screen.
#-------------------------------------------------------------------------------
# Comments before mappings show guest symbol obtained when key and
# given modifiers for host symbol (french keyboard) are entered.
#-------------------------------------------------------------------------------

# [q]                     =>     [q]
# 0x04 or 4 or q
0x04,0x1e

# [c] + [LALT]            =>     [©]
# 0x06 or 6 or c
0x06|LALT,ALT_XXX|189

# [e] + [RALT]            =>     [€]
# 0x08 or 8 or e
0x08|RALT,ALT_XXX|238

# [i] + [SHIFT] + [LALT]  =>     [∞]
# [i] + [LALT]            =>     [π]
# 0x0c or 12 or i
0x0c|SHIFT|LALT,ALT_XXX|223
0x0c|LALT,ALT_XXX|227

# [,] + [SHIFT]           =>     [?]
# [,]                     =>     [,]
# 0x10 or 16
0x10|SHIFT,0x32|LSHIFT|RSHIFT
0x10,0x32

# [o] + [SHIFT] + [LALT]  =>     [Œ]
# [o] + [SHIFT] + [CTRL]  =>     [Ø]
# [o] + [LALT]            =>     [œ]
# [o] + [CTRL]            =>     [ø]
# 0x12 or 18 or o
0x12|SHIFT|LALT,ALT_XXX|181
0x12|SHIFT|CTRL,ALT_XXX|178
0x12|LALT,ALT_XXX|180
0x12|CTRL,ALT_XXX|179

# [a] + [SHIFT] + [LALT]  =>     [Æ]
# [a] + [SHIFT] + [CTRL]  =>     [Å]
# [a] + [LALT]            =>     [æ]
# [a] + [CTRL]            =>     [å]
# [a]                     =>     [a]
# 0x14 or 20 or a
0x14|SHIFT|LALT,ALT_XXX|146
0x14|SHIFT|CTRL,ALT_XXX|143
0x14|LALT,ALT_XXX|145
0x14|CTRL,ALT_XXX|134
0x14,0x10

# [r] + [LALT]            =>     [®]
# 0x15 or 21 or r
0x15|LALT,ALT_XXX|190

# [s] + [LALT]            =>     [ß]
# 0x16 or 22 or s
0x16|LALT,ALT_XXX|158

# [t] + [LALT]            =>     [™]
# 0x17 or 23 or t
0x17|LALT,ALT_XXX|191

# [z]                     =>     [z]
# 0x1a or 26 or z
0x1a,0x11

# [w]                     =>     [w]
# 0x1d or 29 or w
0x1d,0x2c

# [&] + [SHIFT] + [RALT]  =>     [¼]
# [&] + [RALT]            =>     [½]
# 0x1e or 30
0x1e|SHIFT|RALT,ALT_XXX|172
0x1e|RALT,ALT_XXX|171

# [é] + [CAPS]            =>     [É]
# [é] + [RALT]            =>     [~]
# 0x1f or 31
0x1f|CAPS,ALT_XXX|144
0x1f|RALT,0x2b|LSHIFT|RSHIFT|ALT

# ["] + [RALT]            =>     [#]
# 0x20 or 32
0x20|RALT,0x2b

# ['] + [RALT]            =>     [{]
# 0x21 or 33
0x21|RALT,0x1a|LSHIFT|RSHIFT|ALT

# [(] + [RALT]            =>     '['
# 0x22 or 34
0x22|RALT,0x1a|ALT

# [-] + [RALT]            =>     [|]
# [-] + [SHIFT]           =>     [6]
# [-]                     =>     [-]
# 0x23 or 35
0x23|RALT,0x2b|LSHIFT|RSHIFT
0x23|SHIFT,0x07|LSHIFT|RSHIFT
0x23,0x0d

# [è] + [RALT]            =>     [`]
# 0x24 or 36
0x24|RALT,0x29

# [_] + [RALT]            =>     [\]
# [_] + [SHIFT]           =>     [8]
# [_]                     =>     [_]
# 0x25 or 37
0x25|RALT,0x28|ALT
0x25|SHIFT,0x09|LSHIFT|RSHIFT
0x25,0x0d|LSHIFT|RSHIFT

# [ç] + [RALT]            =>     [^]
# 0x26 or 38
0x26|RALT,ALT_XXX|94

# [à] + [RALT]            =>     [@]
# 0x27 or 39
0x27|RALT,0x2b|ALT

# [)] + [RALT]            =>     ']'
# [)] + [SHIFT]           =>     [°]
# 0x2d or 45
0x2d|RALT,0x1b|NO_LSHIFT|NO_RSHIFT|ALT
0x2d|SHIFT,0x0c|LSHIFT|RSHIFT|NO_ALT

# [=] + [SHIFT] + [RALT]  =>     [±]
# [=] + [RALT]            =>     [}]
# [=] + [SHIFT]           =>     [+]
# [=]                     =>     [=]
# 0x2e or 46
0x2e|SHIFT|RALT,ALT_XXX|241
0x2e|RALT,0x1b|LSHIFT|RSHIFT|ALT
0x2e|SHIFT,0x35|LSHIFT|RSHIFT
0x2e,0x35

# followed by vowel => vowel with this accent,
# followed by space or same accent => accent alone.
# [^] + [SHIFT]           =>     [¨]
# [^]                     =>     [^]
# 0x2f or 47
0x2f|SHIFT,0x1a|LSHIFT|RSHIFT|NO_ALT
0x2f,0x1a|NO_ALT

# [$] + [SHIFT] + [RALT]  =>     [¶]
# [$] + [RALT]            =>     [¤]
# [$] + [SHIFT]           =>     [£]
# [$]                     =>     [$]
# 0x30 or 48
0x30|SHIFT|RALT,ALT_XXX|188
0x30|RALT,ALT_XXX|249
0x30|SHIFT,0x29|LSHIFT|RSHIFT
0x30,0x1b

# [*] + [RALT]            =>     [÷]
# [*] + [SHIFT]           =>     [µ]
# [*]                     =>     [*]
# 0x31 or 49
0x31|RALT,ALT_XXX|246
0x31|SHIFT,ALT_XXX|230
0x31,0x1b|LSHIFT|RSHIFT|NO_ALT

# [m]                     =>     [m]
# 0x33 or 51 or m
0x33,0x27

# [ù] + [SHIFT]           =>     [%]
# [ù]                     =>     [ù]
# 0x34 or 52
#0x34|LALT,ALT_XXX|151
0x34|SHIFT,0x28|LSHIFT|RSHIFT
0x34,0x28|NO_ALT

# [²] + [RALT]            =>     [~]
# [²] + [SHIFT]           =>     [³]
# [²]                     =>     [²]
# 0x35 or 53
0x35|RALT,0x2b|LSHIFT|RSHIFT|ALT
0x35|SHIFT,ALT_XXX|254
0x35,ALT_XXX|253

# [;] + [SHIFT]           =>     [.]
# [;]                     =>     [;]
# 0x36 or 54
0x36|SHIFT,0x33|LSHIFT|RSHIFT
0x36,0x33

# [:] + [SHIFT]           =>     [/]
# [:]                     =>     [:]
# 0x37 or 55
0x37|SHIFT,0x34|LSHIFT|RSHIFT
0x37,0x34

# [!] + [SHIFT]           =>     [§]
# [!]                     =>     [!]
# 0x38 or 56
0x38|SHIFT,0x07|NO_LSHIFT|NO_RSHIFT
0x38,0x09

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


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