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. /* My first recreational X activity. Based on Tronche's tutorial. */ #include <X11/Xlib.h> // Every Xlib program must include this #include <assert.h> // I include this to test return values the lazy way #include <unistd.h> // So we got the profile for 10 seconds #include <stdio.h> #include <stdlib.h> // for exit Display *dpy; int blackcolor,whitecolor; Window w; GC gc; XEvent e; // a struct #define WWIDTH 320 #define WHEIGHT 240 int main(void) { dpy = XOpenDisplay(NULL); assert(dpy); // be sure we've got dpy blackcolor = BlackPixel(dpy, DefaultScreen(dpy)); whitecolor = WhitePixel(dpy, DefaultScreen(dpy)); w = XCreateSimpleWindow(dpy,DefaultRootWindow(dpy),0,0,WWIDTH,WHEIGHT,0,\ blackcolor,whitecolor); XSelectInput(dpy,w,StructureNotifyMask); // watch notifications XMapWindow(dpy,w); gc = XCreateGC(dpy,w,0,NULL); XSetFunction(dpy,gc,GXxor); // sets xor mode XSetForeground(dpy,gc,blackcolor); // MapNotify wait loop, wait for a MapNotify event before drawing // confirms that XMapWindow worked. for (;;) { XNextEvent(dpy,&e); // fetch an event if (e.type == MapNotify) // done when we find one break; } XDrawLine(dpy, w, gc, 10, 60, 180, 20); // draw a line XFlush(dpy); printf("after draw\n"); // to stdout getchar(); // wait for keypress XDrawLine(dpy, w, gc, 10, 60, 180, 20); // should erase it XFlush(dpy); // sends request to server printf("After erase\n"); getchar(); return 0; } -- ------------- No, I won't call it "climate change", do you have a "reality problem"? - AB1JX Impeach Impeach Impeach Impeach Impeach Impeach Impeach Impeach _______________________________________________ xorg@lists.x.org: X.Org support Archives: http://lists.freedesktop.org/archives/xorg Info: https://lists.x.org/mailman/listinfo/xorg Your subscription address: %(user_address)s