Re: typing characters not present on your keyboard (was Re: OT What does RET (Enter) do and how does it do it ??)

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

 



On Sunday 26 August 2007 16:07, Andras Simon wrote:
> On 8/26/07, Marko Vojinovic <vvmarko@xxxxxxxxxxx> wrote:
> > X has a very complicated while simultaneously very limited (ie. stupid)
> > keyboard controls. It does not make the difference between left ctrl and
> > right ctrl, for example (if the keyboard happens to have both). Same for
> > shift keys. While it is enough for a typical mouse-oriented user, it
> > fails to
> > support anything more advanced in terms of keyboard.
>
> Are you sure about the L/R Ctrl part?
>
> $ xmodmap -pm
> xmodmap:  up to 3 keys per modifier, (keycodes in parentheses):
>
> shift       Shift_L (0x32),  Shift_R (0x3e)
> lock        Caps_Lock (0x42)
> control     Control_L (0x25),  Control_R (0x6d)
> mod1        Alt_L (0x40),  Alt_L (0x7d),  Meta_L (0x9c)
> mod2        Num_Lock (0x4d)
> mod3
> mod4        Super_L (0x7f),  Hyper_L (0x80)
> mod5        Mode_switch (0x5d)

Yes, this table exactly proves my point. There is only *one* control modifier 
(left column), to which *both* ctrl keys are mapped. So, there is no way for 
an application under X to know which of the two keys has been pressed, except 
to bypass X and read off the keyboard itself. If an app relies on X to handle 
the keyboard, Shift_L+a and Shift_R+a are the same thing, shift+a, as given 
by X to the app.

Of course, you can redirect Shift_R to be, say, mod3 instead of shift, but 
that would break all other apps that rely on both shift keys to be 
represented by the same X modifier.

> In xev also, the two Ctrl keys show up as different keypresses.

Xev is similar to showkey, it reads keyboard (and mouse) events directly, 
bypassing X, simply because it is specially made for that purpose.

I do not argue that X does not see the two ctrl keys as different keys, but 
that it does not give that information further to a user app running on top 
of it, as displayed by your table above.

Let me clarify this with an example. Take any X app, say KMail (I'm writing 
this post in it, but any other app will do as well). I want to configure 
shortcuts for some actions, say sending mail and receiving mail on demand. I 
want to send mail by pressing Ctrl_L+a, while I want to receive mail by 
pressing Ctrl_R+a. (the sanity of such choice is for debate, but it is a 
legal one, in a way).

Is this possible to configure? No, it is not!

Why not? Because KMail knows nothing of left and right keys. It only knows of 
one and only ctrl modifier.

Who is the culprit? X, it deliberately abstracts this information between 
reading keyboard input and passing it to KMail. That is Bad Design, afaik. 
Completely unneeded limitation of hardware (keyboard) by software (X).

How to get around it? Make KMail read keyboard directly, not relying on X? Too 
complicated, hard to implement (although possible in principle).

Is this situation specific for KMail? No! Every X app is hosed this way, 
except for ones that are specifically written to circumvent this bad design 
(like xev, vmware, some games, etc).

End result? User needs to live with it, is forced to choose other shortcut key 
combinations, and hates X for bad keyboard handling. Like me. ;-)

Best, :-)
Marko

Marko Vojinovic
Institute of Physics
University of Belgrade
======================
e-mail: vmarko@xxxxxxxxxxxx





[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux