The Symbian OS (779886), страница 43
Текст из файла (страница 43)
(Note that devices may also have multiplephysical displays.)A window is an abstraction for making a screen region available to anapplication for interaction. A window abstracts a region of the physicalscreen. From the perspective of an application developer, a window isa screen region in which an application view can be constructed. Todraw into the window area, and to receive user input, applications createcontrols inside windows and the controls become the units of interaction.Applications are, by definition, window-owning processes. Applications may create and destroy windows, may have many windows, andmay switch between them. Application windows form a window group.The first application window in a group is the top client window and anapplication must have at least one of these in order to display. Windowsallow applications to display and have screen modes (e.g.
color depth), adrawing area, and so on.Logically, windows are maintained in a window stack, implying thatthey have a ‘Z’ order which is enforced by clipping; windows higher inthe stack hide windows lower in the stack. Windows come in and outof focus (i.e. have the focus of the user) and, typically, the window atthe top of the stack is the window which currently has focus. (A windowgroup, however, may choose not to receive focus.)By default, windows are the size of the full screen (less any areareserved for device status bars, control button arrays, or similar systemowned screen resources). Therefore, windows do not overlap but hideeach other, a design optimized for small-screen devices (but a policywhich is ultimately determined by the variant user interface running on agiven device).In implementation terms, a window is an ‘R’ class (RWindow) objectreturned by the Window Server to a client opening a window subsessionin a Window Server session.From an application perspective, most of the Window Server functionality is abstracted through the Control Environment and is made availableto applications through the APIs provided to create and manipulatecontrols.
Thus while applications need some knowledge of the windowing model, the window methods are provided through the ControlEnvironment, not from the Window Server explicitly.The Window Server is a system server that is started by the SystemStarter at boot time and runs until system shutdown. Only when theWindow Server is running and providing access to the screen and events,can the Application and UI Frameworks be started, and only then can thephone application be run.The Window Server is also responsible for starting some servers atstartup and it provides the plug-in interface for animation (see Chapter 7).(It also provides other plug-in interfaces, for example the RSoundPlug-ininterface. The Keyclickref plug-in is an example implementation of aMULTIMEDIA AND GRAPHICS SERVICES BLOCK183Window Server key-click plug-in library, which provides the audibleclicks for keystroke events.)The Window Server has a number of responsibilities:• implementing client-side buffering of windowing commands to minimize calls across process boundaries between client and server, whileenabling fine-grained control by the client (which can flush the buffer)• managing bitmapped drawing via the Font and Bitmap Server• managing the clipping and valid or invalid regions of screen, forexample, when part of the screen becomes uncovered by somewindow• managing system-initiated redraw events, window stacking (Z-order),etc.• providing backed-up windows as a special case for applications thatlack the ability to manage their own redrawing efficiently• handling special effects including shadowing and animation.Event handling is based around the RequestEvent active object,which the Window Server uses to get events from the kernel, once it hasregistered itself as the default event handler.
Event types include digitizerand pointer events, keyboard events, and some other hardware events(including switch off, case open and case close, which are legacies ofthe early device architecture of the Series 5, a clamshell device in whichclosing the case caused the device to suspend and opening it caused thedevice to resume operation).Window Server processes these events and passes processed eventsto clients. Thus, for example, pointer events may be translated intofocus events or other logical events.
Window Server may also performrotation and other logical processing or scaling of screen coordinatesfor generated events (some devices support multiple screen orientations;others support full and ‘flip’ mode sizes). It performs key events andlogical key events, including translations that are implemented by FrontEnd Processor (FEP) plug-ins, for example to translate pointer events onan on-screen soft keyboard to logical keyboard events; to translate scancodes to character codes for physical key events; and to interpret hotkey events and combinations. Window Server also initiates events, forexample redraw events, and manages the event queues for clients. Eachclient has its own queues.The Window Server also supports a direct access (DSA) drawingmode, which bypasses the server itself but still enables an application todetermine which screen region it owns (so that it does not overwrite otherapplications or system components which may have visible elementson the screen).
The DSA framework notifies Window Server when it isinvoked (but otherwise the Window Server is not directly involved).184THE OS SERVICES LAYERThe Window Server has been a central part of Symbian OS sincethe beginning but has seen many enhancements in subsequent releases,including semi-transparent windows, multiple screens, double buffering,and a configurable origin and scaling factor for windows (supportingrotated screens and flexible screen size).Fonts and BitmapsFrom the perspective of the graphics system, all graphics devices arebitmap devices. All bitmapped graphics services and font services, including printing support, are managed by the Font and Bitmap Server.
It ownsthe graphics devices and serializes client access to them (whether clientsare applications or other system services). All access therefore to thescreen or to printers and all bit-oriented screen operations, includingfont operations, are conducted through a client session with the Fontand Bitmap Server, within a bitmapped device context. The Font andBitmap Server also ensures that screen operations are efficient by sharingsingle instances of fonts and bitmaps between its multiple clients. It alsoprovides the framework for loading bitmap and vector fonts.While the Font and Bitmap Server owns the graphics devices, the BitGraphics Device Interface (GDI) actually rasterizes drawing to bitmappeddevices. Bit GDI implements the concrete instances of bitmappedgraphics contexts, from the basic device abstractions providing hardwareindependent access to display devices and screen attributes using a varietyof graphics primitives.
Bit GDI also provides transparency support (alphablending).Font management is delegated to Font Store, which manages all fontsin the system, both native Symbian OS format bitmapped fonts (glyphfonts) and open vector fonts, and performs closest-fit matching of fontrequests. Font Store provides APIs for storing, querying and retrievingbitmapped fonts and all properties of glyph fonts. Vector fonts are drawnby the FreeType Font Rasterizer and the available vector fonts are vendordependent. (Symbian OS includes a reference implementation of theFreeType rasterizer and reference bitmap fonts.
Licensees may chooseto replace the FreeType implementation with one of production qualityor may omit it and replace the reference bitmap fonts with their ownbespoke fonts.)FreeType supports FreeType 2 TrueType fonts. On small-displaydevices, and on phones in particular, carefully optimized bitmap fontsoffer a more optimal font solution than standard vector fonts.WYSIWYG printing is provided by the Printer Driver Support printingframework, which stores and manages printer drivers and manages accessto and mapping of printer ports, and for which reference implementationsof concrete printer ‘driver’ plug-ins (type: PDR) are provided.