Meta, Alt, Super: key mapping problems

James Weatherall jnw "at" realvnc.com
Fri Mar 9 16:42:01 2007


Hi Hendrik,

The VNC X server is built against XFree86, which regards Meta as
Shifted-Alt.  Because Meta is a modifier key, not a normal symbol key, this
creates problems for the shifting logic in Xvnc.

You can avoid these problems by telling Xvnc to treat Meta and Alt as
separate keys, with something along the lines of:

xmodmap -e 'keysym Alt_L = Alt_L'
xmodmap -e 'keysym Alt_R = Alt_R'
xmodmap -e 'keycode 255 = Meta_L'
xmodmap -e 'keycode 254 = Meta_R'
xmodmap -e 'keycode 253 = Super_L'
xmodmap -e 'keycode 252 = Super_R'
xmodmap -e 'add mod3 = Super_L Super_R'
xmodmap -e 'add mod4 = Meta_L Meta_R'

Cheers,

Wez @ RealVNC Ltd
 

> -----Original Message-----
> From: vnc-list-admin "at" realvnc.com 
> [mailto:vnc-list-admin "at" realvnc.com] On Behalf Of Hendrik Tews
> Sent: 09 March 2007 09:54
> To: VNC-List "at" realvnc.com
> Subject: Meta, Alt, Super: key mapping problems
> 
> Hi,
> 
> I configured my keyboard to have real and independent Alt, Meta,
> and Super keys. Inside a vnc viewer only Alt works. The Meta key
> generates some nonsensical Shift events and for the Super key the
> modifier bits are lost (details below). There is no xmodmap
> running on the vnc X server.
> 
> What do I have to do to make keys inside vnc behave the same as
> outside? What I want is simply that a key that generates a Meta_L
> keysym with modifier bits 0x40 outside vnc does generate the same
> keysym inside vnc.
> 
> I tried  -RemapKeys '0xffe7->0xffe7' (Meta_L is 0xffe7) but it
> doesn't have any effect.
> 
> There have been discussions about this problem before (mostly
> xmodmap related) however, I couldn't find any solution.
> 
> 
> 
> key events outside vnc (logged by xev running on the real screen)
> ==============================================================
> ============
> 
> left Alt key:
> 
> KeyPress event, serial 30, synthetic NO, window 0x2e00001,
>     root 0x63, subw 0x0, time 904754106, (134,16), root:(934,384),
>     state 0x0, keycode 115 (keysym 0xffe9, Alt_L), same_screen YES,
>     XLookupString gives 0 bytes: 
>     XmbLookupString gives 0 bytes: 
>     XFilterEvent returns: False
> 
> KeyRelease event, serial 33, synthetic NO, window 0x2e00001,
>     root 0x63, subw 0x0, time 904754202, (134,16), root:(934,384),
>     state 0x8, keycode 115 (keysym 0xffe9, Alt_L), same_screen YES,
>     XLookupString gives 0 bytes: 
> 
> 
> left meta key:
> 
> KeyPress event, serial 33, synthetic NO, window 0x2e00001,
>     root 0x63, subw 0x0, time 904763346, (134,16), root:(934,384),
>     state 0x0, keycode 64 (keysym 0xffe7, Meta_L), same_screen YES,
>     XLookupString gives 0 bytes: 
>     XmbLookupString gives 0 bytes: 
>     XFilterEvent returns: False
> 
> KeyRelease event, serial 33, synthetic NO, window 0x2e00001,
>     root 0x63, subw 0x0, time 904763474, (134,16), root:(934,384),
>     state 0x40, keycode 64 (keysym 0xffe7, Meta_L), same_screen YES,
>     XLookupString gives 0 bytes: 
> 
> 
> right super key:
> 
> KeyPress event, serial 33, synthetic NO, window 0x2e00001,
>     root 0x63, subw 0x0, time 904770209, (134,16), root:(934,384),
>     state 0x0, keycode 117 (keysym 0xffec, Super_R), same_screen YES,
>     XLookupString gives 0 bytes: 
>     XmbLookupString gives 0 bytes: 
>     XFilterEvent returns: False
> 
> KeyRelease event, serial 33, synthetic NO, window 0x2e00001,
>     root 0x63, subw 0x0, time 904770289, (134,16), root:(934,384),
>     state 0x20, keycode 117 (keysym 0xffec, Super_R), same_screen YES,
>     XLookupString gives 0 bytes: 
> 
> 
> 
> key events inside vnc (logged by xev running on the virtual desktop)
> ==============================================================
> ============
> 
> Alt key:
> 
> KeyPress event, serial 29, synthetic NO, window 0x600001,
>     root 0x2e, subw 0x0, time 907210128, (146,88), root:(153,111),
>     state 0x0, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
>     XLookupString gives 0 bytes: 
>     XmbLookupString gives 0 bytes: 
>     XFilterEvent returns: False
> 
> KeyRelease event, serial 31, synthetic NO, window 0x600001,
>     root 0x2e, subw 0x0, time 907210215, (146,88), root:(153,111),
>     state 0x8, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
>     XLookupString gives 0 bytes: 
> 
> for alt everything is fine: right keysym, right modifier flags
> 
> 
> Meta key:
> 
> KeyPress event, serial 31, synthetic NO, window 0x600001,
>     root 0x2e, subw 0x0, time 907210767, (146,88), root:(153,111),
>     state 0x0, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
>     XLookupString gives 0 bytes: 
>     XmbLookupString gives 0 bytes: 
>     XFilterEvent returns: False
> 
> KeyPress event, serial 31, synthetic NO, window 0x600001,
>     root 0x2e, subw 0x0, time 907210768, (146,88), root:(153,111),
>     state 0x1, keycode 64 (keysym 0xffe7, Meta_L), same_screen YES,
>     XLookupString gives 0 bytes: 
>     XmbLookupString gives 0 bytes: 
>     XFilterEvent returns: False
> 
> KeyRelease event, serial 31, synthetic NO, window 0x600001,
>     root 0x2e, subw 0x0, time 907210768, (146,88), root:(153,111),
>     state 0x9, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
>     XLookupString gives 0 bytes: 
> 
> KeyRelease event, serial 31, synthetic NO, window 0x600001,
>     root 0x2e, subw 0x0, time 907210831, (146,88), root:(153,111),
>     state 0x8, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
>     XLookupString gives 0 bytes: 
> 
> This is completely nonsensical! Where does the shift event
> comming from? Why do I have the shift modifier flag? Why do
> keypress and keyrelease events differ??
> 
> 
> 
> Syper key:
> 
> KeyPress event, serial 31, synthetic NO, window 0x600001,
>     root 0x2e, subw 0x0, time 907211807, (146,88), root:(153,111),
>     state 0x0, keycode 255 (keysym 0xffec, Super_R), same_screen YES,
>     XLookupString gives 0 bytes: 
>     XmbLookupString gives 0 bytes: 
>     XFilterEvent returns: False
> 
> KeyRelease event, serial 31, synthetic NO, window 0x600001,
>     root 0x2e, subw 0x0, time 907211863, (146,88), root:(153,111),
>     state 0x0, keycode 255 (keysym 0xffec, Super_R), same_screen YES,
>     XLookupString gives 0 bytes: 
> 
> Almost working, only the modifier bits are lost (note the state
> 0x20 for super on the real screen). This could actuall be fixed
> with xmodmap.
> 
> 
> Bye,
> 
> Hendrik
> _______________________________________________
> VNC-List mailing list
> VNC-List "at" realvnc.com
> To remove yourself from the list visit:
> http://www.realvnc.com/mailman/listinfo/vnc-list