Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!van-bc!ubc-cs!uw-beaver!cornell!rochester!kodak!ispd-newsserver!ism.isc.com!ico!auto-trol!marbru From: marbru@auto-trol.com (Martin Brunecky) Newsgroups: comp.windows.x Subject: Re: BUG: XtSetValues assumes all non-widgets are RectObjs Message-ID: <1991Apr19.153005.22266@auto-trol.com> Date: 19 Apr 91 15:30:05 GMT References: <1991Apr17.073327.12784@melba.bby.oz.au> Reply-To: marbru@auto-trol.UUCP (Martin Brunecky) Organization: Auto-trol Technology, Denver Lines: 60 In article <1991Apr17.073327.12784@melba.bby.oz.au> gnb@bby.oz.au (Gregory N. Bond) writes: >[This has been sent to xbugs] > > The XtSetValues handling of redraws is flawed for Objects that > are not widgets and not subclasses of RectObj. When a widget > set_values routine returns True, XtSetValues forces a redraw > by doing an XClearArea on the widget window. If the object is > not a widget, XtSetValues finds the nearest widget ancestor > and, treating the object as a RectObj, clears the portion of > the ancestor window that is "covered" by the RectObj. If the > object is not a RectObj, this will be wrong and a random part > of the window will be cleared. If the data wrongly read as > the rectangle coords is sufficiently perverse, a BadValue > error may be generated (I think, I've not actually seen one). > > It doesn't seem to be actually causing any problems for me, .... I had more than my share of troubles with SIMILAR bug in Motif 1.0 "flavor" of XtIntrinsics. We ended-up padding all our "objects" with "RectObj" fields, initialized appropriately. ick, ick, ick. However, this WAS Motif R3++ code, and it WAS really bad. I looked at the R4 code several times, and it does NOT seem to have this problem (at least not THAT bad). UNLESS there is a "buggy" widget. The MIT code assumes that "Objects" will be "reasonable" and set_values will return redisplay = FALSE. It also assumes that constraint widgets will be "reasonable", and for "Object" children their constraint_set_values will return FALSE. So, if the objects in question are not buggy - no problem, as far as I can tell. However, the world is not a perfect place. Though I would like all the widgets to be perfect, I doubt it will ever happen. AS in this case XtIntrinsics can compensate for "buggy" widgets, I'd recomend to change the code as suggested. > It is not clear what the correct action is in this case. One > approach is to generate a synthetic expose event on the window > with an empty region. Why ? If there is a window/rectangle, XClearArea will do the job. There, however, is another, related problem. SetValues descends the class hierarchy top-down. If my widget's superclass said "yes, I need to redisplay", my widget has no way to change that - even though because of changed semantics my class in fact may not need to redisplay at all. So what I need is a tri-state return from SetValues: TRUE = this class does require redisplay FALSE = this class does not require redisplay UNDO = even if superclass required redisplay, it is not needed -- =*= Opinions presented here are solely of my own and not those of Auto-trol =*= Martin Brunecky {...}sunpeaks!auto-trol!marbru (303) 252-2499 (sometimes also: marbru@auto-trol.COM ) Auto-trol Technology Corp. 12500 North Washington St., Denver, CO 80241-2404