diff options
Diffstat (limited to 'vncviewer/Viewport.cxx')
-rw-r--r-- | vncviewer/Viewport.cxx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx index 1c0503c5..851405cd 100644 --- a/vncviewer/Viewport.cxx +++ b/vncviewer/Viewport.cxx @@ -228,6 +228,36 @@ void Viewport::updateWindow() damage(FL_DAMAGE_USER1, r.tl.x + x(), r.tl.y + y(), r.width(), r.height()); } +void Viewport::serverCutText(const char* str, rdr::U32 len) +{ + char *buffer; + int size, ret; + + if (!acceptClipboard) + return; + + size = fl_utf8froma(NULL, 0, str, len); + if (size <= 0) + return; + + size++; + + buffer = new char[size]; + + ret = fl_utf8froma(buffer, size, str, len); + assert(ret < size); + + vlog.debug("Got clipboard data (%d bytes)", (int)strlen(buffer)); + + // RFB doesn't have separate selection and clipboard concepts, so we + // dump the data into both variants. + if (setPrimary) + Fl::copy(buffer, ret, 0); + Fl::copy(buffer, ret, 1); + + delete [] buffer; +} + static const char * dotcursor_xpm[] = { "5 5 2 1", ". c #000000", |