Index: /branches/eam_branch_20080223/Ohana/src/kapa2/src/CheckVisual.c
===================================================================
--- /branches/eam_branch_20080223/Ohana/src/kapa2/src/CheckVisual.c	(revision 16795)
+++ /branches/eam_branch_20080223/Ohana/src/kapa2/src/CheckVisual.c	(revision 16796)
@@ -14,5 +14,5 @@
   unsigned long planes[3];
   XPixmapFormatValues *pixmaps;
-  int Npixmaps;
+  int Npixmaps, Npixels;
 
   if (DEBUG) {
@@ -127,8 +127,15 @@
 
   if (isDynamic) {
+    Npixels = NPIXELS_DYNAMIC;
+    if ((N = get_argument (*argc, argv, "-ncolors"))) {
+      remove_argument(N, argc, argv);
+      Npixels = atoi (argv[N]);
+      remove_argument(N, argc, argv);
+    } 
+
     /* allocate color cells */
-    ALLOCATE (graphic[0].pixels, unsigned long, NPIXELS_DYNAMIC);
-    ALLOCATE (graphic[0].cmap,   XColor,        NPIXELS_DYNAMIC);
-    for (graphic[0].Npixels = NPIXELS_DYNAMIC; graphic[0].Npixels >= 16; graphic[0].Npixels -= 4) {
+    ALLOCATE (graphic[0].pixels, unsigned long, Npixels);
+    ALLOCATE (graphic[0].cmap,   XColor,        Npixels);
+    for (graphic[0].Npixels = Npixels; graphic[0].Npixels >= 16; graphic[0].Npixels -= 4) {
       if (DEBUG) fprintf (stderr, "trying %d colors\n", (int) graphic[0].Npixels);
       if (XAllocColorCells (graphic[0].display, graphic[0].colormap, FALSE, planes, 1, graphic[0].pixels, graphic[0].Npixels)) {
@@ -163,8 +170,15 @@
     }
   } else {
+    Npixels = NPIXELS_STATIC;
+    if ((N = get_argument (*argc, argv, "-ncolors"))) {
+      remove_argument(N, argc, argv);
+      Npixels = atoi (argv[N]);
+      remove_argument(N, argc, argv);
+    } 
+
     // XXX allocate the unsigned long *pixels here and above
-    ALLOCATE (graphic[0].pixels, unsigned long, NPIXELS_STATIC);
-    ALLOCATE (graphic[0].cmap,   XColor,        NPIXELS_STATIC);
-    graphic[0].Npixels = NPIXELS_STATIC;
+    ALLOCATE (graphic[0].pixels, unsigned long, Npixels);
+    ALLOCATE (graphic[0].cmap,   XColor,        Npixels);
+    graphic[0].Npixels = Npixels;
   }
 
