[comp.windows.open-look] Openwin Server bug ?

klaassen@fifi.informatik.uni-dortmund.de (Othmar Klaassen) (06/19/91)

Hi,

We ran into a problem with openwindows, and I wonder whether this
really is a server bug.

Our environment: Sun4, SunOS4.1.1, Openwin-2.0, any window manager.

The following program (cut to the absolute minimum, so no comments
about missing tests etc. please) works okay until any other window
obscures (partly) the upper left square with it's upper left corner.
In this case, the XDrawLine (,,,, CoordModePrevious) seems rather
confused about the place and the lines to draw ...

It seems a problem with the server, because 

a) monitoring the requests shows a valid PolyLine request, and

b) it works with the MIT server.

Please tell me if there were 27 persons before me to notice this or
if Openwin-2.0 is out of time, 

thanks in advance,

Othmar


Othmar Klaassen                  e-mail : klaassen@fifi.informatik.uni-dortmund.de
University of Dortmund                    klaassen@fifi.unido.uucp
Informatik IV                             uunet!mcsun!unido!laura!fifi!klaassen
P.O.Box 500500                            unido!laura!fifi!klaassen                                          
D-4600 Dortmund 50, Germany      voice  : +49 231 755 4746


/*
** file: bug.c
*/

#include <X11/Xlib.h>
#include <X11/Xos.h>
#include <X11/Xutil.h>
#include <stdio.h>


#define err(x) fprintf(stderr,x)

#define X_RES	300
#define Y_RES	300


Display *disp;	/* my display	*/
Window win;	/* my window	*/
GC gc;		/* my GC	*/
XEvent evnt;	/* my exent	*/
int scrn;	/* screen	*/

XPoint points1 [] = {{10, 10}, {50, 0}, {0, 50}, {-50, 0}, {0, -50}};
XPoint points2 [] = {{100, 100}, {150, 100}, {150, 150}, {100, 150}, {100, 100}};


main(argc,argv)
int argc;
char *argv[];
{
XEvent evnt;

	initx();

	while(1){
		XNextEvent(disp,&evnt);
		switch (evnt.type){
		case Expose:
			XClearWindow(disp,win);
                        XDrawLines(disp, win, gc, points1, 5,
                                   CoordModePrevious);
                        XDrawLines(disp, win, gc, points2, 5,
                                   CoordModeOrigin);
			break;
		case ButtonPress:
			XCloseDisplay(disp);
			exit(0);
               }
       }

}
/***************************************************************************
** FUNCTION: initx
**
***************************************************************************/
initx()
{
unsigned long att_flags;
XSetWindowAttributes att;
XGCValues gcatt;

	if ((disp = XOpenDisplay(NULL)) == NULL){
		err("Can't open display.\n");
		exit(-1);
	}

	scrn = DefaultScreen(disp);

/*
** now set up the window
*/
	att_flags = CWEventMask | CWBackPixel;
	att.event_mask = ButtonPressMask | ExposureMask;
	att.background_pixel = BlackPixel(disp,scrn);
	win = XCreateWindow(disp,RootWindow(disp,scrn),100,100,X_RES,Y_RES,5,
				CopyFromParent,InputOutput,CopyFromParent,
				att_flags,&att);

/*
** Create the GC to draw with.
*/
	att_flags = GCForeground | GCBackground;
	gcatt.foreground = WhitePixel(disp,scrn);
	gcatt.background = BlackPixel(disp,scrn);
	gc = XCreateGC(disp,win,att_flags,&gcatt);

	XMapWindow(disp,win);
}