visual of 24 depth

This forum is read only. No new submissions are accepted.

Questions about motif? Contact us

2 posts / 0 new
Last post
visual of 24 depth

Submitted by Anonymous on Sat, 10/13/2001 - 15:31. Developers
The default depth of my display is 8 and it support 24 depth, I want to create a window with 24 depth, but it cause error, my code is as following

theScreen = DefaultScreen( theDisplay );
theVisualInfo.depth = 24;
pv = XGetVisualInfo( theDisplay, VisualDepthMask,
&theVisualInfo, &nitem);
for ( i=0; i< nitem; i++)
{
if ( pv[i].class == 4 )
{
memcpy( &theVisualInfo, &pv[i], sizeof(theVisualInfo) );
break;
}
}
XFree( pv );

colormap = XCreateColormap( theDisplay,
RootWindow( theDisplay, theScreen),
theVisualInfo.visual,
AllocNone);
theWindowAttributes.colormap = colormap;
theWindowAttributes.override_redirect = True;
theWindowMask = CWOverrideRedirect | CWColormap;
theNewWindow = XCreateWindow(theDisplay,
RootWindow( theDisplay, theScreen ),
0,0,
200,200,
2,
theVisualInfo.depth,
InputOutput,
theVisualInfo.visual,
theWindowMask,
&theWindowAttributes);
XSetWindowColormap( theDisplay, theNewWindow, colormap);
XMapWindow( theDisplay, theNewWindow );
XSync( theDisplay, False );

XSync cause error.

Look forward to your answer.
Thanks in advance

ICS_support

You seem to be assuming that XGetVisualInfo will return valid information.

I think you want XMatchVisualInfo instead. See http//www.motifzone.com/resources/man/XMatchVisualInfo.html for information.