Well, I know what was going wrong.  I was running Xvnc out of my home
directory, but the vncserver script was looking for Xvnc in the PATH
instead and was loading /usr/bin/Xvnc, which is from an installed copy
of RealVNC 4.  Thus, it didn't have the Tight extensions and wasn't
responding to the compress level changes.

I'm attaching a proposed patch to vncserver which contains some of the
TurboVNC enhancements, including:

-- allowing Xvnc and the Java classes to be distributed under an
arbitrary directory (I did this because TurboVNC distributes everything
in /opt/TurboVNC, but this also allows us as developers to run a
development version of Xvnc from a non-system directory.)

-- finds xauth in /usr/X11R6/bin even if that directory isn't in the
PATH (necessary for older Linux systems)

-- Adds a much better xstartup file which loads the user's chosen window
manager and falls back to twm only if it is unable to do this.

-- Changes the default depth to 24-bit, since this is the best
performing path on TigerVNC

-- Tries to figure out an appropriate font path for the system and falls
back to using XFS if it is unable to do so.  Note that XFS isn't
generally available on Linux.  In particular, not all releases of SuSE
and Ubuntu have it.

Pierre Ossman wrote:
> I did some printf-debugging and TightEncoder::setCompressLevel() is
> called here. This was unix client to unix server.
>
> Rgds
>   

Index: unix/vncserver
===================================================================
--- unix/vncserver      (revision 3720)
+++ unix/vncserver      (working copy)
@@ -1,5 +1,7 @@
 #!/usr/bin/env perl
 #
+#  Copyright (C) 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
+#  Copyright (C) 2002-2003 Constantin Kaplinsky.  All Rights Reserved.
 #  Copyright (C) 2002-2005 RealVNC Ltd.
 #  Copyright (C) 1999 AT&T Laboratories Cambridge.  All Rights Reserved.
 #
@@ -27,6 +29,16 @@
 # First make sure we're operating in a sane environment.
 #
 
+$exedir = "";
+$slashndx = rindex($0, "/");
+if($slashndx>=0) {
+    $exedir = substr($0, 0, $slashndx+1);
+}
+
+$vncClasses = "";
+
+$xauth = "xauth";
+
 &SanityCheck();
 
 #
@@ -34,14 +46,33 @@
 #
 
 $geometry = "1024x768";
-$depth = 16;
+$depth = 24;
 $vncJavaFiles = (((-d "/usr/share/vnc/classes") && "/usr/share/vnc/classes") ||
-                 ((-d "/usr/local/vnc/classes") && "/usr/local/vnc/classes"));
+                 ((-d "/usr/local/vnc/classes") && "/usr/local/vnc/classes") ||
+                 ((-d "$vncClasses") && "$vncClasses"));
 $vncUserDir = "$ENV{HOME}/.vnc";
 $xauthorityFile = "$ENV{XAUTHORITY}" || "$ENV{HOME}/.Xauthority";
 
 $defaultXStartup
     = ("#!/bin/sh\n\n".
+       "unset SESSION_MANAGER\n".
+       "OS=`uname -s`\n".
+       "if [ \$OS = 'Linux' ]; then\n".
+       "  case \"\$WINDOWMANAGER\" in\n".
+       "    \*gnome\*)\n".
+       "      if [ -e /etc/SuSE-release ]; then\n".
+       "        PATH=\$PATH:/opt/gnome/bin\n".
+       "        export PATH\n".
+       "      fi\n".
+       "      ;;\n".
+       "  esac\n".
+       "fi\n".
+       "if [ -x /etc/X11/xinit/xinitrc ]; then\n".
+       "  exec /etc/X11/xinit/xinitrc\n".
+       "fi\n".
+       "if [ -f /etc/X11/xinit/xinitrc ]; then\n".
+       "  exec sh /etc/X11/xinit/xinitrc\n".
+       "fi\n".
        "[ -r \$HOME/.Xresources ] && xrdb \$HOME/.Xresources\n".
        "xsetroot -solid grey\n".
        "vncconfig -iconic &\n".
@@ -50,7 +81,35 @@
 
 chop($host = `uname -n`);
 
+...@fontpaths = ('/usr/share/X11/fonts', '/usr/share/fonts', 
'/usr/share/fonts/X11/');
+if (! -l "/usr/lib/X11") {push(@fontpaths, '/usr/lib/X11/fonts');}
+if (! -l "/usr/X11") {push(@fontpaths, '/usr/X11/lib/X11/fonts');}
+if (! -l "/usr/X11R6") {push(@fontpaths, '/usr/X11R6/lib/X11/fonts');}
+push(@fontpaths, '/usr/share/fonts/default');
 
+...@fonttypes = ('misc',
+             '75dpi',
+             '100dpi',
+             'Speedo',
+             'Type1');
+
+foreach $_fpath (@fontpaths) {
+    foreach $_ftype (@fonttypes) {
+        if (-f "$_fpath/$_ftype/fonts.dir") {
+            if (! -l "$_fpath/$_ftype") {
+                $fontPath .= "$_fpath/$_ftype,";
+            }
+        }
+    }
+}
+if ($fontPath) {
+    if (substr($fontPath, -1, 1) == ',') {
+        chop $fontPath;
+    }
+}
+
+$defFontPath = "unix/:7100";
+
 # Check command line options
 
 &ParseOptions("-geometry",1,"-depth",1,"-pixelformat",1,"-name",1,"-kill",1,
@@ -91,7 +150,7 @@
 ($z,$z,$mode) = stat("$vncUserDir/passwd");
 if (!(-e "$vncUserDir/passwd") || ($mode & 077)) {
     warn "\nYou will require a password to access your desktops.\n\n";
-    system("vncpasswd -q $vncUserDir/passwd"); 
+    system($exedir."vncpasswd -q $vncUserDir/passwd"); 
     if (($? >> 8) != 0) {
        exit 1;
     }
@@ -137,7 +196,7 @@
 
 # Now start the X VNC Server
 
-$cmd = "Xvnc :$displayNumber";
+$cmd = $exedir."Xvnc :$displayNumber";
 $cmd .= " -desktop " . &quotedString($desktopName);
 $cmd .= " -httpd $vncJavaFiles" if ($vncJavaFiles);
 $cmd .= " -auth $xauthorityFile";
@@ -147,11 +206,11 @@
 $cmd .= " -rfbwait 30000";
 $cmd .= " -rfbauth $vncUserDir/passwd";
 $cmd .= " -rfbport $vncPort";
+$cmd .= " -fp $fontPath" if ($fontPath);
 $cmd .= " -pn";
 
-# Add font path and color database stuff here, e.g.:
+# Add color database stuff here, e.g.:
 #
-# $cmd .= " -fp /usr/lib/X11/fonts/misc/,/usr/lib/X11/fonts/75dpi/";
 # $cmd .= " -co /usr/lib/X11/rgb";
 #
 
@@ -168,6 +227,22 @@
 # Give Xvnc a chance to start up
 
 sleep(3); 
+unless (kill 0, `cat $pidFile`) {
+    warn "\nWARNING: The first attempt to start Xvnc failed, possibly because 
the vncserver\n";
+    warn "script was not able to figure out an appropriate X11 font path for 
this system.\n";
+    warn "Attempting to restart Xvnc using the X Font Server (xfs) ...\n";
+    $cmd =~ s...@-fp [^ ]+@@;
+    $cmd .= " -fp $defFontPath" if ($defFontPath);
+    system("$cmd & echo \$! >$pidFile");
+    sleep(3);
+}
+unless (kill 0, `cat $pidFile`) {
+    warn "Could not start Xvnc.\n\n";
+    open(LOG, "<$desktopLog");
+    while (<LOG>) { print; }
+    close(LOG);
+    die "\n";
+}
 
 warn "\nNew '$desktopName' desktop is $host:$displayNumber\n\n";
 
@@ -518,7 +593,7 @@
     #
 
  cmd:
-    foreach $cmd ("uname","xauth","Xvnc","vncpasswd") {
+    foreach $cmd ("uname") {
        for (split(/:/,$ENV{PATH})) {
            if (-x "$_/$cmd") {
                next cmd;
@@ -526,7 +601,46 @@
        }
        die "$prog: couldn't find \"$cmd\" on your PATH.\n";
     }
+    if (-x "/usr/X11R6/bin/xauth") {
+       $xauth = "/usr/X11R6/bin/xauth";
+    }
+    else {
+      cmd1:
+       foreach $cmd ("xauth") {
+           for (split(/:/,$ENV{PATH})) {
+               if (-x "$_/$cmd") {
+                   next cmd1;
+               }
+           }
+           die "$prog: couldn't find \"$cmd\" on your PATH.\n";
+       }
+    }
 
+    if($exedir eq "") {
+      cmd2:
+       foreach $cmd ("Xvnc","vncpasswd") {
+           for (split(/:/,$ENV{PATH})) {
+               if (-x "$_/$cmd") {
+                   $vncClasses = "$_/../vnc/classes";
+                   next cmd2;
+               }
+           }
+           die "$prog: couldn't find \"$cmd\" on your PATH.\n";
+       }
+    }
+    else {
+      cmd3:
+       foreach $cmd ($exedir."Xvnc",$exedir."vncpasswd") {
+           for (split(/:/,$ENV{PATH})) {
+               if (-x "$cmd") {
+                   $vncClasses = $exedir."../vnc/classes";
+                   next cmd3;
+               }
+           }
+           die "$prog: couldn't find \"$cmd\".\n";
+       }
+    }
+
     #
     # Check the HOME environment variable is set
     #
@@ -534,7 +648,7 @@
     if (!defined($ENV{HOME})) {
        die "$prog: The HOME environment variable is not set.\n";
     }
-    chdir($ENV{HOME});
+#    chdir($ENV{HOME});
 
     #
     # Find socket constants. 'use Socket' is a perl5-ism, so we wrap it in an
------------------------------------------------------------------------------
_______________________________________________
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel

Reply via email to