diff options
author | Pierre Ossman <ossman@cendio.se> | 2019-05-03 10:53:06 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2019-07-01 11:18:27 +0200 |
commit | 615d16bd5ba11e89262cc5cfe94a35b6d6e7a628 (patch) | |
tree | c520bd561b0e44f005cc2fbc118b8e36f439bfcb /common/rfb/CConnection.cxx | |
parent | 56fa7821560a60db39195e8c81d16b46e8f972c2 (diff) | |
download | tigervnc-615d16bd5ba11e89262cc5cfe94a35b6d6e7a628.tar.gz tigervnc-615d16bd5ba11e89262cc5cfe94a35b6d6e7a628.zip |
Improved clipboard API
Change the internal clipboard API to use a request based model in
order to be prepared for more advanced clipboard transfers.
Diffstat (limited to 'common/rfb/CConnection.cxx')
-rw-r--r-- | common/rfb/CConnection.cxx | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/common/rfb/CConnection.cxx b/common/rfb/CConnection.cxx index d6960dd2..ce2741e4 100644 --- a/common/rfb/CConnection.cxx +++ b/common/rfb/CConnection.cxx @@ -1,5 +1,5 @@ /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. - * Copyright 2011-2017 Pierre Ossman for Cendio AB + * Copyright 2011-2019 Pierre Ossman for Cendio AB * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -52,7 +52,8 @@ CConnection::CConnection() formatChange(false), encodingChange(false), firstUpdate(true), pendingUpdate(false), continuousUpdates(false), forceNonincremental(true), - framebuffer(NULL), decoder(this) + framebuffer(NULL), decoder(this), + serverClipboard(NULL) { } @@ -65,6 +66,7 @@ CConnection::~CConnection() reader_ = 0; delete writer_; writer_ = 0; + strFree(serverClipboard); } void CConnection::setStreams(rdr::InStream* is_, rdr::OutStream* os_) @@ -463,6 +465,16 @@ void CConnection::dataRect(const Rect& r, int encoding) decoder.decodeRect(r, encoding, framebuffer); } +void CConnection::serverCutText(const char* str) +{ + strFree(serverClipboard); + serverClipboard = NULL; + + serverClipboard = strDup(str); + + handleClipboardAnnounce(true); +} + void CConnection::authSuccess() { } @@ -476,6 +488,37 @@ void CConnection::resizeFramebuffer() assert(false); } +void CConnection::handleClipboardRequest() +{ +} + +void CConnection::handleClipboardAnnounce(bool available) +{ +} + +void CConnection::handleClipboardData(const char* data) +{ +} + +void CConnection::requestClipboard() +{ + if (serverClipboard != NULL) { + handleClipboardData(serverClipboard); + return; + } +} + +void CConnection::announceClipboard(bool available) +{ + if (available) + handleClipboardRequest(); +} + +void CConnection::sendClipboardData(const char* data) +{ + writer()->writeClientCutText(data); +} + void CConnection::refreshFramebuffer() { forceNonincremental = true; |