gnb@bby.oz.au (Gregory N. Bond) (05/16/91)
The Xt manual states that GCs obtained via XtGetGC() "must be treated as read-only" (sec 11.4). However, I have seen a couple of widgets that do something like this in the widget redraw routine: if (region) XSetRegion(XtDisplay(w), w->widget.GC, region); .... /* do the draw */ .... if (region) XSetClipMask(XtDisplay(w), w->widget.GC, None); often with code to set region=NULL if it is clear it covers most of the window. This doesn't seem to be read-only, but from the point of view of multiple widget instances that may share the GC, the clip region is always None when the routine is entered. It is clear that this code works, at least in my situation. Is it "legal" to do so? If not, how should complex widgets handle expose events if they cannot legally set the clipmask in shared GCs but still want to avoid flicker from a full redraw? Greg. -- 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
asente@adobe.com (Paul Asente) (05/16/91)
In article <1991May16.073250.14656@melba.bby.oz.au> gnb@bby.oz.au (Gregory N. Bond) writes: > >The Xt manual states that GCs obtained via XtGetGC() "must be treated >as read-only" (sec 11.4). However, I have seen a couple of widgets >that do something like this in the widget redraw routine: [code that temporarily changes the GC] >It is clear that this code works, at least in my situation. Is it >"legal" to do so? If not, how should complex widgets handle expose >events if they cannot legally set the clipmask in shared GCs but still >want to avoid flicker from a full redraw? This falls into a gray area. You won't get into trouble for doing it, at least in most cases, as long as you're careful not to do anything that lets Xt get back in control while you have changed the GC. It will completely hose you if you happen to be using multiple threads of control, but I suspect if you try to multithread an Xt interface (as opposed to having the interface controlled by one of several threads) that this will be the least of your problems. -paul asente asente@adobe.com ...decwrl!adobe!asente Ratz put a bucket of liquid in front of me. "I wanted a glass of docs, Ratz. What the hell is this?" I barked. "Motif don't fit in a glass anymore," he barked back. I looked at the liquid. It was totally opaque to me.