[fa.info-mac] Behaviour of InvalRect

info-mac@uw-beaver (12/18/84)

From: kato.SV@XEROX.ARPA

OK. Let's see if I've got it right this time. InvalRect just adds the
AREA of the rectangle to the update region and doesn't affect any kind
of drawing in it. The update event is NOT generated at that time. I have
a feeling it's generated by SystemTask seeing that a window's update
region is not empty. For this much I thank Art Pope, Ben Hyde, and
Robert White.

Now, I still have the problem that when I make a text window grow, the
text gets re-drawn in the window, but any old text on later lines does
not get erased. There is a global variable called paintWhite that should
be set to erase the window's update region BEFORE an update event is
generated. IM even asserts that several window manager routines set this
flag so if you want it cleared, you should keep re-clearing it. In my
code I call InvalRect with the portrect of the window, then call
Sizewindow with fUpdate true, then call TECalc. The InvalRect adds the
old rectangle to the update region, Sizewindow adds any new area to the
update region, therefore the update region should be set to the whole
window. If indeed paintWhite is set, the whole window should be erased
and I'd have no problem. It looks like IM is wrong. PaintWhite is NOT
set by default.

I will check it this weekend.

Kato.sv@Xerox.arpa

ech@spuxll.UUCP (Ned Horvath) (12/19/84)

Almost right.  the paintWhite flag affects what the Window Manager does
when a window gets EXPOSED as a result of a window in front of it being
closed, moved to the back, or moved.  I.e. the Window manager
	- paints the exposed area white, then
	- adds the exposed area to the invalid region with something that
	  might as well be InvalRect.

The other side of your problem is that TECalText and TEUpdate seem to be
a bit braindamaged about the precise case you describe (I have been here!).
i.e., the window gets WIDER, so there are fewer lines of text, but the 
no-longer-relevant stuff at the bottom stays.  Yecch.

Seems that in this case the ONLY option you have -- or at least, one that
works -- is to use EraseRect to clear window's portRect, then invoke
TEUpdate.

To reiterate: paintWhite ONLY affects regions the WMgr "knows" just got
exposed.

=Ned=

info-mac@uw-beaver (12/21/84)

From: kato.SV@XEROX.ARPA

Well, Paintwhite was indeed set (-1) so it seems to be a No-op. Does anyone
have the real scoop on this variable? I am now erasing the rectangle myself.

Of course, as soon as you hit a key, the rest of the rectangle is erased but
no update event is generated so I still think there's code in the ROMs that will
do what I want automatically. However it's not worth the effort to look for it.
(Sigh).

Kato.sv@Xerox.arpa