|
||
Manages access to the screen and input devices.
The phone's screen and input devices are shared resources for all running applications. The window server controls and co-ordinates access. For instance drawing is clipped to the application’s visible window, pointer events are only received if related to the application’s windows, and keyboard events are normally only given to an application with focus.
Note that much of the Window Server API is low-level and is encapsulated in the UI Control Framework API.
The API has the following key concepts: session
(RWsSession
), events (TWsEvent
),
window group (RWindowGroup
), drawable windows
(RWindow
), graphics (CWindowGc
,
CWsBitmap
and CWsScreenDevice
),
sprites and cursors (RWsSprite
and
RWsPointerCursor
), and animation client
(RAnim
).
The key classes are shown below:
A window server session allows an application to control and interrogate its windows, the events it wishes to receive, and all other window groups connected to the window server.
It is provided by RWsSession
.
Applications function by waiting for events and handling them. Common events are user input, and requests that windows be redrawn. The window server session is used to request and obtain events.
Most events (such as key and point events) are encapsulated in
TWsEvent
.
A redraw event tells the application what screen area needs
redrawing. It is encapsulated in TWsRedrawEvent
.
A window group is special non-displayable type of window, which can be considered as the root window of an application. Keyboard focus and events are associated with it, and it can have a name, used for such things as lists of running applications.
It is provided by RWindowGroup
.
Drawable windows allow applications to draw to the screen. They have operations to control size, position, visibility, scrolling, z-order, and parent/child relationships.
In a standard drawable window, areas that become invalid (e.g. when
an overlaying window is removed) must be redrawn by the client application. It
is provided by RWindow
.
A backed-up drawable window's content is stored by the window server,
and redrawn by the server when it becomes invalid. It is provided by
RBackedUpWindow
.
These window types are derived from a sequence of base classes,
RWindowTreeNode
, RWindowBase
, and
RDrawableWindow
.
Applications draw to drawable windows through a windows graphics context provided by a windows graphics device. These implement the abstract graphics context and graphics device interfaces respectively, as defined in the Graphics API.
The windows graphics context is provided by
CWindowGc
; the windows graphics device by
CWsScreenDevice
. The bitmap class,
CFbsBitmap
, is extended for most efficient use with the
window server by CWsBitmap
.
A sprite is an arbitrary-shaped bitmap that can be moved without applications having to redraw the underlying screen. It has one or more sprite members, each containing a bitmap image and a time interval for that bitmap to be displayed.
The sprite class is RWsSprite
; the sprite member
class is TSpriteMember
.
A specialised sprite type is provided for pointer cursors, which
automatically track the position of a pointer. It is provided by
RWsPointerCursor
.
Third-parties can write window server plug-in DLLs, as defined in the Animation API, that perform animations. Providers of such animation DLLs must also provide a client-side interface to allow applications to control the animation.
The base class for an animation client-side interface is
RAnim
.
Clients must request an animation DLL to be loaded before the
animations provided by it can be used. This is done through
RAnimDll
.