Showing changes from revision #5 to #6:
Added | Removed | Changed
It is the shared responsibility of the Wimp and the application to ensure that windows on the screen are updated. The Wimp does not, after all, know what the contents of a window should be.
The Wimp is responsible for informing applications when a window needs to be redrawn and which part of a window is to be redrawn. It is the responsibility of an application actually to redraw the contents of a window.
When a window needs to be redrawn, it is quite possible that only part of the window needs to be updated, and hence the Wimp will inform the application which rectangular part(s) of a window needs to be redrawn. The Wimp splits these parts into non-overlapping rectangles so that the application can either;
An application receives notification that one of its windows needs redrawing by receiving a Redraw_Window_Request?Redraw_Window_Request event from the Wimp_Poll.
Upon notification, the application should enter a loop in which it checks with the Wimp which rectangular parts of a window need updating. The application itself must then take responsibility for updating each rectangular part of the window.
The snippet of pseudocode below shows how an application would deal with this.
REM block is the Wimp_Poll block SYS"Wimp_RedrawWindow",,block TO flag WHILE flag :REM Get each rectangular are needing updating Redraw contents of the appropriate rectangular part of a window SYS"Wimp_GetRectangle",,block TO flag ENDWHILE Return to polling loop
The block
returns values that are of use for updating a window. Full details are available in the Wimp_GetRectangle page.
The areas specified by the Wimp_RedrawWindow call are automatically cleared to the window’s background colour by the Wimp. The task must determine how to update the window’s contents,taking into account the visible work-area and scroll offsets.
The following operations should not be used within the redraw loop
By ensuring that these operations are excluded from the window redraw loop, the same code can be reused to draw the window’s contents to a printer.
A full description on improving redraw speed is available in the Redrawing Speed? section in the RISC OS Style Guide.