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



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




--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list



Relevant Pages

  • Re: Ctrl key stuck? with every key press?
    ... or seg-fault (or possibly some other error would ... to re-enable the keyboard repeat or re-enable the screensaver. ... down the CTRL key. ... applications in the menu, I couldn't start an app via ALT-F2 because I ...
    (Debian-User)
  • Re: Keyboard donīt works ok in winXP
    ... I have a problem with my keyboard, and I'm sure that's the cause is ... with ctrl and with alt I have the same problem... ... press the keys at the same time). ... the game think that I never release it. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Feedback to Microsoft
    ... function keys. ... Microsoft Word MVP ... which on my system is Ctrl+(. ... For those of us with a U.S. keyboard, ...
    (microsoft.public.word.docmanagement)
  • Re: Space Bar to Start/Stop playback
    ... I had David add that in for y'all. ... CTRL + P keys will do play/pause. ... Those are the available keyboard shortcuts in WMP10 - perhaps you can ...
    (microsoft.public.windowsmedia.player)
  • Re: Swap/Remap Ctrl and Alt keys
    ... Right-click the Ctrl key in the virtual keyboard ... Select "Exchange Keys" ... Include the xmodmap command to read the xmodmap file in some appropriate startup script ... I want to swap the Ctrl and Alt keys, and I'd appreciate any help you can give. ...
    (Ubuntu)