The Quartz Window Server

The Quartz Window Server is the part of the Mac OS X operating system that manages the location of windows on the computer’s screen and organizes the flow of events from the mouse and the keyboard. While the Window Server is mostly transparent to you as a programmer, you will occasionally see behavior in Mac OS X that is very different from what you might experience in Mac OS 9 or in Windows, and it’s important to understand why. For example, you can still move the windows of a Mac OS X application that is trapped inside an infinite loop (i.e., “hung”), because the moving of the windows is done by the Window Server itself, not by the application. Another result of the Window Server is that if you wish to draw on the screen, you must draw on a window — you cannot draw on the screen’s background itself.[36]

Quartz uses a mechanism called graphics context to present each Quartz client program with its own independent copy of the Quartz environment. NSViews can also have their own graphics contexts. A graphics context can be thought of as a “virtual printer.” Each has its own independent set of resources for drawing. You may have noticed on some Macs running Mac OS 9 that when you switch from one application to another, the colors of the application windows change. That sort of change never happens on Mac OS X, because the colors of each window are completely independent of one another.

Buffered, Retained, and Nonretained Windows

The underlying communication ...

Get Building Cocoa Applications: A Step by Step Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.