x11vnc
x11vnc copied to clipboard
Can not input parenthesis in VM when using `virt-manager`
Host OS is Ubuntu 20.04 desktop.
x11vnc
and virt-manager
are installed in the host OS.
When connecting from another PC using remmina VNC plugin, I can not type parenthesis shift+9/0
into VM, other keys are OK, including 9
, 0
themselves.
But it works fine for a text editor app in the host. It also works fine if using physical keyboard to input parenthesis in VM.
My x11vnc
is started with arguments:
/usr/bin/x11vnc -nevershared -forever -auth /var/run/lightdm/root/:0 -display WAIT:0 -rfbport 5900 -rfbauth /etc/x11vnc-passwd -repeat -nomodtweak -clear_mods -clear_keys
I've also tries many other arguments combinations -modtweak, -nomodtweak, -xkb, -noxkb, -capslock, ... None is woking!
version: x11vnc: 0.9.16 lastmod: 2019-01-05
Debug log:
08/05/2024 16:46:50 # keyboard(down, 0xffe1 "Shift_L") uip=0 177615.1816
08/05/2024 16:46:50 keyboard(): KeySym 0xffe1 "Shift_L" -> KeyCode 0x32
08/05/2024 16:46:50 XTestFakeKeyEvent(dpy, keycode=0x32 "Shift_L", down)
08/05/2024 16:46:50 calling XTestFakeKeyEvent(50, 1) 177615.1818
08/05/2024 16:46:50 # keyboard(down, 0x28 "parenleft") uip=0 177615.3275
08/05/2024 16:46:50 keyboard(): KeySym 0x28 "parenleft" -> KeyCode 0xbb
08/05/2024 16:46:50 XTestFakeKeyEvent(dpy, keycode=0xbb "parenleft", down)
08/05/2024 16:46:50 calling XTestFakeKeyEvent(187, 1) 177615.3280
08/05/2024 16:46:50 # keyboard(up, 0x28 "parenleft") uip=0 177615.4892
08/05/2024 16:46:50 keyboard(): KeySym 0x28 "parenleft" -> KeyCode 0xbb
08/05/2024 16:46:50 XTestFakeKeyEvent(dpy, keycode=0xbb "parenleft", up)
08/05/2024 16:46:50 calling XTestFakeKeyEvent(187, 0) 177615.4894
08/05/2024 16:46:50 # keyboard(up, 0xffe1 "Shift_L") uip=0 177615.6319
08/05/2024 16:46:50 keyboard(): KeySym 0xffe1 "Shift_L" -> KeyCode 0x32
08/05/2024 16:46:50 XTestFakeKeyEvent(dpy, keycode=0x32 "Shift_L", up)
08/05/2024 16:46:50 calling XTestFakeKeyEvent(50, 0) 177615.6322
Issue Cause
The KeySym "parenleft" is mapped to two keycodes (18 and 187). You can verify this using "xmodmap -pk". Currently, x11vnc prioritizes the mapping with no modifiers, which results in an unexpected keycode (187) being returned.
Solutions
-
Filter Specific Keycodes in x11vnc: Start x11vnc with the -skip_keycodes option to filter out specific keycodes:
x11vnc -skip_keycodes 187,188
-
Modify xmodmap: Update the keycode mappings using xmodmap.
-
Adjust x11vnc Source Code: Modify the x11vnc source code to handle KeySym-to-keycode conversion.
You can choose the solution that best fits your needs.
@hsiang0100
Thanks for your reply!
But adding parameters -skip_keycodes 187,188
still does not solve my problem.
I should point out that, it is very weird, the parenthesis is OK for all apps, except for virt-manager.
Output for command xmodmap -pk|grep -E '\b(18|187)\b'
:
18 0x0039 (9) 0x0028 (parenleft) 0x0039 (9) 0x0028 (parenleft)
187 0x0028 (parenleft) 0x0000 (NoSymbol) 0x0028 (parenleft)
I am newbie in terms of x11vnc and X11 keyboard mechanisms under the hood.
Does this output mean The KeySym "parenleft" is mapped to two keycodes (18 and 187).
, as you mentioned?
@hsiang0100
I finally got it working.
I must use -skip_keycodes 187,188
combined with -modtweak
, to make parenthesis working in VM, both params are required. But -modtweak
introduces other problems. It's painful.
Thank you!
What problems you encounter~?