} OverlayVisualPropertyRec; OverlayVisualPropertyRec *pOverlayVisuals, *pOVis;
XVisualInfo | getVis; |
XVisualInfo | *pVisuals; |
Atom | overlayVisualsAtom, actualType; |
... |
|
/* Get the visuals for this screen and allocate. */ getVis.screen = screen;
pVisuals = XGetVisualInfo(display, VisualScreenMask, &getVis, &nVisuals); pOverlayVisuals = (OverlayVisualPropertyRec *)
malloc ( (size_t)nVisuals * sizeof(OverlayVisualPropertyRec) );
/* Get the overlay visual information for this screen. Obtain
*this information from the SERVER_OVERLAY_VISUALS property. */ overlayVisualsAtom = XInternAtom(display, "SERVER_OVERLAY_VISUALS", True); if (overlayVisualsAtom != None)
{
/* Since the Atom exists, request the property's contents. */ bytesAfter = 0;
numLongs = ( nVisuals * sizeof(OverlayVisualPropertyRec) + 3 ) / 4; XGetWindowProperty(display, RootWindow(display, screen),
overlayVisualsAtom, 0, numLongs, False, AnyPropertyType, &actualType, &actualFormat, &numLongs, &bytesAfter, &pOverlayVisuals);
if ( bytesAfter != 0 ) {/* Serious Failure Here */} ;
/* Loop through the pOverlayVisuals array. */
...
nOVisuals = numLongs/sizeof(OverlayVisualPropertyRec); pOVis = pOverlayVisuals;
while
{
if (
{/* Found a transparent overlay visual, set ident. aside. */}; pOVis++;
}
XFree(pOverlayVisuals);
/* There might be some additional checking of the found transparent overlay visuals wanted; e.g., for depth. */
}
XFree(pVisuals);
}
This program segment is not complete; however, its main purpose is to give an idea of how to find an overlay visual having transparency.
Page 71 | Graphics Administration Guide for |