diff options
author | Pierre Ossman <ossman@cendio.se> | 2011-11-14 16:22:23 +0000 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2011-11-14 16:22:23 +0000 |
commit | c898d9af833212adc2ac5839899d82895976dee9 (patch) | |
tree | e426a325ba8346e1fc54a4ba780adffb883bd04e /common | |
parent | e28bdb22ff9cc95dfadee4437c1a5a4328d083cd (diff) | |
download | tigervnc-c898d9af833212adc2ac5839899d82895976dee9.tar.gz tigervnc-c898d9af833212adc2ac5839899d82895976dee9.zip |
Basic infrastructure for continuous updates.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4801 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'common')
-rw-r--r-- | common/rfb/CMsgHandler.cxx | 5 | ||||
-rw-r--r-- | common/rfb/CMsgHandler.h | 1 | ||||
-rw-r--r-- | common/rfb/CMsgReaderV3.cxx | 6 | ||||
-rw-r--r-- | common/rfb/CMsgReaderV3.h | 1 | ||||
-rw-r--r-- | common/rfb/CMsgWriter.cxx | 1 | ||||
-rw-r--r-- | common/rfb/CMsgWriter.h | 2 | ||||
-rw-r--r-- | common/rfb/CMsgWriterV3.cxx | 18 | ||||
-rw-r--r-- | common/rfb/CMsgWriterV3.h | 2 | ||||
-rw-r--r-- | common/rfb/ConnParams.cxx | 3 | ||||
-rw-r--r-- | common/rfb/ConnParams.h | 1 | ||||
-rw-r--r-- | common/rfb/SConnection.cxx | 5 | ||||
-rw-r--r-- | common/rfb/SConnection.h | 5 | ||||
-rw-r--r-- | common/rfb/SMsgHandler.cxx | 9 | ||||
-rw-r--r-- | common/rfb/SMsgHandler.h | 8 | ||||
-rw-r--r-- | common/rfb/SMsgReaderV3.cxx | 16 | ||||
-rw-r--r-- | common/rfb/SMsgReaderV3.h | 1 | ||||
-rw-r--r-- | common/rfb/SMsgWriter.h | 4 | ||||
-rw-r--r-- | common/rfb/SMsgWriterV3.cxx | 9 | ||||
-rw-r--r-- | common/rfb/SMsgWriterV3.h | 1 | ||||
-rw-r--r-- | common/rfb/encodings.h | 1 | ||||
-rw-r--r-- | common/rfb/msgTypes.h | 4 |
21 files changed, 102 insertions, 1 deletions
diff --git a/common/rfb/CMsgHandler.cxx b/common/rfb/CMsgHandler.cxx index 53f496b0..eff47766 100644 --- a/common/rfb/CMsgHandler.cxx +++ b/common/rfb/CMsgHandler.cxx @@ -69,3 +69,8 @@ void CMsgHandler::fence(rdr::U32 flags, unsigned len, const char data[]) { cp.supportsFence = true; } + +void CMsgHandler::endOfContinuousUpdates() +{ + cp.supportsContinuousUpdates = true; +} diff --git a/common/rfb/CMsgHandler.h b/common/rfb/CMsgHandler.h index 1e30eebb..d69d4f21 100644 --- a/common/rfb/CMsgHandler.h +++ b/common/rfb/CMsgHandler.h @@ -54,6 +54,7 @@ namespace rfb { virtual void setPixelFormat(const PixelFormat& pf); virtual void setName(const char* name); virtual void fence(rdr::U32 flags, unsigned len, const char data[]); + virtual void endOfContinuousUpdates(); virtual void serverInit() = 0; virtual void framebufferUpdateStart() = 0; diff --git a/common/rfb/CMsgReaderV3.cxx b/common/rfb/CMsgReaderV3.cxx index ebf08d32..085cc5ad 100644 --- a/common/rfb/CMsgReaderV3.cxx +++ b/common/rfb/CMsgReaderV3.cxx @@ -61,6 +61,7 @@ void CMsgReaderV3::readMsg() case msgTypeBell: readBell(); break; case msgTypeServerCutText: readServerCutText(); break; case msgTypeServerFence: readFence(); break; + case msgTypeEndOfContinuousUpdates: readEndOfContinuousUpdates(); break; default: fprintf(stderr, "unknown message type %d\n", type); @@ -166,3 +167,8 @@ void CMsgReaderV3::readFence() handler->fence(flags, len, data); } + +void CMsgReaderV3::readEndOfContinuousUpdates() +{ + handler->endOfContinuousUpdates(); +} diff --git a/common/rfb/CMsgReaderV3.h b/common/rfb/CMsgReaderV3.h index 9f55c650..bff70ef4 100644 --- a/common/rfb/CMsgReaderV3.h +++ b/common/rfb/CMsgReaderV3.h @@ -33,6 +33,7 @@ namespace rfb { virtual void readSetDesktopName(int x, int y, int w, int h); virtual void readExtendedDesktopSize(int x, int y, int w, int h); virtual void readFence(); + virtual void readEndOfContinuousUpdates(); int nUpdateRectsLeft; }; } diff --git a/common/rfb/CMsgWriter.cxx b/common/rfb/CMsgWriter.cxx index f221f229..ddc25ff7 100644 --- a/common/rfb/CMsgWriter.cxx +++ b/common/rfb/CMsgWriter.cxx @@ -71,6 +71,7 @@ void CMsgWriter::writeSetEncodings(int preferredEncoding, bool useCopyRect) encodings[nEncodings++] = pseudoEncodingDesktopName; encodings[nEncodings++] = pseudoEncodingLastRect; + encodings[nEncodings++] = pseudoEncodingContinuousUpdates; encodings[nEncodings++] = pseudoEncodingFence; if (Decoder::supported(preferredEncoding)) { diff --git a/common/rfb/CMsgWriter.h b/common/rfb/CMsgWriter.h index e5cc590b..66174598 100644 --- a/common/rfb/CMsgWriter.h +++ b/common/rfb/CMsgWriter.h @@ -46,6 +46,8 @@ namespace rfb { virtual void writeSetDesktopSize(int width, int height, const ScreenSet& layout)=0; virtual void writeFence(rdr::U32 flags, unsigned len, const char data[])=0; + virtual void writeEnableContinuousUpdates(bool enable, + int x, int y, int w, int h)=0; // CMsgWriter implemented methods virtual void writeSetPixelFormat(const PixelFormat& pf); diff --git a/common/rfb/CMsgWriterV3.cxx b/common/rfb/CMsgWriterV3.cxx index ab3680a9..b96e2b37 100644 --- a/common/rfb/CMsgWriterV3.cxx +++ b/common/rfb/CMsgWriterV3.cxx @@ -97,3 +97,21 @@ void CMsgWriterV3::writeFence(rdr::U32 flags, unsigned len, const char data[]) endMsg(); } + +void CMsgWriterV3::writeEnableContinuousUpdates(bool enable, + int x, int y, int w, int h) +{ + if (!cp->supportsContinuousUpdates) + throw Exception("Server does not support continuous updates"); + + startMsg(msgTypeEnableContinuousUpdates); + + os->writeU8(!!enable); + + os->writeU16(x); + os->writeU16(y); + os->writeU16(w); + os->writeU16(h); + + endMsg(); +} diff --git a/common/rfb/CMsgWriterV3.h b/common/rfb/CMsgWriterV3.h index a0b9cab8..fb1c42c0 100644 --- a/common/rfb/CMsgWriterV3.h +++ b/common/rfb/CMsgWriterV3.h @@ -34,6 +34,8 @@ namespace rfb { virtual void writeSetDesktopSize(int width, int height, const ScreenSet& layout); virtual void writeFence(rdr::U32 flags, unsigned len, const char data[]); + virtual void writeEnableContinuousUpdates(bool enable, + int x, int y, int w, int h); }; } #endif diff --git a/common/rfb/ConnParams.cxx b/common/rfb/ConnParams.cxx index 35b0054f..2f0e275e 100644 --- a/common/rfb/ConnParams.cxx +++ b/common/rfb/ConnParams.cxx @@ -34,6 +34,7 @@ ConnParams::ConnParams() supportsDesktopResize(false), supportsExtendedDesktopSize(false), supportsDesktopRename(false), supportsLastRect(false), supportsSetDesktopSize(false), supportsFence(false), + supportsContinuousUpdates(false), customCompressLevel(false), compressLevel(6), noJpeg(false), qualityLevel(-1), fineQualityLevel(-1), subsampling(SUBSAMP_UNDEFINED), @@ -127,6 +128,8 @@ void ConnParams::setEncodings(int nEncodings, const rdr::S32* encodings) supportsLastRect = true; else if (encodings[i] == pseudoEncodingFence) supportsFence = true; + else if (encodings[i] == pseudoEncodingContinuousUpdates) + supportsContinuousUpdates = true; else if (encodings[i] >= pseudoEncodingCompressLevel0 && encodings[i] <= pseudoEncodingCompressLevel9) { customCompressLevel = true; diff --git a/common/rfb/ConnParams.h b/common/rfb/ConnParams.h index 35e06050..fa0fe022 100644 --- a/common/rfb/ConnParams.h +++ b/common/rfb/ConnParams.h @@ -81,6 +81,7 @@ namespace rfb { bool supportsSetDesktopSize; bool supportsFence; + bool supportsContinuousUpdates; bool customCompressLevel; int compressLevel; diff --git a/common/rfb/SConnection.cxx b/common/rfb/SConnection.cxx index ea565432..941d30a1 100644 --- a/common/rfb/SConnection.cxx +++ b/common/rfb/SConnection.cxx @@ -342,3 +342,8 @@ void SConnection::fence(rdr::U32 flags, unsigned len, const char data[]) writer()->writeFence(flags, len, data); } + +void SConnection::enableContinuousUpdates(bool enable, + int x, int y, int w, int h) +{ +} diff --git a/common/rfb/SConnection.h b/common/rfb/SConnection.h index 51ceac06..a3a9fc8f 100644 --- a/common/rfb/SConnection.h +++ b/common/rfb/SConnection.h @@ -113,6 +113,11 @@ namespace rfb { // support. virtual void fence(rdr::U32 flags, unsigned len, const char data[]); + // enableContinuousUpdates() is called when the client wants to enable + // or disable continuous updates, or change the active area. + virtual void enableContinuousUpdates(bool enable, + int x, int y, int w, int h); + // setAccessRights() allows a security package to limit the access rights // of a VNCSConnectionST to the server. How the access rights are treated // is up to the derived class. diff --git a/common/rfb/SMsgHandler.cxx b/common/rfb/SMsgHandler.cxx index ff15e196..d4046b1b 100644 --- a/common/rfb/SMsgHandler.cxx +++ b/common/rfb/SMsgHandler.cxx @@ -41,9 +41,10 @@ void SMsgHandler::setPixelFormat(const PixelFormat& pf) void SMsgHandler::setEncodings(int nEncodings, rdr::S32* encodings) { - bool firstFence; + bool firstFence, firstContinuousUpdates; firstFence = !cp.supportsFence; + firstContinuousUpdates = !cp.supportsContinuousUpdates; cp.setEncodings(nEncodings, encodings); @@ -51,6 +52,8 @@ void SMsgHandler::setEncodings(int nEncodings, rdr::S32* encodings) if (cp.supportsFence && firstFence) supportsFence(); + if (cp.supportsContinuousUpdates && firstContinuousUpdates) + supportsContinuousUpdates(); } void SMsgHandler::supportsLocalCursor() @@ -61,6 +64,10 @@ void SMsgHandler::supportsFence() { } +void SMsgHandler::supportsContinuousUpdates() +{ +} + void SMsgHandler::setDesktopSize(int fb_width, int fb_height, const ScreenSet& layout) { diff --git a/common/rfb/SMsgHandler.h b/common/rfb/SMsgHandler.h index 0b1fd7ee..c21cf528 100644 --- a/common/rfb/SMsgHandler.h +++ b/common/rfb/SMsgHandler.h @@ -51,6 +51,8 @@ namespace rfb { virtual void setDesktopSize(int fb_width, int fb_height, const ScreenSet& layout) = 0; virtual void fence(rdr::U32 flags, unsigned len, const char data[]) = 0; + virtual void enableContinuousUpdates(bool enable, + int x, int y, int w, int h) = 0; // InputHandler interface // The InputHandler methods will be called for the corresponding messages. @@ -66,6 +68,12 @@ namespace rfb { // the client of server support. virtual void supportsFence(); + // supportsContinuousUpdates() is called the first time we detect that + // the client wants the continuous updates extension. A + // EndOfContinuousUpdates message should be sent back to the client at + // this point if it is supported. + virtual void supportsContinuousUpdates(); + ConnParams cp; }; } diff --git a/common/rfb/SMsgReaderV3.cxx b/common/rfb/SMsgReaderV3.cxx index eddeccf0..cd957b9a 100644 --- a/common/rfb/SMsgReaderV3.cxx +++ b/common/rfb/SMsgReaderV3.cxx @@ -55,6 +55,7 @@ void SMsgReaderV3::readMsg() case msgTypeClientCutText: readClientCutText(); break; case msgTypeSetDesktopSize: readSetDesktopSize(); break; case msgTypeClientFence: readFence(); break; + case msgTypeEnableContinuousUpdates: readEnableContinuousUpdates(); break; default: fprintf(stderr, "unknown message type %d\n", msgType); @@ -113,3 +114,18 @@ void SMsgReaderV3::readFence() handler->fence(flags, len, data); } + +void SMsgReaderV3::readEnableContinuousUpdates() +{ + bool enable; + int x, y, w, h; + + enable = is->readU8(); + + x = is->readU16(); + y = is->readU16(); + w = is->readU16(); + h = is->readU16(); + + handler->enableContinuousUpdates(enable, x, y, w, h); +} diff --git a/common/rfb/SMsgReaderV3.h b/common/rfb/SMsgReaderV3.h index f4cc7d7e..805fd876 100644 --- a/common/rfb/SMsgReaderV3.h +++ b/common/rfb/SMsgReaderV3.h @@ -31,6 +31,7 @@ namespace rfb { protected: virtual void readSetDesktopSize(); virtual void readFence(); + virtual void readEnableContinuousUpdates(); }; } #endif diff --git a/common/rfb/SMsgWriter.h b/common/rfb/SMsgWriter.h index aaa98e44..3933b38c 100644 --- a/common/rfb/SMsgWriter.h +++ b/common/rfb/SMsgWriter.h @@ -69,6 +69,10 @@ namespace rfb { // writeFence() sends a new fence request or response to the client. virtual void writeFence(rdr::U32 flags, unsigned len, const char data[])=0; + // writeEndOfContinuousUpdates() indicates that we have left continuous + // updates mode. + virtual void writeEndOfContinuousUpdates()=0; + // setupCurrentEncoder() should be called before each framebuffer update, // prior to calling getNumRects() or writeFramebufferUpdateStart(). void setupCurrentEncoder(); diff --git a/common/rfb/SMsgWriterV3.cxx b/common/rfb/SMsgWriterV3.cxx index 0867b107..86f35078 100644 --- a/common/rfb/SMsgWriterV3.cxx +++ b/common/rfb/SMsgWriterV3.cxx @@ -82,6 +82,15 @@ void SMsgWriterV3::writeFence(rdr::U32 flags, unsigned len, const char data[]) endMsg(); } +void SMsgWriterV3::writeEndOfContinuousUpdates() +{ + if (!cp->supportsContinuousUpdates) + throw Exception("Client does not support continuous updates"); + + startMsg(msgTypeEndOfContinuousUpdates); + endMsg(); +} + bool SMsgWriterV3::writeSetDesktopSize() { if (!cp->supportsDesktopResize) return false; needSetDesktopSize = true; diff --git a/common/rfb/SMsgWriterV3.h b/common/rfb/SMsgWriterV3.h index 35f1f94b..6710fa6b 100644 --- a/common/rfb/SMsgWriterV3.h +++ b/common/rfb/SMsgWriterV3.h @@ -36,6 +36,7 @@ namespace rfb { virtual void startMsg(int type); virtual void endMsg(); virtual void writeFence(rdr::U32 flags, unsigned len, const char data[]); + virtual void writeEndOfContinuousUpdates(); virtual bool writeSetDesktopSize(); virtual bool writeExtendedDesktopSize(); virtual bool writeExtendedDesktopSize(rdr::U16 reason, rdr::U16 result, diff --git a/common/rfb/encodings.h b/common/rfb/encodings.h index 84844c53..5c6c5eab 100644 --- a/common/rfb/encodings.h +++ b/common/rfb/encodings.h @@ -37,6 +37,7 @@ namespace rfb { const int pseudoEncodingExtendedDesktopSize = -308; const int pseudoEncodingDesktopName = -307; const int pseudoEncodingFence = -312; + const int pseudoEncodingContinuousUpdates = -313; // TightVNC-specific const int pseudoEncodingLastRect = -224; diff --git a/common/rfb/msgTypes.h b/common/rfb/msgTypes.h index e42d95af..a55e1c50 100644 --- a/common/rfb/msgTypes.h +++ b/common/rfb/msgTypes.h @@ -26,6 +26,8 @@ namespace rfb { const int msgTypeBell = 2; const int msgTypeServerCutText = 3; + const int msgTypeEndOfContinuousUpdates = 150; + const int msgTypeServerFence = 248; // client to server @@ -38,6 +40,8 @@ namespace rfb { const int msgTypePointerEvent = 5; const int msgTypeClientCutText = 6; + const int msgTypeEnableContinuousUpdates = 150; + const int msgTypeClientFence = 248; const int msgTypeSetDesktopSize = 251; |