Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!munnari.oz.au!metro!usage.csd.unsw.oz.au!sphinx!pta!yarra!melba.bby.oz.au!gnb From: gnb@bby.oz.au (Gregory N. Bond) Newsgroups: comp.windows.x Subject: BUG: XtSetValues assumes all non-widgets are RectObjs Message-ID: <1991Apr17.073327.12784@melba.bby.oz.au> Date: 17 Apr 91 07:33:27 GMT Sender: usenet@melba.bby.oz.au (news READER id) Organization: Burdett, Buckeridge and Young Ltd. Lines: 77 Nntp-Posting-Host: leo-gw [This has been sent to xbugs] X Window System Bug Report xbugs@expo.lcs.mit.edu VERSION: R4, MIT tape patched to fix-18 CLIENT MACHINE and OPERATING SYSTEM: Any DISPLAY TYPE: Any WINDOW MANAGER: Any AREA: Xt SYNOPSIS: XtSetValues assumes all non-widget objects are RectObjs DESCRIPTION: 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, but perhaps I am just lucky with the data I have in the "rectangle" fields (they overlap 2 Pixel values and an integer in the subclass I am using, which means XtSetValues was seing x=, y=0, width=, height=0, borderwidth=0). 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. The fix below handles it by just not doing any redraws for changes on non-RectObj objects. Whatever is chosen will need to be documented! REPEAT BY: Examine the source code! SAMPLE FIX: *** SetValues.c.DIST Wed Apr 17 17:16:24 1991 --- SetValues.c Wed Apr 17 17:17:35 1991 *************** *** 262,268 **** if (redisplay && XtIsRealized(w) && !w->core.being_destroyed) XClearArea (XtDisplay(w), XtWindow(w), 0, 0, 0, 0, TRUE); } else { /*non-window object */ ! if (redisplay && ! cleared_rect_obj ) { Widget pw = _XtWindowedAncestor(w); if (XtIsRealized(pw) && !pw->core.being_destroyed) { RectObj r = (RectObj)w; --- 262,268 ---- if (redisplay && XtIsRealized(w) && !w->core.being_destroyed) XClearArea (XtDisplay(w), XtWindow(w), 0, 0, 0, 0, TRUE); } else { /*non-window object */ ! if (XtIsRectObj(w) && redisplay && ! cleared_rect_obj ) { Widget pw = _XtWindowedAncestor(w); if (XtIsRealized(pw) && !pw->core.being_destroyed) { RectObj r = (RectObj)w; -- Gregory Bond, Burdett Buckeridge & Young Ltd, Melbourne, Australia Internet: gnb@melba.bby.oz.au non-MX: gnb%melba.bby.oz@uunet.uu.net Uucp: {uunet,pyramid,ubc-cs,ukc,mcvax,prlb2,nttlab...}!munnari!melba.bby.oz!gnb