[comp.windows.x] Exposures, a couple of questions.

thp@westhawk.UUCP ("Timothy H Panton.") (04/05/89)

Background:
	We've nearly completed a large front-end to a simulation and 
have a couple of bugs I can't get a handle on.

	The front-end uses the HP widget set, and thus the R2 version of 
the Xt intrinsics, we have also added a couple of new (home grown) widgets.

	The front end talks to the simulation over a TCP socket. It gets
new data to display continuously.

	These problems occur under both R2/Hpux/hpXserver and 
R3/Sunos4.0/MitXserver

Problems:

1)	The front-end (Xclient) gets killed (by the server?) when a large
number of widgets (>100) are exposed (or mapped). Sometimes one gets an 
"XIO Fatal Error" KillClient type message. The behaviour can be improved in 
the mapping case by adding an XFlush() after a batch (5) of widgets, but this
slows things down. The symptoms can be made much worse by using unix:0.0 
rather than westhawk:0.0 - only get about 30 widgets befor death. This leads
me to beleive that there is a buffer filling up and causing the problem.
Any advice?

2)	One of the new widgets we wrote is an emulation of a chart-recorder.
It displays a graph of say 300 points, with the value on the Y axis and time
on the X axis. ("Now" on the right hand side, "then" on the left). As time
passes the data at the lefthand end is discarded, new data is added on the
right, and the rest is shifted leftwards. In order to reduce the workload
(new data arrives about once a sec) the widget attempts to avoid redrawing
the line if it can and uses XCopyArea to move the bulk of the data leftwards.
This method works fine when the widget is completely exposed. If the right-
hand edge is obscured however the new data isn't drawn, and the graph slowly
fills to the background colour (as the data arrives).
My question is : How can the widget tell if it is partially obscured, and
thus know to use the more expensive drawing strategy? Alternatively is there
a better way of tackling the problem?

TIA.
Tim.



+----------------------------------------------------------------------------+
|Tim Panton, Westhawk Ltd.       (Bright the hawk's flight on the empty sky.)|
|Paper: Westhawk Ltd. 26 Rydal Grove, Helsby, Cheshire, WA6 OET. UK.         |
|Phone: +44 92822574             uucp : ..!mcvax!ukc!cam-cl!westhawk!thp     |
+----------------------------------------------------------------------------+

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (04/05/89)

    How can the widget tell if it is partially obscured, and
    thus know to use the more expensive drawing strategy?

You can track VisibilityNotify events, but this isn't the right solution.

    Alternatively is there a better way of tackling the problem?

You can use GraphicsExpose/NoExpose events (generated by the XCopyArea)
to tell when this does/doesn't happen.