vip@wsu-cs.uucp (Virtual Interactive Programming) (06/24/89)
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 <stdio.h>
#include <X11/Xlib.h>
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();
}
klee@gilroy.pa.dec.com (Ken Lee) (06/24/89)
In article <758@wsu-cs.uucp>, vip@wsu-cs.uucp (Virtual Interactive Programming) writes: > 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. Well, I ran your program as-is on a DECstation 3100 and a VAXstation 2000. Both worked perfectly. Both were running ULTRIX UWS2.1 DECwindows (should be publicly available now), so you may want to upgrade. I believe that your problem was a bug in the UWS2.0 X server. Early MIT sample servers suffered from the same bug (copy area with IncludeInferiors). Ken Lee DEC Western Software Laboratory, Palo Alto, Calif. Internet: klee@decwrl.dec.com Uucp: uunet!decwrl!klee