xmodmap patch to vnc 3.3.3

Grant McDorman grant.mcdorman "at" cedara.com
Thu, 21 Mar 2002 16:34:12 +0000


According to Marius Kotsbak:
> I tried your trick, but it didn't have any effect. Has 127 in "xmodmap
> -e 'keycode 127 = s S aring" anything with the key to do, or is it just
> an empty keycode. But wait.... now the questionmark key gives me 'S'.
> This could indicate that the answer is yes.

No, the '127' is of no significance, other than it has to be higher than the
highest used keymap entry in Xvnc. Currently, the last used entry is
actually 88, for F12. I don't know why the question-mark key is giving you
'S' (is that really upper case?), unless it's sending the aring - or S -
keysym.

I just looked at the other end of the equation, the Windows VNC viewer. It
has a translation table which converts Windows virtual keys to X keysyms
(i.e. translating from the Windows names to the Unix names). If a Windows
key isn't in the table, it tries to send the Latin-1 character (i.e. 8-bit
ASCII) that corresponds to the key pressed.

However, for 'aring' this should be OK - the X keysym for 'aring' is the
Latin-1 character. I don't know why the xmodmap I suggested isn't working -
unless you have a lower-numbered entry in your keymap for 'aring'; that
would happen if you pressed 'aring' before doing the xmodmap.

I think what we need to do here is two things:
 1) Use xev to determine what keysym is being sent for the international
    key(s), including aring - and the question-mark key. It should be
    the corresponding keysyms (e.g. XK_aring).
    (Do this without doing the xmodmap at all).
 2) Print the keymap (xmodmap -pk) after pressing the international key(s)
    on your keyboard, paying attention to keycodes greater than 88.

Send me the result of this and we'll take it from there.

> Marius
>
> On Wed, 2002-03-20 at 17:18, Grant McDorman wrote:
> > [Copied to the VNC list since this should be archived, and distributed to
> > the world.]
> >
> > Background: Marius is using a VNC server on a *nix system, and has a
non-US
> > (Norwegian?) keyboard. He wishes to change the keyboard layout so that
the
> > 'Aring' key, when pressed, acts as the 's' key. The standard X method of
> > changing this does not work.
> >
> > Analysis: This is a deficiency, at best; at worst, it's a bug.
> >
> > VNC in general sends keystrokes as key names (due to its Unix heritage,
> > these are the names used in Unix, referred to as keysyms).
> >
> > The Unix VNC server has a compiled-in list of a basic set of key names;
this
> > is, essentially, the U.S. 'qwerty' keyboard.
> >
> > If you press a key on the viewer that's not in the static list, the VNC
> > server looks for a key definition, locally, that when pressed will
> > correspond to the key name. It then uses that definition, suitably
modifed
> > by the Shift/Shift Lock keys, to report the key to the Unix applications.
> >
> > As a result, it is impossible to redefine the key completely - the
physical
> > key name (in this case Aring) must be present on the logical key.
> >
> > In detail, the first time you press the 'aring' key Xvnc will add a key
> > mapping that assigns keycode 91, say, to 'aring'. Subsequently, it will
> > search its mappings when you press the 'aring' key, and find that entry
#91
> > contains 'aring'. It will then send code 91 to the application - which
will
> > use the *same* entry to translate it back to a key name: that is,
'aring'.
> >
> > If you remap 'aring' to 's':
> >   xmodmap -e 'keysym aring = s'
> > this changes entry #91 to contain only 's'. As a result, when Xvnc
searches
> > its mappings for 'aring', it won't find it - and will create a *new*
> > mapping!
> >
> > However, since the VNC server (and all X servers, in fact) allow multiple
> > key definitions for each physical key, there is a trick you can use to
get
> > the effect you want.
> >
> > The first two definitions on the key are the normal state, and the
shifted
> > state. The second two are for the 'AltGraph' or "Mode Switch" key, in
> > combination with the shift key. Subsequent definitions are possible but
> > usually serve no pratical purpose.
> >
> > However, since Xvnc uses the key definition when *any* of the set of
> > mappings correspond to the physical key, you should be able to do this
trick:
> >   xmodmap -e 'keycode 127 = s S aring'
> > Then, Xvnc will find this mapping for when the viewer sends the aring
key;
> > since the 'aring' key name appears as the _third_ symbol the application
> > (and you) will see 's' (or 'S') when you press the key.
> >
> > Of course, if you're using a 'mode switch' type key you'll have to extend
> > the mapping to five entries; but it should still work.
> >
> > (original message follows)
> >
> > According to Marius Kotsbak:
> > > On Wed, 2002-03-20 at 16:44, Grant McDorman wrote:
> > > > According to Marius Kotsbak:
> > > > > On Wed, 2002-03-20 at 16:02, Grant McDorman wrote:
> > > > > > According to Marius:
> > > > > > > Grant McDorman wrote:
> > > > > I am NOT using xmodmap with keycodes myself, just keysyms. The
keycodes
> > > > > are preconfigured for vnc (havent't changed anything in vnc), just
as
> > in
> > > > > normal X session.
> > > > >
> > > > > The opposite work though, i can use keysym "s = aring" and i get
the
> > > > > norwegian character "aring" when i press s. But mapping from the
> > > > > aring-button to s is impossible. xmodmap does not complain, but it
has
> > > > > no effect.
> > > > >
> > > > > Could it be that vnc is not handling keycodes outside the US
keyboard
> > > > > right?
> > > >
> > > > VNC doesn't include non-U.S. keysyms in its static keymap. Any keysym
> > that
> > > > it receives outside of this static keymap is dynamically added.
> > > >
> > > > What happens is the VNC client sends the keysym. If the server finds
it
> > in
> > > > its keymap, it uses that; otherwise, it creates a new entry which, of
> > > > course, maps the incoming keysym to itself.
> > > >
> > > > I'm not sure how one could manage to remap a keysym outside the
static
> > > > keymap at startup. However, to see if it works, try this: Press your
> > aring
> > > > key; then do 'xmodmap -e "keysym aring = s"'.
> > > As I said; I have tried exactly that one. It is accepted, but has no
> > > effect.
> > >
> > > >
> > > > I'll look at the source for 3.3.3 and see if there is something that
can
> > be
> > > > cooked up.
> > > >
> > > > --
> > > >
> > > > Grant McDorman <grant.mcdorman "at" cedara.com>, Sr. Software Design
> > Consultant
> > > > Cedara Software Corp.  <URL:http://www.cedara.com>
> > > >   (formerly I.S.G. Technologies Inc.)
> > > > Mississauga, Ontario, Canada
> > > >
> > >
> >
> > --
> >
> > Grant McDorman <grant.mcdorman "at" cedara.com>, Sr. Software Design
Consultant
> > Cedara Software Corp.  <URL:http://www.cedara.com>
> >   (formerly I.S.G. Technologies Inc.)
> > Mississauga, Ontario, Canada
> >
> > [demime 0.97b removed an attachment of type application/pgp-signature]
> > ---------------------------------------------------------------------
> > To unsubscribe, mail majordomo "at" uk.research.att.com with the line:
> > 'unsubscribe vnc-list' in the message BODY
> > See also: http://www.uk.research.att.com/vnc/intouch.html
> > ---------------------------------------------------------------------
>

--

Grant McDorman <grant.mcdorman "at" cedara.com>, Sr. Software Design Consultant
Cedara Software Corp.  <URL:http://www.cedara.com>
  (formerly I.S.G. Technologies Inc.)
Mississauga, Ontario, Canada

[demime 0.97b removed an attachment of type application/pgp-signature]
---------------------------------------------------------------------
To unsubscribe, mail majordomo "at" uk.research.att.com with the line:
'unsubscribe vnc-list' in the message BODY
See also: http://www.uk.research.att.com/vnc/intouch.html
---------------------------------------------------------------------