]> source.dussan.org Git - tigervnc.git/commitdiff
Improved code to advertise supported encoding types via protocol capabilities. Only...
authorConstantin Kaplinsky <const@tightvnc.com>
Tue, 12 Sep 2006 06:37:33 +0000 (06:37 +0000)
committerConstantin Kaplinsky <const@tightvnc.com>
Tue, 12 Sep 2006 06:37:33 +0000 (06:37 +0000)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@668 3789f03b-4d11-0410-bbf8-ca57d06f2519

common/rfb/SConnection.cxx

index d97be6cbd75b034aa593970b7887366084fb57e5..daed8f8fdf39bdd50296224000ff88e7f0925737 100644 (file)
@@ -207,6 +207,7 @@ void SConnection::offerTunneling()
   os->writeU32(nTypes);
 
   if (nTypes) {
+    // NOTE: Never executed in current version.
     state_ = RFBSTATE_TIGHT_TUNN_TYPE;
   } else {
     offerAuthentication();
@@ -425,13 +426,36 @@ void SConnection::sendInteractionCaps()
 
   // Advertise all supported encoding types (except raw encoding).
   CapsList ecaps;
-  // FIXME: Add actually registered encodings (and CopyRect which is special).
-  //        Ideally, encoders themselves should provide capability info.
+
+  // First, add true encodings.
+  for (unsigned int i = 1; i <= encodingMax; i++) {
+    if (Encoder::supported(i)) {
+      // FIXME: Ideally, encoders themselves should provide capability info.
+      switch(i) {
+      case encodingRRE:
+        ecaps.addStandard(encodingRRE,            "RRE_____");
+        break;
+      case encodingCoRRE:
+        ecaps.addStandard(encodingCoRRE,          "CORRE___");
+        break;
+      case encodingHextile:
+        ecaps.addStandard(encodingHextile,        "HEXTILE_");
+        break;
+      case encodingZRLE:
+        ecaps.addStandard(encodingZRLE,           "ZRLE____");
+        break;
+      case encodingTight:
+        ecaps.addTightExt(encodingTight,          "TIGHT___");
+        break;
+      }
+    }
+  }
+
+  // CopyRect is special - Encoder::supported() returns 0 for it,
+  // that's why we add it here explicitly.
   ecaps.addStandard(encodingCopyRect,             "COPYRECT");
-  ecaps.addStandard(encodingRRE,                  "RRE_____");
-  ecaps.addStandard(encodingHextile,              "HEXTILE_");
-  ecaps.addStandard(encodingZRLE,                 "ZRLE____");
-  ecaps.addTightExt(encodingTight,                "TIGHT___");
+
+  // Add supported pseudo encodings as well.
   ecaps.addTightExt(pseudoEncodingCompressLevel0, "COMPRLVL");
   ecaps.addTightExt(pseudoEncodingQualityLevel0,  "JPEGQLVL");
   ecaps.addTightExt(pseudoEncodingXCursor,        "X11CURSR");