x11vnc
x11vnc copied to clipboard
Key autorepeat from client doesn't work
Describe the bug
By default x11vnc uses -norepeat. The manpage says that this is no problem:
Note: your VNC viewer side will likely do autorepeating, so this is no loss unless someone is simultaneously at the real X display.
But that doesn't work (tested with TigerVNC Viewer v1.10.1 on XUbuntu 20.04, and also with a custom viewer) - and x11vnc -debug_keyboard tells me why:
19/03/2022 02:14:23 # keyboard(down, 0xff08 "BackSpace") uip=0 2485.4015
19/03/2022 02:14:23 keyboard(): KeySym 0xff08 "BackSpace" -> KeyCode 0x16
19/03/2022 02:14:23 XTestFakeKeyEvent(dpy, keycode=0x16 "BackSpace", down)
19/03/2022 02:14:23 calling XTestFakeKeyEvent(22, 1) 2485.4017
19/03/2022 02:14:24 # keyboard(down, 0xff08 "BackSpace") uip=0 2485.9048
19/03/2022 02:14:24 keyboard(): KeySym 0xff08 "BackSpace" -> KeyCode 0x16
19/03/2022 02:14:24 XTestFakeKeyEvent(dpy, keycode=0x16 "BackSpace", down)
19/03/2022 02:14:24 calling XTestFakeKeyEvent(22, 1) 2485.9050
19/03/2022 02:14:24 XTestFakeKeyEvent: keycode=0x16 "BackSpace" is *already* down
19/03/2022 02:14:24 # keyboard(down, 0xff08 "BackSpace") uip=0 2485.9568
19/03/2022 02:14:24 keyboard(): KeySym 0xff08 "BackSpace" -> KeyCode 0x16
19/03/2022 02:14:24 XTestFakeKeyEvent(dpy, keycode=0x16 "BackSpace", down)
19/03/2022 02:14:24 calling XTestFakeKeyEvent(22, 1) 2485.9569
19/03/2022 02:14:24 XTestFakeKeyEvent: keycode=0x16 "BackSpace" is *already* down
I guess "BackSpace" is *already* down means that those repeated down events are ignored.
Maybe the assumption was that client autorepeat would send repeated key-up and key-down events, but that's not the case and not to be expected - VNC clients are supposed to only send down events for autorepeat, see https://github.com/rfbproto/rfbproto/blob/master/rfbproto.rst#keyevent :
The client should send only repeated "down" KeyEvent messages, no "up" messages, when a key is automatically repeated. This allows the server to tell the difference between automatic repeat and actual repeated entry by the user.
To Reproduce
- Start x11vnc on one machine/VM/whatever
- Connect a VNC viewer (tested with TigerVNC Viewer v1.10.1)
- Through the VNC viewer, open a text editor or terminal or whatever
- Press a key and hold it for some seconds
Expected Behavior
The character for the pressed key should be duplicated (or if you're pressing Delete or Backspace, it should continue deleting characters until you release the key).
Desktop:
- OS and version: XUbuntu 20.04, on both client and server
- Xorg version used: 7.7+19ubuntu14
- x11vnc 0.9.16-3, libvncserver1 0.9.12+dfsg-9ubuntu0.3