RISC OS Open
Safeguarding the past, present and future of RISC OS for everyone
ROOL
Home | News | Downloads | Bugs | Bounties | Forum | Documents | Photos | Contact us
Account

WindowManager Polling

WindowManager
» Technical Details
» Polling

Overview

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

Masking Events

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.

Null Events

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.

Revised on December 4, 2013 13:26:15 by Jeffrey Lee (213) (195.72.173.131)
Edit | Back in time (7 revisions) | See changes | History | Views: Print | Source | Linked from: WindowManager Technical Details

Search the Wiki

Social

Follow us on and

ROOL Store

Buy RISC OS Open merchandise here, including SD cards for Raspberry Pi and more.

Donate! Why?

Help ROOL make things happen – please consider donating!

RISC OS IPR

RISC OS is an Open Source operating system owned by RISC OS Developments Ltd and licensed primarily under the Apache 2.0 license.

Navigation

  • Home Page
  • All Pages
  • Recently Revised
  • Authors
  • Feeds
Site design © RISC OS Open Limited 2018 except where indicated
The RISC OS Open Instiki theme is based on Insitki's default layout

Valid XHTML 1.0  |  Valid CSS

Instiki 0.19.1(MML+)
This site runs on Rails

Hosted by Arachsys