the application interface. The application then begins its main run loop and begins accepting input from the user. When users click or drag the mouse or type on the keyboard, the window server detects and processes these actions, passing them to the application as events. Events sent to the application by the window server are placed on a queue in the order they are received. On each cycle of the run loop, NSApp processes the topmost event in the queue, as shown in Figure 8-2. When NSApp finishes processing the event, it gets the next event from the queue and repeats the process again and again until the application terminates. NSEvent NSApplication NSEvent NSEvent NSWindow Window Server NSEvent NSView Figure 8-2. The event queue Responders Recall that when we introduced the core program framework of NSWindow, NSView, and NSApplication in Chapter 6, we mentioned that each of these classes inherits