visual and PictFormat related question

Alexei Babich a.babich at rez.ru
Tue Mar 3 01:51:20 PST 2009


Good afternoon.

I tryed to deal with colormap, but probably I got wrong.

Description: We have two visuals (as xdpyinfo says): default, 0x21 (TrueColor, depth == 24 planes); 0x39 (TrueColor, depth == 32 planes)

I tryed this:

{
       Window win;
       Visual *argb_visual;

       {       //search visual suitable for PictStandardARGB32
               //derived from xdpyinfo source
               XVisualInfo viproto;            /* fill in for getting info */
               XVisualInfo *vip;                       /* returned info */
               int nvi = 0;
               viproto.depth = 32;
               vip = XGetVisualInfo (display, VisualDepthMask, &viproto, &nvi);
               if(nvi <1) {
                       exit(EXIT_FAILURE);
               }
               if(nvi){
                       argb_visual = vip->visual;              //visual for 32-planes
                       XFree(vip);
               }
       }

       // create window
       // default depth of root window is 24

       win = XCreateWindow(display, DefaultRootWindow(display), 20,30,20,30,0,32 /*depth*/,InputOutput,argb_visual,0,NULL);
       // when I try depth 24, creating window also fails.
       // This depth (32) and visual combinations look legal, because manual tells, that "For class InputOutput, the visual type and depth must be a combination supported for the screen, or a BadMatch error results".
}

Following your advice, I tryed colormap before creating window, like this:
{
       Colormap cmap;
       //AllocNone is the only choice for visual type of TrueColor
       cmap = XCreateColormap(display, DefaultRootWindow(display), argb_visual,AllocNone);
}

But creating window still fails.
I suppose I could get your letter wrong. If not, have you please other ideas how to create windows compatible with PictStandardARGB32 ?

-- 
Regards,
Alexei Babich, circuit engineer, OOO NPP "Rezonans", Chelyabinsk, Russia
http://www.rez.ru
Jabber ID: impatt at jabber.ru



More information about the xorg mailing list