home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / windows / x / 21500 < prev    next >
Encoding:
Internet Message Format  |  1993-01-23  |  1.9 KB

  1. Path: sparky!uunet!olivea!hal.com!darkstar.UCSC.EDU!bering!craig
  2. From: craig@ucsc (Craig Schiavone)
  3. Newsgroups: comp.windows.x
  4. Subject: Q: How do I create a window with an 8-bit visual?
  5. Keywords: visual
  6. Message-ID: <1jq7d1INNag3@darkstar.UCSC.EDU>
  7. Date: 23 Jan 93 01:35:29 GMT
  8. Reply-To: craig@bering.ucsc.edu
  9. Distribution: ca
  10. Organization: Sun Microsystems, Inc.
  11. Lines: 38
  12. NNTP-Posting-Host: bering.ucsc.edu
  13.  
  14. I am having trouble with creating a window with an 8-bit Pseudocolor visual
  15. on a Sun Sparcstation.  I am getting the visual w/XMatchVisualInfo, and
  16. creating an appropriate colormap with no problem, but running the program
  17. gives me this error:
  18.  
  19. X Error of failed request:  BadMatch (invalid parameter attributes)
  20.   Major opcode of failed request:  1 (X_CreateWindow)
  21.   Serial number of failed request:  4
  22.   Current serial number in output stream:  5
  23.  
  24. I am running under sunOS 4.1.2 and OpenWindows 3.0, using the open-look
  25. window manager (olwm).  The default visual of the screen in a 24-bit
  26. TrueColor visual.  Here's the code:
  27.  
  28.         stat = XMatchVisualInfo(display, DefaultScreen(display), 8, PseudoColor, &vInfo);
  29.         pseudo8Vis = vInfo.visual;
  30.         pseudoCmap = XCreateColormap(display, rootWin, pseudo8Vis, AllocNone);
  31.         if (pseudoCmap == DefaultColormap(display, screen_num)) {
  32.                 printf("got default colormap\n");
  33.         }
  34.  
  35.         /* create opaque window */
  36.         if (stat && pseudoCmap && (pseudoCmap != DefaultColormap(display, screen_num))) {
  37.             winAttrs.colormap = pseudoCmap;
  38.             win = XCreateWindow(display, rootWin, x, y, width, height,
  39.                 border_width, 8, InputOutput, pseudo8Vis, (unsigned long) CWColormap,
  40.                 &winAttrs);
  41.         } else {
  42.             fprintf(stderr, "Couldn't get visual (%d) or cmap (%d).\n",
  43.                 stat, pseudoCmap);
  44.             exit(0);
  45.         }
  46.  
  47. What am I doing wrong?
  48.  
  49. Any help with this program would be greatly appreciated.
  50.  
  51. -Craig
  52.