[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Keybindings in non-Latin layout

From: James Cloos
Subject: Re: Keybindings in non-Latin layout
Date: Wed, 06 May 2009 08:19:37 -0400
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.92 (gnu/linux)

>>>>> "Andrey" == Andrey Paramonov <address@hidden> writes:

Andrey> I could however notice that it doesn't contain platform-specific
Andrey> code. How come NTEmacs works nicely, while Emacs on my GNU/Linux
Andrey> system doesn't?

It is probably a function of how the key events are presented to emacs.

On X, the key event struct’s .state member is a bitmask intended to
alter the meaning of the key event.  The lower eight bits represent the
eight modifiers (caps, shift, ctrl and five unnamed modifiers which are
typicaly used for alt, meta, super, hyper, numlock).

Bits 13 and 14 (0x2000 and 0x4000) specify which of the four possible
groups are in play.  Groups were initially indended for those cases
where the keyboard has multiple columns of symbols, as seen on most
European keyboards.  (Here in the states, the most common case is the
euro symbols on recent keyboards.)  As few years ago the keyboard
database project changed its use of groups.

Now, the columns of symbols on the key caps are treated as additional
rows, and one can configure up to four separate keyboard configs at a
time, one per group.

This is convenient, as it allows one to quickly switch between up to
four keyboards, using only the keyboard itself.  But it is not how
XKB groups were intended to be used when XKB was invented.

With the current keyboard configs, it is appropriate to ignore the
group bits when the control, meta, super and/or hyper bits are set.
Some apps already do.

In Emacs, it is probably also reasonable to ignore the group bits in
the middle of sequences intiated by prefix keys.

Ignoring the group bits also might be the Right Thing To Do when the
user selects an application-level alternate keyboard, such as by use
of Emacs’ (set-input-method) or (toggle-input-method).

NT probably uses a sufficiently different method of keyboard events that
this problem does not occur; there is nothing for Emacs to work around.

(BTW, the concept of groups comes from XKB; XKB uses this:

#define XkbBuildCoreState(m,g)  ((((g)&0x3)<<13)|((m)&0xff))
#define XkbGroupForCoreState(s) (((s)>>13)&0x3)
#define XkbIsLegalGroup(g)      (((g)>=0)&&((g)<XkbNumKbdGroups))

to save the group info into the core event .state bitmask, using two
bits which are not otherwise used by the core protocol.  If Emacs is
already XKB-aware there is probably a better way to deal with this
issue.  But if Emacs just used core keyboard events, then simply
ignoring the two group bits when Emacs is in “special” keyboard modes
should work well enough.)

James Cloos <address@hidden>         OpenPGP: 1024D/ED7DAEA6

reply via email to

[Prev in Thread] Current Thread [Next in Thread]