Browse Source

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.
tags/v1.9.90
Pierre Ossman 5 years ago
parent
commit
b03512c65d
5 changed files with 36 additions and 35 deletions
  1. 16
    12
      common/rfb/CConnection.cxx
  2. 9
    0
      common/rfb/CConnection.h
  3. 1
    4
      common/rfb/ServerParams.cxx
  4. 0
    7
      common/rfb/ServerParams.h
  5. 10
    12
      vncviewer/CConn.cxx

+ 16
- 12
common/rfb/CConnection.cxx View File

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

+ 9
- 0
common/rfb/CConnection.h View File

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

+ 1
- 4
common/rfb/ServerParams.cxx View File

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

+ 0
- 7
common/rfb/ServerParams.h View File

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

+ 10
- 12
vncviewer/CConn.cxx View File

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


Loading…
Cancel
Save