The Window Manager helps your application keep the window display current by maintaining an update region, which represents the parts of your content region that have been affected by changes to the desktop. If a user exposes part of an inactive window by dragging an active window to a new location, for example, the Window Manager adds the newly exposed area of the inactive window to that window's update region.
When your application calls the Event Manager function WaitNextEvent and there are no events queued, the Event Manager scans the update regions of all windows on the desktop. If it finds one whose update region is not empty, it generates an update event for that window. When your application receives an update event, it redraws as much of the content area as necessary. Note that your application can receive update events when it is in either the foreground or the background.
Your application can force and suppress update events by manipulating the update region using Window Manager functions provided for this purpose.
You can remove an area from the update region by calling either of the functions ValidWindowRect or ValidWindowRgn , when you know that the area is in fact valid. Limiting the size of the update region decreases the time that your application spends redrawing window content in response to update events.
The functions ValidWindowRect and ValidWindowRgn each inform the Window Manager that an area of a window no longer needs to be redrawn. The functions are, respectively, similar to the earlier Window Manager functions ValidRect and ValidRgn , but the Mac OS 8.5 functions allow the window that they operate upon to be explicitly specified, instead of operating on the current graphics port, so they do not require the graphics port to be set before their use.
You can add an area to the update region by calling either of the functions InvalWindowRect or InvalWindowRgn . Each function informs the Window Manager that an area of a window should be redrawn.