Re: [hatari-devel] Enhanced keymap support |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
Hello,
The problems described in my previous e-mail were intricated.
Case C (one single modifier allowed) masked case B :
The configuration file must declare host definitions for same scancode
sorted by 'modifiers having most bits up' to get the good mapping.
For instance if they are two mappings of same scancode with mod 0x100
and 0x101
The one with mod 0x101 must appear before the one with mod 0x100.
So, in Case B the first line of config file has a mapping without modifier.
Then this entry is used because (input modifiers AND mapping modifier) is
always equal to mapping modifier when mapping modifier is 0. I just don't
understand why the 'a' symbol was not displayed.
After applying a new patch 0012-Fix-Single-Mod-Host-Parsing.patch
(patch allowing several PC modifiers to be OR-ed : see attachment)
to the enhanced keymap patch series and changing configuration file as
....
# æ --- Æ
0x14|LALT|LSHIFT,ALT_XXX|146
0x14|LALT,ALT_XXX|145
# a --- A
0x14,0x10
....
Case C reports no error and display the good symbols.
I re-send the French PC keyboard configuration file as i changed
documentation
and added few symbols (œ, Œ, æ, Æ, ≤, ≥)
Yves
Le 08/01/2022 à 18:39, Yves Le Berre a écrit :
Hello,
First, Happy new year !
I just tried to add some mapping in config file to obtain 'æ' and 'Æ'.
These keys do not appear on french PC keyboard but may be obtained on
X in Linux in with 'a' key and Alt Gr modifier for 'æ' and with
'a' key, Alt Gr and (LSHIFT or RSHIFT) modifiers for 'Æ'.
As Key 'a' with Alt Gr modifier is assigned to 'record animation'
in default Hatari configuration, i tried to use LALT modifier.
--------------------------------------------------------------------------------
Case A
--------------------------------------------------------------------------------
Keymap configuration file :
# æ
0x14|LALT,ALT_XXX|145
# a
0x14,0x10
Input keyed in EmuCon :
- Key 'a' without modifier => OK, symbol 'a' displayed, trace :
key mapping from file: host 0x64 => guest 0x60
key down: sym=97 scan=20 mod=0x1000 name='A'
key mapping: 10 (keymap)
key map: sym=0x61 to ST-scan=0x10
key up: sym=97 scan=20 mod=0x1000 name='A'
LSHIFT:0 RSHIFT:0 CTRL:0 ALT:0
- Key 'a' + LALT modifier => OK, symbol 'æ' displayed, trace :
key down: sym=1073742050 scan=226 mod=0x1100 name='Left Alt'
key mapping: 38 (symbolic)
key map: sym=0x400000e2 to ST-scan=0x38
key down: sym=97 scan=20 mod=0x1100 name='A'
key mapping: 91 (keymap)
key map: sym=0x61 to ST-scan=0x91
key mod(s): ALT_XXX (0x38) + '1' (0x6d) + '4' (0x6a) + '5' (0x6b)
key up: sym=97 scan=20 mod=0x1100 name='A'
key mod(s): ALT_XXX (0x38)
LSHIFT:0 RSHIFT:0 CTRL:0 ALT:1
key up: sym=1073742050 scan=226 mod=0x1000 name='Left Alt'
LSHIFT:0 RSHIFT:0 CTRL:0 ALT:0
--------------------------------------------------------------------------------
Case B
--------------------------------------------------------------------------------
Keymap configuration file :
# a
0x14,0x10
# æ
0x14|LALT,ALT_XXX|145
Input keyed in EmuCon :
- Key 'a' without modifier => OK, symbol 'a' displayed, trace :
key down: sym=97 scan=20 mod=0x1000 name='A'
key mapping: 10 (keymap)
key map: sym=0x61 to ST-scan=0x10
key up: sym=97 scan=20 mod=0x1000 name='A'
LSHIFT:0 RSHIFT:0 CTRL:0 ALT:0
- Key 'a' with LALT modifier => KO, no symbol displayed, trace :
key down: sym=1073742050 scan=226 mod=0x1100 name='Left Alt'
key mapping: 38 (symbolic)
key map: sym=0x400000e2 to ST-scan=0x38
key down: sym=97 scan=20 mod=0x1100 name='A'
key mapping: 10 (keymap)
key map: sym=0x61 to ST-scan=0x10
key up: sym=97 scan=20 mod=0x1100 name='A'
LSHIFT:0 RSHIFT:0 CTRL:0 ALT:1
key up: sym=1073742050 scan=226 mod=0x1000 name='Left Alt'
LSHIFT:0 RSHIFT:0 CTRL:0 ALT:0
--------------------------------------------------------------------------------
Case C
--------------------------------------------------------------------------------
Keymap configuration file :
0x14|LALT,ALT_XXX|145
0x14|LALT|LSHIFT,ALT_XXX|146
0x14,0x10
Reloading file => Error, trace :
...
key mapping from file: host 0x14|LALT => guest ALT_XXX|145
ERROR: extra 'LSHIFT', PC/SDL modifier already set
WARN : Failed to parse host (PC/SDL) part '0x14|LALT|LSHIFT' of line ...
key mapping from file: host 0x14 => guest 0x10
...
Questions :
1) Why case A and B configurations give different results ?
2) Why several modifiers are not authorized on host side in case C ?
Hatari version with enhanced keymap patches reports this error
in HostSpecToKeymap function :
...
/* is it modifier? */
mod = GetSdlModifier(token);
if (mod)
{
if (mods)
{
Log_Printf(LOG_ERROR, "extra '%s', PC/SDL modifier already
set\n", token);
return false;
}
mods = mod;
continue;
}
...
mods could be rather or-ed with mod ?
Yves
Le 11/12/2021 à 23:29, Eero Tamminen a écrit :
Hi,
Thanks for verifying that the ALT_XXX fix works.
I'll be looking at PortMidi / MIDI stuff this weekend, so I'll have
time to look into NOxxx only later.
- Eero
--- hatari-master-a/src/keymap.c 2022-01-08 15:55:42.760580040 +0100
+++ hatari-master-b/src/keymap.c 2022-01-09 16:49:48.413928401 +0100
@@ -506,6 +506,7 @@
continue;
pcmod = mapping->pc.mods;
+ LOG_TRACE(TRACE_KEYMAP, "key mapping entry: mods=0x%x, pcmod=0x%x\n", mods, pcmod);
/* (at least) one shift used? */
if (pcmod == KMOD_SHIFT)
{
@@ -603,12 +604,7 @@
mod = GetSdlModifier(token);
if (mod)
{
- if (mods)
- {
- Log_Printf(LOG_ERROR, "extra '%s', PC/SDL modifier already set\n", token);
- return false;
- }
- mods = mod;
+ mods |= mod;
continue;
}
/* is it non-modifier, symbolic key name? */
#-------------------------------------------------------------------------------
# Hatari Key mapping for french pc keyboard
# (Patches for enhanced keymap from M. Eero Tamminen).
#
# 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 '|'
# 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 and RCTRL),
# LALT (left alt),
# RALT (right alt / alt gr),
# ALT (LALT and RALT),
# LGUI (left windows),
# RGUI (right windows),
# GUI (LGUI and RGUI),
# CAPS (cap 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.
#
# Keys are mapped in PC SDL scancode order. If the same scancode is mapped
# multiple times, the mappings must appear with 'modifiers having most bits up'
# before the others.
#
# Comments before mappings show host symbols found on the keyboard :
# symbol (no modifier) --- symbol (Shift L or R) --- symbol (Alt Gr)
#
# or host symbols not found on the keyboard but usefull :
# symbol (ALT L) --- symbol (ALT L and SHIFT L)
#-------------------------------------------------------------------------------
# q --- Q
0x04,0x1e
# e --- E --- €
0x08|RALT,ALT_XXX|238
# , --- ?
0x10|SHIFT,0x32|LSHIFT
0x10,0x32
# œ --- Œ
0x12|LALT|LSHIFT,ALT_XXX|181
0x12|LALT,ALT_XXX|180
# æ --- Æ
0x14|LALT|LSHIFT,ALT_XXX|146
0x14|LALT,ALT_XXX|145
# a --- A
0x14,0x10
# z --- Z
0x1a,0x11
# w --- W
0x1d,0x2c
# & --- 1
0x1e,0x02
# é --- 2 --- ~
0x1f|RALT,0x2b|ALT|LSHIFT
0x1f|CAPS,ALT_XXX|144
# " --- 3 --- #
0x20|RALT,0x2b
0x20,0x04
# ' --- 4 --- {
0x21|RALT,0x1a|ALT|LSHIFT
0x21,0x05
# ( --- 5 --- [
0x22|RALT,0x1a|ALT
0x22,0x06
# - --- 6 --- |
0x23|RALT,0x2b|LSHIFT
0x23|SHIFT,0x07|LSHIFT
0x23,0x0d
# è --- 7 --- `
0x24|RALT,0x29
# _ --- 8 --- \
0x25|RALT,0x28|ALT
0x25|SHIFT,0x09|LSHIFT
0x25,0x0d|LSHIFT
# ç --- 9 --- ^
0x26|RALT,ALT_XXX|94
# à --- 0 --- @
0x27|RALT,0x2b|ALT
# ) --- ° --- ]
0x2d|RALT,0x1b|ALT
0x2d|SHIFT,0x0c|LSHIFT
# = --- + --- }
0x2e|RALT,0x1b|ALT|LSHIFT
0x2e|SHIFT,0x35|LSHIFT
0x2e,0x35
# ^ --- "
# followed by vowel => vowel with this accent,
# followed by space or same accent => accent alone.
0x2f|SHIFT,0x1a|LSHIFT
0x2f,0x1a
# $ --- £ --- ¤
0x30|RALT,ALT_XXX|249
0x30|SHIFT,0x29|LSHIFT
0x30,0x1b
# * --- µ
0x31|SHIFT,ALT_XXX|230
0x31,0x1b|LSHIFT
# m --- M
0x33,0x27
# ù --- %
0x34|SHIFT,0x28|LSHIFT
0x34,0x28
# ² --- ~
0x35|SHIFT,0x2b|ALT|LSHIFT
0x35,ALT_XXX|253
# ; --- .
0x36|SHIFT,0x33|LSHIFT
0x36,0x33
# : --- /
0x37|SHIFT,0x34|LSHIFT
0x37,0x34
# ! --- §
0x38|SHIFT,ALT_XXX|221
0x38,0x09
# ≤ --- ≥
0x64|LALT|LSHIFT,ALT_XXX|242
0x64|LALT,ALT_XXX|243
# < --- >
0x64|SHIFT,0x60|LSHIFT
0x64,0x60
#-------------------------------------------------------------------------------