From: Constantin Kaplinsky Date: Tue, 12 Sep 2006 06:37:33 +0000 (+0000) Subject: Improved code to advertise supported encoding types via protocol capabilities. Only... X-Git-Tag: v0.0.90~384^2~215 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4ad04c16599f53ad88da91aefbb87b402b3b3eff;p=tigervnc.git Improved code to advertise supported encoding types via protocol capabilities. Only actually registered encoders are advertised now. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@668 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- diff --git a/common/rfb/SConnection.cxx b/common/rfb/SConnection.cxx index d97be6cb..daed8f8f 100644 --- a/common/rfb/SConnection.cxx +++ b/common/rfb/SConnection.cxx @@ -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");