]> source.dussan.org Git - tigervnc.git/commitdiff
Fix clipboard state tracking in server
authorPierre Ossman <ossman@cendio.se>
Tue, 5 Jan 2021 09:25:17 +0000 (10:25 +0100)
committerPierre Ossman <ossman@cendio.se>
Tue, 5 Jan 2021 09:25:17 +0000 (10:25 +0100)
This was out of sync with the client handling for no good reason.

common/rfb/SConnection.cxx

index b4f63ae824dc1e4f1a8dd39c4c6c355bb54d6f66..d44ff786a4c08c583bde27f56d5924a47be3cf19 100644 (file)
@@ -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);
 }