[comp.windows.x] Why Won't This Popup Disappear?

pickel@mcnc.org (Lisa C. Pickel) (03/20/89)

I have nearly reached the end of converting my X10 program to X11.  Many
thanks to all those who wrote and told me how to fix my "XCreateWindow"
problem.  "It's easy once you know how!"

My hopefully final insoluble problem seems a little hairier.  I am trying 
to repaint the spot underneath a popup window which lies totally within 
my parent application window.  I'm getting no errors or any cues as to 
what is going wrong...the supposedly saved pixmap of what lies beneath the 
popup just is never drawn.  I cannot tell if it was saved initially or not 
since there is no Pixmap structure to inspect.

(I cannot use "save_under" on this server--don't worry, I tried.)

Here is the code to define and then show the popup:

	win_atts.override_redirect = True;
	popup = XCreateWindow(Graph_display, Graph_window, pu_x1, pu_y1, 
		pu_wd, pu_ht, 0, CopyFromParent, InputOutput, CopyFromParent,
		CWOverrideRedirect, &win_atts);

	XSetFunction(Graph_display, XGC, GXcopy);
	XSetPlaneMask(Graph_display, XGC, (unsigned int)
		/* this complicated mess comes out to 0xff */
		(pow(2.0, (double)DefaultDepth(Graph_display, Graph_screen))-1));

	/* this call returns a non-garbage integer for "underside" */
	underside = XCreatePixmap(Graph_display, Graph_window, pu_wd,
		pu_ht, DefaultDepth(Graph_display, Graph_screen));

	/* I also tried using XGetImage, but all I ever got was "X protocol 
	   error: parameter mismatch."  */
	XCopyArea(Graph_display, Graph_window, underside, XGC, pu_x1, pu_y1,
		(unsigned int)pu_wd, (unsigned int)pu_ht, 0, 0);

	XMapWindow(Graph_display, popup);

............
	and then after successfully drawing to the popup window and receiving
	events from it and so on....
............

	XUnmapWindow(Graph_display, popup);

	XSetFunction(Graph_display, XGC, GXcopy);
	XSetPlaneMask(Graph_display, XGC, (unsigned int)
		(pow(2.0, (double)DefaultDepth(Graph_display, Graph_screen))-1));

	XCopyArea(Graph_display, underside, Graph_window, XGC, 0, 0,
		(unsigned int)pu_wd, (unsigned int)pu_ht, pu_x1, pu_y1); 

	XFlush(Graph_display);
	XFreePixmap(Graph_display, underside);

............

What's wrong?  I've worked on this for over two days and am now quite ready to
pack it in and move to Costa Rica.

Lisa.
pickel@mcnc.org
decvax!mcnc!pickel