Mac OS X Internals: A Systems Approach

2.12. User Interface

Aqua is the cornerstone of visual user experience in Mac OS X. It is not one or more specific applications, libraries, or APIs but a set of guidelines that describe the look-and-feel, behavior, and integration of GUI elements. Besides user-interface guidelines, the Mac OS X user experience also depends on applications using recommended technologies in their implementations. Mac OS X application environments that support GUI-based applicationsCarbon, Cocoa, and Javaall provide the Aqua look-and-feel.[60] The Interface Builder assists programmers in laying out user-interface elements in accordance with interface guidelines.

[60] As we saw earlier, Mac OS 9 applications running under Classic retain their original look-and-feel because Classic does not conform to Aqua.

The X Window System and Aqua

In the X Window System, the window manager is an X application that is a client of the X Window server. We saw earlier in this chapter that the Mac OS X implementation of the X Window System includes a window manager (quartz-wm) that provides the Aqua look-and-feel.

However, only certain visual and behavioral aspects of an X Window applicationspecifically those controlled by the window managerwill benefit from Aqua. The application's own look-and-feel will depend on the specific widget set being used.

The Mac OS X user interface has several distinctive features, many of which depend on the features of the available graphics hardware. Let us look at the important user-interface features.

2.12.1. Visual Effects

Aqua uses animation, color, depth, translucence, textures, and photorealistic icons rendered at various sizes up to 256x256 pixels,[61] making possible a visually appealing interface. Icon images at various sizes are contained in .icns files.

[61] Mac OS X 10.4 added support for 256x256 pixel icons.

You can use the Icon Browser application (icns Browser.app), which is installed as part of Apple Developer Tools, to view the contents of .icns files. Use the Icon Composer application (Icon Composer.app) to create .icns filesfor example, from arbitrarily sized images in various formatsby simply dragging the images[62] to the Icon Composer window.

[62] An icon usually has an associated "mask" used to designate certain parts of the icon as transparent, allowing arbitrarily shaped icons to be generated. You can specify the data and mask components of the icon by dragging an image for each, or Icon Composer can automatically calculate the mask based on the data image.

2.12.2. Resolution-Independent User Interface

Beginning with Mac OS X 10.4, Aqua is resolution-independent. The system supports multiple scaling modes: framework scaling mode, application scaling mode, and magnified mode. Each mode provides support in applying scaling factors to rendered graphics.

In framework scaling mode, the graphics subsystem in usesuch as the Application Kit (Cocoa) or HIView (Carbon)automatically handles most of the scaling. For example, the relevant frameworks will automatically scale user-interface elements, apply scaling transforms to rendered content, increase the size of window buffers, and so on.

In application scaling mode, the application must handle scaling of rendered content. The frameworks will still scale system-defined user-interface elements, such as menus and title bars.

In magnified mode, the window server will simply create a magnified view of the image by applying a scaling factor to the window buffer. This is essentially a digital zoomthere is no gain in image detail while zooming in since pixel data is simply being interpolated to a new size.

You can experiment with user-interface resolution scaling by using the Quartz Debug application (Quartz Debug.app), which allows you to vary the scaling factor from its default value of 1. Quartz Debug is a part of Apple Developer Tools.

2.12.3. Productivity Features

Mac OS X includes several user-interface features that enhance user experience, for example: in-place document preview, in-icon status indication,[63] instant access to any open window with a single keystroke (Exposé), fast user switching, Dashboard, and the user interface to Spotlight.

[63] Applications can superimpose information on their icons to convey it to the user. For example, Apple's Mail application uses a status indicator in its icon to display the number of unread messages.

2.12.3.1. Fast User Switching

Newer versions of Mac OS X include support for switching between users rapidly through the fast user-switching feature. With this feature, a user's session remains active "behind the scenes" while another user accesses the computer in an independent GUI session using the mouse, keyboard, and display. Multiple users can switch in this manneronly one user remains the "current" user, and everybody else's session remains intact in the background. Note that if there is an application that does not run correctly when multiple instances of that application are run, and multiple users attempt to run such an application, fast user-switching may cause problems. Mac OS X 10.4 added support for making operations such as logging out, shutting down, and restarting the system faster and less cumbersome.

2.12.3.2. Dashboard

Dashboardintroduced in Mac OS X 10.4is an environment for running lightweight desktop utilities called widgets.[64] Dashboard widgets are confined to a special layer of the Mac OS X desktop that is hidden from view until activated by the user. When activatedfor example, through a predefined key combination[65]the Dashboard layer is overlaid on top of the normal Desktop, providing rapid access to the currently selected widgets. Deactivating Dashboard hides the widget layer.

[64] Technically, Dashboard is an application environment, the "applications" being widgets.

[65] The default key assigned to Dashboard is F12.

2.12.3.3. Spotlight

Although it is a file system technology, Spotlight is an important addition to the Mac OS X user interface since it fundamentally changes how users access files. The Spotlight metadata search technology roughly encompasses three distinct pieces of functionality:

  1. An in-kernel notification mechanism that can inform user-space subscribers of file system changes as they occur

  2. A database of various types of file-related informationin particular, of harvested metadata

  3. The programmer and end-user interfaces to Spotlight

A user-space Spotlight server subscribes to receive file system changes from the kernel. It can gather metadata from documents and other relevant user files, both dynamically (as files are created or modified) and statically (by scanning for files). It incorporates the harvested metadata into a searchable lightweight database. Spotlight's integration with the Finder provides a powerful search mechanism to the user. Moreover, the Finder can use file metadata to display additional relevant information about files.[66] The Spotlight search API allows searching for files programmatically by using database-style queries. Spotlight is extensible by third-party developers: If an application uses a custom file format, it can provide a Spotlight importer plug-in that will parse the application's documents and gather metadata.

[66] For example, in the case of a PDF document, the PDF file's metadata may contain attributes such as the document's title, author, number of pages, page dimensions, creator application, and summary. The Finder and Spotlight search results window can display these attributes.

2.12.4. Universal Access Support

Mac OS X supports several accessibility technologies and features, such as those listed here.

  • Enhanced Contrast can be varied through the ctrl-cmd-option-, and ctrl-cmd-option-. key combinations.

  • Full Keyboard Access allows the keyboard to be used for navigating and interacting with on-screen items.

  • Grayscale Mode can be toggled through a checkbox in the Seeing pane of the Universal Access system preference.

  • Inverted Colors Mode can be toggled through the ctrl-cmd-option-8 key combination.

  • Mouse Keys allows controlling the mouse pointer using the numeric keypad.

  • Screen Zooming allows increasing the size of on-screen elements. It can be turned on or off through the cmd-option-8 key combination. Once the feature is enabled, you can zoom in and zoom out using cmd-option-+ and cmd-option--, respectively.

  • Speech Recognition allows the user to speak commands rather than type them. When this feature is enabled, the computer will listen for commands and, if recognized, act on them.

  • Sticky Keys allows the user to press a set of modifier keys as a sequence, rather than having to press several keys at once.

  • Text-to-Speech enables the computer to speak the text in dialogs and alert messages.

  • VoiceOver provides spoken user-interface featuresthat is, it describes what is happening on the screen. It can be turned on or off through the cmd-F5 key combination.

Accessibility features can be controlled through the Universal Access pane in the System Preferences application.

Two of the most important Mac OS X frameworks, Carbon and Cocoa, automatically provide several accessibility features to applications.

Категории