Next: 2.5.1 Expose Handling Up: 2 Example Walk Through Previous: 2.4 View Selection

2.5 Event Dispatching

Now the window has been created, the OpenGL renderer has been bound to it, the display lists have been constructed, and OpenGL's state has been configured. All that remains is to request the window be mapped using XMapWindow and begin handling any X events sent to the program.

When the window was created, four types of window events were requested to be sent to our application: Expose events reporting regions of the window to be drawn, ButtonPress events indicating mouse button status, KeyPress events indicating a keyboard key has been presed, MotionNotify events indicating mouse movement, and ConfigureNotify events indicating the window's size or position has changed.

X event dispatching is usually done in an infinite loop. Most X programs do not stop dispatching events until the program terminates. XNextEvent can be used to block waiting for an X event. When an event arrives, its type is examined to tell what event has been received.



mjk@asd.sgi.com
Wed Oct 19 18:11:46 PDT 1994