Browse Source

Move server cut text handler to Viewport

That way both incoming and outgoing clipboard are both in the same
place, making things clearer.
tags/v1.8.90
Pierre Ossman 6 years ago
parent
commit
4c20423fb2
5 changed files with 43 additions and 26 deletions
  1. 1
    26
      vncviewer/CConn.cxx
  2. 6
    0
      vncviewer/DesktopWindow.cxx
  3. 3
    0
      vncviewer/DesktopWindow.h
  4. 30
    0
      vncviewer/Viewport.cxx
  5. 3
    0
      vncviewer/Viewport.h

+ 1
- 26
vncviewer/CConn.cxx View File

@@ -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)

+ 6
- 0
vncviewer/DesktopWindow.cxx View File

@@ -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)

+ 3
- 0
vncviewer/DesktopWindow.h View File

@@ -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);

+ 30
- 0
vncviewer/Viewport.cxx View File

@@ -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",

+ 3
- 0
vncviewer/Viewport.h View File

@@ -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);

Loading…
Cancel
Save