home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / windows / x / 21061 < prev    next >
Encoding:
Text File  |  1993-01-12  |  2.5 KB  |  84 lines

  1. Newsgroups: comp.windows.x
  2. Path: sparky!uunet!ulowell!woods.ulowell.edu!steritir
  3. From: steritir@woods.ulowell.edu
  4. Subject: 24 bit TrueColor problem (a Stardent computer)
  5. Message-ID: <1993Jan12.123148.1@woods.ulowell.edu>
  6. Lines: 73
  7. Sender: usenet@ulowell.ulowell.edu (News manager - ulowell)
  8. Organization: University of Lowell
  9. Date: Tue, 12 Jan 1993 17:31:48 GMT
  10.  
  11. I'm having trouble using x on a Stardent (24 bit color)
  12.  
  13. The code works fine on Dec's
  14.  
  15. It apparently has trouble creating proper visuals and colormaps
  16.  
  17. Here's the relevant code:
  18.  
  19.     screen   = XDefaultScreen (display);
  20.     parent   = XRootWindow    (display, screen);
  21.     depth    = XDefaultDepth  (display, screen);
  22.     planes   = XDisplayPlanes (display, screen);
  23.     ncolors  = XDisplayCells  (display, screen);
  24.  
  25.     default_visual = DefaultVisual ( display, screen );
  26.  
  27.     switch ( default_visual->class ) {
  28.  
  29.     case PseudoColor:
  30.       r = XMatchVisualInfo ( display, screen, depth, PseudoColor, &vis_info );
  31.       break;
  32.     case GrayScale:
  33.       printf ( "GrayScale \n" );
  34.       r = XMatchVisualInfo ( display, screen, depth, GrayScale, &vis_info );
  35.       break;
  36.     case DirectColor:
  37.       printf ( "DirectColor \n" );
  38.       r = XMatchVisualInfo ( display, screen, depth, DirectColor, &vis_info );
  39.       break;
  40.     case TrueColor:
  41. /*
  42.       r = XMatchVisualInfo ( display, screen, depth, TrueColor, &vis_info );
  43. */
  44.       printf ( "TrueColor -> PseudoColor \n" );
  45.       r = XMatchVisualInfo ( display, screen, depth, PseudoColor, &vis_info );
  46.       break;
  47.     default:
  48.       printf ( " No visual found. \n");
  49.  
  50.     }
  51.     if ( !r ) printf ( " Problem matching visual \n" );
  52.  
  53.     cmap = XCreateColormap ( display, parent, vis_info.visual, AllocAll );
  54.  
  55.     colors = (XColor *) malloc ( ncolors * sizeof (XColor) );
  56.  
  57.     colors = (XColor *) malloc ( ncolors * sizeof (XColor) );
  58.  
  59.     for (i=0;i<ncolors;i++) {
  60.       colors[i].pixel = i;
  61.       colors[i].red = colors[i].green = colors[i].blue = i*256;
  62.       colors[i].flags = DoRed | DoGreen | DoBlue;
  63.     }
  64.  
  65.     XStoreColors ( display, cmap, colors, ncolors);
  66.  
  67.  
  68. The default visual is TrueColor, it was suggested that i use Pseudo anyway
  69. hence the commented out XMatchVisual ( TrueColor )
  70.  
  71. Matching with PseudoColor however does print the (appropriate) error message
  72. "problem matching visual", 
  73. Both Pseudo and True result in 
  74. X Protocol error:  BadValue, integer parameter out of range for operation
  75.   Major opcode of failed request:  78 (X_CreateColormap)
  76.  
  77. I'd appreciate any help!
  78.  
  79. Ron Steriti
  80. UMass Lowell
  81. steritir@woods.ulowell.edu
  82.  
  83. The code works fine on Dec 
  84.