Skip to content

X Toolkit Intrinsics - C Language Interface

X Window System

Joel McCormack

Digital Equipment Corporation
Western Software Laboratory

Paul Asente

Digital Equipment Corporation
Western Software Laboratory

Ralph R. Swick

Digital Equipment Corporation
External Research Group

X Version 11, Release 7.7

XWindow System is a trademark of X Consortium, Inc.

Copyright © 1985, 1986, 1987, 1988, 1991, 1994 X Consortium

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium.

Copyright © 1985, 1986, 1987, 1988, 1991, 1994 Digital Equipment Corporation, Maynard, Massachusetts.

Permission to use, copy, modify and distribute this documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appears in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Digital makes no representations about the suitability of the software described herein for any purpose. It is provided "as is" without express or implied warranty.


Acknowledgments

The design of the X11 Intrinsics was done primarily by Joel McCormack of Digital WSL. Major contributions to the design and implementation also were done by Charles Haynes, Mike Chow, and Paul Asente of Digital WSL. Additional contributors to the design and/or implementation were:

Loretta Guarino-Reid (Digital WSL)Rich Hyde (Digital WSL)
Susan Angebranndt (Digital WSL)Terry Weissman (Digital WSL)
Mary Larson (Digital UEG)Mark Manasse (Digital SRC)
Jim Gettys (Digital SRC)Leo Treggiari (Digital SDT)
Ralph Swick (Project Athena and Digital ERP)Mark Ackerman (Project Athena)
Ron Newman (Project Athena)Bob Scheifler (MIT LCS)

The contributors to the X10 toolkit also deserve mention. Although the X11 Intrinsics present an entirely different programming style, they borrow heavily from the implicit and explicit concepts in the X10 toolkit.

The design and implementation of the X10 Intrinsics were done by:

Terry Weissman (Digital WSL)
Smokey Wallace (Digital WSL)
Phil Karlton (Digital WSL)
Charles Haynes (Digital WSL)
Frank Hall (HP)

The design and implementation of the X10 toolkit’s sample widgets were by the above, as well as by:

Ram Rao (Digital UEG)
Mary Larson (Digital UEG)
Mike Gancarz (Digital UEG)
Kathleen Langone (Digital UEG)

These widgets provided a checklist of requirements that we had to address in the X11 Intrinsics.

Thanks go to Al Mento of Digital’s UEG Documentation Group for formatting and generally improving this document and to John Ousterhout of Berkeley for extensively reviewing early drafts of it.

Finally, a special thanks to Mike Chow, whose extensive performance analysis of the X10 toolkit provided the justification to redesign it entirely for X11.


Joel McCormack
Western Software Laboratory
Digital Equipment Corporation
March 1988

The current design of the Intrinsics has benefited greatly from the input of several dedicated reviewers in the membership of the X Consortium. In addition to those already mentioned, the following individuals have dedicated significant time to suggesting improvements to the Intrinsics:

Steve Pitschke (Stellar)C.Doug Blewett (AT&T)
Bob Miller (HP)David Schiferl (Tektronix)
Fred Taft (HP)Michael Squires (Sequent)
Marcel Meth (AT&T)JimFulton (MIT)
Mike Collins (Digital)Kerry Kimbrough (Texas Instruments)
Scott McGregor (Digital)Phil Karlton (Digital)
Julian Payne (ESS)Jacques Davy (Bull)
Gabriel Beged-Dov (HP)GlennWidener (Tektronix)

Thanks go to each of them for the countless hours spent reviewing drafts and code.


Ralph R. Swick
External Research Group
Digital Equipment Corporation
MIT Project Athena
June 1988

From Release 3 to Release 4, several new members joined the design team. We greatly appreciate the thoughtful comments, suggestions, lengthy discussions, and in some cases implementation code contributed by each of the following:

Don Alecci (AT&T)EllisCohen (OSF)
Donna Converse (MIT)Clive Feather (IXI)
Nayeem Islam (Sun)Dana Laursen (HP)
Keith Packard (MIT)Chris Peterson (MIT)
Richard Probst (Sun)Larry Cable (Sun)

In Release 5, the effort to define the internationalization additions was headed by Bill McMahon of Hewlett Packard and Frank Rojas of IBM. This has been an educational process for many of us, and Bill and Frank’s tutelage has carried us through. Vania Joloboff of the OSF also contributed to the internationalization additions. The implementation efforts of Bill, Gabe Beged-Dov, and especially Donna Converse for this release are also gratefully acknowledged.


Ralph R. Swick
December 1989
and
July 1991

The Release 6 Intrinsics is a result of the collaborative efforts of participants in the X Consortium’s intrinsics working group. A few individuals contributed substantial design proposals, participated in lengthy discussions, reviewed final specifications, and in most cases, were also responsible for sections of the implementation. They deserve recognition and thanks for their major contributions:

Paul Asente (Adobe)Larry Cable (SunSoft)
Ellis Cohen (OSF)Daniel Dardailler (OSF)
Vania Joloboff (OSF)KalebKeithley (X Consortium)
Courtney Loomis (HP)Douglas Rand (OSF)
Bob Scheifler (X Consortium)Ajay Vohra (SunSoft)

Many others analyzed designs, offered useful comments and suggestions, and participated in a significant subset of the process. The following people deserve thanks for their contributions: Andy Bovingdon, Sam Chang, Chris Craig, George Erwin-Grotsky, Keith Edwards, Clive Feather, Stephen Gildea, Dan Heller, Steve Humphrey, David Kaelbling, Jaime Lau, Rob Lembree, Stuart Marks, Beth Mynatt, Tom Paquin, Chris Peterson, Kamesh Ramakrishna, Tom Rodriguez, Jim VanGilder, Will Walker, and Mike Wexler.

I am especially grateful to two of my colleagues: Ralph Swick for expert editorial guidance, and Kaleb Keithley for leadership in the implementation and the specification work.


Donna Converse
X Consortium
April 1994

Table of Contents

About This Manual
1. Intrinsics and Widgets
Intrinsics
Languages
Procedures and Macros
Widgets
Core Widgets
Composite Widgets
Constraint Widgets
Implementation-Specific Types
Widget Classing
Widget Naming Conventions
Widget Subclassing in Public .h Files
Widget Subclassing in Private .h Files
Widget Subclassing in .c Files
Widget Class and Superclass Look Up
Widget Subclass Verification
Superclass Chaining
Class Initialization: class_initialize and class_part_initialize Procedures
Initializing a Widget Class
Inheritance of Superclass Operations
Invocation of Superclass Operations
Class Extension Records
2. Widget Instantiation
Initializing the X Toolkit
Establishing the Locale
Loading the Resource Database
Parsing the Command Line
Creating Widgets
Creating and Merging Argument Lists
Creating a Widget Instance
Creating an Application Shell Instance
Convenience Procedure to Initialize an Application
Widget Instance Allocation: The allocate Procedure
Widget Instance Initialization: The initialize Procedure
Constraint Instance Initialization: The ConstraintClassPart initialize Procedure
Nonwidget Data Initialization: The initialize_hook Procedure
Realizing Widgets
Widget Instance Window Creation: The realize Procedure
Window Creation Convenience Routine
Obtaining Window Information from a Widget
Unrealizing Widgets
Destroying Widgets
Adding and Removing Destroy Callbacks
Dynamic Data Deallocation: The destroy Procedure
Dynamic Constraint Data Deallocation: The ConstraintClassPart destroy Procedure
Widget Instance Deallocation: The deallocate Procedure
Exiting from an Application
3. Composite Widgets and Their Children
Addition of Children to a Composite Widget: The insert_child Procedure
Insertion Order of Children: The insert_position Procedure
Deletion of Children: The delete_child Procedure
Adding and Removing Children from the Managed Set
Managing Children
Unmanaging Children
Bundling Changes to the Managed Set
Determining if a Widget Is Managed
Controlling When Widgets Get Mapped
Constrained Composite Widgets
4. Shell Widgets
Shell Widget Definitions
ShellClassPart Definitions
ShellPart Definition
Shell Resources
ShellPart Default Values
Session Participation
Joining a Session
Saving Application State
Responding to a Shutdown
Resigning from a Session
5. Pop-Up Widgets
Pop-Up Widget Types
Creating a Pop-Up Shell
Creating Pop-Up Children
Mapping a Pop-Up Widget
Unmapping a Pop-Up Widget
6. Geometry Management
Initiating Geometry Changes
General Geometry Manager Requests
Resize Requests
Potential Geometry Changes
Child Geometry Management: The geometry_manager Procedure
Widget Placement and Sizing
Preferred Geometry
Size Change Management: The resize Procedure
7. Event Management
Adding and Deleting Additional Event Sources
Adding and Removing Input Sources
Adding and Removing Blocking Notifications
Adding and Removing Timeouts
Adding and Removing Signal Callbacks
Constraining Events to a Cascade of Widgets
Requesting Key and Button Grabs
Focusing Events on a Child
Events for Drawables That Are Not a Widget's Window
Querying Event Sources
Dispatching Events
The Application Input Loop
Setting and Checking the Sensitivity State of a Widget
Adding Background Work Procedures
X Event Filters
Pointer Motion Compression
Enter/Leave Compression
Exposure Compression
Widget Exposure and Visibility
Redisplay of a Widget: The expose Procedure
Widget Visibility
X Event Handlers
Event Handlers That Select Events
Event Handlers That Do Not Select Events
Current Event Mask
Event Handlers for X11 Protocol Extensions
Using the Intrinsics in a Multi-Threaded Environment
Initializing a Multi-Threaded Intrinsics Application
Locking X Toolkit Data Structures
Event Management in a Multi-Threaded Environment
8. Callbacks
Using Callback Procedure and Callback List Definitions
Identifying Callback Lists
Adding Callback Procedures
Removing Callback Procedures
Executing Callback Procedures
Checking the Status of a Callback List
9. Resource Management
Resource Lists
Byte Offset Calculations
Superclass-to-Subclass Chaining of Resource Lists
Subresources
Obtaining Application Resources
Resource Conversions
Predefined Resource Converters
New Resource Converters
Issuing Conversion Warnings
Registering a New Resource Converter
Resource Converter Invocation
Reading and Writing Widget State
Obtaining Widget State
Setting Widget State
10. Translation Management
Action Tables
Action Table Registration
Action Names to Procedure Translations
Action Hook Registration
Translation Tables
Event Sequences
Action Sequences
Multi-Click Time
Translation Table Management
Using Accelerators
KeyCode-to-KeySym Conversions
Obtaining a KeySym in an Action Procedure
KeySym-to-KeyCode Conversions
Registering Button and Key Grabs for Actions
Invoking Actions Directly
Obtaining a Widget's Action List
11. Utility Functions
Determining the Number of Elements in an Array
Translating Strings to Widget Instances
Managing Memory Usage
Sharing Graphics Contexts
Managing Selections
Setting and Getting the Selection Timeout Value
Using Atomic Transfers
Using Incremental Transfers
Setting and Retrieving Selection Target Parameters
Generating MULTIPLE Requests
Auxiliary Selection Properties
Retrieving the Most Recent Timestamp
Retrieving the Most Recent Event
Merging Exposure Events into a Region
Translating Widget Coordinates
Translating a Window to a Widget
Handling Errors
Setting WM_COLORMAP_WINDOWS
Finding File Names
Hooks for External Agents
Hook Object Resources
Querying Open Displays
12. Nonwidget Objects
Data Structures
Object Objects
ObjectClassPart Structure
ObjectPart Structure
Object Resources
ObjectPart Default Values
Object Arguments to Intrinsics Routines
Use of Objects
Rectangle Objects
RectObjClassPart Structure
RectObjPart Structure
RectObj Resources
RectObjPart Default Values
Widget Arguments to Intrinsics Routines
Use of Rectangle Objects
Undeclared Class
Widget Arguments to Intrinsics Routines
13. Evolution of the Intrinsics
Determining Specification Revision Level
Release 3 to Release 4 Compatibility
Additional Arguments
set_values_almost Procedures
Query Geometry
unrealizeCallback Callback List
Subclasses of WMShell
Resource Type Converters
KeySym Case Conversion Procedure
Nonwidget Objects
Release 4 to Release 5 Compatibility
baseTranslations Resource
Resource File Search Path
Customization Resource
Per-Screen Resource Database
Internationalization of Applications
Permanently Allocated Strings
Arguments to Existing Functions
Release 5 to Release 6 Compatibility
Widget Internals
General Application Development
Communication with Window and Session Managers
Geometry Management
Event Management
Resource Management
Translation Management
Selections
External Agent Hooks
A. Resource File Format
B. Translation Table Syntax
C. Compatibility Functions
D. Intrinsics Error Messages
E. Defined Strings
F. Resource Configuration Management