Notification Ordering

[This is preliminary documentation and subject to change.]

Order is important: applications should always perform the stages of an alert in the following order:

  1. Adjust the visual presentation of the object (for example, change the icon to red)
  2. Set the alert level state flag for the object (the icon object)
  3. Send any appropriate events related to the appearance change (for example, APPEARANCECHANGE or OBJECTCREATE for the icon object)
  4. Send the ALERTLEVELCHANGE event with a reference to the object that is presenting the alert (for example, the icon object)
  5. When the client receives the ALERTLEVELCHANGE event it should be able to query the alert status of the referenced object immediately.

The same thing is repeated if and when the object is changed to no longer be in the alert state. For example, when the battery indicator icon changes to yellow, its STATE_SYTEM_ALERT_MEDIUM flag is set, and the EVENT_SYSTEM_ALERTLEVELCHANGE message has been sent referencing this icon object. When the indicator changes back to green, its STATE_SYSTEM_ALERT_MEDIUM flag is cleared (so that none of the alert flags are set), and another EVENT_SYSTEM_ALERTLEVELCHANGE message is sent. A client receives this event, checks the icon object's state flags, finds that none are set, and realizes that this notification indicated that the alert level on this object has completed.