#627784 x11vnc: the () keys are reported with wrong keycode

Package:
x11vnc
Source:
x11vnc
Description:
VNC server to allow remote access to an existing X session
Submitter:
Michal Suchanek
Date:
2022-11-25 23:03:03 UTC
Severity:
normal
Tags:
#627784#5
Date:
2011-05-24 14:08:01 UTC
From:
To:
If you look in /usr/share/X11/xkb/keycodes/evdev there is:

       ...
       <AE09> = 18;
       <AE10> = 19;
       ...
       <I187> = 187;   // #define KEY_KPLEFTPAREN         179
       <I188> = 188;   // #define KEY_KPRIGHTPAREN        180
       ...

This results in xev reporting these:

KeyRelease event, serial 27, synthetic NO, window 0x3200001,
    root 0x101, subw 0x3200002, time 15931330, (47,52), root:(1248,53),
    state 0x10, keycode 18 (keysym 0x39, 9), same_screen YES,
    XLookupString gives 1 bytes: (39) "9"
    XFilterEvent returns: False

KeyPress event, serial 27, synthetic NO, window 0x3200001,
    root 0x101, subw 0x3200002, time 15931546, (47,52), root:(1248,53),
    state 0x11, keycode 18 (keysym 0x28, parenleft), same_screen YES,
    XKeysymToKeycode returns keycode: 187
    XLookupString gives 1 bytes: (28) "("
    XmbLookupString gives 1 bytes: (28) "("
    XFilterEvent returns: False


Note the different value of XKeysymToKeycode.

x11vnc then sends "(" with the keycode 187 which breaks applications like Wine that use the keycode value for further keycode translation. I would expect that rdesktop/kvm/VirtualBox and the like would be also affected I would guess.

#627784#10
Date:
2011-06-11 15:42:06 UTC
From:
To:
Could you run x11vnc with the options "-v -o log.txt -dk -dk" (yes two
-dk's) and then reproduce the problem and then attach the entire log.txt
file to this bug.

Thanks,

Karl

#627784#15
Date:
2011-06-11 16:54:47 UTC
From:
To:
Also, as a workaround you probably can use the -skip_keycodes x11vnc
option to indicate which keycodes to not inject.  It is a comma separated
list of the ones you want skipped.

(See the -help output or
http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-skip_keycodes for
more info.)

So one could even do something like this:

# x11vnc ... -v -dk -dk -skip_keycodes `egrep '<I[12]..> =' /usr/share/X11/xkb/keycodes/evdev | awk '{print $3}' | tr '\n' , | sed -e 's/;//g' -e 's/,$//'`

(or similar sort of thing to make the list...)  A quick test suggests
this avoids the 187 being used for "("

Karl

#627784#22
Date:
2022-11-25 22:59:34 UTC
From:
To:
I know this bug is old but I just stumbled upon it when trying to
connect to a machine running in KVM on a host connected to via x11vnc.

The workaround Karl suggested worked perfectly the () keys work again.

Attached is the output of "-v -o log.txt -dk -dk" as requested.