aboutsummaryrefslogtreecommitdiffstats
path: root/common/rfb/SConnection.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2014-09-17 17:11:56 +0200
committerPierre Ossman <ossman@cendio.se>2014-09-18 14:08:42 +0200
commit487008102e35ccbde59c54500700ba2b85f981c2 (patch)
tree6585b5fddd2d7a9ec272b53cd28aaa083c8e8b55 /common/rfb/SConnection.cxx
parent1ec4531ca6b37db1fa9b9cc5d5db289be32d4241 (diff)
downloadtigervnc-487008102e35ccbde59c54500700ba2b85f981c2.tar.gz
tigervnc-487008102e35ccbde59c54500700ba2b85f981c2.zip
Move preferred encoding tracking into a server object
Having it in ConnParams made the linker pull all the encoder objects into vncviewer, making it larger than necessary and giving it extra parameters in its help output that weren't relevant.
Diffstat (limited to 'common/rfb/SConnection.cxx')
-rw-r--r--common/rfb/SConnection.cxx20
1 files changed, 19 insertions, 1 deletions
diff --git a/common/rfb/SConnection.cxx b/common/rfb/SConnection.cxx
index 48acf0ac..eeaeafe4 100644
--- a/common/rfb/SConnection.cxx
+++ b/common/rfb/SConnection.cxx
@@ -26,6 +26,8 @@
#include <rfb/SMsgWriter.h>
#include <rfb/SConnection.h>
#include <rfb/ServerCore.h>
+#include <rfb/encodings.h>
+#include <rfb/EncodeManager.h>
#include <rfb/LogWriter.h>
@@ -47,7 +49,8 @@ SConnection::SConnection(bool reverseConnection_)
: readyForSetColourMapEntries(false),
is(0), os(0), reader_(0), writer_(0),
security(0), ssecurity(0), state_(RFBSTATE_UNINITIALISED),
- reverseConnection(reverseConnection_)
+ reverseConnection(reverseConnection_),
+ preferredEncoding(encodingRaw)
{
defaultMajorVersion = 3;
defaultMinorVersion = 8;
@@ -264,6 +267,21 @@ void SConnection::writeConnFailedFromScratch(const char* msg,
os->flush();
}
+void SConnection::setEncodings(int nEncodings, rdr::S32* encodings)
+{
+ int i;
+
+ preferredEncoding = encodingRaw;
+ for (i = 0;i < nEncodings;i++) {
+ if (EncodeManager::supported(encodings[i])) {
+ preferredEncoding = encodings[i];
+ break;
+ }
+ }
+
+ SMsgHandler::setEncodings(nEncodings, encodings);
+}
+
void SConnection::versionReceived()
{
}