[comp.windows.x] GX{clear, set} problem

rbd@lamont.Columbia.edu (roger davis) (02/17/88)

I am writing an X11 application which does extensive drawing into a
Window. (I am running on Sun 3/160C, 3/110C and 3/50 displays.)
Since backing store does not work and I need to deal with exposures,
I'm doing all my drawing into a Pixmap and then using XCopyArea to
write it to the Window -- when an expose event occurs, I just call
XCopyArea again to redraw the exposed area.

Before drawing into the Pixmap, I need to set all of its pixels to
the background pixel of the Window into which it will ultimately be
copied. I am attempting to do this with XFillRectangle, using a
GC with gcv->background set to the Window background and gcv->function
set to GXclear. This works on a color display, but not on a monochrome
display when the background is black and the foreground is white.
According to the Xlib documentation regarding GCs, GXclear sets
destination bits to 0, and GXset sets them to 1. This is obviously
not what is happening on my color display (all pixels are set to
the background pixel, which is *not* 0), but it does seem to be
exactly what happens on the monochrome display.

Can anyone

	(1) clarify exactly what GX{clear, set} is supposed to do?
	    It would seem preferable to me to set pixels to be the
	    background or foreground, not 0 or 1, since there's no
	    other easy way to do this (to my knowledge). At least one
	    of the phenomena (color vs. inverted monochrome) described
	    above is a bug.

	(2) suggest a better, entirely different way to do this?
	    (I've already got a working kludge which tests for
	    the special case involving the inverted monochrome.)

Thanks.