List of Examples

| Table of Contents | List of Figures | List of Examples | List of Tables |

Example 2-1. An event structure
Example 2-2. The XErrorEvent structure
Example 3-1. basicwin -- include files and declarations
Example 3-2. basicwin -- connecting to the server
Example 3-3. Code fragment for getting display dimensions -- using macros
Example 3-4. Another way to get window size -- using XGetGeometry()
Example 3-5. A third way to get window size -- using XGetWindowAttributes()
Example 3-6. basicwin -- creating a window
Example 3-7. basicwin -- creating an icon pixmap
Example 3-8. Format of bitmap files
Example 3-9. basicwin -- setting standard properties
Example 3-10. The XSizeHints structure
Example 3-11. basicwin -- selecting desired event types
Example 3-12. basicwin -- mapping the window
Example 3-13. basicwin -- processing events
Example 3-14. The XExposeEvent structure
Example 3-15. Handling Expose events for complex window contents
Example 3-16. basicwin -- the ConfigureNotify event
Example 3-17. Closing the display connection and freeing resources
Example 3-18. basicwin -- in its entirety
Example 4-1. The XSetWindowAttributes structure
Example 4-2. Setting window attributes while creating a window
Example 4-3. Changing window attributes of existing window
Example 4-4. Read-only XWindowAttributes members
Example 5-1. The GCValues structure
Example 5-2. Example of setting a GC while creating it
Example 5-3. Example of setting default GC then changing it
Example 5-4. Example of switching graphics contexts
Example 5-5. Code segment specifying five styles of dashed line in five GCs
Example 5-6. Setting line characteristics in a GC
Example 5-7. Members of XGCValues that control combining of source and destination pixels
Example 6-1. The draw_graphics routine
Example 6-2. Creating a stipple from included data and from data read from a file
Example 6-3. The load_font routine
Example 6-4. The XCharStruct structure
Example 6-5. The XFontStruct structure
Example 6-6. The XTextItem and XChar2b structures
Example 6-7. The draw_text routine
Example 6-8. The additional font property structure
Example 6-9. The XImage structure
Example 6-10. Example using images -- reflect_window
Example 6-11. Creating a Cursor from the standard cursor font
Example 6-12. Creating a Pixmap Cursor
Example 7-1. Specifying device-independent colors from a resource file
Example 7-2. Example entries from a client color database
Example 7-3. The XColor structure
Example 7-4. Allocating read-only colorcells
Example 7-5. Allocating read/write colorcells for dynamic colors
Example 7-6. Main of basic.rw -- changing colors of dynamic colorcells
Example 7-7. Using XAllocColorCells() to allocate read/write colorcells for overlay plane
Example 7-8. Using XAllocColorPlanes() to allocate colorcells for DirectColor
Example 7-9. The XVisualInfo structure
Example 7-10. Code to match visuals
Example 7-11. The XStandardColormap structure
Example 7-12. Code to create and use XA_RGB_BEST_MAP
Example 7-13. Calculating pixel values from floating point RGB values
Example 7-14. The XcmsColor structure
Example 7-15. Selected XcmsColor sub-structures
Example 7-16. Allocating device-independent colors
Example 7-17. Querying the screen gamut and allocating colors
Example 7-18. The ColormapEvent structure
Example 8-1. The XAnyEvent structure
Example 8-2. The XEvent union
Example 8-3. An event-handling loop
Example 8-4. An include file for printing the event type -- eventnames.h
Example 8-5. Printing the event type
Example 8-6. A predicate procedure and XIfEvent() call
Example 8-7. An example of selecting input
Example 9-1. The XKeyEvent structure
Example 9-2. Some sample keysym definitions
Example 9-3. Translating a key event to keysym and ASCII
Example 9-4. Implementing a dialog box
Example 9-5. Mapping keys to strings
Example 9-6. An application for server-wide keymapping
Example 9-7. Getting all motion events
Example 9-8. Using pointer motion hints
Example 9-9. The XTimeCoord structure
Example 9-10. Reading the motion history buffer
Example 9-11. Accepting button events in pairs
Example 9-12. Monitoring whether keyboard input will be available
Example 9-13. The XKeyboardControl() structure
Example 9-14. The XKeyboardState() structure
Example 10-1. Establishing the locale of an X application
Example 10-2. Creating an XFontSet
Example 10-3. The XFontSetExtents() structure
Example 10-4. The XmbTextItem() and XwcTextItem() structures
Example 10-5. Centering and drawing a multi-byte string
Example 10-6. The XTextProperty structure
Example 10-7. The XICCEncodingStyle type
Example 10-8.
Example 10-9.
Example 11-1. The XIM varargs interface and attribute naming conventions
Example 11-2. A nested call to XVaCreateNestedList()
Example 11-3. Establishing the locale and opening an XIM
Example 11-4. The XIMStyles structure
Example 11-5. Choosing an interaction style and creating an IC
Example 11-6. Negotiating Preedit and Status area geometries
Example 11-7. The XIMCallback structure
Example 11-8. A prototype XIM callback procedure
Example 11-9. The XIMPreeditDrawCallbackStruct
Example 11-10. The XIMPreeditCaretCallbackStruct
Example 11-11. The XIMStatusDrawCallbackStruct
Example 11-12. Selecting events for an IM and using XFilterEvent() in an event loop
Example 11-13. Looking up internationalized input
Example 11-14. Performing internationalized text input: a complete program
Example 12-1. The XSizeHints structure
Example 12-2. The XWMHints structure
Example 12-3. The icon hints elements of the XWMHints structure
Example 12-4. The XClassHint structure
Example 12-5. The XIconSize structure
Example 12-6. The XTextProperty structure
Example 12-7. Setting the primary selection to a line number
Example 12-8. Code to ensure transfer of selection ownership
Example 12-9. The XSelectionRequestEvent structure
Example 12-10. The XSelectionEvent structure
Example 12-11. The XSelectionClearEvent structure
Example 13-1. Handling program options with XGetDefault()
Example 13-2. Processing geometry option using program resource specifications file
Example 13-3. The resource file XMail-color.
Example 13-4. A user defaults file for color and monochrome screens
Example 13-5. A simple resource database file
Example 13-6. The XrmValue structure
Example 14-1. basecalc -- include files
Example 14-2. basecalc -- the main
Example 14-3. A sample .Xdefaults file
Example 14-4. basecalc -- the parseOpenDisp routine
Example 14-5. XrmOptionDescRec, XrmOptionDescList, and XrmOptionKind declarations
Example 14-6. basecalc -- the GetUsersDataBase routine
Example 14-7. basecalc -- the extractOpts routine
Example 14-8. basecalc -- the Usage routine
Example 14-9. basecalc -- declarations for initCalc
Example 14-10. basecalc -- the initCalc routine
Example 14-11. basecalc -- the selectEvents routine
Example 14-12. basecalc -- the takeEvents routine
Example 14-13. basecalc -- the drawButton routine
Example 15-1. Reading a property
Example 15-2. Writing a property
Example 15-3. The XHostAddress structure
Example 15-4. Using the XlibSpecificationRelease symbol
Example 16-1. winman -- main C program
Example 16-2. Using event-getting routines together
Example 16-3. winman -- the paint_pane routine
Example 16-4. winman -- the circle up and circle down routines
Example 16-5. winman -- the raise and lower routines
Example 16-6. winman -- the move and resize routines
Example 16-7. The draw_box routine
Example 16-8. winman -- the iconify routine
Example 16-9. winman -- the isIcon routine
Example 16-10. winman -- the makeIcon routine
Example 16-11. winman -- the getDefaultIconSize and getIconName routines
Example 16-12. winman -- the finishIcon routine
Example 16-13. winman -- the removeIcon routine
Example 16-14. winman -- the focus routine
Example 16-15. winman -- the draw_focus_frame routine
Example 16-16. winman -- the execute routine
Example 16-17. winman -- code for assisting execution of shell commands
Example A-1. Sample fonts.alias file
Example A-2. fonts.dir file in /usr/lib/X11/fonts/100dpi
Example A-3. X font paths containing font servers
Example A-4. Listing scalable fonts
Example A-5. Finding derived instances of scalable fonts
Example A-6. Font name patterns that don't match scaled fonts.
Example A-7. Determining if a font is scalable
Example A-8. Loading a derived instance of a scalable font
Example B-1. The Vertex structure for XDraw
Example B-2. draw_box implemented with X Version 10 XDraw
Example D-1. The complete basecalc.h file
Example D-2. Remaining code for basecalc
Example E-1. XEvent union and XAnyEvent structure