Ivan Pascal wrote:

Danilo Segan wrote:


It all works fine, but the problem arises with the usage of CTRL+<key> combinations. If I put en_US as the first group, then they use keys from group1 no matter what group is active. But, in any other case, they use the key mappings from the "current group".



There is an XKB feature that is completely undocumented, unfortunatly.
The XLookupString (and so X{mb|wc}LookupString too) procedure having Control
modifier in a key event tries to make a 'controlized' code from the symbol
got from the current layout.
If this attempt fails, the procedure changes an XKB group to the first one
and repeats the 'controlization' attempt.
(The "documentation" is a source code of XLookupString in xc/lib/X11/XKBBind.c).


It seems to me that there's also something related on line 728 in XKBTranslateKeySym (actually, it's the only other place where ControlMask is used to treat Control specially). Of course, all this is performed starting with line 878.

What about suggesting to enforce (if anything is enforced) in XkbToControl() only? Isn't it saner to have all the "ifs and thens" on one place?

 Since a control code can be produced from an ascii code, if a key in the
current group has such keysym you get the controlized code (the first attempt
got success).  Otherwise you get the control code from the first group, if
it is a latin-based layout (the second attempt is successful) or just a code
from the first group.

This behavior can be switched on/off by setting 'Xlib XKB control bit'
XkbLC_ControlFallback or using the environment variable _XKB_CONTROL_FALLBACK
(values can be 'on/off' or '0/1'). By default it's switched on.


It seems to me that for "multi-layout" it's way better to have it switched off as default.

 It worked well while all keyboard maps had the 'us' map as a first layout
or were latin-based maps themself.  But as you see this method doesn't work
in some multi-layout combinations.

 I would offer to add another one variable like:
_XKB_CONTROL_FALLBACK_TO=<group>

 BTW there are users who would like to have the similar option for Alt
modifier, i.e. _XKB_ALT_FALLBACK.

Any opinions?


Actually, I find „hard coding“ any of these to be counter-productive (including the _XKB_CONTROL_FALLBACK_TO=<group>, and _XKB_ALT_FALLBACK, _XKB_CONTROL_FALLBACK).

I think that the keymap writers will be the ones who know best what will the user expect (for example, if I have a program translated into cyrillic, Alt would need to use cyrillic letters to access the menus, while Control would still need to use latin letters for shortcuts like C-A, C-S and so forth). Still, even the keymap writers would not be entirely correct. In such cases, there should be fallback (for instance when the user is a native english, he expects to have Alt and Control both use his „base“, even though he might temporarily type some cyrillic). This fallback should not be as simple as „group1“ or „group<whatever>“, and it might need to be a special section in Xkb options (eg. „fallback“ section next to „compat“, „types“, „extra“ and others). For the time being, your suggestion would work if we could make one group „transparent“ (it would be skipped by ISO_Next_Group, and other shift keys). The transparency matters because if one runs cyrillic GUI, with latin Control-shortcuts, and yet uses some external keyboard switcher, (s)he couldn't access neither the menus nor the Control-shortcuts if he suddently starts typing Hebrew. That's the main reasoning for separating this mechanism from groups mechanism.

The care should be also taken as to not assume Control shortcuts use only latin alphabet, since, at least in GTK+ programs, one is allowed to dynamically redefine shortcuts, what would lead to all sorts of problems.

At least, if you opt for your suggestion of *_FALLBACK_TO, it would be nice to be able to set this through keymaps, by using „-option“ parameter to setxkbmap (or in XF86Config):
setxkbmap -layout "sr,yu,en_US" -option "grp:shift_toggle,alt-fb:1,ctl-fb:3"


Now that I think of it, this seems as a quite a good idea ;) Especially so if one uses only standard facilities for setting XKB up (setxkbmap, XF86Config, ...). If we want to take care of those using other switchers, we might need something on the lines of:

setxkbmap -layout "fr" -option "alt-fb:sr,ctrl-fb:en_US"

where sr and en_US are symols/pc/ files (by default).

On my other problems I'll start a different thread, so as not to confuse anyone.


Regards, Danilo


_______________________________________________ I18n mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/i18n

Reply via email to