qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: VNC clipboard support


From: Philipp Hahn
Subject: Re: VNC clipboard support
Date: Sun, 30 Apr 2023 18:20:13 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0

Hello,

Am 29.04.23 um 17:29 schrieb octaveflon@outlook.fr:
I'm trying to use the copy/paste with VNC.

I'm launching qemu with:

$ qemu-system-x86_64 -hda debiandisk.img vnc :1

I'm using tightvncviewer which has support for copy/paste.

I try to copy text between guest and host.

It doesn't work. Neither from host to guest or guest to host.

As far as I know, there is clipboard support in VNC (ui/vnc-clipboard.c and so on).
With wireshark, I can see that tightvncviewer send clipboard requests.

Am I missing some configuration?

Clipboard via VNC to QEMU does not work: Basically the VNC protocol was originally used for remote-access to X11 application. There you work on a high-level were XKeySyms are used and where clipboard data can be exchanged.

In contrast with QEMU you work on a much lower level as you do hardware emulation: The operating system inside your QEMU process expects low-level hardware events like a USB or PS2 keyboard key Up / Down events. As the VNC protocol only exchanges "XKeySyms" QEMU has to translate them back to those low-level USB/PS2 events expected by the OS. This back-translation is not unique: For example most full-sized keyboards have the number block, so there are 2 keys to enter a digit.

Therefore QEMU added the "extended key event"-extension, which adds the low-level "KeyCode" in addition to the "XKeySym" to the VNC protocol: When you press a key in your VNC browser the X-Server luckily also gets the low-level "KeyCode", but the original VNC protocol did not include that information on the protocol level. By including that information QEMU no longer has to "fake" it and simply pass that information to the inside OS.

Even when your clipboards only contains text (it could also have a bitmap picture or some other rich data), you are basically back in the situation where you have to translate each character to one (or multiple) key-press/release events, again with the same issue mention above: You do not have the KeyCode and someone has to fake them.

Therefore it will not work: Albeit some VNC browsers or libraries implement that approach, but their result is unreliable, especially if the keyboard layout on your client computer does not match the keyboard layout configured in QEMU for the backward translation does not match the keyboard layout of your operating system running inside of QEMU.

If you want to know more, read this still excellent blog-post from Daniel Berrangé: - https://www.berrange.com/posts/2010/07/04/more-than-you-or-i-ever-wanted-to-know-about-virtual-keyboard-handling/ - https://github.com/rfbproto/rfbproto/blob/master/rfbproto.rst#qemu-extended-key-event-message

Philipp



reply via email to

[Prev in Thread] Current Thread [Next in Thread]