Re: [hatari-devel] Enhanced keymap support

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


Hello,

I apologize for the big patch 'keymap.c.patch'. To return to enhanced keymap patches series :

- I Added a first patch (0001) adding screen.h include in keymap.c
  to eliminate offset lines in following patches,
- Then, I added the ordered patches in the series
  (renumbered from 0001 - 0014 to 0002 - 0015),
- Then, I added a patch (0016) deleting screen.h include in keymap.c
  (and incidentally change strlcpy inserted in patches 0006 and 0009 to Str_Copy).

In attachment, you'll find the files :

1) enhanced_keymap_patches.tar.gz which contains the patches to apply to master :

0001-Master-changes-before-applying-0002-to-0015.patch
0002-Keymap_LoadRemapFile-refactor-rewrite.patch
0003-Switch-to-using-KeyMapping-struct-and-KeysDown-array.patch
0004-Clear-KeysDown-key-mapping-state-on-reset.patch
0005-Add-defines-for-some-of-the-ST-scancode-values.patch
0006-Support-for-specifying-ST-key-modifiers-in-the-mappi.patch
0007-Add-ALT-XXX-sequence-insert-support-for-keymaps.patch
0008-Add-trace-output-for-ST-key-modifiers.patch
0009-Support-for-specifying-PC-SDL-key-modifiers-in-the-m.patch
0010-Keymap-accept-also-0x-prefixed-hex-values-for-scanco.patch
0011-Fix-improve-keymap-file-SDL-key-name-parsing.patch
0012-Fix-ALT_XXX-scancode-handling.patch
0013-Fix-Single-Mod-Host-Parsing.patch
0014-Remap-mod.patch
0015-Add-NO-XXX-mod.patch
0016-Master-changes-after-applying-0002-to-0015.patch

2) keymap_fr_pc.cfg which contains the mapping.

Yves

Le 03/10/2022 à 17:53, Thomas Huth a écrit :
Am Sun, 2 Oct 2022 15:57:18 +0200
schrieb Yves Le Berre <yves.le_berre@xxxxxxxxx>:

Hello,

Due to Thomas recent changes :

- Reduce our dependencies to screen.h,
- Replace strlcpy() with a better implementation.

I adapted enhanced_keymap patches by rebasing and grouping the patches
by filenames rather by added/modified function.
Please don't squash patches together in such a big patch. That makes the
changes very hard to review.

Eero, you once started looking into this problem, do you still plan to
take care of this? Or don't you have time for this anymore?

  Thomas

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

#-------------------------------------------------------------------------------
# Hatari Key mapping for French PC Keyboard layout (105 keys)
#
# Following patches must be applied to master :
#
# 0001-Master-changes-before-applying-0002-to-0015.patch
# 0002-Keymap_LoadRemapFile-refactor-rewrite.patch
# 0003-Switch-to-using-KeyMapping-struct-and-KeysDown-array.patch
# 0004-Clear-KeysDown-key-mapping-state-on-reset.patch
# 0005-Add-defines-for-some-of-the-ST-scancode-values.patch
# 0006-Support-for-specifying-ST-key-modifiers-in-the-mappi.patch
# 0007-Add-ALT-XXX-sequence-insert-support-for-keymaps.patch
# 0008-Add-trace-output-for-ST-key-modifiers.patch
# 0009-Support-for-specifying-PC-SDL-key-modifiers-in-the-m.patch
# 0010-Keymap-accept-also-0x-prefixed-hex-values-for-scanco.patch
# 0011-Fix-improve-keymap-file-SDL-key-name-parsing.patch
# 0012-Fix-ALT_XXX-scancode-handling.patch
# 0013-Fix-Single-Mod-Host-Parsing.patch
# 0014-Remap-mod.patch
# 0015-Add-NO-XXX-mod.patch
# 0016-Master-changes-after-applying-0002-to-0015.patch
#
# These patches are filed in enhanced_keymap_patches.tar.gz
# which has been posted to Hatari-devel@xxxxxxxxxxxxxxxxxxx
# on October 5 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.
#-------------------------------------------------------------------------------
# lines beginning with a hash '#' or semicolon ';' (comments) are ignored.
# Empty lines 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) If Host modifiers are set, there is no need to set corresponding
#    ST modifiers, but to show the right ST Key definition, ST modifiers
#    are set in mappings EVEN if corresponding Host modifiers are set.
#    This does not apply to
#    - ALT_XXX which cannot be set with another ST modifier,
#    - NO_XXX which must be set to disable corresponding Host modifier.
#
#    Example :
#
#    [_] + [SHIFT]           =>     [8]
#    0x25|SHIFT,0x09|LSHIFT|RSHIFT
#
#    LSHIFT and RSHIFT ST modifiers 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 :
#
#    [ù] + [LALT]            =>     [ù]
#    [ù] + [SHIFT]           =>     [%]
#    [ù]                     =>     [ù]
#    0x2f|SHIFT,0x1a|LSHIFT|RSHIFT|NO_ALT
#    0x2f,0x1a|NO_ALT
#
#    instead of
#
#    [ù] + [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

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

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

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

# [(] + [RALT]            =>     '['
# 0x22 or 34
0x22|RALT,0x1a|NO_LSHIFT|NO_RSHIFT|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|NO_LSHIFT|NO_RSHIFT

# [_] + [RALT]            =>     [\]
# [_] + [SHIFT]           =>     [8]
# [_]                     =>     [_]
# 0x25 or 37
0x25|RALT,0x28|ALT|NO_LSHIFT|NO_RSHIFT
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|NO_LSHIFT|NO_RSHIFT

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

# [=] + [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|SHIFT,0x28|LSHIFT|RSHIFT|NO_ALT
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/