<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel rdf:about="http://blog.gmane.org/gmane.network.vnc.tigervnc.scm">
    <title>gmane.network.vnc.tigervnc.scm</title>
    <link>http://blog.gmane.org/gmane.network.vnc.tigervnc.scm</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1286"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1285"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1284"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1283"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1282"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1281"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1280"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1279"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1278"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1277"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1276"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1275"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1274"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1273"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1272"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1271"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1270"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1269"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1268"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1267"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1286">
    <title>SF.net SVN: tigervnc:[4918] trunk/java/com/tigervnc/vncviewer/VncViewer. java</title>
    <link>http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1286</link>
    <description>&lt;pre&gt;Revision: 4918
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4918&amp;amp;view=rev
Author:   bphinz
Date:     2012-05-23 04:21:09 +0000 (Wed, 23 May 2012)
Log Message:
-----------
removed ANSI character escapes, not supported on Windows cmd line

Modified Paths:
--------------
    trunk/java/com/tigervnc/vncviewer/VncViewer.java

Modified: trunk/java/com/tigervnc/vncviewer/VncViewer.java
===================================================================
--- trunk/java/com/tigervnc/vncviewer/VncViewer.java2012-05-23 03:43:10 UTC (rev 4917)
+++ trunk/java/com/tigervnc/vncviewer/VncViewer.java2012-05-23 04:21:09 UTC (rev 4918)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -202,13 +202,12 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 
     Configuration.listParams(79, 14);
     String propertiesString = ("\n"+
-"\u001B[1mSystem Properties\u001B[0m (adapted from the TurboVNC vncviewer man page)\n"+
-"  When started with the -via option, vncviewer reads the\n"+
-"  \u001B[1mVNC_VIA_CMD\u001B[0m System property, expands\n"+
-"  patterns beginning with the \"%\" character, and uses the resulting\n"+
-"  command line to establish the secure tunnel to the VNC gateway.\n"+
-"  If \u001B[1mVNC_VIA_CMD\u001B[0m is not set, this \n"+
-"  command line defaults to \"/usr/bin/ssh -f -L %L:%H:%R %G sleep 20\".\n"+
+"System Properties (adapted from the TurboVNC vncviewer man page)\n"+
+"  When started with the -via option, vncviewer reads the VNC_VIA_CMD\n"+
+"  System property, expands patterns beginning with the \"%\" character,\n"+
+"  and uses the resulting command line to establish the secure tunnel\n"+
+"  to the VNC gateway.  If VNC_VIA_CMD is not set, this command line\n"+
+"  defaults to \"/usr/bin/ssh -f -L %L:%H:%R %G sleep 20\".\n"+
 "\n"+
 "  The following patterns are recognized in the VNC_VIA_CMD property\n"+
 "  (note that all of the patterns %G, %H, %L and %R must be present in \n"+
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -224,12 +223,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 "\n"+
 "  \t%R     remote TCP port number.\n"+
 "\n"+
-"  When started with the -tunnel option, vncviewer reads the\n"+
-"  \u001B[1mVNC_TUNNEL_CMD\u001B[0m System property, expands\n"+
-"  patterns beginning with the \"%\" character, and uses the resulting\n"+
-"  command line to establish the secure tunnel to the VNC server.\n"+
-"  If \u001B[1mVNC_TUNNEL_CMD\u001B[0m is not set, this command \n"+
-"  line defaults to \"/usr/bin/ssh -f -L %L:localhost:%R %H sleep 20\".\n"+
+"  When started with the -tunnel option, vncviewer reads the VNC_TUNNEL_CMD\n"+
+"  System property, expands patterns beginning with the \"%\" character, and\n"+
+"  uses the resulting command line to establish the secure tunnel to the\n"+
+"  VNC server.  If VNC_TUNNEL_CMD is not set, this command line defaults\n"+
+"  to \"/usr/bin/ssh -f -L %L:localhost:%R %H sleep 20\".\n"+
 "\n"+
 "  The following patterns are recognized in the VNC_TUNNEL_CMD property\n"+
 "  (note that all of the patterns %H, %L and %R must be present in \n"+

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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
&lt;/pre&gt;</description>
    <dc:creator>bphinz-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&lt; at &gt;public.gmane.org</dc:creator>
    <dc:date>2012-05-23T04:21:10</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1285">
    <title>SF.net SVN: tigervnc:[4917] trunk/java/com/tigervnc/vncviewer/BIPixelBuffer .java</title>
    <link>http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1285</link>
    <description>&lt;pre&gt;Revision: 4917
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4917&amp;amp;view=rev
Author:   bphinz
Date:     2012-05-23 03:43:10 +0000 (Wed, 23 May 2012)
Log Message:
-----------
Significantly improves the peak frame rate on platforms that support using BIPixelBuffer

Modified Paths:
--------------
    trunk/java/com/tigervnc/vncviewer/BIPixelBuffer.java

Modified: trunk/java/com/tigervnc/vncviewer/BIPixelBuffer.java
===================================================================
--- trunk/java/com/tigervnc/vncviewer/BIPixelBuffer.java2012-05-23 03:40:07 UTC (rev 4916)
+++ trunk/java/com/tigervnc/vncviewer/BIPixelBuffer.java2012-05-23 03:43:10 UTC (rev 4917)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -24,12 +24,25 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 import com.tigervnc.rfb.*;
 import com.tigervnc.rfb.Exception;
 
-public class BIPixelBuffer extends PlatformPixelBuffer
+public class BIPixelBuffer extends PlatformPixelBuffer implements ImageObserver
 {
   public BIPixelBuffer(int w, int h, CConn cc_, DesktopWindow desktop_) {
     super(w, h, cc_, desktop_);
+    clip = new Rectangle();
   }
 
+  public void setPF(PixelFormat pf) {
+    super.setPF(pf);
+    if (source != null)
+      source.newPixels(data, cm, 0, width_);
+  }
+
+  public void updateColourMap() {
+    cm = new IndexColorModel(8, nColours, reds, greens, blues);
+    if (source != null)
+      source.newPixels(data, cm, 0, width_);
+  }
+  
   // resize() resizes the image, preserving the image data where possible.
   public void resize(int w, int h) {
     if (w == width() &amp;amp;&amp;amp; h == height()) return;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -43,6 +56,12 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     image = gc.createCompatibleImage(w, h, Transparency.TRANSLUCENT);
     image.setAccelerationPriority(1);
     image.createGraphics();
+    data = new int[width() * height()];
+    source = new MemoryImageSource(w, h, cm, data, 0, w);
+    source.setAnimated(true);
+    source.setFullBufferUpdates(false);
+    source.newPixels(data, cm, 0, width_);
+    sourceImage = tk.createImage(source);
   }
 
   public void fillRect(int x, int y, int w, int h, int pix) {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -63,29 +82,29 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   }
 
   public void imageRect(int x, int y, int w, int h, Object pix) {
-    Graphics2D graphics = (Graphics2D)image.getGraphics();
-    Image img;
     if (pix instanceof Image) {
-      img = (Image)pix;
+      Image img = (Image)pix;
+      clip = new Rectangle(x, y, w, h); 
+      synchronized(clip) {
+        tk.prepareImage(img, -1, -1, this);
+        try {
+          clip.wait(1000);
+        } catch (InterruptedException e) {
+          throw new Exception("Error decoding JPEG data");
+        }
+      } 
+      clip = null;
+      img.flush();
     } else {
-      img = tk.createImage(new MemoryImageSource(w, h, cm, (int[])pix, 0, w));
-      img.setAccelerationPriority(1);
+      for (int j = 0; j &amp;lt; h; j++)
+        System.arraycopy(pix, (w*j), data, width_ * (y + j) + x, w);
+      source.newPixels(x, y, w, h, true);
+      Graphics2D graphics = (Graphics2D)image.getGraphics();
+      graphics.setClip(x, y, w, h);
+      graphics.drawImage(sourceImage, 0, 0, null);
+      graphics.setClip(0, 0, width(), height());
+      graphics.dispose();
     }
-    boolean ret = tk.prepareImage(img, -1, -1, null);
-    if (!ret) {
-      while ((tk.checkImage(img, -1, -1, null) &amp;amp; ImageObserver.ALLBITS) == 0) {
-        synchronized (this) {
-          try {
-            this.wait(0, 10000);
-          } catch (InterruptedException e) {
-            throw new Exception("Error decoding JPEG data");
-          }
-        }
-      }
-    } 
-    graphics.drawImage(img, x, y, w, h, null); 
-    graphics.dispose();
-    img.flush();
   }
 
   public void copyRect(int x, int y, int w, int h, int srcX, int srcY) {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -98,7 +117,29 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     return (Image)image;
   }
 
+  public boolean imageUpdate(Image img, int infoflags, int x, int y, int w, int h) {
+    if ((infoflags &amp;amp; (ALLBITS | ABORT)) == 0) {
+      return true;
+    } else {
+      if ((infoflags &amp;amp; ALLBITS) != 0) {
+        if (clip != null) {
+          synchronized(clip) {
+            Graphics2D graphics = (Graphics2D)image.getGraphics();
+            graphics.drawImage(img, clip.x, clip.y, clip.width, clip.height, null); 
+            graphics.dispose();
+            clip.notify();
+          }
+        }
+      }
+      return false;
+    }
+  }
+
   BufferedImage image;
+  MemoryImageSource source;
+  int[] data;
+  Image sourceImage;
+  Rectangle clip;
 
   static LogWriter vlog = new LogWriter("BIPixelBuffer");
 }

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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
&lt;/pre&gt;</description>
    <dc:creator>bphinz-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&lt; at &gt;public.gmane.org</dc:creator>
    <dc:date>2012-05-23T03:43:10</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1284">
    <title>SF.net SVN: tigervnc:[4916]trunk/java/com/tigervnc/vncviewer</title>
    <link>http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1284</link>
    <description>&lt;pre&gt;Revision: 4916
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4916&amp;amp;view=rev
Author:   bphinz
Date:     2012-05-23 03:40:07 +0000 (Wed, 23 May 2012)
Log Message:
-----------
Shortened SSH tunneling System property names, fixed problem with parsing of '-via' cmd line option, fixed intermittent problem with SSH password dialog.

Modified Paths:
--------------
    trunk/java/com/tigervnc/vncviewer/VncViewer.java
    trunk/java/com/tigervnc/vncviewer/tunnel.java

Modified: trunk/java/com/tigervnc/vncviewer/VncViewer.java
===================================================================
--- trunk/java/com/tigervnc/vncviewer/VncViewer.java2012-05-19 13:28:43 UTC (rev 4915)
+++ trunk/java/com/tigervnc/vncviewer/VncViewer.java2012-05-23 03:40:07 UTC (rev 4916)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -139,6 +139,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
       if (argv[i].equalsIgnoreCase("-tunnel") || argv[i].equalsIgnoreCase("-via")) {
         if (!tunnel.createTunnel(argv.length, argv, i))
           System.exit(1);
+        if (argv[i].equalsIgnoreCase("-via")) i++;
         continue;
       }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -203,10 +204,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     String propertiesString = ("\n"+
 "\u001B[1mSystem Properties\u001B[0m (adapted from the TurboVNC vncviewer man page)\n"+
 "  When started with the -via option, vncviewer reads the\n"+
-"  \u001B[1mcom.tigervnc.VNC_VIA_CMD\u001B[0m System property, expands\n"+
+"  \u001B[1mVNC_VIA_CMD\u001B[0m System property, expands\n"+
 "  patterns beginning with the \"%\" character, and uses the resulting\n"+
 "  command line to establish the secure tunnel to the VNC gateway.\n"+
-"  If \u001B[1mcom.tigervnc.VNC_VIA_CMD\u001B[0m is not set, this \n"+
+"  If \u001B[1mVNC_VIA_CMD\u001B[0m is not set, this \n"+
 "  command line defaults to \"/usr/bin/ssh -f -L %L:%H:%R %G sleep 20\".\n"+
 "\n"+
 "  The following patterns are recognized in the VNC_VIA_CMD property\n"+
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -224,10 +225,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 "  \t%R     remote TCP port number.\n"+
 "\n"+
 "  When started with the -tunnel option, vncviewer reads the\n"+
-"  \u001B[1mcom.tigervnc.VNC_TUNNEL_CMD\u001B[0m System property, expands\n"+
+"  \u001B[1mVNC_TUNNEL_CMD\u001B[0m System property, expands\n"+
 "  patterns beginning with the \"%\" character, and uses the resulting\n"+
 "  command line to establish the secure tunnel to the VNC server.\n"+
-"  If \u001B[1mcom.tigervnc.VNC_TUNNEL_CMD\u001B[0m is not set, this command \n"+
+"  If \u001B[1mVNC_TUNNEL_CMD\u001B[0m is not set, this command \n"+
 "  line defaults to \"/usr/bin/ssh -f -L %L:localhost:%R %H sleep 20\".\n"+
 "\n"+
 "  The following patterns are recognized in the VNC_TUNNEL_CMD property\n"+

Modified: trunk/java/com/tigervnc/vncviewer/tunnel.java
===================================================================
--- trunk/java/com/tigervnc/vncviewer/tunnel.java2012-05-19 13:28:43 UTC (rev 4915)
+++ trunk/java/com/tigervnc/vncviewer/tunnel.java2012-05-23 03:40:07 UTC (rev 4916)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -194,9 +194,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   
     try {
       if (tunnelOption) {
-        pattern = System.getProperty("com.tigervnc.VNC_TUNNEL_CMD");
+        pattern = System.getProperty("VNC_TUNNEL_CMD");
       } else {
-        pattern = System.getProperty("com.tigervnc.VNC_VIA_CMD");
+        pattern = System.getProperty("VNC_VIA_CMD");
       }
     } catch (java.lang.Exception e) { 
       vlog.info(e.toString());
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -294,10 +294,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
       }
       // username and passphrase will be given via UserInfo interface.
       PasswdDialog dlg = new PasswdDialog(new String("SSH Authentication"), false, false);
-      dlg.userEntry.setText((String)System.getProperties().get("user.name"));
+      dlg.promptPassword(new String("SSH Authentication"));
 
       Session session=jsch.getSession(dlg.userEntry.getText(), tunnelEndpoint, 22);
-      session.setUserInfo(dlg);
+      session.setPassword(new String(dlg.passwdEntry.getPassword()));
       session.connect();
 
       String[] tokens = cmd.split("\\s");

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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
&lt;/pre&gt;</description>
    <dc:creator>bphinz-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&lt; at &gt;public.gmane.org</dc:creator>
    <dc:date>2012-05-23T03:40:07</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1283">
    <title>SF.net SVN: tigervnc:[4915] trunk/java/com/tigervnc/vncviewer/BIPixelBuffer .java</title>
    <link>http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1283</link>
    <description>&lt;pre&gt;Revision: 4915
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4915&amp;amp;view=rev
Author:   bphinz
Date:     2012-05-19 13:28:43 +0000 (Sat, 19 May 2012)
Log Message:
-----------
Fixes what appears to be a Java bug on Linux. Graphics2D.copyArea corrupts the screen image when areas are shifted to the left.  Benchmarking show no measurable performance impact from this change, and it seems to mitigate the problem.

Modified Paths:
--------------
    trunk/java/com/tigervnc/vncviewer/BIPixelBuffer.java

Modified: trunk/java/com/tigervnc/vncviewer/BIPixelBuffer.java
===================================================================
--- trunk/java/com/tigervnc/vncviewer/BIPixelBuffer.java2012-05-16 03:51:42 UTC (rev 4914)
+++ trunk/java/com/tigervnc/vncviewer/BIPixelBuffer.java2012-05-19 13:28:43 UTC (rev 4915)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -40,7 +40,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
       GraphicsEnvironment.getLocalGraphicsEnvironment();
     GraphicsDevice gd = ge.getDefaultScreenDevice();
     GraphicsConfiguration gc = gd.getDefaultConfiguration();
-    image = gc.createCompatibleImage(w, h, Transparency.OPAQUE);
+    image = gc.createCompatibleImage(w, h, Transparency.TRANSLUCENT);
     image.setAccelerationPriority(1);
     image.createGraphics();
   }

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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
&lt;/pre&gt;</description>
    <dc:creator>bphinz-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&lt; at &gt;public.gmane.org</dc:creator>
    <dc:date>2012-05-19T13:28:43</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1282">
    <title>SF.net SVN: tigervnc:[4914]trunk/java/com/tigervnc/vncviewer</title>
    <link>http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1282</link>
    <description>&lt;pre&gt;Revision: 4914
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4914&amp;amp;view=rev
Author:   bphinz
Date:     2012-05-16 03:51:42 +0000 (Wed, 16 May 2012)
Log Message:
-----------
Adds support for setting the menu key via cmd line arg.  Adds all menu keys supported by native viewer to the combo box in the OptionsDialog.

Modified Paths:
--------------
    trunk/java/com/tigervnc/vncviewer/CConn.java
    trunk/java/com/tigervnc/vncviewer/DesktopWindow.java
    trunk/java/com/tigervnc/vncviewer/F8Menu.java
    trunk/java/com/tigervnc/vncviewer/OptionsDialog.java
    trunk/java/com/tigervnc/vncviewer/VncViewer.java

Added Paths:
-----------
    trunk/java/com/tigervnc/vncviewer/menukey.java

Modified: trunk/java/com/tigervnc/vncviewer/CConn.java
===================================================================
--- trunk/java/com/tigervnc/vncviewer/CConn.java2012-05-14 02:19:41 UTC (rev 4913)
+++ trunk/java/com/tigervnc/vncviewer/CConn.java2012-05-16 03:51:42 UTC (rev 4914)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -165,7 +165,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     autoSelect = viewer.autoSelect.getValue();
     formatChange = false; encodingChange = false;
     fullScreen = viewer.fullScreen.getValue();
-    menuKey = Keysyms.F8;
+    menuKeyCode = menukey.getMenuKeyCode();
     options = new OptionsDialog(this);
     options.initDialog();
     clipboardDialog = new ClipboardDialog(this);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -876,7 +876,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     options.viewOnly.setSelected(viewer.viewOnly.getValue());
     options.acceptClipboard.setSelected(viewer.acceptClipboard.getValue());
     options.sendClipboard.setSelected(viewer.sendClipboard.getValue());
-    options.menuKey.setSelectedIndex(menuKey-0xFFBE);
+    options.menuKey.setSelectedItem(KeyEvent.getKeyText(menukey.getMenuKeyCode()));
 
     if (state() == RFBSTATE_NORMAL) {
       options.shared.setEnabled(false);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1073,8 +1073,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     }
 
     clipboardDialog.setSendingEnabled(viewer.sendClipboard.getValue());
-    menuKey = (options.menuKey.getSelectedIndex()+0xFFBE);
-    F8Menu.f8.setText("Send F"+(menuKey-Keysyms.F1+1));
+    viewer.menuKey.setParam(menukey.getMenuKeySymbols()[options.menuKey.getSelectedIndex()].name);
+    F8Menu.f8.setText("Send "+KeyEvent.getKeyText(menukey.getMenuKeyCode()));
 
     setShared(options.shared.isSelected());
     viewer.useLocalCursor.setParam(options.useLocalCursor.isSelected());
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1455,7 +1455,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 
   private boolean supportsSyncFence;
 
-  public int menuKey;
+  public int menuKeyCode;
   ViewportFrame viewport;
   private boolean fullColour;
   private boolean autoSelect;

Modified: trunk/java/com/tigervnc/vncviewer/DesktopWindow.java
===================================================================
--- trunk/java/com/tigervnc/vncviewer/DesktopWindow.java2012-05-14 02:19:41 UTC (rev 4913)
+++ trunk/java/com/tigervnc/vncviewer/DesktopWindow.java2012-05-16 03:51:42 UTC (rev 4914)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -409,8 +409,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   public void keyReleased(KeyEvent e) {}
   /** Handle the key-pressed event. */
   public void keyPressed(KeyEvent e) {
-    if (e.getKeyCode() == 
-        (KeyEvent.VK_F1+cc.menuKey-Keysyms.F1)) {
+    if (e.getKeyCode() == menukey.getMenuKeyCode()) {
       int sx = (scaleWidthRatio == 1.00) 
         ? lastX : (int)Math.floor(lastX*scaleWidthRatio);
       int sy = (scaleHeightRatio == 1.00) 

Modified: trunk/java/com/tigervnc/vncviewer/F8Menu.java
===================================================================
--- trunk/java/com/tigervnc/vncviewer/F8Menu.java2012-05-14 02:19:41 UTC (rev 4913)
+++ trunk/java/com/tigervnc/vncviewer/F8Menu.java2012-05-16 03:51:42 UTC (rev 4914)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -51,7 +51,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     addSeparator();
     clipboard  = addMenuItem("Clipboard...");
     addSeparator();
-    f8 = addMenuItem("Send F"+(cc.menuKey-Keysyms.F1+1));
+    f8 = addMenuItem("Send "+KeyEvent.getKeyText(menukey.getMenuKeyCode()), menukey.getMenuKeyCode());
     ctrlAltDel = addMenuItem("Send Ctrl-Alt-Del");
     addSeparator();
     refresh    = addMenuItem("Refresh Screen", KeyEvent.VK_H);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -100,8 +100,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     } else if (actionMatch(ev, clipboard)) {
       cc.clipboardDialog.showDialog(cc.viewport);
     } else if (actionMatch(ev, f8)) {
-      cc.writeKeyEvent(cc.menuKey, true);
-      cc.writeKeyEvent(cc.menuKey, false);
+      cc.writeKeyEvent(cc.menuKeyCode, true);
+      cc.writeKeyEvent(cc.menuKeyCode, false);
     } else if (actionMatch(ev, ctrlAltDel)) {
       cc.writeKeyEvent(Keysyms.Control_L, true);
       cc.writeKeyEvent(Keysyms.Alt_L, true);

Modified: trunk/java/com/tigervnc/vncviewer/OptionsDialog.java
===================================================================
--- trunk/java/com/tigervnc/vncviewer/OptionsDialog.java2012-05-14 02:19:41 UTC (rev 4913)
+++ trunk/java/com/tigervnc/vncviewer/OptionsDialog.java2012-05-16 03:51:42 UTC (rev 4914)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -132,8 +132,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     sendClipboard = new JCheckBox("Send clipboard to server");
     sendClipboard.addItemListener(this);
     JLabel menuKeyLabel = new JLabel("Menu Key");
-    String[] menuKeys = 
-      { "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12" };
+    String[] menuKeys = new String[menukey.getMenuKeySymbolCount()]; 
+    for (int i = 0; i &amp;lt; menukey.getMenuKeySymbolCount(); i++)
+      menuKeys[i] = KeyEvent.getKeyText(menukey.getMenuKeySymbols()[i].keycode);
     menuKey  = new JComboBox(menuKeys);
     menuKey.addItemListener(this);
     addGBComponent(viewOnly,InputsPanel,        0, 0, 2, 1, 2, 2, 1, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.LINE_START, new Insets(4,5,0,5));

Modified: trunk/java/com/tigervnc/vncviewer/VncViewer.java
===================================================================
--- trunk/java/com/tigervnc/vncviewer/VncViewer.java2012-05-14 02:19:41 UTC (rev 4913)
+++ trunk/java/com/tigervnc/vncviewer/VncViewer.java2012-05-16 03:51:42 UTC (rev 4914)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -445,11 +445,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   = new BoolParameter("SendClipboard",
                       "Send clipboard changes to the server",
                       true);
-  // FIXME
-  //StringParameter menuKey
-  //= new StringParameter("MenuKey",
-  //                      "The key which brings up the popup menu",
-  //                      "F8");
+  StringParameter menuKey
+  = new StringParameter("MenuKey",
+                        "The key which brings up the popup menu",
+                        "F8");
   StringParameter desktopSize
   = new StringParameter("DesktopSize",
                         "Reconfigure desktop size on the server on "+

Added: trunk/java/com/tigervnc/vncviewer/menukey.java
===================================================================
--- trunk/java/com/tigervnc/vncviewer/menukey.java                        (rev 0)
+++ trunk/java/com/tigervnc/vncviewer/menukey.java2012-05-16 03:51:42 UTC (rev 4914)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -0,0 +1,86 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+/* Copyright 2011 Martin Koegler &amp;lt;mkoegler-41OhEqcGnsuDqU6vP1vexV6hYfS7NtTn&amp;lt; at &amp;gt;public.gmane.org&amp;gt;
+ * Copyright 2011 Pierre Ossman &amp;lt;ossman-+4tYiAq3b6azQB+pC5nmwQ&amp;lt; at &amp;gt;public.gmane.org&amp;gt; for Cendio AB
+ * Copyright 2012 Brian P. Hinz
+ * 
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this software; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
+ * USA.
+ */
+
+package com.tigervnc.vncviewer;
+
+import java.awt.event.KeyEvent;
+
+import com.tigervnc.rfb.*;
+
+public class menukey 
+{
+  static class MenuKeySymbol {
+    public MenuKeySymbol(String name_, int keycode_) {
+      name = name_;
+      keycode = keycode_;
+    }
+    String name;
+    int keycode;
+  }
+
+  private static final MenuKeySymbol[] menuSymbols = {
+    new MenuKeySymbol("F1", KeyEvent.VK_F1),
+    new MenuKeySymbol("F2", KeyEvent.VK_F2),
+    new MenuKeySymbol("F3", KeyEvent.VK_F3),
+    new MenuKeySymbol("F4", KeyEvent.VK_F4),
+    new MenuKeySymbol("F5", KeyEvent.VK_F5),
+    new MenuKeySymbol("F6", KeyEvent.VK_F6),
+    new MenuKeySymbol("F7", KeyEvent.VK_F7),
+    new MenuKeySymbol("F8", KeyEvent.VK_F8),
+    new MenuKeySymbol("F9", KeyEvent.VK_F9),
+    new MenuKeySymbol("F10", KeyEvent.VK_F10),
+    new MenuKeySymbol("F11", KeyEvent.VK_F11),
+    new MenuKeySymbol("F12", KeyEvent.VK_F12),
+    new MenuKeySymbol("Pause", KeyEvent.VK_PAUSE),
+    new MenuKeySymbol("Print", KeyEvent.VK_PRINTSCREEN),
+    new MenuKeySymbol("Scroll_Lock", KeyEvent.VK_SCROLL_LOCK),
+    new MenuKeySymbol("Escape", KeyEvent.VK_ESCAPE),
+    new MenuKeySymbol("Insert", KeyEvent.VK_INSERT),
+    new MenuKeySymbol("Delete", KeyEvent.VK_DELETE),
+    new MenuKeySymbol("Home", KeyEvent.VK_HOME),
+    new MenuKeySymbol("Page_Up", KeyEvent.VK_PAGE_UP),
+    new MenuKeySymbol("Page_Down", KeyEvent.VK_PAGE_DOWN)
+  };
+  
+  static int getMenuKeySymbolCount()
+  {
+    return menuSymbols.length;
+  }
+  
+  public static MenuKeySymbol[] getMenuKeySymbols()
+  {
+    return menuSymbols;
+  }
+  
+  static int getMenuKeyCode()
+  {
+      String menuKeyStr;
+      int menuKeyCode = KeyEvent.VK_F8;
+  
+      menuKeyStr = 
+        Configuration.global().getParam("menuKey").getValueStr();
+      for(int i = 0; i &amp;lt; getMenuKeySymbolCount(); i++)
+        if (menuSymbols[i].name.equals(menuKeyStr))
+          menuKeyCode = menuSymbols[i].keycode;
+  
+      return menuKeyCode;
+  }
+
+}

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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
&lt;/pre&gt;</description>
    <dc:creator>bphinz-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&lt; at &gt;public.gmane.org</dc:creator>
    <dc:date>2012-05-16T03:51:43</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1281">
    <title>SF.net SVN: tigervnc:[4913]trunk/java/com/tigervnc</title>
    <link>http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1281</link>
    <description>&lt;pre&gt;Revision: 4913
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4913&amp;amp;view=rev
Author:   bphinz
Date:     2012-05-14 02:19:41 +0000 (Mon, 14 May 2012)
Log Message:
-----------
Implemented rfb/Configuration similar to the native client methods. Added equivalent cmd line options for all native client options except "-menuKey", which needs a little more work on the GUI side before it can be added.

Modified Paths:
--------------
    trunk/java/com/tigervnc/rfb/AliasParameter.java
    trunk/java/com/tigervnc/rfb/BoolParameter.java
    trunk/java/com/tigervnc/rfb/CSecurityTLS.java
    trunk/java/com/tigervnc/rfb/Configuration.java
    trunk/java/com/tigervnc/rfb/IntParameter.java
    trunk/java/com/tigervnc/rfb/SecurityClient.java
    trunk/java/com/tigervnc/rfb/StringParameter.java
    trunk/java/com/tigervnc/rfb/VoidParameter.java
    trunk/java/com/tigervnc/vncviewer/CConn.java
    trunk/java/com/tigervnc/vncviewer/VncViewer.java

Modified: trunk/java/com/tigervnc/rfb/AliasParameter.java
===================================================================
--- trunk/java/com/tigervnc/rfb/AliasParameter.java2012-05-07 01:02:24 UTC (rev 4912)
+++ trunk/java/com/tigervnc/rfb/AliasParameter.java2012-05-14 02:19:41 UTC (rev 4913)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,4 +1,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * Copyright 2004-2005 Cendio AB.
+ * Copyright 2012 Brian P. Hinz
  * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -19,11 +21,17 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 package com.tigervnc.rfb;
 
 public class AliasParameter extends VoidParameter {
-  public AliasParameter(String name_, String desc_, VoidParameter v) {
-    super(name_, desc_);
-    param = v;
+  public AliasParameter(String name_, String desc_, VoidParameter param_, 
+                        Configuration.ConfigurationObject co)
+  {
+    super(name_, desc_, co);
+    param = param_;
   }
 
+  public AliasParameter(String name_, String desc_, VoidParameter param_) {
+    this(name_, desc_, param_, Configuration.ConfigurationObject.ConfGlobal);
+  }
+
   public boolean setParam(String v) { return param.setParam(v); }
   public boolean setParam() { return param.setParam(); }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -31,5 +39,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   public String getValueStr() { return param.getValueStr(); }
   public boolean isBool() { return param.isBool(); }
 
+  public void setImmutable() {
+    vlog.debug("set immutable "+getName()+" (Alias)");
+    param.setImmutable();
+  }
+
   protected VoidParameter param;
 }

Modified: trunk/java/com/tigervnc/rfb/BoolParameter.java
===================================================================
--- trunk/java/com/tigervnc/rfb/BoolParameter.java2012-05-07 01:02:24 UTC (rev 4912)
+++ trunk/java/com/tigervnc/rfb/BoolParameter.java2012-05-14 02:19:41 UTC (rev 4913)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,4 +1,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * Copyright 2004-2005 Cendio AB.
+ * Copyright 2012 Brian P. Hinz
  * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -19,26 +21,39 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 package com.tigervnc.rfb;
 
 public class BoolParameter extends VoidParameter {
-  public BoolParameter(String name_, String desc_, boolean v) {
-    super(name_, desc_);
+  public BoolParameter(String name_, String desc_, boolean v,
+                       Configuration.ConfigurationObject co)
+  {
+    super(name_, desc_, co);
     value = v;
     defValue = v;
   }
 
+  public BoolParameter(String name_, String desc_, boolean v) {
+    this(name_, desc_, v, Configuration.ConfigurationObject.ConfGlobal);
+  }
+
   public boolean setParam(String v) {
-    if (v.equals("1") || v.equalsIgnoreCase("on") ||
+    if (immutable) return true;
+
+    if (v == null || v.equals("1") || v.equalsIgnoreCase("on") ||
         v.equalsIgnoreCase("true") || v.equalsIgnoreCase("yes"))
       value = true;
     else if (v.equals("0") || v.equalsIgnoreCase("off") ||
         v.equalsIgnoreCase("false") || v.equalsIgnoreCase("no"))
       value = false;
-    else
+    else {
+      vlog.error("Bool parameter "+getName()+": invalid value '"+v+"'");
       return false;
+    }
     return true;
   }
 
   public boolean setParam() { setParam(true); return true; }
-  public void setParam(boolean b) { value = b; }
+  public void setParam(boolean b) { 
+    if (immutable) return;
+    value = b;
+  }
 
   public String getDefaultStr() { return defValue ? "1" : "0"; }
   public String getValueStr() { return value ? "1" : "0"; }

Modified: trunk/java/com/tigervnc/rfb/CSecurityTLS.java
===================================================================
--- trunk/java/com/tigervnc/rfb/CSecurityTLS.java2012-05-07 01:02:24 UTC (rev 4912)
+++ trunk/java/com/tigervnc/rfb/CSecurityTLS.java2012-05-14 02:19:41 UTC (rev 4913)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -44,10 +44,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 
   public static StringParameter x509ca
   = new StringParameter("x509ca",
-                        "X509 CA certificate", "");
+                        "X509 CA certificate", "", Configuration.ConfigurationObject.ConfViewer);
   public static StringParameter x509crl
   = new StringParameter("x509crl",
-                        "X509 CRL file", "");
+                        "X509 CRL file", "", Configuration.ConfigurationObject.ConfViewer);
 
   private void initGlobal() 
   {

Modified: trunk/java/com/tigervnc/rfb/Configuration.java
===================================================================
--- trunk/java/com/tigervnc/rfb/Configuration.java2012-05-07 01:02:24 UTC (rev 4912)
+++ trunk/java/com/tigervnc/rfb/Configuration.java2012-05-14 02:19:41 UTC (rev 4913)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
  * Copyright 2004-2005 Cendio AB.
+ * Copyright 2012 Brian P. Hinz
  * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -25,68 +26,250 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 
 public class Configuration {
 
+  static LogWriter vlog = new LogWriter("Config");
+
+  public enum ConfigurationObject { ConfGlobal, ConfServer, ConfViewer };
+
+  // -=- The Global/server/viewer Configuration objects
+  private static Configuration global_ = null;
+  private static Configuration server_ = null;
+  private static Configuration viewer_ = null;
+
+  public static Configuration global() {
+    if (global_ == null)
+      global_ = new Configuration("Global");
+    return global_;
+  } 
+
+  public static Configuration server() {
+    if (server_ == null)
+      server_ = new Configuration("Server");
+    return server_;
+  } 
+
+  public static Configuration viewer() {
+    if (viewer_ == null)
+      viewer_ = new Configuration("Viewer");
+    return viewer_;
+  } 
+
+  // Enable server/viewer specific parameters
+  public static void enableServerParams() { global().appendConfiguration(server()); }
+  public static void enableViewerParams() { global().appendConfiguration(viewer()); }
+
+  // Append configuration object to this instance.
+  // NOTE: conf instance can be only one configuration object
+  public void appendConfiguration(Configuration conf) {
+    conf._next = _next; _next = conf;
+  }
+
+  // -=- Configuration implementation
+  public Configuration(String name_, Configuration attachToGroup) {
+    name = name_; head = null; _next = null;
+    if (attachToGroup != null) {
+      _next = attachToGroup._next;
+      attachToGroup._next = this;
+    }
+  }
+
+  public Configuration(String name_) {
+    this(name_, null);
+  }
+
+  // - Return the buffer containing the Configuration's name
+  final public String getName() { return name; }
+
+  // - Assignment operator.  For every Parameter in this Configuration's
+  //   group, get()s the corresponding source parameter and copies its
+  //   content.
+  public Configuration assign(Configuration src) {
+    VoidParameter current = head;
+    while (current != null) {
+      VoidParameter srcParam = ((Configuration)src).get(current.getName());
+      if (srcParam != null) {
+        current.immutable = false;
+        String value = srcParam.getValueStr();
+        vlog.debug("operator=("+current.getName()+", "+value+")");
+        current.setParam(value);
+      }
+      current = current._next;
+    }
+    if (_next != null)
+      _next = src;
+    return this;
+  }
+
   // - Set named parameter to value
-  public static boolean setParam(String name, String value) {
-    VoidParameter param = getParam(name);
-    if (param == null) return false;
-    return param.setParam(value);
+  public boolean set(String n, String v, boolean immutable) {
+    return set(n, n.length(), v, immutable);
   }
 
+  public boolean set(String n, String v) {
+    return set(n, n.length(), v, false);
+  }
+
   // - Set parameter to value (separated by "=")
-  public static boolean setParam(String config) {
+  public boolean set(String name, int len,
+                     String val, boolean immutable)
+  {
+    VoidParameter current = head;
+    while (current != null) {
+      if (current.getName().length() == len &amp;amp;&amp;amp;
+          current.getName().equalsIgnoreCase(name.substring(0, len)))
+      {
+        boolean b = current.setParam(val);
+        current.setHasBeenSet(); 
+        if (b &amp;amp;&amp;amp; immutable) 
+    current.setImmutable();
+        return b;
+      }
+      current = current._next;
+    }
+    return (_next != null) ? _next.set(name, len, val, immutable) : false;
+  }
+
+  // - Set named parameter to value, with name truncated at len
+  boolean set(String config, boolean immutable) {
     boolean hyphen = false;
     if (config.charAt(0) == '-') {
       hyphen = true;
-      if (config.charAt(1) == '-')
-        config = config.substring(2); // allow gnu-style --&amp;lt;option&amp;gt;
-      else
-        config = config.substring(1);
+      config = config.substring(1);
+      if (config.charAt(0) == '-') config = config.substring(1); // allow gnu-style --&amp;lt;option&amp;gt;
     }
     int equal = config.indexOf('=');
-    if (equal != -1) {
-      return setParam(config.substring(0, equal), config.substring(equal+1));
+    if (equal &amp;gt; -1) {
+      return set(config, equal, config.substring(equal+1), immutable);
     } else if (hyphen) {
-      VoidParameter param = getParam(config);
-      if (param == null) return false;
-      return param.setParam();
-    }
-    return false;
+      VoidParameter current = head;
+      while (current != null) {
+        if (current.getName().equalsIgnoreCase(config)) {
+          boolean b = current.setParam();
+    current.setHasBeenSet(); 
+          if (b &amp;amp;&amp;amp; immutable) 
+      current.setImmutable();
+          return b;
+        }
+        current = current._next;
+      }
+    }    
+    return (_next != null) ? _next.set(config, immutable) : false;
   }
 
+  boolean set(String config) {
+    return set(config, false);
+  }
+
+  // - Container for process-wide Global parameters
+  public static boolean setParam(String param, String value, boolean immutable) {
+    return global().set(param, value, immutable);
+  }
+
+  public static boolean setParam(String param, String value) {
+    return setParam(param, value, false);
+  }
+
+  public static boolean setParam(String config, boolean immutable) { 
+    return global().set(config, immutable);
+  }
+
+  public static boolean setParam(String config) { 
+    return setParam(config, false);
+  }
+
+  public static boolean setParam(String name, int len,
+                                 String val, boolean immutable) {
+    return global().set(name, len, val, immutable);
+  }
+
+
   // - Get named parameter
-  public static VoidParameter getParam(String name) {
+  public VoidParameter get(String param)
+  {
     VoidParameter current = head;
     while (current != null) {
-      if (name.equalsIgnoreCase(current.getName()))
+      if (current.getName().equalsIgnoreCase(param))
         return current;
-      current = current.next;
+      current = current._next;
     }
-    return null;
+    return (_next != null) ? _next.get(param) : null;
   }
+  
+  public static VoidParameter getParam(String param) { return global().get(param); }
 
-  public static String listParams() {
-    StringBuffer s = new StringBuffer();
+  public static void listParams(int width, int nameWidth) {
+    global().list(width, nameWidth);
+  }
+  public static void listParams() {
+    listParams(79, 10);
+  }
 
+  public void list(int width, int nameWidth) {
     VoidParameter current = head;
+  
+    System.err.format("%s Parameters:%n", name);
     while (current != null) {
       String def_str = current.getDefaultStr();
-      String desc = current.getDescription();
-      s.append("  "+current.getName()+" - "+desc+" (default="+def_str+")\n");
-      current = current.next;
+      String desc = current.getDescription().trim();
+      String format = "  %-"+nameWidth+"s -";
+      System.err.format(format, current.getName());
+      int column = current.getName().length();
+      if (column &amp;lt; nameWidth) column = nameWidth;
+      column += 4;
+      while (true) {
+        int s = desc.indexOf(' ');
+        int wordLen;
+        if (s &amp;gt; -1) wordLen = s;
+        else wordLen = desc.length();
+  
+        if (column + wordLen + 1 &amp;gt; width) {
+          format = "%n%"+(nameWidth+4)+"s";
+          System.err.format(format, "");
+          column = nameWidth+4;
+        }
+        format = " %"+wordLen+"s";
+        System.err.format(format, desc.substring(0, wordLen));
+        column += wordLen + 1;
+
+        if (s == -1) break;
+        desc = desc.substring(wordLen+1);
+      }
+  
+      if (def_str != null) {
+        if (column + def_str.length() + 11 &amp;gt; width)
+          System.err.format("%n%"+(nameWidth+4)+"s","");
+        System.err.format(" (default=%s)%n",def_str);
+        def_str = null;
+      } else {
+        System.err.format("%n");
+      }
+      current = current._next;
     }
+  
+    if (_next != null)
+      _next.list(width, nameWidth);
+  }
 
-    return s.toString();
+  public void list() {
+    list(79, 10);
   }
 
-  public static void readAppletParams(java.applet.Applet applet) {
+  public void readAppletParams(java.applet.Applet applet) {
     VoidParameter current = head;
     while (current != null) {
       String str = applet.getParameter(current.getName());
       if (str != null)
         current.setParam(str);
-      current = current.next;
+      current = current._next;
     }
   }
 
-  public static VoidParameter head;
+  // Name for this Configuration
+  private String name;
+
+  // - Pointer to first Parameter in this group
+  public VoidParameter head;
+
+  // Pointer to next Configuration in this group
+  public Configuration _next;
+
 }

Modified: trunk/java/com/tigervnc/rfb/IntParameter.java
===================================================================
--- trunk/java/com/tigervnc/rfb/IntParameter.java2012-05-07 01:02:24 UTC (rev 4912)
+++ trunk/java/com/tigervnc/rfb/IntParameter.java2012-05-14 02:19:41 UTC (rev 4913)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,4 +1,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * Copyright 2004-2005 Cendio AB.
+ * Copyright 2012 Brian P. Hinz
  * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -19,26 +21,55 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 package com.tigervnc.rfb;
 
 public class IntParameter extends VoidParameter {
-  public IntParameter(String name_, String desc_, int v) {
-    super(name_, desc_);
+  public IntParameter(String name_, String desc_, int v,
+                      int minValue_, int maxValue_, 
+                      Configuration.ConfigurationObject co)
+  {
+    super(name_, desc_, co);
     value = v;
     defValue = v;
+    minValue = minValue_;
+    maxValue = maxValue_;
   }
 
+  public IntParameter(String name_, String desc_, int v) 
+  {
+    this(name_, desc_, v, Integer.MIN_VALUE, Integer.MAX_VALUE,
+         Configuration.ConfigurationObject.ConfGlobal);
+  }
+
   public boolean setParam(String v) {
+    if (immutable) return true;
+    vlog.debug("set "+getName()+"(Int) to "+v);
     try {
-      value = Integer.parseInt(v);
+      int i;
+      i = Integer.parseInt(v);
+      if (i &amp;lt; minValue || i &amp;gt; maxValue)
+        return false;
+      value = i;
+      return true;
     } catch (NumberFormatException e) {
+      throw new Exception(e.toString());
+    }
+  }
+
+  public boolean setParam(int v) {
+    if (immutable) return true;
+    vlog.debug("set "+getName()+"(Int) to "+v);
+    if (v &amp;lt; minValue || v &amp;gt; maxValue)
       return false;
-    }
+    value = v;
     return true;
   }
 
   public String getDefaultStr() { return Integer.toString(defValue); }
   public String getValueStr() { return Integer.toString(value); }
 
+  //public int int() { return value; }
   public int getValue() { return value; }
 
   protected int value;
   protected int defValue;
+  protected int minValue;
+  protected int maxValue;
 }

Modified: trunk/java/com/tigervnc/rfb/SecurityClient.java
===================================================================
--- trunk/java/com/tigervnc/rfb/SecurityClient.java2012-05-07 01:02:24 UTC (rev 4912)
+++ trunk/java/com/tigervnc/rfb/SecurityClient.java2012-05-14 02:19:41 UTC (rev 4913)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,6 +1,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
  * Copyright (C) 2010 TigerVNC Team
- * Copyright (C) 2011 Brian P. Hinz
+ * Copyright (C) 2011-2012 Brian P. Hinz
  * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -81,6 +81,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   static StringParameter secTypes 
   = new StringParameter("SecurityTypes",
                         "Specify which security scheme to use (None, VncAuth)",
-                        "Ident,TLSIdent,X509Ident,X509Plain,TLSPlain,X509Vnc,TLSVnc,X509None,TLSNone,VncAuth,None");
+                        "Ident,TLSIdent,X509Ident,X509Plain,TLSPlain,X509Vnc,TLSVnc,X509None,TLSNone,VncAuth,None", Configuration.ConfigurationObject.ConfViewer);
 
 }

Modified: trunk/java/com/tigervnc/rfb/StringParameter.java
===================================================================
--- trunk/java/com/tigervnc/rfb/StringParameter.java2012-05-07 01:02:24 UTC (rev 4912)
+++ trunk/java/com/tigervnc/rfb/StringParameter.java2012-05-14 02:19:41 UTC (rev 4913)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,4 +1,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * Copyright 2004-2005 Cendio AB.
+ * Copyright 2012 Brian P. Hinz
  * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -19,22 +21,31 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 package com.tigervnc.rfb;
 
 public class StringParameter extends VoidParameter {
-  public StringParameter(String name_, String desc_, String v) {
-    super(name_, desc_);
+  public StringParameter(String name_, String desc_, String v, 
+                         Configuration.ConfigurationObject co) 
+  {
+    super(name_, desc_, co);
     value = v;
     defValue = v;
   }
 
+  public StringParameter(String name_, String desc_, String v) 
+  {
+    this(name_, desc_, v, Configuration.ConfigurationObject.ConfGlobal);
+  }
+
+  public void setDefaultStr(String v) {
+    value = defValue = v;
+  }
+
   public boolean setParam(String v) {
+    if (immutable) return true;
+    if (v == null)
+      throw new Exception("setParam(&amp;lt;null&amp;gt;) not allowed");
     value = v;
     return value != null;
   }
 
-  public boolean setDefaultStr(String v) {
-    value = defValue = v;
-    return defValue != null;
-  }
-
   public String getDefaultStr() { return defValue; }
   public String getValueStr() { return value; }
 

Modified: trunk/java/com/tigervnc/rfb/VoidParameter.java
===================================================================
--- trunk/java/com/tigervnc/rfb/VoidParameter.java2012-05-07 01:02:24 UTC (rev 4912)
+++ trunk/java/com/tigervnc/rfb/VoidParameter.java2012-05-14 02:19:41 UTC (rev 4913)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,4 +1,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * Copyright 2004-2005 Cendio AB.
+ * Copyright 2012 Brian P. Hinz
  * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -19,23 +21,62 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 package com.tigervnc.rfb;
 
 abstract public class VoidParameter {
+  public VoidParameter(String name_, String desc_, 
+                       Configuration.ConfigurationObject co) 
+  {
+    immutable = false; _hasBeenSet = false; name = name_; description = desc_;
+
+    Configuration conf = null;
+
+    switch (co) {
+    case ConfGlobal:
+      conf = Configuration.global();
+      break;
+    case ConfServer:
+      conf = Configuration.server();
+      break;
+    case ConfViewer:
+      conf = Configuration.viewer();
+      break;
+    }
+    _next = conf.head;
+    conf.head = this;
+  }
+
   public VoidParameter(String name_, String desc_) {
-    name = name_;
-    description = desc_;
-    next = Configuration.head;
-    Configuration.head = this;
+    this(name_, desc_, Configuration.ConfigurationObject.ConfGlobal);
   }
 
-  final public String getName() { return name; }
-  final public String getDescription() { return description; }
+  final public String getName() { 
+    return name;
+  }
 
+  final public String getDescription() { 
+    return description;
+  }
+
   abstract public boolean setParam(String value);
   public boolean setParam() { return false; }
   abstract public String getDefaultStr();
   abstract public String getValueStr();
   public boolean isBool() { return false; }
+  public void setImmutable() {
+    vlog.debug("set immutable "+getName());
+    immutable = true;
+  }
 
-  public VoidParameter next;
+  public void setHasBeenSet() {
+    _hasBeenSet = true;
+  }
+
+  public boolean hasBeenSet() {
+    return _hasBeenSet;
+  }
+
   protected String name;
   protected String description;
+  public VoidParameter _next;
+  protected boolean immutable;
+  protected boolean _hasBeenSet;
+  static LogWriter vlog = new LogWriter("VoidParameter");
 }

Modified: trunk/java/com/tigervnc/vncviewer/CConn.java
===================================================================
--- trunk/java/com/tigervnc/vncviewer/CConn.java2012-05-07 01:02:24 UTC (rev 4912)
+++ trunk/java/com/tigervnc/vncviewer/CConn.java2012-05-14 02:19:41 UTC (rev 4913)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -809,10 +809,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
       pkgTime = attributes.getValue("Package-Time");
     } catch (IOException e) { }
     JOptionPane.showMessageDialog((viewport != null ? viewport : null),
-      VncViewer.about1+" v"+VncViewer.version+" ("+VncViewer.build+")\n"
-      +"Built on "+pkgDate+" at "+pkgTime+"\n"
-      +VncViewer.about2+"\n"
-      +VncViewer.about3,
+      String.format(VncViewer.aboutText, VncViewer.version, VncViewer.build,
+                    VncViewer.buildDate, VncViewer.buildTime), 
       "About TigerVNC Viewer for Java",
       JOptionPane.INFORMATION_MESSAGE,
       logo);

Modified: trunk/java/com/tigervnc/vncviewer/VncViewer.java
===================================================================
--- trunk/java/com/tigervnc/vncviewer/VncViewer.java2012-05-07 01:02:24 UTC (rev 4912)
+++ trunk/java/com/tigervnc/vncviewer/VncViewer.java2012-05-14 02:19:41 UTC (rev 4913)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -52,13 +52,15 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 
 public class VncViewer extends java.applet.Applet implements Runnable
 {
-  public static final String about1 = "TigerVNC Viewer for Java";
-  public static final String about2 = "Copyright (C) 1998-2011 "+
-                                      "TigerVNC Team and many others (see README)";
-  public static final String about3 = "Visit http://www.tigervnc.org "+
-                                      "for information on TigerVNC.";
+  public static final String aboutText = new String("TigerVNC Java Viewer v%s (%s)%n"+
+                                                    "Built on %s at %s%n"+
+                                                    "Copyright (C) 1999-2011 TigerVNC Team and many others (see README.txt)%n"+
+                                                    "See http://www.tigervnc.org for information on TigerVNC.");
+                                           
   public static String version = null;
   public static String build = null;
+  public static String buildDate = null;
+  public static String buildTime = null;
 
   public static void setLookAndFeel() {
     try {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -114,7 +116,17 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   
   public VncViewer(String[] argv) {
     applet = false;
+
+    SecurityClient.setDefaults();
     
+    // Write about text to console, still using normal locale codeset
+    getTimestamp();
+    System.err.format("%n");
+    System.err.format(aboutText, version, build, buildDate, buildTime); 
+    System.err.format("%n");
+
+    Configuration.enableViewerParams();
+
     // Override defaults with command-line options
     for (int i = 0; i &amp;lt; argv.length; i++) {
       if (argv[i].equalsIgnoreCase("-log")) {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -148,6 +160,23 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
       vncServerName.setParam(argv[i]);
     }
 
+    if (!autoSelect.hasBeenSet()) {
+      // Default to AutoSelect=0 if -PreferredEncoding or -FullColor is used
+      autoSelect.setParam(!preferredEncoding.hasBeenSet() &amp;amp;&amp;amp;
+                          !fullColour.hasBeenSet() &amp;amp;&amp;amp;
+                          !fullColourAlias.hasBeenSet());
+    }
+    if (!fullColour.hasBeenSet() &amp;amp;&amp;amp; !fullColourAlias.hasBeenSet()) {
+      // Default to FullColor=0 if AutoSelect=0 &amp;amp;&amp;amp; LowColorLevel is set
+      if (!autoSelect.getValue() &amp;amp;&amp;amp; (lowColourLevel.hasBeenSet() ||
+                          lowColourLevelAlias.hasBeenSet())) {
+        fullColour.setParam(false);
+      }
+    }
+    if (!customCompressLevel.hasBeenSet()) {
+      // Default to CustomCompressLevel=1 if CompressLevel is used.
+      customCompressLevel.setParam(compressLevel.hasBeenSet());
+    }
   }
 
   public static void usage() {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -166,62 +195,52 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
                     "Other valid forms are &amp;lt;param&amp;gt;=&amp;lt;value&amp;gt; -&amp;lt;param&amp;gt;=&amp;lt;value&amp;gt; "+
                     "--&amp;lt;param&amp;gt;=&amp;lt;value&amp;gt;\n"+
                     "Parameter names are case-insensitive.  The parameters "+
-                    "are:");
+                    "are:\n"+
+                    "\n");
     System.err.print(usage);
-    VoidParameter current = Configuration.head;
-    while (current != null) {
-      System.err.format("%n%-7s%-64s%n", " ", "\u001B[1m"+"-"+current.getName()+"\u001B[0m");
-      String[] desc = current.getDescription().split("(?&amp;lt;=\\G.{60})");
-      for (int i = 0; i &amp;lt; desc.length; i++) {
-        String line = desc[i];
-        if (!line.endsWith(" ") &amp;amp;&amp;amp; i &amp;lt; desc.length-1)
-          line = line+"-";
-        System.err.format("%-14s%-64s%n"," ", line.trim());
-      }
-      System.err.format("%-14s%-64s%n"," ", "[default="+current.getDefaultStr()+"]");
-      current = current.next;
-    }
+
+    Configuration.listParams(79, 14);
     String propertiesString = ("\n"+
 "\u001B[1mSystem Properties\u001B[0m (adapted from the TurboVNC vncviewer man page)\n"+
-"\tWhen started with the -via option, vncviewer reads the\n"+
-"\t\u001B[1mcom.tigervnc.VNC_VIA_CMD\u001B[0m System property, expands\n"+
-"\tpatterns beginning with the \"%\" character, and uses the resulting\n"+
-"\tcommand line to establish the secure tunnel to the VNC gateway.\n"+
-"\tIf \u001B[1mcom.tigervnc.VNC_VIA_CMD\u001B[0m is not set, this \n"+
-"\tcommand line defaults to \"/usr/bin/ssh -f -L %L:%H:%R %G sleep 20\".\n"+
+"  When started with the -via option, vncviewer reads the\n"+
+"  \u001B[1mcom.tigervnc.VNC_VIA_CMD\u001B[0m System property, expands\n"+
+"  patterns beginning with the \"%\" character, and uses the resulting\n"+
+"  command line to establish the secure tunnel to the VNC gateway.\n"+
+"  If \u001B[1mcom.tigervnc.VNC_VIA_CMD\u001B[0m is not set, this \n"+
+"  command line defaults to \"/usr/bin/ssh -f -L %L:%H:%R %G sleep 20\".\n"+
 "\n"+
-"\tThe following patterns are recognized in the VNC_VIA_CMD property\n"+
-"\t(note that all of the patterns %G, %H, %L and %R must be present in \n"+
-"\tthe command template):\n"+
+"  The following patterns are recognized in the VNC_VIA_CMD property\n"+
+"  (note that all of the patterns %G, %H, %L and %R must be present in \n"+
+"  the command template):\n"+
 "\n"+
-"\t\t%%     A literal \"%\";\n"+
+"  \t%%     A literal \"%\";\n"+
 "\n"+
-"\t\t%G     gateway machine name;\n"+
+"  \t%G     gateway machine name;\n"+
 "\n"+
-"\t\t%H     remote VNC machine name, (as known to the gateway);\n"+
+"  \t%H     remote VNC machine name, (as known to the gateway);\n"+
 "\n"+
-"\t\t%L     local TCP port number;\n"+
+"  \t%L     local TCP port number;\n"+
 "\n"+
-"\t\t%R     remote TCP port number.\n"+
+"  \t%R     remote TCP port number.\n"+
 "\n"+
-"\tWhen started with the -tunnel option, vncviewer reads the\n"+
-"\t\u001B[1mcom.tigervnc.VNC_TUNNEL_CMD\u001B[0m System property, expands\n"+
-"\tpatterns beginning with the \"%\" character, and uses the resulting\n"+
-"\tcommand line to establish the secure tunnel to the VNC server.\n"+
-"\tIf \u001B[1mcom.tigervnc.VNC_TUNNEL_CMD\u001B[0m is not set, this command \n"+
-"\tline defaults to \"/usr/bin/ssh -f -L %L:localhost:%R %H sleep 20\".\n"+
+"  When started with the -tunnel option, vncviewer reads the\n"+
+"  \u001B[1mcom.tigervnc.VNC_TUNNEL_CMD\u001B[0m System property, expands\n"+
+"  patterns beginning with the \"%\" character, and uses the resulting\n"+
+"  command line to establish the secure tunnel to the VNC server.\n"+
+"  If \u001B[1mcom.tigervnc.VNC_TUNNEL_CMD\u001B[0m is not set, this command \n"+
+"  line defaults to \"/usr/bin/ssh -f -L %L:localhost:%R %H sleep 20\".\n"+
 "\n"+
-"\tThe following patterns are recognized in the VNC_TUNNEL_CMD property\n"+
-"\t(note that all of the patterns %H, %L and %R must be present in \n"+
-"\tthe command template):\n"+
+"  The following patterns are recognized in the VNC_TUNNEL_CMD property\n"+
+"  (note that all of the patterns %H, %L and %R must be present in \n"+
+"  the command template):\n"+
 "\n"+
-"\t\t%%     A literal \"%\";\n"+
+"  \t%%     A literal \"%\";\n"+
 "\n"+
-"\t\t%H     remote VNC machine name (as known to the client);\n"+
+"  \t%H     remote VNC machine name (as known to the client);\n"+
 "\n"+
-"\t\t%L     local TCP port number;\n"+
+"  \t%L     local TCP port number;\n"+
 "\n"+
-"\t\t%R     remote TCP port number.\n"+
+"  \t%R     remote TCP port number.\n"+
 "\n");
     System.err.print(propertiesString);
     System.exit(1);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -259,8 +278,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     logo = icon.getImage();
   }
 
-  public void start() {
-    vlog.debug("start called");
+  private void getTimestamp() {
     if (version == null || build == null) {
       ClassLoader cl = this.getClass().getClassLoader();
       InputStream stream = cl.getResourceAsStream("com/tigervnc/vncviewer/timestamp");
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -269,12 +287,19 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
         Attributes attributes = manifest.getMainAttributes();
         version = attributes.getValue("Version");
         build = attributes.getValue("Build");
+        buildDate = attributes.getValue("Package-Date");
+        buildTime = attributes.getValue("Package-Time");
       } catch (java.io.IOException e) { }
     }
+  }
+
+  public void start() {
+    vlog.debug("start called");
+    getTimestamp();
     nViewers++;
     if (applet &amp;amp;&amp;amp; firstApplet) {
       alwaysShowServerDialog.setParam(true);
-      Configuration.readAppletParams(this);
+      Configuration.global().readAppletParams(this);
       String host = getCodeBase().getHost();
       if (vncServerName.getValue() == null &amp;amp;&amp;amp; vncServerPort.getValue() != 0) {
         int port = vncServerPort.getValue();
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -294,11 +319,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   public void paint(Graphics g) {
     g.drawImage(logo, 0, 0, this);
     int h = logo.getHeight(this)+20;
-    g.drawString(about1+" v"+version+" ("+build+")", 0, h);
-    h += g.getFontMetrics().getHeight();
-    g.drawString(about2, 0, h);
-    h += g.getFontMetrics().getHeight();
-    g.drawString(about3, 0, h);
+    g.drawString(String.format(aboutText, version, build, 
+                               buildDate, buildTime), 0, h);
   }
 
   public void run() {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -382,10 +404,20 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
                       "used until AutoSelect decides the link is "+
                       "fast enough",
                       true);
-  AliasParameter fullColor
+  AliasParameter fullColourAlias
   = new AliasParameter("FullColor",
                        "Alias for FullColour",
                        fullColour);
+  IntParameter lowColourLevel
+  = new IntParameter("LowColorLevel",
+                     "Color level to use on slow connections. "+
+                     "0 = Very Low (8 colors), 1 = Low (64 colors), "+
+                     "2 = Medium (256 colors)", 
+                     2);
+  AliasParameter lowColourLevelAlias
+  = new AliasParameter("LowColourLevel",
+                       "Alias for LowColorLevel",
+                       lowColourLevel);
   StringParameter preferredEncoding
   = new StringParameter("PreferredEncoding",
                         "Preferred encoding to use (Tight, ZRLE, "+
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -413,6 +445,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   = new BoolParameter("SendClipboard",
                       "Send clipboard changes to the server",
                       true);
+  // FIXME
+  //StringParameter menuKey
+  //= new StringParameter("MenuKey",
+  //                      "The key which brings up the popup menu",
+  //                      "F8");
   StringParameter desktopSize
   = new StringParameter("DesktopSize",
                         "Reconfigure desktop size on the server on "+

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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
&lt;/pre&gt;</description>
    <dc:creator>bphinz-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&lt; at &gt;public.gmane.org</dc:creator>
    <dc:date>2012-05-14T02:19:42</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1280">
    <title>SF.net SVN: tigervnc:[4912] trunk/java/com/tigervnc/vncviewer/VncViewer. java</title>
    <link>http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1280</link>
    <description>&lt;pre&gt;Revision: 4912
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4912&amp;amp;view=rev
Author:   bphinz
Date:     2012-05-07 01:02:24 +0000 (Mon, 07 May 2012)
Log Message:
-----------
Reverted change introduced in r4910, r4911 didn't fix the problem that was created.

Revision Links:
--------------
    http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4910&amp;amp;view=rev
    http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4911&amp;amp;view=rev

Modified Paths:
--------------
    trunk/java/com/tigervnc/vncviewer/VncViewer.java

Modified: trunk/java/com/tigervnc/vncviewer/VncViewer.java
===================================================================
--- trunk/java/com/tigervnc/vncviewer/VncViewer.java2012-05-07 00:30:08 UTC (rev 4911)
+++ trunk/java/com/tigervnc/vncviewer/VncViewer.java2012-05-07 01:02:24 UTC (rev 4912)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -143,8 +143,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
         usage();
       }
 
-      if (vncServerName.getValue() == "")
-        vncServerName.setParam(argv[i]);
+      if (vncServerName.getValue() != null)
+        usage();
+      vncServerName.setParam(argv[i]);
     }
 
   }

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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
&lt;/pre&gt;</description>
    <dc:creator>bphinz-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&lt; at &gt;public.gmane.org</dc:creator>
    <dc:date>2012-05-07T01:02:24</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1279">
    <title>SF.net SVN: tigervnc:[4911] trunk/java/com/tigervnc/vncviewer/VncViewer. java</title>
    <link>http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1279</link>
    <description>&lt;pre&gt;Revision: 4911
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4911&amp;amp;view=rev
Author:   bphinz
Date:     2012-05-07 00:30:08 +0000 (Mon, 07 May 2012)
Log Message:
-----------
Fixed a null pointer exception introduced by r4909

Revision Links:
--------------
    http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4909&amp;amp;view=rev

Modified Paths:
--------------
    trunk/java/com/tigervnc/vncviewer/VncViewer.java

Modified: trunk/java/com/tigervnc/vncviewer/VncViewer.java
===================================================================
--- trunk/java/com/tigervnc/vncviewer/VncViewer.java2012-05-06 19:18:05 UTC (rev 4910)
+++ trunk/java/com/tigervnc/vncviewer/VncViewer.java2012-05-07 00:30:08 UTC (rev 4911)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -143,7 +143,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
         usage();
       }
 
-      if (vncServerName.getValue() == null)
+      if (vncServerName.getValue() == "")
         vncServerName.setParam(argv[i]);
     }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -366,7 +366,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   StringParameter passwordFile
   = new StringParameter("PasswordFile",
                         "Password file for VNC authentication",
-                        null);
+                        "");
   AliasParameter passwd
   = new AliasParameter("passwd",
                        "Alias for PasswordFile",

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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
&lt;/pre&gt;</description>
    <dc:creator>bphinz-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&lt; at &gt;public.gmane.org</dc:creator>
    <dc:date>2012-05-07T00:30:09</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1278">
    <title>SF.net SVN: tigervnc:[4910]trunk/java/com/tigervnc/vncviewer</title>
    <link>http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1278</link>
    <description>&lt;pre&gt;Revision: 4910
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4910&amp;amp;view=rev
Author:   bphinz
Date:     2012-05-06 19:18:05 +0000 (Sun, 06 May 2012)
Log Message:
-----------
Re-implemented SSH tunneling features in Java viewer based on TurboVNC native client method.  Adds support for string substitutions of via command, as well as a '-tunnel' option for tunneling directly to VNC server host (also support string substitutions). This implementation requires the vncServerName to be the last argument specified to the viewer, however this is consistent with the behavior of the native client and does not appear to cause any problems when using the viewer in standalone, applet, or jnlp modes.

Modified Paths:
--------------
    trunk/java/com/tigervnc/vncviewer/VncViewer.java

Added Paths:
-----------
    trunk/java/com/tigervnc/vncviewer/tunnel.java

Modified: trunk/java/com/tigervnc/vncviewer/VncViewer.java
===================================================================
--- trunk/java/com/tigervnc/vncviewer/VncViewer.java2012-05-06 17:51:27 UTC (rev 4909)
+++ trunk/java/com/tigervnc/vncviewer/VncViewer.java2012-05-06 19:18:05 UTC (rev 4910)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -50,9 +50,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 import com.tigervnc.rfb.*;
 import com.tigervnc.network.*;
 
-import com.jcraft.jsch.JSch;
-import com.jcraft.jsch.Session;
-
 public class VncViewer extends java.applet.Applet implements Runnable
 {
   public static final String about1 = "TigerVNC Viewer for Java";
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -127,6 +124,12 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
         continue;
       }
 
+      if (argv[i].equalsIgnoreCase("-tunnel") || argv[i].equalsIgnoreCase("-via")) {
+        if (!tunnel.createTunnel(argv.length, argv, i))
+          System.exit(1);
+        continue;
+      }
+
       if (Configuration.setParam(argv[i]))
         continue;
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -140,15 +143,15 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
         usage();
       }
 
-      if (vncServerName.getValue() != null)
-        usage();
-      vncServerName.setParam(argv[i]);
+      if (vncServerName.getValue() == null)
+        vncServerName.setParam(argv[i]);
     }
+
   }
 
   public static void usage() {
     String usage = ("\nusage: vncviewer [options/parameters] "+
-                    "[host:displayNum] [options/parameters]\n"+
+                    "[host:displayNum]\n"+
                     "       vncviewer [options/parameters] -listen [port] "+
                     "[options/parameters]\n"+
                     "\n"+
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -177,85 +180,52 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
       System.err.format("%-14s%-64s%n"," ", "[default="+current.getDefaultStr()+"]");
       current = current.next;
     }
+    String propertiesString = ("\n"+
+"\u001B[1mSystem Properties\u001B[0m (adapted from the TurboVNC vncviewer man page)\n"+
+"\tWhen started with the -via option, vncviewer reads the\n"+
+"\t\u001B[1mcom.tigervnc.VNC_VIA_CMD\u001B[0m System property, expands\n"+
+"\tpatterns beginning with the \"%\" character, and uses the resulting\n"+
+"\tcommand line to establish the secure tunnel to the VNC gateway.\n"+
+"\tIf \u001B[1mcom.tigervnc.VNC_VIA_CMD\u001B[0m is not set, this \n"+
+"\tcommand line defaults to \"/usr/bin/ssh -f -L %L:%H:%R %G sleep 20\".\n"+
+"\n"+
+"\tThe following patterns are recognized in the VNC_VIA_CMD property\n"+
+"\t(note that all of the patterns %G, %H, %L and %R must be present in \n"+
+"\tthe command template):\n"+
+"\n"+
+"\t\t%%     A literal \"%\";\n"+
+"\n"+
+"\t\t%G     gateway machine name;\n"+
+"\n"+
+"\t\t%H     remote VNC machine name, (as known to the gateway);\n"+
+"\n"+
+"\t\t%L     local TCP port number;\n"+
+"\n"+
+"\t\t%R     remote TCP port number.\n"+
+"\n"+
+"\tWhen started with the -tunnel option, vncviewer reads the\n"+
+"\t\u001B[1mcom.tigervnc.VNC_TUNNEL_CMD\u001B[0m System property, expands\n"+
+"\tpatterns beginning with the \"%\" character, and uses the resulting\n"+
+"\tcommand line to establish the secure tunnel to the VNC server.\n"+
+"\tIf \u001B[1mcom.tigervnc.VNC_TUNNEL_CMD\u001B[0m is not set, this command \n"+
+"\tline defaults to \"/usr/bin/ssh -f -L %L:localhost:%R %H sleep 20\".\n"+
+"\n"+
+"\tThe following patterns are recognized in the VNC_TUNNEL_CMD property\n"+
+"\t(note that all of the patterns %H, %L and %R must be present in \n"+
+"\tthe command template):\n"+
+"\n"+
+"\t\t%%     A literal \"%\";\n"+
+"\n"+
+"\t\t%H     remote VNC machine name (as known to the client);\n"+
+"\n"+
+"\t\t%L     local TCP port number;\n"+
+"\n"+
+"\t\t%R     remote TCP port number.\n"+
+"\n");
+    System.err.print(propertiesString);
     System.exit(1);
   }
 
-  /* Tunnelling support. */
-  private void interpretViaParam(StringParameter gatewayHost,
-    StringParameter remoteHost, IntParameter remotePort, 
-    StringParameter vncServerName, IntParameter localPort)
-  {
-    final int SERVER_PORT_OFFSET = 5900;;
-    int pos = vncServerName.getValueStr().indexOf(":");
-    if (pos == -1)
-      remotePort.setParam(""+SERVER_PORT_OFFSET+"");
-    else {
-      int portOffset = SERVER_PORT_OFFSET;
-      int len;
-      pos++;
-      len =  vncServerName.getValueStr().substring(pos).length();
-      if (vncServerName.getValueStr().substring(pos, pos).equals(":")) {
-        /* Two colons is an absolute port number, not an offset. */
-        pos++;
-        len--;
-        portOffset = 0;
-      }
-      try {
-        if (len &amp;lt;= 0 || !vncServerName.getValueStr().substring(pos).matches("[0-9]+"))
-          usage();
-        portOffset += Integer.parseInt(vncServerName.getValueStr().substring(pos));
-        remotePort.setParam(""+portOffset+"");
-      } catch (java.lang.NumberFormatException e) {
-        usage();
-      }
-    }
-  
-    if (vncServerName != null)
-      remoteHost.setParam(vncServerName.getValueStr().split(":")[0]);
-  
-    gatewayHost.setParam(via.getValueStr());
-    vncServerName.setParam("localhost::"+localPort.getValue());
-  }
-
-  private void
-  createTunnel(String gatewayHost, String remoteHost,
-          int remotePort, int localPort)
-  {
-    try{
-      JSch jsch=new JSch();
-      String homeDir = new String("");
-      try {
-        homeDir = System.getProperty("user.home");
-      } catch(java.security.AccessControlException e) {
-        System.out.println("Cannot access user.home system property");
-      }
-      // NOTE: jsch does not support all ciphers.  User may be
-      //       prompted to accept host key authenticy even if
-      //       the key is in the known_hosts file.
-      File knownHosts = new File(homeDir+"/.ssh/known_hosts");
-      if (knownHosts.exists() &amp;amp;&amp;amp; knownHosts.canRead())
-      jsch.setKnownHosts(knownHosts.getAbsolutePath());
-      ArrayList&amp;lt;File&amp;gt; privateKeys = new ArrayList&amp;lt;File&amp;gt;();
-      privateKeys.add(new File(homeDir+"/.ssh/id_rsa"));
-      privateKeys.add(new File(homeDir+"/.ssh/id_dsa"));
-      for (Iterator i = privateKeys.iterator(); i.hasNext();) {
-        File privateKey = (File)i.next();
-        if (privateKey.exists() &amp;amp;&amp;amp; privateKey.canRead())
-        jsch.addIdentity(privateKey.getAbsolutePath());
-      }
-      // username and passphrase will be given via UserInfo interface.
-      PasswdDialog dlg = new PasswdDialog(new String("SSH Authentication"), false, false);
-      dlg.userEntry.setText((String)System.getProperties().get("user.name"));
-      Session session=jsch.getSession(dlg.userEntry.getText(), gatewayHost, 22);
-      session.setUserInfo(dlg);
-      session.connect();
-
-      session.setPortForwardingL(localPort, remoteHost, remotePort);
-    } catch (java.lang.Exception e) {
-      System.out.println(e);
-    }
-  }
-
   public VncViewer() {
     applet = true;
     firstApplet = true;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -333,21 +303,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   public void run() {
     CConn cc = null;
 
-    /* Tunnelling support. */
-    if (via.getValueStr() != null) {
-      StringParameter gatewayHost = new StringParameter("", "", "");
-      StringParameter remoteHost = new StringParameter("", "", "localhost");
-      IntParameter localPort = 
-        new IntParameter("", "", TcpSocket.findFreeTcpPort());
-      IntParameter remotePort = new IntParameter("", "", 5900);
-      if (vncServerName.getValueStr() == null)
-        usage();
-      interpretViaParam(gatewayHost, remoteHost, remotePort, 
-        vncServerName, localPort);
-      createTunnel(gatewayHost.getValueStr(), remoteHost.getValueStr(), 
-        remotePort.getValue(), localPort.getValue());
-    }
-
     if (listenMode.getValue()) {
       int port = 5500;
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -469,11 +424,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   = new StringParameter("ScalingFactor",
                         "Reduce or enlarge the remote desktop image. "+
                         "The value is interpreted as a scaling factor "+
-                        "in percent.  If the parameter is set to "+
+                        "in percent. If the parameter is set to "+
                         "\"Auto\", then automatic scaling is "+
-                        "performed.  Auto-scaling tries to choose a "+
+                        "performed. Auto-scaling tries to choose a "+
                         "scaling factor in such a way that the whole "+
-                        "remote desktop will fit on the local screen.  "+
+                        "remote desktop will fit on the local screen. "+
                         "If the parameter is set to \"FixedRatio\", "+
                         "then automatic scaling is performed, but the "+
                         "original aspect ratio is preserved.",
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -499,8 +454,30 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
                       "Produce a system beep when requested to by the server.", 
                       true);
   StringParameter via
-  = new StringParameter("via", "Gateway to tunnel via", null);
+  = new StringParameter("via",
+    "Automatically create an encrypted TCP tunnel to "+
+    "machine gateway, then use that tunnel to connect "+
+    "to a VNC server running on host. By default, "+
+    "this option invokes SSH local port forwarding and "+
+    "assumes that the SSH client binary is located at "+
+    "/usr/bin/ssh. Note that when using the -via "+
+    "option, the host machine name should be specified "+
+    "from the point of view of the gateway machine. "+
+    "For example, \"localhost\" denotes the gateway, "+
+    "not the machine on which vncviewer was launched. "+
+    "See the System Properties section below for "+
+    "information on configuring the -via option.",
+    null);
 
+  StringParameter tunnelMode
+  = new StringParameter("tunnel",
+    "Automatically create an encrypted TCP tunnel to "+
+    "remote gateway, then use that tunnel to connect "+
+    "to the specified VNC server port on the remote "+
+    "host. See the System Properties section below "+
+    "for information on configuring the -tunnel option.",
+    null);
+
   BoolParameter customCompressLevel
   = new BoolParameter("CustomCompressLevel",
                       "Use custom compression level. "+

Added: trunk/java/com/tigervnc/vncviewer/tunnel.java
===================================================================
--- trunk/java/com/tigervnc/vncviewer/tunnel.java                        (rev 0)
+++ trunk/java/com/tigervnc/vncviewer/tunnel.java2012-05-06 19:18:05 UTC (rev 4910)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -0,0 +1,327 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+/*
+ *  Copyright (C) 2012 Brian P. Hinz.  All Rights Reserved.
+ *  Copyright (C) 2000 Const Kaplinsky.  All Rights Reserved.
+ *  Copyright (C) 1999 AT&amp;amp;T Laboratories Cambridge.  All Rights Reserved.
+ *
+ *  This is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This software is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this software; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ *  USA.
+ */
+
+/*
+ * tunnel.java - SSH tunneling support
+ */
+
+package com.tigervnc.vncviewer;
+
+import java.io.File;
+import java.lang.Character;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import com.tigervnc.rdr.*;
+import com.tigervnc.rfb.*;
+import com.tigervnc.network.*;
+
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.Session;
+
+public class tunnel 
+{
+  private final static Integer SERVER_PORT_OFFSET = 5900;;
+  private final static String DEFAULT_SSH_CMD = "/usr/bin/ssh";
+  private final static String DEFAULT_TUNNEL_CMD  
+    = DEFAULT_SSH_CMD+" -f -L %L:localhost:%R %H sleep 20";
+  private final static String DEFAULT_VIA_CMD  
+    = DEFAULT_SSH_CMD+" -f -L %L:%H:%R %G sleep 20";
+
+  private final static int H = 17;
+  private final static int G = 16;
+  private final static int R = 27;
+  private final static int L = 21;
+  
+  /* True if there was -tunnel or -via option in the command line. */
+  private static boolean tunnelSpecified = false;
+  
+  /* True if it was -tunnel, not -via option. */
+  private static boolean tunnelOption = false;
+  
+  /* "Hostname:display" pair in the command line will be substituted
+     by this fake argument when tunneling is used. */
+  private static String lastArgv;
+
+  private static String tunnelEndpoint;
+  
+  public static Boolean
+  createTunnel(int pargc, String[] argv, int tunnelArgIndex)
+  {
+    char[] pattern;
+    char[] cmd = new char[1024];
+    int[] localPort = new int[1];
+    int[] remotePort = new int[1];
+    char[] localPortStr = new char[8];
+    char[] remotePortStr = new char[8];
+    StringBuilder gatewayHost = new StringBuilder("");
+    StringBuilder remoteHost = new StringBuilder("localhost");
+  
+    tunnelSpecified = true;
+    if (argv[tunnelArgIndex].equalsIgnoreCase("-tunnel"))
+      tunnelOption = true;
+  
+    pattern = getCmdPattern();
+    if (pattern == null)
+      return false;
+  
+    localPort[0] = TcpSocket.findFreeTcpPort();
+    if (localPort[0] == 0)
+      return false;
+  
+    if (tunnelOption) {
+      processTunnelArgs(remoteHost, remotePort, localPort,
+        pargc, argv, tunnelArgIndex);
+    } else {
+      processViaArgs(gatewayHost, remoteHost, remotePort, localPort,
+     pargc, argv, tunnelArgIndex);
+    }
+  
+    localPortStr = Integer.toString(localPort[0]).toCharArray();
+    remotePortStr = Integer.toString(remotePort[0]).toCharArray();
+  
+    if (!fillCmdPattern(cmd, pattern, gatewayHost.toString().toCharArray(), 
+remoteHost.toString().toCharArray(), remotePortStr, localPortStr))
+      return false;
+  
+    if (!runCommand(new String(cmd)))
+      return false;
+  
+    return true;
+  }
+  
+  private static void
+  processTunnelArgs(StringBuilder remoteHost, int[] remotePort, 
+                    int[] localPort, int pargc, String[] argv, 
+                    int tunnelArgIndex)
+  {
+    String pdisplay;
+  
+    if (tunnelArgIndex &amp;gt;= pargc - 1)
+      VncViewer.usage();
+  
+    pdisplay = argv[pargc - 1].split(":")[1];
+    if (pdisplay == null || pdisplay == argv[pargc - 1])
+      VncViewer.usage();
+  
+    if (pdisplay.matches("/[^0-9]/"))
+      VncViewer.usage();
+  
+    remotePort[0] = Integer.parseInt(pdisplay);
+    if (remotePort[0] &amp;lt; 100)
+      remotePort[0] = remotePort[0] + SERVER_PORT_OFFSET;
+  
+    lastArgv = new String("localhost::"+localPort[0]);
+  
+    remoteHost.setLength(0);
+    remoteHost.insert(0, argv[pargc - 1].split(":")[0]);
+    argv[pargc - 1] = lastArgv;
+  
+    //removeArgs(pargc, argv, tunnelArgIndex, 1);
+  }
+  
+  private static void
+  processViaArgs(StringBuilder gatewayHost, StringBuilder remoteHost,
+         int[] remotePort, int[] localPort,
+         int pargc, String[] argv, int tunnelArgIndex)
+  {
+    String colonPos;
+    int len, portOffset;
+    int disp;
+  
+    if (tunnelArgIndex &amp;gt;= pargc - 2)
+      VncViewer.usage();
+  
+    colonPos = argv[pargc - 1].split(":", 2)[1];
+    if (colonPos == null) {
+      /* No colon -- use default port number */
+      remotePort[0] = SERVER_PORT_OFFSET;
+    } else {
+      len = colonPos.length();
+      portOffset = SERVER_PORT_OFFSET;
+      if (colonPos.startsWith(":")) {
+        /* Two colons -- interpret as a port number */
+        colonPos.replaceFirst(":", "");
+        len--;
+        portOffset = 0;
+      }
+      if (len == 0 || colonPos.matches("/[^0-9]/")) {
+        VncViewer.usage();
+      }
+      disp = Integer.parseInt(colonPos);
+      if (portOffset != 0 &amp;amp;&amp;amp; disp &amp;gt;= 100)
+        portOffset = 0;
+      remotePort[0] = disp + portOffset;
+    }
+  
+    lastArgv = "localhost::"+localPort[0];
+  
+    gatewayHost.setLength(0);
+    gatewayHost.insert(0, argv[tunnelArgIndex + 1]);
+  
+    if (!argv[pargc - 1].split(":", 2)[0].equals("")) {
+      remoteHost.setLength(0);
+      remoteHost.insert(0, argv[pargc - 1].split(":", 2)[0]);
+    }
+  
+    argv[pargc - 1] = lastArgv;
+  
+    //removeArgs(pargc, argv, tunnelArgIndex, 2);
+  }
+  
+  private static char[]
+  getCmdPattern()
+  {
+    String pattern = "";
+  
+    try {
+      if (tunnelOption) {
+        pattern = System.getProperty("com.tigervnc.VNC_TUNNEL_CMD");
+      } else {
+        pattern = System.getProperty("com.tigervnc.VNC_VIA_CMD");
+      }
+    } catch (java.lang.Exception e) { 
+      vlog.info(e.toString());
+    }
+    if (pattern == null || pattern.equals(""))
+      pattern = (tunnelOption) ? DEFAULT_TUNNEL_CMD : DEFAULT_VIA_CMD;
+  
+    return pattern.toCharArray();
+  }
+  
+  /* Note: in fillCmdPattern() result points to a 1024-byte buffer */
+  
+  private static boolean
+  fillCmdPattern(char[] result, char[] pattern,
+         char[] gatewayHost, char[] remoteHost,
+         char[] remotePort, char[] localPort)
+  {
+    int i, j;
+    boolean H_found = false, G_found = false, R_found = false, L_found = false;
+
+    for (i=0, j=0; i &amp;lt; pattern.length &amp;amp;&amp;amp; j&amp;lt;1023; i++, j++) {
+      if (pattern[i] == '%') {
+        switch (pattern[++i]) {
+        case 'H':
+  System.arraycopy(remoteHost, 0, result, j, remoteHost.length);
+  j += remoteHost.length;
+  H_found = true;
+        tunnelEndpoint = new String(remoteHost);
+  continue;
+        case 'G':
+  System.arraycopy(gatewayHost, 0, result, j, gatewayHost.length);
+  j += gatewayHost.length;
+  G_found = true;
+        tunnelEndpoint = new String(gatewayHost);
+  continue;
+        case 'R':
+  System.arraycopy(remotePort, 0, result, j, remotePort.length);
+  j += remotePort.length;
+  R_found = true;
+  continue;
+        case 'L':
+  System.arraycopy(localPort, 0, result, j, localPort.length);
+  j += localPort.length;
+  L_found = true;
+  continue;
+        case '\0':
+  i--;
+  continue;
+        }
+      }
+      result[j] = pattern[i];
+    }
+  
+    if (pattern.length &amp;gt; 1024) {
+      vlog.error("Tunneling command is too long.");
+      return false;
+    }
+  
+    if (!H_found || !R_found || !L_found) {
+      vlog.error("%H, %R or %L absent in tunneling command.");
+      return false;
+    }
+    if (!tunnelOption &amp;amp;&amp;amp; !G_found) {
+      vlog.error("%G pattern absent in tunneling command.");
+      return false;
+    }
+  
+    return true;
+  }
+  
+  private static Boolean
+  runCommand(String cmd)
+  {
+    try{
+      JSch jsch=new JSch();
+      String homeDir = new String("");
+      try {
+        homeDir = System.getProperty("user.home");
+      } catch(java.security.AccessControlException e) {
+        System.out.println("Cannot access user.home system property");
+      }
+      // NOTE: jsch does not support all ciphers.  User may be
+      //       prompted to accept host key authenticy even if
+      //       the key is in the known_hosts file.
+      File knownHosts = new File(homeDir+"/.ssh/known_hosts");
+      if (knownHosts.exists() &amp;amp;&amp;amp; knownHosts.canRead())
+      jsch.setKnownHosts(knownHosts.getAbsolutePath());
+      ArrayList&amp;lt;File&amp;gt; privateKeys = new ArrayList&amp;lt;File&amp;gt;();
+      privateKeys.add(new File(homeDir+"/.ssh/id_rsa"));
+      privateKeys.add(new File(homeDir+"/.ssh/id_dsa"));
+      for (Iterator i = privateKeys.iterator(); i.hasNext();) {
+        File privateKey = (File)i.next();
+        if (privateKey.exists() &amp;amp;&amp;amp; privateKey.canRead())
+        jsch.addIdentity(privateKey.getAbsolutePath());
+      }
+      // username and passphrase will be given via UserInfo interface.
+      PasswdDialog dlg = new PasswdDialog(new String("SSH Authentication"), false, false);
+      dlg.userEntry.setText((String)System.getProperties().get("user.name"));
+
+      Session session=jsch.getSession(dlg.userEntry.getText(), tunnelEndpoint, 22);
+      session.setUserInfo(dlg);
+      session.connect();
+
+      String[] tokens = cmd.split("\\s");
+      for (int i = 0; i &amp;lt; tokens.length; i++) {
+        if (tokens[i].equals("-L")) {
+          String[] par = tokens[++i].split(":");
+          int localPort = Integer.parseInt(par[0].trim());
+          String remoteHost = par[1].trim();
+          int remotePort = Integer.parseInt(par[2].trim());
+          session.setPortForwardingL(localPort, remoteHost, remotePort);
+        } else if (tokens[i].equals("-R")) {
+          String[] par = tokens[++i].split(":");
+          int remotePort = Integer.parseInt(par[0].trim());
+          String localHost = par[1].trim();
+          int localPort = Integer.parseInt(par[2].trim());
+          session.setPortForwardingR(remotePort, localHost, localPort);
+        }
+      }
+    } catch (java.lang.Exception e) {
+      System.out.println(" Tunneling command failed: "+e.toString());
+      return false;
+    }
+    return true;
+  }
+  
+  static LogWriter vlog = new LogWriter("tunnel");
+}

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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
&lt;/pre&gt;</description>
    <dc:creator>bphinz-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&lt; at &gt;public.gmane.org</dc:creator>
    <dc:date>2012-05-06T19:18:05</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1277">
    <title>SF.net SVN: tigervnc:[4909]trunk/java/com/tigervnc</title>
    <link>http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1277</link>
    <description>&lt;pre&gt;Revision: 4909
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4909&amp;amp;view=rev
Author:   bphinz
Date:     2012-05-06 17:51:27 +0000 (Sun, 06 May 2012)
Log Message:
-----------
improve readability of usage message displayed by Java viewer.

Modified Paths:
--------------
    trunk/java/com/tigervnc/rfb/VoidParameter.java
    trunk/java/com/tigervnc/vncviewer/VncViewer.java

Modified: trunk/java/com/tigervnc/rfb/VoidParameter.java
===================================================================
--- trunk/java/com/tigervnc/rfb/VoidParameter.java2012-04-27 18:23:31 UTC (rev 4908)
+++ trunk/java/com/tigervnc/rfb/VoidParameter.java2012-05-06 17:51:27 UTC (rev 4909)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -35,7 +35,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   abstract public String getValueStr();
   public boolean isBool() { return false; }
 
-  VoidParameter next;
+  public VoidParameter next;
   protected String name;
   protected String description;
 }

Modified: trunk/java/com/tigervnc/vncviewer/VncViewer.java
===================================================================
--- trunk/java/com/tigervnc/vncviewer/VncViewer.java2012-04-27 18:23:31 UTC (rev 4908)
+++ trunk/java/com/tigervnc/vncviewer/VncViewer.java2012-05-06 17:51:27 UTC (rev 4909)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -162,9 +162,21 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
                     "Other valid forms are &amp;lt;param&amp;gt;=&amp;lt;value&amp;gt; -&amp;lt;param&amp;gt;=&amp;lt;value&amp;gt; "+
                     "--&amp;lt;param&amp;gt;=&amp;lt;value&amp;gt;\n"+
                     "Parameter names are case-insensitive.  The parameters "+
-                    "are:\n\n"+
-                    Configuration.listParams());
+                    "are:");
     System.err.print(usage);
+    VoidParameter current = Configuration.head;
+    while (current != null) {
+      System.err.format("%n%-7s%-64s%n", " ", "\u001B[1m"+"-"+current.getName()+"\u001B[0m");
+      String[] desc = current.getDescription().split("(?&amp;lt;=\\G.{60})");
+      for (int i = 0; i &amp;lt; desc.length; i++) {
+        String line = desc[i];
+        if (!line.endsWith(" ") &amp;amp;&amp;amp; i &amp;lt; desc.length-1)
+          line = line+"-";
+        System.err.format("%-14s%-64s%n"," ", line.trim());
+      }
+      System.err.format("%-14s%-64s%n"," ", "[default="+current.getDefaultStr()+"]");
+      current = current.next;
+    }
     System.exit(1);
   }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -389,50 +401,69 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 
   BoolParameter useLocalCursor
   = new BoolParameter("UseLocalCursor",
-                          "Render the mouse cursor locally", true);
+                      "Render the mouse cursor locally",
+                      true);
   BoolParameter sendLocalUsername
   = new BoolParameter("SendLocalUsername",
-                          "Send the local username for SecurityTypes "+
-                          "such as Plain rather than prompting", true);
+                      "Send the local username for SecurityTypes "+
+                      "such as Plain rather than prompting",
+                      true);
   StringParameter passwordFile
   = new StringParameter("PasswordFile",
-                          "Password file for VNC authentication", "");
+                        "Password file for VNC authentication",
+                        null);
   AliasParameter passwd
-  = new AliasParameter("passwd", "Alias for PasswordFile", passwordFile);
+  = new AliasParameter("passwd",
+                       "Alias for PasswordFile",
+                       passwordFile);
   BoolParameter autoSelect
   = new BoolParameter("AutoSelect",
-                          "Auto select pixel format and encoding", true);
+                      "Auto select pixel format and encoding",
+                      true);
   BoolParameter fullColour
   = new BoolParameter("FullColour",
-                          "Use full colour - otherwise 6-bit colour is used "+
-                          "until AutoSelect decides the link is fast enough",
-                          true);
+                      "Use full colour - otherwise 6-bit colour is "+
+                      "used until AutoSelect decides the link is "+
+                      "fast enough",
+                      true);
   AliasParameter fullColor
-  = new AliasParameter("FullColor", "Alias for FullColour", fullColour);
+  = new AliasParameter("FullColor",
+                       "Alias for FullColour",
+                       fullColour);
   StringParameter preferredEncoding
   = new StringParameter("PreferredEncoding",
-                            "Preferred encoding to use (Tight, ZRLE, hextile or"+
-                            " raw) - implies AutoSelect=0", "Tight");
+                        "Preferred encoding to use (Tight, ZRLE, "+
+                        "hextile or raw) - implies AutoSelect=0",
+                        "Tight");
   BoolParameter viewOnly
-  = new BoolParameter("ViewOnly", "Don't send any mouse or keyboard "+
-                          "events to the server", false);
+  = new BoolParameter("ViewOnly",
+                      "Don't send any mouse or keyboard events to "+
+                      "the server",
+                      false);
   BoolParameter shared
-  = new BoolParameter("Shared", "Don't disconnect other viewers upon "+
-                          "connection - share the desktop instead", false);
+  = new BoolParameter("Shared",
+                      "Don't disconnect other viewers upon "+
+                      "connection - share the desktop instead",
+                      false);
   BoolParameter fullScreen
-  = new BoolParameter("FullScreen", "Full Screen Mode", false);
+  = new BoolParameter("FullScreen",
+                      "Full Screen Mode",
+                      false);
   BoolParameter acceptClipboard
   = new BoolParameter("AcceptClipboard",
-                          "Accept clipboard changes from the server", true);
+                      "Accept clipboard changes from the server",
+                      true);
   BoolParameter sendClipboard
   = new BoolParameter("SendClipboard",
-                          "Send clipboard changes to the server", true);
+                      "Send clipboard changes to the server",
+                      true);
   StringParameter desktopSize
   = new StringParameter("DesktopSize",
                         "Reconfigure desktop size on the server on "+
                         "connect (if possible)", "");
   BoolParameter listenMode
-  = new BoolParameter("listen", "Listen for connections from VNC servers", 
+  = new BoolParameter("listen",
+                      "Listen for connections from VNC servers", 
                       false);
   StringParameter scalingFactor
   = new StringParameter("ScalingFactor",
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -445,20 +476,24 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
                         "remote desktop will fit on the local screen.  "+
                         "If the parameter is set to \"FixedRatio\", "+
                         "then automatic scaling is performed, but the "+
-                        "original aspect ratio is preserved.", "100");
+                        "original aspect ratio is preserved.",
+                        "100");
   BoolParameter alwaysShowServerDialog
   = new BoolParameter("AlwaysShowServerDialog",
-                          "Always show the server dialog even if a server "+
-                          "has been specified in an applet parameter or on "+
-                          "the command line", false);
+                      "Always show the server dialog even if a server "+
+                      "has been specified in an applet parameter or on "+
+                      "the command line",
+                      false);
   StringParameter vncServerName
   = new StringParameter("Server",
-                            "The VNC server &amp;lt;host&amp;gt;[:&amp;lt;dpyNum&amp;gt;] or "+
-                            "&amp;lt;host&amp;gt;::&amp;lt;port&amp;gt;", null);
+                        "The VNC server &amp;lt;host&amp;gt;[:&amp;lt;dpyNum&amp;gt;] or "+
+                        "&amp;lt;host&amp;gt;::&amp;lt;port&amp;gt;",
+                        null);
   IntParameter vncServerPort
   = new IntParameter("Port",
-                         "The VNC server's port number, assuming it is on "+
-                         "the host from which the applet was downloaded", 0);
+                     "The VNC server's port number, assuming it is on "+
+                     "the host from which the applet was downloaded",
+                     0);
   BoolParameter acceptBell
   = new BoolParameter("AcceptBell",
                       "Produce a system beep when requested to by the server.", 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -468,21 +503,23 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 
   BoolParameter customCompressLevel
   = new BoolParameter("CustomCompressLevel",
-                          "Use custom compression level. "+
-                          "Default if CompressLevel is specified.", false);
+                      "Use custom compression level. "+
+                      "Default if CompressLevel is specified.",
+                      false);
   IntParameter compressLevel
   = new IntParameter("CompressLevel",
-                    "Use specified compression level "+
-                    "0 = Low, 6 = High",
-                    1);
+                     "Use specified compression level "+
+                     "0 = Low, 6 = High",
+                     1);
   BoolParameter noJpeg
   = new BoolParameter("NoJPEG",
-                          "Disable lossy JPEG compression in Tight encoding.", false);
+                      "Disable lossy JPEG compression in Tight encoding.",
+                      false);
   IntParameter qualityLevel
   = new IntParameter("QualityLevel",
-                    "JPEG quality level. "+
-                    "0 = Low, 9 = High",
-                    8);
+                     "JPEG quality level. "+
+                     "0 = Low, 9 = High",
+                     8);
 
   Thread thread;
   Socket sock;

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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
&lt;/pre&gt;</description>
    <dc:creator>bphinz-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&lt; at &gt;public.gmane.org</dc:creator>
    <dc:date>2012-05-06T17:51:27</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1276">
    <title>SF.net SVN: tigervnc:[4908] trunk/java/com/tigervnc/network/TcpListener. java</title>
    <link>http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1276</link>
    <description>&lt;pre&gt;Revision: 4908
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4908&amp;amp;view=rev
Author:   bphinz
Date:     2012-04-27 18:23:31 +0000 (Fri, 27 Apr 2012)
Log Message:
-----------
Fixed an issue with -listen mode where java client wasn't listening on the wildcard address

Modified Paths:
--------------
    trunk/java/com/tigervnc/network/TcpListener.java

Modified: trunk/java/com/tigervnc/network/TcpListener.java
===================================================================
--- trunk/java/com/tigervnc/network/TcpListener.java2012-04-26 14:27:52 UTC (rev 4907)
+++ trunk/java/com/tigervnc/network/TcpListener.java2012-04-27 18:23:31 UTC (rev 4908)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -59,9 +59,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
       } else if (listenaddr != null) {
           addr = java.net.InetAddress.getByName(listenaddr);
       } else {
-        // FIXME: need to be sure we get the wildcard address?
-        addr = InetAddress.getByName(null);
-        //addr = InetAddress.getLocalHost();
+        addr = InetAddress.getByName("0.0.0.0");
       }
     } catch (UnknownHostException e) {
       System.out.println(e.toString());

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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
&lt;/pre&gt;</description>
    <dc:creator>bphinz-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&lt; at &gt;public.gmane.org</dc:creator>
    <dc:date>2012-04-27T18:23:31</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1275">
    <title>SF.net SVN: tigervnc:[4907]trunk/vncviewer/vncviewer.cxx</title>
    <link>http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1275</link>
    <description>&lt;pre&gt;Revision: 4907
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4907&amp;amp;view=rev
Author:   ossman_
Date:     2012-04-26 14:27:52 +0000 (Thu, 26 Apr 2012)
Log Message:
-----------
The old Windows viewer was capable of logging to file. This is essential
on Windows as stdout/stderr don't work well there. Make sure the new
viewer also has this functionality.

Modified Paths:
--------------
    trunk/vncviewer/vncviewer.cxx

Modified: trunk/vncviewer/vncviewer.cxx
===================================================================
--- trunk/vncviewer/vncviewer.cxx2012-04-26 09:18:19 UTC (rev 4906)
+++ trunk/vncviewer/vncviewer.cxx2012-04-26 14:27:52 UTC (rev 4907)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -290,6 +290,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   bind_textdomain_codeset("libc", "UTF-8");
 
   rfb::initStdIOLoggers();
+#ifdef WIN32
+  rfb::initFileLogger("C:\\temp\\vncviewer.log");
+#else
+  rfb::initFileLogger("/tmp/vncviewer.log");
+#endif
   rfb::LogWriter::setLogParams("*:stderr:30");
 
 #ifdef SIGHUP

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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
&lt;/pre&gt;</description>
    <dc:creator>ossman_-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&lt; at &gt;public.gmane.org</dc:creator>
    <dc:date>2012-04-26T14:27:53</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1274">
    <title>SF.net SVN: tigervnc:[4906]trunk/win/winvnc/JavaViewer.cxx</title>
    <link>http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1274</link>
    <description>&lt;pre&gt;Revision: 4906
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4906&amp;amp;view=rev
Author:   ossman_
Date:     2012-04-26 09:18:19 +0000 (Thu, 26 Apr 2012)
Log Message:
-----------
Windows has a bit of a peculiarity in that winsock2.h must be included
before windows.h for correct winsock behaviour. mingw-w64 also enforces
this order, so to avoid compile errors we must include windows.h late in
all files.

Modified Paths:
--------------
    trunk/win/winvnc/JavaViewer.cxx

Modified: trunk/win/winvnc/JavaViewer.cxx
===================================================================
--- trunk/win/winvnc/JavaViewer.cxx2012-04-26 09:04:14 UTC (rev 4905)
+++ trunk/win/winvnc/JavaViewer.cxx2012-04-26 09:18:19 UTC (rev 4906)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -16,7 +16,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
  * USA.
  */
 
-#include &amp;lt;windows.h&amp;gt;
 #include &amp;lt;winvnc/JavaViewer.h&amp;gt;
 #include &amp;lt;winvnc/resource.h&amp;gt;
 #include &amp;lt;rdr/MemInStream.h&amp;gt;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -24,6 +23,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 #include &amp;lt;rfb/VNCServerST.h&amp;gt;
 #include &amp;lt;rfb_win32/TCharArray.h&amp;gt;
 
+#include &amp;lt;windows.h&amp;gt;
+
 #define strcasecmp _stricmp
 
 using namespace winvnc;

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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
&lt;/pre&gt;</description>
    <dc:creator>ossman_-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&lt; at &gt;public.gmane.org</dc:creator>
    <dc:date>2012-04-26T09:18:19</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1273">
    <title>SF.net SVN: tigervnc:[4905] trunk</title>
    <link>http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1273</link>
    <description>&lt;pre&gt;Revision: 4905
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4905&amp;amp;view=rev
Author:   ossman_
Date:     2012-04-26 09:04:14 +0000 (Thu, 26 Apr 2012)
Log Message:
-----------
Fix unsafe usage of the logging functions.

Modified Paths:
--------------
    trunk/common/rfb/CConnection.cxx
    trunk/common/rfb/CSecurityTLS.cxx
    trunk/common/rfb/SConnection.cxx
    trunk/common/rfb/SSecurityTLS.cxx
    trunk/unix/vncconfig/vncconfig.cxx
    trunk/unix/x0vncserver/x0vncserver.cxx
    trunk/vncviewer/CConn.cxx
    trunk/vncviewer/Viewport.cxx
    trunk/win/rfb_win32/CleanDesktop.cxx
    trunk/win/rfb_win32/Clipboard.cxx
    trunk/win/rfb_win32/DeviceFrameBuffer.cxx
    trunk/win/rfb_win32/MonitorInfo.cxx
    trunk/win/rfb_win32/RegConfig.cxx
    trunk/win/rfb_win32/SDisplay.cxx
    trunk/win/rfb_win32/SocketManager.cxx

Modified: trunk/common/rfb/CConnection.cxx
===================================================================
--- trunk/common/rfb/CConnection.cxx2012-04-26 08:51:19 UTC (rev 4904)
+++ trunk/common/rfb/CConnection.cxx2012-04-26 09:04:14 UTC (rev 4905)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -100,7 +100,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     char msg[256];
     sprintf(msg,"Server gave unsupported RFB protocol version %d.%d",
             cp.majorVersion, cp.minorVersion);
-    vlog.error(msg);
+    vlog.error("%s", msg);
     state_ = RFBSTATE_INVALID;
     throw Exception(msg);
   } else if (useProtocol3_3 || cp.beforeVersion(3,7)) {

Modified: trunk/common/rfb/CSecurityTLS.cxx
===================================================================
--- trunk/common/rfb/CSecurityTLS.cxx2012-04-26 08:51:19 UTC (rev 4904)
+++ trunk/common/rfb/CSecurityTLS.cxx2012-04-26 09:04:14 UTC (rev 4905)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -72,7 +72,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 
 static void debug_log(int level, const char* str)
 {
-  vlog_raw.debug(str);
+  vlog_raw.debug("[%d]: %s", level, str);
 }
 
 void CSecurityTLS::initGlobal()

Modified: trunk/common/rfb/SConnection.cxx
===================================================================
--- trunk/common/rfb/SConnection.cxx2012-04-26 08:51:19 UTC (rev 4904)
+++ trunk/common/rfb/SConnection.cxx2012-04-26 09:04:14 UTC (rev 4905)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -239,7 +239,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 
 void SConnection::throwConnFailedException(const char* msg)
 {
-  vlog.info(msg);
+  vlog.info("%s", msg);
   if (state_ == RFBSTATE_PROTOCOL_VERSION) {
     if (cp.majorVersion == 3 &amp;amp;&amp;amp; cp.minorVersion == 3) {
       os-&amp;gt;writeU32(0);

Modified: trunk/common/rfb/SSecurityTLS.cxx
===================================================================
--- trunk/common/rfb/SSecurityTLS.cxx2012-04-26 08:51:19 UTC (rev 4904)
+++ trunk/common/rfb/SSecurityTLS.cxx2012-04-26 09:04:14 UTC (rev 4905)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -49,7 +49,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 
 static void debug_log(int level, const char* str)
 {
-  vlog.debug(str);
+  vlog.debug("[%d]: %s", level, str);
 }
 
 void SSecurityTLS::initGlobal()

Modified: trunk/unix/vncconfig/vncconfig.cxx
===================================================================
--- trunk/unix/vncconfig/vncconfig.cxx2012-04-26 08:51:19 UTC (rev 4904)
+++ trunk/unix/vncconfig/vncconfig.cxx2012-04-26 09:04:14 UTC (rev 4905)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -431,7 +431,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     XCloseDisplay(dpy);
 
   } catch (rdr::Exception &amp;amp;e) {
-    vlog.error(e.str());
+    vlog.error("%s", e.str());
   }
 
   return 0;

Modified: trunk/unix/x0vncserver/x0vncserver.cxx
===================================================================
--- trunk/unix/x0vncserver/x0vncserver.cxx2012-04-26 08:51:19 UTC (rev 4904)
+++ trunk/unix/x0vncserver/x0vncserver.cxx2012-04-26 09:04:14 UTC (rev 4905)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -546,7 +546,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     }
 
   } catch (rdr::Exception &amp;amp;e) {
-    vlog.error(e.str());
+    vlog.error("%s", e.str());
     return 1;
   }
 

Modified: trunk/vncviewer/CConn.cxx
===================================================================
--- trunk/vncviewer/CConn.cxx2012-04-26 08:51:19 UTC (rev 4904)
+++ trunk/vncviewer/CConn.cxx2012-04-26 09:04:14 UTC (rev 4905)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -99,7 +99,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     sock = new network::TcpSocket(serverHost, serverPort);
     vlog.info(_("connected to host %s port %d"), serverHost, serverPort);
   } catch (rdr::Exception&amp;amp; e) {
-    vlog.error(e.str());
+    vlog.error("%s", e.str());
     fl_alert("%s", e.str());
     exit_vncviewer();
     return;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -210,10 +210,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
       cc-&amp;gt;processMsg();
     } while (cc-&amp;gt;sock-&amp;gt;inStream().checkNoWait(1));
   } catch (rdr::EndOfStream&amp;amp; e) {
-    vlog.info(e.str());
+    vlog.info("%s", e.str());
     exit_vncviewer();
   } catch (rdr::Exception&amp;amp; e) {
-    vlog.error(e.str());
+    vlog.error("%s", e.str());
     exit_vncviewer(e.str());
   }
 

Modified: trunk/vncviewer/Viewport.cxx
===================================================================
--- trunk/vncviewer/Viewport.cxx2012-04-26 08:51:19 UTC (rev 4904)
+++ trunk/vncviewer/Viewport.cxx2012-04-26 09:04:14 UTC (rev 4905)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -369,7 +369,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     try {
       cc-&amp;gt;writer()-&amp;gt;clientCutText(buffer, ret);
     } catch (rdr::Exception&amp;amp; e) {
-      vlog.error(e.str());
+      vlog.error("%s", e.str());
       exit_vncviewer(e.str());
     }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -501,7 +501,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
       try {
         cc-&amp;gt;writer()-&amp;gt;pointerEvent(pos, buttonMask);
       } catch (rdr::Exception&amp;amp; e) {
-        vlog.error(e.str());
+        vlog.error("%s", e.str());
         exit_vncviewer(e.str());
       }
     } else {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -524,7 +524,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   try {
     self-&amp;gt;cc-&amp;gt;writer()-&amp;gt;pointerEvent(self-&amp;gt;lastPointerPos, self-&amp;gt;lastButtonMask);
   } catch (rdr::Exception&amp;amp; e) {
-    vlog.error(e.str());
+    vlog.error("%s", e.str());
     exit_vncviewer(e.str());
   }
 }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -756,7 +756,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     try {
       cc-&amp;gt;writer()-&amp;gt;keyEvent(iter-&amp;gt;second, false);
     } catch (rdr::Exception&amp;amp; e) {
-      vlog.error(e.str());
+      vlog.error("%s", e.str());
       exit_vncviewer(e.str());
     }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -800,7 +800,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
       if (downKeySym.find(FL_Alt_R) != downKeySym.end())
         cc-&amp;gt;writer()-&amp;gt;keyEvent(XK_Alt_R, false);
     } catch (rdr::Exception&amp;amp; e) {
-      vlog.error(e.str());
+      vlog.error("%s", e.str());
       exit_vncviewer(e.str());
     }
   }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -814,7 +814,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   try {
     cc-&amp;gt;writer()-&amp;gt;keyEvent(keySym, down);
   } catch (rdr::Exception&amp;amp; e) {
-    vlog.error(e.str());
+    vlog.error("%s", e.str());
     exit_vncviewer(e.str());
   }
 

Modified: trunk/win/rfb_win32/CleanDesktop.cxx
===================================================================
--- trunk/win/rfb_win32/CleanDesktop.cxx2012-04-26 08:51:19 UTC (rev 4904)
+++ trunk/win/rfb_win32/CleanDesktop.cxx2012-04-26 09:04:14 UTC (rev 4905)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -178,7 +178,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
       if (ad.enable(false))
         restoreActiveDesktop = true;
     } catch (rdr::Exception&amp;amp; e) {
-      vlog.error(e.str());
+      vlog.error("%s", e.str());
     }
 
     // -=- Switch of normal wallpaper and notify apps
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -186,7 +186,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     restoreWallpaper = true;
 
   } catch (rdr::Exception&amp;amp; e) {
-    vlog.info(e.str());
+    vlog.info("%s", e.str());
   }
 }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -203,7 +203,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
         ad.enable(true);
         restoreActiveDesktop = false;
       } catch (rdr::Exception&amp;amp; e) {
-        vlog.error(e.str());
+        vlog.error("%s", e.str());
       }
     }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -216,7 +216,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     }
 
   } catch (rdr::Exception&amp;amp; e) {
-    vlog.info(e.str());
+    vlog.info("%s", e.str());
   }
 }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -230,7 +230,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     restorePattern = true;
 
   } catch (rdr::Exception&amp;amp; e) {
-    vlog.info(e.str());
+    vlog.info("%s", e.str());
   }
 }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -252,7 +252,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     }
 
   } catch (rdr::Exception&amp;amp; e) {
-    vlog.info(e.str());
+    vlog.info("%s", e.str());
   }
 }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -288,7 +288,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     restoreEffects = true;
 
   } catch (rdr::Exception&amp;amp; e) {
-    vlog.info(e.str());
+    vlog.info("%s", e.str());
   }
 }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -317,6 +317,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     }
 
   } catch (rdr::Exception&amp;amp; e) {
-    vlog.info(e.str());
+    vlog.info("%s", e.str());
   }
 }

Modified: trunk/win/rfb_win32/Clipboard.cxx
===================================================================
--- trunk/win/rfb_win32/Clipboard.cxx2012-04-26 08:51:19 UTC (rev 4904)
+++ trunk/win/rfb_win32/Clipboard.cxx2012-04-26 09:04:14 UTC (rev 4905)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -185,7 +185,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 
     vlog.debug("set clipboard");
   } catch (rdr::Exception&amp;amp; e) {
-    vlog.debug(e.str());
+    vlog.debug("%s", e.str());
   }
 
   // - Close the clipboard

Modified: trunk/win/rfb_win32/DeviceFrameBuffer.cxx
===================================================================
--- trunk/win/rfb_win32/DeviceFrameBuffer.cxx2012-04-26 08:51:19 UTC (rev 4904)
+++ trunk/win/rfb_win32/DeviceFrameBuffer.cxx2012-04-26 09:04:14 UTC (rev 4905)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -276,7 +276,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     server-&amp;gt;setCursor(cursor.width(), cursor.height(), cursor.hotspot,
                       cursorBm.data, cursor.mask.buf);
   } catch (rdr::Exception&amp;amp; e) {
-    vlog.error(e.str());
+    vlog.error("%s", e.str());
   }
 }
 

Modified: trunk/win/rfb_win32/MonitorInfo.cxx
===================================================================
--- trunk/win/rfb_win32/MonitorInfo.cxx2012-04-26 08:51:19 UTC (rev 4904)
+++ trunk/win/rfb_win32/MonitorInfo.cxx2012-04-26 09:04:14 UTC (rev 4905)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -80,7 +80,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
       return;
     }
   } catch (rdr::Exception&amp;amp; e) {
-    vlog.error(e.str());
+    vlog.error("%s", e.str());
   }
 #endif
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -106,7 +106,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
       return;
     }
   } catch (rdr::Exception&amp;amp; e) {
-    vlog.error(e.str());
+    vlog.error("%s", e.str());
   }
 #endif
 

Modified: trunk/win/rfb_win32/RegConfig.cxx
===================================================================
--- trunk/win/rfb_win32/RegConfig.cxx2012-04-26 08:51:19 UTC (rev 4904)
+++ trunk/win/rfb_win32/RegConfig.cxx2012-04-26 09:04:14 UTC (rev 4905)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -48,7 +48,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     processEvent(event);
     return true;
   } catch (rdr::Exception&amp;amp; e) {
-    vlog.debug(e.str());
+    vlog.debug("%s", e.str());
     return false;
   }
 }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -65,7 +65,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     }
   } catch (rdr::SystemException&amp;amp; e) {
     if (e.err != 6)
-      vlog.error(e.str());
+      vlog.error("%s", e.str());
   }
 }
 

Modified: trunk/win/rfb_win32/SDisplay.cxx
===================================================================
--- trunk/win/rfb_win32/SDisplay.cxx2012-04-26 08:51:19 UTC (rev 4904)
+++ trunk/win/rfb_win32/SDisplay.cxx2012-04-26 09:04:14 UTC (rev 4905)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -185,7 +185,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
       if (tryMethod == 0)
         throw rdr::Exception("unable to access desktop");
       tryMethod--;
-      vlog.error(e.str());
+      vlog.error("%s", e.str());
     }
   }
   vlog.info("Started %s", core-&amp;gt;methodName());
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -388,7 +388,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
       try {
         core-&amp;gt;flushUpdates();
       } catch (rdr::Exception&amp;amp; e) {
-        vlog.error(e.str());
+        vlog.error("%s", e.str());
         restartCore();
         return;
       }

Modified: trunk/win/rfb_win32/SocketManager.cxx
===================================================================
--- trunk/win/rfb_win32/SocketManager.cxx2012-04-26 08:51:19 UTC (rev 4904)
+++ trunk/win/rfb_win32/SocketManager.cxx2012-04-26 09:04:14 UTC (rev 4905)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -43,7 +43,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   if (WSAIoctl(sock_-&amp;gt;getFd(), SIO_ADDRESS_LIST_CHANGE, 0, 0, 0, 0, &amp;amp;dummy, 0, 0) == SOCKET_ERROR) {
     DWORD err = WSAGetLastError();
     if (err != WSAEWOULDBLOCK)
-      vlog.error("Unable to track address changes", err);
+      vlog.error("Unable to track address changes: 0x%08x", (unsigned)err);
   }
 }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -70,7 +70,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     if (event)
       WSACloseEvent(event);
     delete sock_;
-    vlog.error(e.str());
+    vlog.error("%s", e.str());
     throw;
   }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -204,7 +204,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
       if (WSAEventSelect(ci.sock-&amp;gt;getFd(), event, FD_READ | FD_CLOSE) == SOCKET_ERROR)
         throw rdr::SystemException("unable to re-enable WSAEventSelect:%u", WSAGetLastError());
     } catch (rdr::Exception&amp;amp; e) {
-      vlog.error(e.str());
+      vlog.error("%s", e.str());
       remSocket(ci.sock);
     }
   }

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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
&lt;/pre&gt;</description>
    <dc:creator>ossman_-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&lt; at &gt;public.gmane.org</dc:creator>
    <dc:date>2012-04-26T09:04:14</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1272">
    <title>SF.net SVN: tigervnc:[4904]trunk/common/rfb/LogWriter.h</title>
    <link>http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1272</link>
    <description>&lt;pre&gt;Revision: 4904
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4904&amp;amp;view=rev
Author:   ossman_
Date:     2012-04-26 08:51:19 +0000 (Thu, 26 Apr 2012)
Log Message:
-----------
Allow gcc to check for correct usage of the formatting string for the
logging class.

Modified Paths:
--------------
    trunk/common/rfb/LogWriter.h

Modified: trunk/common/rfb/LogWriter.h
===================================================================
--- trunk/common/rfb/LogWriter.h2012-04-26 04:33:11 UTC (rev 4903)
+++ trunk/common/rfb/LogWriter.h2012-04-26 08:51:19 UTC (rev 4904)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -25,12 +25,18 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 #include &amp;lt;rfb/Logger.h&amp;gt;
 #include &amp;lt;rfb/Configuration.h&amp;gt;
 
+#ifdef __GNUC__
+#  define __printf_attr(a, b) __attribute__((__format__ (__printf__, a, b)))
+#else
+#  define __printf_attr(a, b)
+#endif // __GNUC__
+
 // Each log writer instance has a unique textual name,
 // and is attached to a particular Log instance and
 // is assigned a particular log level.
 
 #define DEF_LOGFUNCTION(name, level) \
-  inline void name(const char* fmt, ...) { \
+  inline void name(const char* fmt, ...) __printf_attr(2, 3) { \
     if (m_log &amp;amp;&amp;amp; (level &amp;lt;= m_level)) {     \
       va_list ap; va_start(ap, fmt);       \
       m_log-&amp;gt;write(level, m_name, fmt, ap);\
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -53,7 +59,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     void setLevel(int level);
     int getLevel(void) { return m_level; }
 
-    inline void write(int level, const char* format, ...) {
+    inline void write(int level, const char* format, ...) __printf_attr(3, 4) {
       if (m_log &amp;amp;&amp;amp; (level &amp;lt;= m_level)) {
         va_list ap;
         va_start(ap, format);

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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
&lt;/pre&gt;</description>
    <dc:creator>ossman_-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&lt; at &gt;public.gmane.org</dc:creator>
    <dc:date>2012-04-26T08:51:20</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1271">
    <title>SF.net SVN: tigervnc:[4903] trunk/java/com/tigervnc/vncviewer/OptionsDialog .java</title>
    <link>http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1271</link>
    <description>&lt;pre&gt;Revision: 4903
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4903&amp;amp;view=rev
Author:   bphinz
Date:     2012-04-26 04:33:11 +0000 (Thu, 26 Apr 2012)
Log Message:
-----------
Fixed cut &amp;amp; paste error

Modified Paths:
--------------
    trunk/java/com/tigervnc/vncviewer/OptionsDialog.java

Modified: trunk/java/com/tigervnc/vncviewer/OptionsDialog.java
===================================================================
--- trunk/java/com/tigervnc/vncviewer/OptionsDialog.java2012-04-26 00:03:16 UTC (rev 4902)
+++ trunk/java/com/tigervnc/vncviewer/OptionsDialog.java2012-04-26 04:33:11 UTC (rev 4903)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -160,7 +160,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     scalingFactor = new JComboBox(scalingFactors);
     // Hack to set the left inset on editable JComboBox
     if (UIManager.getLookAndFeel().getID() == "Windows") {
-      scalingFactor.setBorder(BorderFactory.createCompoundBorder(compressLevel.getBorder(),
+      scalingFactor.setBorder(BorderFactory.createCompoundBorder(scalingFactor.getBorder(),
         BorderFactory.createEmptyBorder(0,1,0,0)));
     } else if (UIManager.getLookAndFeel().getID() == "Metal") {
       ComboBoxEditor sfe = scalingFactor.getEditor();

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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
&lt;/pre&gt;</description>
    <dc:creator>bphinz-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&lt; at &gt;public.gmane.org</dc:creator>
    <dc:date>2012-04-26T04:33:11</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1270">
    <title>SF.net SVN: tigervnc:[4902]trunk/java/com/tigervnc</title>
    <link>http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1270</link>
    <description>&lt;pre&gt;Revision: 4902
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4902&amp;amp;view=rev
Author:   bphinz
Date:     2012-04-26 00:03:16 +0000 (Thu, 26 Apr 2012)
Log Message:
-----------
Fix Socket methods for querying the socket endpoints. Fix the address displayed in the info dialog for redirected connections.

Modified Paths:
--------------
    trunk/java/com/tigervnc/network/Socket.java
    trunk/java/com/tigervnc/network/TcpSocket.java
    trunk/java/com/tigervnc/vncviewer/CConn.java

Modified: trunk/java/com/tigervnc/network/Socket.java
===================================================================
--- trunk/java/com/tigervnc/network/Socket.java2012-04-25 21:20:24 UTC (rev 4901)
+++ trunk/java/com/tigervnc/network/Socket.java2012-04-26 00:03:16 UTC (rev 4902)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -51,6 +51,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 
   // information about the remote end of the socket
   abstract public String getPeerAddress(); // a string e.g. "192.168.0.1"
+  abstract public String getPeerName(); 
   abstract public int getPeerPort();
   abstract public String getPeerEndpoint(); // &amp;lt;address&amp;gt;::&amp;lt;port&amp;gt;
 

Modified: trunk/java/com/tigervnc/network/TcpSocket.java
===================================================================
--- trunk/java/com/tigervnc/network/TcpSocket.java2012-04-25 21:20:24 UTC (rev 4901)
+++ trunk/java/com/tigervnc/network/TcpSocket.java2012-04-26 00:03:16 UTC (rev 4902)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -118,15 +118,22 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   }
 
   public String getPeerAddress() {
-    SocketAddress peer = ((SocketDescriptor)getFd()).socket().getRemoteSocketAddress();
+    InetAddress peer = ((SocketDescriptor)getFd()).socket().getInetAddress();
     if (peer != null)
-      return peer.toString();
+      return peer.getHostAddress();
     return "";
   }
 
+  public String getPeerName() {
+    InetAddress peer = ((SocketDescriptor)getFd()).socket().getInetAddress();
+    if (peer != null)
+      return peer.getHostName();
+    return "";
+  }
+
   public int getPeerPort() {
-    SocketAddress address = ((SocketDescriptor)getFd()).socket().getRemoteSocketAddress();
-    return ((InetSocketAddress)address).getPort();
+    int port = ((SocketDescriptor)getFd()).socket().getPort();
+    return port;
   }
 
   public String getPeerEndpoint() {

Modified: trunk/java/com/tigervnc/vncviewer/CConn.java
===================================================================
--- trunk/java/com/tigervnc/vncviewer/CConn.java2012-04-25 21:20:24 UTC (rev 4901)
+++ trunk/java/com/tigervnc/vncviewer/CConn.java2012-04-26 00:03:16 UTC (rev 4902)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -821,7 +821,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   void showInfo() {
     JOptionPane.showMessageDialog(viewport,
       "Desktop name: "+cp.name()+"\n"
-      +"Host: "+serverHost+":"+serverPort+"\n"
+      +"Host: "+sock.getPeerName()+":"+sock.getPeerPort()+"\n"
       +"Size: "+cp.width+"x"+cp.height+"\n"
       +"Pixel format: "+desktop.getPF().print()+"\n"
       +"(server default "+serverPF.print()+")\n"

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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
&lt;/pre&gt;</description>
    <dc:creator>bphinz-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&lt; at &gt;public.gmane.org</dc:creator>
    <dc:date>2012-04-26T00:03:17</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1269">
    <title>SF.net SVN: tigervnc:[4901]trunk/java/com/tigervnc/vncviewer</title>
    <link>http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1269</link>
    <description>&lt;pre&gt;Revision: 4901
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4901&amp;amp;view=rev
Author:   bphinz
Date:     2012-04-25 21:20:24 +0000 (Wed, 25 Apr 2012)
Log Message:
-----------
Remove hard-coded font names from UI settings.

Modified Paths:
--------------
    trunk/java/com/tigervnc/vncviewer/OptionsDialog.java
    trunk/java/com/tigervnc/vncviewer/VncViewer.java

Modified: trunk/java/com/tigervnc/vncviewer/OptionsDialog.java
===================================================================
--- trunk/java/com/tigervnc/vncviewer/OptionsDialog.java2012-04-25 15:43:56 UTC (rev 4900)
+++ trunk/java/com/tigervnc/vncviewer/OptionsDialog.java2012-04-25 21:20:24 UTC (rev 4901)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -105,7 +105,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     addGBComponent(customCompressLevel, tightPanel, 0, 0, 2, 1, 2, 2, 1, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.FIRST_LINE_START, new Insets(0,0,0,0));
     addGBComponent(compressLevel, tightPanel,       0, 1, 1, 1, 2, 2, 0, 0, GridBagConstraints.NONE, GridBagConstraints.FIRST_LINE_START, new Insets(0,20,0,0));
     addGBComponent(compressionLabel, tightPanel,    1, 1, 1, 1, 2, 2, 1, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.LINE_START, new Insets(0,5,0,0));
-    addGBComponent(noJpeg, tightPanel,              0, 2, 2, 1, 2, 2, 1, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.FIRST_LINE_START, new Insets(0,0,0,0));
+    addGBComponent(noJpeg, tightPanel,              0, 2, 2, 1, 2, 2, 1, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.FIRST_LINE_START, new Insets(4,0,0,0));
     addGBComponent(qualityLevel, tightPanel,        0, 3, 1, 1, 2, 2, 0, 0, GridBagConstraints.NONE, GridBagConstraints.FIRST_LINE_START, new Insets(0,20,0,0));
     addGBComponent(qualityLabel, tightPanel,        1, 3, 1, 1, 2, 2, 1, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.LINE_START, new Insets(0,5,0,0));
 

Modified: trunk/java/com/tigervnc/vncviewer/VncViewer.java
===================================================================
--- trunk/java/com/tigervnc/vncviewer/VncViewer.java2012-04-25 15:43:56 UTC (rev 4900)
+++ trunk/java/com/tigervnc/vncviewer/VncViewer.java2012-04-25 21:20:24 UTC (rev 4901)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -81,23 +81,25 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
       UIManager.put("TitledBorder.titleColor",Color.blue);
       if (UIManager.getLookAndFeel().getName().equals("Metal")) {
         UIManager.put("swing.boldMetal", Boolean.FALSE);
-        FontUIResource f = new FontUIResource("SansSerif", Font.PLAIN, 11);
         java.util.Enumeration keys = UIManager.getDefaults().keys();
         while (keys.hasMoreElements()) {
           Object key = keys.nextElement();
           Object value = UIManager.get(key);
-          if (value instanceof javax.swing.plaf.FontUIResource)
+          if (value instanceof FontUIResource) {
+            String name = ((FontUIResource)value).getName();
+            int style = ((FontUIResource)value).getStyle();
+            int size = ((FontUIResource)value).getSize()-1;
+            FontUIResource f = new FontUIResource(name, style, size);
             UIManager.put(key, f);
+          }
         }
       } else if (UIManager.getLookAndFeel().getName().equals("Nimbus")) {
-        FontUIResource f;
-        String os = System.getProperty("os.name");
-        if (os.startsWith("Windows")) {
-          f = new FontUIResource("Verdana", 0, 11);
-        } else {
-          f = new FontUIResource("DejaVu Sans", 0, 11);
-        }
-      UIManager.put("TitledBorder.font", f);
+        Font f = UIManager.getFont("TitledBorder.font");
+        String name = f.getName();
+        int style = f.getStyle();
+        int size = f.getSize()-2;
+        FontUIResource r = new FontUIResource(name, style, size);
+      UIManager.put("TitledBorder.font", r);
       }
     } catch (java.lang.Exception e) { 
       vlog.info(e.toString());

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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
&lt;/pre&gt;</description>
    <dc:creator>bphinz-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&lt; at &gt;public.gmane.org</dc:creator>
    <dc:date>2012-04-25T21:20:24</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1268">
    <title>SF.net SVN: tigervnc:[4900] trunk/vncviewer</title>
    <link>http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1268</link>
    <description>&lt;pre&gt;Revision: 4900
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4900&amp;amp;view=rev
Author:   ossman_
Date:     2012-04-25 15:43:56 +0000 (Wed, 25 Apr 2012)
Log Message:
-----------
Make sure we're paranoid about accidentally feeding a format string.
Basic patch by Joachim Falk. Slightly improved before commit.

Modified Paths:
--------------
    trunk/vncviewer/CConn.cxx
    trunk/vncviewer/UserDialog.cxx
    trunk/vncviewer/Viewport.cxx
    trunk/vncviewer/vncviewer.cxx

Modified: trunk/vncviewer/CConn.cxx
===================================================================
--- trunk/vncviewer/CConn.cxx2012-04-25 15:10:38 UTC (rev 4899)
+++ trunk/vncviewer/CConn.cxx2012-04-25 15:43:56 UTC (rev 4900)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -100,7 +100,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     vlog.info(_("connected to host %s port %d"), serverHost, serverPort);
   } catch (rdr::Exception&amp;amp; e) {
     vlog.error(e.str());
-    fl_alert(e.str());
+    fl_alert("%s", e.str());
     exit_vncviewer();
     return;
   }

Modified: trunk/vncviewer/UserDialog.cxx
===================================================================
--- trunk/vncviewer/UserDialog.cxx2012-04-25 15:10:38 UTC (rev 4899)
+++ trunk/vncviewer/UserDialog.cxx2012-04-25 15:43:56 UTC (rev 4900)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -150,22 +150,20 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   // FLTK doesn't give us a flexible choice of the icon, so we ignore those
   // bits for now.
 
-  // FIXME: Filter out % from input text
-
   fl_message_title(title);
 
   switch (flags &amp;amp; 0xf) {
   case M_OKCANCEL:
-    return fl_choice(buffer, NULL, fl_ok, fl_cancel) == 1;
+    return fl_choice("%s", NULL, fl_ok, fl_cancel, buffer) == 1;
   case M_YESNO:
-    return fl_choice(buffer, NULL, fl_yes, fl_no) == 1;
+    return fl_choice("%s", NULL, fl_yes, fl_no, buffer) == 1;
   case M_OK:
   default:
     if (((flags &amp;amp; 0xf0) == M_ICONERROR) ||
         ((flags &amp;amp; 0xf0) == M_ICONWARNING))
-      fl_alert(buffer);
+      fl_alert("%s", buffer);
     else
-      fl_message(buffer);
+      fl_message("%s", buffer);
     return true;
   }
 

Modified: trunk/vncviewer/Viewport.cxx
===================================================================
--- trunk/vncviewer/Viewport.cxx2012-04-25 15:10:38 UTC (rev 4899)
+++ trunk/vncviewer/Viewport.cxx2012-04-25 15:43:56 UTC (rev 4900)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -950,7 +950,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   case ID_INFO:
     if (fltk_escape(cc-&amp;gt;connectionInfo(), buffer, sizeof(buffer)) &amp;lt; sizeof(buffer)) {
       fl_message_title(_("VNC connection info"));
-      fl_message(buffer);
+      fl_message("%s", buffer);
     }
     break;
   case ID_ABOUT:

Modified: trunk/vncviewer/vncviewer.cxx
===================================================================
--- trunk/vncviewer/vncviewer.cxx2012-04-25 15:10:38 UTC (rev 4899)
+++ trunk/vncviewer/vncviewer.cxx2012-04-25 15:43:56 UTC (rev 4900)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -69,7 +69,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 using namespace rfb;
 using namespace std;
 
-static char aboutText[1024];
+static const char aboutText[] = N_("TigerVNC Viewer %d-bit v%s (%s)\n"
+                                   "%s\n"
+                                   "Copyright (C) 1999-2011 TigerVNC Team and many others (see README.txt)\n"
+                                   "See http://www.tigervnc.org for information on TigerVNC.");
 extern const char* buildTime;
 
 static bool exitMainloop = false;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -88,7 +91,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 void about_vncviewer()
 {
   fl_message_title(_("About TigerVNC Viewer"));
-  fl_message(aboutText);
+  fl_message(gettext(aboutText), (int)sizeof(size_t)*8,
+             PACKAGE_VERSION, __BUILD__, buildTime);
 }
 
 static void about_callback(Fl_Widget *widget, void *data)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -267,11 +271,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   const char* vncServerName = NULL;
   UserDialog dlg;
 
-  const char englishAbout[] = N_("TigerVNC Viewer %d-bit v%s (%s)\n"
-                                 "%s\n"
-                                 "Copyright (C) 1999-2011 TigerVNC Team and many others (see README.txt)\n"
-                                 "See http://www.tigervnc.org for information on TigerVNC.");
-
   setlocale(LC_ALL, "");
   bindtextdomain(PACKAGE_NAME, LOCALE_DIR);
   textdomain(PACKAGE_NAME);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -279,10 +278,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   rfb::SecurityClient::setDefaults();
 
   // Write about text to console, still using normal locale codeset
-  snprintf(aboutText, sizeof(aboutText),
-           gettext(englishAbout), (int)sizeof(size_t)*8, PACKAGE_VERSION,
-           __BUILD__, buildTime);
-  fprintf(stderr,"\n%s\n", aboutText);
+  fprintf(stderr,"\n");
+  fprintf(stderr, gettext(aboutText), (int)sizeof(size_t)*8,
+          PACKAGE_VERSION, __BUILD__, buildTime);
+  fprintf(stderr,"\n");
 
   // Set gettext codeset to what our GUI toolkit uses. Since we are
   // passing strings from strerror/gai_strerror to the GUI, these must
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -290,11 +289,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   bind_textdomain_codeset(PACKAGE_NAME, "UTF-8");
   bind_textdomain_codeset("libc", "UTF-8");
 
-  // Re-create the aboutText for the GUI, now using GUI codeset
-  snprintf(aboutText, sizeof(aboutText),
-           gettext(englishAbout), (int)sizeof(size_t)*8, PACKAGE_VERSION,
-           __BUILD__, buildTime);
-
   rfb::initStdIOLoggers();
   rfb::LogWriter::setLogParams("*:stderr:30");
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -376,7 +370,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   delete cc;
 
   if (exitError != NULL)
-    fl_alert(exitError);
+    fl_alert("%s", exitError);
 
   return 0;
 }

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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
&lt;/pre&gt;</description>
    <dc:creator>ossman_-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&lt; at &gt;public.gmane.org</dc:creator>
    <dc:date>2012-04-25T15:43:56</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1267">
    <title>SF.net SVN: tigervnc:[4899]trunk/unix/xserver/hw/vnc/Makefile.am</title>
    <link>http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1267</link>
    <description>&lt;pre&gt;Revision: 4899
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4899&amp;amp;view=rev
Author:   ossman_
Date:     2012-04-25 15:10:38 +0000 (Wed, 25 Apr 2012)
Log Message:
-----------
The reformatting of all the Xserver sources in the 1.12.1 release changed
the headers so now some of them have multiple instances of the C++ "and"
and "xor" keywords on the same line, so the hack to sanitize them needs
to use the sed "g" flag to replace all instances, not just the first.

Otherwise, the build fails with strange errors such as:

"fb.h", line 817: Error: Unexpected type name "FbBits" encountered.
"fb.h", line 817: Error: dst is not defined.
"fb.h", line 818: Error: Unexpected type name "FbStride" encountered.
"fb.h", line 818: Error: dstStride is not defined.
"fb.h", line 819: Error: Badly formed expression.

Signed-off-by: Alan Coopersmith &amp;lt;alan.coopersmith-QHcLZuEGTsvQT0dZR+AlfA&amp;lt; at &amp;gt;public.gmane.org&amp;gt;

Modified Paths:
--------------
    trunk/unix/xserver/hw/vnc/Makefile.am

Modified: trunk/unix/xserver/hw/vnc/Makefile.am
===================================================================
--- trunk/unix/xserver/hw/vnc/Makefile.am2012-04-25 14:57:22 UTC (rev 4898)
+++ trunk/unix/xserver/hw/vnc/Makefile.am2012-04-25 15:10:38 UTC (rev 4899)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -63,7 +63,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 BUILT_SOURCES = $(nodist_Xvnc_SOURCES)
 
 fb.h: $(top_srcdir)/fb/fb.h
-cat $(top_srcdir)/fb/fb.h | sed -e 's,and,c_and,' -e 's,xor,c_xor,' &amp;gt; $(srcdir)/fb.h
+cat $(top_srcdir)/fb/fb.h | sed -e 's,and,c_and,g' -e 's,xor,c_xor,g' &amp;gt; $(srcdir)/fb.h
 
 pixman.h:
 for i in ${XSERVERLIBS_CFLAGS}; do \
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -78,4 +78,4 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 fi
 
 fbrop.h: $(top_srcdir)/fb/fbrop.h
-cat $(top_srcdir)/fb/fbrop.h | sed -e 's,and,c_and,' -e 's,xor,c_xor,' &amp;gt; $(srcdir)/fbrop.h
+cat $(top_srcdir)/fb/fbrop.h | sed -e 's,and,c_and,g' -e 's,xor,c_xor,g' &amp;gt; $(srcdir)/fbrop.h

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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
&lt;/pre&gt;</description>
    <dc:creator>ossman_-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&lt; at &gt;public.gmane.org</dc:creator>
    <dc:date>2012-04-25T15:10:38</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1266">
    <title>SF.net SVN: tigervnc:[4898] trunk/common/fltk</title>
    <link>http://comments.gmane.org/gmane.network.vnc.tigervnc.scm/1266</link>
    <description>&lt;pre&gt;Revision: 4898
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4898&amp;amp;view=rev
Author:   ossman_
Date:     2012-04-25 14:57:22 +0000 (Wed, 25 Apr 2012)
Log Message:
-----------
Proper support for icons in FLTK (upstream STR 2816).

Modified Paths:
--------------
    trunk/common/fltk/FL/Fl_Window.H
    trunk/common/fltk/FL/mac.H
    trunk/common/fltk/FL/win32.H
    trunk/common/fltk/FL/x.H
    trunk/common/fltk/src/Fl.cxx
    trunk/common/fltk/src/Fl_Window.cxx
    trunk/common/fltk/src/Fl_win32.cxx
    trunk/common/fltk/src/Fl_x.cxx

Modified: trunk/common/fltk/FL/Fl_Window.H
===================================================================
--- trunk/common/fltk/FL/Fl_Window.H2012-04-25 14:54:04 UTC (rev 4897)
+++ trunk/common/fltk/FL/Fl_Window.H2012-04-25 14:57:22 UTC (rev 4898)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -31,6 +31,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 #ifndef Fl_Window_H
 #define Fl_Window_H
 
+#ifdef WIN32
+#include &amp;lt;windows.h&amp;gt;
+#endif
+
 #include "Fl_Group.H"
 
 #define FL_WINDOW 0xF0///&amp;lt; window type id all subclasses have type() &amp;gt;= this
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -63,9 +67,19 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   friend class Fl_X;
   Fl_X *i; // points at the system-specific stuff
 
+  struct icon_data {
+    const void *legacy_icon;
+    Fl_RGB_Image **icons;
+    int count;
+#ifdef WIN32
+    HICON big_icon;
+    HICON small_icon;
+#endif
+  };
+
   const char* iconlabel_;
   char* xclass_;
-  const void* icon_;
+  struct icon_data *icon_;
   // size_range stuff:
   int minw, minh, maxw, maxh;
   int dw, dh, aspect;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -110,6 +124,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   */
   int force_position() const { return ((flags() &amp;amp; FORCE_POSITION)?1:0); }
 
+  void free_icons();
+
 public:
 
   /**
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -331,6 +347,18 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   static const char *default_xclass();
   const char* xclass() const;
   void xclass(const char* c);
+
+  static void default_icon(const Fl_RGB_Image*);
+  static void default_icons(const Fl_RGB_Image*[], int);
+  void icon(const Fl_RGB_Image*);
+  void icons(const Fl_RGB_Image*[], int);
+
+#ifdef WIN32
+  static void default_icons(HICON big_icon, HICON small_icon);
+  void icons(HICON big_icon, HICON small_icon);
+#endif
+
+  /* for legacy compatibility */
   const void* icon() const;
   void icon(const void * ic);
 

Modified: trunk/common/fltk/FL/mac.H
===================================================================
--- trunk/common/fltk/FL/mac.H2012-04-25 14:54:04 UTC (rev 4897)
+++ trunk/common/fltk/FL/mac.H2012-04-25 14:57:22 UTC (rev 4898)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -141,6 +141,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   void collapse(void);
   WindowRef window_ref(void);
   void set_key_window(void);
+  // OS X doesn't have per window icons
+  static void set_default_icons(const Fl_RGB_Image*[], int) {};
+  void set_icons() {};
   int set_cursor(Fl_Cursor);
   int set_cursor(const Fl_RGB_Image*, int, int);
   static CGImageRef CGImage_from_window_rect(Fl_Window *win, int x, int y, int w, int h);

Modified: trunk/common/fltk/FL/win32.H
===================================================================
--- trunk/common/fltk/FL/win32.H2012-04-25 14:54:04 UTC (rev 4897)
+++ trunk/common/fltk/FL/win32.H2012-04-25 14:57:22 UTC (rev 4898)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -93,6 +93,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   void flush() {w-&amp;gt;flush();}
   void set_minmax(LPMINMAXINFO minmax);
   void mapraise();
+  static void set_default_icons(const Fl_RGB_Image*[], int);
+  static void set_default_icons(HICON, HICON);
+  void set_icons();
   int set_cursor(Fl_Cursor);
   int set_cursor(const Fl_RGB_Image*, int, int);
   static Fl_X* make(Fl_Window*);

Modified: trunk/common/fltk/FL/x.H
===================================================================
--- trunk/common/fltk/FL/x.H2012-04-25 14:54:04 UTC (rev 4897)
+++ trunk/common/fltk/FL/x.H2012-04-25 14:57:22 UTC (rev 4898)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -163,6 +163,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   static Fl_X* i(const Fl_Window* wi) {return wi-&amp;gt;i;}
   void setwindow(Fl_Window* wi) {w=wi; wi-&amp;gt;i=this;}
   void sendxjunk();
+  static void set_default_icons(const Fl_RGB_Image*[], int);
+  void set_icons();
   int set_cursor(Fl_Cursor);
   int set_cursor(const Fl_RGB_Image*, int, int);
   static void make_xid(Fl_Window*,XVisualInfo* =fl_visual, Colormap=fl_colormap);

Modified: trunk/common/fltk/src/Fl.cxx
===================================================================
--- trunk/common/fltk/src/Fl.cxx2012-04-25 14:54:04 UTC (rev 4897)
+++ trunk/common/fltk/src/Fl.cxx2012-04-25 14:57:22 UTC (rev 4898)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1535,6 +1535,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   if (xclass_) {
     free(xclass_);
   }
+  free_icons();
+  delete icon_;
 }
 
 // FL_SHOW and FL_HIDE are called whenever the visibility of this widget

Modified: trunk/common/fltk/src/Fl_Window.cxx
===================================================================
--- trunk/common/fltk/src/Fl_Window.cxx2012-04-25 14:54:04 UTC (rev 4897)
+++ trunk/common/fltk/src/Fl_Window.cxx2012-04-25 14:57:22 UTC (rev 4898)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -32,6 +32,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 #include &amp;lt;config.h&amp;gt;
 #include &amp;lt;FL/Fl.H&amp;gt;
 #include &amp;lt;FL/x.H&amp;gt;
+#include &amp;lt;FL/Fl_RGB_Image.H&amp;gt;
 #include &amp;lt;FL/Fl_Window.H&amp;gt;
 #include &amp;lt;stdlib.h&amp;gt;
 #include "flstring.h"
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -54,7 +55,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   }
   i = 0;
   xclass_ = 0;
-  icon_ = 0;
+  icon_ = new icon_data;
+  memset(icon_, 0, sizeof(*icon_));
   iconlabel_ = 0;
   resizable(0);
   size_range_set = 0;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -277,17 +279,69 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   }
 }
 
+void Fl_Window::default_icon(const Fl_RGB_Image *icon) {
+  default_icons(&amp;amp;icon, 1);
+}
+
+void Fl_Window::default_icons(const Fl_RGB_Image **icons, int count) {
+  Fl_X::set_default_icons(icons, count);
+}
+
+void Fl_Window::icon(const Fl_RGB_Image *icon) {
+  icons(&amp;amp;icon, 1);
+}
+
+void Fl_Window::icons(const Fl_RGB_Image **icons, int count) {
+  free_icons();
+
+  if (count &amp;gt; 0) {
+    icon_-&amp;gt;icons = new Fl_RGB_Image*[count];
+    icon_-&amp;gt;count = count;
+    // FIXME: Fl_RGB_Image lacks const modifiers on methods
+    for (int i = 0;i &amp;lt; count;i++)
+      icon_-&amp;gt;icons[i] = (Fl_RGB_Image*)((Fl_RGB_Image*)icons[i])-&amp;gt;copy();
+  }
+
+  if (i)
+    i-&amp;gt;set_icons();
+}
+
 /** Gets the current icon window target dependent data. */
 const void *Fl_Window::icon() const {
-  return icon_;
+  return icon_-&amp;gt;legacy_icon;
 }
 
 /** Sets the current icon window target dependent data. */
 void Fl_Window::icon(const void * ic) {
-  icon_ = ic;
+  free_icons();
+  icon_-&amp;gt;legacy_icon = ic;
 }
 
+void Fl_Window::free_icons() {
+  int i;
 
+  icon_-&amp;gt;legacy_icon = 0L;
+
+  if (icon_-&amp;gt;icons) {
+    for (i = 0;i &amp;lt; icon_-&amp;gt;count;i++)
+      delete icon_-&amp;gt;icons[i];
+    delete [] icon_-&amp;gt;icons;
+    icon_-&amp;gt;icons = 0L;
+  }
+
+  icon_-&amp;gt;count = 0;
+
+#ifdef WIN32
+  if (icon_-&amp;gt;big_icon)
+    DestroyIcon(icon_-&amp;gt;big_icon);
+  if (icon_-&amp;gt;small_icon)
+    DestroyIcon(icon_-&amp;gt;small_icon);
+
+  icon_-&amp;gt;big_icon = NULL;
+  icon_-&amp;gt;small_icon = NULL;
+#endif
+}
+
 //
 // End of "$Id: Fl_Window.cxx 8472 2011-02-25 08:44:47Z AlbrechtS $".
 //

Modified: trunk/common/fltk/src/Fl_win32.cxx
===================================================================
--- trunk/common/fltk/src/Fl_win32.cxx2012-04-25 14:54:04 UTC (rev 4897)
+++ trunk/common/fltk/src/Fl_win32.cxx2012-04-25 14:57:22 UTC (rev 4898)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1802,6 +1802,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   );
   if (lab) free(lab);
 
+  x-&amp;gt;set_icons();
+
   if (w-&amp;gt;flags() &amp;amp; Fl_Widget::FULLSCREEN) {
   /* We need to make sure that the fullscreen is created on the
      default monitor, ie the desktop where the shortcut is located
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2028,71 +2030,19 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 
 ////////////////////////////////////////////////////////////////
 
-#ifndef IDC_HAND
-#  define IDC_HAND  MAKEINTRESOURCE(32649)
-#endif // !IDC_HAND
-
-int Fl_X::set_cursor(Fl_Cursor c) {
-  LPSTR n;
-  HCURSOR new_cursor;
-
-  if (c == FL_CURSOR_NONE)
-    new_cursor = NULL;
-  else {
-    switch (c) {
-    case FL_CURSOR_ARROW:   n = IDC_ARROW; break;
-    case FL_CURSOR_CROSS:   n = IDC_CROSS; break;
-    case FL_CURSOR_WAIT:    n = IDC_WAIT; break;
-    case FL_CURSOR_INSERT:  n = IDC_IBEAM; break;
-    case FL_CURSOR_HAND:    n = IDC_HAND; break;
-    case FL_CURSOR_HELP:    n = IDC_HELP; break;
-    case FL_CURSOR_MOVE:    n = IDC_SIZEALL; break;
-    case FL_CURSOR_N:
-    case FL_CURSOR_S:
-      // FIXME: Should probably have fallbacks for these instead
-    case FL_CURSOR_NS:      n = IDC_SIZENS; break;
-    case FL_CURSOR_NE:
-    case FL_CURSOR_SW:
-      // FIXME: Dito.
-    case FL_CURSOR_NESW:    n = IDC_SIZENESW; break;
-    case FL_CURSOR_E:
-    case FL_CURSOR_W:
-      // FIXME: Dito.
-    case FL_CURSOR_WE:      n = IDC_SIZEWE; break;
-    case FL_CURSOR_SE:
-    case FL_CURSOR_NW:
-      // FIXME: Dito.
-    case FL_CURSOR_NWSE:    n = IDC_SIZENWSE; break;
-    default:
-      return 0;
-    }
-
-    new_cursor = LoadCursor(NULL, n);
-    if (new_cursor == NULL)
-      return 0;
-  }
-
-  if ((cursor != NULL) &amp;amp;&amp;amp; custom_cursor)
-    DestroyIcon(cursor);
-
-  cursor = new_cursor;
-  custom_cursor = 0;
-
-  SetCursor(cursor);
-
-  return 1;
-}
-
-int Fl_X::set_cursor(const Fl_RGB_Image *image, int hotx, int hoty) {
+static HICON image_to_icon(const Fl_RGB_Image *image, bool is_icon=true,
+                           int hotx = 0, int hoty = 0) {
   BITMAPV5HEADER bi;
   HBITMAP bitmap, mask;
   DWORD *bits;
-  HCURSOR new_cursor;
+  HICON icon;
 
-  if ((hotx &amp;lt; 0) || (hotx &amp;gt;= image-&amp;gt;w()))
-    return 0;
-  if ((hoty &amp;lt; 0) || (hoty &amp;gt;= image-&amp;gt;h()))
-    return 0;
+  if (!is_icon) {
+    if ((hotx &amp;lt; 0) || (hotx &amp;gt;= image-&amp;gt;w()))
+      return NULL;
+    if ((hoty &amp;lt; 0) || (hoty &amp;gt;= image-&amp;gt;h()))
+      return NULL;
+  }
 
   memset(&amp;amp;bi, 0, sizeof(BITMAPV5HEADER));
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2114,7 +2064,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   ReleaseDC(NULL, hdc);
 
   if (bits == NULL)
-    return 0;
+    return NULL;
 
   const uchar *i = (const uchar*)*image-&amp;gt;data();
   for (int y = 0;y &amp;lt; image-&amp;gt;h();y++) {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2143,22 +2093,206 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   mask = CreateBitmap(image-&amp;gt;w(),image-&amp;gt;h(),1,1,NULL);
   if (mask == NULL) {
     DeleteObject(bitmap);
-    return 0;
+    return NULL;
   }
 
   ICONINFO ii;
 
-  ii.fIcon    = FALSE;
+  ii.fIcon    = is_icon;
   ii.xHotspot = hotx;
   ii.yHotspot = hoty;
   ii.hbmMask  = mask;
   ii.hbmColor = bitmap;
 
-  new_cursor = CreateIconIndirect(&amp;amp;ii);
+  icon = CreateIconIndirect(&amp;amp;ii);
 
   DeleteObject(bitmap);
   DeleteObject(mask);
 
+  if (icon == NULL)
+    return NULL;
+
+  return icon;
+}
+
+////////////////////////////////////////////////////////////////
+
+static HICON default_big_icon = NULL;
+static HICON default_small_icon = NULL;
+
+const Fl_RGB_Image *find_best_icon(int ideal_width, 
+                                   const Fl_RGB_Image *icons[], int count) {
+  const Fl_RGB_Image *best;
+
+  best = NULL;
+
+  for (int i = 0;i &amp;lt; count;i++) {
+    if (best == NULL)
+      best = icons[i];
+    else {
+      if (best-&amp;gt;w() &amp;lt; ideal_width) {
+        if (icons[i]-&amp;gt;w() &amp;gt; best-&amp;gt;w())
+          best = icons[i];
+      } else {
+        if ((icons[i]-&amp;gt;w() &amp;gt;= ideal_width) &amp;amp;&amp;amp;
+            (icons[i]-&amp;gt;w() &amp;lt; best-&amp;gt;w()))
+          best = icons[i];
+      }
+    }
+  }
+
+  return best;
+}
+
+void Fl_X::set_default_icons(const Fl_RGB_Image *icons[], int count) {
+  const Fl_RGB_Image *best_big, *best_small;
+
+  if (default_big_icon != NULL)
+    DestroyIcon(default_big_icon);
+  if (default_small_icon != NULL)
+    DestroyIcon(default_small_icon);
+
+  best_big = find_best_icon(GetSystemMetrics(SM_CXICON), icons, count);
+  best_small = find_best_icon(GetSystemMetrics(SM_CXSMICON), icons, count);
+
+  if (best_big != NULL)
+    default_big_icon = image_to_icon(best_big);
+  else
+    default_big_icon = NULL;
+
+  if (best_small != NULL)
+    default_small_icon = image_to_icon(best_small);
+  else
+    default_small_icon = NULL;
+}
+
+void Fl_X::set_default_icons(HICON big_icon, HICON small_icon) {
+  if (default_big_icon != NULL)
+    DestroyIcon(default_big_icon);
+  if (default_small_icon != NULL)
+    DestroyIcon(default_small_icon);
+
+  if (big_icon != NULL)
+    default_big_icon = CopyIcon(big_icon);
+  if (small_icon != NULL)
+    default_small_icon = CopyIcon(small_icon);
+}
+
+void Fl_X::set_icons() {
+  HICON big_icon, small_icon;
+
+  big_icon = NULL;
+  small_icon = NULL;
+
+  if (w-&amp;gt;icon_-&amp;gt;count) {
+    const Fl_RGB_Image *best_big, *best_small;
+
+    best_big = find_best_icon(GetSystemMetrics(SM_CXICON),
+                              (const Fl_RGB_Image **)w-&amp;gt;icon_-&amp;gt;icons,
+                              w-&amp;gt;icon_-&amp;gt;count);
+    best_small = find_best_icon(GetSystemMetrics(SM_CXSMICON),
+                                (const Fl_RGB_Image **)w-&amp;gt;icon_-&amp;gt;icons,
+                                w-&amp;gt;icon_-&amp;gt;count);
+
+    if (best_big != NULL)
+      big_icon = image_to_icon(best_big);
+    if (best_small != NULL)
+      small_icon = image_to_icon(best_small);
+  } else {
+    big_icon = default_big_icon;
+    small_icon = default_small_icon;
+  }
+
+  if (big_icon != NULL)
+    SendMessage(xid, WM_SETICON, ICON_BIG, (LPARAM)big_icon);
+  if (small_icon != NULL)
+    SendMessage(xid, WM_SETICON, ICON_SMALL, (LPARAM)small_icon);
+
+  if (w-&amp;gt;icon_-&amp;gt;count) {
+    if (big_icon != NULL)
+      DestroyIcon(big_icon);
+    if (small_icon != NULL)
+      DestroyIcon(small_icon);
+  }
+}
+
+void Fl_Window::default_icons(HICON big_icon, HICON small_icon) {
+  Fl_X::set_default_icons(big_icon, small_icon);
+}
+
+void Fl_Window::icons(HICON big_icon, HICON small_icon) {
+  free_icons();
+
+  if (big_icon != NULL)
+    icon_-&amp;gt;big_icon = CopyIcon(big_icon);
+  if (small_icon != NULL)
+    icon_-&amp;gt;small_icon = CopyIcon(small_icon);
+
+  if (i)
+    i-&amp;gt;set_icons();
+}
+
+////////////////////////////////////////////////////////////////
+
+#ifndef IDC_HAND
+#  define IDC_HAND  MAKEINTRESOURCE(32649)
+#endif // !IDC_HAND
+
+int Fl_X::set_cursor(Fl_Cursor c) {
+  LPSTR n;
+  HCURSOR new_cursor;
+
+  if (c == FL_CURSOR_NONE)
+    new_cursor = NULL;
+  else {
+    switch (c) {
+    case FL_CURSOR_ARROW:   n = IDC_ARROW; break;
+    case FL_CURSOR_CROSS:   n = IDC_CROSS; break;
+    case FL_CURSOR_WAIT:    n = IDC_WAIT; break;
+    case FL_CURSOR_INSERT:  n = IDC_IBEAM; break;
+    case FL_CURSOR_HAND:    n = IDC_HAND; break;
+    case FL_CURSOR_HELP:    n = IDC_HELP; break;
+    case FL_CURSOR_MOVE:    n = IDC_SIZEALL; break;
+    case FL_CURSOR_N:
+    case FL_CURSOR_S:
+      // FIXME: Should probably have fallbacks for these instead
+    case FL_CURSOR_NS:      n = IDC_SIZENS; break;
+    case FL_CURSOR_NE:
+    case FL_CURSOR_SW:
+      // FIXME: Dito.
+    case FL_CURSOR_NESW:    n = IDC_SIZENESW; break;
+    case FL_CURSOR_E:
+    case FL_CURSOR_W:
+      // FIXME: Dito.
+    case FL_CURSOR_WE:      n = IDC_SIZEWE; break;
+    case FL_CURSOR_SE:
+    case FL_CURSOR_NW:
+      // FIXME: Dito.
+    case FL_CURSOR_NWSE:    n = IDC_SIZENWSE; break;
+    default:
+      return 0;
+    }
+
+    new_cursor = LoadCursor(NULL, n);
+    if (new_cursor == NULL)
+      return 0;
+  }
+
+  if ((cursor != NULL) &amp;amp;&amp;amp; custom_cursor)
+    DestroyIcon(cursor);
+
+  cursor = new_cursor;
+  custom_cursor = 0;
+
+  SetCursor(cursor);
+
+  return 1;
+}
+
+int Fl_X::set_cursor(const Fl_RGB_Image *image, int hotx, int hoty) {
+  HCURSOR new_cursor;
+
+  new_cursor = image_to_icon(image, false, hotx, hoty);
   if (new_cursor == NULL)
     return 0;
 

Modified: trunk/common/fltk/src/Fl_x.cxx
===================================================================
--- trunk/common/fltk/src/Fl_x.cxx2012-04-25 14:54:04 UTC (rev 4897)
+++ trunk/common/fltk/src/Fl_x.cxx2012-04-25 14:57:22 UTC (rev 4898)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -346,6 +346,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 Atom fl_NET_SUPPORTING_WM_CHECK;
 Atom fl_NET_WM_STATE;
 Atom fl_NET_WM_STATE_FULLSCREEN;
+Atom fl_NET_WM_ICON;
 
 /*
   X defines 32-bit-entities to have a format value of max. 32,
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -708,6 +709,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   fl_NET_SUPPORTING_WM_CHECK = XInternAtom(d, "_NET_SUPPORTING_WM_CHECK", 0);
   fl_NET_WM_STATE       = XInternAtom(d, "_NET_WM_STATE",       0);
   fl_NET_WM_STATE_FULLSCREEN = XInternAtom(d, "_NET_WM_STATE_FULLSCREEN", 0);
+  fl_NET_WM_ICON        = XInternAtom(d, "_NET_WM_ICON",        0);
 
   if (sizeof(Atom) &amp;lt; 4)
     atom_bits = sizeof(Atom) * 8;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2095,12 +2097,14 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
       fl_show_iconic = 0;
       showit = 0;
     }
-    if (win-&amp;gt;icon()) {
-      hints-&amp;gt;icon_pixmap = (Pixmap)win-&amp;gt;icon();
+    if (win-&amp;gt;icon_-&amp;gt;legacy_icon) {
+      hints-&amp;gt;icon_pixmap = (Pixmap)win-&amp;gt;icon_-&amp;gt;legacy_icon;
       hints-&amp;gt;flags       |= IconPixmapHint;
     }
     XSetWMHints(fl_display, xp-&amp;gt;xid, hints);
     XFree(hints);
+
+    xp-&amp;gt;set_icons();
   }
 
   // set the window type for menu and tooltip windows to avoid animations (compiz)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2220,6 +2224,93 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 
 ////////////////////////////////////////////////////////////////
 
+static unsigned long *default_net_wm_icons = 0L;
+static size_t default_net_wm_icons_size = 0;
+
+void icons_to_property(const Fl_RGB_Image *icons[], int count,
+                       unsigned long **property, size_t *len) {
+  size_t sz;
+  unsigned long *data;
+
+  sz = 0;
+  for (int i = 0;i &amp;lt; count;i++)
+    sz += 2 + icons[i]-&amp;gt;w() * icons[i]-&amp;gt;h();
+
+  // FIXME: Might want to sort the icons
+
+  *property = data = new unsigned long[sz];
+  *len = sz;
+
+  for (int i = 0;i &amp;lt; count;i++) {
+    const Fl_RGB_Image *image;
+
+    image = icons[i];
+
+    data[0] = image-&amp;gt;w();
+    data[1] = image-&amp;gt;h();
+    data += 2;
+
+    const uchar *in = (const uchar*)*image-&amp;gt;data();
+    for (int y = 0;y &amp;lt; image-&amp;gt;h();y++) {
+      for (int x = 0;x &amp;lt; image-&amp;gt;w();x++) {
+        switch (image-&amp;gt;d()) {
+        case 1:
+          *data = ( 0xff&amp;lt;&amp;lt;24) | (in[0]&amp;lt;&amp;lt;16) | (in[0]&amp;lt;&amp;lt;8) | in[0];
+          break;
+        case 2:
+          *data = (in[1]&amp;lt;&amp;lt;24) | (in[0]&amp;lt;&amp;lt;16) | (in[0]&amp;lt;&amp;lt;8) | in[0];
+          break;
+        case 3:
+          *data = ( 0xff&amp;lt;&amp;lt;24) | (in[0]&amp;lt;&amp;lt;16) | (in[1]&amp;lt;&amp;lt;8) | in[2];
+          break;
+        case 4:
+          *data = (in[3]&amp;lt;&amp;lt;24) | (in[0]&amp;lt;&amp;lt;16) | (in[1]&amp;lt;&amp;lt;8) | in[2];
+          break;
+        }
+        in += image-&amp;gt;d();
+        data++;
+      }
+      in += image-&amp;gt;ld();
+    }
+  }
+}
+
+void Fl_X::set_default_icons(const Fl_RGB_Image *icons[], int count) {
+  if (default_net_wm_icons) {
+    delete [] default_net_wm_icons;
+    default_net_wm_icons = 0L;
+    default_net_wm_icons_size = 0;
+  }
+
+  if (count &amp;gt; 0)
+    icons_to_property(icons, count,
+                      &amp;amp;default_net_wm_icons, &amp;amp;default_net_wm_icons_size);
+}
+
+void Fl_X::set_icons() {
+  unsigned long *net_wm_icons;
+  size_t net_wm_icons_size;
+
+  if (w-&amp;gt;icon_-&amp;gt;count) {
+    icons_to_property((const Fl_RGB_Image **)w-&amp;gt;icon_-&amp;gt;icons, w-&amp;gt;icon_-&amp;gt;count,
+                      &amp;amp;net_wm_icons, &amp;amp;net_wm_icons_size);
+  } else {
+    net_wm_icons = default_net_wm_icons;
+    net_wm_icons_size = default_net_wm_icons_size;
+  }
+
+  XChangeProperty (fl_display, xid, fl_NET_WM_ICON, XA_CARDINAL, 32,
+      PropModeReplace, (unsigned char*) net_wm_icons, net_wm_icons_size);
+
+  if (w-&amp;gt;icon_-&amp;gt;count) {
+    delete [] net_wm_icons;
+    net_wm_icons = 0L;
+    net_wm_icons_size = 0;
+  }
+}
+
+////////////////////////////////////////////////////////////////
+
 int Fl_X::set_cursor(Fl_Cursor c) {
   unsigned int shape;
   Cursor xc;

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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
&lt;/pre&gt;</description>
    <dc:creator>ossman_-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&lt; at &gt;public.gmane.org</dc:creator>
    <dc:date>2012-04-25T14:57:23</dc:date>
  </item>
  <textinput rdf:about="http://search.gmane.org/?group=$group=gmane.network.vnc.tigervnc.scm">
    <title>Search Engine</title>
    <description>Search the mailing list at Gmane</description>
    <name>query</name>
    <link>http://search.gmane.org/?group=$group=gmane.network.vnc.tigervnc.scm</link>
  </textinput>
</rdf:RDF>

