The window server maintains the screen display taking into account the region, ordinal position, visibility and shadow requirements of all displayable windows. The display may be updated for several reasons:
at direct application request by an application drawing to a window through a CWindowGc
as an indirect consequence of application action, due to regions of the display becoming invalid
due to actions internal to the window server, such as pointer cursor movement, or action by an animation DLL
All window server applications must be able to perform application-initiated drawing. Most also need to handle redraws due to regions of their windows becoming invalid.
When an application model changes, as a result of a user command or some other reason, it may be necessary for that application to update the display. In this case, the application initiates a draw sequence to one or more of its windows. When this draw sequence has finished on a particular window, that window will be a valid reflection of the model.
When a window is moved, resized, or otherwise manipulated by an application, it may cause parts of other windows to become invalid so that they must be redrawn. The window server maintains a list of all invalid regions and causes them to be redrawn in one of several ways:
for a region with no window, the window server redraws the invalid region in the default background color: the region is then valid again
for a blank window, the window server redraws the invalid region in the window’s color: the region is then valid again
for a backed-up window, the invalid region is redrawn from a backup bitmap maintained by the window server: the region is then valid again
if the invalid region is invalid because an overlay window has just exposed the area, the window server redraws the region from the overlay bitmap: the region is then valid again
if the invalid region is owned by an animation DLL, the window server invokes the animation DLL directly to redraw the area: the region is then valid again
for a normal RWindow
, the window server generates a redraw event and sends it to the application.
This latter case requires the application to redraw the region of the RWindow
that is now invalid. All applications which use RWindow
s must be able to redraw reliably.