[comp.windows.x] What's wrong with that code

RWS@ZERMATT.LCS.MIT.EDU (Robert Scheifler) (04/11/88)

    Date: 22 Mar 88 10:42:08 GMT
    From: srinivas@sally.utexas.edu  (Srini Sankaran)

    The following code doesn't work

	viewport = XtCreateManagedWidget("viewport", viewportWidgetClass, toplevel,
			      arglist, XtNumber(arglist));

	win = XtWindow(viewport);

		XDrawArc(dpy, win, gc, XSIZE >> 1, YSIZE >> 1,
			 i * (XSIZE >> 5) , i * (YSIZE >> 5), 0, 64*360);

The viewport widget contains a "clip" widget as a child.  The clip
widget's window completely obscures the viewport widget's window.  As a
result, when you try to draw into the viewport widget's window, you get
no output.  You aren't expected to do graphics directly into the
viewport widget; instead you should be creating another widget to place
inside the viewport (it will get reparented inside the clip widget).


By the way, your code is making the canonical mistake of hardcoding
pixel values 0 and 1.  This is not X10; using 0 and 1 is guaranteed to
get you inverse colors on lots of monochrome displays, and garbage on
lots of color displays.