[[!redirects The Window Manager Redrawing Windows]] h6. [[WindowManager]] h6(. » [[WindowManager Technical Details|Technical Details]] h6((. » Redrawing Windows h2(#overview). Overview 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; # efficiently update only the rectangular parts of a window # simply, but inefficiently, update the whole window in one go An application receives notification that one of its windows needs redrawing by receiving a [[Redraw_Window_Request]] event from the [[Wimp_Poll|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. <pre> 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 </pre> The <code> block </code> returns values that are of use for updating a window. Full details are available in the [[Wimp_GetRectangle|Wimp_GetRectangle]] page. The areas specified by the [[Wimp_RedrawWindow|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. h4. Important The following operations should not be used within the redraw loop * [[Wimp_BlockCopy|Wimp_BlockCopy]] should only be used outside of the redraw loop to move an area of the work-area; * EOR operations should only be used when updating a dragged object within a window, and not the window's contents themselves. 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. h4. See also A full description on improving redraw speed is available in the [[Style Guide Redrawing Speed|Redrawing Speed]] section in the RISC OS [[Style Guide|Style Guide]].