Now possible to select tight encoding in UNIX vncviewer GUI


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@47 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/vncviewer_unix/CConn.cxx b/vncviewer_unix/CConn.cxx
index 7229cc3..faab2a4 100644
--- a/vncviewer_unix/CConn.cxx
+++ b/vncviewer_unix/CConn.cxx
@@ -53,7 +53,7 @@
   : dpy(dpy_), argc(argc_),
     argv(argv_), serverHost(0), serverPort(0), sock(sock_), viewport(0),
     desktop(0), desktopEventHandler(0),
-    currentEncoding(encodingZRLE), lastServerEncoding((unsigned int)-1),
+    currentEncoding(encodingTight), lastServerEncoding((unsigned int)-1),
     fullColour(::fullColour),
     autoSelect(::autoSelect), shared(::shared), formatChange(false),
     encodingChange(false), sameMachine(false), fullScreen(::fullScreen),
@@ -485,6 +485,7 @@
   options.veryLowColour.checked(!fullColour && lowColourLevel == 0);
   options.lowColour.checked(!fullColour && lowColourLevel == 1);
   options.mediumColour.checked(!fullColour && lowColourLevel == 2);
+  options.tight.checked(currentEncoding == encodingTight);
   options.zrle.checked(currentEncoding == encodingZRLE);
   options.hextile.checked(currentEncoding == encodingHextile);
   options.raw.checked(currentEncoding == encodingRaw);
@@ -514,7 +515,8 @@
       formatChange = true;
     }
   }
-  unsigned int newEncoding = (options.zrle.checked() ? encodingZRLE :
+  unsigned int newEncoding = (options.tight.checked() ? encodingTight :
+			      options.zrle.checked() ? encodingZRLE :
                               options.hextile.checked() ? encodingHextile :
                               encodingRaw);
   if (newEncoding != currentEncoding) {
@@ -599,7 +601,7 @@
 // to the connection speed:
 //   Above 16Mbps (timing for at least a second), same machine, switch to raw
 //   Above 3Mbps, switch to hextile
-//   Below 1.5Mbps, switch to ZRLE
+//   Below 1.5Mbps, switch to Tight
 //   Above 1Mbps, switch to full colour mode
 void CConn::autoSelectFormatAndEncoding()
 {
@@ -612,7 +614,7 @@
   } else if (kbitsPerSecond > 3000) {
     newEncoding = encodingHextile;
   } else if (kbitsPerSecond < 1500) {
-    newEncoding = encodingZRLE;
+    newEncoding = encodingTight;
   }
 
   if (newEncoding != currentEncoding) {
diff --git a/vncviewer_unix/OptionsDialog.h b/vncviewer_unix/OptionsDialog.h
index 96268cc..3963990 100644
--- a/vncviewer_unix/OptionsDialog.h
+++ b/vncviewer_unix/OptionsDialog.h
@@ -48,6 +48,7 @@
       mediumColour(dpy, "Medium (256 colours)", this, true, this),
       lowColour(dpy, "Low (64 colours)", this, true, this),
       veryLowColour(dpy, "Very low (8 colours)", this, true, this),
+      tight(dpy, "Tight", this, true, this),
       zrle(dpy, "ZRLE", this, true, this),
       hextile(dpy, "Hextile", this, true, this),
       raw(dpy, "Raw", this, true, this),
@@ -70,14 +71,16 @@
     int x2 = xPad + autoSelect.width() + xPad*5;
     fullColour.move(x2, y);
     y += autoSelect.height();
-    zrle.move(xPad, y);
+    tight.move(xPad, y);
     mediumColour.move(x2, y);
+    y += tight.height();
+    zrle.move(xPad, y);
+    lowColour.move(x2, y);
     y += zrle.height();
     hextile.move(xPad, y);
-    lowColour.move(x2, y);
+    veryLowColour.move(x2, y);
     y += hextile.height();
     raw.move(xPad, y);
-    veryLowColour.move(x2, y);
     y += raw.height();
 
     y += yPad*4;
@@ -113,6 +116,7 @@
 
   virtual void initDialog() {
     if (cb) cb->setOptions();
+    tight.disabled(autoSelect.checked());
     zrle.disabled(autoSelect.checked());
     hextile.disabled(autoSelect.checked());
     raw.disabled(autoSelect.checked());
@@ -135,6 +139,7 @@
 
   virtual void checkboxSelect(TXCheckbox* checkbox) {
     if (checkbox == &autoSelect) {
+      tight.disabled(autoSelect.checked());
       zrle.disabled(autoSelect.checked());
       hextile.disabled(autoSelect.checked());
       raw.disabled(autoSelect.checked());
@@ -144,7 +149,8 @@
       mediumColour.checked(checkbox == &mediumColour);
       lowColour.checked(checkbox == &lowColour);
       veryLowColour.checked(checkbox == &veryLowColour);
-    } else if (checkbox == &zrle || checkbox == &hextile || checkbox == &raw) {
+    } else if (checkbox == &tight || checkbox == &zrle || checkbox == &hextile || checkbox == &raw) {
+      tight.checked(checkbox == &tight);
       zrle.checked(checkbox == &zrle);
       hextile.checked(checkbox == &hextile);
       raw.checked(checkbox == &raw);
@@ -159,7 +165,7 @@
   TXLabel formatAndEnc, inputs, misc;
   TXCheckbox autoSelect;
   TXCheckbox fullColour, mediumColour, lowColour, veryLowColour;
-  TXCheckbox zrle, hextile, raw;
+  TXCheckbox tight, zrle, hextile, raw;
   TXCheckbox viewOnly, acceptClipboard, sendClipboard, sendPrimary;
   TXCheckbox shared, fullScreen, useLocalCursor, dotWhenNoCursor;
   TXButton okButton, cancelButton;