Problem is not solved, yet. Reading the huge Xorg documentation is so time consuming...
But at least I write here some progress (for remembering/log when I do a tinycore search on forum for a solution).
When X server starts, XKB (its keyboard module) reads all needed data from text files (these are the 'database' of the XKB configuration). Strictly speaking most of these files XKB doesn't read itself. It calls xkbcomp to translate these files to a binary form that XKB can understand.
The XKB configuration database consists of 5 components: keycodes, types, compat, symbols, geometry
All these components corespond to subdirectories in directory {XROOT}/lib/X11/xkb
On Linux systems, the evdev rules are most commonly used; I checked with: setxkbmap -query -v 10
"Setting verbose level to 10
locale is C
Trying to load rules file ./rules/evdev...
Trying to load rules file /usr/local/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules: evdev
model: pc104
layout: fr
Trying to build keymap using the following components:
keycodes: evdev+aliases(azerty)
types: complete
compat: complete
symbols: pc+fr+inet(evdev)
geometry: pc(pc104)
rules: evdev
model: pc104
layout: fr"
So, 'Rules' defines a function (in mathematical meaning) which arguments are 'Model', 'Layout', 'Variant' and 'Options'. <-- see Xorg.conf
And the return value is a vector of components: keycodes, types, compat, symbols and geometry (aka a full keymap).
The Rules files also are placed in the {XKBROOT}/rules directory.
Scancodes (from keyboard controller) are first mapped to keycodes, which are then mapped to keysyms (by XKB) depending on used keyboard layout; Keys without a scancode are not recognized by the kernel;
-A scancode is the lowest identification number for a key, it is the value that a keyboard sends to a computer.
- A keycode is the second level of identification for a key, a keycode corresponds to a function.
- A keysym is the third level of identification for a key, it corresponds to a symbol. It may depend on whether the Shift key or another modifier key was also pressed
I do not think I have a problem with the scan-codes or with the key-symbols (geometry is ignored anyway), because:
The keycodes used by Xorg are reported by a utility called xev; (Note: the keycodes are different for Linux console and Xorg)
- after setxkeybmap us, the prog "xev" shows: keycode 58, keysym 0x6d m, and keysym 0x4d M;
and ctrl+alt+; maximised the window (flwm knows the combination). of course on my french keyboard the key is labeled as [, ?] not [m M] as on a US keyboard
- now, after setxkeybmap fr, the prog "xev" shows: keycode 58, keysym 0x2c comma, and keysym 0x3f question;
So flwm is not using hardcoded keycode 58, otherwise it should worked; hm, next..
keycode 47, keysym 0x6d m, and keysym 0x4d M;
So, the problem should be with the mapping inside the types or compat files.
To get current configuration, I run: xkbcomp $DISPLAY output.xkb
(To upload the data back to the server, run: xkbcomp input.xkb $DISPLAY )
The bits in the state field of keycode (xev shows them) have pre-defined names: Shift, Lock, Control, Mod1, Mod2, Mod3, Mod4 and Mod5, lowest to highest.
Now, back to study; Any help is welcome...