Hello Xorg Mailing List,<br><br> Lately I've been trying to create a window with XWindowCreate() using depth, class, and visual from a visual I obtain using XGetVisualInfo() (of course I parse the XVisualInfo[] for a single XVisualInfo). When X creates the window, I get the following error:<br>
<br>X Error of failed request: BadValue (integer parameter out of range for operation)<br> Major opcode of failed request: 1 (X_CreateWindow)<br> Value in failed request: 0x4<br> Serial number of failed request: 62<br>
Current serial number in output stream: 66<br>(code segment below)<br><br>0x4 meaning the class (TrueColor), because when I change it to DirectColor, an 'inferior' class (hey, blame the enumeration!), it changes to 0x3, so it must be the class. Any suggestions, advice, or bugs you see? <br>
<br>Thanks,<br>Lee<br><br><br>Here is the code segment that does this:<br><br>void<br>updatebars(void) {<br> Monitor *m;<br> int nvi = 0;<br> XVisualInfo template;<br> template.depth = 32;<br> template.screen = screen;<br>
XVisualInfo *vlist = XGetVisualInfo(dpy, VisualDepthMask, &template, &nvi);<br> <br> for(int x = 0; x < nvi; x++)<br> {<br> if(vlist[x].depth == 32)<br> dc.vinfo = &vlist[x];<br> }<br> <br>
<br> XSetWindowAttributes wa = {<br> .override_redirect = True,<br> .colormap = XCreateColormap( dpy, screen, dc.vinfo->visual, AllocNone ),<br> .event_mask = ButtonPressMask|ExposureMask<br> };<br> <br>
for(m = mons; m; m = m->next) {<br> if (m->barwin)<br> continue;<br> <br> XMatchVisualInfo(dpy, screen, dc.vinfo->depth, dc.vinfo->class, dc.vinfo);<br> /* Original XCreateWindow<br> <br>
m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen),<br> CopyFromParent, DefaultVisual(dpy, screen),<br> CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);<br>
*/<br> m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, dc.vinfo->depth,<br> dc.vinfo->class, dc.vinfo->visual,<br> CWOverrideRedirect|CWColormap|CWEventMask, &wa);<br>
<br> printf("passed!");<br> XDefineCursor(dpy, m->barwin, cursor[CurNormal]);<br> XMapRaised(dpy, m->barwin);<br> }<br> }<br>