Problem with mapping a key to multiple characters (Unicode + diacritic symbol)

Pierre-Luc Angles angles at stud.uni-heidelberg.de
Tue Mar 12 23:46:25 UTC 2019


Dear Ilya,

Thanks a lot for your interesting advices.

Le 12/03/2019 à 15:16, Ilya Anfimov a écrit :
> You are probably right. Keysyms does not get added automatically
> by naming it, and I don't see any mention of i_breve_below and so
> on  in  standard keysymdef.h , which is the source of the default
> set of keysyms.

i_breve_below etc. are indeed names that I have created and as you 
rightly wrote, I should add them to /usr/include/X11/keysymdef.h

> 
>   You can always check it by running xev and pressing that key  in
> it's window. It should display NoSymbol, AFAIK.

By running xev and pressing this key (plus the modifier AltGr), I obtain 
this message:

"KeyRelease event, serial 37, synthetic NO, window 0x4600001,
     root 0x168, subw 0x0, time 338633818, (163,294), root:(714,562),
     state 0x4090, keycode 10 (keysym 0xb9, onesuperior), same_screen YES,
     XKeysymToKeycode returns keycode: 49
     XLookupString gives 2 bytes: (c2 b9) "¹"
     XFilterEvent returns: False"

It could be explained because the beginning of my keybord layout is the 
following:

"partial alphanumeric_keys
xkb_symbols "oss" {

     include "latin"
     include "level3(ralt_switch)"
     include "nbsp(level4n)"
     include "keypad(oss)" "




> 
>   If you really want your keysym -- you can probably add one.  You
> need to define a value for that keysym, probably in  the  vendor-
> specific  range #x10000000..#x1FFFFFFF  (29th bit set). Also note
> already used ones, you can get it from the  last  used  XKeysymDB
> file:
> 
> 
> https://gitlab.freedesktop.org/xorg/lib/libx11/blob/00175397480b76d32bf82b0c7c94c91a2a95954e/src/XKeysymDB
> 
> Also  note,  that  #x11000000 to #x1100FFFF are reserved for key-
> pad, so don't use that either.
> 

So I have chose the last available numbers #x1FFFFFF5 to #x1FFFFFFF, and 
would add to /usr/include/X11 these lines:

#ifdef XK_TRANSLITTERATION
#define XK_i_breve_below      0x1ffffff5  /* U+0DD3 SINHALA DIGA IS-PILLA */
#define XK_u_breve_below      0x1ffffff6  /* U+0DD4 SINHALA PAA-PILLA */
#define XK_ı_ring_above       0x1ffffff7  /* U+0DD6 SINHALA DIGA 
PAA-PILLA */
#define XK_I_ring_above       0x1ffffff8  /* U+0DD8 SINHALA GAETTA-PILLA */
#define XK_č_dot_below        0x1ffffff9  /* U+0DD9 SINHALA KOMBUVA */
#define XK_Č_dot_below        0x1ffffffa  /* U+0DDA SINHALA DIGA KOMBUVA */
#define XK_s_macron_below     0x1ffffffb  /* U+0DDB SINHALA KOMBU DEKA */
#define XK_S_macron_below     0x1ffffffc  /* U+0DDC SINHALA KOMBUVA HAA 
AELA-PILLA*/
#define XK_H_macron_below     0x1ffffffd  /* U+0DDD SINHALA KOMBUVA HAA 
DIGA AELA-PILLA*/
#define XK_h_circumf_below    0x1ffffffe  /* U+0DDE SINHALA KOMBUVA HAA 
GAYANUKITTA */
#define XK_H_circumf_below    0x1fffffff  /* U+0DDF SINHALA GAYANUKITTA */
#endif /* XK_TRANSLITTERATION */

What should I write instead of for example /* U+0DD3 SINHALA DIGA 
IS-PILLA */ since there are characters without one predefined Unicode 
symbol?

> 
>   Then you can write your new XKeysymDB in the same format as  ex-
> ample  above  and put it the /usr/share/X11 on every machine that
> needs to work with your keys.
>   Well, the /usr/share/X11/XKeysymDB is the place that my  current
> devuan  expects  it to be, and other distributions can place this
> file in other places, like /usr/X11R6/lib/  or so. You can quickly
> find an exact place by running
> 
>    strace xkbcomp "$DISPLAY"  - 2>&1 >/dev/null  |grep XKeysym
> 
>    (if you have strace, of course).

Typing "strace xkbcomp "$DISPLAY"  - 2>&1 >/dev/null  |grep XKeysym"
I obtain:
"openat(AT_FDCWD, "/usr/share/X11/XKeysymDB", O_RDONLY) = -1 ENOENT 
(Aucun fichier ou dossier de ce type)"

So I assume that I have to create a XKeysymDB file in /usr/share/X11/ 
that would be the following:

i_breve_below		:1FFFFFF5
u_breve_below		:1FFFFFF6
ı_ring_above		:1FFFFFF7
I_ring_above		:1FFFFFF8
č_dot_below		:1FFFFFF9
Č_dot_below		:1FFFFFFA
s_macron_below		:1FFFFFFB
S_macron_below		:1FFFFFFC
H_macron_below		:1FFFFFFD
h_circumf_below		:1FFFFFFE
H_circumf_below		:1FFFFFFF

> 
>   Then  reloading  your xkb should work, and .XCompose should work
> also.
> 
>   Or you can type any keysym number in-place just by  typing  it's
> code in hex with 0x prefix as in 0x10000501
> 
>   However,  it  can  be  simpler to borrow some unused or reserved
> unicode position, as every unicode character in the  range  0x100
> --  0x10FFFF have a default assigned keysym name "Uxxx", e.g. the
> cyrillic capital letter A (0x410 unicode value) would  be  keysym
> "U410"  and  first private use area symbol (0xE000 unicode value)
> would be keysym "UE000".

Thanks a lot again for your patience and your help.

Best regards,

Pierre-Luc


More information about the xorg mailing list