From fa26b74fb5f4653f71741bd7c1230acf992ef6f7 Mon Sep 17 00:00:00 2001 From: Samuel Mannehed Date: Tue, 1 Oct 2024 12:49:40 +0200 Subject: [PATCH] Only announce clipboard for plain text data FLTK has support for both image and plain text clipboard data, we don't. This means we only send plain text clipboard from the viewer to the server. Some applications can get confused when we announce that clipboard is available and later don't send anything. An example of such an application is QGIS, in the remote session it froze when an image was copied on the client side. This fix means we only call announceClipboard() when the clipboard contains plain text. That means TigerVNC is now more robust and doesn't trigger freezes in buggy applications. (cherry picked from commit 8a80c906b9f7c08b1c664569a97d327d62c6d8ae) --- vncviewer/Viewport.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx index be2cbc8f..5ff38f68 100644 --- a/vncviewer/Viewport.cxx +++ b/vncviewer/Viewport.cxx @@ -754,6 +754,11 @@ void Viewport::handleClipboardChange(int source, void *data) return; #endif + if (!Fl::clipboard_contains(Fl::clipboard_plain_text)) { + vlog.debug("Got non-plain text in local clipboard, ignoring."); + return; + } + self->clipboardSource = source; if (!self->hasFocus()) { -- 2.39.5