aboutsummaryrefslogtreecommitdiffstats
path: root/vncviewer
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2018-03-26 13:32:49 +0200
committerPierre Ossman <ossman@cendio.se>2018-03-26 13:32:49 +0200
commit4c20423fb2c9cfc10909d4ca54efeedf294af993 (patch)
treeeca606cb1475185078398a24f6d908844e9c3260 /vncviewer
parentfecf0a4c79104a37ec076c3028d9fe9035077153 (diff)
downloadtigervnc-4c20423fb2c9cfc10909d4ca54efeedf294af993.tar.gz
tigervnc-4c20423fb2c9cfc10909d4ca54efeedf294af993.zip
Move server cut text handler to Viewport
That way both incoming and outgoing clipboard are both in the same place, making things clearer.
Diffstat (limited to 'vncviewer')
-rw-r--r--vncviewer/CConn.cxx27
-rw-r--r--vncviewer/DesktopWindow.cxx6
-rw-r--r--vncviewer/DesktopWindow.h3
-rw-r--r--vncviewer/Viewport.cxx30
-rw-r--r--vncviewer/Viewport.h3
5 files changed, 43 insertions, 26 deletions
diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx
index d95c6ab7..35d6e231 100644
--- a/vncviewer/CConn.cxx
+++ b/vncviewer/CConn.cxx
@@ -423,32 +423,7 @@ void CConn::bell()
void CConn::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;
+ desktop->serverCutText(str, len);
}
void CConn::dataRect(const Rect& r, int encoding)
diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx
index 306803f9..c450ea93 100644
--- a/vncviewer/DesktopWindow.cxx
+++ b/vncviewer/DesktopWindow.cxx
@@ -276,6 +276,12 @@ void DesktopWindow::resizeFramebuffer(int new_w, int new_h)
}
+void DesktopWindow::serverCutText(const char* str, rdr::U32 len)
+{
+ viewport->serverCutText(str, len);
+}
+
+
void DesktopWindow::setCursor(int width, int height,
const rfb::Point& hotspot,
const rdr::U8* data)
diff --git a/vncviewer/DesktopWindow.h b/vncviewer/DesktopWindow.h
index ce589385..6ec8e1bd 100644
--- a/vncviewer/DesktopWindow.h
+++ b/vncviewer/DesktopWindow.h
@@ -62,6 +62,9 @@ public:
// Resize the current framebuffer, but retain the contents
void resizeFramebuffer(int new_w, int new_h);
+ // Incoming clipboard from server
+ void serverCutText(const char* str, rdr::U32 len);
+
// New image for the locally rendered cursor
void setCursor(int width, int height, const rfb::Point& hotspot,
const rdr::U8* data);
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",
diff --git a/vncviewer/Viewport.h b/vncviewer/Viewport.h
index 3895fc7f..7acf3487 100644
--- a/vncviewer/Viewport.h
+++ b/vncviewer/Viewport.h
@@ -43,6 +43,9 @@ public:
// Flush updates to screen
void updateWindow();
+ // Incoming clipboard from server
+ void serverCutText(const char* str, rdr::U32 len);
+
// New image for the locally rendered cursor
void setCursor(int width, int height, const rfb::Point& hotspot,
const rdr::U8* data);