]> source.dussan.org Git - tigervnc.git/commitdiff
Merge branch 'clipfocus' of https://github.com/CendioOssman/tigervnc
authorPierre Ossman <ossman@cendio.se>
Fri, 20 Apr 2018 11:45:07 +0000 (13:45 +0200)
committerPierre Ossman <ossman@cendio.se>
Fri, 20 Apr 2018 11:47:32 +0000 (13:47 +0200)
1  2 
vncviewer/Viewport.cxx
vncviewer/Viewport.h

index 14163aa4992a5fa10303deef8d81b09b65eeb4ca,6c10f3572f516e5cc8384a8cdf12b6b876dffe79..4a44f40104cf5b9c7cfb1b7ede10f873df4fcb44
@@@ -661,6 -723,33 +723,33 @@@ void Viewport::handleClipboardChange(in
  }
  
  
 -    cc->writer()->clientCutText(pendingClientCutText, len);
+ void Viewport::clearPendingClipboard()
+ {
+   delete [] pendingServerCutText;
+   pendingServerCutText = NULL;
+   delete [] pendingClientCutText;
+   pendingClientCutText = NULL;
+ }
+ void Viewport::flushPendingClipboard()
+ {
+   if (pendingServerCutText) {
+     size_t len = strlen(pendingServerCutText);
+     if (setPrimary)
+       Fl::copy(pendingServerCutText, len, 0);
+     Fl::copy(pendingServerCutText, len, 1);
+   }
+   if (pendingClientCutText) {
+     size_t len = strlen(pendingClientCutText);
+     vlog.debug("Sending pending clipboard data (%d bytes)", (int)len);
++    cc->writer()->writeClientCutText(pendingClientCutText, len);
+   }
+   clearPendingClipboard();
+ }
  void Viewport::handlePointerEvent(const rfb::Point& pos, int buttonMask)
  {
    if (!viewOnly) {
Simple merge