Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wsu-cs!vip From: vip@wsu-cs.uucp (Virtual Interactive Programming) Newsgroups: comp.windows.x Subject: XCopyArea Problem With UWS 2.0 Keywords: XCopyArea Message-ID: <758@wsu-cs.uucp> Date: 23 Jun 89 17:53:03 GMT Organization: Wayne State University, Detroit, MI Lines: 59 In the process of upgrading from ULTRIX 2.2 to UWS 2.0 running DECwindows, we have encountered a problem with the X11 command XCopyArea when it is used to copy a portion of the root window into a pixmap. This problem doesn't occur on our microVAX GPX running ULTRIX 2.2. Any suggestions can be e-mailed to vip@zeus.cs.wayne.edu. On the next page is a 30-line program which demonstrates the problem. Thank you for your help. /* -- The following code demonstrates the problem we are having -- with XCopyArea with UWS 2.0. Two carriage returns were added -- to separate the executions of XCopyArea. */ #include #include Display *dpy; GC gc; Pixmap pix; Drawable d; XGCValues values; main() { if ((dpy = XOpenDisplay("")) == 0) { printf("Cannot Open Display\n"); exit (1); } /* -- When d is assigned to a window id created by our program, -- then this code works. -- The problem occurs when d is assigned the RootWindow. */ d = RootWindow(dpy, DefaultScreen(dpy)); if ((pix = XCreatePixmap (dpy, d, 100, 100, DefaultDepth(dpy,DefaultScreen(dpy))))==0) printf("Can't Create pix\n"); gc = DefaultGC(dpy, DefaultScreen(dpy)); /* -- This is probably needed to copy from any windows on top of the -- Rootwindow(we tried it without it, it also fails) */ XSetSubwindowMode( dpy, gc, IncludeInferiors ); XFlush(dpy); /* -- Store screen area to pixmap */ if(XCopyArea(dpy,d,pix,gc,0,0,100,100,0,0) == 0) printf("Root copy error\n"); else printf("Root window copied to Pixmap.\n"); XFlush(dpy); getchar(); /* -- Put previously copied area back to the Rootwindow, at the same location -- (on our machine it throws garbage on the screen). */ if(XCopyArea(dpy,pix,d,gc,0,0,100,100,0,0)==0) printf("Pix copy error\n"); else printf("Pixmap copied to Root window.\n"); XFlush(dpy); getchar(); }