[Bugfix] Fixed screen initialization - use correct depths and richer set of visuals.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3005 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/unix/xserver/hw/vnc/xvnc.cc b/unix/xserver/hw/vnc/xvnc.cc
index effd0f2..cc32bc0 100644
--- a/unix/xserver/hw/vnc/xvnc.cc
+++ b/unix/xserver/hw/vnc/xvnc.cc
@@ -81,7 +81,6 @@
 #include "miline.h"
 #include "inputstr.h"
 #include <X11/keysym.h>
-  extern int defaultColorVisualClass;
   extern char buildtime[];
 #undef class
 #undef public
@@ -1068,8 +1067,40 @@
     if (!pbits) return FALSE;
     vncFbptr[index] = pbits;
 
-    defaultColorVisualClass
-	= (pvfb->bitsPerPixel > 8) ? TrueColor : PseudoColor;
+    miSetPixmapDepths();
+
+    switch (pvfb->depth) {
+    case 8:
+	miSetVisualTypesAndMasks (8,
+				  ((1 << StaticGray) |
+				  (1 << GrayScale) |
+				  (1 << StaticColor) |
+				  (1 << PseudoColor) |
+				  (1 << TrueColor) |
+				  (1 << DirectColor)),
+				  8, PseudoColor, 0, 0, 0);
+	break;
+    case 16:
+	miSetVisualTypesAndMasks (16,
+				  ((1 << TrueColor) |
+				  (1 << DirectColor)),
+				  8, TrueColor, 0xf800, 0x07e0, 0x001f);
+	break;
+    case 24:
+	miSetVisualTypesAndMasks (24,
+				  ((1 << TrueColor) |
+				  (1 << DirectColor)),
+				  8, TrueColor, 0xff0000, 0x00ff00, 0x0000ff);
+	break;
+    case 32:
+	miSetVisualTypesAndMasks (32,
+				  ((1 << TrueColor) |
+				  (1 << DirectColor)),
+				  8, TrueColor, 0xff000000, 0x00ff0000, 0x0000ff00);
+	break;
+    default:
+	return FALSE;
+    }
 
     ret = fbScreenInit(pScreen, pbits, pvfb->width, pvfb->height,
 		       dpi, dpi, pvfb->paddedWidth, pvfb->bitsPerPixel);