diff options
author | Pierre Ossman <ossman@cendio.se> | 2021-01-04 13:01:55 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2021-01-04 13:01:55 +0100 |
commit | 3a7fd223a2ea05f8781c6d3c3894ad33ef35b354 (patch) | |
tree | 74ba17eda8ac80fb1fe21bd5b074dec946a69821 | |
parent | 2a0eabec3140c5bfbff83f2c68659259ab9cd34d (diff) | |
download | tigervnc-3a7fd223a2ea05f8781c6d3c3894ad33ef35b354.tar.gz tigervnc-3a7fd223a2ea05f8781c6d3c3894ad33ef35b354.zip |
Log client/server clipboard capabilities
-rw-r--r-- | common/rfb/CMsgHandler.cxx | 41 | ||||
-rw-r--r-- | common/rfb/SMsgHandler.cxx | 44 |
2 files changed, 85 insertions, 0 deletions
diff --git a/common/rfb/CMsgHandler.cxx b/common/rfb/CMsgHandler.cxx index 9dab5d94..c6ab87ef 100644 --- a/common/rfb/CMsgHandler.cxx +++ b/common/rfb/CMsgHandler.cxx @@ -21,6 +21,7 @@ #include <rfb/Exception.h> #include <rfb/LogWriter.h> #include <rfb/CMsgHandler.h> +#include <rfb/clipboardTypes.h> #include <rfb/screenTypes.h> static rfb::LogWriter vlog("CMsgHandler"); @@ -101,6 +102,46 @@ void CMsgHandler::setLEDState(unsigned int state) void CMsgHandler::handleClipboardCaps(rdr::U32 flags, const rdr::U32* lengths) { + int i; + + vlog.debug("Got server clipboard capabilities:"); + for (i = 0;i < 16;i++) { + if (flags & (1 << i)) { + const char *type; + + switch (1 << i) { + case clipboardUTF8: + type = "Plain text"; + break; + case clipboardRTF: + type = "Rich text"; + break; + case clipboardHTML: + type = "HTML"; + break; + case clipboardDIB: + type = "Images"; + break; + case clipboardFiles: + type = "Files"; + break; + default: + vlog.debug(" Unknown format 0x%x", 1 << i); + continue; + } + + if (lengths[i] == 0) + vlog.debug(" %s (only notify)", type); + else { + char bytes[1024]; + + iecPrefix(lengths[i], "B", bytes, sizeof(bytes)); + vlog.debug(" %s (automatically send up to %s)", + type, bytes); + } + } + } + server.setClipboardCaps(flags, lengths); } diff --git a/common/rfb/SMsgHandler.cxx b/common/rfb/SMsgHandler.cxx index 32b561e7..972facb0 100644 --- a/common/rfb/SMsgHandler.cxx +++ b/common/rfb/SMsgHandler.cxx @@ -17,12 +17,16 @@ * USA. */ #include <rfb/Exception.h> +#include <rfb/LogWriter.h> #include <rfb/SMsgHandler.h> #include <rfb/ScreenSet.h> +#include <rfb/clipboardTypes.h> #include <rfb/encodings.h> using namespace rfb; +static LogWriter vlog("SMsgHandler"); + SMsgHandler::SMsgHandler() { } @@ -66,6 +70,46 @@ void SMsgHandler::setEncodings(int nEncodings, const rdr::S32* encodings) void SMsgHandler::handleClipboardCaps(rdr::U32 flags, const rdr::U32* lengths) { + int i; + + vlog.debug("Got client clipboard capabilities:"); + for (i = 0;i < 16;i++) { + if (flags & (1 << i)) { + const char *type; + + switch (1 << i) { + case clipboardUTF8: + type = "Plain text"; + break; + case clipboardRTF: + type = "Rich text"; + break; + case clipboardHTML: + type = "HTML"; + break; + case clipboardDIB: + type = "Images"; + break; + case clipboardFiles: + type = "Files"; + break; + default: + vlog.debug(" Unknown format 0x%x", 1 << i); + continue; + } + + if (lengths[i] == 0) + vlog.debug(" %s (only notify)", type); + else { + char bytes[1024]; + + iecPrefix(lengths[i], "B", bytes, sizeof(bytes)); + vlog.debug(" %s (automatically send up to %s)", + type, bytes); + } + } + } + client.setClipboardCaps(flags, lengths); } |