visual and PictFormat related question
Alexei Babich
a.babich at rez.ru
Tue Mar 3 23:52:40 PST 2009
> Just to be sure: You did pass the colormap to the XCreateWindow call?
> (Adding the colormap to the "attributes" parameter and setting the
> CWColorMap bit in "valuemask")
In the example yesterday - no, I suppose, I did wrong way.
Today I corrected the parameters of creation of the window, here is an example:
----
{
Window win;
Visual *argb_visual;
Colormap cmap;
XSetWindowAttributes setattr;
{
//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);
}
}
//Creating colormap before creating window
cmap =
XCreateColormap(display, DefaultRootWindow(display), argb_visual,
AllocNone);
//preparing XSetWindowAttributes structure
bzero(&setattr, sizeof(setattr));
setattr.colormap = cmap;
// create window
// at this step I get error: "X Error of failed request: BadMatch (invalid parameter attributes)\ Major opcode of failed request: 1 (X_CreateWindow)"
win =
XCreateWindow(display, DefaultRootWindow(display), 20, 30, 20, 30,
0, 32, InputOutput, argb_visual, CWColormap,
&setattr);
}
----
I have a lot of documentation on the X Window System, but due to poor English I do not often capture the nuances and this results in silly mistakes, as in yesterday's example (a situation with the XSetWindowAttributes.colormap when creating the window).
I suppose it's an embarrassing trifle for respected gurus of the community, so maybe someone could tell me where a dialogue on such issues would be more appropriate?
Or, specifically for the this topic, someone could point to an example, doing what I want, in a similar situation?
Thank you.
--
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