XLib Help : RGBA Visual and Window Creation
Lee Fallat
ircsurfer33 at gmail.com
Sun Apr 22 08:01:21 PDT 2012
Hello Xorg Mailing List,
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:
X Error of failed request: BadValue (integer parameter out of range for
operation)
Major opcode of failed request: 1 (X_CreateWindow)
Value in failed request: 0x4
Serial number of failed request: 62
Current serial number in output stream: 66
(code segment below)
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?
Thanks,
Lee
Here is the code segment that does this:
void
updatebars(void) {
Monitor *m;
int nvi = 0;
XVisualInfo template;
template.depth = 32;
template.screen = screen;
XVisualInfo *vlist = XGetVisualInfo(dpy, VisualDepthMask, &template,
&nvi);
for(int x = 0; x < nvi; x++)
{
if(vlist[x].depth == 32)
dc.vinfo = &vlist[x];
}
XSetWindowAttributes wa = {
.override_redirect = True,
.colormap = XCreateColormap( dpy, screen, dc.vinfo->visual, AllocNone
),
.event_mask = ButtonPressMask|ExposureMask
};
for(m = mons; m; m = m->next) {
if (m->barwin)
continue;
XMatchVisualInfo(dpy, screen, dc.vinfo->depth, dc.vinfo->class,
dc.vinfo);
/* Original XCreateWindow
m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0,
DefaultDepth(dpy, screen),
CopyFromParent, DefaultVisual(dpy, screen),
CWOverrideRedirect|CWBackPixmap|CWEventMask,
&wa);
*/
m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0,
dc.vinfo->depth,
dc.vinfo->class, dc.vinfo->visual,
CWOverrideRedirect|CWColormap|CWEventMask,
&wa);
printf("passed!");
XDefineCursor(dpy, m->barwin, cursor[CurNormal]);
XMapRaised(dpy, m->barwin);
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg/attachments/20120422/76185e84/attachment.html>
More information about the xorg
mailing list