diff options
author | Pierre Ossman <ossman@cendio.se> | 2011-05-17 09:39:07 +0000 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2011-05-17 09:39:07 +0000 |
commit | f4f309408d39b110ddf81e8815cea8da4cd0d40e (patch) | |
tree | 171dbb7f0e9f142785e06d51fa6a9e2b3eb0cb96 /vncviewer/CConn.cxx | |
parent | 0c41e1d057f0425c2687b87da4272f8eafb70ba4 (diff) | |
download | tigervnc-f4f309408d39b110ddf81e8815cea8da4cd0d40e.tar.gz tigervnc-f4f309408d39b110ddf81e8815cea8da4cd0d40e.zip |
Update connection parameters when the user has changed things in the options
dialog.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4422 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'vncviewer/CConn.cxx')
-rw-r--r-- | vncviewer/CConn.cxx | 61 |
1 files changed, 58 insertions, 3 deletions
diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx index 45189d73..9525c719 100644 --- a/vncviewer/CConn.cxx +++ b/vncviewer/CConn.cxx @@ -33,6 +33,7 @@ #include <FL/fl_ask.H> #include "CConn.h" +#include "OptionsDialog.h" #include "i18n.h" #include "parameters.h" @@ -44,6 +45,10 @@ extern void exit_vncviewer(); static rfb::LogWriter vlog("CConn"); +static const PixelFormat mediumColourPF(8,3,0,1,1,1,1,2,1,0); +static const PixelFormat lowColourPF(8,6,0,1,3,3,3,4,2,0); +static const PixelFormat verylowColourPF(8,8,0,0); + CConn::CConn(const char* vncServerName) : serverHost(0), serverPort(0), sock(NULL), desktop(NULL), currentEncoding(encodingTight), lastServerEncoding((unsigned int)-1), @@ -89,10 +94,14 @@ CConn::CConn(const char* vncServerName) setStreams(&sock->inStream(), &sock->outStream()); initialiseProtocol(); + + OptionsDialog::addCallback(handleOptions, this); } CConn::~CConn() { + OptionsDialog::removeCallback(handleOptions); + free(serverHost); if (sock) Fl::remove_fd(sock->getFd()); @@ -472,11 +481,11 @@ void CConn::requestNewUpdate() pf = fullColourPF; } else { if (lowColourLevel == 0) - pf = PixelFormat(8,3,0,1,1,1,1,2,1,0); + pf = mediumColourPF; else if (lowColourLevel == 1) - pf = PixelFormat(8,6,0,1,3,3,3,4,2,0); + pf = lowColourPF; else - pf = PixelFormat(8,8,0,0); + pf = verylowColourPF; } char str[256]; pf.print(str, 256); @@ -497,3 +506,49 @@ void CConn::requestNewUpdate() forceNonincremental = false; } + +void CConn::handleOptions(void *data) +{ + CConn *self = (CConn*)data; + + // Checking all the details of the current set of encodings is just + // a pain. Assume something has changed, as resending the encoding + // list is cheap. Avoid overriding what the auto logic has selected + // though. + if (!autoSelect) { + int encNum = encodingNum(preferredEncoding); + + if (encNum != -1) + self->currentEncoding = encNum; + + self->cp.qualityLevel = qualityLevel; + } + + self->cp.supportsLocalCursor = useLocalCursor; + + self->cp.customCompressLevel = customCompressLevel; + self->cp.compressLevel = compressLevel; + + self->cp.noJpeg = noJpeg; + + self->encodingChange = true; + + // Format changes refreshes the entire screen though and are therefore + // very costly. It's probably worth the effort to see if it is necessary + // here. + PixelFormat pf; + + if (fullColour) { + pf = self->fullColourPF; + } else { + if (lowColourLevel == 0) + pf = mediumColourPF; + else if (lowColourLevel == 1) + pf = lowColourPF; + else + pf = verylowColourPF; + } + + if (!pf.equal(self->cp.pf())) + self->formatChange = true; +} |