You will have to repair the damage made by occluding windows. Some options are
xdpyinfo from
the command line to find out) you could set this facility, but
it will tie memory up.
XEvent event;
Region region;
XRectangle rectangle;
switch(event.type){
case Expose:
region = XCreateRegion();
/*Make the union of the rectangles into a Region */
do{
rectangle.x = (short) event.xexpose.x
rectangle.y = (short) event.xexpose.y
rectangle.width = (unsigned short) event.xexpose.width
rectangle.height = (unsigned short) event.xexpose.height
XUnionRectWithRegion(&rectangle,region,region);
} while(XCheckTypedEvent(display,Expose, &event);
XSetRegion(display,gc,region);
redraw(window);
XDestroyRegion(region);
break;