From 513cb8bc9414d8132bd9fd51b0713e17a6c3c4a2 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Tue, 5 Jan 2021 10:25:17 +0100 Subject: [PATCH] Fix clipboard state tracking in server This was out of sync with the client handling for no good reason. --- common/rfb/SConnection.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/common/rfb/SConnection.cxx b/common/rfb/SConnection.cxx index b4f63ae8..d44ff786 100644 --- a/common/rfb/SConnection.cxx +++ b/common/rfb/SConnection.cxx @@ -315,6 +315,8 @@ void SConnection::setEncodings(int nEncodings, const rdr::S32* encodings) void SConnection::clientCutText(const char* str) { + hasLocalClipboard = false; + strFree(clientClipboard); clientClipboard = NULL; @@ -343,10 +345,12 @@ void SConnection::handleClipboardNotify(rdr::U32 flags) strFree(clientClipboard); clientClipboard = NULL; - if (flags & rfb::clipboardUTF8) + if (flags & rfb::clipboardUTF8) { + hasLocalClipboard = false; handleClipboardAnnounce(true); - else + } else { handleClipboardAnnounce(false); + } } void SConnection::handleClipboardProvide(rdr::U32 flags, @@ -361,6 +365,7 @@ void SConnection::handleClipboardProvide(rdr::U32 flags, clientClipboard = convertLF((const char*)data[0], lengths[0]); + // FIXME: Should probably verify that this data was actually requested handleClipboardData(clientClipboard); } -- 2.39.5