RISC OS Open
A fast and easily customised operating system for ARM devices
ROOL
Home | News | Software | Bugs | Bounties | Forum | Documents | Photos | Contact us
Account

The Window Manager Polling

Programmer's Reference Manuals
» Part 7 - The Desktop
» The Window Manager
» 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 January 26, 2010 11:21:29 by GavinWraith (26)? (127.0.0.1)
Edit | Back in time (6 revisions) | See changes | History | Views: Print | Source | Linked from: The Window Manager Technical Details

Search the Wiki

Commercial use

For commercial enquiries, please contact the owners of RISC OS, Castle Technology Ltd.

ROOL Store

The official C/C++ Development kit and more here.

Donate! Why?

Help ROOL make things happen – please consider donating!

Navigation

  • Home Page
  • All Pages
  • Recently Revised
  • Authors
  • Feeds
Site design © RISC OS Open Limited 2011 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