Path: utzoo!attcan!uunet!samsung!sdd.hp.com!zaphod.mps.ohio-state.edu!julius.cs.uiuc.edu!psuvax1!psuvm!cunyvm!uupsi!rodan.acs.syr.edu!top.cis.syr.edu!rshankar From: rshankar@top.cis.syr.edu (Ravi V. Shankar) Newsgroups: comp.windows.x Subject: XDrawLine doesn't draw lines! Looking for help. Message-ID: <1991Jan23.235111.23319@rodan.acs.syr.edu> Date: 24 Jan 91 06:12:57 GMT Reply-To: rshankar@top.cis.syr.edu (Ravi V. Shankar) Organization: CIS Dept., Syracuse University Lines: 70 I seem to be running into a problem when I use XDrawLine to draw a set of lines. My program is pretty basic. It reads from a text file 4 values at a time and draws a line using the read values as coordinates for the two endpoints. The program does not give any errors during compilation. But I seem to get different results each time I execute the compiled code. Sometimes I get all lines drawn properly, sometimes none, sometimes a few. I've given a portion of the code below for anyone who has patience to read it. I would appreciate any comments/suggestions. Please reply directly to me through email. Thanks, Ravi P.S. I use a color monitor on a Sun/4 (just in case you need this info) ---------------------------------------------------------------------- ..... theWindowAttributes.border_pixel = BlackPixel(theDisplay, theScreen); theWindowAttributes.background_pixel = WhitePixel(theDisplay, theScreen); theWindowAttributes.override_redirect = False; theWindowMask = (CWBackPixel | CWBorderPixel | CWOverrideRedirect ); theNewWindow = XCreateWindow( theDisplay, RootWindow( theDisplay, theScreen ), 0, 0, 512, 512, border_width, theDepth, InputOutput, theVisual, theWindowMask, &theWindowAttributes ); theGC = XCreateGC (theDisplay, theNewWindow,(unsigned long)0, &theGCValues); theColormap = DefaultColormap(theDisplay, theScreen); XSetFunction(theDisplay, theGC, GXset); XSetForeground(theDisplay, theGC, BlackPixel(theDisplay, theScreen)); XMapWindow(theDisplay, theNewWindow); XFlush(theDisplay); line_fin = fopen("data/lines.dat","r"); for (i=0; i<44; i++) { fscanf(line_fin,"%d %d %d %d\n", &x1, &y1, &x2, &y2); XDrawLine(theDisplay, theNewWindow, theGC, x1, y1, x2, y2); } XFlush(theDisplay); fclose(line_fin); sleep(2); XDestroyWindow( theDisplay, theNewWindow); XFlush(theDisplay); ....... ----------------------------------------------------------------------------