diff options
author | Pierre Ossman <ossman@cendio.se> | 2013-02-15 08:33:39 +0000 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2013-02-15 08:33:39 +0000 |
commit | 2a7a8d60c8b5d5ded850e92a27d45e9e728b20f3 (patch) | |
tree | a1645ff8ba51bf47c2acdcb4361571f07425b110 /vncviewer/CConn.cxx | |
parent | 1e252c68268825c340e80b6532af404659e32cbb (diff) | |
download | tigervnc-2a7a8d60c8b5d5ded850e92a27d45e9e728b20f3.tar.gz tigervnc-2a7a8d60c8b5d5ded850e92a27d45e9e728b20f3.zip |
Reimplement -listen in the new FLTK vncviewer. Work done by
Justina Mickonyte for Cendio.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5041 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'vncviewer/CConn.cxx')
-rw-r--r-- | vncviewer/CConn.cxx | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx index 25e17efc..e4d55aa0 100644 --- a/vncviewer/CConn.cxx +++ b/vncviewer/CConn.cxx @@ -67,8 +67,8 @@ static const PixelFormat lowColourPF(8, 6, false, true, // 256 colours (palette) static const PixelFormat mediumColourPF(8, 8, false, false); -CConn::CConn(const char* vncServerName) - : serverHost(0), serverPort(0), sock(NULL), desktop(NULL), +CConn::CConn(const char* vncServerName, network::Socket* socket=NULL) + : serverHost(0), serverPort(0), desktop(NULL), pendingPFChange(false), currentEncoding(encodingTight), lastServerEncoding((unsigned int)-1), formatChange(false), encodingChange(false), @@ -76,6 +76,7 @@ CConn::CConn(const char* vncServerName) forceNonincremental(true), supportsSyncFence(false) { setShared(::shared); + sock = socket; int encNum = encodingNum(preferredEncoding); if (encNum != -1) @@ -93,16 +94,18 @@ CConn::CConn(const char* vncServerName) cp.noJpeg = noJpeg; cp.qualityLevel = qualityLevel; - try { - getHostAndPort(vncServerName, &serverHost, &serverPort); - - sock = new network::TcpSocket(serverHost, serverPort); - vlog.info(_("connected to host %s port %d"), serverHost, serverPort); - } catch (rdr::Exception& e) { - vlog.error("%s", e.str()); - fl_alert("%s", e.str()); - exit_vncviewer(); - return; + if(sock == NULL) { + try { + getHostAndPort(vncServerName, &serverHost, &serverPort); + + sock = new network::TcpSocket(serverHost, serverPort); + vlog.info(_("connected to host %s port %d"), serverHost, serverPort); + } catch (rdr::Exception& e) { + vlog.error("%s", e.str()); + fl_alert("%s", e.str()); + exit_vncviewer(); + return; + } } Fl::add_fd(sock->getFd(), FL_READ | FL_EXCEPT, socketEvent, this); |