Revision: 4801
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4801&view=rev
Author:   ossman_
Date:     2011-11-14 16:22:23 +0000 (Mon, 14 Nov 2011)
Log Message:
-----------
Basic infrastructure for continuous updates.

Modified Paths:
--------------
    trunk/common/rfb/CMsgHandler.cxx
    trunk/common/rfb/CMsgHandler.h
    trunk/common/rfb/CMsgReaderV3.cxx
    trunk/common/rfb/CMsgReaderV3.h
    trunk/common/rfb/CMsgWriter.cxx
    trunk/common/rfb/CMsgWriter.h
    trunk/common/rfb/CMsgWriterV3.cxx
    trunk/common/rfb/CMsgWriterV3.h
    trunk/common/rfb/ConnParams.cxx
    trunk/common/rfb/ConnParams.h
    trunk/common/rfb/SConnection.cxx
    trunk/common/rfb/SConnection.h
    trunk/common/rfb/SMsgHandler.cxx
    trunk/common/rfb/SMsgHandler.h
    trunk/common/rfb/SMsgReaderV3.cxx
    trunk/common/rfb/SMsgReaderV3.h
    trunk/common/rfb/SMsgWriter.h
    trunk/common/rfb/SMsgWriterV3.cxx
    trunk/common/rfb/SMsgWriterV3.h
    trunk/common/rfb/encodings.h
    trunk/common/rfb/msgTypes.h

Modified: trunk/common/rfb/CMsgHandler.cxx
===================================================================
--- trunk/common/rfb/CMsgHandler.cxx    2011-11-14 16:02:06 UTC (rev 4800)
+++ trunk/common/rfb/CMsgHandler.cxx    2011-11-14 16:22:23 UTC (rev 4801)
@@ -69,3 +69,8 @@
 {
   cp.supportsFence = true;
 }
+
+void CMsgHandler::endOfContinuousUpdates()
+{
+  cp.supportsContinuousUpdates = true;
+}

Modified: trunk/common/rfb/CMsgHandler.h
===================================================================
--- trunk/common/rfb/CMsgHandler.h      2011-11-14 16:02:06 UTC (rev 4800)
+++ trunk/common/rfb/CMsgHandler.h      2011-11-14 16:22:23 UTC (rev 4801)
@@ -54,6 +54,7 @@
     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;

Modified: trunk/common/rfb/CMsgReaderV3.cxx
===================================================================
--- trunk/common/rfb/CMsgReaderV3.cxx   2011-11-14 16:02:06 UTC (rev 4800)
+++ trunk/common/rfb/CMsgReaderV3.cxx   2011-11-14 16:22:23 UTC (rev 4801)
@@ -61,6 +61,7 @@
     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 @@
   
   handler->fence(flags, len, data);
 }
+
+void CMsgReaderV3::readEndOfContinuousUpdates()
+{
+  handler->endOfContinuousUpdates();
+}

Modified: trunk/common/rfb/CMsgReaderV3.h
===================================================================
--- trunk/common/rfb/CMsgReaderV3.h     2011-11-14 16:02:06 UTC (rev 4800)
+++ trunk/common/rfb/CMsgReaderV3.h     2011-11-14 16:22:23 UTC (rev 4801)
@@ -33,6 +33,7 @@
     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;
   };
 }

Modified: trunk/common/rfb/CMsgWriter.cxx
===================================================================
--- trunk/common/rfb/CMsgWriter.cxx     2011-11-14 16:02:06 UTC (rev 4800)
+++ trunk/common/rfb/CMsgWriter.cxx     2011-11-14 16:22:23 UTC (rev 4801)
@@ -71,6 +71,7 @@
     encodings[nEncodings++] = pseudoEncodingDesktopName;
 
   encodings[nEncodings++] = pseudoEncodingLastRect;
+  encodings[nEncodings++] = pseudoEncodingContinuousUpdates;
   encodings[nEncodings++] = pseudoEncodingFence;
 
   if (Decoder::supported(preferredEncoding)) {

Modified: trunk/common/rfb/CMsgWriter.h
===================================================================
--- trunk/common/rfb/CMsgWriter.h       2011-11-14 16:02:06 UTC (rev 4800)
+++ trunk/common/rfb/CMsgWriter.h       2011-11-14 16:22:23 UTC (rev 4801)
@@ -46,6 +46,8 @@
     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);

Modified: trunk/common/rfb/CMsgWriterV3.cxx
===================================================================
--- trunk/common/rfb/CMsgWriterV3.cxx   2011-11-14 16:02:06 UTC (rev 4800)
+++ trunk/common/rfb/CMsgWriterV3.cxx   2011-11-14 16:22:23 UTC (rev 4801)
@@ -97,3 +97,21 @@
 
   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();
+}

Modified: trunk/common/rfb/CMsgWriterV3.h
===================================================================
--- trunk/common/rfb/CMsgWriterV3.h     2011-11-14 16:02:06 UTC (rev 4800)
+++ trunk/common/rfb/CMsgWriterV3.h     2011-11-14 16:22:23 UTC (rev 4801)
@@ -34,6 +34,8 @@
     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

Modified: trunk/common/rfb/ConnParams.cxx
===================================================================
--- trunk/common/rfb/ConnParams.cxx     2011-11-14 16:02:06 UTC (rev 4800)
+++ trunk/common/rfb/ConnParams.cxx     2011-11-14 16:22:23 UTC (rev 4801)
@@ -34,6 +34,7 @@
     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 @@
       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;

Modified: trunk/common/rfb/ConnParams.h
===================================================================
--- trunk/common/rfb/ConnParams.h       2011-11-14 16:02:06 UTC (rev 4800)
+++ trunk/common/rfb/ConnParams.h       2011-11-14 16:22:23 UTC (rev 4801)
@@ -81,6 +81,7 @@
 
     bool supportsSetDesktopSize;
     bool supportsFence;
+    bool supportsContinuousUpdates;
 
     bool customCompressLevel;
     int compressLevel;

Modified: trunk/common/rfb/SConnection.cxx
===================================================================
--- trunk/common/rfb/SConnection.cxx    2011-11-14 16:02:06 UTC (rev 4800)
+++ trunk/common/rfb/SConnection.cxx    2011-11-14 16:22:23 UTC (rev 4801)
@@ -342,3 +342,8 @@
 
   writer()->writeFence(flags, len, data);
 }
+
+void SConnection::enableContinuousUpdates(bool enable,
+                                          int x, int y, int w, int h)
+{
+}

Modified: trunk/common/rfb/SConnection.h
===================================================================
--- trunk/common/rfb/SConnection.h      2011-11-14 16:02:06 UTC (rev 4800)
+++ trunk/common/rfb/SConnection.h      2011-11-14 16:22:23 UTC (rev 4801)
@@ -113,6 +113,11 @@
     // 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.

Modified: trunk/common/rfb/SMsgHandler.cxx
===================================================================
--- trunk/common/rfb/SMsgHandler.cxx    2011-11-14 16:02:06 UTC (rev 4800)
+++ trunk/common/rfb/SMsgHandler.cxx    2011-11-14 16:22:23 UTC (rev 4801)
@@ -41,9 +41,10 @@
 
 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 @@
 
   if (cp.supportsFence && firstFence)
     supportsFence();
+  if (cp.supportsContinuousUpdates && firstContinuousUpdates)
+    supportsContinuousUpdates();
 }
 
 void SMsgHandler::supportsLocalCursor()
@@ -61,6 +64,10 @@
 {
 }
 
+void SMsgHandler::supportsContinuousUpdates()
+{
+}
+
 void SMsgHandler::setDesktopSize(int fb_width, int fb_height,
                                  const ScreenSet& layout)
 {

Modified: trunk/common/rfb/SMsgHandler.h
===================================================================
--- trunk/common/rfb/SMsgHandler.h      2011-11-14 16:02:06 UTC (rev 4800)
+++ trunk/common/rfb/SMsgHandler.h      2011-11-14 16:22:23 UTC (rev 4801)
@@ -51,6 +51,8 @@
     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 @@
     // 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;
   };
 }

Modified: trunk/common/rfb/SMsgReaderV3.cxx
===================================================================
--- trunk/common/rfb/SMsgReaderV3.cxx   2011-11-14 16:02:06 UTC (rev 4800)
+++ trunk/common/rfb/SMsgReaderV3.cxx   2011-11-14 16:22:23 UTC (rev 4801)
@@ -55,6 +55,7 @@
   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 @@
   
   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);
+}

Modified: trunk/common/rfb/SMsgReaderV3.h
===================================================================
--- trunk/common/rfb/SMsgReaderV3.h     2011-11-14 16:02:06 UTC (rev 4800)
+++ trunk/common/rfb/SMsgReaderV3.h     2011-11-14 16:22:23 UTC (rev 4801)
@@ -31,6 +31,7 @@
   protected:
     virtual void readSetDesktopSize();
     virtual void readFence();
+    virtual void readEnableContinuousUpdates();
   };
 }
 #endif

Modified: trunk/common/rfb/SMsgWriter.h
===================================================================
--- trunk/common/rfb/SMsgWriter.h       2011-11-14 16:02:06 UTC (rev 4800)
+++ trunk/common/rfb/SMsgWriter.h       2011-11-14 16:22:23 UTC (rev 4801)
@@ -69,6 +69,10 @@
     // 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();

Modified: trunk/common/rfb/SMsgWriterV3.cxx
===================================================================
--- trunk/common/rfb/SMsgWriterV3.cxx   2011-11-14 16:02:06 UTC (rev 4800)
+++ trunk/common/rfb/SMsgWriterV3.cxx   2011-11-14 16:22:23 UTC (rev 4801)
@@ -82,6 +82,15 @@
   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;

Modified: trunk/common/rfb/SMsgWriterV3.h
===================================================================
--- trunk/common/rfb/SMsgWriterV3.h     2011-11-14 16:02:06 UTC (rev 4800)
+++ trunk/common/rfb/SMsgWriterV3.h     2011-11-14 16:22:23 UTC (rev 4801)
@@ -36,6 +36,7 @@
     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,

Modified: trunk/common/rfb/encodings.h
===================================================================
--- trunk/common/rfb/encodings.h        2011-11-14 16:02:06 UTC (rev 4800)
+++ trunk/common/rfb/encodings.h        2011-11-14 16:22:23 UTC (rev 4801)
@@ -37,6 +37,7 @@
   const int pseudoEncodingExtendedDesktopSize = -308;
   const int pseudoEncodingDesktopName = -307;
   const int pseudoEncodingFence = -312;
+  const int pseudoEncodingContinuousUpdates = -313;
 
   // TightVNC-specific
   const int pseudoEncodingLastRect = -224;

Modified: trunk/common/rfb/msgTypes.h
===================================================================
--- trunk/common/rfb/msgTypes.h 2011-11-14 16:02:06 UTC (rev 4800)
+++ trunk/common/rfb/msgTypes.h 2011-11-14 16:22:23 UTC (rev 4801)
@@ -26,6 +26,8 @@
   const int msgTypeBell = 2;
   const int msgTypeServerCutText = 3;
 
+  const int msgTypeEndOfContinuousUpdates = 150;
+
   const int msgTypeServerFence = 248;
 
   // client to server
@@ -38,6 +40,8 @@
   const int msgTypePointerEvent = 5;
   const int msgTypeClientCutText = 6;
 
+  const int msgTypeEnableContinuousUpdates = 150;
+
   const int msgTypeClientFence = 248;
 
   const int msgTypeSetDesktopSize = 251;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Tigervnc-commits mailing list
Tigervnc-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-commits

Reply via email to