summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2018-06-20 16:03:23 +0200
committerPierre Ossman <ossman@cendio.se>2018-11-01 16:11:42 +0100
commitb03512c65d962485efc9d2b206d293916e1cf01c (patch)
treebfda962d3eb5e29b10fc7776bded8f87d2d9b0a3
parent6ea58ba97b93331ef3dc8fc6daf973612561773a (diff)
downloadtigervnc-b03512c65d962485efc9d2b206d293916e1cf01c.tar.gz
tigervnc-b03512c65d962485efc9d2b206d293916e1cf01c.zip
Move client attributes out of ServerParams
ServerParams should contain the server state and not information about client settings or capabilities. Move those things up a level to the CConnection object.
-rw-r--r--common/rfb/CConnection.cxx28
-rw-r--r--common/rfb/CConnection.h9
-rw-r--r--common/rfb/ServerParams.cxx5
-rw-r--r--common/rfb/ServerParams.h7
-rw-r--r--vncviewer/CConn.cxx22
5 files changed, 36 insertions, 35 deletions
diff --git a/common/rfb/CConnection.cxx b/common/rfb/CConnection.cxx
index 98ef5862..3ea217fa 100644
--- a/common/rfb/CConnection.cxx
+++ b/common/rfb/CConnection.cxx
@@ -41,10 +41,14 @@ using namespace rfb;
static LogWriter vlog("CConnection");
CConnection::CConnection()
- : csecurity(0), is(0), os(0), reader_(0), writer_(0),
+ : csecurity(0),
+ supportsLocalCursor(false), supportsDesktopResize(false),
+ supportsLEDState(false),
+ is(0), os(0), reader_(0), writer_(0),
shared(false),
state_(RFBSTATE_UNINITIALISED), useProtocol3_3(false),
pendingPFChange(false), preferredEncoding(encodingTight),
+ compressLevel(2), qualityLevel(-1),
formatChange(false), encodingChange(false),
firstUpdate(true), pendingUpdate(false), continuousUpdates(false),
forceNonincremental(true),
@@ -498,19 +502,19 @@ int CConnection::getPreferredEncoding()
void CConnection::setCompressLevel(int level)
{
- if (server.compressLevel == level)
+ if (compressLevel == level)
return;
- server.compressLevel = level;
+ compressLevel = level;
encodingChange = true;
}
void CConnection::setQualityLevel(int level)
{
- if (server.qualityLevel == level)
+ if (qualityLevel == level)
return;
- server.qualityLevel = level;
+ qualityLevel = level;
encodingChange = true;
}
@@ -590,16 +594,16 @@ void CConnection::updateEncodings()
{
std::list<rdr::U32> encodings;
- if (server.supportsLocalCursor) {
+ if (supportsLocalCursor) {
encodings.push_back(pseudoEncodingCursorWithAlpha);
encodings.push_back(pseudoEncodingCursor);
encodings.push_back(pseudoEncodingXCursor);
}
- if (server.supportsDesktopResize) {
+ if (supportsDesktopResize) {
encodings.push_back(pseudoEncodingDesktopSize);
encodings.push_back(pseudoEncodingExtendedDesktopSize);
}
- if (server.supportsLEDState)
+ if (supportsLEDState)
encodings.push_back(pseudoEncodingLEDState);
encodings.push_back(pseudoEncodingDesktopName);
@@ -619,10 +623,10 @@ void CConnection::updateEncodings()
encodings.push_back(i);
}
- if (server.compressLevel >= 0 && server.compressLevel <= 9)
- encodings.push_back(pseudoEncodingCompressLevel0 + server.compressLevel);
- if (server.qualityLevel >= 0 && server.qualityLevel <= 9)
- encodings.push_back(pseudoEncodingQualityLevel0 + server.qualityLevel);
+ if (compressLevel >= 0 && compressLevel <= 9)
+ encodings.push_back(pseudoEncodingCompressLevel0 + compressLevel);
+ if (qualityLevel >= 0 && qualityLevel <= 9)
+ encodings.push_back(pseudoEncodingQualityLevel0 + qualityLevel);
writer()->writeSetEncodings(encodings);
}
diff --git a/common/rfb/CConnection.h b/common/rfb/CConnection.h
index a0fa54aa..5a3ef919 100644
--- a/common/rfb/CConnection.h
+++ b/common/rfb/CConnection.h
@@ -188,6 +188,13 @@ namespace rfb {
ModifiablePixelBuffer* getFramebuffer() { return framebuffer; }
+ protected:
+ // Optional capabilities that a subclass is expected to set to true
+ // if supported
+ bool supportsLocalCursor;
+ bool supportsDesktopResize;
+ bool supportsLEDState;
+
private:
// This is a default implementation of fences that automatically
// responds to requests, stating no support for synchronisation.
@@ -224,6 +231,8 @@ namespace rfb {
rfb::PixelFormat pendingPF;
int preferredEncoding;
+ int compressLevel;
+ int qualityLevel;
bool formatChange;
rfb::PixelFormat nextPF;
diff --git a/common/rfb/ServerParams.cxx b/common/rfb/ServerParams.cxx
index 289c8647..bfeb80d6 100644
--- a/common/rfb/ServerParams.cxx
+++ b/common/rfb/ServerParams.cxx
@@ -25,12 +25,9 @@ using namespace rfb;
ServerParams::ServerParams()
: majorVersion(0), minorVersion(0),
- supportsLocalCursor(false),
- supportsDesktopResize(false),
- supportsLEDState(false), supportsQEMUKeyEvent(false),
+ supportsQEMUKeyEvent(false),
supportsSetDesktopSize(false), supportsFence(false),
supportsContinuousUpdates(false),
- compressLevel(2), qualityLevel(-1),
width_(0), height_(0), name_(0),
ledState_(ledUnknown)
{
diff --git a/common/rfb/ServerParams.h b/common/rfb/ServerParams.h
index 09ebddc0..7a58ea37 100644
--- a/common/rfb/ServerParams.h
+++ b/common/rfb/ServerParams.h
@@ -69,18 +69,11 @@ namespace rfb {
unsigned int ledState() { return ledState_; }
void setLEDState(unsigned int state);
- bool supportsLocalCursor;
- bool supportsDesktopResize;
- bool supportsLEDState;
bool supportsQEMUKeyEvent;
-
bool supportsSetDesktopSize;
bool supportsFence;
bool supportsContinuousUpdates;
- int compressLevel;
- int qualityLevel;
-
private:
int width_;
diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx
index 5c40a707..b4610e6a 100644
--- a/vncviewer/CConn.cxx
+++ b/vncviewer/CConn.cxx
@@ -80,17 +80,15 @@ CConn::CConn(const char* vncServerName, network::Socket* socket=NULL)
setShared(::shared);
sock = socket;
- server.supportsLocalCursor = true;
-
- server.supportsDesktopResize = true;
-
- server.supportsLEDState = true;
+ supportsLocalCursor = true;
+ supportsDesktopResize = true;
+ supportsLEDState = true;
if (customCompressLevel)
- setCompressLevel(compressLevel);
+ setCompressLevel(::compressLevel);
if (!noJpeg)
- setQualityLevel(qualityLevel);
+ setQualityLevel(::qualityLevel);
if(sock == NULL) {
try {
@@ -452,7 +450,7 @@ void CConn::autoSelectFormatAndEncoding()
int kbitsPerSecond = sock->inStream().kbitsPerSecond();
unsigned int timeWaited = sock->inStream().timeWaited();
bool newFullColour = fullColour;
- int newQualityLevel = qualityLevel;
+ int newQualityLevel = ::qualityLevel;
// Always use Tight
setPreferredEncoding(encodingTight);
@@ -468,10 +466,10 @@ void CConn::autoSelectFormatAndEncoding()
else
newQualityLevel = 6;
- if (newQualityLevel != qualityLevel) {
+ if (newQualityLevel != ::qualityLevel) {
vlog.info(_("Throughput %d kbit/s - changing to quality %d"),
kbitsPerSecond, newQualityLevel);
- qualityLevel.setParam(newQualityLevel);
+ ::qualityLevel.setParam(newQualityLevel);
setQualityLevel(newQualityLevel);
}
}
@@ -540,12 +538,12 @@ void CConn::handleOptions(void *data)
}
if (customCompressLevel)
- self->setCompressLevel(compressLevel);
+ self->setCompressLevel(::compressLevel);
else
self->setCompressLevel(-1);
if (!noJpeg && !autoSelect)
- self->setQualityLevel(qualityLevel);
+ self->setQualityLevel(::qualityLevel);
else
self->setQualityLevel(-1);