Trying to use an xlib GXxor

Ilya Anfimov ilan at
Mon Feb 6 07:04:58 UTC 2017

On Sun, Feb 05, 2017 at 08:18:41PM -0500, Alan Corey wrote:
> This probably isn't exactly the right list for this, but maybe
> somebody lingering can answer.  I'm trying to use xor to put a line on
> the screen then erase it again when I want.  With the XSetFunction()
> to xor uncommented I get no line.  If I comment it out I get a line,
> but no erase.  If I move it between the draws I get no erase.
> xor (exclusive or) should set every bit where there's one and only one
> of the inputs true.  If you xor something to the screen twice the 2nd
> time erases what you wrote the first time.  Except I'm doing something
> wrong or there's something I didn't consider.

 To get the "blackcolor" over "whitecolor" with GXxor, you should
draw with "blackcolor^whitecolor".
 (because the result would  be

 In fact, on most displays blackcolor is an integer with the val-
ue 0, therefore xor with just blackcolor does nothing.

More information about the xorg mailing list