Path: utzoo!attcan!uunet!steinmetz!nepal!laymon From: laymon@nepal.steinmetz (Marc A Laymon) Newsgroups: comp.windows.x Subject: rubber banding in X Message-ID: <10979@steinmetz.ge.com> Date: 24 May 88 18:35:29 GMT Sender: news@steinmetz.ge.com Reply-To: laymon@nepal.steinmetz () Distribution: na Organization: General Electric CRD, Schenectady, NY Lines: 54 Question #1: I want to draw a rubber-banding line. It would seem to me that I want to repeatedly draw a line in exclusive-or mode. I tried to use the following code fragment (and several variations thereof) to try to set the graphics context to exclusive-or, then call XDrawLine using the graphics context. My line does not show up. Can someone tell me what I am doing wrong or suggest another approach ? ---------------------------------------------------------------------------- Display *dpy ; int g_black ; int g_white ; unsigned long mask ; GC xor_gc ; XGCValues xgcv ; g_black = BlackPixel (dpy, screen); g_white = WhitePixel (dpy, screen); mask = g_black ^ g_white ; xgcv.foreground = mask ; xgcv.background = g_white ; xgcv.line_width = 1 ; xgcv.function = GXxor ; gc_mask = 0 ; gc_mask = GCFunction | GCPlaneMask | GCForeground | GCBackground | GCLineWidth ; xor_gc = XCreateGC (dpy, Rootwindow, GCFunction, &xgcv) ; while (*whatever*) { [code to modify x[1] & y[1]] XDrawLine (dpy, Rootwindow, xor_gc, x[0], y[0], x[1], y[1]) ; } -------------------------------------------------------------------------- Question #2 I created a graphic widget using the X Intrinsics. This widget is just a blank window into which I can use Xlib graphics functions. This works fine. However, if my base window containing this graphic widget is resized or moved via the window manager, I lose the contents of the window. Is there an easy way to preserve and restore the random contents of a window ? Regions or buffers don't seem to be what I want. Thanks in advance. Marc Laymon ARPANET: laymon@ge-crd.arpa GE Corp. R&D USENET: steinmetz!nepal!laymon Schenectady, NY