From cf1f5380f9ea099ce42b144e0552541fc08946a7 Mon Sep 17 00:00:00 2001 From: Samuel Mannehed Date: Wed, 2 Oct 2024 10:18:22 +0200 Subject: [PATCH] Clear clipboard state when its not plain text Commit 8a80c906b9f7c08b1c664569a97d327d62c6d8ae added a check to prevent announcing clipboard when it's not plain text data. When this check triggers and we want to ignore the non-plain text clipboard, we should reset the state by no longer indicating pending clipboard, and by asking the server to clear its clipboard. This ensures we don't end up in a state where the server thinks the viewer has useful clipboard data, but it doesn't. (cherry picked from commit 6f6d9406035d59b6a9f59ff0f38206c0c98a0266) --- vncviewer/Viewport.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx index 5ff38f68..e3c3f87d 100644 --- a/vncviewer/Viewport.cxx +++ b/vncviewer/Viewport.cxx @@ -756,6 +756,9 @@ void Viewport::handleClipboardChange(int source, void *data) if (!Fl::clipboard_contains(Fl::clipboard_plain_text)) { vlog.debug("Got non-plain text in local clipboard, ignoring."); + // Reset the state as if we don't have any clipboard data at all + self->pendingClientClipboard = false; + self->cc->announceClipboard(false); return; } -- 2.39.5