The Window Server and Quartz

The Mac OS X Window Server manages the screen (or screens), the keyboard, and the mouse. Unlike the X Window Server and the NeXTSTEP Display PostScript Window Server, the Mac OS X Window Server is lightweight — it doesn’t actually do the drawing itself. Instead, its primary role is to manage which regions of the screen each application is allowed to use, and to allow the applications to do their own drawing. The main job of the Window Server, then, is to assure that programs draw in their own rectangular piece of real estate on the screen, and to see to it that events destined for one program aren’t accidentally sent to another.

The Window Server frees you from having to worry about interactions between your program and other programs that are running simultaneously. For all intents and purposes, you can design your program as if it is the only one running.

The actual drawing on the Mac OS X screen is done with Quartz. Most Cocoa applications use Quartz to draw to an off-screen buffer that is flushed to the screen when the drawing is finished. This buffer is shared between the application and the Window Server using the Mach virtual memory system, making it very fast.

The Quartz system has native support for Adobe’s Portable Document Format (although Apple’s implementation of PDF doesn’t actually use any of Adobe’s code, for licensing reasons). As a result, Quartz can both display and generate PDF files. Quartz can display text in any font size and ...

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.