XLib Help : RGBA Visual and Window Creation

Eirik Byrkjeflot Anonsen eirik at opera.com
Sun Apr 22 22:45:19 PDT 2012


Lee Fallat <ircsurfer33 at gmail.com> writes:

>     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
[...]
>       XSetWindowAttributes wa = {
>         .override_redirect = True,
>         .colormap = XCreateColormap( dpy, screen, dc.vinfo->visual,
>    AllocNone ),

Second parameter to XCreateColormap should be a window, I believe.
(Though I don't know whether Xlib cares.)

>         .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);

Why switch to a different visual here?  (I have no idea if that matters,
though.)

[...]

eirik



More information about the xorg mailing list