aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2018-06-20 15:47:49 +0200
committerPierre Ossman <ossman@cendio.se>2018-11-01 16:11:42 +0100
commit6ea58ba97b93331ef3dc8fc6daf973612561773a (patch)
treef4c203274e1a5ee8de7053431dbe0f6a8e9bee2c /common
parentdc738ac7545585b12e904f8ebc90327acbc51ddf (diff)
downloadtigervnc-6ea58ba97b93331ef3dc8fc6daf973612561773a.tar.gz
tigervnc-6ea58ba97b93331ef3dc8fc6daf973612561773a.zip
Merge client resize capabilities
No need to have one setting for each extension. All the client code needs to indicate is if it supports resize. The common code can then map this to relevant extensions.
Diffstat (limited to 'common')
-rw-r--r--common/rfb/CConnection.cxx24
-rw-r--r--common/rfb/CConnection.h5
-rw-r--r--common/rfb/ServerParams.cxx2
-rw-r--r--common/rfb/ServerParams.h1
4 files changed, 28 insertions, 4 deletions
diff --git a/common/rfb/CConnection.cxx b/common/rfb/CConnection.cxx
index e61c2e72..98ef5862 100644
--- a/common/rfb/CConnection.cxx
+++ b/common/rfb/CConnection.cxx
@@ -73,6 +73,11 @@ void CConnection::setFramebuffer(ModifiablePixelBuffer* fb)
{
decoder.flush();
+ if (fb) {
+ assert(fb->width() == server.width());
+ assert(fb->height() == server.height());
+ }
+
if ((framebuffer != NULL) && (fb != NULL)) {
Rect rect;
@@ -334,6 +339,11 @@ void CConnection::setDesktopSize(int w, int h)
writer()->writeEnableContinuousUpdates(true, 0, 0,
server.width(),
server.height());
+
+ resizeFramebuffer();
+ assert(framebuffer != NULL);
+ assert(framebuffer->width() == server.width());
+ assert(framebuffer->height() == server.height());
}
void CConnection::setExtendedDesktopSize(unsigned reason,
@@ -349,6 +359,11 @@ void CConnection::setExtendedDesktopSize(unsigned reason,
writer()->writeEnableContinuousUpdates(true, 0, 0,
server.width(),
server.height());
+
+ resizeFramebuffer();
+ assert(framebuffer != NULL);
+ assert(framebuffer->width() == server.width());
+ assert(framebuffer->height() == server.height());
}
void CConnection::endOfContinuousUpdates()
@@ -452,6 +467,11 @@ void CConnection::initDone()
{
}
+void CConnection::resizeFramebuffer()
+{
+ assert(false);
+}
+
void CConnection::refreshFramebuffer()
{
forceNonincremental = true;
@@ -575,10 +595,10 @@ void CConnection::updateEncodings()
encodings.push_back(pseudoEncodingCursor);
encodings.push_back(pseudoEncodingXCursor);
}
- if (server.supportsDesktopResize)
+ if (server.supportsDesktopResize) {
encodings.push_back(pseudoEncodingDesktopSize);
- if (server.supportsExtendedDesktopSize)
encodings.push_back(pseudoEncodingExtendedDesktopSize);
+ }
if (server.supportsLEDState)
encodings.push_back(pseudoEncodingLEDState);
diff --git a/common/rfb/CConnection.h b/common/rfb/CConnection.h
index 56e6d143..a0fa54aa 100644
--- a/common/rfb/CConnection.h
+++ b/common/rfb/CConnection.h
@@ -127,6 +127,11 @@ namespace rfb {
// returning.
virtual void initDone() = 0;
+ // resizeFramebuffer() is called whenever the framebuffer
+ // dimensions or the screen layout changes. A subclass must make
+ // sure the pixel buffer has been updated once this call returns.
+ virtual void resizeFramebuffer();
+
// Other methods
diff --git a/common/rfb/ServerParams.cxx b/common/rfb/ServerParams.cxx
index 9ae8a60a..289c8647 100644
--- a/common/rfb/ServerParams.cxx
+++ b/common/rfb/ServerParams.cxx
@@ -26,7 +26,7 @@ using namespace rfb;
ServerParams::ServerParams()
: majorVersion(0), minorVersion(0),
supportsLocalCursor(false),
- supportsDesktopResize(false), supportsExtendedDesktopSize(false),
+ supportsDesktopResize(false),
supportsLEDState(false), supportsQEMUKeyEvent(false),
supportsSetDesktopSize(false), supportsFence(false),
supportsContinuousUpdates(false),
diff --git a/common/rfb/ServerParams.h b/common/rfb/ServerParams.h
index cae38cb5..09ebddc0 100644
--- a/common/rfb/ServerParams.h
+++ b/common/rfb/ServerParams.h
@@ -71,7 +71,6 @@ namespace rfb {
bool supportsLocalCursor;
bool supportsDesktopResize;
- bool supportsExtendedDesktopSize;
bool supportsLEDState;
bool supportsQEMUKeyEvent;