diff options
author | Pierre Ossman <ossman@cendio.se> | 2019-05-10 11:44:19 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2019-07-01 11:18:27 +0200 |
commit | 5fbbe10b6c180ae8c0545695db6ad308cb5caea7 (patch) | |
tree | db83c70816ef00328e0da860a5b40522ce6435ae /vncviewer | |
parent | 615d16bd5ba11e89262cc5cfe94a35b6d6e7a628 (diff) | |
download | tigervnc-5fbbe10b6c180ae8c0545695db6ad308cb5caea7.tar.gz tigervnc-5fbbe10b6c180ae8c0545695db6ad308cb5caea7.zip |
Use UTF-8 in clipboard API
In prepartion for better clipboard extensions that can send Unicode
data between the client and server.
Diffstat (limited to 'vncviewer')
-rw-r--r-- | vncviewer/Viewport.cxx | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx index 713d3648..cd613279 100644 --- a/vncviewer/Viewport.cxx +++ b/vncviewer/Viewport.cxx @@ -310,14 +310,12 @@ void Viewport::handleClipboardAnnounce(bool available) void Viewport::handleClipboardData(const char* data) { - char* buffer; size_t len; if (!hasFocus()) return; - buffer = latin1ToUTF8(data); - len = strlen(buffer); + len = strlen(data); vlog.debug("Got clipboard data (%d bytes)", (int)len); @@ -325,11 +323,9 @@ void Viewport::handleClipboardData(const char* data) // dump the data into both variants. #if !defined(WIN32) && !defined(__APPLE__) if (setPrimary) - Fl::copy(buffer, len, 0); + Fl::copy(data, len, 0); #endif - Fl::copy(buffer, len, 1); - - strFree(buffer); + Fl::copy(data, len, 1); } void Viewport::setLEDState(unsigned int state) @@ -561,15 +557,13 @@ void Viewport::resize(int x, int y, int w, int h) int Viewport::handle(int event) { - char *buffer, *filtered; + char *filtered; int buttonMask, wheelMask; DownMap::const_iterator iter; switch (event) { case FL_PASTE: - buffer = utf8ToLatin1(Fl::event_text(), Fl::event_length()); - filtered = convertLF(buffer); - strFree(buffer); + filtered = convertLF(Fl::event_text(), Fl::event_length()); vlog.debug("Sending clipboard data (%d bytes)", (int)strlen(filtered)); |