Within each Multi-tasking application there must be a polling loop. It is the polling loops duty to respond to events. An event can either be user generated or from the Operating System itself.
An application calls the SYS"Wimp_Poll"? routine to identify if there are any events pending for it. The output from this routine varies depending on the events.
The output takes the form of a block of information that contains an event number and specific information relating to the event.
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 pseudo code 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 which event codes will not be responded by your application in advance. This stops the Window Manager from passing control to your application if it is simply going to ignore them. This method is called Masking.
The upside of masking is that it improves the efficiency of the application, and ensures a more responsive experience for the user.
Note: Some events cannot be masked, as it is vital that an application responds to them. An example of this is the Open_Window_Request?.
Null events is simply a fancy name to specify that no events have been detected since the last time it was polled.
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.