Chapter 27. X Window Programming

Non-graphical programs tend to follow the programmer's choice of events, accepting user input only when it is convenient for the program. An update process will chug through a database and wait for the user's input only when it has called fgets(3), for example. Once control has returned from fgets(3) with the input, however, any additional user input is ignored as the update proceeds.

Another program that puts up a text-based screen is also program directed. The user must provide input that is suitable for the field where the cursor is. As the cursor moves to other input fields, the input data provided must obey content rules for those fields. These are examples of a program telling the user what input to provide and when it must be provided.

Graphical user interfaces use a different processing paradigm. Event-driven programming has a program constantly waiting for user input events. Processing occurs briefly only after these user-input events have been received by the program. The user is able to choose where to input text with a mouse click or a tab key. Alternatively, the user may use the mouse to draw, causing numerous input events to occur.

This chapter will examine event-driven programming as it applies to X Window graphics. The intention of this chapter is to

  • Illustrate event-driven programming

  • Introduce X Window graphics programming

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.95.38