Showing changes from revision #7 to #8:
Added | Removed | Changed
Within each Multi-tasking application there must be a polling loop. It is the polling loop’s duty to respond to events. An event can be generated by either the user or the Operating System itself.
An application calls its own polling routine to discover if there are any events pending for it. The event is returned in register R0, and other data, depending on the event, are returned in the message block whose address is returned in R1.
The application can utilize the polling routine to execute some code ‘in the background’. For example, a clock application may update the clock display if no more pressing events are pending.
A pseudocode version of Polling routine may look like:
SYS"Wimp_Initialise" finished = FALSE DIM blk 255 REPEAT SYS"Wimp_Poll",0,blk TO event CASE event OF WHEN 0:... Null_Reason_Code WHEN 1:... Redraw_Window_Request ... etc. ENDCASE UNTIL finished SYS"Wimp_CloseDown" End Application
It is also possible to specify that your application is not interested in certain events. This stops the Window Manager from passing control needlessly to your application when these events occur. This method is called Masking.
Masking improves the efficiency of the system, and ensures a more responsive experience for the user.
Note: Some events cannot be masked, as it is vital that an application respond to them. An example of this is the Open_Window_Request.
The Null Event is returned by the wimp (unless masked) if no events have occurred since the last poll.
If your application does not need to respond to null events (i.e. responding to no events) then you should mask it out to improve efficiency.
If you do need to respond to null events you should use Wimp_PollIdle rather than Wimp_Poll, unless the user is directly involved (e.g. when dragging an object) and responsiveness is important.