home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!hal.com!darkstar.UCSC.EDU!bering!craig
- From: craig@ucsc (Craig Schiavone)
- Newsgroups: comp.windows.x
- Subject: Q: How do I create a window with an 8-bit visual?
- Keywords: visual
- Message-ID: <1jq7d1INNag3@darkstar.UCSC.EDU>
- Date: 23 Jan 93 01:35:29 GMT
- Reply-To: craig@bering.ucsc.edu
- Distribution: ca
- Organization: Sun Microsystems, Inc.
- Lines: 38
- NNTP-Posting-Host: bering.ucsc.edu
-
- I am having trouble with creating a window with an 8-bit Pseudocolor visual
- on a Sun Sparcstation. I am getting the visual w/XMatchVisualInfo, and
- creating an appropriate colormap with no problem, but running the program
- gives me this error:
-
- X Error of failed request: BadMatch (invalid parameter attributes)
- Major opcode of failed request: 1 (X_CreateWindow)
- Serial number of failed request: 4
- Current serial number in output stream: 5
-
- I am running under sunOS 4.1.2 and OpenWindows 3.0, using the open-look
- window manager (olwm). The default visual of the screen in a 24-bit
- TrueColor visual. Here's the code:
-
- stat = XMatchVisualInfo(display, DefaultScreen(display), 8, PseudoColor, &vInfo);
- pseudo8Vis = vInfo.visual;
- pseudoCmap = XCreateColormap(display, rootWin, pseudo8Vis, AllocNone);
- if (pseudoCmap == DefaultColormap(display, screen_num)) {
- printf("got default colormap\n");
- }
-
- /* create opaque window */
- if (stat && pseudoCmap && (pseudoCmap != DefaultColormap(display, screen_num))) {
- winAttrs.colormap = pseudoCmap;
- win = XCreateWindow(display, rootWin, x, y, width, height,
- border_width, 8, InputOutput, pseudo8Vis, (unsigned long) CWColormap,
- &winAttrs);
- } else {
- fprintf(stderr, "Couldn't get visual (%d) or cmap (%d).\n",
- stat, pseudoCmap);
- exit(0);
- }
-
- What am I doing wrong?
-
- Any help with this program would be greatly appreciated.
-
- -Craig
-