It looks like you're just missing the border. I think it defaults
to CopyFromParent, which is a BadMatch if the parent if of a different
depth.
Mark.
On Fri, 7 Mar 2003, Pascual Castellon Gadea wrote:
> Hi!
>
> I am trying to create an X Window not using the default Visual. To do
> such thing, I select my prefered Visual with the
> XGetVisualInfo function.
>
> Then I want to use the �visual� and �depth� fields in the structure, to
> open a Window. But unfortunatelly, the X-Server
> always gives me a BadMatch Error. I also tried creating a Colormap
> before the Window and giving it at creation time
> through the XSetAttributes structure.
>
> Here is the code that shows me the error message:
>
> int main()
>
> {
> Display *display;
> Window window,
> parent;
> Colormap colormap;
> XVisualInfo *xvinfo;
> XVisualInfo xvinfo_template;
> unsigned long mask;
> long xvinfo_mask;
> int nitems_return;
> XSetWindowAttributes attributes;
>
> screen = XDefaultScreen(display);
> parent = XRootWindow (display,screen);
>
> xvinfo_template.screen = screen;
> xvinfo_template.depth = 8;
> xvinfo_template.class = PseudoColor;
> xvinfo_mask = (VisualScreenMask|VisualDepthMask|VisualClassMask);
>
> xvinfo =
> XGetVisualInfo(display,xvinfo_mask,&xvinfo_template,&nitems_return);
> if (!nitems_return) {
> fprintf(stderr,"Can not find PseudoColor Visual");
> }
>
> colormap = XCreateColormap(display,parent,xvinfo[0].visual,AllocAll);
>
> mask = (CWBackingStore | CWEventMask | CWWinGravity | CWBackPixel |
> CWBackingPixel | CWColormap );
> attributes.backing_store = Always;
> attributes.event_mask = ExposureMask | StructureNotifyMask;
> attributes.win_gravity = NorthWestGravity;
> attributes.background_pixel = XBlackPixel (display,screen);
> attributes.backing_pixel = XBlackPixel (display,screen);
> attributes.colormap = colormap;
>
> window = XCreateWindow (display,parent,x,y,width,height,borderw,
> xvinfo[0].depth,InputOutput,xvinfo[0].visual,
> mask,&attributes);
>
> ....
> }
>
> Can anybody help me with this?
>
> Thanks in advance
>
> --
> Pascual Castellon
> Programming Department
>
>
> mailto: [EMAIL PROTECTED]
> http://www.cadt.com
>
>
> _______________________________________________
> XFree86 mailing list
> [EMAIL PROTECTED]
> http://XFree86.Org/mailman/listinfo/xfree86
>
_______________________________________________
XFree86 mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xfree86