home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 August - Disc 2 / chip_20018102_hu.iso / linux / X-4.1.0 / doc / intrinsics.TXT < prev    next >
Encoding:
Text File  |  2001-06-27  |  727.6 KB  |  29,173 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.     X Toolkit Intrinsics -- C Language Interface
  17.  
  18.               X Window System
  19.  
  20.          X Version 11, Release 6.4
  21.  
  22.  
  23.         First Revision - April, 1994
  24.  
  25.  
  26.  
  27.  
  28.  
  29.                Joel McCormack
  30.            Digital Equipment Corporation
  31.         Western Software Laboratory
  32.  
  33.  
  34.             Paul Asente
  35.            Digital Equipment Corporation
  36.         Western Software Laboratory
  37.  
  38.  
  39.                Ralph R. Swick
  40.            Digital Equipment Corporation
  41.           External Research Group
  42.               MIT X Consortium
  43.  
  44.  
  45.          version 6 edited by Donna Converse
  46.              X Consortium, Inc.
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83. X Window System is a trademark of X Consortium, Inc.
  84.  
  85. Copyright (C) 1985, 1986, 1987, 1988, 1991, 1994 X Consor-
  86. tium
  87.  
  88. Permission is hereby granted, free of charge, to any person
  89. obtaining a copy of this software and associated documenta-
  90. tion files (the "Software"), to deal in the Software without
  91. restriction, including without limitation the rights to use,
  92. copy, modify, merge, publish, distribute, sublicense, and/or
  93. sell copies of the Software, and to permit persons to whom
  94. the Software is furnished to do so, subject to the following
  95. conditions:
  96.  
  97. The above copyright notice and this permission notice shall
  98. be included in all copies or substantial portions of the
  99. Software.
  100.  
  101. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
  102. KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  103. WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PUR-
  104. POSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE X CONSOR-
  105. TIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  106. WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  107. FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
  108. OR OTHER DEALINGS IN THE SOFTWARE.
  109.  
  110. Except as contained in this notice, the name of the X Con-
  111. sortium shall not be used in advertising or otherwise to
  112. promote the sale, use or other dealings in this Software
  113. without prior written authorization from the X Consortium.
  114.  
  115. Copyright (C) 1985, 1986, 1987, 1988, 1991, 1994 Digital
  116. Equipment Corporation, Maynard, Massachusetts.
  117.  
  118. Permission to use, copy, modify and distribute this documen-
  119. tation for any purpose and without fee is hereby granted,
  120. provided that the above copyright notice appears in all
  121. copies and that both that copyright notice and this permis-
  122. sion notice appear in supporting documentation, and that the
  123. name of Digital not be used in in advertising or publicity
  124. pertaining to distribution of the software without specific,
  125. written prior permission.  Digital makes no representations
  126. about the suitability of the software described herein for
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139. any purpose.  It is provided ``as is'' without express or
  140. implied warranty.
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.               Acknowledgments
  208.  
  209.  
  210.  
  211. The design of the X11 Intrinsics was done primarily by Joel
  212. McCormack of Digital WSL.  Major contributions to the design
  213. and implementation also were done by Charles Haynes, Mike
  214. Chow, and Paul Asente of Digital WSL.  Additional contribu-
  215. tors to the design and/or implementation were:
  216.  
  217.  
  218.      Loretta Guarino-Reid (Digital WSL)Rich Hyde (Digital WSL)
  219.      Susan Angebranndt (Digital WSL)Terry Weissman (Digital WSL)
  220.      Mary Larson (Digital UEG)       Mark Manasse (Digital SRC)
  221.      Jim Gettys  (Digital SRC)       Leo Treggiari  (Digital SDT)
  222.      Ralph Swick (Project Athena and Digital ERP)Mark Ackerman (Project Athena)
  223.      Ron Newman (Project Athena)   Bob Scheifler (MIT LCS)
  224.  
  225.  
  226. The contributors to the X10 toolkit also deserve mention.
  227. Although the X11 Intrinsics present an entirely different
  228. programming style, they borrow heavily from the implicit and
  229. explicit concepts in the X10 toolkit.
  230.  
  231. The design and implementation of the X10 Intrinsics were
  232. done by:
  233.  
  234.  
  235.      Terry Weissman (Digital WSL)
  236.      Smokey Wallace (Digital WSL)
  237.      Phil Karlton (Digital WSL)
  238.      Charles Haynes (Digital WSL)
  239.      Frank Hall (HP)
  240.  
  241.  
  242. The design and implementation of the X10 toolkit's sample
  243. widgets were by the above, as well as by:
  244.  
  245.  
  246.      Ram Rao (Digital UEG)
  247.      Mary Larson (Digital UEG)
  248.      Mike Gancarz (Digital UEG)
  249.      Kathleen Langone  (Digital UEG)
  250.  
  251. These widgets provided a checklist of requirements that we
  252. had to address in the X11 Intrinsics.
  253.  
  254. Thanks go to Al Mento of Digital's UEG Documentation Group
  255. for formatting and generally improving this document and to
  256. John Ousterhout of Berkeley for extensively reviewing early
  257. drafts of it.
  258.  
  259.  
  260.  
  261.  
  262.                  xi
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271. Finally, a special thanks to Mike Chow, whose extensive per-
  272. formance analysis of the X10 toolkit provided the justifica-
  273. tion to redesign it entirely for X11.
  274.  
  275.  
  276.  
  277. Joel McCormack
  278. Western Software Laboratory
  279. Digital Equipment Corporation
  280.  
  281. March 1988
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.                  xii
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337. The current design of the Intrinsics has benefited greatly
  338. from the input of several dedicated reviewers in the member-
  339. ship of the X Consortium.  In addition to those already men-
  340. tioned, the following individuals have dedicated significant
  341. time to suggesting improvements to the Intrinsics:
  342.  
  343.  
  344.      Steve Pitschke (Stellar)       C. Doug Blewett (AT&T)
  345.      Bob Miller (HP)           David Schiferl (Tektronix)
  346.      Fred Taft (HP)           Michael Squires (Sequent)
  347.      Marcel Meth (AT&T)        Jim Fulton (MIT)
  348.      Mike Collins (Digital)       Kerry Kimbrough (Texas Instruments)
  349.      Scott McGregor (Digital)       Phil Karlton (Digital)
  350.      Julian Payne (ESS)        Jacques Davy (Bull)
  351.      Gabriel Beged-Dov (HP)       Glenn Widener (Tektronix)
  352.  
  353.  
  354. Thanks go to each of them for the countless hours spent
  355. reviewing drafts and code.
  356.  
  357.  
  358.  
  359. Ralph R. Swick
  360. External Research Group
  361. Digital Equipment Corporation
  362. MIT Project Athena
  363.  
  364. June 1988
  365.  
  366.  
  367.  
  368. From Release 3 to Release 4, several new members joined the
  369. design team.  We greatly appreciate the thoughtful comments,
  370. suggestions, lengthy discussions, and in some cases imple-
  371. mentation code contributed by each of the following:
  372.  
  373.  
  374.      Don Alecci (AT&T)           Ellis Cohen (OSF)
  375.      Donna Converse (MIT)       Clive Feather (IXI)
  376.      Nayeem Islam (Sun)        Dana Laursen (HP)
  377.      Keith Packard (MIT)       Chris Peterson (MIT)
  378.      Richard Probst (Sun)       Larry Cable (Sun)
  379.  
  380.  
  381.  
  382. In Release 5, the effort to define the internationalization
  383. additions was headed by Bill McMahon of Hewlett Packard and
  384. Frank Rojas of IBM.  This has been an educational process
  385. for many of us, and Bill and Frank's tutelage has carried us
  386. through.  Vania Joloboff of the OSF also contributed to the
  387. internationalization additions.  The implementation efforts
  388. of Bill, Gabe Beged-Dov, and especially Donna Converse for
  389. this release are also gratefully acknowledged.
  390.  
  391.  
  392.  
  393.  
  394.                 xiii
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403. Ralph R. Swick
  404.  
  405. December 1989
  406. and
  407. July 1991
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.                  xiv
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469. The Release 6 Intrinsics is a result of the collaborative
  470. efforts of participants in the X Consortium's intrinsics
  471. working group.    A few individuals contributed substantial
  472. design proposals, participated in lengthy discussions,
  473. reviewed final specifications, and in most cases, were also
  474. responsible for sections of the implementation.  They
  475. deserve recognition and thanks for their major contribu-
  476. tions:
  477.  
  478.  
  479.      Paul Asente (Adobe)       Larry Cable (SunSoft)
  480.      Ellis Cohen (OSF)           Daniel Dardailler (OSF)
  481.      Vania Joloboff (OSF)       Kaleb Keithley (X Consortium)
  482.      Courtney Loomis (HP)       Douglas Rand (OSF)
  483.      Bob Scheifler (X Consortium)  Ajay Vohra (SunSoft)
  484.  
  485.  
  486. Many others analyzed designs, offered useful comments and
  487. suggestions, and participated in a significant subset of the
  488. process.  The following people deserve thanks for their con-
  489. tributions: Andy Bovingdon, Sam Chang, Chris Craig, George
  490. Erwin-Grotsky, Keith Edwards, Clive Feather, Stephen Gildea,
  491. Dan Heller, Steve Humphrey, David Kaelbling, Jaime Lau, Rob
  492. Lembree, Stuart Marks, Beth Mynatt, Tom Paquin, Chris Peter-
  493. son, Kamesh Ramakrishna, Tom Rodriguez, Jim VanGilder, Will
  494. Walker, and Mike Wexler.
  495.  
  496. I am especially grateful to two of my colleagues: Ralph
  497. Swick for expert editorial guidance, and Kaleb Keithley for
  498. leadership in the implementation and the specification work.
  499.  
  500.  
  501. Donna Converse
  502. X Consortium
  503. April 1994
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.                  xv
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.              About This Manual
  538.  
  539.  
  540.  
  541. X Toolkit Intrinsics -- C Language Interface is intended to
  542. be read by both application programmers who will use one or
  543. more of the many widget sets built with the Intrinsics and
  544. by widget programmers who will use the Intrinsics to build
  545. widgets for one of the widget sets.  Not all the information
  546. in this manual, however, applies to both audiences.  That
  547. is, because the application programmer is likely to use only
  548. a number of the Intrinsics functions in writing an applica-
  549. tion and because the widget programmer is likely to use many
  550. more, if not all, of the Intrinsics functions in building a
  551. widget, an attempt has been made to highlight those areas of
  552. information that are deemed to be of special interest for
  553. the application programmer.  (It is assumed the widget pro-
  554. grammer will have to be familiar with all the information.)
  555. Therefore, all entries in the table of contents that are
  556. printed in bold indicate the information that should be of
  557. special interest to an application programmer.
  558.  
  559. It is also assumed that, as application programmers become
  560. more familiar with the concepts discussed in this manual,
  561. they will find it more convenient to implement portions of
  562. their applications as special-purpose or custom widgets.  It
  563. is possible, nonetheless, to use widgets without knowing how
  564. to build them.
  565.  
  566. Conventions Used in this Manual
  567.  
  568. This document uses the following conventions:
  569.  
  570. o    Global symbols are printed in this special font.  These
  571.      can be either function names, symbols defined in
  572.      include files, data types, or structure names.  Argu-
  573.      ments to functions, procedures, or macros are printed
  574.      in italics.
  575.  
  576. o    Each function is introduced by a general discussion
  577.      that distinguishes it from other functions.  The func-
  578.      tion declaration itself follows, and each argument is
  579.      specifically explained.  General discussion of the
  580.      function, if any is required, follows the arguments.
  581.  
  582. o    To eliminate any ambiguity between those arguments that
  583.      you pass and those that a function returns to you, the
  584.      explanations for all arguments that you pass start with
  585.      the word specifies or, in the case of multiple argu-
  586.      ments, the word specify.  The explanations for all
  587.      arguments that are returned to you start with the word
  588.      returns or, in the case of multiple arguments, the word
  589.  
  590.  
  591.  
  592.                  xvi
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.      return.
  602.  
  603.  
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.                 xvii
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.                 Chapter 1
  670.  
  671.              Intrinsics and Widgets
  672.  
  673.  
  674.  
  675. The Intrinsics are a programming library tailored to the
  676. special requirements of user interface construction within a
  677. network window system, specifically the X Window System.
  678. The Intrinsics and a widget set make up an X Toolkit.
  679.  
  680.  
  681. 1.1.  Intrinsics
  682.  
  683. The Intrinsics provide the base mechanism necessary to build
  684. a wide variety of interoperating widget sets and application
  685. environments.  The Intrinsics are a layer on top of Xlib,
  686. the C Library X Interface.  They extend the fundamental
  687. abstractions provided by the X Window System while still
  688. remaining independent of any particular user interface pol-
  689. icy or style.
  690.  
  691. The Intrinsics use object-oriented programming techniques to
  692. supply a consistent architecture for constructing and com-
  693. posing user interface components, known as widgets.  This
  694. allows programmers to extend a widget set in new ways,
  695. either by deriving new widgets from existing ones (subclass-
  696. ing) or by writing entirely new widgets following the estab-
  697. lished conventions.
  698.  
  699. When the Intrinsics were first conceived, the root of the
  700. object hierarchy was a widget class named Core.  In Release
  701. 4 of the Intrinsics, three nonwidget superclasses were added
  702. above Core.  These superclasses are described in Chapter 12.
  703. The name of the class now at the root of the Intrinsics
  704. class hierarchy is Object.  The remainder of this specifica-
  705. tion refers uniformly to widgets and Core as if they were
  706. the base class for all Intrinsics operations.  The argument
  707. descriptions for each Intrinsics procedure and Chapter 12
  708. describe which operations are defined for the nonwidget
  709. superclasses of Core.  The reader may determine by context
  710. whether a specific reference to widget actually means ``wid-
  711. get'' or ``object.''
  712.  
  713.  
  714. 1.2.  Languages
  715.  
  716. The Intrinsics are intended to be used for two programming
  717. purposes.  Programmers writing widgets will be using most of
  718. the facilities provided by the Intrinsics to construct user
  719. interface components from the simple, such as buttons and
  720. scrollbars, to the complex, such as control panels and
  721.  
  722.  
  723.  
  724.                   1
  725.  
  726.  
  727.  
  728.  
  729.  
  730. X Toolkit Intrinsics                 X11 Release 6.4
  731.  
  732.  
  733. property sheets.  Application programmers will use a much
  734. smaller subset of the Intrinsics procedures in combination
  735. with one or more sets of widgets to construct and present
  736. complete user interfaces on an X display.  The Intrinsics
  737. programming interfaces primarily intended for application
  738. use are designed to be callable from most procedural pro-
  739. gramming languages.  Therefore, most arguments are passed by
  740. reference rather than by value.  The interfaces primarily
  741. intended for widget programmers are expected to be used
  742. principally from the C language.  In these cases, the usual
  743. C programming conventions apply.  In this specification, the
  744. term client refers to any module, widget, or application
  745. that calls an Intrinsics procedure.
  746.  
  747. Applications that use the Intrinsics mechanisms must include
  748. the header files <X11/Intrinsic.h> and <X11/StringDefs.h>,
  749. or their equivalent, and they may also include
  750. <X11/Xatoms.h> and <X11/Shell.h>.  In addition, widget
  751. implementations should include <X11/IntrinsicP.h> instead of
  752. <X11/Intrinsic.h>.
  753.  
  754. The applications must also include the additional header
  755. files for each widget class that they are to use (for exam-
  756. ple, <X11/Xaw/Label.h> or <X11/Xaw/Scrollbar.h>).  On a
  757. POSIX-based system, the Intrinsics object library file is
  758. named libXt.a and is usually referenced as -lXt when linking
  759. the application.
  760.  
  761.  
  762. 1.3.  Procedures and Macros
  763.  
  764. All functions defined in this specification except those
  765. specified below may be implemented as C macros with argu-
  766. ments.    C applications may use ``#undef'' to remove a macro
  767. definition and ensure that the actual function is refer-
  768. enced.    Any such macro will expand to a single expression
  769. that has the same precedence as a function call and that
  770. evaluates each of its arguments exactly once, fully pro-
  771. tected by parentheses, so that arbitrary expressions may be
  772. used as arguments.
  773.  
  774. The following symbols are macros that do not have function
  775. equivalents and that may expand their arguments in a manner
  776. other than that described above: XtCheckSubclass, XtNew,
  777. XtNumber, XtOffsetOf, XtOffset, and XtSetArg.
  778.  
  779.  
  780. 1.4.  Widgets
  781.  
  782.  
  783. The fundamental abstraction and data type of the X Toolkit
  784. is the widget, which is a combination of an X window and its
  785. associated input and display semantics and which is dynami-
  786. cally allocated and contains state information.  Some
  787.  
  788.  
  789.  
  790.                   2
  791.  
  792.  
  793.  
  794.  
  795.  
  796. X Toolkit Intrinsics                 X11 Release 6.4
  797.  
  798.  
  799. widgets display information (for example, text or graphics),
  800. and others are merely containers for other widgets (for
  801. example, a menu box).  Some widgets are output-only and do
  802. not react to pointer or keyboard input, and others change
  803. their display in response to input and can invoke functions
  804. that an application has attached to them.
  805.  
  806. Every widget belongs to exactly one widget class, which is
  807. statically allocated and initialized and which contains the
  808. operations allowable on widgets of that class.    Logically, a
  809. widget class is the procedures and data associated with all
  810. widgets belonging to that class.  These procedures and data
  811. can be inherited by subclasses.  Physically, a widget class
  812. is a pointer to a structure.  The contents of this structure
  813. are constant for all widgets of the widget class but will
  814. vary from class to class.  (Here, ``constant'' means the
  815. class structure is initialized at compile time and never
  816. changed, except for a one-time class initialization and in-
  817. place compilation of resource lists, which takes place when
  818. the first widget of the class or subclass is created.)    For
  819. further information, see Section 2.5.
  820.  
  821. The distribution of the declarations and code for a new wid-
  822. get class among a public .h file for application programmer
  823. use, a private .h file for widget programmer use, and the
  824. implementation .c file is described in Section 1.6.  The
  825. predefined widget classes adhere to these conventions.
  826.  
  827. A widget instance is composed of two parts:
  828.  
  829. o    A data structure which contains instance-specific val-
  830.      ues.
  831.  
  832. o    A class structure which contains information that is
  833.      applicable to all widgets of that class.
  834.  
  835. Much of the input/output of a widget (for example, fonts,
  836. colors, sizes, or border widths) is customizable by users.
  837.  
  838. This chapter discusses the base widget classes, Core, Com-
  839. posite, and Constraint, and ends with a discussion of widget
  840. classing.
  841.  
  842.  
  843. 1.4.1.    Core Widgets
  844.  
  845. The Core widget class contains the definitions of fields
  846. common to all widgets.    All widgets classes are subclasses
  847. of the Core class, which is defined by the CoreClassPart and
  848. CorePart structures.
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.                   3
  857.  
  858.  
  859.  
  860.  
  861.  
  862. X Toolkit Intrinsics                 X11 Release 6.4
  863.  
  864.  
  865. 1.4.1.1.  CoreClassPart Structure
  866.  
  867. All widget classes contain the fields defined in the Core-
  868. ClassPart structure.
  869.  
  870. __
  871. |
  872. typedef struct {
  873.      WidgetClass superclass;       See Section 1.6
  874.      String class_name;        See Chapter 9
  875.      Cardinal widget_size;       See Section 1.6
  876.      XtProc class_initialize;       See Section 1.6
  877.      XtWidgetClassProc class_part_initialize;See Section 1.6
  878.      XtEnum class_inited;       See Section 1.6
  879.      XtInitProc initialize;       See Section 2.5
  880.      XtArgsProc initialize_hook;   See Section 2.5
  881.      XtRealizeProc realize;       See Section 2.6
  882.      XtActionList actions;       See Chapter 10
  883.      Cardinal num_actions;       See Chapter 10
  884.      XtResourceList resources;       See Chapter 9
  885.      Cardinal num_resources;       See Chapter 9
  886.      XrmClass xrm_class;       Private to resource manager
  887.      Boolean compress_motion;       See Section 7.9
  888.      XtEnum compress_exposure;       See Section 7.9
  889.      Boolean compress_enterleave;  See Section 7.9
  890.      Boolean visible_interest;       See Section 7.10
  891.      XtWidgetProc destroy;       See Section 2.8
  892.      XtWidgetProc resize;       See Chapter 6
  893.      XtExposeProc expose;       See Section 7.10
  894.      XtSetValuesFunc set_values;   See Section 9.7
  895.      XtArgsFunc set_values_hook;   See Section 9.7
  896.      XtAlmostProc set_values_almost;See Section 9.7
  897.      XtArgsProc get_values_hook;   See Section 9.7
  898.      XtAcceptFocusProc accept_focus;See Section 7.3
  899.      XtVersionType version;       See Section 1.6
  900.      XtPointer callback_private;   Private to callbacks
  901.      String tm_table;           See Chapter 10
  902.      XtGeometryHandler query_geometry;See Chapter 6
  903.      XtStringProc display_accelerator;See Chapter 10
  904.      XtPointer extension;       See Section 1.6
  905. } CoreClassPart;
  906.  
  907. |__
  908.  
  909. All widget classes have the Core class fields as their first
  910. component.  The prototypical WidgetClass and CoreWidgetClass
  911. are defined with only this set of fields.
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.                   4
  923.  
  924.  
  925.  
  926.  
  927.  
  928. X Toolkit Intrinsics                 X11 Release 6.4
  929.  
  930. __
  931. |
  932. typedef struct {
  933.      CoreClassPart core_class;
  934. } WidgetClassRec, *WidgetClass, CoreClassRec, *CoreWidgetClass;
  935.  
  936. |__
  937.  
  938. Various routines can cast widget class pointers, as needed,
  939. to specific widget class types.
  940.  
  941. The single occurrences of the class record and pointer for
  942. creating instances of Core are
  943.  
  944. In IntrinsicP.h:
  945.  
  946. __
  947. |
  948. extern WidgetClassRec widgetClassRec;
  949. #define coreClassRec widgetClassRec
  950.  
  951. |__
  952.  
  953. In Intrinsic.h:
  954.  
  955. __
  956. |
  957. extern WidgetClass widgetClass, coreWidgetClass;
  958.  
  959. |__
  960.  
  961. The opaque types Widget and WidgetClass and the opaque vari-
  962. able widgetClass are defined for generic actions on widgets.
  963. In order to make these types opaque and ensure that the com-
  964. piler does not allow applications to access private data,
  965. the Intrinsics use incomplete structure definitions in
  966. Intrinsic.h:
  967.  
  968. __
  969. |
  970. typedef struct _WidgetClassRec *WidgetClass, *CoreWidgetClass;
  971. |__
  972.  
  973.  
  974.  
  975. 1.4.1.2.  CorePart Structure
  976.  
  977. All widget instances contain the fields defined in the
  978. CorePart structure.
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.                   5
  989.  
  990.  
  991.  
  992.  
  993.  
  994. X Toolkit Intrinsics                 X11 Release 6.4
  995.  
  996. __
  997. |
  998. typedef struct _CorePart {
  999.      Widget self;          Described below
  1000.      WidgetClass widget_class;See Section 1.6
  1001.      Widget parent;          See Section 2.5
  1002.      Boolean being_destroyed; See Section 2.8
  1003.      XtCallbackList destroy_callbacks;See Section 2.8
  1004.      XtPointer constraints;   See Section 3.6
  1005.      Position x;          See Chapter 6
  1006.      Position y;          See Chapter 6
  1007.      Dimension width;          See Chapter 6
  1008.      Dimension height;          See Chapter 6
  1009.      Dimension border_width;  See Chapter 6
  1010.      Boolean managed;          See Chapter 3
  1011.      Boolean sensitive;       See Section 7.7
  1012.      Boolean ancestor_sensitive;See Section 7.7
  1013.      XtTranslations accelerators;See Chapter 10
  1014.      Pixel border_pixel;      See Section 2.6
  1015.      Pixmap border_pixmap;    See Section 2.6
  1016.      WidgetList popup_list;   See Chapter 5
  1017.      Cardinal num_popups;     See Chapter 5
  1018.      String name;          See Chapter 9
  1019.      Screen *screen;          See Section 2.6
  1020.      Colormap colormap;       See Section 2.6
  1021.      Window window;          See Section 2.6
  1022.      Cardinal depth;          See Section 2.6
  1023.      Pixel background_pixel;  See Section 2.6
  1024.      Pixmap background_pixmap;See Section 2.6
  1025.      Boolean visible;          See Section 7.10
  1026.      Boolean mapped_when_managed;See Chapter 3
  1027. } CorePart;
  1028.  
  1029. |__
  1030.  
  1031. All widget instances have the Core fields as their first
  1032. component.  The prototypical type Widget is defined with
  1033. only this set of fields.
  1034.  
  1035. __
  1036. |
  1037. typedef struct {
  1038.      CorePart core;
  1039. } WidgetRec, *Widget, CoreRec, *CoreWidget;
  1040.  
  1041. |__
  1042.  
  1043. Various routines can cast widget pointers, as needed, to
  1044. specific widget types.
  1045.  
  1046. In order to make these types opaque and ensure that the com-
  1047. piler does not allow applications to access private data,
  1048. the Intrinsics use incomplete structure definitions in
  1049. Intrinsic.h.
  1050.  
  1051.  
  1052.  
  1053.  
  1054.                   6
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060. X Toolkit Intrinsics                 X11 Release 6.4
  1061.  
  1062. __
  1063. |
  1064. typedef struct _WidgetRec *Widget, *CoreWidget;
  1065. |__
  1066.  
  1067.  
  1068.  
  1069. 1.4.1.3.  Core Resources
  1070.  
  1071.  
  1072. The resource names, classes, and representation types speci-
  1073. fied in the coreClassRec resource list are
  1074.  
  1075.  
  1076. ------------------------------------------------------------------------
  1077. Name               Class              Representation
  1078. ------------------------------------------------------------------------
  1079. XtNaccelerators        XtCAccelerators          XtRAcceleratorTable
  1080. XtNbackground           XtCBackground          XtRPixel
  1081. XtNbackgroundPixmap    XtCPixmap          XtRPixmap
  1082. XtNborderColor           XtCBorderColor          XtRPixel
  1083. XtNborderPixmap        XtCPixmap          XtRPixmap
  1084. XtNcolormap           XtCColormap          XtRColormap
  1085. XtNdepth           XtCDepth           XtRInt
  1086. XtNmappedWhenManaged   XtCMappedWhenManaged   XtRBoolean
  1087. XtNscreen           XtCScreen          XtRScreen
  1088. XtNtranslations        XtCTranslations          XtRTranslationTable
  1089. ------------------------------------------------------------------------
  1090.  
  1091.  
  1092. Additional resources are defined for all widgets via the
  1093. objectClassRec and rectObjClassRec resource lists; see Sec-
  1094. tions 12.2 and 12.3 for details.
  1095.  
  1096.  
  1097. 1.4.1.4.  CorePart Default Values
  1098.  
  1099. The default values for the Core fields, which are filled in
  1100. by the Intrinsics, from the resource lists, and by the ini-
  1101. tialize procedures, are
  1102.  
  1103.  
  1104. ------------------------------------------------------------------------------
  1105. Field             Default Value
  1106. ------------------------------------------------------------------------------
  1107. self             Address of the widget structure (may not be changed).
  1108. widget_class         widget_class argument to XtCreateWidget (may not be
  1109.              changed).
  1110. parent             parent argument to XtCreateWidget (may not be changed).
  1111. being_destroyed      Parent's being_destroyed value.
  1112. destroy_callbacks    NULL
  1113. constraints         NULL
  1114. x             0
  1115. y             0
  1116.  
  1117.  
  1118.  
  1119.  
  1120.                   7
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126. X Toolkit Intrinsics                 X11 Release 6.4
  1127.  
  1128.  
  1129. width             0
  1130. height             0
  1131. border_width         1
  1132. managed          False
  1133. sensitive         True
  1134. ancestor_sensitive   logical AND of parent's sensitive and ancestor_sensitive
  1135.              values.
  1136. accelerators         NULL
  1137. border_pixel         XtDefaultForeground
  1138. border_pixmap         XtUnspecifiedPixmap
  1139. popup_list         NULL
  1140. num_popups         0
  1141. name             name argument to XtCreateWidget (may not be changed).
  1142. screen             Parent's screen; top-level widget gets screen from dis-
  1143.              play specifier
  1144.              (may not be changed).
  1145. colormap         Parent's colormap value.
  1146. window             NULL
  1147. depth             Parent's depth; top-level widget gets root window depth.
  1148. background_pixel     XtDefaultBackground
  1149. background_pixmap    XtUnspecifiedPixmap
  1150. visible          True
  1151. mapped_when_man-     True
  1152. aged
  1153. ------------------------------------------------------------------------------
  1154.  
  1155.  
  1156. XtUnspecifiedPixmap is a symbolic constant guaranteed to be
  1157. unequal to any valid Pixmap id, None, and ParentRelative.
  1158.  
  1159.  
  1160. 1.4.2.    Composite Widgets
  1161.  
  1162. The Composite widget class is a subclass of the Core widget
  1163. class (see Chapter 3).    Composite widgets are intended to be
  1164. containers for other widgets.  The additional data used by
  1165. composite widgets are defined by the CompositeClassPart and
  1166. CompositePart structures.
  1167.  
  1168.  
  1169. 1.4.2.1.  CompositeClassPart Structure
  1170.  
  1171. In addition to the Core class fields, widgets of the Compos-
  1172. ite class have the following class fields.
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.                   8
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192. X Toolkit Intrinsics                 X11 Release 6.4
  1193.  
  1194. __
  1195. |
  1196. typedef struct {
  1197.      XtGeometryHandler geometry_manager;See Chapter 6
  1198.      XtWidgetProc change_managed;  See Chapter 3
  1199.      XtWidgetProc insert_child;    See Chapter 3
  1200.      XtWidgetProc delete_child;    See Chapter 3
  1201.      XtPointer extension;       See Section 1.6
  1202. } CompositeClassPart;
  1203.  
  1204. |__
  1205.  
  1206. The extension record defined for CompositeClassPart with
  1207. record_type equal to NULLQUARK is
  1208. CompositeClassExtensionRec.
  1209.  
  1210. __
  1211. |
  1212. typedef struct {
  1213.      XtPointer next_extension;       See Section 1.6.12
  1214.      XrmQuark record_type;       See Section 1.6.12
  1215.      long version;           See Section 1.6.12
  1216.      Cardinal record_size;       See Section 1.6.12
  1217.      Boolean accepts_objects;       See Section 2.5.2
  1218.      Boolean allows_change_managed_set;See Section 3.4.3
  1219. } CompositeClassExtensionRec, *CompositeClassExtension;
  1220.  
  1221. |__
  1222.  
  1223. Composite classes have the Composite class fields immedi-
  1224. ately following the Core class fields.
  1225.  
  1226. __
  1227. |
  1228. typedef struct {
  1229.      CoreClassPart core_class;
  1230.      CompositeClassPart composite_class;
  1231. } CompositeClassRec, *CompositeWidgetClass;
  1232.  
  1233. |__
  1234.  
  1235. The single occurrences of the class record and pointer for
  1236. creating instances of Composite are
  1237.  
  1238. In IntrinsicP.h:
  1239.  
  1240. __
  1241. |
  1242. extern CompositeClassRec compositeClassRec;
  1243.  
  1244. |__
  1245.  
  1246. In Intrinsic.h:
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.                   9
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258. X Toolkit Intrinsics                 X11 Release 6.4
  1259.  
  1260. __
  1261. |
  1262. extern WidgetClass compositeWidgetClass;
  1263.  
  1264. |__
  1265.  
  1266. The opaque types CompositeWidget and CompositeWidgetClass
  1267. and the opaque variable compositeWidgetClass are defined for
  1268. generic operations on widgets whose class is Composite or a
  1269. subclass of Composite.    The symbolic constant for the Com-
  1270. positeClassExtension version identifier is XtCompositeExten-
  1271. sionVersion (see Section 1.6.12).  Intrinsic.h uses an
  1272. incomplete structure definition to ensure that the compiler
  1273. catches attempts to access private data.
  1274.  
  1275. __
  1276. |
  1277. typedef struct _CompositeClassRec *CompositeWidgetClass;
  1278. |__
  1279.  
  1280.  
  1281.  
  1282. 1.4.2.2.  CompositePart Structure
  1283.  
  1284. In addition to the Core instance fields, widgets of the Com-
  1285. posite class have the following instance fields defined in
  1286. the CompositePart structure.
  1287.  
  1288. __
  1289. |
  1290. typedef struct {
  1291.      WidgetList children;     See Chapter 3
  1292.      Cardinal num_children;   See Chapter 3
  1293.      Cardinal num_slots;      See Chapter 3
  1294.      XtOrderProc insert_position;See Section 3.2
  1295. } CompositePart;
  1296.  
  1297. |__
  1298.  
  1299. Composite widgets have the Composite instance fields immedi-
  1300. ately following the Core instance fields.
  1301.  
  1302. __
  1303. |
  1304. typedef struct {
  1305.      CorePart core;
  1306.      CompositePart composite;
  1307. } CompositeRec, *CompositeWidget;
  1308.  
  1309. |__
  1310.  
  1311. Intrinsic.h uses an incomplete structure definition to
  1312. ensure that the compiler catches attempts to access private
  1313. data.
  1314.  
  1315.  
  1316.  
  1317.  
  1318.                  10
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324. X Toolkit Intrinsics                 X11 Release 6.4
  1325.  
  1326. __
  1327. |
  1328. typedef struct _CompositeRec *CompositeWidget;
  1329. |__
  1330.  
  1331.  
  1332.  
  1333. 1.4.2.3.  Composite Resources
  1334.  
  1335. The resource names, classes, and representation types that
  1336. are specified in the compositeClassRec resource list are
  1337.  
  1338.  
  1339. -------------------------------------------------------------
  1340. Name            Class        Representation
  1341. -------------------------------------------------------------
  1342. XtNchildren        XtCReadOnly     XtRWidgetList
  1343. XtNinsertPosition   XtCInsertPosition    XtRFunction
  1344. XtNnumChildren        XtCReadOnly     XtRCardinal
  1345. -------------------------------------------------------------
  1346.  
  1347.  
  1348.  
  1349. 1.4.2.4.  CompositePart Default Values
  1350.  
  1351. The default values for the Composite fields, which are
  1352. filled in from the Composite resource list and by the Com-
  1353. posite initialize procedure, are
  1354.  
  1355.  
  1356. -----------------------------------------------------
  1357. Field          Default Value
  1358. -----------------------------------------------------
  1359. children      NULL
  1360. num_children      0
  1361. num_slots      0
  1362. insert_position   Internal function to insert at end
  1363. -----------------------------------------------------
  1364.  
  1365.  
  1366. The children, num_children, and insert_position fields are
  1367. declared as resources; XtNinsertPosition is a settable
  1368. resource, XtNchildren and XtNnumChildren may be read by any
  1369. client but should only be modified by the composite widget
  1370. class procedures.
  1371.  
  1372.  
  1373. 1.4.3.    Constraint Widgets
  1374.  
  1375. The Constraint widget class is a subclass of the Composite
  1376. widget class (see Section 3.6).  Constraint widgets maintain
  1377. additional state data for each child; for example, client-
  1378. defined constraints on the child's geometry.  The additional
  1379. data used by constraint widgets are defined by the Con-
  1380. straintClassPart and ConstraintPart structures.
  1381.  
  1382.  
  1383.  
  1384.                  11
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390. X Toolkit Intrinsics                 X11 Release 6.4
  1391.  
  1392.  
  1393. 1.4.3.1.  ConstraintClassPart Structure
  1394.  
  1395. In addition to the Core and Composite class fields, widgets
  1396. of the Constraint class have the following class fields.
  1397.  
  1398. __
  1399. |
  1400. typedef struct {
  1401.      XtResourceList resources;See Chapter 9
  1402.      Cardinal num_resources;  See Chapter 9
  1403.      Cardinal constraint_size;See Section 3.6
  1404.      XtInitProc initialize;   See Section 3.6
  1405.      XtWidgetProc destroy;    See Section 3.6
  1406.      XtSetValuesFunc set_values;See Section 9.7.2
  1407.      XtPointer extension;     See Section 1.6
  1408. } ConstraintClassPart;
  1409.  
  1410. |__
  1411.  
  1412. The extension record defined for ConstraintClassPart with
  1413. record_type equal to NULLQUARK is
  1414. ConstraintClassExtensionRec.
  1415.  
  1416. __
  1417. |
  1418. typedef struct {
  1419.      XtPointer next_extension;See Section 1.6.12
  1420.      XrmQuark record_type;    See Section 1.6.12
  1421.      long version;          See Section 1.6.12
  1422.      Cardinal record_size;    See Section 1.6.12
  1423.      XtArgsProc get_values_hook;See Section 9.7.1
  1424. } ConstraintClassExtensionRec, *ConstraintClassExtension;
  1425.  
  1426. |__
  1427.  
  1428. Constraint classes have the Constraint class fields immedi-
  1429. ately following the Composite class fields.
  1430.  
  1431. __
  1432. |
  1433. typedef struct _ConstraintClassRec {
  1434.      CoreClassPart core_class;
  1435.      CompositeClassPart composite_class;
  1436.      ConstraintClassPart constraint_class;
  1437. } ConstraintClassRec, *ConstraintWidgetClass;
  1438.  
  1439. |__
  1440.  
  1441. The single occurrences of the class record and pointer for
  1442. creating instances of Constraint are
  1443.  
  1444. In IntrinsicP.h:
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.                  12
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456. X Toolkit Intrinsics                 X11 Release 6.4
  1457.  
  1458. __
  1459. |
  1460. extern ConstraintClassRec constraintClassRec;
  1461.  
  1462. |__
  1463.  
  1464. In Intrinsic.h:
  1465.  
  1466. __
  1467. |
  1468. extern WidgetClass constraintWidgetClass;
  1469.  
  1470. |__
  1471.  
  1472. The opaque types ConstraintWidget and ConstraintWidgetClass
  1473. and the opaque variable constraintWidgetClass are defined
  1474. for generic operations on widgets whose class is Constraint
  1475. or a subclass of Constraint.  The symbolic constant for the
  1476. ConstraintClassExtension version identifier is XtConstrain-
  1477. tExtensionVersion (see Section 1.6.12).  Intrinsic.h uses an
  1478. incomplete structure definition to ensure that the compiler
  1479. catches attempts to access private data.
  1480.  
  1481. __
  1482. |
  1483. typedef struct _ConstraintClassRec *ConstraintWidgetClass;
  1484. |__
  1485.  
  1486.  
  1487.  
  1488. 1.4.3.2.  ConstraintPart Structure
  1489.  
  1490. In addition to the Core and Composite instance fields, wid-
  1491. gets of the Constraint class have the following unused
  1492. instance fields defined in the ConstraintPart structure
  1493.  
  1494. __
  1495. |
  1496. typedef struct {
  1497.     int empty;
  1498. } ConstraintPart;
  1499.  
  1500. |__
  1501.  
  1502. Constraint widgets have the Constraint instance fields imme-
  1503. diately following the Composite instance fields.
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.                  13
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522. X Toolkit Intrinsics                 X11 Release 6.4
  1523.  
  1524. __
  1525. |
  1526. typedef struct {
  1527.      CorePart core;
  1528.      CompositePart composite;
  1529.      ConstraintPart constraint;
  1530. } ConstraintRec, *ConstraintWidget;
  1531.  
  1532. |__
  1533.  
  1534. Intrinsic.h uses an incomplete structure definition to
  1535. ensure that the compiler catches attempts to access private
  1536. data.
  1537.  
  1538. __
  1539. |
  1540. typedef struct _ConstraintRec *ConstraintWidget;
  1541. |__
  1542.  
  1543.  
  1544.  
  1545. 1.4.3.3.  Constraint Resources
  1546.  
  1547. The constraintClassRec core_class and constraint_class
  1548. resources fields are NULL, and the num_resources fields are
  1549. zero; no additional resources beyond those declared by the
  1550. superclasses are defined for Constraint.
  1551.  
  1552.  
  1553. 1.5.  Implementation-Specific Types
  1554.  
  1555. To increase the portability of widget and application source
  1556. code between different system environments, the Intrinsics
  1557. define several types whose precise representation is explic-
  1558. itly dependent upon, and chosen by, each individual imple-
  1559. mentation of the Intrinsics.
  1560.  
  1561. These implementation-defined types are
  1562.  
  1563. Boolean    A datum that contains a zero or nonzero value.
  1564.        Unless explicitly stated, clients should not
  1565.        assume that the nonzero value is equal to the
  1566.        symbolic value True.
  1567.  
  1568. Cardinal   An unsigned integer datum with a minimum range of
  1569.        [0..2^16-1].
  1570.  
  1571. Dimension  An unsigned integer datum with a minimum range of
  1572.        [0..2^16-1].
  1573.  
  1574. Position   A signed integer datum with a minimum range of
  1575.        [-2^15..2^15-1].
  1576.  
  1577. XtPointer  A datum large enough to contain the largest of a
  1578.        char*, int*, function pointer, structure pointer,
  1579.  
  1580.  
  1581.  
  1582.                  14
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588. X Toolkit Intrinsics                 X11 Release 6.4
  1589.  
  1590.  
  1591.        or long value.  A pointer to any type or func-
  1592.        tion, or a long value may be converted to an
  1593.        XtPointer and back again and the result will com-
  1594.        pare equal to the original value.  In ANSI C
  1595.        environments it is expected that XtPointer will
  1596.        be defined as void*.
  1597.  
  1598. XtArgVal   A datum large enough to contain an XtPointer,
  1599.        Cardinal, Dimension, or Position value.
  1600.  
  1601. XtEnum       An integer datum large enough to encode at least
  1602.        128 distinct values, two of which are the sym-
  1603.        bolic values True and False.  The symbolic values
  1604.        TRUE and FALSE are also defined to be equal to
  1605.        True and False, respectively.
  1606.  
  1607. In addition to these specific types, the precise order of
  1608. the fields within the structure declarations for any of the
  1609. instance part records ObjectPart, RectObjPart, CorePart,
  1610. CompositePart, ShellPart, WMShellPart, TopLevelShellPart,
  1611. and ApplicationShellPart is implementation-defined.  These
  1612. structures may also have additional private fields internal
  1613. to the implementation.    The ObjectPart, RectObjPart, and
  1614. CorePart structures must be defined so that any member with
  1615. the same name appears at the same offset in ObjectRec,
  1616. RectObjRec, and CoreRec (WidgetRec).  No other relations
  1617. between the offsets of any two fields may be assumed.
  1618.  
  1619.  
  1620. 1.6.  Widget Classing
  1621.  
  1622. The widget_class field of a widget points to its widget
  1623. class structure, which contains information that is constant
  1624. across all widgets of that class.  As a consequence, widgets
  1625. usually do not implement directly callable procedures;
  1626. rather, they implement procedures, called methods, that are
  1627. available through their widget class structure.  These meth-
  1628. ods are invoked by generic procedures that envelop common
  1629. actions around the methods implemented by the widget class.
  1630. Such procedures are applicable to all widgets of that class
  1631. and also to widgets whose classes are subclasses of that
  1632. class.
  1633.  
  1634. All widget classes are a subclass of Core and can be sub-
  1635. classed further.  Subclassing reduces the amount of code and
  1636. declarations necessary to make a new widget class that is
  1637. similar to an existing class.  For example, you do not have
  1638. to describe every resource your widget uses in an
  1639. XtResourceList.  Instead, you describe only the resources
  1640. your widget has that its superclass does not.  Subclasses
  1641. usually inherit many of their superclasses' procedures (for
  1642. example, the expose procedure or geometry handler).
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.                  15
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654. X Toolkit Intrinsics                 X11 Release 6.4
  1655.  
  1656.  
  1657. Subclassing, however, can be taken too far.  If you create a
  1658. subclass that inherits none of the procedures of its super-
  1659. class, you should consider whether you have chosen the most
  1660. appropriate superclass.
  1661.  
  1662. To make good use of subclassing, widget declarations and
  1663. naming conventions are highly stylized.  A widget consists
  1664. of three files:
  1665.  
  1666. o    A public .h file, used by client widgets or applica-
  1667.      tions.
  1668.  
  1669. o    A private .h file, used by widgets whose classes are
  1670.      subclasses of the widget class.
  1671.  
  1672. o    A .c file, which implements the widget.
  1673.  
  1674.  
  1675. 1.6.1.    Widget Naming Conventions
  1676.  
  1677. The Intrinsics provide a vehicle by which programmers can
  1678. create new widgets and organize a collection of widgets into
  1679. an application.  To ensure that applications need not deal
  1680. with as many styles of capitalization and spelling as the
  1681. number of widget classes it uses, the following guidelines
  1682. should be followed when writing new widgets:
  1683.  
  1684. o    Use the X library naming conventions that are applica-
  1685.      ble.  For example, a record component name is all low-
  1686.      ercase and uses underscores (_) for compound words (for
  1687.      example, background_pixmap).  Type and procedure names
  1688.      start with uppercase and use capitalization for com-
  1689.      pound words (for example, ArgList or XtSetValues).
  1690.  
  1691. o    A resource name is spelled identically to the field
  1692.      name except that compound names use capitalization
  1693.      rather than underscore.  To let the compiler catch
  1694.      spelling errors, each resource name should have a sym-
  1695.      bolic identifier prefixed with ``XtN''.  For example,
  1696.      the background_pixmap field has the corresponding iden-
  1697.      tifier XtNbackgroundPixmap, which is defined as the
  1698.      string ``backgroundPixmap''.  Many predefined names are
  1699.      listed in <X11/StringDefs.h>.  Before you invent a new
  1700.      name, you should make sure there is not already a name
  1701.      that you can use.
  1702.  
  1703. o    A resource class string starts with a capital letter
  1704.      and uses capitalization for compound names (for exam-
  1705.      ple,``BorderWidth'').  Each resource class string
  1706.      should have a symbolic identifier prefixed with ``XtC''
  1707.      (for example, XtCBorderWidth).  Many predefined classes
  1708.      are listed in <X11/StringDefs.h>.
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.                  16
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720. X Toolkit Intrinsics                 X11 Release 6.4
  1721.  
  1722.  
  1723. o    A resource representation string is spelled identically
  1724.      to the type name (for example, ``TranslationTable'').
  1725.      Each representation string should have a symbolic iden-
  1726.      tifier prefixed with ``XtR'' (for example, XtRTransla-
  1727.      tionTable).  Many predefined representation types are
  1728.      listed in <X11/StringDefs.h>.
  1729.  
  1730. o    New widget classes start with a capital and use upper-
  1731.      case for compound words.  Given a new class name
  1732.      AbcXyz, you should derive several names:
  1733.  
  1734.      -      Additional widget instance structure part name
  1735.       AbcXyzPart.
  1736.  
  1737.      -      Complete widget instance structure names AbcXyzRec
  1738.       and _AbcXyzRec.
  1739.  
  1740.      -      Widget instance structure pointer type name
  1741.       AbcXyzWidget.
  1742.  
  1743.      -      Additional class structure part name AbcXyzClass-
  1744.       Part.
  1745.  
  1746.      -      Complete class structure names AbcXyzClassRec and
  1747.       _AbcXyzClassRec.
  1748.  
  1749.      -      Class structure pointer type name AbcXyzWidget-
  1750.       Class.
  1751.  
  1752.      -      Class structure variable abcXyzClassRec.
  1753.  
  1754.      -      Class structure pointer variable abcXyzWidget-
  1755.       Class.
  1756.  
  1757. o    Action procedures available to translation specifica-
  1758.      tions should follow the same naming conventions as pro-
  1759.      cedures.  That is, they start with a capital letter,
  1760.      and compound names use uppercase (for example, ``High-
  1761.      light'' and ``NotifyClient'').
  1762.  
  1763. The symbolic identifiers XtN..., XtC..., and XtR...  may be
  1764. implemented as macros, as global symbols, or as a mixture of
  1765. the two.  The (implicit) type of the identifier is String.
  1766. The pointer value itself is not significant; clients must
  1767. not assume that inequality of two identifiers implies
  1768. inequality of the resource name, class, or representation
  1769. string.  Clients should also note that although global sym-
  1770. bols permit savings in literal storage in some environments,
  1771. they also introduce the possibility of multiple definition
  1772. conflicts when applications attempt to use independently
  1773. developed widgets simultaneously.
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.                  17
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786. X Toolkit Intrinsics                 X11 Release 6.4
  1787.  
  1788.  
  1789. 1.6.2.    Widget Subclassing in Public .h Files
  1790.  
  1791. The public .h file for a widget class is imported by clients
  1792. and contains
  1793.  
  1794. o    A reference to the public .h file for the superclass.
  1795.  
  1796. o    Symbolic identifiers for the names and classes of the
  1797.      new resources that this widget adds to its superclass.
  1798.      The definitions should have a single space between the
  1799.      definition name and the value and no trailing space or
  1800.      comment in order to reduce the possibility of compiler
  1801.      warnings from similar declarations in multiple classes.
  1802.  
  1803. o    Type declarations for any new resource data types
  1804.      defined by the class.
  1805.  
  1806. o    The class record pointer variable used to create widget
  1807.      instances.
  1808.  
  1809. o    The C type that corresponds to widget instances of this
  1810.      class.
  1811.  
  1812. o    Entry points for new class methods.
  1813.  
  1814. For example, the following is the public .h file for a pos-
  1815. sible implementation of a Label widget:
  1816.  
  1817.  
  1818.      #ifndef LABEL_H
  1819.      #define LABEL_H
  1820.  
  1821.      /* New resources */
  1822.      #define XtNjustify "justify"
  1823.      #define XtNforeground "foreground"
  1824.      #define XtNlabel "label"
  1825.      #define XtNfont "font"
  1826.      #define XtNinternalWidth "internalWidth"
  1827.      #define XtNinternalHeight "internalHeight"
  1828.  
  1829.      /* Class record pointer */
  1830.      extern WidgetClass labelWidgetClass;
  1831.  
  1832.      /* C Widget type definition */
  1833.      typedef struct _LabelRec       *LabelWidget;
  1834.  
  1835.      /* New class method entry points */
  1836.      extern void LabelSetText();
  1837.       /* Widget w */
  1838.       /* String text */
  1839.  
  1840.      extern String LabelGetText();
  1841.       /* Widget w */
  1842.  
  1843.  
  1844.  
  1845.  
  1846.                  18
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852. X Toolkit Intrinsics                 X11 Release 6.4
  1853.  
  1854.  
  1855.      #endif LABEL_H
  1856.  
  1857.  
  1858. The conditional inclusion of the text allows the application
  1859. to include header files for different widgets without being
  1860. concerned that they already may be included as a superclass
  1861. of another widget.
  1862.  
  1863. To accommodate operating systems with file name length
  1864. restrictions, the name of the public .h file is the first
  1865. ten characters of the widget class.  For example, the public
  1866. .h file for the Constraint widget class is Constraint.h.
  1867.  
  1868.  
  1869. 1.6.3.    Widget Subclassing in Private .h Files
  1870.  
  1871. The private .h file for a widget is imported by widget
  1872. classes that are subclasses of the widget and contains
  1873.  
  1874. o    A reference to the public .h file for the class.
  1875.  
  1876. o    A reference to the private .h file for the superclass.
  1877.  
  1878. o    Symbolic identifiers for any new resource representa-
  1879.      tion types defined by the class.  The definitions
  1880.      should have a single space between the definition name
  1881.      and the value and no trailing space or comment.
  1882.  
  1883. o    A structure part definition for the new fields that the
  1884.      widget instance adds to its superclass's widget struc-
  1885.      ture.
  1886.  
  1887. o    The complete widget instance structure definition for
  1888.      this widget.
  1889.  
  1890. o    A structure part definition for the new fields that
  1891.      this widget class adds to its superclass's constraint
  1892.      structure if the widget class is a subclass of Con-
  1893.      straint.
  1894.  
  1895. o    The complete constraint structure definition if the
  1896.      widget class is a subclass of Constraint.
  1897.  
  1898. o    Type definitions for any new procedure types used by
  1899.      class methods declared in the widget class part.
  1900.  
  1901. o    A structure part definition for the new fields that
  1902.      this widget class adds to its superclass's widget class
  1903.      structure.
  1904.  
  1905. o    The complete widget class structure definition for this
  1906.      widget.
  1907.  
  1908.  
  1909.  
  1910.  
  1911.  
  1912.                  19
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918. X Toolkit Intrinsics                 X11 Release 6.4
  1919.  
  1920.  
  1921. o    The complete widget class extension structure defini-
  1922.      tion for this widget, if any.
  1923.  
  1924. o    The symbolic constant identifying the class extension
  1925.      version, if any.
  1926.  
  1927. o    The name of the global class structure variable con-
  1928.      taining the generic class structure for this class.
  1929.  
  1930. o    An inherit constant for each new procedure in the wid-
  1931.      get class part structure.
  1932.  
  1933. For example, the following is the private .h file for a pos-
  1934. sible Label widget:
  1935.  
  1936.  
  1937.      #ifndef LABELP_H
  1938.      #define LABELP_H
  1939.  
  1940.      #include <X11/Label.h>
  1941.  
  1942.      /* New representation types used by the Label widget */
  1943.      #define XtRJustify "Justify"
  1944.  
  1945.      /* New fields for the Label widget record */
  1946.      typedef struct {
  1947.      /* Settable resources */
  1948.       Pixel foreground;
  1949.       XFontStruct *font;
  1950.       String label;        /* text to display */
  1951.       XtJustify justify;
  1952.       Dimension internal_width;/* # pixels horizontal border */
  1953.       Dimension internal_height;/* # pixels vertical border */
  1954.  
  1955.      /* Data derived from resources */
  1956.       GC normal_GC;
  1957.       GC gray_GC;
  1958.       Pixmap gray_pixmap;
  1959.       Position label_x;
  1960.       Position label_y;
  1961.       Dimension label_width;
  1962.       Dimension label_height;
  1963.       Cardinal label_len;
  1964.       Boolean display_sensitive;
  1965.      } LabelPart;
  1966.  
  1967.  
  1968.  
  1969.      /* Full instance record declaration */
  1970.      typedef struct _LabelRec {
  1971.       CorePart core;
  1972.       LabelPart label;
  1973.      } LabelRec;
  1974.  
  1975.  
  1976.  
  1977.  
  1978.                  20
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984. X Toolkit Intrinsics                 X11 Release 6.4
  1985.  
  1986.  
  1987.      /* Types for Label class methods */
  1988.      typedef void (*LabelSetTextProc)();
  1989.       /* Widget w */
  1990.       /* String text */
  1991.  
  1992.      typedef String (*LabelGetTextProc)();
  1993.       /* Widget w */
  1994.  
  1995.      /* New fields for the Label widget class record */
  1996.      typedef struct {
  1997.       LabelSetTextProc set_text;
  1998.       LabelGetTextProc get_text;
  1999.       XtPointer extension;
  2000.      } LabelClassPart;
  2001.  
  2002.      /* Full class record declaration */
  2003.      typedef struct _LabelClassRec {
  2004.       CoreClassPart core_class;
  2005.       LabelClassPart label_class;
  2006.      } LabelClassRec;
  2007.  
  2008.      /* Class record variable */
  2009.      extern LabelClassRec labelClassRec;
  2010.  
  2011.      #define LabelInheritSetText((LabelSetTextProc)_XtInherit)
  2012.      #define LabelInheritGetText((LabelGetTextProc)_XtInherit)
  2013.      #endif LABELP_H
  2014.  
  2015.  
  2016. To accommodate operating systems with file name length
  2017. restrictions, the name of the private .h file is the first
  2018. nine characters of the widget class followed by a capital P.
  2019. For example, the private .h file for the Constraint widget
  2020. class is ConstrainP.h.
  2021.  
  2022.  
  2023. 1.6.4.    Widget Subclassing in .c Files
  2024.  
  2025. The .c file for a widget contains the structure initializer
  2026. for the class record variable, which contains the following
  2027. parts:
  2028.  
  2029. o    Class information (for example, superclass, class_name,
  2030.      widget_size, class_initialize, and class_inited).
  2031.  
  2032. o    Data constants (for example, resources and
  2033.      num_resources, actions and num_actions, visible_inter-
  2034.      est, compress_motion, compress_exposure, and version).
  2035.  
  2036. o    Widget operations (for example, initialize, realize,
  2037.      destroy, resize, expose, set_values, accept_focus, and
  2038.      any new operations specific to the widget).
  2039.  
  2040.  
  2041.  
  2042.  
  2043.  
  2044.                  21
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050. X Toolkit Intrinsics                 X11 Release 6.4
  2051.  
  2052.  
  2053. The superclass field points to the superclass global class
  2054. record, declared in the superclass private .h file.  For
  2055. direct subclasses of the generic core widget, superclass
  2056. should be initialized to the address of the widgetClassRec
  2057. structure.  The superclass is used for class chaining opera-
  2058. tions and for inheriting or enveloping a superclass's opera-
  2059. tions (see Sections 1.6.7, 1.6.9, and 1.6.10).
  2060.  
  2061. The class_name field contains the text name for this class,
  2062. which is used by the resource manager.    For example, the
  2063. Label widget has the string ``Label''.    More than one widget
  2064. class can share the same text class name.  This string must
  2065. be permanently allocated prior to or during the execution of
  2066. the class initialization procedure and must not be subse-
  2067. quently deallocated.
  2068.  
  2069.  
  2070. The widget_size field is the size of the corresponding wid-
  2071. get instance structure (not the size of the class struc-
  2072. ture).
  2073.  
  2074. The version field indicates the toolkit implementation ver-
  2075. sion number and is used for runtime consistency checking of
  2076. the X Toolkit and widgets in an application.  Widget writers
  2077. must set it to the implementation-defined symbolic value
  2078. XtVersion in the widget class structure initialization.
  2079. Those widget writers who believe that their widget binaries
  2080. are compatible with other implementations of the Intrinsics
  2081. can put the special value XtVersionDontCheck in the version
  2082. field to disable version checking for those widgets.  If a
  2083. widget needs to compile alternative code for different revi-
  2084. sions of the Intrinsics interface definition, it may use the
  2085. symbol XtSpecificationRelease, as described in Chapter 13.
  2086. Use of XtVersion allows the Intrinsics implementation to
  2087. recognize widget binaries that were compiled with older
  2088. implementations.
  2089.  
  2090. The extension field is for future upward compatibility.  If
  2091. the widget programmer adds fields to class parts, all sub-
  2092. class structure layouts change, requiring complete recompi-
  2093. lation.  To allow clients to avoid recompilation, an exten-
  2094. sion field at the end of each class part can point to a
  2095. record that contains any additional class information
  2096. required.
  2097.  
  2098. All other fields are described in their respective sections.
  2099.  
  2100. The .c file also contains the declaration of the global
  2101. class structure pointer variable used to create instances of
  2102. the class.  The following is an abbreviated version of the
  2103. .c file for a Label widget.  The resources table is
  2104. described in Chapter 9.
  2105.  
  2106.  
  2107.  
  2108.  
  2109.  
  2110.                  22
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116. X Toolkit Intrinsics                 X11 Release 6.4
  2117.  
  2118.  
  2119.      /* Resources specific to Label */
  2120.      static XtResource resources[] = {
  2121.       {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
  2122.          XtOffset(LabelWidget, label.foreground), XtRString,
  2123.          XtDefaultForeground},
  2124.       {XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *),
  2125.          XtOffset(LabelWidget, label.font),XtRString,
  2126.          XtDefaultFont},
  2127.       {XtNlabel, XtCLabel, XtRString, sizeof(String),
  2128.          XtOffset(LabelWidget, label.label), XtRString, NULL},
  2129.             .
  2130.             .
  2131.             .
  2132.      }
  2133.  
  2134.      /* Forward declarations of procedures */
  2135.      static void ClassInitialize();
  2136.      static void Initialize();
  2137.      static void Realize();
  2138.      static void SetText();
  2139.      static void GetText();
  2140.       .
  2141.       .
  2142.       .
  2143.  
  2144.  
  2145.  
  2146.      /* Class record constant */
  2147.      LabelClassRec labelClassRec = {
  2148.        {
  2149.      /* core_class fields */
  2150.       /* superclass  */       (WidgetClass)&coreClassRec,
  2151.       /* class_name  */       "Label",
  2152.       /* widget_size */       sizeof(LabelRec),
  2153.       /* class_initialize       */ClassInitialize,
  2154.       /* class_part_initialize */NULL,
  2155.       /* class_inited       */False,
  2156.       /* initialize  */       Initialize,
  2157.       /* initialize_hook       */NULL,
  2158.       /* realize     */       Realize,
  2159.       /* actions     */       NULL,
  2160.       /* num_actions */       0,
  2161.       /* resources     */       resources,
  2162.       /* num_resources       */XtNumber(resources),
  2163.       /* xrm_class     */       NULLQUARK,
  2164.       /* compress_motion       */True,
  2165.       /* compress_exposure       */True,
  2166.       /* compress_enterleave   */True,
  2167.       /* visible_interest       */False,
  2168.       /* destroy     */       NULL,
  2169.       /* resize     */       Resize,
  2170.       /* expose     */       Redisplay,
  2171.       /* set_values  */       SetValues,
  2172.       /* set_values_hook       */NULL,
  2173.  
  2174.  
  2175.  
  2176.                  23
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182. X Toolkit Intrinsics                 X11 Release 6.4
  2183.  
  2184.  
  2185.       /* set_values_almost       */XtInheritSetValuesAlmost,
  2186.       /* get_values_hook       */NULL,
  2187.       /* accept_focus       */NULL,
  2188.       /* version     */       XtVersion,
  2189.       /* callback_offsets       */NULL,
  2190.       /* tm_table     */       NULL,
  2191.       /* query_geometry       */XtInheritQueryGeometry,
  2192.       /* display_accelerator   */NULL,
  2193.       /* extension     */       NULL
  2194.        },
  2195.        {
  2196.      /* Label_class fields       */
  2197.       /* get_text     */       GetText,
  2198.       /* set_text     */       SetText,
  2199.       /* extension     */       NULL
  2200.        }
  2201.      };
  2202.  
  2203.      /* Class record pointer */
  2204.      WidgetClass labelWidgetClass = (WidgetClass) &labelClassRec;
  2205.  
  2206.      /* New method access routines */
  2207.      void LabelSetText(w, text)
  2208.       Widget w;
  2209.       String text;
  2210.      {
  2211.       Label WidgetClass lwc = (Label WidgetClass)XtClass(w);
  2212.       XtCheckSubclass(w, labelWidgetClass, NULL);
  2213.       *(lwc->label_class.set_text)(w, text)
  2214.      }
  2215.      /* Private procedures */
  2216.       .
  2217.       .
  2218.       .
  2219.  
  2220.  
  2221.  
  2222. 1.6.5.    Widget Class and Superclass Look Up
  2223.  
  2224. To obtain the class of a widget, use XtClass.
  2225.  
  2226. __
  2227. |
  2228. WidgetClass XtClass(w)
  2229.       Widget w;
  2230.  
  2231.  
  2232. w      Specifies the widget. Must be of class Object or
  2233.       any subclass thereof.
  2234. |__
  2235.  
  2236. The XtClass function returns a pointer to the widget's class
  2237. structure.
  2238.  
  2239.  
  2240.  
  2241.  
  2242.                  24
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248. X Toolkit Intrinsics                 X11 Release 6.4
  2249.  
  2250.  
  2251. To obtain the superclass of a widget, use XtSuperclass.
  2252.  
  2253. __
  2254. |
  2255. WidgetClass XtSuperclass(w)
  2256.       Widget w;
  2257.  
  2258.  
  2259. w      Specifies the widget. Must be of class Object or
  2260.       any subclass thereof.
  2261. |__
  2262.  
  2263. The XtSuperclass function returns a pointer to the widget's
  2264. superclass class structure.
  2265.  
  2266.  
  2267. 1.6.6.    Widget Subclass Verification
  2268.  
  2269. To check the subclass to which a widget belongs, use
  2270. XtIsSubclass.
  2271.  
  2272. __
  2273. |
  2274. Boolean XtIsSubclass(w, widget_class)
  2275.       Widget w;
  2276.       WidgetClass widget_class;
  2277.  
  2278.  
  2279. w      Specifies the widget or object instance whose
  2280.       class is to be checked.  Must be of class Object
  2281.       or any subclass thereof.
  2282.  
  2283. widget_class
  2284.       Specifies the widget class for which to test. Must
  2285.       be objectClass or any subclass thereof.
  2286. |__
  2287.  
  2288. The XtIsSubclass function returns True if the class of the
  2289. specified widget is equal to or is a subclass of the speci-
  2290. fied class.  The widget's class can be any number of sub-
  2291. classes down the chain and need not be an immediate subclass
  2292. of the specified class.  Composite widgets that need to
  2293. restrict the class of the items they contain can use XtIs-
  2294. Subclass to find out if a widget belongs to the desired
  2295. class of objects.
  2296.  
  2297.  
  2298. To test if a given widget belongs to a subclass of an
  2299. Intrinsics-defined class, the Intrinsics define macros or
  2300. functions equivalent to XtIsSubclass for each of the built-
  2301. in classes.  These procedures are XtIsObject, XtIsRectObj,
  2302. XtIsWidget, XtIsComposite, XtIsConstraint, XtIsShell,
  2303. XtIsOverrideShell, XtIsWMShell, XtIsVendorShell,
  2304. XtIsTransientShell, XtIsTopLevelShell, XtIsApplicationShell,
  2305.  
  2306.  
  2307.  
  2308.                  25
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314. X Toolkit Intrinsics                 X11 Release 6.4
  2315.  
  2316.  
  2317. and XtIsSessionShell.
  2318.  
  2319. All these macros and functions have the same argument
  2320. description.
  2321.  
  2322. __
  2323. |
  2324. Boolean XtIs<class> (w)
  2325.       Widget w;
  2326.  
  2327.  
  2328. w      Specifies the widget or object instance whose
  2329.       class is to be checked.  Must be of class Object
  2330.       or any subclass thereof.
  2331. |__
  2332.  
  2333. These procedures may be faster than calling XtIsSubclass
  2334. directly for the built-in classes.
  2335.  
  2336.  
  2337. To check a widget's class and to generate a debugging error
  2338. message, use XtCheckSubclass, defined in <X11/IntrinsicP.h>:
  2339.  
  2340. __
  2341. |
  2342. void XtCheckSubclass(w, widget_class, message)
  2343.       Widget w;
  2344.       WidgetClass widget_class;
  2345.       String message;
  2346.  
  2347.  
  2348. w      Specifies the widget or object whose class is to
  2349.       be checked.  Must be of class Object or any sub-
  2350.       class thereof.
  2351.  
  2352. widget_class
  2353.       Specifies the widget class for which to test.
  2354.       Must be objectClass or any subclass thereof.
  2355.  
  2356. message   Specifies the message to be used.
  2357. |__
  2358.  
  2359. The XtCheckSubclass macro determines if the class of the
  2360. specified widget is equal to or is a subclass of the speci-
  2361. fied class.  The widget's class can be any number of sub-
  2362. classes down the chain and need not be an immediate subclass
  2363. of the specified class.  If the specified widget's class is
  2364. not a subclass, XtCheckSubclass constructs an error message
  2365. from the supplied message, the widget's actual class, and
  2366. the expected class and calls XtErrorMsg.  XtCheckSubclass
  2367. should be used at the entry point of exported routines to
  2368. ensure that the client has passed in a valid widget class
  2369. for the exported operation.
  2370.  
  2371.  
  2372.  
  2373.  
  2374.                  26
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380. X Toolkit Intrinsics                 X11 Release 6.4
  2381.  
  2382.  
  2383. XtCheckSubclass is only executed when the module has been
  2384. compiled with the compiler symbol DEBUG defined; otherwise,
  2385. it is defined as the empty string and generates no code.
  2386.  
  2387.  
  2388. 1.6.7.    Superclass Chaining
  2389.  
  2390. While most fields in a widget class structure are self-con-
  2391. tained, some fields are linked to their corresponding fields
  2392. in their superclass structures.  With a linked field, the
  2393. Intrinsics access the field's value only after accessing its
  2394. corresponding superclass value (called downward superclass
  2395. chaining) or before accessing its corresponding superclass
  2396. value (called upward superclass chaining).  The self-con-
  2397. tained fields are
  2398.  
  2399. In all widget classes:class_name
  2400.             class_initialize
  2401.             widget_size
  2402.             realize
  2403.             visible_interest
  2404.             resize
  2405.             expose
  2406.             accept_focus
  2407.             compress_motion
  2408.             compress_exposure
  2409.             compress_enterleave
  2410.             set_values_almost
  2411.             tm_table
  2412.             version
  2413.             allocate
  2414.             deallocate
  2415.  
  2416. In Composite widget classes:geometry_manager
  2417.             change_managed
  2418.             insert_child
  2419.             delete_child
  2420.             accepts_objects
  2421.             allows_change_managed_set
  2422.  
  2423. In Constraint widget classes:constraint_size
  2424.  
  2425. In Shell widget classes:root_geometry_manager
  2426.  
  2427.  
  2428. With downward superclass chaining, the invocation of an
  2429. operation first accesses the field from the Object, RectObj,
  2430. and Core class structures, then from the subclass structure,
  2431. and so on down the class chain to that widget's class struc-
  2432. ture.  These superclass-to-subclass fields are
  2433.  
  2434.       class_part_initialize
  2435.       get_values_hook
  2436.       initialize
  2437.  
  2438.  
  2439.  
  2440.                  27
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446. X Toolkit Intrinsics                 X11 Release 6.4
  2447.  
  2448.  
  2449.       initialize_hook
  2450.       set_values
  2451.       set_values_hook
  2452.       resources
  2453.  
  2454.  
  2455. In addition, for subclasses of Constraint, the following
  2456. fields of the ConstraintClassPart and ConstraintClassExten-
  2457. sionRec structures are chained from the Constraint class
  2458. down to the subclass:
  2459.       resources
  2460.       initialize
  2461.       set_values
  2462.       get_values_hook
  2463.  
  2464.  
  2465. With upward superclass chaining, the invocation of an opera-
  2466. tion first accesses the field from the widget class struc-
  2467. ture, then from the superclass structure, and so on up the
  2468. class chain to the Core, RectObj, and Object class struc-
  2469. tures.    The subclass-to-superclass fields are
  2470.  
  2471.       destroy
  2472.       actions
  2473.  
  2474.  
  2475. For subclasses of Constraint, the following field of Con-
  2476. straintClassPart is chained from the subclass up to the Con-
  2477. straint class:
  2478.  
  2479.       destroy
  2480.  
  2481.  
  2482. 1.6.8.    Class Initialization: class_initialize and
  2483. class_part_initialize Procedures
  2484.  
  2485. Many class records can be initialized completely at compile
  2486. or link time.  In some cases, however, a class may need to
  2487. register type converters or perform other sorts of once-only
  2488. runtime initialization.
  2489.  
  2490. Because the C language does not have initialization proce-
  2491. dures that are invoked automatically when a program starts
  2492. up, a widget class can declare a class_initialize procedure
  2493. that will be automatically called exactly once by the
  2494. Intrinsics.  A class initialization procedure pointer is of
  2495. type XtProc:
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.  
  2504.  
  2505.  
  2506.                  28
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512. X Toolkit Intrinsics                 X11 Release 6.4
  2513.  
  2514. __
  2515. |
  2516. typedef void (*XtProc)(void);
  2517.  
  2518. |__
  2519.  
  2520. A widget class indicates that it has no class initialization
  2521. procedure by specifying NULL in the class_initialize field.
  2522.  
  2523. In addition to the class initialization that is done exactly
  2524. once, some classes perform initialization for fields in
  2525. their parts of the class record.  These are performed not
  2526. just for the particular class, but for subclasses as well,
  2527. and are done in the class's class part initialization proce-
  2528. dure, a pointer to which is stored in the class_part_ini-
  2529. tialize field.    The class_part_initialize procedure pointer
  2530. is of type XtWidgetClassProc.
  2531.  
  2532. __
  2533. |
  2534. typedef void (*XtWidgetClassProc)(WidgetClass);
  2535.       WidgetClass widget_class;
  2536.  
  2537.  
  2538. widget_class
  2539.       Points to the class structure for the class being
  2540.       initialized.
  2541. |__
  2542.  
  2543. During class initialization, the class part initialization
  2544. procedures for the class and all its superclasses are called
  2545. in superclass-to-subclass order on the class record.  These
  2546. procedures have the responsibility of doing any dynamic ini-
  2547. tializations necessary to their class's part of the record.
  2548. The most common is the resolution of any inherited methods
  2549. defined in the class.  For example, if a widget class C has
  2550. superclasses Core, Composite, A, and B, the class record for
  2551. C first is passed to Core 's class_part_initialize proce-
  2552. dure.  This resolves any inherited Core methods and compiles
  2553. the textual representations of the resource list and action
  2554. table that are defined in the class record.  Next, Compos-
  2555. ite's class_part_initialize procedure is called to initial-
  2556. ize the composite part of C's class record.  Finally, the
  2557. class_part_initialize procedures for A, B, and C, in that
  2558. order, are called.  For further information, see Section
  2559. 1.6.9.    Classes that do not define any new class fields or
  2560. that need no extra processing for them can specify NULL in
  2561. the class_part_initialize field.
  2562.  
  2563. All widget classes, whether they have a class initialization
  2564. procedure or not, must start with their class_inited field
  2565. False.
  2566.  
  2567. The first time a widget of a class is created, XtCreateWid-
  2568. get ensures that the widget class and all superclasses are
  2569.  
  2570.  
  2571.  
  2572.                  29
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578. X Toolkit Intrinsics                 X11 Release 6.4
  2579.  
  2580.  
  2581. initialized, in superclass-to-subclass order, by checking
  2582. each class_inited field and, if it is False, by calling the
  2583. class_initialize and the class_part_initialize procedures
  2584. for the class and all its superclasses.  The Intrinsics then
  2585. set the class_inited field to a nonzero value.    After the
  2586. one-time initialization, a class structure is constant.
  2587.  
  2588. The following example provides the class initialization pro-
  2589. cedure for a Label class.
  2590.  
  2591.  
  2592.      static void ClassInitialize()
  2593.      {
  2594.       XtSetTypeConverter(XtRString, XtRJustify, CvtStringToJustify,
  2595.              NULL, 0, XtCacheNone, NULL);
  2596.      }
  2597.  
  2598.  
  2599.  
  2600. 1.6.9.    Initializing a Widget Class
  2601.  
  2602. A class is initialized when the first widget of that class
  2603. or any subclass is created.  To initialize a widget class
  2604. without creating any widgets, use XtInitializeWidgetClass.
  2605.  
  2606. __
  2607. |
  2608. void XtInitializeWidgetClass(object_class)
  2609.       WidgetClass object_class;
  2610.  
  2611.  
  2612. object_class
  2613.       Specifies the object class to initialize.  May be
  2614.       objectClass or any subclass thereof.
  2615. |__
  2616.  
  2617. If the specified widget class is already initialized, XtIni-
  2618. tializeWidgetClass returns immediately.
  2619.  
  2620. If the class initialization procedure registers type con-
  2621. verters, these type converters are not available until the
  2622. first object of the class or subclass is created or XtIni-
  2623. tializeWidgetClass is called (see Section 9.6).
  2624.  
  2625.  
  2626. 1.6.10.  Inheritance of Superclass Operations
  2627.  
  2628. A widget class is free to use any of its superclass's self-
  2629. contained operations rather than implementing its own code.
  2630. The most frequently inherited operations are
  2631.  
  2632.      expose
  2633.  
  2634.  
  2635.  
  2636.  
  2637.  
  2638.                  30
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644. X Toolkit Intrinsics                 X11 Release 6.4
  2645.  
  2646.  
  2647.      realize
  2648.  
  2649.      insert_child
  2650.  
  2651.      delete_child
  2652.  
  2653.      geometry_manager
  2654.  
  2655.      set_values_almost
  2656.  
  2657. To inherit an operation xyz, specify the constant
  2658. XtInheritXyz in your class record.
  2659.  
  2660. Every class that declares a new procedure in its widget
  2661. class part must provide for inheriting the procedure in its
  2662. class_part_initialize procedure.  The chained operations
  2663. declared in Core and Constraint records are never inherited.
  2664. Widget classes that do nothing beyond what their superclass
  2665. does specify NULL for chained procedures in their class
  2666. records.
  2667.  
  2668. Inheriting works by comparing the value of the field with a
  2669. known, special value and by copying in the superclass's
  2670. value for that field if a match occurs.  This special value,
  2671. called the inheritance constant, is usually the Intrinsics
  2672. internal value _XtInherit cast to the appropriate type.
  2673. _XtInherit is a procedure that issues an error message if it
  2674. is actually called.
  2675.  
  2676. For example, CompositeP.h contains these definitions:
  2677.  
  2678.  
  2679.      #define XtInheritGeometryManager ((XtGeometryHandler) _XtInherit)
  2680.      #define XtInheritChangeManaged ((XtWidgetProc) _XtInherit)
  2681.      #define XtInheritInsertChild ((XtArgsProc) _XtInherit)
  2682.      #define XtInheritDeleteChild ((XtWidgetProc) _XtInherit)
  2683.  
  2684.  
  2685. Composite's class_part_initialize procedure begins as fol-
  2686. lows:
  2687.  
  2688.  
  2689.      static void CompositeClassPartInitialize(widgetClass)
  2690.        WidgetClass widgetClass;
  2691.      {
  2692.        CompositeWidgetClass wc = (CompositeWidgetClass)widgetClass;
  2693.        CompositeWidgetClass super = (CompositeWidgetClass)wc->core_class.superclass;
  2694.  
  2695.        if (wc->composite_class.geometry_manager == XtInheritGeometryManager) {
  2696.        wc->composite_class.geometry_manager = super->composite_class.geometry_manager;
  2697.        }
  2698.  
  2699.        if (wc->composite_class.change_managed == XtInheritChangeManaged) {
  2700.        wc->composite_class.change_managed = super->composite_class.change_managed;
  2701.  
  2702.  
  2703.  
  2704.                  31
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710. X Toolkit Intrinsics                 X11 Release 6.4
  2711.  
  2712.  
  2713.        }
  2714.        .
  2715.        .
  2716.        .
  2717.  
  2718.  
  2719. Nonprocedure fields may be inherited in the same manner as
  2720. procedure fields.  The class may declare any reserved value
  2721. it wishes for the inheritance constant for its new fields.
  2722. The following inheritance constants are defined:
  2723.  
  2724. For Object:
  2725.  
  2726.      XtInheritAllocate
  2727.  
  2728.      XtInheritDeallocate
  2729.  
  2730. For Core:
  2731.  
  2732.      XtInheritRealize
  2733.  
  2734.      XtInheritResize
  2735.  
  2736.      XtInheritExpose
  2737.  
  2738.      XtInheritSetValuesAlmost
  2739.  
  2740.      XtInheritAcceptFocus
  2741.  
  2742.      XtInheritQueryGeometry
  2743.  
  2744.      XtInheritTranslations
  2745.  
  2746.      XtInheritDisplayAccelerator
  2747.  
  2748. For Composite:
  2749.  
  2750.      XtInheritGeometryManager
  2751.  
  2752.      XtInheritChangeManaged
  2753.  
  2754.      XtInheritInsertChild
  2755.  
  2756.      XtInheritDeleteChild
  2757.  
  2758. For Shell:
  2759.  
  2760.      XtInheritRootGeometryManager
  2761.  
  2762.  
  2763. 1.6.11.  Invocation of Superclass Operations
  2764.  
  2765. A widget sometimes needs to call a superclass operation that
  2766. is not chained.  For example, a widget's expose procedure
  2767.  
  2768.  
  2769.  
  2770.                  32
  2771.  
  2772.  
  2773.  
  2774.  
  2775.  
  2776. X Toolkit Intrinsics                 X11 Release 6.4
  2777.  
  2778.  
  2779. might call its superclass's expose and then perform a little
  2780. more work on its own.  For example, a Composite class with
  2781. predefined managed children can implement insert_child by
  2782. first calling its superclass's insert_child and then calling
  2783. XtManageChild to add the child to the managed set.
  2784.  
  2785.  
  2786.                 Note
  2787.  
  2788.      A class method should not use XtSuperclass but
  2789.      should instead call the class method of its own
  2790.      specific superclass directly through the super-
  2791.      class record.  That is, it should use its own
  2792.      class pointers only, not the widget's class point-
  2793.      ers, as the widget's class may be a subclass of
  2794.      the class whose implementation is being refer-
  2795.      enced.
  2796.  
  2797. This technique is referred to as enveloping the superclass's
  2798. operation.
  2799.  
  2800.  
  2801. 1.6.12.  Class Extension Records
  2802.  
  2803. It may be necessary at times to add new fields to already
  2804. existing widget class structures.  To permit this to be done
  2805. without requiring recompilation of all subclasses, the last
  2806. field in a class part structure should be an extension
  2807. pointer.  If no extension fields for a class have yet been
  2808. defined, subclasses should initialize the value of the
  2809. extension pointer to NULL.
  2810.  
  2811. If extension fields exist, as is the case with the Compos-
  2812. ite, Constraint, and Shell classes, subclasses can provide
  2813. values for these fields by setting the extension pointer for
  2814. the appropriate part in their class structure to point to a
  2815. statically declared extension record containing the addi-
  2816. tional fields.    Setting the extension field is never manda-
  2817. tory; code that uses fields in the extension record must
  2818. always check the extension field and take some appropriate
  2819. default action if it is NULL.
  2820.  
  2821. In order to permit multiple subclasses and libraries to
  2822. chain extension records from a single extension field,
  2823. extension records should be declared as a linked list, and
  2824. each extension record definition should contain the follow-
  2825. ing four fields at the beginning of the structure declara-
  2826. tion:
  2827.  
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833.  
  2834.  
  2835.  
  2836.                  33
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842. X Toolkit Intrinsics                 X11 Release 6.4
  2843.  
  2844. __
  2845. |
  2846. struct {
  2847.      XtPointer next_extension;
  2848.      XrmQuark record_type;
  2849.      long version;
  2850.      Cardinal record_size;
  2851. };
  2852.  
  2853.  
  2854. next_extension
  2855.         Specifies the next record in the list, or NULL.
  2856.  
  2857. record_type Specifies the particular structure declaration
  2858.         to which each extension record instance con-
  2859.         forms.
  2860.  
  2861. version     Specifies a version id symbolic constant sup-
  2862.         plied by the definer of the structure.
  2863.  
  2864. record_size Specifies the total number of bytes allocated
  2865.         for the extension record.
  2866. |__
  2867.  
  2868. The record_type field identifies the contents of the exten-
  2869. sion record and is used by the definer of the record to
  2870. locate its particular extension record in the list.  The
  2871. record_type field is normally assigned the result of Xrm-
  2872. StringToQuark for a registered string constant.  The Intrin-
  2873. sics reserve all record type strings beginning with the two
  2874. characters ``XT'' for future standard uses.  The value NUL-
  2875. LQUARK may also be used by the class part owner in extension
  2876. records attached to its own class part extension field to
  2877. identify the extension record unique to that particular
  2878. class.
  2879.  
  2880. The version field is an owner-defined constant that may be
  2881. used to identify binary files that have been compiled with
  2882. alternate definitions of the remainder of the extension
  2883. record data structure.    The private header file for a widget
  2884. class should provide a symbolic constant for subclasses to
  2885. use to initialize this field.  The record_size field value
  2886. includes the four common header fields and should normally
  2887. be initialized with sizeof().
  2888.  
  2889. Any value stored in the class part extension fields of
  2890. CompositeClassPart, ConstraintClassPart, or ShellClassPart
  2891. must point to an extension record conforming to this defini-
  2892. tion.
  2893.  
  2894. The Intrinsics provide a utility function for widget writers
  2895. to locate a particular class extension record in a linked
  2896. list, given a widget class and the offset of the extension
  2897. field in the class record.
  2898.  
  2899.  
  2900.  
  2901.  
  2902.                  34
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908. X Toolkit Intrinsics                 X11 Release 6.4
  2909.  
  2910.  
  2911. To locate a class extension record, use XtGetClassExtension.
  2912.  
  2913. __
  2914. |
  2915. XtPointer XtGetClassExtension(object_class, byte_offset, type, version, record_size)
  2916.       WidgetClass object_class;
  2917.       Cardinal byte_offset;
  2918.       XrmQuark type;
  2919.       long version;
  2920.       Cardinal record_size;
  2921.  
  2922.  
  2923. object_class
  2924.       Specifies the object class containing the exten-
  2925.       sion list to be searched.
  2926.  
  2927. byte_offset
  2928.       Specifies the offset in bytes from the base of the
  2929.       class record of the extension field to be
  2930.       searched.
  2931.  
  2932. type      Specifies the record_type of the class extension
  2933.       to be located.
  2934.  
  2935. version   Specifies the minimum acceptable version of the
  2936.       class extension required for a match.
  2937.  
  2938. record_size
  2939.       Specifies the minimum acceptable length of the
  2940.       class extension record required for a match, or 0.
  2941. |__
  2942.  
  2943. The list of extension records at the specified offset in the
  2944. specified object class will be searched for a match on the
  2945. specified type, a version greater than or equal to the spec-
  2946. ified version, and a record size greater than or equal the
  2947. specified record_size if it is nonzero.  XtGetClassExtension
  2948. returns a pointer to a matching extension record or NULL if
  2949. no match is found.  The returned extension record must not
  2950. be modified or freed by the caller if the caller is not the
  2951. extension owner.
  2952.  
  2953.  
  2954.  
  2955.  
  2956.  
  2957.  
  2958.  
  2959.  
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965.  
  2966.  
  2967.  
  2968.                  35
  2969.  
  2970.  
  2971.  
  2972.  
  2973.  
  2974. X Toolkit Intrinsics                 X11 Release 6.4
  2975.  
  2976.  
  2977.  
  2978.  
  2979.              Chapter 2
  2980.  
  2981.             Widget Instantiation
  2982.  
  2983.  
  2984.  
  2985. A hierarchy of widget instances constitutes a widget tree.
  2986. The shell widget returned by XtAppCreateShell is the root of
  2987. the widget tree instance.  The widgets with one or more
  2988. children are the intermediate nodes of that tree, and the
  2989. widgets with no children of any kind are the leaves of the
  2990. widget tree.  With the exception of pop-up children (see
  2991. Chapter 5), this widget tree instance defines the associated
  2992. X Window tree.
  2993.  
  2994. Widgets can be either composite or primitive.  Both kinds of
  2995. widgets can contain children, but the Intrinsics provide a
  2996. set of management mechanisms for constructing and interfac-
  2997. ing between composite widgets, their children, and other
  2998. clients.
  2999.  
  3000. Composite widgets, that is, members of the class
  3001. compositeWidgetClass, are containers for an arbitrary, but
  3002. widget implementation-defined, collection of children, which
  3003. may be instantiated by the composite widget itself, by other
  3004. clients, or by a combination of the two.  Composite widgets
  3005. also contain methods for managing the geometry (layout) of
  3006. any child widget.  Under unusual circumstances, a composite
  3007. widget may have zero children, but it usually has at least
  3008. one.  By contrast, primitive widgets that contain children
  3009. typically instantiate specific children of known classes
  3010. themselves and do not expect external clients to do so.
  3011. Primitive widgets also do not have general geometry manage-
  3012. ment methods.
  3013.  
  3014. In addition, the Intrinsics recursively perform many opera-
  3015. tions (for example, realization and destruction) on compos-
  3016. ite widgets and all their children.  Primitive widgets that
  3017. have children must be prepared to perform the recursive
  3018. operations themselves on behalf of their children.
  3019.  
  3020. A widget tree is manipulated by several Intrinsics func-
  3021. tions.    For example, XtRealizeWidget traverses the tree
  3022. downward and recursively realizes all pop-up widgets and
  3023. children of composite widgets.    XtDestroyWidget traverses
  3024. the tree downward and destroys all pop-up widgets and chil-
  3025. dren of composite widgets.  The functions that fetch and
  3026. modify resources traverse the tree upward and determine the
  3027. inheritance of resources from a widget's ancestors.  XtMake-
  3028. GeometryRequest traverses the tree up one level and calls
  3029. the geometry manager that is responsible for a widget
  3030. child's geometry.
  3031.  
  3032.  
  3033.  
  3034.                  36
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040. X Toolkit Intrinsics                 X11 Release 6.4
  3041.  
  3042.  
  3043. To facilitate upward traversal of the widget tree, each wid-
  3044. get has a pointer to its parent widget.  The Shell widget
  3045. that XtAppCreateShell returns has a parent pointer of NULL.
  3046.  
  3047. To facilitate downward traversal of the widget tree, the
  3048. children field of each composite widget is a pointer to an
  3049. array of child widgets, which includes all normal children
  3050. created, not just the subset of children that are managed by
  3051. the composite widget's geometry manager.  Primitive widgets
  3052. that instantiate children are entirely responsible for all
  3053. operations that require downward traversal below themselves.
  3054. In addition, every widget has a pointer to an array of pop-
  3055. up children.
  3056.  
  3057.  
  3058. 2.1.  Initializing the X Toolkit
  3059.  
  3060. Before an application can call any Intrinsics function other
  3061. than XtSetLanguageProc and XtToolkitThreadInitialize, it
  3062. must initialize the Intrinsics by using
  3063.  
  3064. o    XtToolkitInitialize, which initializes the Intrinsics
  3065.      internals
  3066.  
  3067. o    XtCreateApplicationContext, which initializes the per-
  3068.      application state
  3069.  
  3070. o    XtDisplayInitialize or XtOpenDisplay, which initializes
  3071.      the per-display state
  3072.  
  3073. o    XtAppCreateShell, which creates the root of a widget
  3074.      tree
  3075.  
  3076. Or an application can call the convenience procedure
  3077. XtOpenApplication, which combines the functions of the pre-
  3078. ceding procedures.  An application wishing to use the ANSI C
  3079. locale mechanism should call XtSetLanguageProc prior to
  3080. calling XtDisplayInitialize, XtOpenDisplay,
  3081. XtOpenApplication, or XtAppInitialize.
  3082.  
  3083. Multiple instances of X Toolkit applications may be imple-
  3084. mented in a single address space.  Each instance needs to be
  3085. able to read input and dispatch events independently of any
  3086. other instance.  Further, an application instance may need
  3087. multiple display connections to have widgets on multiple
  3088. displays.  From the application's point of view, multiple
  3089. display connections usually are treated together as a single
  3090. unit for purposes of event dispatching.  To accommodate both
  3091. requirements, the Intrinsics define application contexts,
  3092. each of which provides the information needed to distinguish
  3093. one application instance from another.    The major component
  3094. of an application context is a list of one or more X Display
  3095. pointers for that application.    The Intrinsics handle all
  3096. display connections within a single application context
  3097.  
  3098.  
  3099.  
  3100.                  37
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106. X Toolkit Intrinsics                 X11 Release 6.4
  3107.  
  3108.  
  3109. simultaneously, handling input in a round-robin fashion.
  3110. The application context type XtAppContext is opaque to
  3111. clients.
  3112.  
  3113.  
  3114. To initialize the Intrinsics internals, use
  3115. XtToolkitInitialize.
  3116.  
  3117. __
  3118. |
  3119. void XtToolkitInitialize()
  3120.  
  3121. |__
  3122.  
  3123. If XtToolkitInitialize was previously called, it returns
  3124. immediately.  When XtToolkitThreadInitialize is called
  3125. before XtToolkitInitialize, the latter is protected against
  3126. simultaneous activation by multiple threads.
  3127.  
  3128.  
  3129. To create an application context, use
  3130. XtCreateApplicationContext.
  3131.  
  3132. __
  3133. |
  3134. XtAppContext XtCreateApplicationContext()
  3135.  
  3136. |__
  3137.  
  3138. The XtCreateApplicationContext function returns an applica-
  3139. tion context, which is an opaque type.    Every application
  3140. must have at least one application context.
  3141.  
  3142.  
  3143. To destroy an application context and close any remaining
  3144. display connections in it, use XtDestroyApplicationContext.
  3145.  
  3146. __
  3147. |
  3148. void XtDestroyApplicationContext(app_context)
  3149.       XtAppContext app_context;
  3150.  
  3151.  
  3152. app_context
  3153.       Specifies the application context.
  3154. |__
  3155.  
  3156. The XtDestroyApplicationContext function destroys the speci-
  3157. fied application context.  If called from within an event
  3158. dispatch (for example, in a callback procedure), XtDestroy-
  3159. ApplicationContext does not destroy the application context
  3160. until the dispatch is complete.
  3161.  
  3162.  
  3163.  
  3164.  
  3165.  
  3166.                  38
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172. X Toolkit Intrinsics                 X11 Release 6.4
  3173.  
  3174.  
  3175. To get the application context in which a given widget was
  3176. created, use XtWidgetToApplicationContext.
  3177.  
  3178. __
  3179. |
  3180. XtAppContext XtWidgetToApplicationContext(w)
  3181.       Widget w;
  3182.  
  3183.  
  3184. w      Specifies the widget for which you want the appli-
  3185.       cation context.  Must be of class Object or any
  3186.       subclass thereof.
  3187. |__
  3188.  
  3189. The XtWidgetToApplicationContext function returns the appli-
  3190. cation context for the specified widget.
  3191.  
  3192.  
  3193. To initialize a display and add it to an application con-
  3194. text, use XtDisplayInitialize.
  3195.  
  3196.  
  3197.  
  3198.  
  3199.  
  3200.  
  3201.  
  3202.  
  3203.  
  3204.  
  3205.  
  3206.  
  3207.  
  3208.  
  3209.  
  3210.  
  3211.  
  3212.  
  3213.  
  3214.  
  3215.  
  3216.  
  3217.  
  3218.  
  3219.  
  3220.  
  3221.  
  3222.  
  3223.  
  3224.  
  3225.  
  3226.  
  3227.  
  3228.  
  3229.  
  3230.  
  3231.  
  3232.                  39
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238. X Toolkit Intrinsics                 X11 Release 6.4
  3239.  
  3240. __
  3241. |
  3242. void XtDisplayInitialize(app_context, display, application_name, application_class,
  3243.                options, num_options, argc, argv)
  3244.       XtAppContext app_context;
  3245.       Display *display;
  3246.       String application_name;
  3247.       String application_class;
  3248.       XrmOptionDescRec *options;
  3249.       Cardinal num_options;
  3250.       int *argc;
  3251.       String *argv;
  3252.  
  3253.  
  3254. app_context   Specifies the application context.
  3255.  
  3256. display       Specifies a previously opened display connec-
  3257.           tion.  Note that a single display connection
  3258.           can be in at most one application context.
  3259.  
  3260. application_name
  3261.           Specifies the name of the application
  3262.           instance.
  3263.  
  3264. application_class
  3265.           Specifies the class name of this application,
  3266.           which is usually the generic name for all
  3267.           instances of this application.
  3268.  
  3269. options       Specifies how to parse the command line for
  3270.           any application-specific resources.  The
  3271.           options argument is passed as a parameter to
  3272.           XrmParseCommand.    For further information, see
  3273.           Section 15.9 in Xlib -- C Language X Interface
  3274.           and Section 2.4 of this specification.
  3275.  
  3276. num_options   Specifies the number of entries in the options
  3277.           list.
  3278.  
  3279. argc          Specifies a pointer to the number of command
  3280.           line parameters.
  3281.  
  3282. argv          Specifies the list of command line parameters.
  3283. |__
  3284.  
  3285. The XtDisplayInitialize function retrieves the language
  3286. string to be used for the specified display (see Section
  3287. 11.11), calls the language procedure (if set) with that lan-
  3288. guage string, builds the resource database for the default
  3289. screen, calls the Xlib XrmParseCommand function to parse the
  3290. command line, and performs other per-display initialization.
  3291. After XrmParseCommand has been called, argc and argv contain
  3292. only those parameters that were not in the standard option
  3293. table or in the table specified by the options argument.  If
  3294. the modified argc is not zero, most applications simply
  3295.  
  3296.  
  3297.  
  3298.                  40
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304. X Toolkit Intrinsics                 X11 Release 6.4
  3305.  
  3306.  
  3307. print out the modified argv along with a message listing the
  3308. allowable options.  On POSIX-based systems, the application
  3309. name is usually the final component of argv[0].  If the syn-
  3310. chronous resource is True, XtDisplayInitialize calls the
  3311. Xlib XSynchronize function to put Xlib into synchronous mode
  3312. for this display connection and any others currently open in
  3313. the application context.  See Sections 2.3 and 2.4 for
  3314. details on the application_name, application_class, options,
  3315. and num_options arguments.
  3316.  
  3317. XtDisplayInitialize calls XrmSetDatabase to associate the
  3318. resource database of the default screen with the display
  3319. before returning.
  3320.  
  3321.  
  3322.  
  3323.  
  3324.  
  3325.  
  3326.  
  3327.  
  3328.  
  3329.  
  3330.  
  3331.  
  3332.  
  3333.  
  3334.  
  3335.  
  3336.  
  3337.  
  3338.  
  3339.  
  3340.  
  3341.  
  3342.  
  3343.  
  3344.  
  3345.  
  3346.  
  3347.  
  3348.  
  3349.  
  3350.  
  3351.  
  3352.  
  3353.  
  3354.  
  3355.  
  3356.  
  3357.  
  3358.  
  3359.  
  3360.  
  3361.  
  3362.  
  3363.  
  3364.                  41
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370. X Toolkit Intrinsics                 X11 Release 6.4
  3371.  
  3372.  
  3373. To open a display, initialize it, and then add it to an
  3374. application context, use XtOpenDisplay.
  3375.  
  3376. __
  3377. |
  3378. Display *XtOpenDisplay(app_context, display_string, application_name, application_class,
  3379.                options, num_options, argc, argv)
  3380.        XtAppContext app_context;
  3381.        String display_string;
  3382.        String application_name;
  3383.        String application_class;
  3384.        XrmOptionDescRec *options;
  3385.        Cardinal num_options;
  3386.        int *argc;
  3387.        String *argv;
  3388.  
  3389.  
  3390. app_context   Specifies the application context.
  3391.  
  3392. display_string
  3393.           Specifies the display string, or NULL.
  3394.  
  3395. application_name
  3396.           Specifies the name of the application
  3397.           instance, or NULL.
  3398.  
  3399. application_class
  3400.           Specifies the class name of this application,
  3401.           which is usually the generic name for all
  3402.           instances of this application.
  3403.  
  3404. options       Specifies how to parse the command line for
  3405.           any application-specific resources.  The
  3406.           options argument is passed as a parameter to
  3407.           XrmParseCommand.
  3408.  
  3409. num_options   Specifies the number of entries in the options
  3410.           list.
  3411.  
  3412. argc          Specifies a pointer to the number of command
  3413.           line parameters.
  3414.  
  3415. argv          Specifies the list of command line parameters.
  3416. |__
  3417.  
  3418. The XtOpenDisplay function calls XOpenDisplay with the spec-
  3419. ified display_string.  If display_string is NULL, XtOpenDis-
  3420. play uses the current value of the -display option specified
  3421. in argv.  If no display is specified in argv, the user's
  3422. default display is retrieved from the environment.  On
  3423. POSIX-based systems, this is the value of the DISPLAY envi-
  3424. ronment variable.
  3425.  
  3426.  
  3427.  
  3428.  
  3429.  
  3430.                  42
  3431.  
  3432.  
  3433.  
  3434.  
  3435.  
  3436. X Toolkit Intrinsics                 X11 Release 6.4
  3437.  
  3438.  
  3439. If this succeeds, XtOpenDisplay then calls XtDisplayInitial-
  3440. ize and passes it the opened display and the value of the
  3441. -name option specified in argv as the application name.  If
  3442. no -name option is specified and application_name is non-
  3443. NULL, application_name is passed to XtDisplayInitialize.  If
  3444. application_name is NULL and if the environment variable
  3445. RESOURCE_NAME is set, the value of RESOURCE_NAME is used.
  3446. Otherwise, the application name is the name used to invoke
  3447. the program.  On implementations that conform to ANSI C
  3448. Hosted Environment support, the application name will be
  3449. argv[0] less any directory and file type components, that
  3450. is, the final component of argv[0], if specified.  If
  3451. argv[0] does not exist or is the empty string, the applica-
  3452. tion name is ``main''.    XtOpenDisplay returns the newly
  3453. opened display or NULL if it failed.
  3454.  
  3455. See Section 7.12 for information regarding the use of
  3456. XtOpenDisplay in multiple threads.
  3457.  
  3458.  
  3459. To close a display and remove it from an application con-
  3460. text, use XtCloseDisplay.
  3461.  
  3462. __
  3463. |
  3464. void XtCloseDisplay(display)
  3465.       Display *display;
  3466.  
  3467.  
  3468. display   Specifies the display.
  3469. |__
  3470.  
  3471. The XtCloseDisplay function calls XCloseDisplay with the
  3472. specified display as soon as it is safe to do so.  If called
  3473. from within an event dispatch (for example, a callback pro-
  3474. cedure), XtCloseDisplay does not close the display until the
  3475. dispatch is complete.  Note that applications need only call
  3476. XtCloseDisplay if they are to continue executing after clos-
  3477. ing the display; otherwise, they should call
  3478. XtDestroyApplicationContext.
  3479.  
  3480. See Section 7.12 for information regarding the use of
  3481. XtCloseDisplay in multiple threads.
  3482.  
  3483.  
  3484. 2.2.  Establishing the Locale
  3485.  
  3486. Resource databases are specified to be created in the cur-
  3487. rent process locale.  During display initialization prior to
  3488. creating the per-screen resource database, the Intrinsics
  3489. will call out to a specified application procedure to set
  3490. the locale according to options found on the command line or
  3491. in the per-display resource specifications.
  3492.  
  3493.  
  3494.  
  3495.  
  3496.                  43
  3497.  
  3498.  
  3499.  
  3500.  
  3501.  
  3502. X Toolkit Intrinsics                 X11 Release 6.4
  3503.  
  3504.  
  3505. The callout procedure provided by the application is of type
  3506. XtLanguageProc.
  3507.  
  3508. __
  3509. |
  3510. typedef String (*XtLanguageProc)(Display*, String, XtPointer);
  3511.       Display *display;
  3512.       String language;
  3513.       XtPointer client_data;
  3514.  
  3515.  
  3516. display   Passes the display.
  3517.  
  3518. language  Passes the initial language value obtained from
  3519.       the command line or server per-display resource
  3520.       specifications.
  3521.  
  3522. client_data
  3523.       Passes the additional client data specified in the
  3524.       call to XtSetLanguageProc.
  3525. |__
  3526.  
  3527. The language procedure allows an application to set the
  3528. locale to the value of the language resource determined by
  3529. XtDisplayInitialize.  The function returns a new language
  3530. string that will be subsequently used by XtDisplayInitialize
  3531. to establish the path for loading resource files.  The
  3532. returned string  will be copied by the Intrinsics into new
  3533. memory.
  3534.  
  3535. Initially, no language procedure is set by the Intrinsics.
  3536. To set the language procedure for use by
  3537. XtDisplayInitialize, use XtSetLanguageProc.
  3538.  
  3539. __
  3540. |
  3541. XtLanguageProc XtSetLanguageProc(app_context, proc, client_data)
  3542.       XtAppContext app_context;
  3543.       XtLanguageProc proc;
  3544.       XtPointer client_data;
  3545.  
  3546.  
  3547. app_context
  3548.       Specifies the application context in which the
  3549.       language procedure is to be used, or NULL.
  3550.  
  3551. proc      Specifies the language procedure.
  3552.  
  3553. client_data
  3554.       Specifies additional client data to be passed to
  3555.       the language procedure when it is called.
  3556. |__
  3557.  
  3558. XtSetLanguageProc sets the language procedure that will be
  3559.  
  3560.  
  3561.  
  3562.                  44
  3563.  
  3564.  
  3565.  
  3566.  
  3567.  
  3568. X Toolkit Intrinsics                 X11 Release 6.4
  3569.  
  3570.  
  3571. called from XtDisplayInitialize for all subsequent Displays
  3572. initialized in the specified application context.   If
  3573. app_context is NULL, the specified language procedure is
  3574. registered in all application contexts created by the call-
  3575. ing process, including any future application contexts that
  3576. may be created.   If proc is NULL, a default language proce-
  3577. dure is registered.  XtSetLanguageProc returns the previ-
  3578. ously registered language procedure.  If a language proce-
  3579. dure has not yet been registered, the return value is
  3580. unspecified, but if this return value is used in a subse-
  3581. quent call to XtSetLanguageProc, it will cause the default
  3582. language procedure to be registered.
  3583.  
  3584. The default language procedure does the following:
  3585.  
  3586. o    Sets the locale according to the environment.  On ANSI
  3587.      C-based systems this is done by calling setlocale(
  3588.      LC_ALL, language ).  If an error is encountered, a
  3589.      warning message is issued with XtWarning.
  3590.  
  3591. o    Calls XSupportsLocale to verify that the current locale
  3592.      is supported.  If the locale is not supported, a warn-
  3593.      ing message is issued with XtWarning and the locale is
  3594.      set to ``C''.
  3595.  
  3596. o    Calls XSetLocaleModifiers specifying the empty string.
  3597.  
  3598. o    Returns the value of the current locale.  On ANSI C-
  3599.      based systems this is the return value from a final
  3600.      call to setlocale( LC_ALL, NULL ).
  3601.  
  3602. A client wishing to use this mechanism to establish locale
  3603. can do so by calling XtSetLanguageProc prior to
  3604. XtDisplayInitialize, as in the following example.
  3605.  
  3606.  
  3607.      Widget top;
  3608.      XtSetLanguageProc(NULL, NULL, NULL);
  3609.      top = XtOpenApplication(...);
  3610.      ...
  3611.  
  3612.  
  3613.  
  3614. 2.3.  Loading the Resource Database
  3615.  
  3616. The XtDisplayInitialize function first determines the lan-
  3617. guage string to be used for the specified display.  It then
  3618. creates a resource database for the default screen of the
  3619. display by combining the following sources in order, with
  3620. the entries in the first named source having highest prece-
  3621. dence:
  3622.  
  3623.  
  3624.  
  3625.  
  3626.  
  3627.  
  3628.                  45
  3629.  
  3630.  
  3631.  
  3632.  
  3633.  
  3634. X Toolkit Intrinsics                 X11 Release 6.4
  3635.  
  3636.  
  3637. o    Application command line (argc, argv).
  3638.  
  3639. o    Per-host user environment resource file on the local
  3640.      host.
  3641.  
  3642. o    Per-screen resource specifications from the server.
  3643.  
  3644. o    Per-display resource specifications from the server or
  3645.      from
  3646.      the user preference file on the local host.
  3647.  
  3648. o    Application-specific user resource file on the local
  3649.      host.
  3650.  
  3651. o    Application-specific class resource file on the local
  3652.      host.
  3653.  
  3654.  
  3655. When the resource database for a particular screen on the
  3656. display is needed (either internally, or when XtScreen-
  3657. Database is called), it is created in the following manner
  3658. using the sources listed above in the same order:
  3659.  
  3660.  
  3661. o    A temporary database, the ``server resource database'',
  3662.      is created from the string returned by XResourceMan-
  3663.      agerString or, if XResourceManagerString returns NULL,
  3664.      the contents of a resource file in the user's home
  3665.      directory.  On POSIX-based systems, the usual name for
  3666.      this user preference resource file is $HOME/.Xdefaults.
  3667.  
  3668.  
  3669. o    If a language procedure has been set, XtDisplayInitial-
  3670.      ize first searches the command line for the option
  3671.      ``-xnlLanguage'', or for a -xrm option that specifies
  3672.      the xnlLanguage/XnlLanguage resource, as specified by
  3673.      Section 2.4.  If such a resource is found, the value is
  3674.      assumed to be entirely in XPCS, the X Portable Charac-
  3675.      ter Set.  If neither option is specified on the command
  3676.      line, XtDisplayInitialize queries the server resource
  3677.      database (which is assumed to be entirely in XPCS) for
  3678.      the resource name.xnlLanguage, class Class.XnlLanguage
  3679.      where name and Class are the application_name and
  3680.      application_class specified to XtDisplayInitialize.
  3681.      The language procedure is then invoked with the
  3682.      resource value if found, else the empty string.  The
  3683.      string returned from the language procedure is saved
  3684.      for all future references in the Intrinsics that
  3685.      require the per-display language string.
  3686.  
  3687.  
  3688. o    The screen resource database is initialized by parsing
  3689.      the command line in the manner specified by Section
  3690.      2.4.
  3691.  
  3692.  
  3693.  
  3694.                  46
  3695.  
  3696.  
  3697.  
  3698.  
  3699.  
  3700. X Toolkit Intrinsics                 X11 Release 6.4
  3701.  
  3702.  
  3703. o    If a language procedure has not been set, the initial
  3704.      database is then queried for the resource name.xnlLan-
  3705.      guage, class Class.XnlLanguage as specified above.  If
  3706.      this database query fails, the server resource database
  3707.      is queried; if this query also fails, the language is
  3708.      determined from the environment; on POSIX-based sys-
  3709.      tems, this is done by retrieving the value of the LANG
  3710.      environment variable.  If no language string is found,
  3711.      the empty string is used.    This language string is
  3712.      saved for all future references in the Intrinsics that
  3713.      require the per-display language string.
  3714.  
  3715.  
  3716. o    After determining the language string, the user's envi-
  3717.      ronment resource file is then merged into the initial
  3718.      resource database if the file exists.  This file is
  3719.      user-, host-, and process-specific and is expected to
  3720.      contain user preferences that are to override those
  3721.      specifications in the per-display and per-screen
  3722.      resources.  On POSIX-based systems, the user's environ-
  3723.      ment resource file name is specified by the value of
  3724.      the XENVIRONMENT environment variable.  If this envi-
  3725.      ronment variable does not exist, the user's home direc-
  3726.      tory is searched for a file named .Xdefaults-host,
  3727.      where host is the host name of the machine on which the
  3728.      application is running.
  3729.  
  3730.  
  3731. o    The per-screen resource specifications are then merged
  3732.      into the screen resource database, if they exist.
  3733.      These specifications are the string returned by
  3734.      XScreenResourceString for the respective screen and are
  3735.      owned entirely by the user.
  3736.  
  3737.  
  3738. o    Next, the server resource database created earlier is
  3739.      merged into the screen resource database.    The server
  3740.      property, and corresponding user preference file, are
  3741.      owned and constructed entirely by the user.
  3742.  
  3743.  
  3744. o    The application-specific user resource file from the
  3745.      local host is then merged into the screen resource
  3746.      database.    This file contains user customizations and
  3747.      is stored in a directory owned by the user.  Either the
  3748.      user or the application or both can store resource
  3749.      specifications in the file.  Each should be prepared to
  3750.      find and respect entries made by the other.  The file
  3751.      name is found by calling XrmSetDatabase with the cur-
  3752.      rent screen resource database, after preserving the
  3753.      original display-associated database, then calling
  3754.      XtResolvePathname with the parameters (display, NULL,
  3755.      NULL, NULL, path, NULL, 0, NULL), where path is defined
  3756.      in an operating-system-specific way.  On POSIX-based
  3757.  
  3758.  
  3759.  
  3760.                  47
  3761.  
  3762.  
  3763.  
  3764.  
  3765.  
  3766. X Toolkit Intrinsics                 X11 Release 6.4
  3767.  
  3768.  
  3769.      systems, path is defined to be the value of the envi-
  3770.      ronment variable XUSERFILESEARCHPATH if this is
  3771.      defined.  If XUSERFILESEARCHPATH is not defined, an
  3772.      implementation-dependent default value is used.  This
  3773.      default value is constrained in the following manner:
  3774.  
  3775.  
  3776.      -    If the environment variable XAPPLRESDIR is not
  3777.     defined, the default XUSERFILESEARCHPATH must con-
  3778.     tain at least six entries.  These entries must con-
  3779.     tain $HOME as the directory prefix, plus the follow-
  3780.     ing substitutions:
  3781.  
  3782.     1. %C, %N, %L  or   %C, %N, %l, %t, %c
  3783.     2. %C, %N, %l
  3784.     3. %C, %N
  3785.     4. %N, %L      or   %N, %l, %t, %c
  3786.     5. %N, %l
  3787.     6. %N
  3788.  
  3789.     The order of these six entries within the path must
  3790.     be as given above.  The order and use of substitu-
  3791.     tions within a given entry are implementation-depen-
  3792.     dent.
  3793.  
  3794.  
  3795.      -    If XAPPLRESDIR is defined, the default XUSERFILE-
  3796.     SEARCHPATH must contain at least seven entries.
  3797.     These entries must contain the following directory
  3798.     prefixes and substitutions:
  3799.  
  3800.     1. $XAPPLRESDIR with  %C, %N, %L or  %C, %N, %l, %t, %c
  3801.     2. $XAPPLRESDIR with  %C, %N, %l
  3802.     3. $XAPPLRESDIR with  %C, %N
  3803.     4. $XAPPLRESDIR with  %N, %L     or  %N, %l, %t, %c
  3804.     5. $XAPPLRESDIR with  %N, %l
  3805.     6. $XAPPLRESDIR with  %N
  3806.     7. $HOME    with  %N
  3807.  
  3808.     The order of these seven entries within the path
  3809.     must be as given above.  The order and use of sub-
  3810.     stitutions within a given entry are implementation-
  3811.     dependent.
  3812.  
  3813.  
  3814. o    Last, the application-specific class resource file from
  3815.      the local host is merged into the screen resource
  3816.      database.    This file is owned by the application and is
  3817.      usually installed in a system directory when the appli-
  3818.      cation is installed.  It may contain sitewide cus-
  3819.      tomizations specified by the system manager.  The name
  3820.      of the application class resource file is found by
  3821.      calling XtResolvePathname with the parameters (display,
  3822.      ``app-defaults'', NULL, NULL, NULL, NULL, 0, NULL).
  3823.  
  3824.  
  3825.  
  3826.                  48
  3827.  
  3828.  
  3829.  
  3830.  
  3831.  
  3832. X Toolkit Intrinsics                 X11 Release 6.4
  3833.  
  3834.  
  3835.      This file is expected to be provided by the developer
  3836.      of the application and may be required for the applica-
  3837.      tion to function properly.  A simple application that
  3838.      wants to be assured of having a minimal set of
  3839.      resources in the absence of its class resource file can
  3840.      declare fallback resource specifications with
  3841.      XtAppSetFallbackResources.  Note that the customization
  3842.      substitution string is retrieved dynamically by XtRe-
  3843.      solvePathname so that the resolved file name of the
  3844.      application class resource file can be affected by any
  3845.      of the earlier sources for the screen resource
  3846.      database, even though the contents of the class
  3847.      resource file have lowest precedence.  After calling
  3848.      XtResolvePathname, the original display-associated
  3849.      database is restored.
  3850.  
  3851.  
  3852. To obtain the resource database for a particular screen, use
  3853. XtScreenDatabase.
  3854.  
  3855. __
  3856. |
  3857. XrmDatabase XtScreenDatabase(screen)
  3858.       Screen *screen;
  3859.  
  3860.  
  3861. screen      Specifies the screen whose resource database is to
  3862.       be returned.
  3863. |__
  3864.  
  3865. The XtScreenDatabase function returns the fully merged
  3866. resource database as specified above, associated with the
  3867. specified screen.  If the specified screen does not belong
  3868. to a Display initialized by XtDisplayInitialize, the results
  3869. are undefined.
  3870.  
  3871.  
  3872. To obtain the default resource database associated with a
  3873. particular display, use XtDatabase.
  3874.  
  3875. __
  3876. |
  3877. XrmDatabase XtDatabase(display)
  3878.       Display *display;
  3879.  
  3880.  
  3881. display   Specifies the display.
  3882. |__
  3883.  
  3884. The XtDatabase function is equivalent to XrmGetDatabase.  It
  3885. returns the database associated with the specified display,
  3886. or NULL if a database has not been set.
  3887.  
  3888.  
  3889.  
  3890.  
  3891.  
  3892.                  49
  3893.  
  3894.  
  3895.  
  3896.  
  3897.  
  3898. X Toolkit Intrinsics                 X11 Release 6.4
  3899.  
  3900.  
  3901. To specify a default set of resource values that will be
  3902. used to initialize the resource database if no application-
  3903. specific class resource file is found (the last of the six
  3904. sources listed above), use XtAppSetFallbackResources.
  3905.  
  3906. __
  3907. |
  3908. void XtAppSetFallbackResources(app_context, specification_list)
  3909.       XtAppContext app_context;
  3910.       String *specification_list;
  3911.  
  3912.  
  3913. app_context Specifies the application context in which the
  3914.         fallback specifications will be used.
  3915.  
  3916. specification_list
  3917.         Specifies a NULL-terminated list of resource
  3918.         specifications to preload the database, or NULL.
  3919. |__
  3920.  
  3921. Each entry in specification_list points to a string in the
  3922. format of XrmPutLineResource.  Following a call to
  3923. XtAppSetFallbackResources, when a resource database is being
  3924. created for a particular screen and the Intrinsics are not
  3925. able to find or read an application-specific class resource
  3926. file according to the rules given above and if specifica-
  3927. tion_list is not NULL, the resource specifications in speci-
  3928. fication_list will be merged into the screen resource
  3929. database in place of the application-specific class resource
  3930. file.  XtAppSetFallbackResources is not required to copy
  3931. specification_list; the caller must ensure that the contents
  3932. of the list and of the strings addressed by the list remain
  3933. valid until all displays are initialized or until XtAppSet-
  3934. FallbackResources is called again.  The value NULL for spec-
  3935. ification_list removes any previous fallback resource speci-
  3936. fication for the application context.  The intended use for
  3937. fallback resources is to provide a minimal number of
  3938. resources that will make the application usable (or at least
  3939. terminate with helpful diagnostic messages) when some prob-
  3940. lem exists in finding and loading the application defaults
  3941. file.
  3942.  
  3943.  
  3944. 2.4.  Parsing the Command Line
  3945.  
  3946. The XtOpenDisplay function first parses the command line for
  3947. the following options:
  3948.  
  3949. -display  Specifies the display name for XOpenDisplay.
  3950.  
  3951. -name      Sets the resource name prefix, which overrides the
  3952.       application name passed to XtOpenDisplay.
  3953.  
  3954.  
  3955.  
  3956.  
  3957.  
  3958.                  50
  3959.  
  3960.  
  3961.  
  3962.  
  3963.  
  3964. X Toolkit Intrinsics                 X11 Release 6.4
  3965.  
  3966.  
  3967. -xnllanguage
  3968.       Specifies the initial language string for estab-
  3969.       lishing locale and for finding application class
  3970.       resource files.
  3971.  
  3972. XtDisplayInitialize has a table of standard command line
  3973. options that are passed to XrmParseCommand for adding
  3974. resources to the resource database, and it takes as a param-
  3975. eter additional application-specific resource abbreviations.
  3976. The format of this table is described in Section 15.9 in
  3977. Xlib -- C Language X Interface.
  3978.  
  3979. __
  3980. |
  3981. typedef enum {
  3982.      XrmoptionNoArg,       /* Value is specified in OptionDescRec.value */
  3983.      XrmoptionIsArg,       /* Value is the option string itself */
  3984.      XrmoptionStickyArg,   /* Value is characters immediately following option */
  3985.      XrmoptionSepArg,       /* Value is next argument in argv */
  3986.      XrmoptionResArg,       /* Use the next argument as input to XrmPutLineResource*/
  3987.      XrmoptionSkipArg,       /* Ignore this option and the next argument in argv */
  3988.      XrmoptionSkipNArgs,   /* Ignore this option and the next */
  3989.                /* OptionDescRec.value arguments in argv */
  3990.      XrmoptionSkipLine       /* Ignore this option and the rest of argv */
  3991. } XrmOptionKind;
  3992.  
  3993. typedef struct {
  3994.      char *option;       /* Option name in argv */
  3995.      char *specifier;       /* Resource name (without application name) */
  3996.      XrmOptionKind argKind;/* Location of the resource value */
  3997.      XPointer value;       /* Value to provide if XrmoptionNoArg */
  3998. } XrmOptionDescRec, *XrmOptionDescList;
  3999.  
  4000.  
  4001. |__
  4002.  
  4003. The standard table contains the following entries:
  4004.  
  4005. -----------------------------------------------------------------------
  4006. Option String        Resource Name    Argument Kind    Resource Value
  4007. -----------------------------------------------------------------------
  4008. -background        *background     SepArg        next argument
  4009. -bd            *borderColor    SepArg        next argument
  4010. -bg            *background     SepArg        next argument
  4011. -borderwidth        .borderWidth    SepArg        next argument
  4012. -bordercolor        *borderColor    SepArg        next argument
  4013. -bw            .borderWidth    SepArg        next argument
  4014. -display        .display        SepArg        next argument
  4015. -fg            *foreground     SepArg        next argument
  4016. -fn            *font        SepArg        next argument
  4017. -font            *font        SepArg        next argument
  4018. -foreground        *foreground     SepArg        next argument
  4019. -geometry        .geometry        SepArg        next argument
  4020.  
  4021.  
  4022.  
  4023.  
  4024.                  51
  4025.  
  4026.  
  4027.  
  4028.  
  4029.  
  4030. X Toolkit Intrinsics                 X11 Release 6.4
  4031.  
  4032.  
  4033. -----------------------------------------------------------------------
  4034. -iconic         .iconic        NoArg        ``true''
  4035. -name            .name        SepArg        next argument
  4036. -reverse        .reverseVideo    NoArg        ``on''
  4037. -rv            .reverseVideo    NoArg        ``on''
  4038. +rv            .reverseVideo    NoArg        ``off''
  4039. -selectionTimeout   .selectionTimeout    SepArg        next argument
  4040. -synchronous        .synchronous    NoArg        ``on''
  4041. +synchronous        .synchronous    NoArg        ``off''
  4042. -title            .title        SepArg        next argument
  4043. -xnllanguage        .xnlLanguage    SepArg        next argument
  4044. -xrm            next argument    ResArg        next argument
  4045. -xtsessionID        .sessionID        SepArg        next argument
  4046. -----------------------------------------------------------------------
  4047.  
  4048.  
  4049. Note that any unique abbreviation for an option name in the
  4050. standard table or in the application table is accepted.
  4051.  
  4052. If reverseVideo is True, the values of XtDefaultForeground
  4053. and XtDefaultBackground are exchanged for all screens on the
  4054. Display.
  4055.  
  4056. The value of the synchronous resource specifies whether or
  4057. not Xlib is put into synchronous mode.    If a value is found
  4058. in the resource database during display initialization,
  4059. XtDisplayInitialize makes a call to XSynchronize for all
  4060. display connections currently open in the application con-
  4061. text.  Therefore, when multiple displays are initialized in
  4062. the same application context, the most recent value speci-
  4063. fied for the synchronous resource is used for all displays
  4064. in the application context.
  4065.  
  4066. The value of the selectionTimeout resource applies to all
  4067. displays opened in the same application context.  When mul-
  4068. tiple displays are initialized in the same application con-
  4069. text, the most recent value specified is used for all dis-
  4070. plays in the application context.
  4071.  
  4072. The -xrm option provides a method of setting any resource in
  4073. an application.  The next argument should be a quoted string
  4074. identical in format to a line in the user resource file.
  4075. For example, to give a red background to all command buttons
  4076. in an application named xmh, you can start it up as
  4077.  
  4078.  
  4079.      xmh -xrm 'xmh*Command.background: red'
  4080.  
  4081.  
  4082. When it parses the command line, XtDisplayInitialize merges
  4083. the application option table with the standard option table
  4084. before calling the Xlib XrmParseCommand function.  An entry
  4085. in the application table with the same name as an entry in
  4086. the standard table overrides the standard table entry.    If
  4087.  
  4088.  
  4089.  
  4090.                  52
  4091.  
  4092.  
  4093.  
  4094.  
  4095.  
  4096. X Toolkit Intrinsics                 X11 Release 6.4
  4097.  
  4098.  
  4099. an option name is a prefix of another option name, both
  4100. names are kept in the merged table.  The Intrinsics reserve
  4101. all option names beginning with the characters ``-xt'' for
  4102. future standard uses.
  4103.  
  4104.  
  4105. 2.5.  Creating Widgets
  4106.  
  4107. The creation of widget instances is a three-phase process:
  4108.  
  4109. 1.   The widgets are allocated and initialized with
  4110.      resources and are optionally added to the managed sub-
  4111.      set of their parent.
  4112.  
  4113. 2.   All composite widgets are notified of their managed
  4114.      children in a bottom-up traversal of the widget tree.
  4115.  
  4116. 3.   The widgets create X windows, which then are mapped.
  4117.  
  4118. To start the first phase, the application calls XtCreateWid-
  4119. get for all its widgets and adds some (usually, most or all)
  4120. of its widgets to their respective parents' managed set by
  4121. calling XtManageChild.    To avoid an O(n2) creation process
  4122. where each composite widget lays itself out each time a wid-
  4123. get is created and managed, parent widgets are not notified
  4124. of changes in their managed set during this phase.
  4125.  
  4126. After all widgets have been created, the application calls
  4127. XtRealizeWidget with the top-level widget to execute the
  4128. second and third phases.  XtRealizeWidget first recursively
  4129. traverses the widget tree in a postorder (bottom-up) traver-
  4130. sal and then notifies each composite widget with one or more
  4131. managed children by means of its change_managed procedure.
  4132.  
  4133. Notifying a parent about its managed set involves geometry
  4134. layout and possibly geometry negotiation.  A parent deals
  4135. with constraints on its size imposed from above (for exam-
  4136. ple, when a user specifies the application window size) and
  4137. suggestions made from below (for example, when a primitive
  4138. child computes its preferred size).  One difference between
  4139. the two can cause geometry changes to ripple in both direc-
  4140. tions through the widget tree.    The parent may force some of
  4141. its children to change size and position and may issue geom-
  4142. etry requests to its own parent in order to better accommo-
  4143. date all its children.    You cannot predict where anything
  4144. will go on the screen until this process finishes.
  4145.  
  4146. Consequently, in the first and second phases, no X windows
  4147. are actually created, because it is likely that they will
  4148. get moved around after creation.  This avoids unnecessary
  4149. requests to the X server.
  4150.  
  4151. Finally, XtRealizeWidget starts the third phase by making a
  4152. preorder (top-down) traversal of the widget tree, allocates
  4153.  
  4154.  
  4155.  
  4156.                  53
  4157.  
  4158.  
  4159.  
  4160.  
  4161.  
  4162. X Toolkit Intrinsics                 X11 Release 6.4
  4163.  
  4164.  
  4165. an X window to each widget by means of its realize proce-
  4166. dure, and finally maps the widgets that are managed.
  4167.  
  4168.  
  4169. 2.5.1.    Creating and Merging Argument Lists
  4170.  
  4171. Many Intrinsics functions may be passed pairs of resource
  4172. names and values.  These are passed as an arglist, a pointer
  4173. to an array of Arg structures, which contains
  4174.  
  4175. __
  4176. |
  4177. typedef struct {
  4178.      String name;
  4179.      XtArgVal value;
  4180. } Arg, *ArgList;
  4181.  
  4182. |__
  4183.  
  4184. where XtArgVal is as defined in Section 1.5.
  4185.  
  4186. If the size of the resource is less than or equal to the
  4187. size of an XtArgVal, the resource value is stored directly
  4188. in value; otherwise, a pointer to it is stored in value.
  4189.  
  4190. To set values in an ArgList, use XtSetArg.
  4191.  
  4192. __
  4193. |
  4194. void XtSetArg(arg, name, value)
  4195.       Arg arg;
  4196.       String name;
  4197.       XtArgVal value;
  4198.  
  4199.  
  4200. arg      Specifies the name/value pair to set.
  4201.  
  4202. name      Specifies the name of the resource.
  4203.  
  4204. value      Specifies the value of the resource if it will fit
  4205.       in an XtArgVal, else the address.
  4206. |__
  4207.  
  4208. The XtSetArg function is usually used in a highly stylized
  4209. manner to minimize the probability of making a mistake; for
  4210. example:
  4211.  
  4212.  
  4213.      Arg args[20];
  4214.      int n;
  4215.  
  4216.      n = 0;
  4217.      XtSetArg(args[n], XtNheight, 100);n++;
  4218.      XtSetArg(args[n], XtNwidth, 200);n++;
  4219.  
  4220.  
  4221.  
  4222.                  54
  4223.  
  4224.  
  4225.  
  4226.  
  4227.  
  4228. X Toolkit Intrinsics                 X11 Release 6.4
  4229.  
  4230.  
  4231.      XtSetValues(widget, args, n);
  4232.  
  4233.  
  4234. Alternatively, an application can statically declare the
  4235. argument list and use XtNumber:
  4236.  
  4237.  
  4238.      static Args args[] = {
  4239.       {XtNheight, (XtArgVal) 100},
  4240.       {XtNwidth, (XtArgVal) 200},
  4241.      };
  4242.      XtSetValues(Widget, args, XtNumber(args));
  4243.  
  4244.  
  4245. Note that you should not use expressions with side effects
  4246. such as auto-increment or auto-decrement within the first
  4247. argument to XtSetArg.  XtSetArg can be implemented as a
  4248. macro that evaluates the first argument twice.
  4249.  
  4250.  
  4251. To merge two arglist arrays, use XtMergeArgLists.
  4252.  
  4253. __
  4254. |
  4255. ArgList XtMergeArgLists(args1, num_args1, args2, num_args2)
  4256.      ArgList args1;
  4257.      Cardinal num_args1;
  4258.      ArgList args2;
  4259.      Cardinal num_args2;
  4260.  
  4261.  
  4262. args1      Specifies the first argument list.
  4263.  
  4264. num_args1 Specifies the number of entries in the first argu-
  4265.       ment list.
  4266.  
  4267. args2      Specifies the second argument list.
  4268.  
  4269. num_args2 Specifies the number of entries in the second
  4270.       argument list.
  4271. |__
  4272.  
  4273. The XtMergeArgLists function allocates enough storage to
  4274. hold the combined arglist arrays and copies them into it.
  4275. Note that it does not check for duplicate entries.  The
  4276. length of the returned list is the sum of the lengths of the
  4277. specified lists.  When it is no longer needed, free the
  4278. returned storage by using XtFree.
  4279.  
  4280.  
  4281. All Intrinsics interfaces that require ArgList arguments
  4282. have analogs conforming to the ANSI C variable argument list
  4283. (traditionally called ``varargs'') calling convention.    The
  4284. name of the analog is formed by prefixing ``Va'' to the name
  4285.  
  4286.  
  4287.  
  4288.                  55
  4289.  
  4290.  
  4291.  
  4292.  
  4293.  
  4294. X Toolkit Intrinsics                 X11 Release 6.4
  4295.  
  4296.  
  4297. of the corresponding ArgList procedure; e.g.,
  4298. XtVaCreateWidget.  Each procedure named XtVasomething takes
  4299. as its last arguments, in place of the corresponding
  4300. ArgList/ Cardinal parameters, a variable parameter list of
  4301. resource name and value pairs where each name is of type
  4302. String and each value is of type XtArgVal.  The end of the
  4303. list is identified by a name entry containing NULL.  Devel-
  4304. opers writing in the C language wishing to pass resource
  4305. name and value pairs to any of these interfaces may use the
  4306. ArgList and varargs forms interchangeably.
  4307.  
  4308. Two special names are defined for use only in varargs lists:
  4309. XtVaTypedArg and XtVaNestedList.
  4310.  
  4311.  
  4312. __
  4313. |
  4314. #define XtVaTypedArg "XtVaTypedArg"
  4315.  
  4316. |__
  4317.  
  4318. If the name XtVaTypedArg is specified in place of a resource
  4319. name, then the following four arguments are interpreted as a
  4320. name/type/value/size tuple where name is of type String,
  4321. type is of type String, value is of type XtArgVal, and size
  4322. is of type int.  When a varargs list containing XtVaTypedArg
  4323. is processed, a resource type conversion (see Section 9.6)
  4324. is performed if necessary to convert the value into the for-
  4325. mat required by the associated resource.  If type is
  4326. XtRString, then value contains a pointer to the string and
  4327. size contains the number of bytes allocated, including the
  4328. trailing null byte.  If type is not XtRString, then if size
  4329. is less than or equal to sizeof(XtArgVal), the value should
  4330. be the data cast to the type XtArgVal, otherwise value is a
  4331. pointer to the data.  If the type conversion fails for any
  4332. reason, a warning message is issued and the list entry is
  4333. skipped.
  4334.  
  4335.  
  4336. __
  4337. |
  4338. #define XtVaNestedList    "XtVaNestedList"
  4339.  
  4340. |__
  4341.  
  4342. If the name XtVaNestedList is specified in place of a
  4343. resource name, then the following argument is interpreted as
  4344. an XtVarArgsList value, which specifies another varargs list
  4345. that is logically inserted into the original list at the
  4346. point of declaration.  The end of the nested list is identi-
  4347. fied with a name entry containing NULL.  Varargs lists may
  4348. nest to any depth.
  4349.  
  4350.  
  4351.  
  4352.  
  4353.  
  4354.                  56
  4355.  
  4356.  
  4357.  
  4358.  
  4359.  
  4360. X Toolkit Intrinsics                 X11 Release 6.4
  4361.  
  4362.  
  4363. To dynamically allocate a varargs list for use with
  4364. XtVaNestedList in multiple calls, use XtVaCreateArgsList.
  4365.  
  4366.  
  4367. __
  4368. |
  4369. typedef XtPointer XtVarArgsList;
  4370.  
  4371.  
  4372.  
  4373. XtVarArgsList XtVaCreateArgsList(unused, ...)
  4374.       XtPointer unused;
  4375.  
  4376.  
  4377. unused      This argument is not currently used and must be
  4378.       specified as NULL.
  4379.  
  4380. ...      Specifies a variable parameter list of resource
  4381.       name and value pairs.
  4382. |__
  4383.  
  4384. The XtVaCreateArgsList function allocates memory and copies
  4385. its arguments into a single list pointer, which may be used
  4386. with XtVaNestedList.  The end of both lists is identified by
  4387. a name entry containing NULL.  Any entries of type XtVaType-
  4388. dArg are copied as specified without applying conversions.
  4389. Data passed by reference (including Strings) are not copied,
  4390. only the pointers themselves; the caller must ensure that
  4391. the data remain valid for the lifetime of the created
  4392. varargs list.  The list should be freed using XtFree when no
  4393. longer needed.
  4394.  
  4395. Use of resource files and of the resource database is gener-
  4396. ally encouraged over lengthy arglist or varargs lists when-
  4397. ever possible in order to permit modification without recom-
  4398. pilation.
  4399.  
  4400.  
  4401. 2.5.2.    Creating a Widget Instance
  4402.  
  4403. To create an instance of a widget, use XtCreateWidget.
  4404.  
  4405.  
  4406.  
  4407.  
  4408.  
  4409.  
  4410.  
  4411.  
  4412.  
  4413.  
  4414.  
  4415.  
  4416.  
  4417.  
  4418.  
  4419.  
  4420.                  57
  4421.  
  4422.  
  4423.  
  4424.  
  4425.  
  4426. X Toolkit Intrinsics                 X11 Release 6.4
  4427.  
  4428. __
  4429. |
  4430. Widget XtCreateWidget(name, object_class, parent, args, num_args)
  4431.       String name;
  4432.       WidgetClass object_class;
  4433.       Widget parent;
  4434.       ArgList args;
  4435.       Cardinal num_args;
  4436.  
  4437.  
  4438. name      Specifies the resource instance name for the cre-
  4439.       ated widget, which is used for retrieving
  4440.       resources and, for that reason, should not be the
  4441.       same as any other widget that is a child of the
  4442.       same parent.
  4443.  
  4444. object_class
  4445.       Specifies the widget class pointer for the created
  4446.       object.  Must be objectClass or any subclass
  4447.       thereof.
  4448.  
  4449. parent      Specifies the parent widget.    Must be of class
  4450.       Object or any subclass thereof.
  4451.  
  4452. args      Specifies the argument list to override any other
  4453.       resource specifications.
  4454.  
  4455. num_args  Specifies the number of entries in the argument
  4456.       list.
  4457. |__
  4458.  
  4459. The XtCreateWidget function performs all the boilerplate
  4460. operations of widget creation, doing the following in order:
  4461.  
  4462. o    Checks to see if the class_initialize procedure has
  4463.      been called for this class and for all superclasses
  4464.      and, if not, calls those necessary in a superclass-to-
  4465.      subclass order.
  4466.  
  4467. o    If the specified class is not coreWidgetClass or a sub-
  4468.      class thereof, and the parent's class is a subclass of
  4469.      compositeWidgetClass and either no extension record in
  4470.      the parent's composite class part extension field
  4471.      exists with the record_type NULLQUARK or the
  4472.      accepts_objects field in the extension record is False,
  4473.      XtCreateWidget issues a fatal error; see Section 3.1
  4474.      and Chapter 12.
  4475.  
  4476. o    If the specified class contains an extension record in
  4477.      the object class part extension field with record_type
  4478.      NULLQUARK and the allocate field is not NULL, the pro-
  4479.      cedure is invoked to allocate memory for the widget
  4480.      instance.    If the parent is a member of the class
  4481.      constraintWidgetClass, the procedure also allocates
  4482.      memory for the parent's constraints and stores the
  4483.  
  4484.  
  4485.  
  4486.                  58
  4487.  
  4488.  
  4489.  
  4490.  
  4491.  
  4492. X Toolkit Intrinsics                 X11 Release 6.4
  4493.  
  4494.  
  4495.      address of this memory into the constraints field.  If
  4496.      no allocate procedure is found, the Intrinsics allocate
  4497.      memory for the widget and, when applicable, the con-
  4498.      straints, and initializes the constraints field.
  4499.  
  4500. o    Initializes the Core nonresource data fields self, par-
  4501.      ent, widget_class, being_destroyed, name, managed, win-
  4502.      dow, visible, popup_list, and num_popups.
  4503.  
  4504. o    Initializes the resource fields (for example, back-
  4505.      ground_pixel) by using the CoreClassPart resource lists
  4506.      specified for this class and all superclasses.
  4507.  
  4508. o    If the parent is a member of the class
  4509.      constraintWidgetClass, initializes the resource fields
  4510.      of the constraints record by using the ConstraintClass-
  4511.      Part resource lists specified for the parent's class
  4512.      and all superclasses up to constraintWidgetClass.
  4513.  
  4514. o    Calls the initialize procedures for the widget starting
  4515.      at the Object initialize procedure on down to the wid-
  4516.      get's initialize procedure.
  4517.  
  4518. o    If the parent is a member of the class
  4519.      constraintWidgetClass, calls the ConstraintClassPart
  4520.      initialize procedures, starting at constraintWidget-
  4521.      Class on down to the parent's ConstraintClassPart ini-
  4522.      tialize procedure.
  4523.  
  4524. o    If the parent is a member of the class
  4525.      compositeWidgetClass, puts the widget into its parent's
  4526.      children list by calling its parent's insert_child pro-
  4527.      cedure.  For further information, see Section 3.1.
  4528.  
  4529.  
  4530. To create an instance of a widget using varargs lists, use
  4531. XtVaCreateWidget.
  4532.  
  4533.  
  4534.  
  4535.  
  4536.  
  4537.  
  4538.  
  4539.  
  4540.  
  4541.  
  4542.  
  4543.  
  4544.  
  4545.  
  4546.  
  4547.  
  4548.  
  4549.  
  4550.  
  4551.  
  4552.                  59
  4553.  
  4554.  
  4555.  
  4556.  
  4557.  
  4558. X Toolkit Intrinsics                 X11 Release 6.4
  4559.  
  4560. __
  4561. |
  4562. Widget XtVaCreateWidget(name, object_class, parent, ...)
  4563.       String name;
  4564.       WidgetClass object_class;
  4565.       Widget parent;
  4566.  
  4567.  
  4568. name      Specifies the resource name for the created wid-
  4569.       get.
  4570.  
  4571. object_class
  4572.       Specifies the widget class pointer for the created
  4573.       object.  Must be objectClass or any subclass
  4574.       thereof.
  4575.  
  4576. parent      Specifies the parent widget.    Must be of class
  4577.       Object or any subclass thereof.
  4578.  
  4579. ...      Specifies the variable argument list to override
  4580.       any other resource specifications.
  4581. |__
  4582.  
  4583. The XtVaCreateWidget procedure is identical in function to
  4584. XtCreateWidget with the args and num_args parameters
  4585. replaced by a varargs list, as described in Section 2.5.1.
  4586.  
  4587.  
  4588. 2.5.3.    Creating an Application Shell Instance
  4589.  
  4590. An application can have multiple top-level widgets, each of
  4591. which specifies a unique widget tree that can potentially be
  4592. on different screens or displays.  An application uses XtAp-
  4593. pCreateShell to create independent widget trees.
  4594.  
  4595.  
  4596.  
  4597.  
  4598.  
  4599.  
  4600.  
  4601.  
  4602.  
  4603.  
  4604.  
  4605.  
  4606.  
  4607.  
  4608.  
  4609.  
  4610.  
  4611.  
  4612.  
  4613.  
  4614.  
  4615.  
  4616.  
  4617.  
  4618.                  60
  4619.  
  4620.  
  4621.  
  4622.  
  4623.  
  4624. X Toolkit Intrinsics                 X11 Release 6.4
  4625.  
  4626. __
  4627. |
  4628. Widget XtAppCreateShell(name, application_class, widget_class, display, args, num_args)
  4629.       String name;
  4630.       String application_class;
  4631.       WidgetClass widget_class;
  4632.       Display *display;
  4633.       ArgList args;
  4634.       Cardinal num_args;
  4635.  
  4636.  
  4637. name        Specifies the instance name of the shell widget.
  4638.         If name is NULL, the application name passed to
  4639.         XtDisplayInitialize is used.
  4640.  
  4641. application_class
  4642.         Specifies the resource class string to be used
  4643.         in place of the widget class_name string when
  4644.         widget_class is applicationShellWidgetClass or a
  4645.         subclass thereof.
  4646.  
  4647. widget_class
  4648.         Specifies the widget class for the top-level
  4649.         widget (e.g., applicationShellWidgetClass).
  4650.  
  4651. display     Specifies the display for the default screen and
  4652.         for the resource database used to retrieve the
  4653.         shell widget resources.
  4654.  
  4655. args        Specifies the argument list to override any
  4656.         other resource specifications.
  4657.  
  4658. num_args    Specifies the number of entries in the argument
  4659.         list.
  4660. |__
  4661.  
  4662. The XtAppCreateShell function creates a new shell widget
  4663. instance as the root of a widget tree.    The screen resource
  4664. for this widget is determined by first scanning args for the
  4665. XtNscreen argument.  If no XtNscreen argument is found, the
  4666. resource database associated with the default screen of the
  4667. specified display is queried for the resource name.screen,
  4668. class Class.Screen where Class is the specified applica-
  4669. tion_class if widget_class is applicationShellWidgetClass or
  4670. a subclass thereof.  If widget_class is not application-
  4671. ShellWidgetClass or a subclass, Class is the class_name
  4672. field from the CoreClassPart of the specified widget_class.
  4673. If this query fails, the default screen of the specified
  4674. display is used.  Once the screen is determined, the
  4675. resource database associated with that screen is used to
  4676. retrieve all remaining resources for the shell widget not
  4677. specified in args.  The widget name and Class as determined
  4678. above are used as the leftmost (i.e., root) components in
  4679. all fully qualified resource names for objects within this
  4680. widget tree.
  4681.  
  4682.  
  4683.  
  4684.                  61
  4685.  
  4686.  
  4687.  
  4688.  
  4689.  
  4690. X Toolkit Intrinsics                 X11 Release 6.4
  4691.  
  4692.  
  4693. If the specified widget class is a subclass of WMShell, the
  4694. name and Class as determined above will be stored into the
  4695. WM_CLASS property on the widget's window when it becomes
  4696. realized.  If the specified widget_class is application-
  4697. ShellWidgetClass or a subclass thereof, the WM_COMMAND prop-
  4698. erty will also be set from the values of the XtNargv and
  4699. XtNargc resources.
  4700.  
  4701.  
  4702. To create multiple top-level shells within a single (logi-
  4703. cal) application, you can use one of two methods:
  4704.  
  4705. o    Designate one shell as the real top-level shell and
  4706.      create the others as pop-up children of it by using
  4707.      XtCreatePopupShell.
  4708.  
  4709. o    Have all shells as pop-up children of an unrealized
  4710.      top-level shell.
  4711.  
  4712. The first method, which is best used when there is a clear
  4713. choice for what is the main window, leads to resource speci-
  4714. fications like the following:
  4715.  
  4716.  
  4717.      xmail.geometry:...  (the main window)
  4718.      xmail.read.geometry:...(the read window)
  4719.      xmail.compose.geometry:...(the compose window)
  4720.  
  4721.  
  4722. The second method, which is best if there is no main window,
  4723. leads to resource specifications like the following:
  4724.  
  4725.  
  4726.      xmail.headers.geometry:...(the headers window)
  4727.      xmail.read.geometry:...(the read window)
  4728.      xmail.compose.geometry:...(the compose window)
  4729.  
  4730.  
  4731.  
  4732. To create a top-level widget that is the root of a widget
  4733. tree using varargs lists, use XtVaAppCreateShell.
  4734.  
  4735.  
  4736.  
  4737.  
  4738.  
  4739.  
  4740.  
  4741.  
  4742.  
  4743.  
  4744.  
  4745.  
  4746.  
  4747.  
  4748.  
  4749.  
  4750.                  62
  4751.  
  4752.  
  4753.  
  4754.  
  4755.  
  4756. X Toolkit Intrinsics                 X11 Release 6.4
  4757.  
  4758. __
  4759. |
  4760. Widget XtVaAppCreateShell(name, application_class, widget_class, display, ...)
  4761.     String name;
  4762.     String application_class;
  4763.     WidgetClass widget_class;
  4764.     Display *display;
  4765.  
  4766.  
  4767. name           Specifies the instance name of the shell wid-
  4768.            get.  If name is NULL, the application name
  4769.            passed to XtDisplayInitialize is used.
  4770.  
  4771. application_class
  4772.            Specifies the resource class string to be
  4773.            used in place of the widget class_name string
  4774.            when widget_class is applicationShellWidget-
  4775.            Class or a subclass thereof.
  4776.  
  4777. widget_class   Specifies the widget class for the top-level
  4778.            widget.
  4779.  
  4780. display        Specifies the display for the default screen
  4781.            and for the resource database used to
  4782.            retrieve the shell widget resources.
  4783.  
  4784. ...           Specifies the variable argument list to over-
  4785.            ride any other resource specifications.
  4786. |__
  4787.  
  4788. The XtVaAppCreateShell procedure is identical in function to
  4789. XtAppCreateShell with the args and num_args parameters
  4790. replaced by a varargs list, as described in Section 2.5.1.
  4791.  
  4792.  
  4793. 2.5.4.    Convenience Procedure to Initialize an Application
  4794.  
  4795. To initialize the Intrinsics internals, create an applica-
  4796. tion context, open and initialize a display, and create the
  4797. initial root shell instance, an application may use XtOpe-
  4798. nApplication or XtVaOpenApplication.
  4799.  
  4800.  
  4801.  
  4802.  
  4803.  
  4804.  
  4805.  
  4806.  
  4807.  
  4808.  
  4809.  
  4810.  
  4811.  
  4812.  
  4813.  
  4814.  
  4815.  
  4816.                  63
  4817.  
  4818.  
  4819.  
  4820.  
  4821.  
  4822. X Toolkit Intrinsics                 X11 Release 6.4
  4823.  
  4824. __
  4825. |
  4826. Widget XtOpenApplication(app_context_return, application_class, options, num_options,
  4827.                argc_in_out, argv_in_out, fallback_resources, widget_class, args, num_args)
  4828.       XtAppContext *app_context_return;
  4829.       String application_class;
  4830.       XrmOptionDescList options;
  4831.       Cardinal num_options;
  4832.       int *argc_in_out;
  4833.       String *argv_in_out;
  4834.       String *fallback_resources;
  4835.       WidgetClass widget_class;
  4836.       ArgList args;
  4837.       Cardinal num_args;
  4838.  
  4839.  
  4840. app_context_return
  4841.            Returns the application context, if non-NULL.
  4842.  
  4843. application_class
  4844.            Specifies the class name of the application.
  4845.  
  4846. options        Specifies the command line options table.
  4847.  
  4848. num_options    Specifies the number of entries in options.
  4849.  
  4850. argc_in_out    Specifies a pointer to the number of command
  4851.            line arguments.
  4852.  
  4853. argv_in_out    Specifies a pointer to the command line argu-
  4854.            ments.
  4855.  
  4856. fallback_resources
  4857.            Specifies resource values to be used if the
  4858.            application class resource file cannot be
  4859.            opened or read, or NULL.
  4860.  
  4861. widget_class   Specifies the class of the widget to be cre-
  4862.            ated.  Must be shellWidgetClass or a sub-
  4863.            class.
  4864.  
  4865. args           Specifies the argument list to override any
  4866.            other resource specifications for the created
  4867.            shell widget.
  4868.  
  4869. num_args       Specifies the number of entries in the argu-
  4870.            ment list.
  4871. |__
  4872.  
  4873. The XtOpenApplication function calls XtToolkitInitialize
  4874. followed by XtCreateApplicationContext, then calls
  4875. XtOpenDisplay with display_string NULL and application_name
  4876. NULL, and finally calls XtAppCreateShell with name NULL, the
  4877. specified widget_class, an argument list and count, and
  4878. returns the created shell.  The recommended widget_class is
  4879.  
  4880.  
  4881.  
  4882.                  64
  4883.  
  4884.  
  4885.  
  4886.  
  4887.  
  4888. X Toolkit Intrinsics                 X11 Release 6.4
  4889.  
  4890.  
  4891. sessionShellWidgetClass.  The argument list and count are
  4892. created by merging the specified args and num_args with a
  4893. list containing the specified argc and argv.  The modified
  4894. argc and argv returned by XtDisplayInitialize are returned
  4895. in argc_in_out and argv_in_out.  If app_context_return is
  4896. not NULL, the created application context is also returned.
  4897. If the display specified by the command line cannot be
  4898. opened, an error message is issued and XtOpenApplication
  4899. terminates the application.  If fallback_resources is non-
  4900. NULL, XtAppSetFallbackResources is called with the value
  4901. prior to calling XtOpenDisplay.
  4902.  
  4903.  
  4904.  
  4905.  
  4906.  
  4907.  
  4908.  
  4909.  
  4910.  
  4911.  
  4912.  
  4913.  
  4914.  
  4915.  
  4916.  
  4917.  
  4918.  
  4919.  
  4920.  
  4921.  
  4922.  
  4923.  
  4924.  
  4925.  
  4926.  
  4927.  
  4928.  
  4929.  
  4930.  
  4931.  
  4932.  
  4933.  
  4934.  
  4935.  
  4936.  
  4937.  
  4938.  
  4939.  
  4940.  
  4941.  
  4942.  
  4943.  
  4944.  
  4945.  
  4946.  
  4947.  
  4948.                  65
  4949.  
  4950.  
  4951.  
  4952.  
  4953.  
  4954. X Toolkit Intrinsics                 X11 Release 6.4
  4955.  
  4956. __
  4957. |
  4958. Widget XtVaOpenApplication(app_context_return, application_class, options, num_options,
  4959.              argc_in_out, argv_in_out, fallback_resources, widget_class, ...)
  4960.     XtAppContext *app_context_return;
  4961.     String application_class;
  4962.     XrmOptionDescList options;
  4963.     Cardinal num_options;
  4964.     int *argc_in_out;
  4965.     String *argv_in_out;
  4966.     String *fallback_resources;
  4967.     WidgetClass widget_class;
  4968.  
  4969.  
  4970. app_context_return
  4971.            Returns the application context, if non-NULL.
  4972.  
  4973. application_class
  4974.            Specifies the class name of the application.
  4975.  
  4976. options        Specifies the command line options table.
  4977.  
  4978. num_options    Specifies the number of entries in options.
  4979.  
  4980. argc_in_out    Specifies a pointer to the number of command
  4981.            line arguments.
  4982.  
  4983. argv_in_out    Specifies the command line arguments array.
  4984.  
  4985. fallback_resources
  4986.            Specifies resource values to be used if the
  4987.            application class resource file cannot be
  4988.            opened, or NULL.
  4989.  
  4990. widget_class   Specifies the class of the widget to be cre-
  4991.            ated.  Must be shellWidgetClass or a sub-
  4992.            class.
  4993.  
  4994. ...           Specifies the variable argument list to over-
  4995.            ride any other resource specifications for
  4996.            the created shell.
  4997. |__
  4998.  
  4999. The XtVaOpenApplication procedure is identical in function
  5000. to XtOpenApplication with the args and num_args parameters
  5001. replaced by a varargs list, as described in Section 2.5.1.
  5002.  
  5003.  
  5004. 2.5.5.    Widget Instance Allocation: The allocate Procedure
  5005.  
  5006. A widget class may optionally provide an instance allocation
  5007. procedure in the ObjectClassExtension record.
  5008.  
  5009. When the call to create a widget includes a varargs list
  5010. containing XtVaTypedArg, these arguments will be passed to
  5011.  
  5012.  
  5013.  
  5014.                  66
  5015.  
  5016.  
  5017.  
  5018.  
  5019.  
  5020. X Toolkit Intrinsics                 X11 Release 6.4
  5021.  
  5022.  
  5023. the allocation procedure in an XtTypedArgList.
  5024.  
  5025. __
  5026. |
  5027. typedef struct {
  5028.      String name;
  5029.      String type;
  5030.      XtArgVal value;
  5031.      int size;
  5032. } XtTypedArg, *XtTypedArgList;
  5033.  
  5034. |__
  5035.  
  5036. The allocate procedure pointer in the ObjectClassExtension
  5037. record is of type XtAllocateProc.
  5038.  
  5039.  
  5040.  
  5041.  
  5042.  
  5043.  
  5044.  
  5045.  
  5046.  
  5047.  
  5048.  
  5049.  
  5050.  
  5051.  
  5052.  
  5053.  
  5054.  
  5055.  
  5056.  
  5057.  
  5058.  
  5059.  
  5060.  
  5061.  
  5062.  
  5063.  
  5064.  
  5065.  
  5066.  
  5067.  
  5068.  
  5069.  
  5070.  
  5071.  
  5072.  
  5073.  
  5074.  
  5075.  
  5076.  
  5077.  
  5078.  
  5079.  
  5080.                  67
  5081.  
  5082.  
  5083.  
  5084.  
  5085.  
  5086. X Toolkit Intrinsics                 X11 Release 6.4
  5087.  
  5088. __
  5089. |
  5090. typedef void (*XtAllocateProc)(WidgetClass, Cardinal*, Cardinal*, ArgList, Cardinal*,
  5091.                         XtTypedArgList, Cardinal*, Widget*, XtPointer*);
  5092.       WidgetClass widget_class;
  5093.       Cardinal* constraint_size;
  5094.       Cardinal* more_bytes;
  5095.       ArgList args;
  5096.       Cardinal* num_args;
  5097.       XtTypedArgList typed_args,
  5098.       Cardinal* num_typed_args;
  5099.       Widget* new_return;
  5100.       XtPointer* more_bytes_return;
  5101.  
  5102.  
  5103. widget_class   Specifies the widget class of the instance to
  5104.            allocate.
  5105.  
  5106. constraint_size
  5107.            Specifies the size of the constraint record
  5108.            to allocate, or 0.
  5109.  
  5110. more_bytes     Specifies the number of auxiliary bytes of
  5111.            memory to allocate.
  5112.  
  5113. args           Specifies the argument list as given in the
  5114.            call to create the widget.
  5115.  
  5116. num_args       Specifies the number of arguments.
  5117.  
  5118. typed_args     Specifies the list of typed arguments given
  5119.            in the call to create the widget.
  5120.  
  5121. num_typed_args Specifies the number of typed arguments.
  5122.  
  5123. new_return     Returns a pointer to the newly allocated
  5124.            instance, or NULL in case of error.
  5125.  
  5126. more_bytes_return
  5127.            Returns the auxiliary memory if it was
  5128.            requested, or NULL if requested and an error
  5129.            occurred; otherwise, unchanged.
  5130. |__
  5131.  
  5132. At widget allocation time, if an extension record with
  5133. record_type equal to NULLQUARK is located through the object
  5134. class part extension field and the allocate field is not
  5135. NULL, the XtAllocateProc will be invoked to allocate memory
  5136. for the widget.  If no ObjectClassPart extension record is
  5137. declared with record_type equal to NULLQUARK, then XtInheri-
  5138. tAllocate and XtInheritDeallocate are assumed.    If no XtAl-
  5139. locateProc is found, the Intrinsics will allocate memory for
  5140. the widget.
  5141.  
  5142.  
  5143.  
  5144.  
  5145.  
  5146.                  68
  5147.  
  5148.  
  5149.  
  5150.  
  5151.  
  5152. X Toolkit Intrinsics                 X11 Release 6.4
  5153.  
  5154.  
  5155. An XtAllocateProc must perform the following:
  5156.  
  5157. o    Allocate memory for the widget instance and return it
  5158.      in new_return.  The memory must be at least
  5159.      wc->core_class.widget_size bytes in length, double-word
  5160.      aligned.
  5161.  
  5162. o    Initialize the core.constraints field in the instance
  5163.      record to NULL or to point to a constraint record.  If
  5164.      constraint_size is not 0, the procedure must allocate
  5165.      memory for the constraint record.    The memory must be
  5166.      double-word aligned.
  5167.  
  5168. o    If more_bytes is not 0, then the address of a block of
  5169.      memory at least more_bytes in size, double-word
  5170.      aligned, must be returned in the more_bytes_return
  5171.      parameter, or NULL to indicate an error.
  5172.  
  5173. A class allocation procedure that envelops the allocation
  5174. procedure of a superclass must rely on the enveloped proce-
  5175. dure to perform the instance and constraint allocation.
  5176. Allocation procedures should refrain from initializing
  5177. fields in the widget record except to store pointers to
  5178. newly allocated additional memory.  Under no circumstances
  5179. should an allocation procedure that envelopes its superclass
  5180. allocation procedure modify fields in the instance part of
  5181. any superclass.
  5182.  
  5183.  
  5184. 2.5.6.    Widget Instance Initialization: The initialize Pro-
  5185. cedure
  5186.  
  5187. The initialize procedure pointer in a widget class is of
  5188. type XtInitProc.
  5189.  
  5190.  
  5191.  
  5192.  
  5193.  
  5194.  
  5195.  
  5196.  
  5197.  
  5198.  
  5199.  
  5200.  
  5201.  
  5202.  
  5203.  
  5204.  
  5205.  
  5206.  
  5207.  
  5208.  
  5209.  
  5210.  
  5211.  
  5212.                  69
  5213.  
  5214.  
  5215.  
  5216.  
  5217.  
  5218. X Toolkit Intrinsics                 X11 Release 6.4
  5219.  
  5220. __
  5221. |
  5222. typedef void (*XtInitProc)(Widget, Widget, ArgList, Cardinal*);
  5223.       Widget request;
  5224.       Widget new;
  5225.       ArgList args;
  5226.       Cardinal *num_args;
  5227.  
  5228.  
  5229. request   Specifies a copy of the widget with resource val-
  5230.       ues as requested by the argument list, the
  5231.       resource database, and the widget defaults.
  5232.  
  5233. new      Specifies the widget with the new values, both
  5234.       resource and nonresource, that are actually
  5235.       allowed.
  5236.  
  5237. args      Specifies the argument list passed by the client,
  5238.       for computing derived resource values.  If the
  5239.       client created the widget using a varargs form,
  5240.       any resources specified via XtVaTypedArg are con-
  5241.       verted to the widget representation and the list
  5242.       is transformed into the ArgList format.
  5243.  
  5244. num_args  Specifies the number of entries in the argument
  5245.       list.
  5246. |__
  5247.  
  5248. An initialization procedure performs the following:
  5249.  
  5250. o    Allocates space for and copies any resources referenced
  5251.      by address that the client is allowed to free or modify
  5252.      after the widget has been created.  For example, if a
  5253.      widget has a field that is a String, it may choose not
  5254.      to depend on the characters at that address remaining
  5255.      constant but dynamically allocate space for the string
  5256.      and copy it to the new space.  Widgets that do not copy
  5257.      one or more resources referenced by address should
  5258.      clearly so state in their user documentation.
  5259.  
  5260.                   Note
  5261.  
  5262.       It is not necessary to allocate space for or
  5263.       to copy callback lists.
  5264.  
  5265.  
  5266. o    Computes values for unspecified resource fields.  For
  5267.      example, if width and height are zero, the widget
  5268.      should compute an appropriate width and height based on
  5269.      its other resources.
  5270.  
  5271.  
  5272.  
  5273.  
  5274.  
  5275.  
  5276.  
  5277.  
  5278.                  70
  5279.  
  5280.  
  5281.  
  5282.  
  5283.  
  5284. X Toolkit Intrinsics                 X11 Release 6.4
  5285.  
  5286.  
  5287.                   Note
  5288.  
  5289.       A widget may directly assign only its own
  5290.       width and height within the initialize, ini-
  5291.       tialize_hook, set_values, and set_values_hook
  5292.       procedures; see Chapter 6.
  5293.  
  5294.  
  5295. o    Computes values for uninitialized nonresource fields
  5296.      that are derived from resource fields.  For example,
  5297.      graphics contexts (GCs) that the widget uses are
  5298.      derived from resources like background, foreground, and
  5299.      font.
  5300.  
  5301. An initialization procedure also can check certain fields
  5302. for internal consistency.  For example, it makes no sense to
  5303. specify a colormap for a depth that does not support that
  5304. colormap.
  5305.  
  5306. Initialization procedures are called in superclass-to-sub-
  5307. class order after all fields specified in the resource lists
  5308. have been initialized.    The initialize procedure does not
  5309. need to examine args and num_args if all public resources
  5310. are declared in the resource list.  Most of the initializa-
  5311. tion code for a specific widget class deals with fields
  5312. defined in that class and not with fields defined in its
  5313. superclasses.
  5314.  
  5315. If a subclass does not need an initialization procedure
  5316. because it does not need to perform any of the above opera-
  5317. tions, it can specify NULL for the initialize field in the
  5318. class record.
  5319.  
  5320. Sometimes a subclass may want to overwrite values filled in
  5321. by its superclass.  In particular, size calculations of a
  5322. superclass often are incorrect for a subclass, and in this
  5323. case, the subclass must modify or recalculate fields
  5324. declared and computed by its superclass.
  5325.  
  5326. As an example, a subclass can visually surround its super-
  5327. class display.    In this case, the width and height calcu-
  5328. lated by the superclass initialize procedure are too small
  5329. and need to be incremented by the size of the surround.  The
  5330. subclass needs to know if its superclass's size was calcu-
  5331. lated by the superclass or was specified explicitly.  All
  5332. widgets must place themselves into whatever size is explic-
  5333. itly given, but they should compute a reasonable size if no
  5334. size is requested.
  5335.  
  5336. The request and new arguments provide the necessary informa-
  5337. tion for a subclass to determine the difference between an
  5338. explicitly specified field and a field computed by a super-
  5339. class.    The request widget is a copy of the widget as ini-
  5340. tialized by the arglist and resource database.    The new
  5341.  
  5342.  
  5343.  
  5344.                  71
  5345.  
  5346.  
  5347.  
  5348.  
  5349.  
  5350. X Toolkit Intrinsics                 X11 Release 6.4
  5351.  
  5352.  
  5353. widget starts with the values in the request, but it has
  5354. been updated by all superclass initialization procedures
  5355. called so far.    A subclass initialize procedure can compare
  5356. these two to resolve any potential conflicts.
  5357.  
  5358. In the above example, the subclass with the visual surround
  5359. can see if the width and height in the request widget are
  5360. zero.  If so, it adds its surround size to the width and
  5361. height fields in the new widget.  If not, it must make do
  5362. with the size originally specified.
  5363.  
  5364. The new widget will become the actual widget instance
  5365. record.  Therefore, the initialization procedure should do
  5366. all its work on the new widget; the request widget should
  5367. never be modified.  If the initialize procedure needs to
  5368. call any routines that operate on a widget, it should spec-
  5369. ify new as the widget instance.
  5370.  
  5371.  
  5372. 2.5.7.    Constraint Instance Initialization: The Constraint-
  5373. ClassPart initialize Procedure
  5374.  
  5375. The constraint initialization procedure pointer, found in
  5376. the ConstraintClassPart initialize field of the widget class
  5377. record, is of type XtInitProc.    The values passed to the
  5378. parent constraint initialization procedures are the same as
  5379. those passed to the child's class widget initialization pro-
  5380. cedures.
  5381.  
  5382. The constraints field of the request widget points to a copy
  5383. of the constraints record as initialized by the arglist and
  5384. resource database.
  5385.  
  5386. The constraint initialization procedure should compute any
  5387. constraint fields derived from constraint resources.  It can
  5388. make further changes to the new widget to make the widget
  5389. and any other constraint fields conform to the specified
  5390. constraints, for example, changing the widget's size or
  5391. position.
  5392.  
  5393. If a constraint class does not need a constraint initializa-
  5394. tion procedure, it can specify NULL for the initialize field
  5395. of the ConstraintClassPart in the class record.
  5396.  
  5397.  
  5398. 2.5.8.    Nonwidget Data Initialization: The initialize_hook
  5399. Procedure
  5400.  
  5401.  
  5402.  
  5403.  
  5404.  
  5405.  
  5406.  
  5407.  
  5408.  
  5409.  
  5410.                  72
  5411.  
  5412.  
  5413.  
  5414.  
  5415.  
  5416. X Toolkit Intrinsics                 X11 Release 6.4
  5417.  
  5418.  
  5419.                 Note
  5420.  
  5421.      The initialize_hook procedure is obsolete, as the
  5422.      same information is now available to the initial-
  5423.      ize procedure.  The procedure has been retained
  5424.      for those widgets that used it in previous
  5425.      releases.
  5426.  
  5427.  
  5428. The initialize_hook procedure pointer is of type XtArgsProc:
  5429.  
  5430. __
  5431. |
  5432. typedef void (*XtArgsProc)(Widget, ArgList, Cardinal*);
  5433.       Widget w;
  5434.       ArgList args;
  5435.       Cardinal *num_args;
  5436.  
  5437.  
  5438. w      Specifies the widget.
  5439.  
  5440. args      Specifies the argument list passed by the client.
  5441.       If the client created the widget using a varargs
  5442.       form, any resources specified via XtVaTypedArg are
  5443.       converted to the widget representation and the
  5444.       list is transformed into the ArgList format.
  5445.  
  5446. num_args  Specifies the number of entries in the argument
  5447.       list.
  5448. |__
  5449.  
  5450. If this procedure is not NULL, it is called immediately
  5451. after the corresponding initialize procedure or in its place
  5452. if the initialize field is NULL.
  5453.  
  5454. The initialize_hook procedure allows a widget instance to
  5455. initialize nonresource data using information from the spec-
  5456. ified argument list as if it were a resource.
  5457.  
  5458.  
  5459. 2.6.  Realizing Widgets
  5460.  
  5461. To realize a widget instance, use XtRealizeWidget.
  5462.  
  5463. __
  5464. |
  5465. void XtRealizeWidget(w)
  5466.       Widget w;
  5467.  
  5468.  
  5469. w      Specifies the widget.  Must be of class Core or
  5470.      |__  any subclass thereof.
  5471.  
  5472.  
  5473.  
  5474.  
  5475.  
  5476.                  73
  5477.  
  5478.  
  5479.  
  5480.  
  5481.  
  5482. X Toolkit Intrinsics                 X11 Release 6.4
  5483.  
  5484.  
  5485. If the widget is already realized, XtRealizeWidget simply
  5486. returns.  Otherwise it performs the following:
  5487.  
  5488. o    Binds all action names in the widget's translation
  5489.      table to procedures (see Section 10.1.2).
  5490.  
  5491. o    Makes a postorder traversal of the widget tree rooted
  5492.      at the specified widget and calls each non-NULL
  5493.      change_managed procedure of all composite widgets that
  5494.      have one or more managed children.
  5495.  
  5496. o    Constructs an XSetWindowAttributes structure filled in
  5497.      with information derived from the Core widget fields
  5498.      and calls the realize procedure for the widget, which
  5499.      adds any widget-specific attributes and creates the X
  5500.      window.
  5501.  
  5502. o    If the widget is not a subclass of
  5503.      compositeWidgetClass, XtRealizeWidget returns; other-
  5504.      wise it continues and performs the following:
  5505.  
  5506.      -      Descends recursively to each of the widget's man-
  5507.       aged children and calls the realize procedures.
  5508.       Primitive widgets that instantiate children are
  5509.       responsible for realizing those children them-
  5510.       selves.
  5511.  
  5512.      -      Maps all of the managed children windows that have
  5513.       mapped_when_managed True.  If a widget is managed
  5514.       but mapped_when_managed is False, the widget is
  5515.       allocated visual space but is not displayed.
  5516.  
  5517. If the widget is a top-level shell widget (that is, it has
  5518. no parent), and mapped_when_managed is True, XtRealizeWidget
  5519. maps the widget window.
  5520.  
  5521. XtCreateWidget, XtVaCreateWidget, XtRealizeWidget,
  5522. XtManageChildren, XtUnmanageChildren, XtUnrealizeWidget,
  5523. XtSetMappedWhenManaged, and XtDestroyWidget maintain the
  5524. following invariants:
  5525.  
  5526. o    If a composite widget is realized, then all its managed
  5527.      children are realized.
  5528.  
  5529. o    If a composite widget is realized, then all its managed
  5530.      children that have mapped_when_managed True are mapped.
  5531.  
  5532. All Intrinsics functions and all widget routines should
  5533. accept either realized or unrealized widgets.  When calling
  5534. the realize or change_managed procedures for children of a
  5535. composite widget, XtRealizeWidget calls the procedures in
  5536. reverse order of appearance in the CompositePart children
  5537. list.  By default, this ordering of the realize procedures
  5538. will result in the stacking order of any newly created
  5539.  
  5540.  
  5541.  
  5542.                  74
  5543.  
  5544.  
  5545.  
  5546.  
  5547.  
  5548. X Toolkit Intrinsics                 X11 Release 6.4
  5549.  
  5550.  
  5551. subwindows being top-to-bottom in the order of appearance on
  5552. the list, and the most recently created child will be at the
  5553. bottom.
  5554.  
  5555.  
  5556. To check whether or not a widget has been realized, use
  5557. XtIsRealized.
  5558.  
  5559. __
  5560. |
  5561. Boolean XtIsRealized(w)
  5562.       Widget w;
  5563.  
  5564.  
  5565. w      Specifies the widget.  Must be of class Object or
  5566.       any subclass thereof.
  5567. |__
  5568.  
  5569. The XtIsRealized function returns True if the widget has
  5570. been realized, that is, if the widget has a nonzero window
  5571. ID.  If the specified object is not a widget, the state of
  5572. the nearest widget ancestor is returned.
  5573.  
  5574. Some widget procedures (for example, set_values) might wish
  5575. to operate differently after the widget has been realized.
  5576.  
  5577.  
  5578. 2.6.1.    Widget Instance Window Creation: The realize Proce-
  5579. dure
  5580.  
  5581. The realize procedure pointer in a widget class is of type
  5582. XtRealizeProc.
  5583.  
  5584. __
  5585. |
  5586. typedef void (*XtRealizeProc)(Widget, XtValueMask*, XSetWindowAttributes*);
  5587.       Widget w;
  5588.       XtValueMask *value_mask;
  5589.       XSetWindowAttributes *attributes;
  5590.  
  5591.  
  5592. w      Specifies the widget.
  5593.  
  5594. value_mask
  5595.       Specifies which fields in the attributes structure
  5596.       are used.
  5597.  
  5598. attributes
  5599.       Specifies the window attributes to use in the
  5600.       XCreateWindow call.
  5601. |__
  5602.  
  5603. The realize procedure must create the widget's window.
  5604.  
  5605.  
  5606.  
  5607.  
  5608.                  75
  5609.  
  5610.  
  5611.  
  5612.  
  5613.  
  5614. X Toolkit Intrinsics                 X11 Release 6.4
  5615.  
  5616.  
  5617. Before calling the class realize procedure, the generic
  5618. XtRealizeWidget function fills in a mask and a corresponding
  5619. XSetWindowAttributes structure.  It sets the following
  5620. fields in attributes and corresponding bits in value_mask
  5621. based on information in the widget core structure:
  5622.  
  5623. o    The background_pixmap (or background_pixel if back-
  5624.      ground_pixmap is XtUnspecifiedPixmap) is filled in from
  5625.      the corresponding field.
  5626.  
  5627. o    The border_pixmap (or border_pixel if border_pixmap is
  5628.      XtUnspecifiedPixmap) is filled in from the correspond-
  5629.      ing field.
  5630.  
  5631. o    The colormap is filled in from the corresponding field.
  5632.  
  5633. o    The event_mask is filled in based on the event handlers
  5634.      registered, the event translations specified, whether
  5635.      the expose field is non-NULL, and whether visi-
  5636.      ble_interest is True.
  5637.  
  5638. o    The bit_gravity is set to NorthWestGravity if the
  5639.      expose field is NULL.
  5640.  
  5641. These or any other fields in attributes and the correspond-
  5642. ing bits in value_mask can be set by the realize procedure.
  5643.  
  5644. Note that because realize is not a chained operation, the
  5645. widget class realize procedure must update the XSetWindowAt-
  5646. tributes structure with all the appropriate fields from non-
  5647. Core superclasses.
  5648.  
  5649. A widget class can inherit its realize procedure from its
  5650. superclass during class initialization.  The realize proce-
  5651. dure defined for coreWidgetClass calls XtCreateWindow with
  5652. the passed value_mask and attributes and with window_class
  5653. and visual set to CopyFromParent.  Both compositeWidgetClass
  5654. and constraintWidgetClass inherit this realize procedure,
  5655. and most new widget subclasses can do the same (see Section
  5656. 1.6.10).
  5657.  
  5658. The most common noninherited realize procedures set
  5659. bit_gravity in the mask and attributes to the appropriate
  5660. value and then create the window.  For example, depending on
  5661. its justification, Label might set bit_gravity to
  5662. WestGravity, CenterGravity, or EastGravity.  Consequently,
  5663. shrinking it would just move the bits appropriately, and no
  5664. exposure event is needed for repainting.
  5665.  
  5666. If a composite widget's children should be realized in an
  5667. order other than that specified (to control the stacking
  5668. order, for example), it should call XtRealizeWidget on its
  5669. children itself in the appropriate order from within its own
  5670. realize procedure.
  5671.  
  5672.  
  5673.  
  5674.                  76
  5675.  
  5676.  
  5677.  
  5678.  
  5679.  
  5680. X Toolkit Intrinsics                 X11 Release 6.4
  5681.  
  5682.  
  5683. Widgets that have children and whose class is not a subclass
  5684. of compositeWidgetClass are responsible for calling XtReal-
  5685. izeWidget on their children, usually from within the realize
  5686. procedure.
  5687.  
  5688. Realize procedures cannot manage or unmanage their descen-
  5689. dants.
  5690.  
  5691.  
  5692. 2.6.2.    Window Creation Convenience Routine
  5693.  
  5694. Rather than call the Xlib XCreateWindow function explicitly,
  5695. a realize procedure should normally call the Intrinsics ana-
  5696. log XtCreateWindow, which simplifies the creation of windows
  5697. for widgets.
  5698.  
  5699. __
  5700. |
  5701. void XtCreateWindow(w, window_class, visual, value_mask, attributes)
  5702.       Widget w;
  5703.       unsigned int window_class;
  5704.       Visual *visual;
  5705.       XtValueMask value_mask;
  5706.       XSetWindowAttributes *attributes;
  5707.  
  5708.  
  5709. w      Specifies the widget that defines the additional
  5710.       window attributed.  Must be of class Core or any
  5711.       subclass thereof.
  5712.  
  5713. window_class
  5714.       Specifies the Xlib window class (for example,
  5715.       InputOutput, InputOnly, or CopyFromParent).
  5716.  
  5717. visual      Specifies the visual type (usually
  5718.       CopyFromParent).
  5719.  
  5720. value_mask
  5721.       Specifies which fields in the attributes structure
  5722.       are used.
  5723.  
  5724. attributes
  5725.       Specifies the window attributes to use in the
  5726.       XCreateWindow call.
  5727. |__
  5728.  
  5729. The XtCreateWindow function calls the Xlib XCreateWindow
  5730. function with values from the widget structure and the
  5731. passed parameters.  Then, it assigns the created window to
  5732. the widget's window field.
  5733.  
  5734. XtCreateWindow evaluates the following fields of the widget
  5735. core structure: depth, screen, parent->core.window, x, y,
  5736. width, height, and border_width.
  5737.  
  5738.  
  5739.  
  5740.                  77
  5741.  
  5742.  
  5743.  
  5744.  
  5745.  
  5746. X Toolkit Intrinsics                 X11 Release 6.4
  5747.  
  5748.  
  5749. 2.7.  Obtaining Window Information from a Widget
  5750.  
  5751. The Core widget class definition contains the screen and
  5752. window ids.  The window field may be NULL for a while (see
  5753. Sections 2.5 and 2.6).
  5754.  
  5755. The display pointer, the parent widget, screen pointer, and
  5756. window of a widget are available to the widget writer by
  5757. means of macros and to the application writer by means of
  5758. functions.
  5759.  
  5760. __
  5761. |
  5762. Display *XtDisplay(w)
  5763.       Widget w;
  5764.  
  5765.  
  5766. w      Specifies the widget.  Must be of class Core or
  5767.       any subclass thereof.
  5768. |__
  5769.  
  5770. XtDisplay returns the display pointer for the specified wid-
  5771. get.
  5772.  
  5773.  
  5774. __
  5775. |
  5776. Widget XtParent(w)
  5777.      Widget w;
  5778.  
  5779.  
  5780. w      Specifies the widget.  Must be of class Object or
  5781.       any subclass thereof.
  5782. |__
  5783.  
  5784. XtParent returns the parent object for the specified widget.
  5785. The returned object will be of class Object or a subclass.
  5786.  
  5787.  
  5788. __
  5789. |
  5790. Screen *XtScreen(w)
  5791.       Widget w;
  5792.  
  5793.  
  5794. w      Specifies the widget.  Must be of class Core or
  5795.       any subclass thereof.
  5796. |__
  5797.  
  5798. XtScreen returns the screen pointer for the specified wid-
  5799. get.
  5800.  
  5801.  
  5802.  
  5803.  
  5804.  
  5805.  
  5806.                  78
  5807.  
  5808.  
  5809.  
  5810.  
  5811.  
  5812. X Toolkit Intrinsics                 X11 Release 6.4
  5813.  
  5814. __
  5815. |
  5816. Window XtWindow(w)
  5817.       Widget w;
  5818.  
  5819.  
  5820. w      Specifies the widget.  Must be of class Core or
  5821.       any subclass thereof.
  5822. |__
  5823.  
  5824. XtWindow returns the window of the specified widget.
  5825.  
  5826.  
  5827. The display pointer, screen pointer, and window of a widget
  5828. or of the closest widget ancestor of a nonwidget object are
  5829. available by means of XtDisplayOfObject, XtScreenOfObject,
  5830. and XtWindowOfObject.
  5831.  
  5832.  
  5833. __
  5834. |
  5835. Display *XtDisplayOfObject(object)
  5836.       Widget object;
  5837.  
  5838.  
  5839. object      Specifies the object.  Must be of class Object or
  5840.       any subclass thereof.
  5841. |__
  5842.  
  5843. XtDisplayOfObject is identical in function to XtDisplay if
  5844. the object is a widget; otherwise XtDisplayOfObject returns
  5845. the display pointer for the nearest ancestor of object that
  5846. is of class Widget or a subclass thereof.
  5847.  
  5848. __
  5849. |
  5850. Screen *XtScreenOfObject(object)
  5851.       Widget object;
  5852.  
  5853.  
  5854. object      Specifies the object.  Must be of class Object or
  5855.       any subclass thereof.
  5856. |__
  5857.  
  5858. XtScreenOfObject is identical in function to XtScreen if the
  5859. object is a widget; otherwise XtScreenOfObject returns the
  5860. screen pointer for the nearest ancestor of object that is of
  5861. class Widget or a subclass thereof.
  5862.  
  5863.  
  5864.  
  5865.  
  5866.  
  5867.  
  5868.  
  5869.  
  5870.  
  5871.  
  5872.                  79
  5873.  
  5874.  
  5875.  
  5876.  
  5877.  
  5878. X Toolkit Intrinsics                 X11 Release 6.4
  5879.  
  5880. __
  5881. |
  5882. Window XtWindowOfObject(object)
  5883.       Widget object;
  5884.  
  5885.  
  5886. object      Specifies the object.  Must be of class Object or
  5887.       any subclass thereof.
  5888. |__
  5889.  
  5890. XtWindowOfObject is identical in function to XtWindow if the
  5891. object is a widget; otherwise XtWindowOfObject returns the
  5892. window for the nearest ancestor of object that is of class
  5893. Widget or a subclass thereof.
  5894.  
  5895.  
  5896. To retrieve the instance name of an object, use XtName.
  5897.  
  5898. __
  5899. |
  5900. String XtName(object)
  5901.       Widget object;
  5902.  
  5903.  
  5904. object      Specifies the object whose name is desired.  Must
  5905.       be of class Object or any subclass thereof.
  5906. |__
  5907.  
  5908. XtName returns a pointer to the instance name of the speci-
  5909. fied object.  The storage is owned by the Intrinsics and
  5910. must not be modified.  The name is not qualified by the
  5911. names of any of the object's ancestors.
  5912.  
  5913. Several window attributes are locally cached in the widget
  5914. instance.  Thus, they can be set by the resource manager and
  5915. XtSetValues as well as used by routines that derive struc-
  5916. tures from these values (for example, depth for deriving
  5917. pixmaps, background_pixel for deriving GCs, and so on) or in
  5918. the XtCreateWindow call.
  5919.  
  5920. The x, y, width, height, and border_width window attributes
  5921. are available to geometry managers.  These fields are main-
  5922. tained synchronously inside the Intrinsics.  When an XCon-
  5923. figureWindow is issued by the Intrinsics on the widget's
  5924. window (on request of its parent), these values are updated
  5925. immediately rather than some time later when the server gen-
  5926. erates a ConfigureNotify event.  (In fact, most widgets do
  5927. not select SubstructureNotify events.)    This ensures that
  5928. all geometry calculations are based on the internally con-
  5929. sistent toolkit world rather than on either an inconsistent
  5930. world updated by asynchronous ConfigureNotify events or a
  5931. consistent, but slow, world in which geometry managers ask
  5932. the server for window sizes whenever they need to lay out
  5933. their managed children (see Chapter 6).
  5934.  
  5935.  
  5936.  
  5937.  
  5938.                  80
  5939.  
  5940.  
  5941.  
  5942.  
  5943.  
  5944. X Toolkit Intrinsics                 X11 Release 6.4
  5945.  
  5946.  
  5947. 2.7.1.    Unrealizing Widgets
  5948.  
  5949. To destroy the windows associated with a widget and its non-
  5950. pop-up descendants, use XtUnrealizeWidget.
  5951.  
  5952. __
  5953. |
  5954. void XtUnrealizeWidget(w)
  5955.       Widget w;
  5956.  
  5957.  
  5958. w      Specifies the widget.  Must be of class Core or
  5959.       any subclass thereof.
  5960. |__
  5961.  
  5962. If the widget is currently unrealized, XtUnrealizeWidget
  5963. simply returns.  Otherwise it performs the following:
  5964.  
  5965. o    Unmanages the widget if the widget is managed.
  5966.  
  5967. o    Makes a postorder (child-to-parent) traversal of the
  5968.      widget tree rooted at the specified widget and, for
  5969.      each widget that has declared a callback list resource
  5970.      named ``unrealizeCallback'', executes the procedures on
  5971.      the XtNunrealizeCallback list.
  5972.  
  5973. o    Destroys the widget's window and any subwindows by
  5974.      calling XDestroyWindow with the specified widget's win-
  5975.      dow field.
  5976.  
  5977. Any events in the queue or which arrive following a call to
  5978. XtUnrealizeWidget will be dispatched as if the window(s) of
  5979. the unrealized widget(s) had never existed.
  5980.  
  5981.  
  5982. 2.8.  Destroying Widgets
  5983.  
  5984. The Intrinsics provide support
  5985.  
  5986. o    To destroy all the pop-up children of the widget being
  5987.      destroyed and destroy all children of composite wid-
  5988.      gets.
  5989.  
  5990. o    To remove (and unmap) the widget from its parent.
  5991.  
  5992. o    To call the callback procedures that have been regis-
  5993.      tered to trigger when the widget is destroyed.
  5994.  
  5995. o    To minimize the number of things a widget has to deal-
  5996.      locate when destroyed.
  5997.  
  5998. o    To minimize the number of XDestroyWindow calls when
  5999.      destroying a widget tree.
  6000.  
  6001.  
  6002.  
  6003.  
  6004.                  81
  6005.  
  6006.  
  6007.  
  6008.  
  6009.  
  6010. X Toolkit Intrinsics                 X11 Release 6.4
  6011.  
  6012.  
  6013. To destroy a widget instance, use XtDestroyWidget.
  6014.  
  6015. __
  6016. |
  6017. void XtDestroyWidget(w)
  6018.       Widget w;
  6019.  
  6020.  
  6021. w      Specifies the widget.  Must be of class Object or
  6022.       any subclass thereof.
  6023. |__
  6024.  
  6025. The XtDestroyWidget function provides the only method of
  6026. destroying a widget, including widgets that need to destroy
  6027. themselves.  It can be called at any time, including from an
  6028. application callback routine of the widget being destroyed.
  6029. This requires a two-phase destroy process in order to avoid
  6030. dangling references to destroyed widgets.
  6031.  
  6032. In phase 1, XtDestroyWidget performs the following:
  6033.  
  6034. o    If the being_destroyed field of the widget is True, it
  6035.      returns immediately.
  6036.  
  6037. o    Recursively descends the widget tree and sets the
  6038.      being_destroyed field to True for the widget and all
  6039.      normal and pop-up children.
  6040.  
  6041. o    Adds the widget to a list of widgets (the destroy list)
  6042.      that should be destroyed when it is safe to do so.
  6043.  
  6044. Entries on the destroy list satisfy the invariant that if w2
  6045. occurs after w1 on the destroy list, then w2 is not a
  6046. descendent, either normal or pop-up, of w1.
  6047.  
  6048. Phase 2 occurs when all procedures that should execute as a
  6049. result of the current event have been called, including all
  6050. procedures registered with the event and translation man-
  6051. agers, that is, when the current invocation of XtDis-
  6052. patchEvent is about to return, or immediately if not in
  6053. XtDispatchEvent.
  6054.  
  6055. In phase 2, XtDestroyWidget performs the following on each
  6056. entry in the destroy list in the order specified:
  6057.  
  6058. o    If the widget is not a pop-up child and the widget's
  6059.      parent is a subclass of compositeWidgetClass, and if
  6060.      the parent is not being destroyed, it calls XtUnman-
  6061.      ageChild on the widget and then calls the widget's par-
  6062.      ent's delete_child procedure (see Section 3.3).
  6063.  
  6064. o    Calls the destroy callback procedures registered on the
  6065.      widget and all normal and pop-up descendants in pos-
  6066.      torder (it calls child callbacks before parent
  6067.  
  6068.  
  6069.  
  6070.                  82
  6071.  
  6072.  
  6073.  
  6074.  
  6075.  
  6076. X Toolkit Intrinsics                 X11 Release 6.4
  6077.  
  6078.  
  6079.      callbacks).
  6080.  
  6081. The XtDestroyWidget function then makes second traversal of
  6082. the widget and all normal and pop-up descendants to perform
  6083. the following three items on each widget in postorder:
  6084.  
  6085. o    If the widget is not a pop-up child and the widget's
  6086.      parent is a subclass of constraintWidgetClass, it calls
  6087.      the ConstraintClassPart destroy procedure for the par-
  6088.      ent, then for the parent's superclass, until finally it
  6089.      calls the ConstraintClassPart destroy procedure for
  6090.      constraintWidgetClass.
  6091.  
  6092. o    Calls the CoreClassPart destroy procedure declared in
  6093.      the widget class, then the destroy procedure declared
  6094.      in its superclass, until finally it calls the destroy
  6095.      procedure declared in the Object class record.  Call-
  6096.      back lists are deallocated.
  6097.  
  6098. o    If the widget class object class part contains an
  6099.      ObjectClassExtension record with the record_type NUL-
  6100.      LQUARK and the deallocate field is not NULL, calls the
  6101.      deallocate procedure to deallocate the instance and if
  6102.      one exists, the constraint record.  Otherwise, the
  6103.      Intrinsics will deallocate the widget instance record
  6104.      and if one exists, the constraint record.
  6105.  
  6106. o    Calls XDestroyWindow if the specified widget is real-
  6107.      ized (that is, has an X window).  The server recur-
  6108.      sively destroys all normal descendant windows.  (Win-
  6109.      dows of realized pop-up Shell children, and their
  6110.      descendants, are destroyed by a shell class destroy
  6111.      procedure.)
  6112.  
  6113.  
  6114. 2.8.1.    Adding and Removing Destroy Callbacks
  6115.  
  6116. When an application needs to perform additional processing
  6117. during the destruction of a widget, it should register a
  6118. destroy callback procedure for the widget.  The destroy
  6119. callback procedures use the mechanism described in Chapter
  6120. 8.  The destroy callback list is identified by the resource
  6121. name XtNdestroyCallback.
  6122.  
  6123. For example, the following adds an application-supplied
  6124. destroy callback procedure ClientDestroy with client data to
  6125. a widget by calling XtAddCallback.
  6126.  
  6127.      XtAddCallback(w, XtNdestroyCallback, ClientDestroy, client_data)
  6128.  
  6129.  
  6130. Similarly, the following removes the application-supplied
  6131. destroy callback procedure ClientDestroy by calling
  6132. XtRemoveCallback.
  6133.  
  6134.  
  6135.  
  6136.                  83
  6137.  
  6138.  
  6139.  
  6140.  
  6141.  
  6142. X Toolkit Intrinsics                 X11 Release 6.4
  6143.  
  6144.  
  6145.      XtRemoveCallback(w, XtNdestroyCallback, ClientDestroy, client_data)
  6146.  
  6147.  
  6148. The ClientDestroy argument is of type XtCallbackProc; see
  6149. Section 8.1.
  6150.  
  6151.  
  6152. 2.8.2.    Dynamic Data Deallocation: The destroy Procedure
  6153.  
  6154. The destroy procedure pointers in the ObjectClassPart,
  6155. RectObjClassPart, and CoreClassPart structures are of type
  6156. XtWidgetProc.
  6157.  
  6158. __
  6159. |
  6160. typedef void (*XtWidgetProc)(Widget);
  6161.       Widget w;
  6162.  
  6163.  
  6164. w      Specifies the widget being destroyed.
  6165. |__
  6166.  
  6167. The destroy procedures are called in subclass-to-superclass
  6168. order.    Therefore, a widget's destroy procedure should deal-
  6169. locate only storage that is specific to the subclass and
  6170. should ignore the storage allocated by any of its super-
  6171. classes.  The destroy procedure should deallocate only
  6172. resources that have been explicitly created by the subclass.
  6173. Any resource that was obtained from the resource database or
  6174. passed in an argument list was not created by the widget and
  6175. therefore should not be destroyed by it.  If a widget does
  6176. not need to deallocate any storage, the destroy procedure
  6177. entry in its class record can be NULL.
  6178.  
  6179. Deallocating storage includes, but is not limited to, the
  6180. following steps:
  6181.  
  6182. o    Calling XtFree on dynamic storage allocated with
  6183.      XtMalloc, XtCalloc, and so on.
  6184.  
  6185. o    Calling XFreePixmap on pixmaps created with direct X
  6186.      calls.
  6187.  
  6188. o    Calling XtReleaseGC on GCs allocated with XtGetGC.
  6189.  
  6190. o    Calling XFreeGC on GCs allocated with direct X calls.
  6191.  
  6192. o    Calling XtRemoveEventHandler on event handlers added to
  6193.      other widgets.
  6194.  
  6195. o    Calling XtRemoveTimeOut on timers created with
  6196.      XtAppAddTimeOut.
  6197.  
  6198.  
  6199.  
  6200.  
  6201.  
  6202.                  84
  6203.  
  6204.  
  6205.  
  6206.  
  6207.  
  6208. X Toolkit Intrinsics                 X11 Release 6.4
  6209.  
  6210.  
  6211. o    Calling XtDestroyWidget for each child if the widget
  6212.      has children and is not a subclass of
  6213.      compositeWidgetClass.
  6214.  
  6215. During destroy phase 2 for each widget, the Intrinsics
  6216. remove the widget from the modal cascade, unregister all
  6217. event handlers, remove all key, keyboard, button, and
  6218. pointer grabs and remove all callback procedures registered
  6219. on the widget.    Any outstanding selection transfers will
  6220. time out.
  6221.  
  6222.  
  6223. 2.8.3.    Dynamic Constraint Data Deallocation: The Con-
  6224. straintClassPart destroy Procedure
  6225.  
  6226. The constraint destroy procedure identified in the Con-
  6227. straintClassPart structure is called for a widget whose par-
  6228. ent is a subclass of constraintWidgetClass.  This constraint
  6229. destroy procedure pointer is of type XtWidgetProc.  The con-
  6230. straint destroy procedures are called in subclass-to-super-
  6231. class order, starting at the class of the widget's parent
  6232. and ending at constraintWidgetClass.  Therefore, a parent's
  6233. constraint destroy procedure should deallocate only storage
  6234. that is specific to the constraint subclass and not storage
  6235. allocated by any of its superclasses.
  6236.  
  6237. If a parent does not need to deallocate any constraint stor-
  6238. age, the constraint destroy procedure entry in its class
  6239. record can be NULL.
  6240.  
  6241.  
  6242. 2.8.4.    Widget Instance Deallocation: The deallocate Proce-
  6243. dure
  6244.  
  6245. The deallocate procedure pointer in the ObjectClassExtension
  6246. record is of type XtDeallocateProc.
  6247.  
  6248. __
  6249. |
  6250. typedef void (*XtDeallocateProc)(Widget, XtPointer);
  6251.       Widget widget;
  6252.       XtPointer more_bytes;
  6253.  
  6254.  
  6255. widget      Specifies the widget being destroyed.
  6256.  
  6257. more_bytes
  6258.       Specifies the auxiliary memory received from the
  6259.       corresponding allocator along with the widget, or
  6260.       NULL.
  6261. |__
  6262.  
  6263. When a widget is destroyed, if an ObjectClassExtension
  6264. record exists in the object class part extension field with
  6265.  
  6266.  
  6267.  
  6268.                  85
  6269.  
  6270.  
  6271.  
  6272.  
  6273.  
  6274. X Toolkit Intrinsics                 X11 Release 6.4
  6275.  
  6276.  
  6277. record_type NULLQUARK and the deallocate field is not NULL,
  6278. the XtDeallocateProc will be called.  If no ObjectClassPart
  6279. extension record is declared with record_type equal to
  6280. NULLQUARK, then XtInheritAllocate and XtInheritDeallocate
  6281. are assumed.  The responsibilities of the deallocate proce-
  6282. dure are to deallocate the memory specified by more_bytes if
  6283. it is not NULL, to deallocate the constraints record as
  6284. specified by the widget's core.constraints field if it is
  6285. not NULL, and to deallocate the widget instance itself.
  6286.  
  6287. If no XtDeallocateProc is found, it is assumed that the
  6288. Intrinsics originally allocated the memory and is responsi-
  6289. ble for freeing it.
  6290.  
  6291.  
  6292. 2.9.  Exiting from an Application
  6293.  
  6294. All X Toolkit applications should terminate by calling XtDe-
  6295. stroyApplicationContext and then exiting using the standard
  6296. method for their operating system (typically, by calling
  6297. exit for POSIX-based systems).    The quickest way to make the
  6298. windows disappear while exiting is to call XtUnmapWidget on
  6299. each top-level shell widget.  The Intrinsics have no
  6300. resources beyond those in the program image, and the X
  6301. server will free its resources when its connection to the
  6302. application is broken.
  6303.  
  6304. Depending upon the widget set in use, it may be necessary to
  6305. explicitly destroy individual widgets or widget trees with
  6306. XtDestroyWidget before calling XtDestroyApplicationContext
  6307. in order to ensure that any required widget cleanup is prop-
  6308. erly executed.    The application developer must refer to the
  6309. widget documentation to learn if a widget needs to perform
  6310. cleanup beyond that performed automatically by the operating
  6311. system.  If the client is a session participant (see Section
  6312. 4.2), then the client may wish to resign from the session
  6313. before exiting.  See Section 4.2.4 for details.
  6314.  
  6315.  
  6316.  
  6317.  
  6318.  
  6319.  
  6320.  
  6321.  
  6322.  
  6323.  
  6324.  
  6325.  
  6326.  
  6327.  
  6328.  
  6329.  
  6330.  
  6331.  
  6332.  
  6333.  
  6334.                  86
  6335.  
  6336.  
  6337.  
  6338.  
  6339.  
  6340. X Toolkit Intrinsics                 X11 Release 6.4
  6341.  
  6342.  
  6343.  
  6344.  
  6345.              Chapter 3
  6346.  
  6347.         Composite Widgets and Their Children
  6348.  
  6349.  
  6350.  
  6351. Composite widgets (widgets whose class is a subclass of
  6352. compositeWidgetClass) can have an arbitrary number of chil-
  6353. dren.  Consequently, they are responsible for much more than
  6354. primitive widgets.  Their responsibilities (either imple-
  6355. mented directly by the widget class or indirectly by Intrin-
  6356. sics functions) include:
  6357.  
  6358. o    Overall management of children from creation to
  6359.      destruction.
  6360.  
  6361. o    Destruction of descendants when the composite widget is
  6362.      destroyed.
  6363.  
  6364. o    Physical arrangement (geometry management) of a dis-
  6365.      playable subset of children (that is, the managed chil-
  6366.      dren).
  6367.  
  6368. o    Mapping and unmapping of a subset of the managed chil-
  6369.      dren.
  6370.  
  6371. Overall management is handled by the generic procedures
  6372. XtCreateWidget and XtDestroyWidget.  XtCreateWidget adds
  6373. children to their parent by calling the parent's
  6374. insert_child procedure.  XtDestroyWidget removes children
  6375. from their parent by calling the parent's delete_child pro-
  6376. cedure and ensures that all children of a destroyed compos-
  6377. ite widget also get destroyed.
  6378.  
  6379. Only a subset of the total number of children is actually
  6380. managed by the geometry manager and hence possibly visible.
  6381. For example, a composite editor widget supporting multiple
  6382. editing buffers might allocate one child widget for each
  6383. file buffer, but it might display only a small number of the
  6384. existing buffers.  Widgets that are in this displayable sub-
  6385. set are called managed widgets and enter into geometry man-
  6386. ager calculations.  The other children are called unmanaged
  6387. widgets and, by definition, are not mapped by the Intrin-
  6388. sics.
  6389.  
  6390. Children are added to and removed from their parent's man-
  6391. aged set by using XtManageChild, XtManageChildren,
  6392. XtUnmanageChild, XtUnmanageChildren, and XtChangeManagedSet,
  6393. which notify the parent to recalculate the physical layout
  6394. of its children by calling the parent's change_managed pro-
  6395. cedure.  The XtCreateManagedWidget convenience function
  6396. calls XtCreateWidget and XtManageChild on the result.
  6397.  
  6398.  
  6399.  
  6400.                  87
  6401.  
  6402.  
  6403.  
  6404.  
  6405.  
  6406. X Toolkit Intrinsics                 X11 Release 6.4
  6407.  
  6408.  
  6409. Most managed children are mapped, but some widgets can be in
  6410. a state where they take up physical space but do not show
  6411. anything.  Managed widgets are not mapped automatically if
  6412. their map_when_managed field is False.    The default is True
  6413. and is changed by using XtSetMappedWhenManaged.
  6414.  
  6415. Each composite widget class declares a geometry manager,
  6416. which is responsible for figuring out where the managed
  6417. children should appear within the composite widget's window.
  6418. Geometry management techniques fall into four classes:
  6419.  
  6420. Fixed boxes    Fixed boxes have a fixed number of children
  6421.         created by the parent.    All these children
  6422.         are managed, and none ever makes geometry
  6423.         manager requests.
  6424.  
  6425. Homogeneous boxes
  6426.         Homogeneous boxes treat all children equally
  6427.         and apply the same geometry constraints to
  6428.         each child.  Many clients insert and delete
  6429.         widgets freely.
  6430.  
  6431. Heterogeneous boxes
  6432.         Heterogeneous boxes have a specific location
  6433.         where each child is placed.  This location
  6434.         usually is not specified in pixels, because
  6435.         the window may be resized, but is expressed
  6436.         rather in terms of the relationship between
  6437.         a child and the parent or between the child
  6438.         and other specific children.  The class of
  6439.         heterogeneous boxes is usually a subclass of
  6440.         Constraint.
  6441.  
  6442. Shell boxes    Shell boxes typically have only one child,
  6443.         and the child's size is usually exactly the
  6444.         size of the shell.  The geometry manager
  6445.         must communicate with the window manager, if
  6446.         it exists, and the box must also accept Con-
  6447.         figureNotify events when the window size is
  6448.         changed by the window manager.
  6449.  
  6450.  
  6451. 3.1.  Addition of Children to a Composite Widget: The
  6452. insert_child Procedure
  6453.  
  6454. To add a child to the parent's list of children, the XtCre-
  6455. ateWidget function calls the parent's class routine
  6456. insert_child.  The insert_child procedure pointer in a com-
  6457. posite widget is of type XtWidgetProc.
  6458.  
  6459.  
  6460.  
  6461.  
  6462.  
  6463.  
  6464.  
  6465.  
  6466.                  88
  6467.  
  6468.  
  6469.  
  6470.  
  6471.  
  6472. X Toolkit Intrinsics                 X11 Release 6.4
  6473.  
  6474. __
  6475. |
  6476. typedef void (*XtWidgetProc)(Widget);
  6477.       Widget w;
  6478.  
  6479.  
  6480. w      Passes the newly created child.
  6481. |__
  6482.  
  6483. Most composite widgets inherit their superclass's operation.
  6484. The insert_child routine in CompositeWidgetClasscalls and
  6485. inserts the child at the specified position in the children
  6486. list, expanding it if necessary.
  6487.  
  6488. Some composite widgets define their own insert_child routine
  6489. so that they can order their children in some convenient
  6490. way, create companion controller widgets for a new widget,
  6491. or limit the number or class of their child widgets.  A com-
  6492. posite widget class that wishes to allow nonwidget children
  6493. (see Chapter 12) must specify a CompositeClassExtension
  6494. extension record as described in Section 1.4.2.1 and set the
  6495. accepts_objects field in this record to True.  If the Com-
  6496. positeClassExtension record is not specified or the
  6497. accepts_objects field is False, the composite widget can
  6498. assume that all its children are of a subclass of Core with-
  6499. out an explicit subclass test in the insert_child procedure.
  6500.  
  6501. If there is not enough room to insert a new child in the
  6502. children array (that is, num_children is equal to
  6503. num_slots), the insert_child procedure must first reallocate
  6504. the array and update num_slots.  The insert_child procedure
  6505. then places the child at the appropriate position in the
  6506. array and increments the num_children field.
  6507.  
  6508.  
  6509. 3.2.  Insertion Order of Children: The insert_position Pro-
  6510. cedure
  6511.  
  6512. Instances of composite widgets sometimes need to specify
  6513. more about the order in which their children are kept.    For
  6514. example, an application may want a set of command buttons in
  6515. some logical order grouped by function, and it may want but-
  6516. tons that represent file names to be kept in alphabetical
  6517. order without constraining the order in which the buttons
  6518. are created.
  6519.  
  6520. An application controls the presentation order of a set of
  6521. children by supplying an XtNinsertPosition resource.  The
  6522. insert_position procedure pointer in a composite widget
  6523. instance is of type XtOrderProc.
  6524.  
  6525.  
  6526.  
  6527.  
  6528.  
  6529.  
  6530.  
  6531.  
  6532.                  89
  6533.  
  6534.  
  6535.  
  6536.  
  6537.  
  6538. X Toolkit Intrinsics                 X11 Release 6.4
  6539.  
  6540. __
  6541. |
  6542. typedef Cardinal (*XtOrderProc)(Widget);
  6543.       Widget w;
  6544.  
  6545.  
  6546. w      Passes the newly created widget.
  6547. |__
  6548.  
  6549. Composite widgets that allow clients to order their children
  6550. (usually homogeneous boxes) can call their widget instance's
  6551. insert_position procedure from the class's insert_child pro-
  6552. cedure to determine where a new child should go in its chil-
  6553. dren array.  Thus, a client using a composite class can
  6554. apply different sorting criteria to widget instances of the
  6555. class, passing in a different insert_position procedure
  6556. resource when it creates each composite widget instance.
  6557.  
  6558. The return value of the insert_position procedure indicates
  6559. how many children should go before the widget.    Returning
  6560. zero indicates that the widget should go before all other
  6561. children, and returning num_children indicates that it
  6562. should go after all other children.  The default
  6563. insert_position function returns num_children and can be
  6564. overridden by a specific composite widget's resource list or
  6565. by the argument list provided when the composite widget is
  6566. created.
  6567.  
  6568.  
  6569. 3.3.  Deletion of Children: The delete_child Procedure
  6570.  
  6571.  
  6572. To remove the child from the parent's children list, the
  6573. XtDestroyWidget function eventually causes a call to the
  6574. Composite parent's class delete_child procedure.  The
  6575. delete_child procedure pointer is of type XtWidgetProc.
  6576.  
  6577. __
  6578. |
  6579. typedef void (*XtWidgetProc)(Widget);
  6580.       Widget w;
  6581.  
  6582.  
  6583. w    Passes the child being deleted.
  6584. |__
  6585.  
  6586. Most widgets inherit the delete_child procedure from their
  6587. superclass.  Composite widgets that create companion widgets
  6588. define their own delete_child procedure to remove these com-
  6589. panion widgets.
  6590.  
  6591.  
  6592.  
  6593.  
  6594.  
  6595.  
  6596.  
  6597.  
  6598.                  90
  6599.  
  6600.  
  6601.  
  6602.  
  6603.  
  6604. X Toolkit Intrinsics                 X11 Release 6.4
  6605.  
  6606.  
  6607. 3.4.  Adding and Removing Children from the Managed Set
  6608.  
  6609. The Intrinsics provide a set of generic routines to permit
  6610. the addition of widgets to or the removal of widgets from a
  6611. composite widget's managed set.  These generic routines
  6612. eventually call the composite widget's change_managed proce-
  6613. dure if the procedure pointer is non-NULL.  The change_man-
  6614. aged procedure pointer is of type XtWidgetProc.  The widget
  6615. argument specifies the composite widget whose managed child
  6616. set has been modified.
  6617.  
  6618.  
  6619. 3.4.1.    Managing Children
  6620.  
  6621. To add a list of widgets to the geometry-managed (and hence
  6622. displayable) subset of their Composite parent, use
  6623. XtManageChildren.
  6624.  
  6625. __
  6626. |
  6627. typedef Widget *WidgetList;
  6628.  
  6629. void XtManageChildren(children, num_children)
  6630.       WidgetList children;
  6631.       Cardinal num_children;
  6632.  
  6633.  
  6634. children  Specifies a list of child widgets.  Each child
  6635.       must be of class RectObj or any subclass thereof.
  6636.  
  6637. num_children
  6638.       Specifies the number of children in the list.
  6639. |__
  6640.  
  6641. The XtManageChildren function performs the following:
  6642.  
  6643. o    Issues an error if the children do not all have the
  6644.      same parent or if the parent's class is not a subclass
  6645.      of compositeWidgetClass.
  6646.  
  6647. o    Returns immediately if the common parent is being
  6648.      destroyed; otherwise, for each unique child on the
  6649.      list, XtManageChildren ignores the child if it already
  6650.      is managed or is being destroyed, and marks it if not.
  6651.  
  6652. o    If the parent is realized and after all children have
  6653.      been marked, it makes some of the newly managed chil-
  6654.      dren viewable:
  6655.  
  6656.      -      Calls the change_managed routine of the widgets'
  6657.       parent.
  6658.  
  6659.      -      Calls XtRealizeWidget on each previously unmanaged
  6660.       child that is unrealized.
  6661.  
  6662.  
  6663.  
  6664.                  91
  6665.  
  6666.  
  6667.  
  6668.  
  6669.  
  6670. X Toolkit Intrinsics                 X11 Release 6.4
  6671.  
  6672.  
  6673.      -      Maps each previously unmanaged child that has
  6674.       map_when_managed True.
  6675.  
  6676. Managing children is independent of the ordering of children
  6677. and independent of creating and deleting children.  The lay-
  6678. out routine of the parent should consider children whose
  6679. managed field is True and should ignore all other children.
  6680. Note that some composite widgets, especially fixed boxes,
  6681. call XtManageChild from their insert_child procedure.
  6682.  
  6683. If the parent widget is realized, its change_managed proce-
  6684. dure is called to notify it that its set of managed children
  6685. has changed.  The parent can reposition and resize any of
  6686. its children.  It moves each child as needed by calling
  6687. XtMoveWidget, which first updates the x and y fields and
  6688. which then calls XMoveWindow.
  6689.  
  6690. If the composite widget wishes to change the size or border
  6691. width of any of its children, it calls XtResizeWidget, which
  6692. first updates the width, height, and border_width fields and
  6693. then calls XConfigureWindow.  Simultaneous repositioning and
  6694. resizing may be done with XtConfigureWidget; see Section
  6695. 6.6.
  6696.  
  6697.  
  6698. To add a single child to its parent widget's set of managed
  6699. children, use XtManageChild.
  6700.  
  6701. __
  6702. |
  6703. void XtManageChild(child)
  6704.       Widget child;
  6705.  
  6706.  
  6707. child      Specifies the child.    Must be of class RectObj or
  6708.       any subclass thereof.
  6709. |__
  6710.  
  6711. The XtManageChild function constructs a WidgetList of length
  6712. 1 and calls XtManageChildren.
  6713.  
  6714.  
  6715. To create and manage a child widget in a single procedure,
  6716. use XtCreateManagedWidget or XtVaCreateManagedWidget.
  6717.  
  6718.  
  6719.  
  6720.  
  6721.  
  6722.  
  6723.  
  6724.  
  6725.  
  6726.  
  6727.  
  6728.  
  6729.  
  6730.                  92
  6731.  
  6732.  
  6733.  
  6734.  
  6735.  
  6736. X Toolkit Intrinsics                 X11 Release 6.4
  6737.  
  6738. __
  6739. |
  6740. Widget XtCreateManagedWidget(name, widget_class, parent, args, num_args)
  6741.       String name;
  6742.       WidgetClass widget_class;
  6743.       Widget parent;
  6744.       ArgList args;
  6745.       Cardinal num_args;
  6746.  
  6747.  
  6748. name      Specifies the resource instance name for the cre-
  6749.       ated widget.
  6750.  
  6751. widget_class
  6752.       Specifies the widget class pointer for the created
  6753.       widget.  Must be rectObjClass or any subclass
  6754.       thereof.
  6755.  
  6756. parent      Specifies the parent widget.    Must be of class
  6757.       Composite or any subclass thereof.
  6758.  
  6759. args      Specifies the argument list to override any other
  6760.       resource specifications.
  6761.  
  6762. num_args  Specifies the number of entries in the argument
  6763.       list.
  6764. |__
  6765.  
  6766. The XtCreateManagedWidget function is a convenience routine
  6767. that calls XtCreateWidget and XtManageChild.
  6768.  
  6769.  
  6770.  
  6771.  
  6772.  
  6773.  
  6774.  
  6775.  
  6776.  
  6777.  
  6778.  
  6779.  
  6780.  
  6781.  
  6782.  
  6783.  
  6784.  
  6785.  
  6786.  
  6787.  
  6788.  
  6789.  
  6790.  
  6791.  
  6792.  
  6793.  
  6794.  
  6795.  
  6796.                  93
  6797.  
  6798.  
  6799.  
  6800.  
  6801.  
  6802. X Toolkit Intrinsics                 X11 Release 6.4
  6803.  
  6804. __
  6805. |
  6806. Widget XtVaCreateManagedWidget(name, widget_class, parent, ...)
  6807.       String name;
  6808.       WidgetClass widget_class;
  6809.       Widget parent;
  6810.  
  6811.  
  6812. name      Specifies the resource instance name for the cre-
  6813.       ated widget.
  6814.  
  6815. widget_class
  6816.       Specifies the widget class pointer for the created
  6817.       widget.  Must be rectObjClass or any subclass
  6818.       thereof.
  6819.  
  6820. parent      Specifies the parent widget.    Must be of class
  6821.       Composite or any subclass thereof.
  6822.  
  6823. ...      Specifies the variable argument list to override
  6824.       any other resource specifications.
  6825. |__
  6826.  
  6827. XtVaCreateManagedWidget is identical in function to XtCre-
  6828. ateManagedWidget with the args and num_args parameters
  6829. replaced by a varargs list, as described in Section 2.5.1.
  6830.  
  6831.  
  6832. 3.4.2.    Unmanaging Children
  6833.  
  6834. To remove a list of children from a parent widget's managed
  6835. list, use XtUnmanageChildren.
  6836.  
  6837. __
  6838. |
  6839. void XtUnmanageChildren(children, num_children)
  6840.       WidgetList children;
  6841.       Cardinal num_children;
  6842.  
  6843.  
  6844. children  Specifies a list of child widgets.  Each child
  6845.       must be of class RectObj or any subclass thereof.
  6846.  
  6847. num_children
  6848.       Specifies the number of children.
  6849. |__
  6850.  
  6851. The XtUnmanageChildren function performs the following:
  6852.  
  6853. o    Returns immediately if the common parent is being
  6854.      destroyed.
  6855.  
  6856. o    Issues an error if the children do not all have the
  6857.      same parent or if the parent is not a subclass of
  6858.      compositeWidgetClass.
  6859.  
  6860.  
  6861.  
  6862.                  94
  6863.  
  6864.  
  6865.  
  6866.  
  6867.  
  6868. X Toolkit Intrinsics                 X11 Release 6.4
  6869.  
  6870.  
  6871. o    For each unique child on the list, XtUnmanageChildren
  6872.      ignores the child if it is unmanaged; otherwise it per-
  6873.      forms the following:
  6874.  
  6875.      -      Marks the child as unmanaged.
  6876.  
  6877.      -      If the child is realized and the map_when_managed
  6878.       field is True, it is unmapped.
  6879.  
  6880. o    If the parent is realized and if any children have
  6881.      become unmanaged, calls the change_managed routine of
  6882.      the widgets' parent.
  6883.  
  6884. XtUnmanageChildren does not destroy the child widgets.
  6885. Removing widgets from a parent's managed set is often a tem-
  6886. porary banishment, and some time later the client may manage
  6887. the children again.  To destroy widgets entirely, XtDestroy-
  6888. Widget should be called instead; see Section 2.9.
  6889.  
  6890.  
  6891. To remove a single child from its parent widget's managed
  6892. set, use XtUnmanageChild.
  6893.  
  6894. __
  6895. |
  6896. void XtUnmanageChild(child)
  6897.       Widget child;
  6898.  
  6899.  
  6900. child      Specifies the child.    Must be of class RectObj or
  6901.       any subclass thereof.
  6902. |__
  6903.  
  6904. The XtUnmanageChild function constructs a widget list of
  6905. length 1 and calls XtUnmanageChildren.
  6906.  
  6907. These functions are low-level routines that are used by
  6908. generic composite widget building routines.  In addition,
  6909. composite widgets can provide widget-specific, high-level
  6910. convenience procedures.
  6911.  
  6912.  
  6913. 3.4.3.    Bundling Changes to the Managed Set
  6914.  
  6915. A client may simultaneously unmanage and manage children
  6916. with a single call to the Intrinsics.  In this same call the
  6917. client may provide a callback procedure that can modify the
  6918. geometries of one or more children.  The composite widget
  6919. class defines whether this single client call results in
  6920. separate invocations of the change_managed method, one to
  6921. unmanage and the other to manage, or in just a single invo-
  6922. cation.
  6923.  
  6924.  
  6925.  
  6926.  
  6927.  
  6928.                  95
  6929.  
  6930.  
  6931.  
  6932.  
  6933.  
  6934. X Toolkit Intrinsics                 X11 Release 6.4
  6935.  
  6936.  
  6937. To simultaneously remove from and add to the geometry-man-
  6938. aged set of children of a composite parent, use
  6939. XtChangeManagedSet.
  6940.  
  6941. __
  6942. |
  6943. void XtChangeManagedSet(unmanage_children, num_unmanage_children,
  6944.                           do_change_proc, client_data,
  6945.                           manage_children, num_manage_children)
  6946.       WidgetList unmanage_children;
  6947.       Cardinal num_unmanage_children;
  6948.       XtDoChangeProc do_change_proc;
  6949.       XtPointer client_data;
  6950.       WidgetList manage_children;
  6951.       Cardinal num_manage_children;
  6952.  
  6953.  
  6954. unmanage_children Specifies the list of widget children to
  6955.           initially remove from the managed set.
  6956.  
  6957. num_unmanage_children
  6958.           Specifies the number of entries in the
  6959.           unmanage_children list.
  6960.  
  6961. do_change_proc      Specifies a procedure to invoke between
  6962.           unmanaging and managing the children, or
  6963.           NULL.
  6964.  
  6965. client_data      Specifies client data to be passed to the
  6966.           do_change_proc.
  6967.  
  6968. manage_children   Specifies the list of widget children to
  6969.           finally add to the managed set.
  6970.  
  6971. num_manage_children
  6972.           Specifies the number of entries in the
  6973.           manage_children list.
  6974. |__
  6975.  
  6976. The XtChangeManagedSet function performs the following:
  6977.  
  6978. o    Returns immediately if num_unmanage_children and
  6979.      num_manage_children are both 0.
  6980.  
  6981. o    Issues a warning and returns if the widgets specified
  6982.      in the manage_children and the unmanage_children lists
  6983.      do not all have the same parent or if that parent is
  6984.      not a subclass of compositeWidgetClass.
  6985.  
  6986. o    Returns immediately if the common parent is being
  6987.      destroyed.
  6988.  
  6989. o    If do_change_proc is not NULL and the parent's Compos-
  6990.      iteClassExtension allows_change_managed_set field is
  6991.  
  6992.  
  6993.  
  6994.                  96
  6995.  
  6996.  
  6997.  
  6998.  
  6999.  
  7000. X Toolkit Intrinsics                 X11 Release 6.4
  7001.  
  7002.  
  7003.      False, then XtChangeManagedSet performs the following:
  7004.  
  7005.      -      Calls XtUnmanageChildren (unmanage_children,
  7006.       num_unmanage_children).
  7007.  
  7008.      -      Calls the do_change_proc.
  7009.  
  7010.      -      Calls XtManageChildren (manage_children, num_man-
  7011.       age_children).
  7012.  
  7013. o    Otherwise, the following is performed:
  7014.  
  7015.      -      For each child on the unmanage_children list; if
  7016.       the child is already unmanaged it is ignored, oth-
  7017.       erwise it is marked as unmanaged, and if it is
  7018.       realized and its map_when_managed field is True,
  7019.       it is unmapped.
  7020.  
  7021.      -      If do_change_proc is non-NULL, the procedure is
  7022.       invoked.
  7023.  
  7024.      -      For each child on the manage_children list; if the
  7025.       child is already managed or is being destroyed, it
  7026.       is ignored; otherwise it is marked as managed.
  7027.  
  7028.      -      If the parent is realized and after all children
  7029.       have been marked, the change_managed method of the
  7030.       parent is invoked, and subsequently some of the
  7031.       newly managed children are made viewable by call-
  7032.       ing XtRealizeWidget on each previously unmanaged
  7033.       child that is unrealized and mapping each previ-
  7034.       ously unmanaged child that has map_when_managed
  7035.       True.
  7036.  
  7037. If no CompositeClassExtension record is found in the par-
  7038. ent's composite class part extension field with record type
  7039. NULLQUARK and version greater than 1, and if XtInher-
  7040. itChangeManaged was specified in the parent's class record
  7041. during class initialization, the value of the
  7042. allows_change_managed_set field is inherited from the super-
  7043. class.    The value inherited from compositeWidgetClass for
  7044. the allows_change_managed_set field is False.
  7045.  
  7046. It is not an error to include a child in both the unman-
  7047. age_children and the manage_children lists.  The effect of
  7048. such a call is that the child remains managed following the
  7049. call, but the do_change_proc is able to affect the child
  7050. while it is in an unmanaged state.
  7051.  
  7052.  
  7053. The do_change_proc is of type XtDoChangeProc.
  7054.  
  7055.  
  7056.  
  7057.  
  7058.  
  7059.  
  7060.                  97
  7061.  
  7062.  
  7063.  
  7064.  
  7065.  
  7066. X Toolkit Intrinsics                 X11 Release 6.4
  7067.  
  7068. __
  7069. |
  7070. typedef void (*XtDoChangeProc)(Widget, WidgetList, Cardinal*, WidgetList, Cardinal*, XtPointer);
  7071.       Widget composite_parent;
  7072.       WidgetList unmange_children;
  7073.       Cardinal *num_unmanage_children;
  7074.       WidgetList manage_children;
  7075.       Cardinal *num_manage_children;
  7076.       XtPointer client_data;
  7077.  
  7078.  
  7079. composite_parent  Passes the composite parent whose managed
  7080.           set is being altered.
  7081.  
  7082. unmanage_children Passes the list of children just removed
  7083.           from the managed set.
  7084.  
  7085. num_unmanage_children
  7086.           Passes the number of entries in the unman-
  7087.           age_children list.
  7088.  
  7089. manage_children   Passes the list of children about to be
  7090.           added to the managed set.
  7091.  
  7092. num_manage_children
  7093.           Passes the number of entries in the man-
  7094.           age_children list.
  7095.  
  7096. client_data      Passes the client data passed to
  7097.           XtChangeManagedSet.
  7098. |__
  7099.  
  7100. The do_change_proc procedure is used by the caller of
  7101. XtChangeManagedSet to make changes to one or more children
  7102. at the point when the managed set contains the fewest
  7103. entries.  These changes may involve geometry requests, and
  7104. in this case the caller of XtChangeManagedSet may take
  7105. advantage of the fact that the Intrinsics internally grant
  7106. geometry requests made by unmanaged children without invok-
  7107. ing the parent's geometry manager.  To achieve this advan-
  7108. tage, if the do_change_proc procedure changes the geometry
  7109. of a child or of a descendant of a child, then that child
  7110. should be included in the unmanage_children and manage_chil-
  7111. dren lists.
  7112.  
  7113.  
  7114. 3.4.4.    Determining if a Widget Is Managed
  7115.  
  7116. To determine the managed state of a given child widget, use
  7117. XtIsManaged.
  7118.  
  7119.  
  7120.  
  7121.  
  7122.  
  7123.  
  7124.  
  7125.  
  7126.                  98
  7127.  
  7128.  
  7129.  
  7130.  
  7131.  
  7132. X Toolkit Intrinsics                 X11 Release 6.4
  7133.  
  7134. __
  7135. |
  7136. Boolean XtIsManaged(w)
  7137.        Widget w;
  7138.  
  7139.  
  7140. w      Specifies the widget.  Must be of class Object or
  7141.       any subclass thereof.
  7142. |__
  7143.  
  7144. The XtIsManaged function returns True if the specified wid-
  7145. get is of class RectObj or any subclass thereof and is man-
  7146. aged, or False otherwise.
  7147.  
  7148.  
  7149. 3.5.  Controlling When Widgets Get Mapped
  7150.  
  7151. A widget is normally mapped if it is managed.  However, this
  7152. behavior can be overridden by setting the XtNmappedWhenMan-
  7153. aged resource for the widget when it is created or by set-
  7154. ting the map_when_managed field to False.
  7155.  
  7156.  
  7157. To change the value of a given widget's map_when_managed
  7158. field, use XtSetMappedWhenManaged.
  7159.  
  7160. __
  7161. |
  7162. void XtSetMappedWhenManaged(w, map_when_managed)
  7163.       Widget w;
  7164.       Boolean map_when_managed;
  7165.  
  7166.  
  7167. w      Specifies the widget.  Must be of class Core or
  7168.       any subclass thereof.
  7169.  
  7170. map_when_managed
  7171.       Specifies a Boolean value that indicates the new
  7172.       value that is stored into the widget's
  7173.       map_when_managed field.
  7174. |__
  7175.  
  7176. If the widget is realized and managed, and if map_when_man-
  7177. aged is True, XtSetMappedWhenManaged maps the window.  If
  7178. the widget is realized and managed, and if map_when_managed
  7179. is False, it unmaps the window.  XtSetMappedWhenManaged is a
  7180. convenience function that is equivalent to (but slightly
  7181. faster than) calling XtSetValues and setting the new value
  7182. for the XtNmappedWhenManaged resource then mapping the wid-
  7183. get as appropriate.  As an alternative to using XtSetMapped-
  7184. WhenManaged to control mapping, a client may set
  7185. mapped_when_managed to False and use XtMapWidget and XtUn-
  7186. mapWidget explicitly.
  7187.  
  7188.  
  7189.  
  7190.  
  7191.  
  7192.                  99
  7193.  
  7194.  
  7195.  
  7196.  
  7197.  
  7198. X Toolkit Intrinsics                 X11 Release 6.4
  7199.  
  7200.  
  7201. To map a widget explicitly, use XtMapWidget.
  7202.  
  7203. __
  7204. |
  7205. XtMapWidget(w)
  7206.      Widget w;
  7207.  
  7208.  
  7209. w      Specifies the widget.  Must be of class Core or
  7210.       any subclass thereof.
  7211. |__
  7212.  
  7213. To unmap a widget explicitly, use XtUnmapWidget.
  7214.  
  7215. __
  7216. |
  7217. XtUnmapWidget(w)
  7218.      Widget w;
  7219.  
  7220.  
  7221. w      Specifies the widget.  Must be of class Core or
  7222.       any subclass thereof.
  7223. |__
  7224.  
  7225.  
  7226.  
  7227. 3.6.  Constrained Composite Widgets
  7228.  
  7229. The Constraint widget class is a subclass of
  7230. compositeWidgetClass.  The name is derived from the fact
  7231. that constraint widgets may manage the geometry of their
  7232. children based on constraints associated with each child.
  7233. These constraints can be as simple as the maximum width and
  7234. height the parent will allow the child to occupy or can be
  7235. as complicated as how other children should change if this
  7236. child is moved or resized.  Constraint widgets let a parent
  7237. define constraints as resources that are supplied for their
  7238. children.  For example, if the Constraint parent defines the
  7239. maximum sizes for its children, these new size resources are
  7240. retrieved for each child as if they were resources that were
  7241. defined by the child widget's class.  Accordingly, con-
  7242. straint resources may be included in the argument list or
  7243. resource file just like any other resource for the child.
  7244.  
  7245. Constraint widgets have all the responsibilities of normal
  7246. composite widgets and, in addition, must process and act
  7247. upon the constraint information associated with each of
  7248. their children.
  7249.  
  7250. To make it easy for widgets and the Intrinsics to keep track
  7251. of the constraints associated with a child, every widget has
  7252. a constraints field, which is the address of a parent-spe-
  7253. cific structure that contains constraint information about
  7254. the child.  If a child's parent does not belong to a
  7255.  
  7256.  
  7257.  
  7258.                  100
  7259.  
  7260.  
  7261.  
  7262.  
  7263.  
  7264. X Toolkit Intrinsics                 X11 Release 6.4
  7265.  
  7266.  
  7267. subclass of constraintWidgetClass, then the child's con-
  7268. straints field is NULL.
  7269.  
  7270. Subclasses of Constraint can add constraint data to the con-
  7271. straint record defined by their superclass.  To allow this,
  7272. widget writers should define the constraint records in their
  7273. private .h file by using the same conventions as used for
  7274. widget records.  For example, a widget class that needs to
  7275. maintain a maximum width and height for each child might
  7276. define its constraint record as follows:
  7277.  
  7278.  
  7279.      typedef struct {
  7280.       Dimension max_width, max_height;
  7281.      } MaxConstraintPart;
  7282.  
  7283.      typedef struct {
  7284.       MaxConstraintPart max;
  7285.      } MaxConstraintRecord, *MaxConstraint;
  7286.  
  7287.  
  7288. A subclass of this widget class that also needs to maintain
  7289. a minimum size would define its constraint record as fol-
  7290. lows:
  7291.  
  7292.  
  7293.      typedef struct {
  7294.       Dimension min_width, min_height;
  7295.      } MinConstraintPart;
  7296.  
  7297.      typedef struct {
  7298.       MaxConstraintPart max;
  7299.       MinConstraintPart min;
  7300.      } MaxMinConstraintRecord, *MaxMinConstraint;
  7301.  
  7302.  
  7303. Constraints are allocated, initialized, deallocated, and
  7304. otherwise maintained insofar as possible by the Intrinsics.
  7305. The Constraint class record part has several entries that
  7306. facilitate this.  All entries in ConstraintClassPart are
  7307. fields and procedures that are defined and implemented by
  7308. the parent, but they are called whenever actions are per-
  7309. formed on the parent's children.
  7310.  
  7311. The XtCreateWidget function uses the constraint_size field
  7312. in the parent's class record to allocate a constraint record
  7313. when a child is created.  XtCreateWidget also uses the con-
  7314. straint resources to fill in resource fields in the con-
  7315. straint record associated with a child.  It then calls the
  7316. constraint initialize procedure so that the parent can com-
  7317. pute constraint fields that are derived from constraint
  7318. resources and can possibly move or resize the child to con-
  7319. form to the given constraints.
  7320.  
  7321.  
  7322.  
  7323.  
  7324.                  101
  7325.  
  7326.  
  7327.  
  7328.  
  7329.  
  7330. X Toolkit Intrinsics                 X11 Release 6.4
  7331.  
  7332.  
  7333. When the XtGetValues and XtSetValues functions are executed
  7334. on a child, they use the constraint resources to get the
  7335. values or set the values of constraints associated with that
  7336. child.    XtSetValues then calls the constraint set_values
  7337. procedures so that the parent can recompute derived con-
  7338. straint fields and move or resize the child as appropriate.
  7339. If a Constraint widget class or any of its superclasses have
  7340. declared a ConstraintClassExtension record in the Con-
  7341. straintClassPart extension fields with a record type of NUL-
  7342. LQUARK and the get_values_hook field in the extension record
  7343. is non-NULL, XtGetValues calls the get_values_hook proce-
  7344. dure(s) to allow the parent to return derived constraint
  7345. fields.
  7346.  
  7347. The XtDestroyWidget function calls the constraint destroy
  7348. procedure to deallocate any dynamic storage associated with
  7349. a constraint record.  The constraint record itself must not
  7350. be deallocated by the constraint destroy procedure; XtDe-
  7351. stroyWidget does this automatically.
  7352.  
  7353.  
  7354.  
  7355.  
  7356.  
  7357.  
  7358.  
  7359.  
  7360.  
  7361.  
  7362.  
  7363.  
  7364.  
  7365.  
  7366.  
  7367.  
  7368.  
  7369.  
  7370.  
  7371.  
  7372.  
  7373.  
  7374.  
  7375.  
  7376.  
  7377.  
  7378.  
  7379.  
  7380.  
  7381.  
  7382.  
  7383.  
  7384.  
  7385.  
  7386.  
  7387.  
  7388.  
  7389.  
  7390.                  102
  7391.  
  7392.  
  7393.  
  7394.  
  7395.  
  7396. X Toolkit Intrinsics                 X11 Release 6.4
  7397.  
  7398.  
  7399.  
  7400.  
  7401.              Chapter 4
  7402.  
  7403.                Shell Widgets
  7404.  
  7405.  
  7406.  
  7407.  
  7408. Shell widgets hold an application's top-level widgets to
  7409. allow them to communicate with the window manager and ses-
  7410. sion manager.  Shells have been designed to be as nearly
  7411. invisible as possible.    Clients have to create them, but
  7412. they should never have to worry about their sizes.
  7413.  
  7414. If a shell widget is resized from the outside (typically by
  7415. a window manager), the shell widget also resizes its managed
  7416. child widget automatically.  Similarly, if the shell's child
  7417. widget needs to change size, it can make a geometry request
  7418. to the shell, and the shell negotiates the size change with
  7419. the outer environment.    Clients should never attempt to
  7420. change the size of their shells directly.
  7421.  
  7422. The five types of public shells are:
  7423.  
  7424. OverrideShell      Used for shell windows that completely
  7425.           bypass the window manager (for example,
  7426.           pop-up menu shells).
  7427.  
  7428. TransientShell      Used for shell windows that have the
  7429.           WM_TRANSIENT_FOR property set. The effect
  7430.           of this property is dependent upon the
  7431.           window manager being used.
  7432.  
  7433. TopLevelShell      Used for normal top-level windows (for
  7434.           example, any additional top-level widgets
  7435.           an application needs).
  7436.  
  7437. Application-      Formerly used for the single main top-
  7438. Shell          level window that the window manager iden-
  7439.           tifies as an application instance and made
  7440.           obsolete by SessionShell.
  7441.  
  7442. SessionShell      Used for the single main top-level window
  7443.           that the window manager identifies as an
  7444.           application instance and that interacts
  7445.           with the session manager.
  7446.  
  7447.  
  7448.  
  7449. 4.1.  Shell Widget Definitions
  7450.  
  7451. Widgets negotiate their size and position with their parent
  7452. widget, that is, the widget that directly contains them.
  7453.  
  7454.  
  7455.  
  7456.                  103
  7457.  
  7458.  
  7459.  
  7460.  
  7461.  
  7462. X Toolkit Intrinsics                 X11 Release 6.4
  7463.  
  7464.  
  7465. Widgets at the top of the hierarchy do not have parent wid-
  7466. gets.  Instead, they must deal with the outside world.    To
  7467. provide for this, each top-level widget is encapsulated in a
  7468. special widget, called a shell widget.
  7469.  
  7470. Shell widgets, whose class is a subclass of the Composite
  7471. class, encapsulate other widgets and can allow a widget to
  7472. avoid the geometry clipping imposed by the parent-child win-
  7473. dow relationship.  They also can provide a layer of communi-
  7474. cation with the window manager.
  7475.  
  7476. The eight different types of shells are:
  7477.  
  7478. Shell          The base class for shell widgets; provides
  7479.           the fields needed for all types of shells.
  7480.           Shell is a direct subclass of
  7481.           compositeWidgetClass.
  7482. OverrideShell      A subclass of Shell; used for shell windows
  7483.           that completely bypass the window manager.
  7484. WMShell       A subclass of Shell; contains fields needed
  7485.           by the common window manager protocol.
  7486. VendorShell      A subclass of WMShell; contains fields used
  7487.           by vendor-specific window managers.
  7488. TransientShell      A subclass of VendorShell; used for shell
  7489.           windows that desire the WM_TRANSIENT_FOR
  7490.           property.
  7491. TopLevelShell      A subclass of VendorShell; used for normal
  7492.           top-level windows.
  7493. Application-      A subclass of TopLevelShell; may be used for
  7494. Shell          an application's additional root windows.
  7495. SessionShell      A subclass of ApplicationShell; used for an
  7496.           application's main root window.
  7497.  
  7498.  
  7499. Note that the classes Shell, WMShell, and VendorShell are
  7500. internal and should not be instantiated or subclassed.    Only
  7501. OverrrideShell, TransientShell, TopLevelShell, Application-
  7502. Shell, and SessionShell are intended for public use.
  7503.  
  7504.  
  7505. 4.1.1.    ShellClassPart Definitions
  7506.  
  7507. Only the Shell class has additional class fields, which are
  7508. all contained in the ShellClassExtensionRec.  None of the
  7509. other Shell classes have any additional class fields:
  7510.  
  7511.  
  7512.  
  7513.  
  7514.  
  7515.  
  7516.  
  7517.  
  7518.  
  7519.  
  7520.  
  7521.  
  7522.                  104
  7523.  
  7524.  
  7525.  
  7526.  
  7527.  
  7528. X Toolkit Intrinsics                 X11 Release 6.4
  7529.  
  7530. __
  7531. |
  7532. typedef struct {
  7533.     XtPointer extension;
  7534. } ShellClassPart, OverrideShellClassPart,
  7535. WMShellClassPart, VendorShellClassPart, TransientShellClassPart,
  7536. TopLevelShellClassPart, ApplicationShellClassPart, SessionShellClassPart;
  7537.  
  7538. |__
  7539.  
  7540. The full Shell class record definitions are:
  7541.  
  7542.  
  7543.  
  7544.  
  7545.  
  7546.  
  7547.  
  7548.  
  7549.  
  7550.  
  7551.  
  7552.  
  7553.  
  7554.  
  7555.  
  7556.  
  7557.  
  7558.  
  7559.  
  7560.  
  7561.  
  7562.  
  7563.  
  7564.  
  7565.  
  7566.  
  7567.  
  7568.  
  7569.  
  7570.  
  7571.  
  7572.  
  7573.  
  7574.  
  7575.  
  7576.  
  7577.  
  7578.  
  7579.  
  7580.  
  7581.  
  7582.  
  7583.  
  7584.  
  7585.  
  7586.  
  7587.  
  7588.                  105
  7589.  
  7590.  
  7591.  
  7592.  
  7593.  
  7594. X Toolkit Intrinsics                 X11 Release 6.4
  7595.  
  7596. __
  7597. |
  7598. typedef struct _ShellClassRec {
  7599.      CoreClassPart     core_class;
  7600.      CompositeClassPart  composite_class;
  7601.      ShellClassPart     shell_class;
  7602. } ShellClassRec;
  7603.  
  7604.  
  7605. typedef struct {
  7606.      XtPointer         next_extension;     See Section 1.6.12
  7607.      XrmQuark         record_type;         See Section 1.6.12
  7608.      long         version;         See Section 1.6.12
  7609.      Cardinal         record_size;         See Section 1.6.12
  7610.      XtGeometryHandler     root_geometry_manager;See below
  7611. } ShellClassExtensionRec, *ShellClassExtension;
  7612.  
  7613.  
  7614. typedef struct _OverrideShellClassRec {
  7615.      CoreClassPart     core_class;
  7616.      CompositeClassPart  composite_class;
  7617.      ShellClassPart     shell_class;
  7618.      OverrideShellClassPart             override_shell_class;
  7619. } OverrideShellClassRec;
  7620.  
  7621.  
  7622. typedef struct _WMShellClassRec {
  7623.      CoreClassPart     core_class;
  7624.      CompositeClassPart  composite_class;
  7625.      ShellClassPart     shell_class;
  7626.      WMShellClassPart     wm_shell_class;
  7627. } WMShellClassRec;
  7628.  
  7629.  
  7630. typedef struct _VendorShellClassRec {
  7631.      CoreClassPart     core_class;
  7632.      CompositeClassPart  composite_class;
  7633.      ShellClassPart     shell_class;
  7634.      WMShellClassPart     wm_shell_class;
  7635.      VendorShellClassPart             vendor_shell_class;
  7636. } VendorShellClassRec;
  7637.  
  7638.  
  7639. typedef struct _TransientShellClassRec {
  7640.      CoreClassPart     core_class;
  7641.      CompositeClassPart  composite_class;
  7642.      ShellClassPart     shell_class;
  7643.      WMShellClassPart     wm_shell_class;
  7644.      VendorShellClassPart             vendor_shell_class;
  7645.      TransientShellClassPart             transient_shell_class;
  7646. } TransientShellClassRec;
  7647.  
  7648.  
  7649.  
  7650.  
  7651.  
  7652.  
  7653.  
  7654.                  106
  7655.  
  7656.  
  7657.  
  7658.  
  7659.  
  7660. X Toolkit Intrinsics                 X11 Release 6.4
  7661.  
  7662.  
  7663. typedef struct _TopLevelShellClassRec {
  7664.      CoreClassPart     core_class;
  7665.      CompositeClassPart  composite_class;
  7666.      ShellClassPart     shell_class;
  7667.      WMShellClassPart     wm_shell_class;
  7668.      VendorShellClassPart             vendor_shell_class;
  7669.      TopLevelShellClassPart             top_level_shell_class;
  7670. } TopLevelShellClassRec;
  7671.  
  7672.  
  7673. typedef struct _ApplicationShellClassRec {
  7674.      CoreClassPart     core_class;
  7675.      CompositeClassPart  composite_class;
  7676.      ShellClassPart     shell_class;
  7677.      WMShellClassPart     wm_shell_class;
  7678.      VendorShellClassPart             vendor_shell_class;
  7679.      TopLevelShellClassPart             top_level_shell_class;
  7680.      ApplicationShellClassPart             application_shell_class;
  7681. } ApplicationShellClassRec;
  7682.  
  7683.  
  7684. typedef struct _SessionShellClassRec {
  7685.      CoreClassPart     core_class;
  7686.      CompositeClassPart  composite_class;
  7687.      ShellClassPart     shell_class;
  7688.      WMShellClassPart     wm_shell_class;
  7689.      VendorShellClassPart             vendor_shell_class;
  7690.      TopLevelShellClassPart             top_level_shell_class;
  7691.      ApplicationShellClassPart             application_shell_class;
  7692.      SessionShellClassPart             session_shell_class;
  7693. } SessionShellClassRec;
  7694.  
  7695. |__
  7696.  
  7697.  
  7698.  
  7699.  
  7700.  
  7701.  
  7702.  
  7703.  
  7704.  
  7705.  
  7706.  
  7707.  
  7708.  
  7709.  
  7710.  
  7711.  
  7712.  
  7713.  
  7714.  
  7715.  
  7716.  
  7717.  
  7718.  
  7719.  
  7720.                  107
  7721.  
  7722.  
  7723.  
  7724.  
  7725.  
  7726. X Toolkit Intrinsics                 X11 Release 6.4
  7727.  
  7728.  
  7729. The single occurrences of the class records and pointers for
  7730. creating instances of shells are:
  7731.  
  7732. __
  7733. |
  7734. extern ShellClassRec shellClassRec;
  7735. extern OverrideShellClassRec overrideShellClassRec;
  7736. extern WMShellClassRec wmShellClassRec;
  7737. extern VendorShellClassRec vendorShellClassRec;
  7738. extern TransientShellClassRec transientShellClassRec;
  7739. extern TopLevelShellClassRec topLevelShellClassRec;
  7740. extern ApplicationShellClassRec applicationShellClassRec;
  7741. extern SessionShellClassRec sessionShellClassRec;
  7742.  
  7743. extern WidgetClass shellWidgetClass;
  7744. extern WidgetClass overrideShellWidgetClass;
  7745. extern WidgetClass wmShellWidgetClass;
  7746. extern WidgetClass vendorShellWidgetClass;
  7747. extern WidgetClass transientShellWidgetClass;
  7748. extern WidgetClass topLevelShellWidgetClass;
  7749. extern WidgetClass applicationShellWidgetClass;
  7750. extern WidgetClass sessionShellWidgetClass;
  7751.  
  7752. |__
  7753.  
  7754. The following opaque types and opaque variables are defined
  7755. for generic operations on widgets whose class is a subclass
  7756. of Shell.
  7757.  
  7758. -----------------------------------------------------------
  7759. Types                  Variables
  7760. -----------------------------------------------------------
  7761. ShellWidget              shellWidgetClass
  7762. OverrideShellWidget          overrideShellWidgetClass
  7763. WMShellWidget              wmShellWidgetClass
  7764. VendorShellWidget          vendorShellWidgetClass
  7765. TransientShellWidget          transientShellWidgetClass
  7766. TopLevelShellWidget          topLevelShellWidgetClass
  7767. ApplicationShellWidget          applicationShellWidgetClass
  7768. SessionShellWidget          sessionShellWidgetClass
  7769. ShellWidgetClass
  7770. OverrideShellWidgetClass
  7771. WMShellWidgetClass
  7772. VendorShellWidgetClass
  7773. TransientShellWidgetClass
  7774. TopLevelShellWidgetClass
  7775. ApplicationShellWidgetClass
  7776. SessionShellWidgetClass
  7777. -----------------------------------------------------------
  7778.  
  7779.  
  7780. The declarations for all Intrinsics-defined shells except
  7781. VendorShell appear in Shell.h and ShellP.h.  VendorShell has
  7782. separate public and private .h files which are included by
  7783.  
  7784.  
  7785.  
  7786.                  108
  7787.  
  7788.  
  7789.  
  7790.  
  7791.  
  7792. X Toolkit Intrinsics                 X11 Release 6.4
  7793.  
  7794.  
  7795. Shell.h and ShellP.h.
  7796.  
  7797. Shell.h uses incomplete structure definitions to ensure that
  7798. the compiler catches attempts to access private data in any
  7799. of the Shell instance or class data structures.
  7800.  
  7801. The symbolic constant for the ShellClassExtension version
  7802. identifier is XtShellExtensionVersion (see Section 1.6.12).
  7803.  
  7804. The root_geometry_manager procedure acts as the parent geom-
  7805. etry manager for geometry requests made by shell widgets.
  7806. When a shell widget calls either XtMakeGeometryRequest or
  7807. XtMakeResizeRequest, the root_geometry_manager procedure is
  7808. invoked to negotiate the new geometry with the window man-
  7809. ager.  If the window manager permits the new geometry, the
  7810. root_geometry_manager procedure should return XtGeometryYes;
  7811. if the window manager denies the geometry request or does
  7812. not change the window geometry within some timeout interval
  7813. (equal to wm_timeout in the case of WMShells), the
  7814. root_geometry_manager procedure should return XtGeometryNo.
  7815. If the window manager makes some alternative geometry
  7816. change, the root_geometry_manager procedure may return
  7817. either XtGeometryNo and handle the new geometry as a resize
  7818. or XtGeometryAlmost in anticipation that the shell will
  7819. accept the compromise.    If the compromise is not accepted,
  7820. the new size must then be handled as a resize.    Subclasses
  7821. of Shell that wish to provide their own root_geometry_man-
  7822. ager procedures are strongly encouraged to use enveloping to
  7823. invoke their superclass's root_geometry_manager procedure
  7824. under most situations, as the window manager interaction may
  7825. be very complex.
  7826.  
  7827. If no ShellClassPart extension record is declared with
  7828. record_type equal to NULLQUARK, then XtInheritRootGeometry-
  7829. Manager is assumed.
  7830.  
  7831.  
  7832. 4.1.2.    ShellPart Definition
  7833.  
  7834. The various shell widgets have the following additional
  7835. instance fields defined in their widget records:
  7836.  
  7837.  
  7838.  
  7839.  
  7840.  
  7841.  
  7842.  
  7843.  
  7844.  
  7845.  
  7846.  
  7847.  
  7848.  
  7849.  
  7850.  
  7851.  
  7852.                  109
  7853.  
  7854.  
  7855.  
  7856.  
  7857.  
  7858. X Toolkit Intrinsics                 X11 Release 6.4
  7859.  
  7860. __
  7861. |
  7862. typedef struct {
  7863.      String         geometry;
  7864.      XtCreatePopupChildProc             create_popup_child_proc;
  7865.      XtGrabKind      grab_kind;
  7866.      Boolean         spring_loaded;
  7867.      Boolean         popped_up;
  7868.      Boolean         allow_shell_resize;
  7869.      Boolean         client_specified;
  7870.      Boolean         save_under;
  7871.      Boolean         override_redirect;
  7872.      XtCallbackList     popup_callback;
  7873.      XtCallbackList     popdown_callback;
  7874.      Visual *         visual;
  7875. } ShellPart;
  7876.  
  7877.  
  7878. typedef struct {
  7879.      int         empty;
  7880. } OverrideShellPart;
  7881.  
  7882.  
  7883. typedef struct {
  7884.      String         title;
  7885.      int         wm_timeout;
  7886.      Boolean         wait_for_wm;
  7887.      Boolean         transient;
  7888.      Boolean         urgency;
  7889.      Widget         client_leader;
  7890.      String         window_role;
  7891.      struct _OldXSizeHints {
  7892.       long         flags;
  7893.       int          x, y;
  7894.       int         width, height;
  7895.       int         min_width, min_height;
  7896.       int         max_width, max_height;
  7897.       int         width_inc, height_inc;
  7898.       struct {
  7899.            int     x;
  7900.            int     y;
  7901.       } min_aspect, max_aspect;
  7902.      } size_hints;
  7903.      XWMHints         wm_hints;
  7904.      int         base_width, base_height, win_gravity;
  7905.      Atom         title_encoding;
  7906. } WMShellPart;
  7907.  
  7908.  
  7909. typedef struct {
  7910.      int         vendor_specific;
  7911. } VendorShellPart;
  7912.  
  7913.  
  7914. typedef struct {
  7915.  
  7916.  
  7917.  
  7918.                  110
  7919.  
  7920.  
  7921.  
  7922.  
  7923.  
  7924. X Toolkit Intrinsics                 X11 Release 6.4
  7925.  
  7926.  
  7927.      Widget         transient_for;
  7928. } TransientShellPart;
  7929.  
  7930. typedef struct {
  7931.      String         icon_name;
  7932.      Boolean         iconic;
  7933.      Atom         icon_name_encoding;
  7934. } TopLevelShellPart;
  7935.  
  7936.  
  7937. typedef struct {
  7938.      char *         class;
  7939.      XrmClass         xrm_class;
  7940.      int         argc;
  7941.      char **         argv;
  7942. } ApplicationShellPart;
  7943.  
  7944.  
  7945. typedef struct {
  7946.      SmcConn         connection;
  7947.      String         session_id;
  7948.      String *         restart_command;
  7949.      String *         clone_command;
  7950.      String *         discard_command;
  7951.      String *         resign_command;
  7952.      String *         shutdown_command;
  7953.      String *         environment;
  7954.      String         current_dir;
  7955.      String         program_path;
  7956.      unsigned char     restart_style;
  7957.      Boolean         join_session;
  7958.      XtCallbackList     save_callbacks;
  7959.      XtCallbackList     interact_callbacks;
  7960.      XtCallbackList     cancel_callbacks;
  7961.      XtCallbackList     save_complete_callbacks;
  7962.      XtCallbackList     die_callbacks;
  7963.      XtCallbackList     error_callbacks;
  7964. } SessionShellPart;
  7965.  
  7966. |__
  7967.  
  7968.  
  7969.  
  7970.  
  7971.  
  7972.  
  7973.  
  7974.  
  7975.  
  7976.  
  7977.  
  7978.  
  7979.  
  7980.  
  7981.  
  7982.  
  7983.  
  7984.                  111
  7985.  
  7986.  
  7987.  
  7988.  
  7989.  
  7990. X Toolkit Intrinsics                 X11 Release 6.4
  7991.  
  7992.  
  7993. The full shell widget instance record definitions are:
  7994.  
  7995. __
  7996. |
  7997. typedef struct {
  7998.      CorePart         core;
  7999.      CompositePart     composite;
  8000.      ShellPart         shell;
  8001. } ShellRec, *ShellWidget;
  8002.  
  8003.  
  8004. typedef struct {
  8005.      CorePart         core;
  8006.      CompositePart     composite;
  8007.      ShellPart         shell;
  8008.      OverrideShellPart     override;
  8009. } OverrideShellRec, *OverrideShellWidget;
  8010.  
  8011.  
  8012. typedef struct {
  8013.      CorePart         core;
  8014.      CompositePart     composite;
  8015.      ShellPart         shell;
  8016.      WMShellPart     wm;
  8017. } WMShellRec, *WMShellWidget;
  8018.  
  8019.  
  8020. typedef struct {
  8021.      CorePart         core;
  8022.      CompositePart     composite;
  8023.      ShellPart         shell;
  8024.      WMShellPart     wm;
  8025.      VendorShellPart     vendor;
  8026. } VendorShellRec, *VendorShellWidget;
  8027.  
  8028.  
  8029. typedef struct {
  8030.      CorePart         core;
  8031.      CompositePart     composite;
  8032.      ShellPart         shell;
  8033.      WMShellPart     wm;
  8034.      VendorShellPart     vendor;
  8035.      TransientShellPart  transient;
  8036. } TransientShellRec, *TransientShellWidget;
  8037.  
  8038.  
  8039.  
  8040.  
  8041.  
  8042.  
  8043.  
  8044.  
  8045.  
  8046.  
  8047.  
  8048.  
  8049.  
  8050.                  112
  8051.  
  8052.  
  8053.  
  8054.  
  8055.  
  8056. X Toolkit Intrinsics                 X11 Release 6.4
  8057.  
  8058.  
  8059. typedef struct {
  8060.      CorePart         core;
  8061.      CompositePart     composite;
  8062.      ShellPart         shell;
  8063.      WMShellPart     wm;
  8064.      VendorShellPart     vendor;
  8065.      TopLevelShellPart     topLevel;
  8066. } TopLevelShellRec, *TopLevelShellWidget;
  8067.  
  8068.  
  8069. typedef  struct {
  8070.      CorePart         core;
  8071.      CompositePart     composite;
  8072.      ShellPart         shell;
  8073.      WMShellPart     wm;
  8074.      VendorShellPart     vendor;
  8075.      TopLevelShellPart     topLevel;
  8076.      ApplicationShellPart             application;
  8077. } ApplicationShellRec, *ApplicationShellWidget;
  8078.  
  8079.  
  8080. typedef  struct {
  8081.      CorePart         core;
  8082.      CompositePart     composite;
  8083.      ShellPart         shell;
  8084.      WMShellPart     wm;
  8085.      VendorShellPart     vendor;
  8086.      TopLevelShellPart     topLevel;
  8087.      ApplicationShellPart             application;
  8088.      SessionShellPart     session;
  8089. } SessionShellRec, *SessionShellWidget;
  8090.  
  8091. |__
  8092.  
  8093.  
  8094.  
  8095. 4.1.3.    Shell Resources
  8096.  
  8097. The resource names, classes, and representation types speci-
  8098. fied in the shellClassRec resource list are:
  8099.  
  8100.  
  8101. -------------------------------------------------------------------
  8102. Name              Class             Representation
  8103. -------------------------------------------------------------------
  8104. XtNallowShellResize      XtCAllowShellResize        XtRBoolean
  8105. XtNcreatePopupChildProc   XtCCreatePopupChildProc   XtRFunction
  8106. XtNgeometry          XtCGeometry            XtRString
  8107. XtNoverrideRedirect      XtCOverrideRedirect        XtRBoolean
  8108. XtNpopdownCallback      XtCCallback            XtRCallback
  8109. XtNpopupCallback      XtCCallback            XtRCallback
  8110. XtNsaveUnder          XtCSaveUnder            XtRBoolean
  8111.  
  8112.  
  8113.  
  8114.  
  8115.  
  8116.                  113
  8117.  
  8118.  
  8119.  
  8120.  
  8121.  
  8122. X Toolkit Intrinsics                 X11 Release 6.4
  8123.  
  8124.  
  8125. XtNvisual          XtCVisual            XtRVisual
  8126. -------------------------------------------------------------------
  8127.  
  8128.  
  8129. OverrideShell declares no additional resources beyond those
  8130. defined by Shell.
  8131.  
  8132. The resource names, classes, and representation types speci-
  8133. fied in the wmShellClassRec resource list are:
  8134.  
  8135.  
  8136. --------------------------------------------------------------------------
  8137. Name                 Class              Representation
  8138. --------------------------------------------------------------------------
  8139. XtNbaseHeight             XtCBaseHeight          XtRInt
  8140. XtNbaseWidth             XtCBaseWidth          XtRInt
  8141. XtNclientLeader          XtCClientLeader          XtRWidget
  8142. XtNheightInc             XtCHeightInc          XtRInt
  8143. XtNiconMask             XtCIconMask          XtRBitmap
  8144. XtNiconPixmap             XtCIconPixmap          XtRBitmap
  8145. XtNiconWindow             XtCIconWindow          XtRWindow
  8146. XtNiconX             XtCIconX              XtRInt
  8147. XtNiconY             XtCIconY              XtRInt
  8148. XtNinitialState          XtCInitialState          XtRInitialState
  8149. XtNinput             XtCInput              XtRBool
  8150. XtNmaxAspectX             XtCMaxAspectX          XtRInt
  8151. XtNmaxAspectY             XtCMaxAspectY          XtRInt
  8152. XtNmaxHeight             XtCMaxHeight          XtRInt
  8153. XtNmaxWidth             XtCMaxWidth          XtRInt
  8154. XtNminAspectX             XtCMinAspectX          XtRInt
  8155. XtNminAspectY             XtCMinAspectY          XtRInt
  8156. XtNminHeight             XtCMinHeight          XtRInt
  8157. XtNminWidth             XtCMinWidth          XtRInt
  8158. XtNtitle             XtCTitle              XtRString
  8159. XtNtitleEncoding         XtCTitleEncoding          XtRAtom
  8160. XtNtransient             XtCTransient          XtRBoolean
  8161. XtNwaitforwm, XtNwaitForWm   XtCWaitforwm, XtCWaitForWm   XtRBoolean
  8162. XtNwidthInc             XtCWidthInc          XtRInt
  8163. XtNwindowRole             XtCWindowRole          XtRString
  8164. XtNwinGravity             XtCWinGravity          XtRGravity
  8165. XtNwindowGroup             XtCWindowGroup          XtRWindow
  8166. XtNwmTimeout             XtCWmTimeout          XtRInt
  8167. XtNurgency             XtCUrgency           XtRBoolean
  8168. --------------------------------------------------------------------------
  8169.  
  8170.  
  8171. The class resource list for VendorShell is implementation-
  8172. defined.
  8173.  
  8174. The resource names, classes, and representation types that
  8175. are specified in the transientShellClassRec resource list
  8176. are:
  8177.  
  8178.  
  8179.  
  8180.  
  8181.  
  8182.                  114
  8183.  
  8184.  
  8185.  
  8186.  
  8187.  
  8188. X Toolkit Intrinsics                 X11 Release 6.4
  8189.  
  8190.  
  8191. -------------------------------------------------------
  8192. Name            Class        Representation
  8193. -------------------------------------------------------
  8194. XtNtransientFor     XtCTransientFor    XtRWidget
  8195. -------------------------------------------------------
  8196.  
  8197.  
  8198. The resource names, classes, and representation types that
  8199. are specified in the topLevelShellClassRec resource list
  8200. are:
  8201.  
  8202.  
  8203. -----------------------------------------------------------
  8204. Name              Class            Representation
  8205. -----------------------------------------------------------
  8206. XtNiconName          XtCIconName        XtRString
  8207. XtNiconNameEncoding   XtCIconNameEncoding   XtRAtom
  8208. XtNiconic          XtCIconic         XtRBoolean
  8209. -----------------------------------------------------------
  8210.  
  8211.  
  8212. The resource names, classes, and representation types that
  8213. are specified in the applicationShellClassRec resource list
  8214. are:
  8215.  
  8216.  
  8217. -------------------------------------------------------
  8218. Name            Class        Representation
  8219. -------------------------------------------------------
  8220. XtNargc         XtCArgc        XtRInt
  8221. XtNargv         XtCArgv        XtRStringArray
  8222. -------------------------------------------------------
  8223.  
  8224.  
  8225.  
  8226.  
  8227.  
  8228.  
  8229.  
  8230.  
  8231.  
  8232.  
  8233.  
  8234.  
  8235.  
  8236.  
  8237.  
  8238.  
  8239.  
  8240.  
  8241.  
  8242.  
  8243.  
  8244.  
  8245.  
  8246.  
  8247.  
  8248.                  115
  8249.  
  8250.  
  8251.  
  8252.  
  8253.  
  8254. X Toolkit Intrinsics                 X11 Release 6.4
  8255.  
  8256.  
  8257. The resource names, classes, and representation types that
  8258. are specified in the sessionShellClassRec resource list are:
  8259.  
  8260.  
  8261. --------------------------------------------------------------------
  8262. Name              Class         Representation
  8263. --------------------------------------------------------------------
  8264. XtNcancelCallback      XtCCallback        XtRCallback
  8265. XtNcloneCommand       XtCCloneCommand    XtRCommandArgArray
  8266. XtNconnection          XtCConnection     XtRSmcConn
  8267. XtNcurrentDirectory      XtCCurrentDirectory    XtRDirectoryString
  8268. XtNdieCallback          XtCCallback        XtRCallback
  8269. XtNdiscardCommand      XtCDiscardCommand    XtRCommandArgArray
  8270. XtNenvironment          XtCEnvironment    XtREnvironmentArray
  8271. XtNerrorCallback      XtCCallback        XtRCallback
  8272. XtNinteractCallback      XtCCallback        XtRCallback
  8273. XtNjoinSession          XtCJoinSession    XtRBoolean
  8274. XtNprogramPath          XtCProgramPath    XtRString
  8275. XtNresignCommand      XtCResignCommand    XtRCommandArgArray
  8276. XtNrestartCommand      XtCRestartCommand    XtRCommandArgArray
  8277. XtNrestartStyle       XtCRestartStyle    XtRRestartStyle
  8278. XtNsaveCallback       XtCCallback        XtRCallback
  8279. XtNsaveCompleteCallback   XtCCallback        XtRCallback
  8280. XtNsessionID          XtCSessionID        XtRString
  8281. XtNshutdownCommand      XtCShutdownCommand    XtRCommandArgArray
  8282. --------------------------------------------------------------------
  8283.  
  8284.  
  8285. 4.1.4.    ShellPart Default Values
  8286.  
  8287. The default values for fields common to all classes of pub-
  8288. lic shells (filled in by the Shell resource lists and the
  8289. Shell initialize procedures) are:
  8290.  
  8291. ---------------------------------------------------------
  8292. Field              Default Value
  8293. ---------------------------------------------------------
  8294. geometry          NULL
  8295. create_popup_child_proc   NULL
  8296. grab_kind          (none)
  8297. spring_loaded          (none)
  8298. popped_up          False
  8299. allow_shell_resize      False
  8300. client_specified      (internal)
  8301. save_under          True for OverrideShell and
  8302.               TransientShell, False other-
  8303.               wise
  8304. override_redirect      True for OverrideShell, False
  8305.               otherwise
  8306. popup_callback          NULL
  8307. popdown_callback      NULL
  8308. visual              CopyFromParent
  8309. ---------------------------------------------------------
  8310.  
  8311.  
  8312.  
  8313.  
  8314.                  116
  8315.  
  8316.  
  8317.  
  8318.  
  8319.  
  8320. X Toolkit Intrinsics                 X11 Release 6.4
  8321.  
  8322.  
  8323. The geometry field specifies the size and position and is
  8324. usually given only on a command line or in a defaults file.
  8325. If the geometry field is non-NULL when a widget of class
  8326. WMShell is realized, the geometry specification is parsed
  8327. using XWMGeometry with a default geometry string constructed
  8328. from the values of x, y, width, height, width_inc, and
  8329. height_inc and the size and position flags in the window
  8330. manager size hints are set.  If the geometry specifies an x
  8331. or y position, then USPosition is set.    If the geometry
  8332. specifies a width or height, then USSize is set.  Any fields
  8333. in the geometry specification override the corresponding
  8334. values in the Core x, y, width, and height fields.  If geom-
  8335. etry is NULL or contains only a partial specification, then
  8336. the Core x, y, width, and height fields are used and PPosi-
  8337. tion and PSize are set as appropriate.    The geometry string
  8338. is not copied by any of the Intrinsics Shell classes; a
  8339. client specifying the string in an arglist or varargs list
  8340. must ensure that the value remains valid until the shell
  8341. widget is realized.  For further information on the geometry
  8342. string, see Section 16.4 in Xlib -- C Language X Interface.
  8343.  
  8344. The create_popup_child_proc procedure is called by the
  8345. XtPopup procedure and may remain NULL.    The grab_kind,
  8346. spring_loaded, and popped_up fields maintain widget state
  8347. information as described under XtPopup, XtMenuPopup,
  8348. XtPopdown, and XtMenuPopdown.  The allow_shell_resize field
  8349. controls whether the widget contained by the shell is
  8350. allowed to try to resize itself.  If allow_shell_resize is
  8351. False, any geometry requests made by the child will always
  8352. return XtGeometryNo without interacting with the window man-
  8353. ager.  Setting save_under True instructs the server to
  8354. attempt to save the contents of windows obscured by the
  8355. shell when it is mapped and to restore those contents auto-
  8356. matically when the shell is unmapped.  It is useful for pop-
  8357. up menus.  Setting override_redirect True determines whether
  8358. the window manager can intercede when the shell window is
  8359. mapped.  For further information on override_redirect, see
  8360. Section 3.2 in Xlib -- C Language X Interface and Sections
  8361. 4.1.10 and 4.2.2 in the Inter-Client Communication Conven-
  8362. tions Manual.  The pop-up and pop-down callbacks are called
  8363. during XtPopup and XtPopdown.  The default value of the
  8364. visual resource is the symbolic value CopyFromParent.  The
  8365. Intrinsics do not need to query the parent's visual type
  8366. when the default value is used; if a client using XtGetVal-
  8367. ues to examine the visual type receives the value
  8368. CopyFromParent, it must then use XGetWindowAttributes if it
  8369. needs the actual visual type.
  8370.  
  8371.  
  8372. The default values for Shell fields in WMShell and its sub-
  8373. classes are:
  8374.  
  8375.  
  8376.  
  8377.  
  8378.  
  8379.  
  8380.                  117
  8381.  
  8382.  
  8383.  
  8384.  
  8385.  
  8386. X Toolkit Intrinsics                 X11 Release 6.4
  8387.  
  8388.  
  8389. ----------------------------------------------------------
  8390. Field         Default Value
  8391. ----------------------------------------------------------
  8392. title         Icon name, if specified, otherwise the
  8393.          application's name
  8394. wm_timeout     Five seconds, in units of milliseconds
  8395. wait_for_wm     True
  8396. transient     True for TransientShell, False otherwise
  8397. urgency      False
  8398. client_leader     NULL
  8399. window_role     NULL
  8400. min_width     XtUnspecifiedShellInt
  8401. min_height     XtUnspecifiedShellInt
  8402. max_width     XtUnspecifiedShellInt
  8403. max_height     XtUnspecifiedShellInt
  8404. width_inc     XtUnspecifiedShellInt
  8405. height_inc     XtUnspecifiedShellInt
  8406. min_aspect_x     XtUnspecifiedShellInt
  8407. min_aspect_y     XtUnspecifiedShellInt
  8408. max_aspect_x     XtUnspecifiedShellInt
  8409. max_aspect_y     XtUnspecifiedShellInt
  8410. input         False
  8411. initial_state     Normal
  8412. icon_pixmap     None
  8413. icon_window     None
  8414. icon_x         XtUnspecifiedShellInt
  8415. icon_y         XtUnspecifiedShellInt
  8416. icon_mask     None
  8417. window_group     XtUnspecifiedWindow
  8418. base_width     XtUnspecifiedShellInt
  8419. base_height     XtUnspecifiedShellInt
  8420. win_gravity     XtUnspecifiedShellInt
  8421. title_encoding     See text
  8422. ----------------------------------------------------------
  8423.  
  8424.  
  8425. The title and title_encoding fields are stored in the
  8426. WM_NAME property on the shell's window by the WMShell real-
  8427. ize procedure.    If the title_encoding field is None, the
  8428. title string is assumed to be in the encoding of the current
  8429. locale and the encoding of the WM_NAME property is set to
  8430. XStdICCTextStyle.  If a language procedure has not been set
  8431. the default value of title_encoding is XA_STRING, otherwise
  8432. the default value is None.  The wm_timeout field specifies,
  8433. in milliseconds, the amount of time a shell is to wait for
  8434. confirmation of a geometry request to the window manager.
  8435. If none comes back within that time, the shell assumes the
  8436. window manager is not functioning properly and sets
  8437. wait_for_wm to False (later events may reset this value).
  8438. When wait_for_wm is False, the shell does not wait for a
  8439. response, but relies on asynchronous notification.  If tran-
  8440. sient is True, the WM_TRANSIENT_FOR property will be stored
  8441. on the shell window with a value as specified below.  The
  8442. interpretation of this property is specific to the window
  8443.  
  8444.  
  8445.  
  8446.                  118
  8447.  
  8448.  
  8449.  
  8450.  
  8451.  
  8452. X Toolkit Intrinsics                 X11 Release 6.4
  8453.  
  8454.  
  8455. manager under which the application is run; see the Inter-
  8456. Client Communication Conventions Manual for more details.
  8457.  
  8458. The realize and set_values procedures of WMShell store the
  8459. WM_CLIENT_LEADER property on the shell window.    When
  8460. client_leader is not NULL and the client leader widget is
  8461. realized, the property will be created with the value of the
  8462. window of the client leader widget.  When client_leader is
  8463. NULL and the shell widget has a NULL parent, the widget's
  8464. window is used as the value of the property.  When
  8465. client_leader is NULL and the shell widget has a non-NULL
  8466. parent, a search is made for the closest shell ancestor with
  8467. a non-NULL client_leader, and if none is found the shell
  8468. ancestor with a NULL parent is the result.  If the resulting
  8469. widget is realized, the property is created with the value
  8470. of the widget's window.
  8471.  
  8472. When the value of window_role is not NULL, the realize and
  8473. set_values procedures store the WM_WINDOW_ROLE property on
  8474. the shell's window with the value of the resource.
  8475.  
  8476. All other resources specify fields in the window manager
  8477. hints and the window manager size hints.  The realize and
  8478. set_values procedures of WMShell set the corresponding flag
  8479. bits in the hints if any of the fields contain nondefault
  8480. values.  In addition, if a flag bit is set that refers to a
  8481. field with the value XtUnspecifiedShellInt, the value of the
  8482. field is modified as follows:
  8483.  
  8484.  
  8485. ------------------------------------------------------------
  8486. Field                 Replacement
  8487. ------------------------------------------------------------
  8488. base_width, base_height      0
  8489. width_inc, height_inc         1
  8490. max_width, max_height         32767
  8491. min_width, min_height         1
  8492. min_aspect_x, min_aspect_y   -1
  8493. max_aspect_x, max_aspect_y   -1
  8494. icon_x, icon_y             -1
  8495. win_gravity             Value returned by XWMGeometry
  8496.                  if called, else NorthWestGrav-
  8497.                  ity
  8498. ------------------------------------------------------------
  8499.  
  8500.  
  8501.  
  8502. If the shell widget has a non-NULL parent, then the realize
  8503. and set_values procedures replace the value XtUnspecified-
  8504. Window in the window_group field with the window id of the
  8505. root widget of the widget tree if the root widget is real-
  8506. ized. The symbolic constant XtUnspecifiedWindowGroup may be
  8507. used to indicate that the window_group hint flag bit is not
  8508. to be set.  If transient is True, the shell's class is not a
  8509.  
  8510.  
  8511.  
  8512.                  119
  8513.  
  8514.  
  8515.  
  8516.  
  8517.  
  8518. X Toolkit Intrinsics                 X11 Release 6.4
  8519.  
  8520.  
  8521. subclass of TransientShell, and window_group is not
  8522. XtUnspecifiedWindowGroup, the WMShell realize and set_values
  8523. procedures then store the WM_TRANSIENT_FOR property with the
  8524. value of window_group.
  8525.  
  8526. Transient shells have the following additional resource:
  8527.  
  8528. ------------------------------
  8529. Field        Default Value
  8530. ------------------------------
  8531. transient_for    NULL
  8532. ------------------------------
  8533.  
  8534.  
  8535. The realize and set_values procedures of TransientShell
  8536. store the WM_TRANSIENT_FOR property on the shell window if
  8537. transient is True.  If transient_for is non-NULL and the
  8538. widget specified by transient_for is realized, then its win-
  8539. dow is used as the value of the WM_TRANSIENT_FOR property;
  8540. otherwise, the value of window_group is used.
  8541.  
  8542. TopLevel shells have the the following additional resources:
  8543.  
  8544. -----------------------------------------
  8545. Field             Default Value
  8546. -----------------------------------------
  8547. icon_name         Shell widget's name
  8548. iconic             False
  8549. icon_name_encoding   See text
  8550. -----------------------------------------
  8551.  
  8552.  
  8553. The icon_name and icon_name_encoding fields are stored in
  8554. the WM_ICON_NAME property on the shell's window by the
  8555. TopLevelShell realize procedure.  If the icon_name_encoding
  8556. field is None, the icon_name string is assumed to be in the
  8557. encoding of the current locale and the encoding of the
  8558. WM_ICON_NAME property is set to XStdICCTextStyle.  If a lan-
  8559. guage procedure has not been set, the default value of
  8560. icon_name_encoding is XA_STRING, otherwise the default value
  8561. is None.  The iconic field may be used by a client to
  8562. request that the window manager iconify or deiconify the
  8563. shell; the TopLevelShell set_values procedure will send the
  8564. appropriate WM_CHANGE_STATE message (as specified by the
  8565. Inter-Client Communication Conventions Manual) if this
  8566. resource is changed from False to True and will call XtPopup
  8567. specifying grab_kind as XtGrabNone if iconic is changed from
  8568. True to False.    The XtNiconic resource is also an alterna-
  8569. tive way to set the XtNinitialState resource to indicate
  8570. that a shell should be initially displayed as an icon; the
  8571. TopLevelShell initialize procedure will set initial_state to
  8572. IconicState if iconic is True.
  8573.  
  8574.  
  8575.  
  8576.  
  8577.  
  8578.                  120
  8579.  
  8580.  
  8581.  
  8582.  
  8583.  
  8584. X Toolkit Intrinsics                 X11 Release 6.4
  8585.  
  8586.  
  8587. Application shells have the following additional resources:
  8588.  
  8589. ----------------------
  8590. Field    Default Value
  8591. ----------------------
  8592. argc    0
  8593. argv    NULL
  8594. ----------------------
  8595.  
  8596.  
  8597. The argc and argv fields are used to initialize the standard
  8598. property WM_COMMAND.  See the Inter-Client Communication
  8599. Conventions Manual for more information.
  8600.  
  8601. The default values for the SessionShell instance fields,
  8602. which are filled in from the resource lists and by the ini-
  8603. tialize procedure, are
  8604.  
  8605. ---------------------------------------------
  8606. Field              Default Value
  8607. ---------------------------------------------
  8608. cancel_callbacks      NULL
  8609. clone_command          See text
  8610. connection          NULL
  8611. current_dir          NULL
  8612. die_callbacks          NULL
  8613. discard_command       NULL
  8614. environment          NULL
  8615. error_callbacks       NULL
  8616. interact_callbacks      NULL
  8617. join_session          True
  8618. program_path          See text
  8619. resign_command          NULL
  8620. restart_command       See text
  8621. restart_style          SmRestartIfRunning
  8622. save_callbacks          NULL
  8623. save_complete_callbacks   NULL
  8624. session_id          NULL
  8625. shutdown_command      NULL
  8626. ---------------------------------------------
  8627.  
  8628.  
  8629. The connection field contains the session connection object
  8630. or NULL if a session connection is not being managed by this
  8631. widget.
  8632.  
  8633. The session_id is an identification assigned to the session
  8634. participant by the session manager.  The session_id will be
  8635. passed to the session manager as the client identifier of
  8636. the previous session.  When a connection is established with
  8637. the session manager, the client id assigned by the session
  8638. manager is stored in the session_id field.  When not NULL,
  8639. the session_id of the Session shell widget that is at the
  8640. root of the widget tree of the client leader widget will be
  8641.  
  8642.  
  8643.  
  8644.                  121
  8645.  
  8646.  
  8647.  
  8648.  
  8649.  
  8650. X Toolkit Intrinsics                 X11 Release 6.4
  8651.  
  8652.  
  8653. used to create the SM_CLIENT_ID property on the client
  8654. leader's window.
  8655.  
  8656. If join_session is False, the widget will not attempt to
  8657. establish a connection to the session manager at shell cre-
  8658. ation time.  See Sections 4.2.1 and 4.2.4 for more informa-
  8659. tion on the functionality of this resource.
  8660.  
  8661. The restart_command, clone_command, discard_command,
  8662. resign_command, shutdown_command, environment, current_dir,
  8663. program_path, and restart_style fields contain standard ses-
  8664. sion properties.
  8665.  
  8666. When a session connection is established or newly managed by
  8667. the shell, the shell initialize and set_values methods check
  8668. the values of the restart_command, clone_command, and pro-
  8669. gram_path resources.  At that time, if restart_command is
  8670. NULL, the value of the argv resource will be copied to
  8671. restart_command.  Whether or not restart_command was NULL,
  8672. if "-xtsessionID" "<session id>" does not already appear in
  8673. the restart_command, it will be added by the initialize and
  8674. set_values methods at the beginning of the command argu-
  8675. ments; if the "-xtsessionID" argument already appears with
  8676. an incorrect session id in the following argument, that
  8677. argument will be replaced with the current session id.
  8678.  
  8679. After this, the shell initialize and set_values procedures
  8680. check the clone_command.  If clone_command is NULL,
  8681. restart_command will be copied to clone_command, except the
  8682. "-xtsessionID" and following argument will not be copied.
  8683.  
  8684. Finally, the shell initialize and set_values procedures
  8685. check the program_path.  If program_path is NULL, the first
  8686. element of restart_command is copied to program_path.
  8687.  
  8688. The possible values of restart_style are SmRestartIfRunning,
  8689. SmRestartAnyway, SmRestartImmediately, and SmRestartNever.
  8690. A resource converter is registered for this resource; for
  8691. the strings that it recognizes, see Section 9.6.1.
  8692.  
  8693. The resource type EnvironmentArray is a NULL-terminated
  8694. array of pointers to strings; each string has the format
  8695. "name=value".  The `=' character may not appear in the name,
  8696. and the string is terminated by a null character.
  8697.  
  8698.  
  8699. 4.2.  Session Participation
  8700.  
  8701. Applications can participate in a user's session, exchanging
  8702. messages with the session manager as described in the X Ses-
  8703. sion Management Protocol and the X Session Management
  8704. Library.
  8705.  
  8706.  
  8707.  
  8708.  
  8709.  
  8710.                  122
  8711.  
  8712.  
  8713.  
  8714.  
  8715.  
  8716. X Toolkit Intrinsics                 X11 Release 6.4
  8717.  
  8718.  
  8719. When a widget of sessionShellWidgetClass or a subclass is
  8720. created, the widget provides support for the application as
  8721. a session participant and continues to provide support until
  8722. the widget is destroyed.
  8723.  
  8724.  
  8725. 4.2.1.    Joining a Session
  8726.  
  8727. When a Session shell is created, if connection is NULL, and
  8728. if join_session is True, and if argv or restart_command is
  8729. not NULL, and if in POSIX environments the SESSION_MANAGER
  8730. environment variable is defined, the shell will attempt to
  8731. establish a new connection with the session manager.
  8732.  
  8733. To transfer management of an existing session connection
  8734. from an application to the shell at widget creation time,
  8735. pass the existing session connection ID as the connection
  8736. resource value when creating the Session shell, and if the
  8737. other creation-time conditions on session participation are
  8738. met, the widget will maintain the connection with the ses-
  8739. sion manager.  The application must ensure that only one
  8740. Session shell manages the connection.
  8741.  
  8742. In the Session shell set_values procedure, if join_session
  8743. changes from False to True and connection is NULL and when
  8744. in POSIX environments the SESSION_MANAGER environment vari-
  8745. able is defined, the shell will attempt to open a connection
  8746. to the session manager.  If connection changes from NULL to
  8747. non-NULL, the Session shell will take over management of
  8748. that session connection and will set join_session to True.
  8749. If join_session changes from False to True and connection is
  8750. not NULL, the Session shell will take over management of the
  8751. session connection.
  8752.  
  8753. When a successful connection has been established, connec-
  8754. tion contains the session connection ID for the session par-
  8755. ticipant.  When the shell begins to manage the connection,
  8756. it will call XtAppAddInput to register the handler which
  8757. watches for protocol messages from the session manager.
  8758. When the attempt to connect fails, a warning message is
  8759. issued and connection is set to NULL.
  8760.  
  8761. While the connection is being managed, if a SaveYourself,
  8762. SaveYourselfPhase2, Interact, ShutdownCancelled,
  8763. SaveComplete, or Die message is received from the session
  8764. manager, the Session shell will call out to application
  8765. callback procedures registered on the respective callback
  8766. list of the Session shell and will send
  8767. SaveYourselfPhase2Request, InteractRequest, InteractDone,
  8768. SaveYourselfDone, and ConnectionClosed messages as appropri-
  8769. ate.  Initially, all of the client's session properties are
  8770. undefined.  When any of the session property resource values
  8771. are defined or change, the Session shell initialize and
  8772. set_values procedures will update the client's session
  8773.  
  8774.  
  8775.  
  8776.                  123
  8777.  
  8778.  
  8779.  
  8780.  
  8781.  
  8782. X Toolkit Intrinsics                 X11 Release 6.4
  8783.  
  8784.  
  8785. property value by a SetProperties or a DeleteProperties mes-
  8786. sage, as appropriate.  The session ProcessID and UserID
  8787. properties are always set by the shell when it is possible
  8788. to determine the value of these properties.
  8789.  
  8790.  
  8791. 4.2.2.    Saving Application State
  8792.  
  8793. The session manager instigates an application checkpoint by
  8794. sending a SaveYourself request.  Applications are responsi-
  8795. ble for saving their state in response to the request.
  8796.  
  8797. When the SaveYourself request arrives, the procedures regis-
  8798. tered on the Session shell's save callback list are called.
  8799. If the application does not register any save callback pro-
  8800. cedures on the save callback list, the shell will report to
  8801. the session manager that the application failed to save its
  8802. state.    Each procedure on the save callback list receives a
  8803. token in the call_data parameter.
  8804.  
  8805.  
  8806. The checkpoint token in the call_data parameter is of type
  8807. XtCheckpointToken.
  8808.  
  8809. __
  8810. |
  8811. typedef struct {
  8812.      int        save_type;
  8813.      int        interact_style;
  8814.      Boolean        shutdown;
  8815.      Boolean        fast;
  8816.      Boolean        cancel_shutdown
  8817.      int        phase;
  8818.      int        interact_dialog_type;/* return */
  8819.      Boolean        request_cancel;    /* return */
  8820.      Boolean        request_next_phase; /* return */
  8821.      Boolean        save_success;    /* return */
  8822. } XtCheckpointTokenRec, *XtCheckpointToken;
  8823.  
  8824. |__
  8825.  
  8826. The save_type, interact_style, shutdown, and fast fields of
  8827. the token contain the parameters of the SaveYourself mes-
  8828. sage.  The possible values of save_type are SmSaveLocal,
  8829. SmSaveGlobal, and SmSaveBoth; these indicate the type of
  8830. information to be saved.  The possible values of inter-
  8831. act_style are SmInteractStyleNone, SmInteractStyleErrors,
  8832. and SmInteractStyleAny; these indicate whether user interac-
  8833. tion would be permitted and, if so, what kind of interac-
  8834. tion.  If shutdown is True, the checkpoint is being per-
  8835. formed in preparation for the end of the session.  If fast
  8836. is True, the client should perform the checkpoint as quickly
  8837. as possible.  If cancel_shutdown is True, a ShutdownCan-
  8838. celled message has been received for the current save
  8839.  
  8840.  
  8841.  
  8842.                  124
  8843.  
  8844.  
  8845.  
  8846.  
  8847.  
  8848. X Toolkit Intrinsics                 X11 Release 6.4
  8849.  
  8850.  
  8851. operation.  (See Section 4.4.4.)  The phase is used by man-
  8852. ager clients, such as a window manager, to distinguish
  8853. between the first and second phase of a save operation.  The
  8854. phase will be either 1 or 2.  The remaining fields in the
  8855. checkpoint token structure are provided for the application
  8856. to communicate with the shell.
  8857.  
  8858. Upon entry to the first application save callback procedure,
  8859. the return fields in the token have the following initial
  8860. values: interact_dialog_type is SmDialogNormal; request_can-
  8861. cel is False; request_next_phase is False; and save_success
  8862. is True.  When a token is returned with any of the four
  8863. return fields containing a noninitial value, and when the
  8864. field is applicable, subsequent tokens passed to the appli-
  8865. cation during the current save operation will always contain
  8866. the noninitial value.
  8867.  
  8868. The purpose of the token's save_success field is to indicate
  8869. the outcome of the entire operation to the session manager
  8870. and ultimately, to the user.  Returning False indicates some
  8871. portion of the application state could not be successfully
  8872. saved.    If any token is returned to the shell with save_suc-
  8873. cess False, tokens subsequently received by the application
  8874. for the current save operation will show save_success as
  8875. False.    When the shell sends the final status of the check-
  8876. point to the session manager, it will indicate failure to
  8877. save application state if any token was returned with
  8878. save_success False.
  8879.  
  8880. Session participants that manage and save the state of other
  8881. clients should structure their save or interact callbacks to
  8882. set request_next_phase to True when phase is 1, which will
  8883. cause the shell to send the SaveYourselfPhase2Request when
  8884. the first phase is complete.  When the SaveYourselfPhase2
  8885. message is received, the shell will invoke the save call-
  8886. backs a second time with phase equal to 2.  Manager clients
  8887. should save the state of other clients when the callbacks
  8888. are invoked the second time and phase equal to 2.
  8889.  
  8890. The application may request additional tokens while a check-
  8891. point is under way, and these additional tokens must be
  8892. returned by an explicit call.
  8893.  
  8894.  
  8895.  
  8896.  
  8897.  
  8898.  
  8899.  
  8900.  
  8901.  
  8902.  
  8903.  
  8904.  
  8905.  
  8906.  
  8907.  
  8908.                  125
  8909.  
  8910.  
  8911.  
  8912.  
  8913.  
  8914. X Toolkit Intrinsics                 X11 Release 6.4
  8915.  
  8916.  
  8917. To request an additional token for a save callback response
  8918. that has a deferred outcome, use XtSessionGetToken.
  8919.  
  8920. __
  8921. |
  8922. XtCheckpointToken XtSessionGetToken(widget)
  8923.       Widget widget;
  8924.  
  8925.  
  8926. widget      Specifies the Session shell widget which manages
  8927.       session participation.
  8928. |__
  8929.  
  8930. The XtSessionGetToken function will return NULL if no check-
  8931. point operation is currently under way.
  8932.  
  8933.  
  8934. To indicate the completion of checkpoint processing includ-
  8935. ing user interaction, the application must signal the Ses-
  8936. sion shell by returning all tokens.  (See Sections 4.2.2.2
  8937. and 4.2.2.4).  To return a token, use XtSessionReturnToken.
  8938.  
  8939. __
  8940. |
  8941. void XtSessionReturnToken(token)
  8942.       XtCheckpointToken token;
  8943.  
  8944.  
  8945. token      Specifies a token that was received as the
  8946.       call_data by a procedure on the interact callback
  8947.       list or a token that was received by a call to
  8948.       XtSessionGetToken.
  8949. |__
  8950.  
  8951.  
  8952. Tokens passed as call_data to save callbacks are implicitly
  8953. returned when the save callback procedure returns.  A save
  8954. callback procedure should not call XtSessionReturnToken on
  8955. the token passed in its call_data.
  8956.  
  8957.  
  8958. 4.2.2.1.  Requesting Interaction
  8959.  
  8960. When the token interact_style allows user interaction, the
  8961. application may interact with the user during the check-
  8962. point, but must wait for permission to interact.  Applica-
  8963. tions request permission to interact with the user during
  8964. the checkpointing operation by registering a procedure on
  8965. the Session shell's interact callback list.  When all save
  8966. callback procedures have returned, and each time a token
  8967. that was granted by a call to XtSessionGetToken is returned,
  8968. the Session shell examines the interact callback list.    If
  8969. interaction is permitted and the interact callback list is
  8970. not empty, the shell will send an InteractRequest to the
  8971.  
  8972.  
  8973.  
  8974.                  126
  8975.  
  8976.  
  8977.  
  8978.  
  8979.  
  8980. X Toolkit Intrinsics                 X11 Release 6.4
  8981.  
  8982.  
  8983. session manager when an interact request is not already out-
  8984. standing for the application.
  8985.  
  8986. The type of interaction dialog that will be requested is
  8987. specified by the interact_dialog_type field in the check-
  8988. point token.  The possible values for interact_dialog_type
  8989. are SmDialogError and SmDialogNormal.  If a token is
  8990. returned with interact_dialog_type containing SmDialogError,
  8991. the interact request and any subsequent interact requests
  8992. will be for an error dialog; otherwise, the request will be
  8993. for a normal dialog with the user.
  8994.  
  8995. When a token is returned with save_success False or inter-
  8996. act_dialog_type SmDialogError, tokens subsequently passed to
  8997. callbacks during the same active SaveYourself response will
  8998. reflect these changed values, indicating that an error con-
  8999. dition has occurred during the checkpoint.
  9000.  
  9001. The request_cancel field is a return value for interact
  9002. callbacks only.  Upon return from a procedure on the save
  9003. callback list, the value of the token's request_cancel field
  9004. is not examined by the shell.  This is also true of tokens
  9005. received through a call to XtSessionGetToken.
  9006.  
  9007.  
  9008. 4.2.2.2.  Interacting with the User during a Checkpoint
  9009.  
  9010. When the session manager grants the application's request
  9011. for user interaction, the Session shell receives an Interact
  9012. message.  The procedures registered on the interact callback
  9013. list are executed, but not as if executing a typical call-
  9014. back list.  These procedures are individually executed in
  9015. sequence, with a checkpoint token functioning as the
  9016. sequencing mechanism.  Each step in the sequence begins by
  9017. removing a procedure from the interact callback list and
  9018. executing it with a token passed in the call_data.  The
  9019. interact callback will typically pop up a dialog box and
  9020. return.  When the user interaction and associated applica-
  9021. tion checkpointing has completed, the application must
  9022. return the token by calling XtSessionReturnToken.  Returning
  9023. the token completes the current step and triggers the next
  9024. step in the sequence.
  9025.  
  9026. During interaction the client may request cancellation of a
  9027. shutdown.  When a token passed as call_data to an interact
  9028. procedure is returned, if shutdown is True and cancel_shut-
  9029. down is False, request_cancel indicates whether the applica-
  9030. tion requests that the pending shutdown be cancelled.  If
  9031. request_cancel is True, the field will also be True in any
  9032. tokens subsequently granted during the checkpoint operation.
  9033. When a token is returned requesting cancellation of the ses-
  9034. sion shutdown, pending interact procedures will still be
  9035. called by the Session shell.  When all interact procedures
  9036. have been removed from the interact callback list, executed,
  9037.  
  9038.  
  9039.  
  9040.                  127
  9041.  
  9042.  
  9043.  
  9044.  
  9045.  
  9046. X Toolkit Intrinsics                 X11 Release 6.4
  9047.  
  9048.  
  9049. and the final interact token returned to the shell, an
  9050. InteractDone message is sent to the session manager, indi-
  9051. cating whether a pending session shutdown is requested to be
  9052. cancelled.
  9053.  
  9054.  
  9055. 4.2.2.3.  Responding to a Shutdown Cancellation
  9056.  
  9057. Callbacks registered on the cancel callback list are invoked
  9058. when the Session shell processes a ShutdownCancelled message
  9059. from the session manager.  This may occur during the pro-
  9060. cessing of save callbacks, while waiting for interact per-
  9061. mission, during user interaction, or after the save opera-
  9062. tion is complete and the application is expecting a SaveCom-
  9063. plete or a Die message.  The call_data for these callbacks
  9064. is NULL.
  9065.  
  9066. When the shell notices that a pending shutdown has been can-
  9067. celled, the token cancel_shutdown field will be True in
  9068. tokens subsequently given to the application.
  9069.  
  9070. Receiving notice of a shutdown cancellation does not cancel
  9071. the pending execution of save callbacks or interact call-
  9072. backs.    After the cancel callbacks execute, if inter-
  9073. act_style is not SmInteractStyleNone and the interact list
  9074. is not empty, the procedures on the interact callback list
  9075. will be executed and passed a token with interact_style
  9076. SmInteractStyleNone.  The application should not interact
  9077. with the user, and the Session shell will not send an Inter-
  9078. actDone message.
  9079.  
  9080.  
  9081. 4.2.2.4.  Completing a Save
  9082.  
  9083. When there is no user interaction, the shell regards the
  9084. application as having finished saving state when all call-
  9085. back procedures on the save callback list have returned, and
  9086. any additional tokens passed out by XtSessionGetToken have
  9087. been returned by corresponding calls to
  9088. XtSessionReturnToken.  If the save operation involved user
  9089. interaction, the above completion conditions apply, and in
  9090. addition, all requests for interaction have been granted or
  9091. cancelled, and all tokens passed to interact callbacks have
  9092. been returned through calls to XtSessionReturnToken.  If the
  9093. save operation involved a manager client that requested the
  9094. second phase, the above conditions apply to both the first
  9095. and second phase of the save operation.
  9096.  
  9097. When the application has finished saving state, the Session
  9098. shell will report the result to the session manager by send-
  9099. ing the SaveYourselfDone message.  If the session is contin-
  9100. uing, the shell will receive the SaveComplete message when
  9101. all applications have completed saving state.  This message
  9102. indicates that applications may again allow changes to their
  9103.  
  9104.  
  9105.  
  9106.                  128
  9107.  
  9108.  
  9109.  
  9110.  
  9111.  
  9112. X Toolkit Intrinsics                 X11 Release 6.4
  9113.  
  9114.  
  9115. state.    The shell will execute the save_complete callbacks.
  9116. The call_data for these callbacks is NULL.
  9117.  
  9118.  
  9119. 4.2.3.    Responding to a Shutdown
  9120.  
  9121. Callbacks registered on the die callback list are invoked
  9122. when the session manager sends a Die message.  The callbacks
  9123. on this list should do whatever is appropriate to quit the
  9124. application.  Before executing procedures on the die call-
  9125. back list, the Session shell will close the connection to
  9126. the session manager and will remove the handler that watches
  9127. for protocol messages.    The call_data for these callbacks is
  9128. NULL.
  9129.  
  9130.  
  9131. 4.2.4.    Resigning from a Session
  9132.  
  9133. When the Session shell widget is destroyed, the destroy
  9134. method will close the connection to the session manager by
  9135. sending a ConnectionClosed protocol message and will remove
  9136. the input callback that was watching for session protocol
  9137. messages.
  9138.  
  9139. When XtSetValues is used to set join_session to False, the
  9140. set_values method of the Session shell will close the con-
  9141. nection to the session manager if one exists by sending a
  9142. ConnectionClosed message, and connection will be set to
  9143. NULL.
  9144.  
  9145. Applications that exit in response to user actions and that
  9146. do not wait for phase 2 destroy to complete on the Session
  9147. shell should set join_session to False before exiting.
  9148.  
  9149. When XtSetValues is used to set connection to NULL, the Ses-
  9150. sion shell will stop managing the connection, if one exists.
  9151. However, that session connection will not be closed.
  9152.  
  9153. Applications that wish to ensure continuation of a session
  9154. connection beyond the destruction of the shell should first
  9155. retrieve the connection resource value, then set the connec-
  9156. tion resource to NULL, and then they may safely destroy the
  9157. widget without losing control of the session connection.
  9158.  
  9159. The error callback list will be called if an unrecoverable
  9160. communications error occurs while the shell is managing the
  9161. connection.  The shell will close the connection, set con-
  9162. nection to NULL, remove the input callback, and call the
  9163. procedures registered on the error callback list.  The
  9164. call_data for these callbacks is NULL.
  9165.  
  9166.  
  9167.  
  9168.  
  9169.  
  9170.  
  9171.  
  9172.                  129
  9173.  
  9174.  
  9175.  
  9176.  
  9177.  
  9178. X Toolkit Intrinsics                 X11 Release 6.4
  9179.  
  9180.  
  9181.  
  9182.  
  9183.              Chapter 5
  9184.  
  9185.                Pop-Up Widgets
  9186.  
  9187.  
  9188.  
  9189. Pop-up widgets are used to create windows outside of the
  9190. window hierarchy defined by the widget tree.  Each pop-up
  9191. child has a window that is a descendant of the root window,
  9192. so that the pop-up window is not clipped by the pop-up wid-
  9193. get's parent window.  Therefore, pop-ups are created and
  9194. attached differently to their widget parent than normal wid-
  9195. get children.
  9196.  
  9197. A parent of a pop-up widget does not actively manage its
  9198. pop-up children; in fact, it usually does not operate upon
  9199. them in any way.  The popup_list field in the CorePart
  9200. structure contains the list of its pop-up children.  This
  9201. pop-up list exists mainly to provide the proper place in the
  9202. widget hierarchy for the pop-up to get resources and to pro-
  9203. vide a place for XtDestroyWidget to look for all extant
  9204. children.
  9205.  
  9206. A composite widget can have both normal and pop-up children.
  9207. A pop-up can be popped up from almost anywhere, not just by
  9208. its parent.  The term child always refers to a normal, geom-
  9209. etry-managed widget on the composite widget's list of chil-
  9210. dren, and the term pop-up child always refers to a widget on
  9211. the pop-up list.
  9212.  
  9213.  
  9214. 5.1.  Pop-Up Widget Types
  9215.  
  9216. There are three kinds of pop-up widgets:
  9217.  
  9218. o    Modeless pop-ups
  9219.  
  9220.      A modeless pop-up (for example, a dialog box that does
  9221.      not prevent continued interaction with the rest of the
  9222.      application) can usually be manipulated by the window
  9223.      manager and looks like any other application window
  9224.      from the user's point of view.  The application main
  9225.      window itself is a special case of a modeless pop-up.
  9226.  
  9227. o    Modal pop-ups
  9228.  
  9229.      A modal pop-up (for example, a dialog box that requires
  9230.      user input to continue) can sometimes be manipulated by
  9231.      the window manager, and except for events that occur in
  9232.      the dialog box, it disables user-event distribution to
  9233.      the rest of the application.
  9234.  
  9235.  
  9236.  
  9237.  
  9238.                  130
  9239.  
  9240.  
  9241.  
  9242.  
  9243.  
  9244. X Toolkit Intrinsics                 X11 Release 6.4
  9245.  
  9246.  
  9247. o    Spring-loaded pop-ups
  9248.  
  9249.      A spring-loaded pop-up (for example, a menu) can seldom
  9250.      be manipulated by the window manager, and except for
  9251.      events that occur in the pop-up or its descendants, it
  9252.      disables user-event distribution to all other applica-
  9253.      tions.
  9254.  
  9255. Modal pop-ups and spring-loaded pop-ups are very similar and
  9256. should be coded as if they were the same.  In fact, the same
  9257. widget (for example, a ButtonBox or Menu widget) can be used
  9258. both as a modal pop-up and as a spring-loaded pop-up within
  9259. the same application.  The main difference is that spring-
  9260. loaded pop-ups are brought up with the pointer and, because
  9261. of the grab that the pointer button causes, require differ-
  9262. ent processing by the Intrinsics.  Furthermore, all user
  9263. input remap events occurring outside the spring-loaded pop-
  9264. up (e.g., in a descendant) are also delivered to the spring-
  9265. loaded pop-up after they have been dispatched to the appro-
  9266. priate descendant, so that, for example, button-up can take
  9267. down a spring-loaded pop-up no matter where the button-up
  9268. occurs.
  9269.  
  9270. Any kind of pop-up, in turn, can pop up other widgets.
  9271. Modal and spring-loaded pop-ups can constrain user events to
  9272. the most recent such pop-up or allow user events to be dis-
  9273. patched to any of the modal or spring-loaded pop-ups cur-
  9274. rently mapped.
  9275.  
  9276. Regardless of their type, all pop-up widget classes are
  9277. responsible for communicating with the X window manager and
  9278. therefore are subclasses of one of the Shell widget classes.
  9279.  
  9280.  
  9281. 5.2.  Creating a Pop-Up Shell
  9282.  
  9283. For a widget to be popped up, it must be the child of a pop-
  9284. up shell widget.  None of the Intrinsics-supplied shells
  9285. will simultaneously manage more than one child.  Both the
  9286. shell and child taken together are referred to as the pop-
  9287. up.  When you need to use a pop-up, you always refer to the
  9288. pop-up by the pop-up shell, not the child.
  9289.  
  9290.  
  9291. To create a pop-up shell, use XtCreatePopupShell.
  9292.  
  9293.  
  9294.  
  9295.  
  9296.  
  9297.  
  9298.  
  9299.  
  9300.  
  9301.  
  9302.  
  9303.  
  9304.                  131
  9305.  
  9306.  
  9307.  
  9308.  
  9309.  
  9310. X Toolkit Intrinsics                 X11 Release 6.4
  9311.  
  9312. __
  9313. |
  9314. Widget XtCreatePopupShell(name, widget_class, parent, args, num_args)
  9315.       String name;
  9316.       WidgetClass widget_class;
  9317.       Widget parent;
  9318.       ArgList args;
  9319.       Cardinal num_args;
  9320.  
  9321.  
  9322. name      Specifies the instance name for the created shell
  9323.       widget.
  9324.  
  9325. widget_class
  9326.       Specifies the widget class pointer for the created
  9327.       shell widget.
  9328.  
  9329. parent      Specifies the parent widget.    Must be of class
  9330.       Core or any subclass thereof.
  9331.  
  9332. args      Specifies the argument list to override any other
  9333.       resource specifications.
  9334.  
  9335. num_args  Specifies the number of entries in the argument
  9336.       list.
  9337. |__
  9338.  
  9339. The XtCreatePopupShell function ensures that the specified
  9340. class is a subclass of Shell and, rather than using
  9341. insert_child to attach the widget to the parent's children
  9342. list, attaches the shell to the parent's popup_list
  9343. directly.
  9344.  
  9345. The screen resource for this widget is determined by first
  9346. scanning args for the XtNscreen argument.  If no XtNscreen
  9347. argument is found, the resource database associated with the
  9348. parent's screen is queried for the resource name.screen,
  9349. class Class.Screen where Class is the class_name field from
  9350. the CoreClassPart of the specified widget_class.  If this
  9351. query fails, the parent's screen is used.  Once the screen
  9352. is determined, the resource database associated with that
  9353. screen is used to retrieve all remaining resources for the
  9354. widget not specified in args.
  9355.  
  9356.  
  9357. A spring-loaded pop-up invoked from a translation table via
  9358. XtMenuPopup must already exist at the time that the transla-
  9359. tion is invoked, so the translation manager can find the
  9360. shell by name.    Pop-ups invoked in other ways can be created
  9361. when the pop-up actually is needed.  This delayed creation
  9362. of the shell is particularly useful when you pop up an
  9363. unspecified number of pop-ups.    You can look to see if an
  9364. appropriate unused shell (that is, not currently popped up)
  9365. exists and create a new shell if needed.
  9366.  
  9367.  
  9368.  
  9369.  
  9370.                  132
  9371.  
  9372.  
  9373.  
  9374.  
  9375.  
  9376. X Toolkit Intrinsics                 X11 Release 6.4
  9377.  
  9378.  
  9379. To create a pop-up shell using varargs lists, use
  9380. XtVaCreatePopupShell.
  9381.  
  9382. __
  9383. |
  9384. Widget XtVaCreatePopupShell(name, widget_class, parent, ...)
  9385.       String name;
  9386.       WidgetClass widget_class;
  9387.       Widget parent;
  9388.  
  9389.  
  9390. name      Specifies the instance name for the created shell
  9391.       widget.
  9392.  
  9393. widget_class
  9394.       Specifies the widget class pointer for the created
  9395.       shell widget.
  9396.  
  9397. parent      Specifies the parent widget.    Must be of class
  9398.       Core or any subclass thereof.
  9399.  
  9400. ...      Specifies the variable argument list to override
  9401.       any other resource specifications.
  9402. |__
  9403.  
  9404. XtVaCreatePopupShell is identical in function to XtCre-
  9405. atePopupShell with the args and num_args parameters replaced
  9406. by a varargs list as described in Section 2.5.1.
  9407.  
  9408.  
  9409. 5.3.  Creating Pop-Up Children
  9410.  
  9411. Once a pop-up shell is created, the single child of the pop-
  9412. up shell can be created either statically or dynamically.
  9413.  
  9414. At startup, an application can create the child of the pop-
  9415. up shell, which is appropriate for pop-up children composed
  9416. of a fixed set of widgets.  The application can change the
  9417. state of the subparts of the pop-up child as the application
  9418. state changes.    For example, if an application creates a
  9419. static menu, it can call XtSetSensitive (or, in general,
  9420. XtSetValues) on any of the buttons that make up the menu.
  9421. Creating the pop-up child early means that pop-up time is
  9422. minimized, especially if the application calls XtRealizeWid-
  9423. get on the pop-up shell at startup.  When the menu is
  9424. needed, all the widgets that make up the menu already exist
  9425. and need only be mapped.  The menu should pop up as quickly
  9426. as the X server can respond.
  9427.  
  9428. Alternatively, an application can postpone the creation of
  9429. the child until it is needed, which minimizes application
  9430. startup time and allows the pop-up child to reconfigure
  9431. itself each time it is popped up.  In this case, the pop-up
  9432. child creation routine might poll the application to find
  9433.  
  9434.  
  9435.  
  9436.                  133
  9437.  
  9438.  
  9439.  
  9440.  
  9441.  
  9442. X Toolkit Intrinsics                 X11 Release 6.4
  9443.  
  9444.  
  9445. out if it should change the sensitivity of any of its sub-
  9446. parts.
  9447.  
  9448. Pop-up child creation does not map the pop-up, even if you
  9449. create the child and call XtRealizeWidget on the pop-up
  9450. shell.
  9451.  
  9452. All shells have pop-up and pop-down callbacks, which provide
  9453. the opportunity either to make last-minute changes to a pop-
  9454. up child before it is popped up or to change it after it is
  9455. popped down.  Note that excessive use of pop-up callbacks
  9456. can make popping up occur more slowly.
  9457.  
  9458.  
  9459. 5.4.  Mapping a Pop-Up Widget
  9460.  
  9461. Pop-ups can be popped up through several mechanisms:
  9462.  
  9463. o    A call to XtPopup or XtPopupSpringLoaded.
  9464.  
  9465. o    One of the supplied callback procedures XtCallbackNone,
  9466.      XtCallbackNonexclusive, or XtCallbackExclusive.
  9467.  
  9468. o    The standard translation action XtMenuPopup.
  9469.  
  9470. Some of these routines take an argument of type XtGrabKind,
  9471. which is defined as
  9472.  
  9473. __
  9474. |
  9475. typedef enum {XtGrabNone, XtGrabNonexclusive, XtGrabExclusive} XtGrabKind;
  9476.  
  9477. |__
  9478.  
  9479.  
  9480. The create_popup_child_proc procedure pointer in the shell
  9481. widget instance record is of type XtCreatePopupChildProc.
  9482.  
  9483. __
  9484. |
  9485. typedef void (*XtCreatePopupChildProc)(Widget);
  9486.       Widget w;
  9487.  
  9488.  
  9489. w      Specifies the shell widget being popped up.
  9490. |__
  9491.  
  9492. To map a pop-up from within an application, use XtPopup.
  9493.  
  9494.  
  9495.  
  9496.  
  9497.  
  9498.  
  9499.  
  9500.  
  9501.  
  9502.                  134
  9503.  
  9504.  
  9505.  
  9506.  
  9507.  
  9508. X Toolkit Intrinsics                 X11 Release 6.4
  9509.  
  9510. __
  9511. |
  9512. void XtPopup(popup_shell, grab_kind)
  9513.       Widget popup_shell;
  9514.       XtGrabKind grab_kind;
  9515.  
  9516.  
  9517. popup_shell
  9518.       Specifies the shell widget.
  9519.  
  9520. grab_kind Specifies the way in which user events should be
  9521.       constrained.
  9522. |__
  9523.  
  9524. The XtPopup function performs the following:
  9525.  
  9526. o    Calls XtCheckSubclass to ensure popup_shell's class is
  9527.      a subclass of shellWidgetClass.
  9528.  
  9529. o    Raises the window and returns if the shell's popped_up
  9530.      field is already True.
  9531.  
  9532. o    Calls the callback procedures on the shell's
  9533.      popup_callback list, specifying a pointer to the value
  9534.      of grab_kind as the call_data argument.
  9535.  
  9536. o    Sets the shell popped_up field to True, the shell
  9537.      spring_loaded field to False, and the shell grab_kind
  9538.      field from grab_kind.
  9539.  
  9540. o    If the shell's create_popup_child_proc field is non-
  9541.      NULL, XtPopup calls it with popup_shell as the parame-
  9542.      ter.
  9543.  
  9544. o    If grab_kind is either XtGrabNonexclusive or
  9545.      XtGrabExclusive, it calls
  9546.  
  9547.  
  9548.      XtAddGrab(popup_shell, (grab_kind == XtGrabExclusive), False)
  9549.  
  9550.  
  9551. o    Calls XtRealizeWidget with popup_shell specified.
  9552.  
  9553. o    Calls XMapRaised with the window of popup_shell.
  9554.  
  9555.  
  9556. To map a spring-loaded pop-up from within an application,
  9557. use XtPopupSpringLoaded.
  9558.  
  9559.  
  9560.  
  9561.  
  9562.  
  9563.  
  9564.  
  9565.  
  9566.  
  9567.  
  9568.                  135
  9569.  
  9570.  
  9571.  
  9572.  
  9573.  
  9574. X Toolkit Intrinsics                 X11 Release 6.4
  9575.  
  9576. __
  9577. |
  9578. void XtPopupSpringLoaded(popup_shell)
  9579.       Widget popup_shell;
  9580.  
  9581.  
  9582. popup_shell
  9583.       Specifies the shell widget to be popped up.
  9584. |__
  9585.  
  9586. The XtPopupSpringLoaded function performs exactly as XtPopup
  9587. except that it sets the shell spring_loaded field to True
  9588. and always calls XtAddGrab with exclusive True and spring-
  9589. loaded True.
  9590.  
  9591.  
  9592. To map a pop-up from a given widget's callback list, you
  9593. also can register one of the XtCallbackNone,
  9594. XtCallbackNonexclusive, or XtCallbackExclusive convenience
  9595. routines as callbacks, using the pop-up shell widget as the
  9596. client data.
  9597.  
  9598.  
  9599.  
  9600.  
  9601.  
  9602.  
  9603.  
  9604.  
  9605.  
  9606.  
  9607.  
  9608.  
  9609.  
  9610.  
  9611.  
  9612.  
  9613.  
  9614.  
  9615.  
  9616.  
  9617.  
  9618.  
  9619.  
  9620.  
  9621.  
  9622.  
  9623.  
  9624.  
  9625.  
  9626.  
  9627.  
  9628.  
  9629.  
  9630.  
  9631.  
  9632.  
  9633.  
  9634.                  136
  9635.  
  9636.  
  9637.  
  9638.  
  9639.  
  9640. X Toolkit Intrinsics                 X11 Release 6.4
  9641.  
  9642. __
  9643. |
  9644. void XtCallbackNone(w, client_data, call_data)
  9645.       Widget w;
  9646.       XtPointer client_data;
  9647.       XtPointer call_data;
  9648.  
  9649.  
  9650. w      Specifies the widget.
  9651.  
  9652. client_data
  9653.       Specifies the pop-up shell.
  9654.  
  9655. call_data Specifies the callback data argument, which is not
  9656.       used by this procedure.
  9657.  
  9658.  
  9659.  
  9660. void XtCallbackNonexclusive(w, client_data, call_data)
  9661.       Widget w;
  9662.       XtPointer client_data;
  9663.       XtPointer call_data;
  9664.  
  9665.  
  9666. w      Specifies the widget.
  9667.  
  9668. client_data
  9669.       Specifies the pop-up shell.
  9670.  
  9671. call_data Specifies the callback data argument, which is not
  9672.       used by this procedure.
  9673.  
  9674.  
  9675.  
  9676. void XtCallbackExclusive(w, client_data, call_data)
  9677.       Widget w;
  9678.       XtPointer client_data;
  9679.       XtPointer call_data;
  9680.  
  9681.  
  9682. w      Specifies the widget.
  9683.  
  9684. client_data
  9685.       Specifies the pop-up shell.
  9686.  
  9687. call_data Specifies the callback data argument, which is not
  9688.       used by this procedure.
  9689. |__
  9690.  
  9691. The XtCallbackNone, XtCallbackNonexclusive, and XtCallback-
  9692. Exclusive functions call XtPopup with the shell specified by
  9693. the client_data argument and grab_kind set as the name spec-
  9694. ifies.    XtCallbackNone, XtCallbackNonexclusive, and XtCall-
  9695. backExclusive specify XtGrabNone, XtGrabNonexclusive, and
  9696. XtGrabExclusive, respectively.    Each function then sets the
  9697.  
  9698.  
  9699.  
  9700.                  137
  9701.  
  9702.  
  9703.  
  9704.  
  9705.  
  9706. X Toolkit Intrinsics                 X11 Release 6.4
  9707.  
  9708.  
  9709. widget that executed the callback list to be insensitive by
  9710. calling XtSetSensitive.  Using these functions in callbacks
  9711. is not required.  In particular, an application must provide
  9712. customized code for callbacks that create pop-up shells
  9713. dynamically or that must do more than desensitizing the but-
  9714. ton.
  9715.  
  9716.  
  9717. Within a translation table, to pop up a menu when a key or
  9718. pointer button is pressed or when the pointer is moved into
  9719. a widget, use XtMenuPopup, or its synonym, MenuPopup.  From
  9720. a translation writer's point of view, the definition for
  9721. this translation action is
  9722.  
  9723. __
  9724. |
  9725. void XtMenuPopup(shell_name)
  9726.       String shell_name;
  9727.  
  9728.  
  9729. shell_name
  9730.       Specifies the name of the shell widget to pop up.
  9731. |__
  9732.  
  9733. XtMenuPopup is known to the translation manager, which reg-
  9734. isters the corresponding built-in action procedure
  9735. XtMenuPopupAction using XtRegisterGrabAction specifying
  9736. owner_events True, event_mask ButtonPressMask |
  9737. ButtonReleaseMask, and pointer_mode and keyboard_mode
  9738. GrabModeAsync.
  9739.  
  9740. If XtMenuPopup is invoked on ButtonPress, it calls XtPopup-
  9741. SpringLoaded on the specified shell widget.  If XtMenuPopup
  9742. is invoked on KeyPress or EnterWindow, it calls XtPopup on
  9743. the specified shell widget with grab_kind set to
  9744. XtGrabNonexclusive.  Otherwise, the translation manager gen-
  9745. erates a warning message and ignores the action.
  9746.  
  9747. XtMenuPopup tries to find the shell by searching the widget
  9748. tree starting at the widget in which it is invoked.  If it
  9749. finds a shell with the specified name in the pop-up children
  9750. of that widget, it pops up the shell with the appropriate
  9751. parameters.  Otherwise, it moves up the parent chain to find
  9752. a pop-up child with the specified name.  If XtMenuPopup gets
  9753. to the application top-level shell widget and has not found
  9754. a matching shell, it generates a warning and returns immedi-
  9755. ately.
  9756.  
  9757.  
  9758. 5.5.  Unmapping a Pop-Up Widget
  9759.  
  9760. Pop-ups can be popped down through several mechanisms:
  9761.  
  9762.  
  9763.  
  9764.  
  9765.  
  9766.                  138
  9767.  
  9768.  
  9769.  
  9770.  
  9771.  
  9772. X Toolkit Intrinsics                 X11 Release 6.4
  9773.  
  9774.  
  9775. o    A call to XtPopdown
  9776.  
  9777. o    The supplied callback procedure XtCallbackPopdown
  9778.  
  9779. o    The standard translation action XtMenuPopdown
  9780.  
  9781.  
  9782. To unmap a pop-up from within an application, use XtPopdown.
  9783.  
  9784. __
  9785. |
  9786. void XtPopdown(popup_shell)
  9787.       Widget popup_shell;
  9788.  
  9789.  
  9790. popup_shell
  9791.       Specifies the shell widget to pop down.
  9792. |__
  9793.  
  9794. The XtPopdown function performs the following:
  9795.  
  9796. o    Calls XtCheckSubclass to ensure popup_shell's class is
  9797.      a subclass of shellWidgetClass.
  9798.  
  9799. o    Checks that the popped_up field of popup_shell is True;
  9800.      otherwise, it returns immediately.
  9801.  
  9802. o    Unmaps popup_shell's window and, if override_redirect
  9803.      is False, sends a synthetic UnmapNotify event as speci-
  9804.      fied by the Inter-Client Communication Conventions Man-
  9805.      ual.
  9806.  
  9807. o    If popup_shell's grab_kind is either XtGrabNonexclusive
  9808.      or XtGrabExclusive, it calls XtRemoveGrab.
  9809.  
  9810. o    Sets popup_shell's popped_up field to False.
  9811.  
  9812. o    Calls the callback procedures on the shell's pop-
  9813.      down_callback list, specifying a pointer to the value
  9814.      of the shell's grab_kind field as the call_data argu-
  9815.      ment.
  9816.  
  9817.  
  9818. To pop down a pop-up from a callback list, you may use the
  9819. callback XtCallbackPopdown.
  9820.  
  9821.  
  9822.  
  9823.  
  9824.  
  9825.  
  9826.  
  9827.  
  9828.  
  9829.  
  9830.  
  9831.  
  9832.                  139
  9833.  
  9834.  
  9835.  
  9836.  
  9837.  
  9838. X Toolkit Intrinsics                 X11 Release 6.4
  9839.  
  9840. __
  9841. |
  9842. void XtCallbackPopdown(w, client_data, call_data)
  9843.       Widget w;
  9844.       XtPointer client_data;
  9845.       XtPointer call_data;
  9846.  
  9847.  
  9848. w      Specifies the widget.
  9849.  
  9850. client_data
  9851.       Specifies a pointer to the XtPopdownID structure.
  9852.  
  9853. call_data Specifies the callback data argument, which is not
  9854.       used by this procedure.
  9855. |__
  9856.  
  9857. The XtCallbackPopdown function casts the client_data parame-
  9858. ter to a pointer of type XtPopdownID.
  9859.  
  9860. __
  9861. |
  9862. typedef struct {
  9863.      Widget shell_widget;
  9864.      Widget enable_widget;
  9865. } XtPopdownIDRec, *XtPopdownID;
  9866.  
  9867. |__
  9868.  
  9869. The shell_widget is the pop-up shell to pop down, and the
  9870. enable_widget is usually the widget that was used to pop it
  9871. up in one of the pop-up callback convenience procedures.
  9872.  
  9873. XtCallbackPopdown calls XtPopdown with the specified
  9874. shell_widget and then calls XtSetSensitive to resensitize
  9875. enable_widget.
  9876.  
  9877.  
  9878. Within a translation table, to pop down a spring-loaded menu
  9879. when a key or pointer button is released or when the pointer
  9880. is moved into a widget, use XtMenuPopdown or its synonym,
  9881. MenuPopdown.  From a translation writer's point of view, the
  9882. definition for this translation action is
  9883.  
  9884.  
  9885.  
  9886.  
  9887.  
  9888.  
  9889.  
  9890.  
  9891.  
  9892.  
  9893.  
  9894.  
  9895.  
  9896.  
  9897.  
  9898.                  140
  9899.  
  9900.  
  9901.  
  9902.  
  9903.  
  9904. X Toolkit Intrinsics                 X11 Release 6.4
  9905.  
  9906. __
  9907. |
  9908. void XtMenuPopdown(shell_name)
  9909.       String shell_name;
  9910.  
  9911.  
  9912. shell_name
  9913.       Specifies the name of the shell widget to pop
  9914.       down.
  9915. |__
  9916.  
  9917. If a shell name is not given, XtMenuPopdown calls XtPopdown
  9918. with the widget for which the translation is specified.  If
  9919. shell_name is specified in the translation table, XtMenuPop-
  9920. down tries to find the shell by looking up the widget tree
  9921. starting at the widget in which it is invoked.    If it finds
  9922. a shell with the specified name in the pop-up children of
  9923. that widget, it pops down the shell; otherwise, it moves up
  9924. the parent chain to find a pop-up child with the specified
  9925. name.  If XtMenuPopdown gets to the application top-level
  9926. shell widget and cannot find a matching shell, it generates
  9927. a warning and returns immediately.
  9928.  
  9929.  
  9930.  
  9931.  
  9932.  
  9933.  
  9934.  
  9935.  
  9936.  
  9937.  
  9938.  
  9939.  
  9940.  
  9941.  
  9942.  
  9943.  
  9944.  
  9945.  
  9946.  
  9947.  
  9948.  
  9949.  
  9950.  
  9951.  
  9952.  
  9953.  
  9954.  
  9955.  
  9956.  
  9957.  
  9958.  
  9959.  
  9960.  
  9961.  
  9962.  
  9963.  
  9964.                  141
  9965.  
  9966.  
  9967.  
  9968.  
  9969.  
  9970. X Toolkit Intrinsics                 X11 Release 6.4
  9971.  
  9972.  
  9973.  
  9974.  
  9975.              Chapter 6
  9976.  
  9977.             Geometry Management
  9978.  
  9979.  
  9980.  
  9981.  
  9982. A widget does not directly control its size and location;
  9983. rather, its parent is responsible for controlling them.
  9984. Although the position of children is usually left up to
  9985. their parent, the widgets themselves often have the best
  9986. idea of their optimal sizes and, possibly, preferred loca-
  9987. tions.
  9988.  
  9989. To resolve physical layout conflicts between sibling widgets
  9990. and between a widget and its parent, the Intrinsics provide
  9991. the geometry management mechanism.  Almost all composite
  9992. widgets have a geometry manager specified in the geome-
  9993. try_manager field in the widget class record that is respon-
  9994. sible for the size, position, and stacking order of the wid-
  9995. get's children.  The only exception is fixed boxes, which
  9996. create their children themselves and can ensure that their
  9997. children will never make a geometry request.
  9998.  
  9999.  
  10000. 6.1.  Initiating Geometry Changes
  10001.  
  10002. Parents, children, and clients each initiate geometry
  10003. changes differently.  Because a parent has absolute control
  10004. of its children's geometry, it changes the geometry directly
  10005. by calling XtMoveWidget, XtResizeWidget, or
  10006. XtConfigureWidget.  A child must ask its parent for a geome-
  10007. try change by calling XtMakeGeometryRequest or
  10008. XtMakeResizeRequest.  An application or other client code
  10009. initiates a geometry change by calling XtSetValues on the
  10010. appropriate geometry fields, thereby giving the widget the
  10011. opportunity to modify or reject the client request before it
  10012. gets propagated to the parent and the opportunity to respond
  10013. appropriately to the parent's reply.
  10014.  
  10015. When a widget that needs to change its size, position, bor-
  10016. der width, or stacking depth asks its parent's geometry man-
  10017. ager to make the desired changes, the geometry manager can
  10018. allow the request, disallow the request, or suggest a com-
  10019. promise.
  10020.  
  10021. When the geometry manager is asked to change the geometry of
  10022. a child, the geometry manager may also rearrange and resize
  10023. any or all of the other children that it controls.  The
  10024. geometry manager can move children around freely using
  10025. XtMoveWidget.  When it resizes a child (that is, changes the
  10026. width, height, or border width) other than the one making
  10027.  
  10028.  
  10029.  
  10030.                  142
  10031.  
  10032.  
  10033.  
  10034.  
  10035.  
  10036. X Toolkit Intrinsics                 X11 Release 6.4
  10037.  
  10038.  
  10039. the request, it should do so by calling XtResizeWidget.  The
  10040. requesting child may be given special treatment; see Section
  10041. 6.5.  It can simultaneously move and resize a child with a
  10042. single call to XtConfigureWidget.
  10043.  
  10044. Often, geometry managers find that they can satisfy a
  10045. request only if they can reconfigure a widget that they are
  10046. not in control of; in particular, the composite widget may
  10047. want to change its own size.  In this case, the geometry
  10048. manager makes a request to its parent's geometry manager.
  10049. Geometry requests can cascade this way to arbitrary depth.
  10050.  
  10051. Because such cascaded arbitration of widget geometry can
  10052. involve extended negotiation, windows are not actually allo-
  10053. cated to widgets at application startup until all widgets
  10054. are satisfied with their geometry; see Sections 2.5 and 2.6.
  10055.  
  10056.                Notes
  10057.  
  10058.  
  10059.      1.   The Intrinsics treatment of stacking requests
  10060.       is deficient in several areas.  Stacking
  10061.       requests for unrealized widgets are granted
  10062.       but will have no effect.  In addition, there
  10063.       is no way to do an XtSetValues that will gen-
  10064.       erate a stacking geometry request.
  10065.  
  10066.      2.   After a successful geometry request (one that
  10067.       returned XtGeometryYes), a widget does not
  10068.       know whether its resize procedure has been
  10069.       called.  Widgets should have resize proce-
  10070.       dures that can be called more than once with-
  10071.       out ill effects.
  10072.  
  10073.  
  10074.  
  10075. 6.2.  General Geometry Manager Requests
  10076.  
  10077. When making a geometry request, the child specifies an
  10078. XtWidgetGeometry structure.
  10079.  
  10080.  
  10081.  
  10082.  
  10083.  
  10084.  
  10085.  
  10086.  
  10087.  
  10088.  
  10089.  
  10090.  
  10091.  
  10092.  
  10093.  
  10094.  
  10095.  
  10096.                  143
  10097.  
  10098.  
  10099.  
  10100.  
  10101.  
  10102. X Toolkit Intrinsics                 X11 Release 6.4
  10103.  
  10104. __
  10105. |
  10106. typedef unsigned long XtGeometryMask;
  10107.  
  10108. typedef struct {
  10109.      XtGeometryMask request_mode;
  10110.      Position x, y;
  10111.      Dimension width, height;
  10112.      Dimension border_width;
  10113.      Widget sibling;
  10114.      int stack_mode;
  10115. } XtWidgetGeometry;
  10116. |__
  10117.  
  10118.  
  10119. To make a general geometry manager request from a widget,
  10120. use XtMakeGeometryRequest.
  10121.  
  10122. __
  10123. |
  10124. XtGeometryResult XtMakeGeometryRequest(w, request, reply_return)
  10125.       Widget w;
  10126.       XtWidgetGeometry *request;
  10127.       XtWidgetGeometry *reply_return;
  10128.  
  10129.  
  10130. w      Specifies the widget making the request.  Must be
  10131.       of class RectObj or any subclass thereof.
  10132.  
  10133. request   Specifies the desired widget geometry (size, posi-
  10134.       tion, border width, and stacking order).
  10135.  
  10136. reply_return
  10137.       Returns the allowed widget size, or may be NULL if
  10138.       the requesting widget is not interested in han-
  10139.       dling XtGeometryAlmost.
  10140. |__
  10141.  
  10142. Depending on the condition, XtMakeGeometryRequest performs
  10143. the following:
  10144.  
  10145. o    If the widget is unmanaged or the widget's parent is
  10146.      not realized, it makes the changes and returns
  10147.      XtGeometryYes.
  10148.  
  10149. o    If the parent's class is not a subclass of compos-
  10150.      iteWidgetClass or the parent's geometry_manager field
  10151.      is NULL, it issues an error.
  10152.  
  10153. o    If the widget's being_destroyed field is True, it
  10154.      returns XtGeometryNo.
  10155.  
  10156. o    If the widget x, y, width, height, and border_width
  10157.      fields are all equal to the requested values, it
  10158.      returns XtGeometryYes; otherwise, it calls the parent's
  10159.  
  10160.  
  10161.  
  10162.                  144
  10163.  
  10164.  
  10165.  
  10166.  
  10167.  
  10168. X Toolkit Intrinsics                 X11 Release 6.4
  10169.  
  10170.  
  10171.      geometry_manager procedure with the given parameters.
  10172.  
  10173. o    If the parent's geometry manager returns XtGeometryYes
  10174.      and if XtCWQueryOnly is not set in
  10175.      request->request_mode and if the widget is realized,
  10176.      XtMakeGeometryRequest calls the XConfigureWindow Xlib
  10177.      function to reconfigure the widget's window (set its
  10178.      size, location, and stacking order as appropriate).
  10179.  
  10180. o    If the geometry manager returns XtGeometryDone, the
  10181.      change has been approved and actually has been done.
  10182.      In this case, XtMakeGeometryRequest does no configuring
  10183.      and returns XtGeometryYes.  XtMakeGeometryRequest never
  10184.      returns XtGeometryDone.
  10185.  
  10186. o    Otherwise, XtMakeGeometryRequest just returns the
  10187.      resulting value from the parent's geometry manager.
  10188.  
  10189. Children of primitive widgets are always unmanaged; there-
  10190. fore, XtMakeGeometryRequest always returns XtGeometryYes
  10191. when called by a child of a primitive widget.
  10192.  
  10193. The return codes from geometry managers are
  10194.  
  10195. __
  10196. |
  10197. typedef enum {
  10198.      XtGeometryYes,
  10199.      XtGeometryNo,
  10200.      XtGeometryAlmost,
  10201.      XtGeometryDone
  10202. } XtGeometryResult;
  10203. |__
  10204.  
  10205.  
  10206. The request_mode definitions are from <X11/X.h>.
  10207.  
  10208. __
  10209. |
  10210. #define   CWX                  (1<<0)
  10211. #define   CWY                  (1<<1)
  10212. #define   CWWidth              (1<<2)
  10213. #define   CWHeight              (1<<3)
  10214. #define   CWBorderWidth           (1<<4)
  10215. #define   CWSibling              (1<<5)
  10216. #define   CWStackMode              (1<<6)
  10217.  
  10218. |__
  10219.  
  10220. The Intrinsics also support the following value.
  10221.  
  10222.  
  10223.  
  10224.  
  10225.  
  10226.  
  10227.  
  10228.                  145
  10229.  
  10230.  
  10231.  
  10232.  
  10233.  
  10234. X Toolkit Intrinsics                 X11 Release 6.4
  10235.  
  10236. __
  10237. |
  10238. #define   XtCWQueryOnly           (1<<7)
  10239.  
  10240. |__
  10241.  
  10242. XtCWQueryOnly indicates that the corresponding geometry
  10243. request is only a query as to what would happen if this
  10244. geometry request were made and that no widgets should actu-
  10245. ally be changed.
  10246.  
  10247. XtMakeGeometryRequest, like the XConfigureWindow Xlib func-
  10248. tion, uses request_mode to determine which fields in the
  10249. XtWidgetGeometry structure the caller wants to specify.
  10250.  
  10251. The stack_mode definitions are from <X11/X.h>:
  10252.  
  10253. __
  10254. |
  10255. #define   Above               0
  10256. #define   Below               1
  10257. #define   TopIf               2
  10258. #define   BottomIf              3
  10259. #define   Opposite              4
  10260.  
  10261. |__
  10262.  
  10263. The Intrinsics also support the following value.
  10264.  
  10265. __
  10266. |
  10267. #define   XtSMDontChange          5
  10268.  
  10269. |__
  10270.  
  10271. For definition and behavior of Above, Below, TopIf,
  10272. BottomIf, and Opposite, see Section 3.7 in Xlib -- C Lan-
  10273. guage X Interface.  XtSMDontChange indicates that the widget
  10274. wants its current stacking order preserved.
  10275.  
  10276.  
  10277. 6.3.  Resize Requests
  10278.  
  10279. To make a simple resize request from a widget, you can use
  10280. XtMakeResizeRequest as an alternative to
  10281. XtMakeGeometryRequest.
  10282.  
  10283.  
  10284.  
  10285.  
  10286.  
  10287.  
  10288.  
  10289.  
  10290.  
  10291.  
  10292.  
  10293.  
  10294.                  146
  10295.  
  10296.  
  10297.  
  10298.  
  10299.  
  10300. X Toolkit Intrinsics                 X11 Release 6.4
  10301.  
  10302. __
  10303. |
  10304. XtGeometryResult XtMakeResizeRequest(w, width, height, width_return, height_return)
  10305.       Widget w;
  10306.       Dimension width, height;
  10307.       Dimension *width_return, *height_return;
  10308.  
  10309.  
  10310. w      Specifies the widget making the request.  Must be
  10311.       of class RectObj or any subclass thereof.
  10312.  
  10313. width      Specify the desired widget width and height.
  10314.  
  10315. height
  10316.  
  10317. width_return
  10318.       Return the allowed widget width and height.
  10319.  
  10320. height_return
  10321. |__
  10322.  
  10323. The XtMakeResizeRequest function, a simple interface to
  10324. XtMakeGeometryRequest, creates an XtWidgetGeometry structure
  10325. and specifies that width and height should change by setting
  10326. request_mode to CWWidth | CWHeight.  The geometry manager is
  10327. free to modify any of the other window attributes (position
  10328. or stacking order) to satisfy the resize request.  If the
  10329. return value is XtGeometryAlmost, width_return and
  10330. height_return contain a compromise width and height.  If
  10331. these are acceptable, the widget should immediately call
  10332. XtMakeResizeRequest again and request that the compromise
  10333. width and height be applied.  If the widget is not inter-
  10334. ested in XtGeometryAlmost replies, it can pass NULL for
  10335. width_return and height_return.
  10336.  
  10337.  
  10338. 6.4.  Potential Geometry Changes
  10339.  
  10340. Sometimes a geometry manager cannot respond to a geometry
  10341. request from a child without first making a geometry request
  10342. to the widget's own parent (the original requestor's grand-
  10343. parent).  If the request to the grandparent would allow the
  10344. parent to satisfy the original request, the geometry manager
  10345. can make the intermediate geometry request as if it were the
  10346. originator.  On the other hand, if the geometry manager
  10347. already has determined that the original request cannot be
  10348. completely satisfied (for example, if it always denies posi-
  10349. tion changes), it needs to tell the grandparent to respond
  10350. to the intermediate request without actually changing the
  10351. geometry because it does not know if the child will accept
  10352. the compromise.  To accomplish this, the geometry manager
  10353. uses XtCWQueryOnly in the intermediate request.
  10354.  
  10355. When XtCWQueryOnly is used, the geometry manager needs to
  10356. cache enough information to exactly reconstruct the
  10357.  
  10358.  
  10359.  
  10360.                  147
  10361.  
  10362.  
  10363.  
  10364.  
  10365.  
  10366. X Toolkit Intrinsics                 X11 Release 6.4
  10367.  
  10368.  
  10369. intermediate request.  If the grandparent's response to the
  10370. intermediate query was XtGeometryAlmost, the geometry man-
  10371. ager needs to cache the entire reply geometry in the event
  10372. the child accepts the parent's compromise.
  10373.  
  10374. If the grandparent's response was XtGeometryAlmost, it may
  10375. also be necessary to cache the entire reply geometry from
  10376. the grandparent when XtCWQueryOnly is not used.  If the
  10377. geometry manager is still able to satisfy the original
  10378. request, it may immediately accept the grandparent's compro-
  10379. mise and then act on the child's request.  If the grandpar-
  10380. ent's compromise geometry is insufficient to allow the
  10381. child's request and if the geometry manager is willing to
  10382. offer a different compromise to the child, the grandparent's
  10383. compromise should not be accepted until the child has
  10384. accepted the new compromise.
  10385.  
  10386. Note that a compromise geometry returned with XtGeometryAl-
  10387. most is guaranteed only for the next call to the same wid-
  10388. get; therefore, a cache of size 1 is sufficient.
  10389.  
  10390.  
  10391. 6.5.  Child Geometry Management: The geometry_manager Proce-
  10392. dure
  10393.  
  10394. The geometry_manager procedure pointer in a composite widget
  10395. class is of type XtGeometryHandler.
  10396.  
  10397. __
  10398. |
  10399. typedef XtGeometryResult (*XtGeometryHandler)(Widget, XtWidgetGeometry*, XtWidgetGeometry*);
  10400.       Widget w;
  10401.       XtWidgetGeometry *request;
  10402.       XtWidgetGeometry *geometry_return;
  10403.  
  10404.  
  10405. w        Passes the widget making the request.
  10406.  
  10407. request     Passes the new geometry the child desires.
  10408.  
  10409. geometry_return
  10410.         Passes a geometry structure in which the geome-
  10411.         try manager may store a compromise.
  10412. |__
  10413.  
  10414. A class can inherit its superclass's geometry manager during
  10415. class initialization.
  10416.  
  10417. A bit set to zero in the request's request_mode field means
  10418. that the child widget does not care about the value of the
  10419. corresponding field, so the geometry manager can change this
  10420. field as it wishes.  A bit set to 1 means that the child
  10421. wants that geometry element set to the value in the corre-
  10422. sponding field.
  10423.  
  10424.  
  10425.  
  10426.                  148
  10427.  
  10428.  
  10429.  
  10430.  
  10431.  
  10432. X Toolkit Intrinsics                 X11 Release 6.4
  10433.  
  10434.  
  10435. If the geometry manager can satisfy all changes requested
  10436. and if XtCWQueryOnly is not specified, it updates the wid-
  10437. get's x, y, width, height, and border_width fields appropri-
  10438. ately.    Then, it returns XtGeometryYes, and the values
  10439. pointed to by the geometry_return argument are undefined.
  10440. The widget's window is moved and resized automatically by
  10441. XtMakeGeometryRequest.
  10442.  
  10443. Homogeneous composite widgets often find it convenient to
  10444. treat the widget making the request the same as any other
  10445. widget, including reconfiguring it using XtConfigureWidget
  10446. or XtResizeWidget as part of its layout process, unless
  10447. XtCWQueryOnly is specified.  If it does this, it should
  10448. return XtGeometryDone to inform XtMakeGeometryRequest that
  10449. it does not need to do the configuration itself.
  10450.  
  10451.                 Note
  10452.  
  10453.      To remain compatible with layout techniques used
  10454.      in older widgets (before XtGeometryDone was added
  10455.      to the Intrinsics), a geometry manager should
  10456.      avoid using XtResizeWidget or XtConfigureWidget on
  10457.      the child making the request because the layout
  10458.      process of the child may be in an intermediate
  10459.      state in which it is not prepared to handle a call
  10460.      to its resize procedure.  A self-contained widget
  10461.      set may choose this alternative geometry manage-
  10462.      ment scheme, however, provided that it clearly
  10463.      warns widget developers of the compatibility con-
  10464.      sequences.
  10465.  
  10466.  
  10467. Although XtMakeGeometryRequest resizes the widget's window
  10468. (if the geometry manager returns XtGeometryYes), it does not
  10469. call the widget class's resize procedure.  The requesting
  10470. widget must perform whatever resizing calculations are
  10471. needed explicitly.
  10472.  
  10473. If the geometry manager disallows the request, the widget
  10474. cannot change its geometry.  The values pointed to by geome-
  10475. try_return are undefined, and the geometry manager returns
  10476. XtGeometryNo.
  10477.  
  10478. Sometimes the geometry manager cannot satisfy the request
  10479. exactly but may be able to satisfy a similar request.  That
  10480. is, it could satisfy only a subset of the requests (for
  10481. example, size but not position) or a lesser request (for
  10482. example, it cannot make the child as big as the request but
  10483. it can make the child bigger than its current size).  In
  10484. such cases, the geometry manager fills in the structure
  10485. pointed to by geometry_return with the actual changes it is
  10486. willing to make, including an appropriate request_mode mask,
  10487. and returns XtGeometryAlmost.  If a bit in geome-
  10488. try_return->request_mode is zero, the geometry manager
  10489.  
  10490.  
  10491.  
  10492.                  149
  10493.  
  10494.  
  10495.  
  10496.  
  10497.  
  10498. X Toolkit Intrinsics                 X11 Release 6.4
  10499.  
  10500.  
  10501. agrees not to change the corresponding value if geome-
  10502. try_return is used immediately in a new request.  If a bit
  10503. is 1, the geometry manager does change that element to the
  10504. corresponding value in geometry_return.  More bits may be
  10505. set in geometry_return->request_mode than in the original
  10506. request if the geometry manager intends to change other
  10507. fields should the child accept the compromise.
  10508.  
  10509. When XtGeometryAlmost is returned, the widget must decide if
  10510. the compromise suggested in geometry_return is acceptable.
  10511. If it is, the widget must not change its geometry directly;
  10512. rather, it must make another call to XtMakeGeometryRequest.
  10513.  
  10514. If the next geometry request from this child uses the geome-
  10515. try_return values filled in by the geometry manager with an
  10516. XtGeometryAlmost return and if there have been no interven-
  10517. ing geometry requests on either its parent or any of its
  10518. other children, the geometry manager must grant the request,
  10519. if possible.  That is, if the child asks immediately with
  10520. the returned geometry, it should get an answer of
  10521. XtGeometryYes.    However, dynamic behavior in the user's win-
  10522. dow manager may affect the final outcome.
  10523.  
  10524. To return XtGeometryYes, the geometry manager frequently
  10525. rearranges the position of other managed children by calling
  10526. XtMoveWidget.  However, a few geometry managers may some-
  10527. times change the size of other managed children by calling
  10528. XtResizeWidget or XtConfigureWidget.  If XtCWQueryOnly is
  10529. specified, the geometry manager must return data describing
  10530. how it would react to this geometry request without actually
  10531. moving or resizing any widgets.
  10532.  
  10533. Geometry managers must not assume that the request and geom-
  10534. etry_return arguments point to independent storage.  The
  10535. caller is permitted to use the same field for both, and the
  10536. geometry manager must allocate its own temporary storage, if
  10537. necessary.
  10538.  
  10539.  
  10540. 6.6.  Widget Placement and Sizing
  10541.  
  10542. To move a sibling widget of the child making the geometry
  10543. request, the parent uses XtMoveWidget.
  10544.  
  10545.  
  10546.  
  10547.  
  10548.  
  10549.  
  10550.  
  10551.  
  10552.  
  10553.  
  10554.  
  10555.  
  10556.  
  10557.  
  10558.                  150
  10559.  
  10560.  
  10561.  
  10562.  
  10563.  
  10564. X Toolkit Intrinsics                 X11 Release 6.4
  10565.  
  10566. __
  10567. |
  10568. void XtMoveWidget(w, x, y)
  10569.       Widget w;
  10570.       Position x;
  10571.       Position y;
  10572.  
  10573.  
  10574. w      Specifies the widget.  Must be of class RectObj or
  10575.       any subclass thereof.
  10576.  
  10577. x
  10578.  
  10579. y      Specify the new widget x and y coordinates.
  10580. |__
  10581.  
  10582. The XtMoveWidget function returns immediately if the speci-
  10583. fied geometry fields are the same as the old values.  Other-
  10584. wise, XtMoveWidget writes the new x and y values into the
  10585. object and, if the object is a widget and is realized,
  10586. issues an Xlib XMoveWindow call on the widget's window.
  10587.  
  10588.  
  10589. To resize a sibling widget of the child making the geometry
  10590. request, the parent uses XtResizeWidget.
  10591.  
  10592. __
  10593. |
  10594. void XtResizeWidget(w, width, height, border_width)
  10595.       Widget w;
  10596.       Dimension width;
  10597.       Dimension height;
  10598.       Dimension border_width;
  10599.  
  10600.  
  10601. w      Specifies the widget.  Must be of class RectObj or
  10602.       any subclass thereof.
  10603.  
  10604. width
  10605.  
  10606. height
  10607.  
  10608. border_width
  10609.       Specify the new widget size.
  10610. |__
  10611.  
  10612. The XtResizeWidget function returns immediately if the spec-
  10613. ified geometry fields are the same as the old values.  Oth-
  10614. erwise, XtResizeWidget writes the new width, height, and
  10615. border_width values into the object and, if the object is a
  10616. widget and is realized, issues an XConfigureWindow call on
  10617. the widget's window.
  10618.  
  10619. If the new width or height is different from the old values,
  10620. XtResizeWidget calls the object's resize procedure to notify
  10621.  
  10622.  
  10623.  
  10624.                  151
  10625.  
  10626.  
  10627.  
  10628.  
  10629.  
  10630. X Toolkit Intrinsics                 X11 Release 6.4
  10631.  
  10632.  
  10633. it of the size change.
  10634.  
  10635.  
  10636. To move and resize the sibling widget of the child making
  10637. the geometry request, the parent uses XtConfigureWidget.
  10638.  
  10639. __
  10640. |
  10641. void XtConfigureWidget(w, x, y, width, height, border_width)
  10642.       Widget w;
  10643.       Position x;
  10644.       Position y;
  10645.       Dimension width;
  10646.       Dimension height;
  10647.       Dimension border_width;
  10648.  
  10649.  
  10650. w      Specifies the widget.  Must be of class RectObj or
  10651.       any subclass thereof.
  10652.  
  10653. x
  10654.  
  10655. y      Specify the new widget x and y coordinates.
  10656.  
  10657. width
  10658.  
  10659. height
  10660.  
  10661. border_width
  10662.       Specify the new widget size.
  10663. |__
  10664.  
  10665. The XtConfigureWidget function returns immediately if the
  10666. specified new geometry fields are all equal to the current
  10667. values.  Otherwise, XtConfigureWidget writes the new x, y,
  10668. width, height, and border_width values into the object and,
  10669. if the object is a widget and is realized, makes an Xlib
  10670. XConfigureWindow call on the widget's window.
  10671.  
  10672. If the new width or height is different from its old value,
  10673. XtConfigureWidget calls the object's resize procedure to
  10674. notify it of the size change; otherwise, it simply returns.
  10675.  
  10676.  
  10677. To resize a child widget that already has the new values of
  10678. its width, height, and border width, the parent uses
  10679. XtResizeWindow.
  10680.  
  10681.  
  10682.  
  10683.  
  10684.  
  10685.  
  10686.  
  10687.  
  10688.  
  10689.  
  10690.                  152
  10691.  
  10692.  
  10693.  
  10694.  
  10695.  
  10696. X Toolkit Intrinsics                 X11 Release 6.4
  10697.  
  10698. __
  10699. |
  10700. void XtResizeWindow(w)
  10701.       Widget w;
  10702.  
  10703.  
  10704. w      Specifies the widget.  Must be of class Core or
  10705.       any subclass thereof.
  10706. |__
  10707.  
  10708. The XtResizeWindow function calls the XConfigureWindow Xlib
  10709. function to make the window of the specified widget match
  10710. its width, height, and border width.  This request is done
  10711. unconditionally because there is no inexpensive way to tell
  10712. if these values match the current values.  Note that the
  10713. widget's resize procedure is not called.
  10714.  
  10715. There are very few times to use XtResizeWindow; instead, the
  10716. parent should use XtResizeWidget.
  10717.  
  10718.  
  10719. 6.7.  Preferred Geometry
  10720.  
  10721. Some parents may be willing to adjust their layouts to
  10722. accommodate the preferred geometries of their children.
  10723. They can use XtQueryGeometry to obtain the preferred geome-
  10724. try and, as they see fit, can use or ignore any portion of
  10725. the response.
  10726.  
  10727.  
  10728. To query a child widget's preferred geometry, use
  10729. XtQueryGeometry.
  10730.  
  10731. __
  10732. |
  10733. XtGeometryResult XtQueryGeometry(w, intended, preferred_return)
  10734.      Widget w;
  10735.      XtWidgetGeometry *intended;
  10736.      XtWidgetGeometry *preferred_return;
  10737.  
  10738.  
  10739. w       Specifies the widget.  Must be of class RectObj
  10740.        or any subclass thereof.
  10741.  
  10742. intended   Specifies the new geometry the parent plans to
  10743.        give to the child, or NULL.
  10744.  
  10745. preferred_return
  10746.        Returns the child widget's preferred geometry.
  10747. |__
  10748.  
  10749. To discover a child's preferred geometry, the child's parent
  10750. stores the new geometry in the corresponding fields of the
  10751. intended structure, sets the corresponding bits in
  10752. intended.request_mode, and calls XtQueryGeometry.  The
  10753.  
  10754.  
  10755.  
  10756.                  153
  10757.  
  10758.  
  10759.  
  10760.  
  10761.  
  10762. X Toolkit Intrinsics                 X11 Release 6.4
  10763.  
  10764.  
  10765. parent should set only those fields that are important to it
  10766. so that the child can determine whether it may be able to
  10767. attempt changes to other fields.
  10768.  
  10769. XtQueryGeometry clears all bits in the pre-
  10770. ferred_return->request_mode field and checks the query_geom-
  10771. etry field of the specified widget's class record.  If
  10772. query_geometry is not NULL, XtQueryGeometry calls the
  10773. query_geometry procedure and passes as arguments the speci-
  10774. fied widget, intended, and preferred_return structures.  If
  10775. the intended argument is NULL, XtQueryGeometry replaces it
  10776. with a pointer to an XtWidgetGeometry structure with
  10777. request_mode equal to zero before calling the query_geometry
  10778. procedure.
  10779.  
  10780.                 Note
  10781.  
  10782.      If XtQueryGeometry is called from within a geome-
  10783.      try_manager procedure for the widget that issued
  10784.      XtMakeGeometryRequest or XtMakeResizeRequest, the
  10785.      results are not guaranteed to be consistent with
  10786.      the requested changes.  The change request passed
  10787.      to the geometry manager takes precedence over the
  10788.      preferred geometry.
  10789.  
  10790.  
  10791.  
  10792. The query_geometry procedure pointer is of type
  10793. XtGeometryHandler.
  10794.  
  10795. __
  10796. |
  10797. typedef XtGeometryResult (*XtGeometryHandler)(Widget, XtWidgetGeometry*, XtWidgetGeometry*);
  10798.       Widget w;
  10799.       XtWidgetGeometry *request;
  10800.       XtWidgetGeometry *preferred_return;
  10801.  
  10802.  
  10803. w        Passes the child widget whose preferred geometry
  10804.         is required.
  10805.  
  10806. request     Passes the geometry changes that the parent
  10807.         plans to make.
  10808.  
  10809. preferred_return
  10810.         Passes a structure in which the child returns
  10811.         its preferred geometry.
  10812. |__
  10813.  
  10814. The query_geometry procedure is expected to examine the bits
  10815. set in request->request_mode, evaluate the preferred geome-
  10816. try of the widget, and store the result in preferred_return
  10817. (setting the bits in preferred_return->request_mode corre-
  10818. sponding to those geometry fields that it cares about).  If
  10819.  
  10820.  
  10821.  
  10822.                  154
  10823.  
  10824.  
  10825.  
  10826.  
  10827.  
  10828. X Toolkit Intrinsics                 X11 Release 6.4
  10829.  
  10830.  
  10831. the proposed geometry change is acceptable without modifica-
  10832. tion, the query_geometry procedure should return
  10833. XtGeometryYes.    If at least one field in preferred_return
  10834. with a bit set in preferred_return->request_mode is differ-
  10835. ent from the corresponding field in request or if a bit was
  10836. set in preferred_return->request_mode that was not set in
  10837. the request, the query_geometry procedure should return
  10838. XtGeometryAlmost.  If the preferred geometry is identical to
  10839. the current geometry, the query_geometry procedure should
  10840. return XtGeometryNo.
  10841.  
  10842.                 Note
  10843.  
  10844.      The query_geometry procedure may assume that no
  10845.      XtMakeResizeRequest or XtMakeGeometryRequest is in
  10846.      progress for the specified widget; that is, it is
  10847.      not required to construct a reply consistent with
  10848.      the requested geometry if such a request were
  10849.      actually outstanding.
  10850.  
  10851.  
  10852. After calling the query_geometry procedure or if the
  10853. query_geometry field is NULL, XtQueryGeometry examines all
  10854. the unset bits in preferred_return->request_mode and sets
  10855. the corresponding fields in preferred_return to the current
  10856. values from the widget instance.  If CWStackMode is not set,
  10857. the stack_mode field is set to XtSMDontChange.    XtQuery-
  10858. Geometry returns the value returned by the query_geometry
  10859. procedure or XtGeometryYes if the query_geometry field is
  10860. NULL.
  10861.  
  10862. Therefore, the caller can interpret a return of XtGeome-
  10863. tryYes as not needing to evaluate the contents of the reply
  10864. and, more important, not needing to modify its layout plans.
  10865. A return of XtGeometryAlmost means either that both the par-
  10866. ent and the child expressed interest in at least one common
  10867. field and the child's preference does not match the parent's
  10868. intentions or that the child expressed interest in a field
  10869. that the parent might need to consider.  A return value of
  10870. XtGeometryNo means that both the parent and the child
  10871. expressed interest in a field and that the child suggests
  10872. that the field's current value in the widget instance is its
  10873. preferred value.  In addition, whether or not the caller
  10874. ignores the return value or the reply mask, it is guaranteed
  10875. that the preferred_return structure contains complete geome-
  10876. try information for the child.
  10877.  
  10878. Parents are expected to call XtQueryGeometry in their layout
  10879. routine and wherever else the information is significant
  10880. after change_managed has been called.  The first time it is
  10881. invoked, the changed_managed procedure may assume that the
  10882. child's current geometry is its preferred geometry.  Thus,
  10883. the child is still responsible for storing values into its
  10884. own geometry during its initialize procedure.
  10885.  
  10886.  
  10887.  
  10888.                  155
  10889.  
  10890.  
  10891.  
  10892.  
  10893.  
  10894. X Toolkit Intrinsics                 X11 Release 6.4
  10895.  
  10896.  
  10897. 6.8.  Size Change Management: The resize Procedure
  10898.  
  10899. A child can be resized by its parent at any time.  Widgets
  10900. usually need to know when they have changed size so that
  10901. they can lay out their displayed data again to match the new
  10902. size.  When a parent resizes a child, it calls
  10903. XtResizeWidget, which updates the geometry fields in the
  10904. widget, configures the window if the widget is realized, and
  10905. calls the child's resize procedure to notify the child.  The
  10906. resize procedure pointer is of type XtWidgetProc.
  10907.  
  10908. If a class need not recalculate anything when a widget is
  10909. resized, it can specify NULL for the resize field in its
  10910. class record.  This is an unusual case and should occur only
  10911. for widgets with very trivial display semantics.  The resize
  10912. procedure takes a widget as its only argument.    The x, y,
  10913. width, height, and border_width fields of the widget contain
  10914. the new values.  The resize procedure should recalculate the
  10915. layout of internal data as needed.  (For example, a centered
  10916. Label in a window that changes size should recalculate the
  10917. starting position of the text.)  The widget must obey resize
  10918. as a command and must not treat it as a request.  A widget
  10919. must not issue an XtMakeGeometryRequest or XtMakeResiz-
  10920. eRequest call from its resize procedure.
  10921.  
  10922.  
  10923.  
  10924.  
  10925.  
  10926.  
  10927.  
  10928.  
  10929.  
  10930.  
  10931.  
  10932.  
  10933.  
  10934.  
  10935.  
  10936.  
  10937.  
  10938.  
  10939.  
  10940.  
  10941.  
  10942.  
  10943.  
  10944.  
  10945.  
  10946.  
  10947.  
  10948.  
  10949.  
  10950.  
  10951.  
  10952.  
  10953.  
  10954.                  156
  10955.  
  10956.  
  10957.  
  10958.  
  10959.  
  10960. X Toolkit Intrinsics                 X11 Release 6.4
  10961.  
  10962.  
  10963.  
  10964.  
  10965.              Chapter 7
  10966.  
  10967.               Event Management
  10968.  
  10969.  
  10970.  
  10971. While Xlib allows the reading and processing of events any-
  10972. where in an application, widgets in the X Toolkit neither
  10973. directly read events nor grab the server or pointer.  Wid-
  10974. gets register procedures that are to be called when an event
  10975. or class of events occurs in that widget.
  10976.  
  10977. A typical application consists of startup code followed by
  10978. an event loop that reads events and dispatches them by call-
  10979. ing the procedures that widgets have registered.  The
  10980. default event loop provided by the Intrinsics is
  10981. XtAppMainLoop.
  10982.  
  10983. The event manager is a collection of functions to perform
  10984. the following tasks:
  10985.  
  10986. o    Add or remove event sources other than X server events
  10987.      (in particular, timer interrupts, file input, or POSIX
  10988.      signals).
  10989.  
  10990. o    Query the status of event sources.
  10991.  
  10992. o    Add or remove procedures to be called when an event
  10993.      occurs for a particular widget.
  10994.  
  10995. o    Enable and disable the dispatching of user-initiated
  10996.      events (keyboard and pointer events) for a particular
  10997.      widget.
  10998.  
  10999. o    Constrain the dispatching of events to a cascade of
  11000.      pop-up widgets.
  11001.  
  11002. o    Register procedures to be called when specific events
  11003.      arrive.
  11004.  
  11005. o    Register procedures to be called when the Intrinsics
  11006.      will block.
  11007.  
  11008. o    Enable safe operation in a multi-threaded environment.
  11009.  
  11010. Most widgets do not need to call any of the event handler
  11011. functions explicitly.  The normal interface to X events is
  11012. through the higher-level translation manager, which maps
  11013. sequences of X events, with modifiers, into procedure calls.
  11014. Applications rarely use any of the event manager routines
  11015. besides XtAppMainLoop.
  11016.  
  11017.  
  11018.  
  11019.  
  11020.                  157
  11021.  
  11022.  
  11023.  
  11024.  
  11025.  
  11026. X Toolkit Intrinsics                 X11 Release 6.4
  11027.  
  11028.  
  11029. 7.1.  Adding and Deleting Additional Event Sources
  11030.  
  11031. While most applications are driven only by X events, some
  11032. applications need to incorporate other sources of input into
  11033. the Intrinsics event-handling mechanism.  The event manager
  11034. provides routines to integrate notification of timer events
  11035. and file data pending into this mechanism.
  11036.  
  11037. The next section describes functions that provide input
  11038. gathering from files.  The application registers the files
  11039. with the Intrinsics read routine.  When input is pending on
  11040. one of the files, the registered callback procedures are
  11041. invoked.
  11042.  
  11043.  
  11044. 7.1.1.    Adding and Removing Input Sources
  11045.  
  11046. To register a new file as an input source for a given appli-
  11047. cation context, use XtAppAddInput.
  11048.  
  11049. __
  11050. |
  11051. XtInputId XtAppAddInput(app_context, source, condition, proc, client_data)
  11052.       XtAppContext app_context;
  11053.       int source;
  11054.       XtPointer condition;
  11055.       XtInputCallbackProc proc;
  11056.       XtPointer client_data;
  11057.  
  11058.  
  11059. app_context
  11060.       Specifies the application context that identifies
  11061.       the application.
  11062.  
  11063. source      Specifies the source file descriptor on a POSIX-
  11064.       based system or other operating-system-dependent
  11065.       device specification.
  11066.  
  11067. condition Specifies the mask that indicates a read, write,
  11068.       or exception condition or some other operating-
  11069.       system-dependent condition.
  11070.  
  11071. proc      Specifies the procedure to be called when the con-
  11072.       dition is found.
  11073.  
  11074. client_data
  11075.       Specifies an argument passed to the specified pro-
  11076.       cedure when it is called.
  11077. |__
  11078.  
  11079. The XtAppAddInput function registers with the Intrinsics
  11080. read routine a new source of events, which is usually file
  11081. input but can also be file output.  Note that file should be
  11082. loosely interpreted to mean any sink or source of data.
  11083.  
  11084.  
  11085.  
  11086.                  158
  11087.  
  11088.  
  11089.  
  11090.  
  11091.  
  11092. X Toolkit Intrinsics                 X11 Release 6.4
  11093.  
  11094.  
  11095. XtAppAddInput also specifies the conditions under which the
  11096. source can generate events.  When an event is pending on
  11097. this source, the callback procedure is called.
  11098.  
  11099. The legal values for the condition argument are operating-
  11100. system-dependent.  On a POSIX-based system, source is a file
  11101. number and the condition is some union of the following:
  11102.  
  11103. XtInputReadMask
  11104.            Specifies that proc is to be called when
  11105.            source has data to be read.
  11106.  
  11107. XtInputWriteMask
  11108.            Specifies that proc is to be called when
  11109.            source is ready for writing.
  11110.  
  11111. XtInputExceptMask
  11112.            Specifies that proc is to be called when
  11113.            source has exception data.
  11114.  
  11115. Callback procedure pointers used to handle file events are
  11116. of type XtInputCallbackProc.
  11117.  
  11118. __
  11119. |
  11120. typedef void (*XtInputCallbackProc)(XtPointer, int*, XtInputId*);
  11121.       XtPointer client_data;
  11122.       int *source;
  11123.       XtInputId *id;
  11124.  
  11125.  
  11126. client_data
  11127.       Passes the client data argument that was regis-
  11128.       tered for this procedure in XtAppAddInput.
  11129.  
  11130. source      Passes the source file descriptor generating the
  11131.       event.
  11132.  
  11133. id      Passes the id returned from the corresponding
  11134.       XtAppAddInput call.
  11135. |__
  11136.  
  11137. See Section 7.12 for information regarding the use of XtAp-
  11138. pAddInput in multiple threads.
  11139.  
  11140.  
  11141. To discontinue a source of input, use XtRemoveInput.
  11142.  
  11143.  
  11144.  
  11145.  
  11146.  
  11147.  
  11148.  
  11149.  
  11150.  
  11151.  
  11152.                  159
  11153.  
  11154.  
  11155.  
  11156.  
  11157.  
  11158. X Toolkit Intrinsics                 X11 Release 6.4
  11159.  
  11160. __
  11161. |
  11162. void XtRemoveInput(id)
  11163.       XtInputId id;
  11164.  
  11165.  
  11166. id      Specifies the id returned from the corresponding
  11167.       XtAppAddInput call.
  11168. |__
  11169.  
  11170. The XtRemoveInput function causes the Intrinsics read rou-
  11171. tine to stop watching for events from the file source speci-
  11172. fied by id.
  11173.  
  11174. See Section 7.12 for information regarding the use of
  11175. XtRemoveInput in multiple threads.
  11176.  
  11177.  
  11178. 7.1.2.    Adding and Removing Blocking Notifications
  11179.  
  11180. Occasionally it is desirable for an application to receive
  11181. notification when the Intrinsics event manager detects no
  11182. pending input from file sources and no pending input from X
  11183. server event sources and is about to block in an operating
  11184. system call.
  11185.  
  11186.  
  11187. To register a hook that is called immediately prior to event
  11188. blocking, use XtAppAddBlockHook.
  11189.  
  11190. __
  11191. |
  11192. XtBlockHookId XtAppAddBlockHook(app_context, proc, client_data)
  11193.       XtAppContext app_context;
  11194.       XtBlockHookProc proc;
  11195.       XtPointer client_data;
  11196.  
  11197.  
  11198. app_context
  11199.       Specifies the application context that identifies
  11200.       the application.
  11201.  
  11202. proc      Specifies the procedure to be called before block-
  11203.       ing.
  11204.  
  11205. client_data
  11206.       Specifies an argument passed to the specified pro-
  11207.       cedure when it is called.
  11208. |__
  11209.  
  11210. The XtAppAddBlockHook function registers the specified pro-
  11211. cedure and returns an identifier for it.  The hook procedure
  11212. proc is called at any time in the future when the Intrinsics
  11213. are about to block pending some input.
  11214.  
  11215.  
  11216.  
  11217.  
  11218.                  160
  11219.  
  11220.  
  11221.  
  11222.  
  11223.  
  11224. X Toolkit Intrinsics                 X11 Release 6.4
  11225.  
  11226.  
  11227. The procedure pointers used to provide notification of event
  11228. blocking are of type XtBlockHookProc.
  11229.  
  11230. __
  11231. |
  11232. typedef void (*XtBlockHookProc)(XtPointer);
  11233.       XtPointer client_data;
  11234.  
  11235.  
  11236. client_data
  11237.       Passes the client data argument that was regis-
  11238.       tered for this procedure in XtAppAddBlockHook.
  11239. |__
  11240.  
  11241. To discontinue the use of a procedure for blocking notifica-
  11242. tion, use XtRemoveBlockHook.
  11243.  
  11244. __
  11245. |
  11246. void XtRemoveBlockHook(id)
  11247.       XtBlockHookId id;
  11248.  
  11249.  
  11250. id      Specifies the identifier returned from the corre-
  11251.       sponding call to XtAppAddBlockHook.
  11252. |__
  11253.  
  11254. The XtRemoveBlockHook function removes the specified proce-
  11255. dure from the list of procedures that are called by the
  11256. Intrinsics read routine before blocking on event sources.
  11257.  
  11258.  
  11259. 7.1.3.    Adding and Removing Timeouts
  11260.  
  11261. The timeout facility notifies the application or the widget
  11262. through a callback procedure that a specified time interval
  11263. has elapsed.  Timeout values are uniquely identified by an
  11264. interval id.
  11265.  
  11266.  
  11267. To register a timeout callback, use XtAppAddTimeOut.
  11268.  
  11269.  
  11270.  
  11271.  
  11272.  
  11273.  
  11274.  
  11275.  
  11276.  
  11277.  
  11278.  
  11279.  
  11280.  
  11281.  
  11282.  
  11283.  
  11284.                  161
  11285.  
  11286.  
  11287.  
  11288.  
  11289.  
  11290. X Toolkit Intrinsics                 X11 Release 6.4
  11291.  
  11292. __
  11293. |
  11294. XtIntervalId XtAppAddTimeOut(app_context, interval, proc, client_data)
  11295.       XtAppContext app_context;
  11296.       unsigned long interval;
  11297.       XtTimerCallbackProc proc;
  11298.       XtPointer client_data;
  11299.  
  11300.  
  11301. app_context
  11302.       Specifies the application context for which the
  11303.       timer is to be set.
  11304.  
  11305. interval  Specifies the time interval in milliseconds.
  11306.  
  11307. proc      Specifies the procedure to be called when the time
  11308.       expires.
  11309.  
  11310. client_data
  11311.       Specifies an argument passed to the specified pro-
  11312.       cedure when it is called.
  11313. |__
  11314.  
  11315. The XtAppAddTimeOut function creates a timeout and returns
  11316. an identifier for it.  The timeout value is set to interval.
  11317. The callback procedure proc is called when XtAppNextEvent or
  11318. XtAppProcessEvent is next called after the time interval
  11319. elapses, and then the timeout is removed.
  11320.  
  11321. Callback procedure pointers used with timeouts are of type
  11322. XtTimerCallbackProc.
  11323.  
  11324. __
  11325. |
  11326. typedef void (*XtTimerCallbackProc)(XtPointer, XtIntervalId*);
  11327.       XtPointer client_data;
  11328.       XtIntervalId *timer;
  11329.  
  11330.  
  11331. client_data
  11332.       Passes the client data argument that was regis-
  11333.       tered for this procedure in XtAppAddTimeOut.
  11334.  
  11335. timer      Passes the id returned from the corresponding
  11336.       XtAppAddTimeOut call.
  11337. |__
  11338.  
  11339. See Section 7.12 for information regarding the use of XtAp-
  11340. pAddTimeOut in multiple threads.
  11341.  
  11342.  
  11343. To clear a timeout value, use XtRemoveTimeOut.
  11344.  
  11345.  
  11346.  
  11347.  
  11348.  
  11349.  
  11350.                  162
  11351.  
  11352.  
  11353.  
  11354.  
  11355.  
  11356. X Toolkit Intrinsics                 X11 Release 6.4
  11357.  
  11358. __
  11359. |
  11360. void XtRemoveTimeOut(timer)
  11361.       XtIntervalId timer;
  11362.  
  11363.  
  11364. timer      Specifies the id for the timeout request to be
  11365.       cleared.
  11366. |__
  11367.  
  11368. The XtRemoveTimeOut function removes the pending timeout.
  11369. Note that timeouts are automatically removed once they trig-
  11370. ger.
  11371.  
  11372. Please refer to Section 7.12 for information regarding the
  11373. use of XtRemoveTimeOut in multiple threads.
  11374.  
  11375.  
  11376. 7.1.4.    Adding and Removing Signal Callbacks
  11377.  
  11378. The signal facility notifies the application or the widget
  11379. through a callback procedure that a signal or other external
  11380. asynchronous event has occurred.  The registered callback
  11381. procedures are uniquely identified by a signal id.
  11382.  
  11383.  
  11384. Prior to establishing a signal handler, the application or
  11385. widget should call XtAppAddSignal and store the resulting
  11386. identifier in a place accessible to the signal handler.
  11387. When a signal arrives, the signal handler should call XtNo-
  11388. ticeSignal to notify the Intrinsics that a signal has
  11389. occured.  To register a signal callback use XtAppAddSignal.
  11390.  
  11391. __
  11392. |
  11393. XtSignalId XtAppAddSignal(app_context, proc, client_data)
  11394.       XtAppContext app_context;
  11395.       XtSignalCallbackProc proc;
  11396.       XtPointer client_data;
  11397.  
  11398.  
  11399. app_context
  11400.       Specifies the application context that identifies
  11401.       the application.
  11402.  
  11403. proc      Specifies the procedure to be called when the sig-
  11404.       nal is noticed.
  11405.  
  11406. client_data
  11407.       Specifies an argument passed to the specified pro-
  11408.       cedure when it is called.
  11409. |__
  11410.  
  11411. The callback procedure pointers used to handle signal events
  11412. are of type XtSignalCallbackProc.
  11413.  
  11414.  
  11415.  
  11416.                  163
  11417.  
  11418.  
  11419.  
  11420.  
  11421.  
  11422. X Toolkit Intrinsics                 X11 Release 6.4
  11423.  
  11424. __
  11425. |
  11426. typedef void (*XtSignalCallbackProc)(XtPointer, XtSignalId*);
  11427.      XtPointer client_data;
  11428.      XtSignalId *id;
  11429.  
  11430.  
  11431. client_data
  11432.       Passes the client data argument that was regis-
  11433.       tered for this procedure in XtAppAddSignal.
  11434.  
  11435. id      Passes the id returned from the corresponding
  11436.       XtAppAddSignal call.
  11437. |__
  11438.  
  11439. To notify the Intrinsics that a signal has occured, use
  11440. XtNoticeSignal.
  11441.  
  11442.  
  11443. __
  11444. |
  11445. void XtNoticeSignal(id)
  11446.       XtSignalId id;
  11447.  
  11448.  
  11449. id      Specifies the id returned from the corresponding
  11450.       XtAppAddSignal call.
  11451. |__
  11452.  
  11453. On a POSIX-based system, XtNoticeSignal is the only Intrin-
  11454. sics function that can safely be called from a signal han-
  11455. dler.  If XtNoticeSignal is invoked multiple times before
  11456. the Intrinsics are able to invoke the registered callback,
  11457. the callback is only called once.  Logically, the Intrinsics
  11458. maintain ``pending'' flag for each registered callback.
  11459. This flag is initially False and is set to True by
  11460. XtNoticeSignal.  When XtAppNextEvent or XtAppProcessEvent
  11461. (with a mask including XtIMSignal) is called, all registered
  11462. callbacks with ``pending'' True are invoked and the flags
  11463. are reset to False.
  11464.  
  11465. If the signal handler wants to track how many times the sig-
  11466. nal has been raised, it can keep its own private counter.
  11467. Typically the handler would not do any other work; the call-
  11468. back does the actual processing for the signal. The Intrin-
  11469. sics never block signals from being raised, so if a given
  11470. signal can be raised multiple times before the Intrinsics
  11471. can invoke the callback for that signal, the callback must
  11472. be designed to deal with this.    In another case, a signal
  11473. might be raised just after the Intrinsics sets the pending
  11474. flag to False but before the callback can get control, in
  11475. which case the pending flag will still be True after the
  11476. callback returns, and the Intrinsics will invoke the call-
  11477. back again, even though all of the signal raises have been
  11478. handled.  The callback must also be prepared to handle this
  11479.  
  11480.  
  11481.  
  11482.                  164
  11483.  
  11484.  
  11485.  
  11486.  
  11487.  
  11488. X Toolkit Intrinsics                 X11 Release 6.4
  11489.  
  11490.  
  11491. case.
  11492.  
  11493. To remove a registered signal callback, call XtRemoveSignal.
  11494.  
  11495. __
  11496. |
  11497. void XtRemoveSignal(id)
  11498.       XtSignalId id;
  11499.  
  11500.  
  11501. id      Specifies the id returned by the corresponding
  11502.       call to XtAppAddSignal.
  11503. |__
  11504.  
  11505. The client should typically disable the source of the signal
  11506. before calling XtRemoveSignal.    If the signal could have
  11507. been raised again before the source was disabled and the
  11508. client wants to process it, then after disabling the source
  11509. but before calling XtRemoveSignal the client can test for
  11510. signals with XtAppPending and process them by calling XtApp-
  11511. ProcessEvent with the mask XtIMSignal.
  11512.  
  11513.  
  11514. 7.2.  Constraining Events to a Cascade of Widgets
  11515.  
  11516. Modal widgets are widgets that, except for the input
  11517. directed to them, lock out user input to the application.
  11518.  
  11519. When a modal menu or modal dialog box is popped up using
  11520. XtPopup, user events (keyboard and pointer events) that
  11521. occur outside the modal widget should be delivered to the
  11522. modal widget or ignored.  In no case will user events be
  11523. delivered to a widget outside the modal widget.
  11524.  
  11525. Menus can pop up submenus, and dialog boxes can pop up fur-
  11526. ther dialog boxes to create a pop-up cascade.  In this case,
  11527. user events may be delivered to one of several modal widgets
  11528. in the cascade.
  11529.  
  11530. Display-related events should be delivered outside the modal
  11531. cascade so that exposure events and the like keep the appli-
  11532. cation's display up-to-date.  Any event that occurs within
  11533. the cascade is delivered as usual.  The user events deliv-
  11534. ered to the most recent spring-loaded shell in the cascade
  11535. when they occur outside the cascade are called remap events
  11536. and are KeyPress, KeyRelease, ButtonPress, and
  11537. ButtonRelease.    The user events ignored when they occur out-
  11538. side the cascade are MotionNotify and EnterNotify.  All
  11539. other events are delivered normally.  In particular, note
  11540. that this is one way in which widgets can receive LeaveNo-
  11541. tify events without first receiving EnterNotify events; they
  11542. should be prepared to deal with this, typically by ignoring
  11543. any unmatched LeaveNotify events.
  11544.  
  11545.  
  11546.  
  11547.  
  11548.                  165
  11549.  
  11550.  
  11551.  
  11552.  
  11553.  
  11554. X Toolkit Intrinsics                 X11 Release 6.4
  11555.  
  11556.  
  11557. XtPopup uses the XtAddGrab and XtRemoveGrab functions to
  11558. constrain user events to a modal cascade and subsequently to
  11559. remove a grab when the modal widget is popped down.
  11560.  
  11561.  
  11562.  
  11563. To constrain or redirect user input to a modal widget, use
  11564. XtAddGrab.
  11565.  
  11566. __
  11567. |
  11568. void XtAddGrab(w, exclusive, spring_loaded)
  11569.       Widget w;
  11570.       Boolean exclusive;
  11571.       Boolean spring_loaded;
  11572.  
  11573.  
  11574. w      Specifies the widget to add to the modal cascade.
  11575.       Must be of class Core or any subclass thereof.
  11576.  
  11577. exclusive Specifies whether user events should be dispatched
  11578.       exclusively to this widget or also to previous
  11579.       widgets in the cascade.
  11580.  
  11581. spring_loaded
  11582.       Specifies whether this widget was popped up
  11583.       because the user pressed a pointer button.
  11584. |__
  11585.  
  11586. The XtAddGrab function appends the widget to the modal cas-
  11587. cade and checks that exclusive is True if spring_loaded is
  11588. True.  If this condition is not met, XtAddGrab generates a
  11589. warning message.
  11590.  
  11591. The modal cascade is used by XtDispatchEvent when it tries
  11592. to dispatch a user event.  When at least one modal widget is
  11593. in the widget cascade, XtDispatchEvent first determines if
  11594. the event should be delivered.    It starts at the most recent
  11595. cascade entry and follows the cascade up to and including
  11596. the most recent cascade entry added with the exclusive
  11597. parameter True.
  11598.  
  11599. This subset of the modal cascade along with all descendants
  11600. of these widgets comprise the active subset.  User events
  11601. that occur outside the widgets in this subset are ignored or
  11602. remapped.  Modal menus with submenus generally add a submenu
  11603. widget to the cascade with exclusive False.  Modal dialog
  11604. boxes that need to restrict user input to the most deeply
  11605. nested dialog box add a subdialog widget to the cascade with
  11606. exclusive True.  User events that occur within the active
  11607. subset are delivered to the appropriate widget, which is
  11608. usually a child or further descendant of the modal widget.
  11609.  
  11610.  
  11611.  
  11612.  
  11613.  
  11614.                  166
  11615.  
  11616.  
  11617.  
  11618.  
  11619.  
  11620. X Toolkit Intrinsics                 X11 Release 6.4
  11621.  
  11622.  
  11623. Regardless of where in the application they occur, remap
  11624. events are always delivered to the most recent widget in the
  11625. active subset of the cascade registered with spring_loaded
  11626. True, if any such widget exists.  If the event occurred in
  11627. the active subset of the cascade but outside the spring-
  11628. loaded widget, it is delivered normally before being deliv-
  11629. ered also to the spring-loaded widget.    Regardless of where
  11630. it is dispatched, the Intrinsics do not modify the contents
  11631. of the event.
  11632.  
  11633.  
  11634. To remove the redirection of user input to a modal widget,
  11635. use XtRemoveGrab.
  11636.  
  11637. __
  11638. |
  11639. void XtRemoveGrab(w)
  11640.       Widget w;
  11641.  
  11642.  
  11643. w      Specifies the widget to remove from the modal cas-
  11644.       cade.
  11645. |__
  11646.  
  11647. The XtRemoveGrab function removes widgets from the modal
  11648. cascade starting at the most recent widget up to and includ-
  11649. ing the specified widget.  It issues a warning if the speci-
  11650. fied widget is not on the modal cascade.
  11651.  
  11652.  
  11653. 7.2.1.    Requesting Key and Button Grabs
  11654.  
  11655. The Intrinsics provide a set of key and button grab inter-
  11656. faces that are parallel to those provided by Xlib and that
  11657. allow the Intrinsics to modify event dispatching when neces-
  11658. sary.  X Toolkit applications and widgets that need to pas-
  11659. sively grab keys or buttons or actively grab the keyboard or
  11660. pointer should use the following Intrinsics routines rather
  11661. than the corresponding Xlib routines.
  11662.  
  11663.  
  11664. To passively grab a single key of the keyboard, use
  11665. XtGrabKey.
  11666.  
  11667.  
  11668.  
  11669.  
  11670.  
  11671.  
  11672.  
  11673.  
  11674.  
  11675.  
  11676.  
  11677.  
  11678.  
  11679.  
  11680.                  167
  11681.  
  11682.  
  11683.  
  11684.  
  11685.  
  11686. X Toolkit Intrinsics                 X11 Release 6.4
  11687.  
  11688. __
  11689. |
  11690. void XtGrabKey(widget, keycode, modifiers, owner_events, pointer_mode, keyboard_mode)
  11691.       Widget widget;
  11692.       KeyCode keycode;
  11693.       Modifiers modifiers;
  11694.       Boolean owner_events;
  11695.       int pointer_mode, keyboard_mode;
  11696.  
  11697.  
  11698. widget      Specifies the widget in whose window the key is to
  11699.       be grabbed.  Must be of class Core or any subclass
  11700.       thereof.
  11701.  
  11702. keycode
  11703.  
  11704. modifiers
  11705.  
  11706. owner_events
  11707.  
  11708. pointer_mode
  11709.  
  11710. keyboard_mode
  11711.       Specify arguments to XGrabKey; see Section 12.2 in
  11712.       Xlib -- C Language X Interface.
  11713. |__
  11714.  
  11715. XtGrabKey calls XGrabKey specifying the widget's window as
  11716. the grab window if the widget is realized.  The remaining
  11717. arguments are exactly as for XGrabKey.    If the widget is not
  11718. realized, or is later unrealized, the call to XGrabKey is
  11719. performed (again) when the widget is realized and its window
  11720. becomes mapped.  In the future, if XtDispatchEvent is called
  11721. with a KeyPress event matching the specified keycode and
  11722. modifiers (which may be AnyKey or AnyModifier, respectively)
  11723. for the widget's window, the Intrinsics will call XtUn-
  11724. grabKeyboard with the timestamp from the KeyPress event if
  11725. either of the following conditions is true:
  11726.  
  11727. o  There is a modal cascade and the widget is not in the
  11728.    active subset of the cascade and the keyboard was not
  11729.    previously grabbed, or
  11730.  
  11731. o  XFilterEvent returns True.
  11732.  
  11733.  
  11734.  
  11735. To cancel a passive key grab, use XtUngrabKey.
  11736.  
  11737.  
  11738.  
  11739.  
  11740.  
  11741.  
  11742.  
  11743.  
  11744.  
  11745.  
  11746.                  168
  11747.  
  11748.  
  11749.  
  11750.  
  11751.  
  11752. X Toolkit Intrinsics                 X11 Release 6.4
  11753.  
  11754. __
  11755. |
  11756. void XtUngrabKey(widget, keycode, modifiers)
  11757.       Widget widget;
  11758.       KeyCode keycode;
  11759.       Modifiers modifiers;
  11760.  
  11761.  
  11762. widget      Specifies the widget in whose window the key was
  11763.       grabbed.
  11764.  
  11765. keycode
  11766.  
  11767. modifiers Specify arguments to XUngrabKey; see Section 12.2
  11768.       in Xlib -- C Language X Interface.
  11769. |__
  11770.  
  11771. The XtUngrabKey procedure calls XUngrabKey specifying the
  11772. widget's window as the ungrab window if the widget is real-
  11773. ized.  The remaining arguments are exactly as for
  11774. XUngrabKey.  If the widget is not realized, XtUngrabKey
  11775. removes a deferred XtGrabKey request, if any, for the speci-
  11776. fied widget, keycode, and modifiers.
  11777.  
  11778.  
  11779. To actively grab the keyboard, use XtGrabKeyboard.
  11780.  
  11781. __
  11782. |
  11783. int XtGrabKeyboard(widget, owner_events, pointer_mode, keyboard_mode, time)
  11784.       Widget widget;
  11785.       Boolean owner_events;
  11786.       int pointer_mode, keyboard_mode;
  11787.       Time time;
  11788.  
  11789.  
  11790. widget      Specifies the widget for whose window the keyboard
  11791.       is to be grabbed.  Must be of class Core or any
  11792.       subclass thereof.
  11793.  
  11794. owner_events
  11795.  
  11796. pointer_mode
  11797.  
  11798. keyboard_mode
  11799.  
  11800. time      Specify arguments to XGrabKeyboard; see Section
  11801.       12.2 in Xlib -- C Language X Interface.
  11802. |__
  11803.  
  11804. If the specified widget is realized, XtGrabKeyboard calls
  11805. XGrabKeyboard specifying the widget's window as the grab
  11806. window.  The remaining arguments and return value are
  11807. exactly as for XGrabKeyboard.  If the widget is not real-
  11808. ized, XtGrabKeyboard immediately returns GrabNotViewable.
  11809.  
  11810.  
  11811.  
  11812.                  169
  11813.  
  11814.  
  11815.  
  11816.  
  11817.  
  11818. X Toolkit Intrinsics                 X11 Release 6.4
  11819.  
  11820.  
  11821. No future automatic ungrab is implied by XtGrabKeyboard.
  11822.  
  11823.  
  11824. To cancel an active keyboard grab, use XtUngrabKeyboard.
  11825.  
  11826. __
  11827. |
  11828. void XtUngrabKeyboard(widget, time)
  11829.       Widget widget;
  11830.       Time time;
  11831.  
  11832.  
  11833. widget      Specifies the widget that has the active keyboard
  11834.       grab.
  11835.  
  11836. time      Specifies the additional argument to
  11837.       XUngrabKeyboard; see Section 12.2 in Xlib -- C
  11838.       Language X Interface.
  11839. |__
  11840.  
  11841. XtUngrabKeyboard calls XUngrabKeyboard with the specified
  11842. time.
  11843.  
  11844.  
  11845. To passively grab a single pointer button, use XtGrabButton.
  11846.  
  11847.  
  11848.  
  11849.  
  11850.  
  11851.  
  11852.  
  11853.  
  11854.  
  11855.  
  11856.  
  11857.  
  11858.  
  11859.  
  11860.  
  11861.  
  11862.  
  11863.  
  11864.  
  11865.  
  11866.  
  11867.  
  11868.  
  11869.  
  11870.  
  11871.  
  11872.  
  11873.  
  11874.  
  11875.  
  11876.  
  11877.  
  11878.                  170
  11879.  
  11880.  
  11881.  
  11882.  
  11883.  
  11884. X Toolkit Intrinsics                 X11 Release 6.4
  11885.  
  11886. __
  11887. |
  11888. void XtGrabButton(widget, button, modifiers, owner_events, event_mask, pointer_mode,
  11889.           keyboard_mode, confine_to, cursor)
  11890.       Widget widget;
  11891.       int button;
  11892.       Modifiers modifiers;
  11893.       Boolean owner_events;
  11894.       unsigned int event_mask;
  11895.       int pointer_mode, keyboard_mode;
  11896.       Window confine_to;
  11897.       Cursor cursor;
  11898.  
  11899.  
  11900. widget      Specifies the widget in whose window the button is
  11901.       to be grabbed.  Must be of class Core or any sub-
  11902.       class thereof.
  11903.  
  11904. button
  11905.  
  11906. modifiers
  11907.  
  11908. owner_events
  11909.  
  11910. event_mask
  11911.  
  11912. pointer_mode
  11913.  
  11914. keyboard_mode
  11915.  
  11916. confine_to
  11917.  
  11918. cursor      Specify arguments to XGrabButton; see Section 12.1
  11919.       in Xlib -- C Language X Interface.
  11920. |__
  11921.  
  11922. XtGrabButton calls XGrabButton specifying the widget's win-
  11923. dow as the grab window if the widget is realized.  The
  11924. remaining arguments are exactly as for XGrabButton.  If the
  11925. widget is not realized, or is later unrealized, the call to
  11926. XGrabButton is performed (again) when the widget is realized
  11927. and its window becomes mapped.    In the future, if XtDis-
  11928. patchEvent is called with a ButtonPress event matching the
  11929. specified button and modifiers (which may be AnyButton or
  11930. AnyModifier, respectively) for the widget's window, the
  11931. Intrinsics will call XtUngrabPointer with the timestamp from
  11932. the ButtonPress event if either of the following conditions
  11933. is true:
  11934.  
  11935. o  There is a modal cascade and the widget is not in the
  11936.    active subset of the cascade and the pointer was not pre-
  11937.    viously grabbed, or
  11938.  
  11939. o  XFilterEvent returns True.
  11940.  
  11941.  
  11942.  
  11943.  
  11944.                  171
  11945.  
  11946.  
  11947.  
  11948.  
  11949.  
  11950. X Toolkit Intrinsics                 X11 Release 6.4
  11951.  
  11952.  
  11953. To cancel a passive button grab, use XtUngrabButton.
  11954.  
  11955. __
  11956. |
  11957. void XtUngrabButton(widget, button, modifiers)
  11958.       Widget widget;
  11959.       unsigned int button;
  11960.       Modifiers modifiers;
  11961.  
  11962.  
  11963. widget      Specifies the widget in whose window the button
  11964.       was grabbed.
  11965.  
  11966. button
  11967.  
  11968. modifiers Specify arguments to XUngrabButton; see Section
  11969.       12.1 in Xlib -- C Language X Interface.
  11970. |__
  11971.  
  11972. The XtUngrabButton procedure calls XUngrabButton specifying
  11973. the widget's window as the ungrab window if the widget is
  11974. realized.  The remaining arguments are exactly as for
  11975. XUngrabButton.    If the widget is not realized, XtUngrabBut-
  11976. ton removes a deferred XtGrabButton request, if any, for the
  11977. specified widget, button, and modifiers.
  11978.  
  11979.  
  11980. To actively grab the pointer, use XtGrabPointer.
  11981.  
  11982.  
  11983.  
  11984.  
  11985.  
  11986.  
  11987.  
  11988.  
  11989.  
  11990.  
  11991.  
  11992.  
  11993.  
  11994.  
  11995.  
  11996.  
  11997.  
  11998.  
  11999.  
  12000.  
  12001.  
  12002.  
  12003.  
  12004.  
  12005.  
  12006.  
  12007.  
  12008.  
  12009.  
  12010.                  172
  12011.  
  12012.  
  12013.  
  12014.  
  12015.  
  12016. X Toolkit Intrinsics                 X11 Release 6.4
  12017.  
  12018. __
  12019. |
  12020. int XtGrabPointer(widget, owner_events, event_mask, pointer_mode, keyboard_mode,
  12021.           confine_to, cursor, time)
  12022.       Widget widget;
  12023.       Boolean owner_events;
  12024.       unsigned int event_mask;
  12025.       int pointer_mode, keyboard_mode;
  12026.       Window confine_to;
  12027.       Cursor cursor;
  12028.       Time time;
  12029.  
  12030.  
  12031. widget      Specifies the widget for whose window the pointer
  12032.       is to be grabbed.  Must be of class Core or any
  12033.       subclass thereof.
  12034.  
  12035. owner_events
  12036.  
  12037. event_mask
  12038.  
  12039. pointer_mode
  12040.  
  12041. keyboard_mode
  12042.  
  12043. confine_to
  12044.  
  12045. cursor
  12046.  
  12047. time      Specify arguments to XGrabPointer; see Section
  12048.       12.1 in Xlib -- C Language X Interface.
  12049. |__
  12050.  
  12051. If the specified widget is realized, XtGrabPointer calls
  12052. XGrabPointer, specifying the widget's window as the grab
  12053. window.  The remaining arguments and return value are
  12054. exactly as for XGrabPointer.  If the widget is not realized,
  12055. XtGrabPointer immediately returns GrabNotViewable.  No
  12056. future automatic ungrab is implied by XtGrabPointer.
  12057.  
  12058.  
  12059. To cancel an active pointer grab, use XtUngrabPointer.
  12060.  
  12061.  
  12062.  
  12063.  
  12064.  
  12065.  
  12066.  
  12067.  
  12068.  
  12069.  
  12070.  
  12071.  
  12072.  
  12073.  
  12074.  
  12075.  
  12076.                  173
  12077.  
  12078.  
  12079.  
  12080.  
  12081.  
  12082. X Toolkit Intrinsics                 X11 Release 6.4
  12083.  
  12084. __
  12085. |
  12086. void XtUngrabPointer(widget, time)
  12087.       Widget widget;
  12088.       Time time;
  12089.  
  12090.  
  12091. widget      Specifies the widget that has the active pointer
  12092.       grab.
  12093.  
  12094. time      Specifies the time argument to XUngrabPointer; see
  12095.       Section 12.1 in Xlib -- C Language X Interface.
  12096. |__
  12097.  
  12098. XtUngrabPointer calls XUngrabPointer with the specified
  12099. time.
  12100.  
  12101.  
  12102. 7.3.  Focusing Events on a Child
  12103.  
  12104. To redirect keyboard input to a normal descendant of a wid-
  12105. get without calling XSetInputFocus, use XtSetKeyboardFocus.
  12106.  
  12107. __
  12108. |
  12109. void XtSetKeyboardFocus(subtree descendant)
  12110.      Widget subtree, descendant;
  12111.  
  12112.  
  12113. subtree   Specifies the subtree of the hierarchy for which
  12114.       the keyboard focus is to be set.  Must be of class
  12115.       Core or any subclass thereof.
  12116.  
  12117. descendant
  12118.       Specifies either the normal (non-pop-up) descen-
  12119.       dant of subtree to which keyboard events are logi-
  12120.       cally directed, or None.  It is not an error to
  12121.       specify None when no input focus was previously
  12122.       set.    Must be of class Object or any subclass
  12123.       thereof.
  12124. |__
  12125.  
  12126. XtSetKeyboardFocus causes XtDispatchEvent to remap keyboard
  12127. events occurring within the specified subtree and dispatch
  12128. them to the specified descendant widget or to an ancestor.
  12129. If the descendant's class is not a subclass of Core, the
  12130. descendant is replaced by its closest windowed ancestor.
  12131.  
  12132. When there is no modal cascade, keyboard events can be dis-
  12133. patched to a widget in one of five ways.  Assume the server
  12134. delivered the event to the window for widget E (because of X
  12135. input focus, key or keyboard grabs, or pointer position).
  12136.  
  12137. o  If neither E nor any of E's ancestors have redirected the
  12138.    keyboard focus, or if the event activated a grab for E as
  12139.  
  12140.  
  12141.  
  12142.                  174
  12143.  
  12144.  
  12145.  
  12146.  
  12147.  
  12148. X Toolkit Intrinsics                 X11 Release 6.4
  12149.  
  12150.  
  12151.    specified by a call to XtGrabKey with any value of
  12152.    owner_events, or if the keyboard is actively grabbed by E
  12153.    with owner_events False via XtGrabKeyboard or XtGrabKey
  12154.    on a previous key press, the event is dispatched to E.
  12155.  
  12156. o  Beginning with the ancestor of E closest to the root that
  12157.    has redirected the keyboard focus or E if no such ances-
  12158.    tor exists, if the target of that focus redirection has
  12159.    in turn redirected the keyboard focus, recursively follow
  12160.    this focus chain to find a widget F that has not redi-
  12161.    rected focus.
  12162.  
  12163.    -  If E is the final focus target widget F or a descen-
  12164.       dant of F, the event is dispatched to E.
  12165.  
  12166.    -  If E is not F, an ancestor of F, or a descendant of F,
  12167.       and the event activated a grab for E as specified by a
  12168.       call to XtGrabKey for E, XtUngrabKeyboard is called.
  12169.  
  12170.    -  If E is an ancestor of F, and the event is a key
  12171.       press, and either
  12172.  
  12173.       +  E has grabbed the key with XtGrabKey and
  12174.      owner_events False, or
  12175.  
  12176.       +  E has grabbed the key with XtGrabKey and
  12177.      owner_events True, and the coordinates of the event
  12178.      are outside the rectangle specified by E's geome-
  12179.      try,
  12180.       then the event is dispatched to E.
  12181.  
  12182.    -  Otherwise, define A as the closest common ancestor of
  12183.       E and F:
  12184.  
  12185.       +  If there is an active keyboard grab for any widget
  12186.      via either XtGrabKeyboard or XtGrabKey on a previ-
  12187.      ous key press, or if no widget between F and A
  12188.      (noninclusive) has grabbed the key and modifier
  12189.      combination with XtGrabKey and any value of
  12190.      owner_events, the event is dispatched to F.
  12191.  
  12192.       +  Else, the event is dispatched to the ancestor of F
  12193.      closest to A that has grabbed the key and modifier
  12194.      combination with XtGrabKey.
  12195.  
  12196. When there is a modal cascade, if the final destination wid-
  12197. get as identified above is in the active subset of the cas-
  12198. cade, the event is dispatched; otherwise the event is
  12199. remapped to a spring-loaded shell or discarded.  Regardless
  12200. of where it is dispatched, the Intrinsics do not modify the
  12201. contents of the event.
  12202.  
  12203. When subtree or one of its descendants acquires the X input
  12204. focus or the pointer moves into the subtree such that
  12205.  
  12206.  
  12207.  
  12208.                  175
  12209.  
  12210.  
  12211.  
  12212.  
  12213.  
  12214. X Toolkit Intrinsics                 X11 Release 6.4
  12215.  
  12216.  
  12217. keyboard events would now be delivered to the subtree, a
  12218. FocusIn event is generated for the descendant if FocusChange
  12219. events have been selected by the descendant.  Similarly,
  12220. when subtree loses the X input focus or the keyboard focus
  12221. for one of its ancestors, a FocusOut event is generated for
  12222. descendant if FocusChange events have been selected by the
  12223. descendant.
  12224.  
  12225.  
  12226. A widget tree may also actively manage the X server input
  12227. focus.    To do so, a widget class specifies an accept_focus
  12228. procedure.
  12229.  
  12230. The accept_focus procedure pointer is of type
  12231. XtAcceptFocusProc.
  12232.  
  12233. __
  12234. |
  12235. typedef Boolean (*XtAcceptFocusProc)(Widget, Time*);
  12236.       Widget w;
  12237.       Time *time;
  12238.  
  12239.  
  12240. w      Specifies the widget.
  12241.  
  12242. time      Specifies the X time of the event causing the
  12243.       accept focus.
  12244. |__
  12245.  
  12246. Widgets that need the input focus can call XSetInputFocus
  12247. explicitly, pursuant to the restrictions of the Inter-Client
  12248. Communication Conventions Manual.  To allow outside agents,
  12249. such as the parent, to cause a widget to take the input
  12250. focus, every widget exports an accept_focus procedure.    The
  12251. widget returns a value indicating whether it actually took
  12252. the focus or not, so that the parent can give the focus to
  12253. another widget.  Widgets that need to know when they lose
  12254. the input focus must use the Xlib focus notification mecha-
  12255. nism explicitly (typically by specifying translations for
  12256. FocusIn and FocusOut events).  Widgets classes that never
  12257. want the input focus should set the accept_focus field to
  12258. NULL.
  12259.  
  12260.  
  12261. To call a widget's accept_focus procedure, use
  12262. XtCallAcceptFocus.
  12263.  
  12264.  
  12265.  
  12266.  
  12267.  
  12268.  
  12269.  
  12270.  
  12271.  
  12272.  
  12273.  
  12274.                  176
  12275.  
  12276.  
  12277.  
  12278.  
  12279.  
  12280. X Toolkit Intrinsics                 X11 Release 6.4
  12281.  
  12282. __
  12283. |
  12284. Boolean XtCallAcceptFocus(w, time)
  12285.        Widget w;
  12286.        Time *time;
  12287.  
  12288.  
  12289. w      Specifies the widget.  Must be of class Core or
  12290.       any subclass thereof.
  12291.  
  12292. time      Specifies the X time of the event that is causing
  12293.       the focus change.
  12294. |__
  12295.  
  12296. The XtCallAcceptFocus function calls the specified widget's
  12297. accept_focus procedure, passing it the specified widget and
  12298. time, and returns what the accept_focus procedure returns.
  12299. If accept_focus is NULL, XtCallAcceptFocus returns False.
  12300.  
  12301.  
  12302. 7.3.1.    Events for Drawables That Are Not a Widget's Window
  12303.  
  12304. Sometimes an application must handle events for drawables
  12305. that are not associated with widgets in its widget tree.
  12306. Examples include handling GraphicsExpose and NoExpose events
  12307. on Pixmaps, and handling PropertyNotify events on the root
  12308. window.
  12309.  
  12310. To register a drawable with the Intrinsics event dispatch-
  12311. ing, use XtRegisterDrawable.
  12312.  
  12313. __
  12314. |
  12315. void XtRegisterDrawable(display, drawable, widget)
  12316.       Display *display;
  12317.       Drawable drawable;
  12318.       Widget widget;
  12319.  
  12320.  
  12321. display   Specifies the drawable's display.
  12322.  
  12323. drawable  Specifies the drawable to register.
  12324.  
  12325. widget      Specifies the widget to register the drawable for.
  12326. |__
  12327.  
  12328. XtRegisterDrawable associates the specified drawable with
  12329. the specified widget so that future calls to XtWindowToWid-
  12330. get with the drawable will return the widget.  The default
  12331. event dispatcher will dispatch future events that arrive for
  12332. the drawable to the widget in the same manner as events that
  12333. contain the widget's window.
  12334.  
  12335. If the drawable is already registered with another widget,
  12336. or if the drawable is the window of a widget in the client's
  12337.  
  12338.  
  12339.  
  12340.                  177
  12341.  
  12342.  
  12343.  
  12344.  
  12345.  
  12346. X Toolkit Intrinsics                 X11 Release 6.4
  12347.  
  12348.  
  12349. widget tree, the results of calling XtRegisterDrawable are
  12350. undefined.
  12351.  
  12352.  
  12353. To unregister a drawable with the Intrinsics event dispatch-
  12354. ing, use XtUnregisterDrawable.
  12355.  
  12356. __
  12357. |
  12358. void XtUnregisterDrawable(display, drawable)
  12359.       Display *display;
  12360.       Drawable drawable;
  12361.  
  12362.  
  12363. display   Specifies the drawable's display.
  12364.  
  12365. drawable  Specifies the drawable to unregister.
  12366. |__
  12367.  
  12368. XtUnregisterDrawable removes an association created with
  12369. XtRegisterDrawable.  If the drawable is the window of a wid-
  12370. get in the client's widget tree the results of calling XtUn-
  12371. registerDrawable are undefined.
  12372.  
  12373.  
  12374. 7.4.  Querying Event Sources
  12375.  
  12376. The event manager provides several functions to examine and
  12377. read events (including file and timer events) that are in
  12378. the queue.  The next three functions are Intrinsics equiva-
  12379. lents of the XPending, XPeekEvent, and XNextEvent Xlib
  12380. calls.
  12381.  
  12382.  
  12383. To determine if there are any events on the input queue for
  12384. a given application, use XtAppPending.
  12385.  
  12386. __
  12387. |
  12388. XtInputMask XtAppPending(app_context)
  12389.       XtAppContext app_context;
  12390.  
  12391.  
  12392. app_context
  12393.       Specifies the application context that identifies
  12394.       the application to check.
  12395. |__
  12396.  
  12397. The XtAppPending function returns a nonzero value if there
  12398. are events pending from the X server, timer pending, other
  12399. input sources pending, or signal sources pending.  The value
  12400. returned is a bit mask that is the OR of XtIMXEvent,
  12401. XtIMTimer, XtIMAlternateInput, and XtIMSignal (see
  12402. XtAppProcessEvent).  If there are no events pending,
  12403.  
  12404.  
  12405.  
  12406.                  178
  12407.  
  12408.  
  12409.  
  12410.  
  12411.  
  12412. X Toolkit Intrinsics                 X11 Release 6.4
  12413.  
  12414.  
  12415. XtAppPending flushes the output buffers of each Display in
  12416. the application context and returns zero.
  12417.  
  12418.  
  12419. To return the event from the head of a given application's
  12420. input queue without removing input from the queue, use
  12421. XtAppPeekEvent.
  12422.  
  12423. __
  12424. |
  12425. Boolean XtAppPeekEvent(app_context, event_return)
  12426.       XtAppContext app_context;
  12427.       XEvent *event_return;
  12428.  
  12429.  
  12430. app_context
  12431.       Specifies the application context that identifies
  12432.       the application.
  12433.  
  12434. event_return
  12435.       Returns the event information to the specified
  12436.       event structure.
  12437. |__
  12438.  
  12439. If there is an X event in the queue, XtAppPeekEvent copies
  12440. it into event_return and returns True.    If no X input is on
  12441. the queue, XtAppPeekEvent flushes the output buffers of each
  12442. Display in the application context and blocks until some
  12443. input is available (possibly calling some timeout callbacks
  12444. in the interim).  If the next available input is an X event,
  12445. XtAppPeekEvent fills in event_return and returns True.    Oth-
  12446. erwise, the input is for an input source registered with
  12447. XtAppAddInput, and XtAppPeekEvent returns False.
  12448.  
  12449.  
  12450. To remove and return the event from the head of a given
  12451. application's X event queue, use XtAppNextEvent.
  12452.  
  12453.  
  12454.  
  12455.  
  12456.  
  12457.  
  12458.  
  12459.  
  12460.  
  12461.  
  12462.  
  12463. -----------
  12464. The sample implementations provides XtAppPeekEvent
  12465. as described.  Timeout callbacks are called while
  12466. blocking for input.  If some input for an input
  12467. source is available, XtAppPeekEvent will return
  12468. True without returning an event.
  12469.  
  12470.  
  12471.  
  12472.                  179
  12473.  
  12474.  
  12475.  
  12476.  
  12477.  
  12478. X Toolkit Intrinsics                 X11 Release 6.4
  12479.  
  12480. __
  12481. |
  12482. void XtAppNextEvent(app_context, event_return)
  12483.       XtAppContext app_context;
  12484.       XEvent *event_return;
  12485.  
  12486.  
  12487. app_context
  12488.       Specifies the application context that identifies
  12489.       the application.
  12490.  
  12491. event_return
  12492.       Returns the event information to the specified
  12493.       event structure.
  12494. |__
  12495.  
  12496. If the X event queue is empty, XtAppNextEvent flushes the X
  12497. output buffers of each Display in the application context
  12498. and waits for an X event while looking at the other input
  12499. sources and timeout values and calling any callback proce-
  12500. dures triggered by them.  This wait time can be used for
  12501. background processing; see Section 7.8.
  12502.  
  12503.  
  12504. 7.5.  Dispatching Events
  12505.  
  12506. The Intrinsics provide functions that dispatch events to
  12507. widgets or other application code.  Every client interested
  12508. in X events on a widget uses XtAddEventHandler to register
  12509. which events it is interested in and a procedure (event han-
  12510. dler) to be called when the event happens in that window.
  12511. The translation manager automatically registers event han-
  12512. dlers for widgets that use translation tables; see Chapter
  12513. 10.
  12514.  
  12515.  
  12516. Applications that need direct control of the processing of
  12517. different types of input should use XtAppProcessEvent.
  12518.  
  12519.  
  12520.  
  12521.  
  12522.  
  12523.  
  12524.  
  12525.  
  12526.  
  12527.  
  12528.  
  12529.  
  12530.  
  12531.  
  12532.  
  12533.  
  12534.  
  12535.  
  12536.  
  12537.  
  12538.                  180
  12539.  
  12540.  
  12541.  
  12542.  
  12543.  
  12544. X Toolkit Intrinsics                 X11 Release 6.4
  12545.  
  12546. __
  12547. |
  12548. void XtAppProcessEvent(app_context, mask)
  12549.       XtAppContext app_context;
  12550.       XtInputMask mask;
  12551.  
  12552.  
  12553. app_context
  12554.       Specifies the application context that identifies
  12555.       the application for which to process input.
  12556.  
  12557. mask      Specifies what types of events to process.  The
  12558.       mask is the bitwise inclusive OR of any combina-
  12559.       tion of XtIMXEvent, XtIMTimer, XtIMAlternateInput,
  12560.       and XtIMSignal.  As a convenience, Intrinsic.h
  12561.       defines the symbolic name XtIMAll to be the bit-
  12562.       wise inclusive OR of these four event types.
  12563. |__
  12564.  
  12565. The XtAppProcessEvent function processes one timer, input
  12566. source, signal source, or X event.  If there is no event or
  12567. input of the appropriate type to process, then XtAppProces-
  12568. sEvent blocks until there is.  If there is more than one
  12569. type of input available to process, it is undefined which
  12570. will get processed.  Usually, this procedure is not called
  12571. by client applications; see XtAppMainLoop.  XtAppProcessEv-
  12572. ent processes timer events by calling any appropriate timer
  12573. callbacks, input sources by calling any appropriate input
  12574. callbacks, signal source by calling any appropriate signal
  12575. callbacks, and X events by calling XtDispatchEvent.
  12576.  
  12577. When an X event is received, it is passed to
  12578. XtDispatchEvent, which calls the appropriate event handlers
  12579. and passes them the widget, the event, and client-specific
  12580. data registered with each procedure.  If no handlers for
  12581. that event are registered, the event is ignored and the dis-
  12582. patcher simply returns.
  12583.  
  12584.  
  12585.  
  12586. To dispatch an event returned by XtAppNextEvent, retrieved
  12587. directly from the Xlib queue, or synthetically constructed,
  12588. to any registered event filters or event handlers, call
  12589. XtDispatchEvent.
  12590.  
  12591.  
  12592.  
  12593.  
  12594.  
  12595.  
  12596.  
  12597.  
  12598.  
  12599.  
  12600.  
  12601.  
  12602.  
  12603.  
  12604.                  181
  12605.  
  12606.  
  12607.  
  12608.  
  12609.  
  12610. X Toolkit Intrinsics                 X11 Release 6.4
  12611.  
  12612. __
  12613. |
  12614. Boolean XtDispatchEvent(event)
  12615.       XEvent *event;
  12616.  
  12617.  
  12618. event      Specifies a pointer to the event structure to be
  12619.       dispatched to the appropriate event handlers.
  12620. |__
  12621.  
  12622. The XtDispatchEvent function first calls XFilterEvent with
  12623. the event and the window of the widget to which the Intrin-
  12624. sics intend to dispatch the event, or the event window if
  12625. the Intrinsics would not dispatch the event to any handlers.
  12626. If XFilterEvent returns True and the event activated a
  12627. server grab as identified by a previous call to XtGrabKey or
  12628. XtGrabButton, XtDispatchEvent calls XtUngrabKeyboard or
  12629. XtUngrabPointer with the timestamp from the event and imme-
  12630. diately returns True.  If XFilterEvent returns True and a
  12631. grab was not activated, XtDispatchEvent just immediately
  12632. returns True.  Otherwise, XtDispatchEvent sends the event to
  12633. the event handler functions that have been previously regis-
  12634. tered with the dispatch routine.  XtDispatchEvent returns
  12635. True if XFilterEvent returned True, or if the event was dis-
  12636. patched to some handler, and False if it found no handler to
  12637. which to dispatch the event.  XtDispatchEvent records the
  12638. last timestamp in any event that contains a timestamp (see
  12639. XtLastTimestampProcessed), regardless of whether it was fil-
  12640. tered or dispatched.  If a modal cascade is active with
  12641. spring_loaded True, and if the event is a remap event as
  12642. defined by XtAddGrab, XtDispatchEvent may dispatch the event
  12643. a second time.    If it does so, XtDispatchEvent will call
  12644. XFilterEvent again with the window of the spring-loaded wid-
  12645. get prior to the second dispatch, and if XFilterEvent
  12646. returns True, the second dispatch will not be performed.
  12647.  
  12648.  
  12649. 7.6.  The Application Input Loop
  12650.  
  12651. To process all input from a given application in a continu-
  12652. ous loop, use the convenience procedure XtAppMainLoop.
  12653.  
  12654. __
  12655. |
  12656. void XtAppMainLoop(app_context)
  12657.       XtAppContext app_context;
  12658.  
  12659.  
  12660. app_context
  12661.       Specifies the application context that identifies
  12662.       the application.
  12663. |__
  12664.  
  12665. The XtAppMainLoop function first reads the next incoming X
  12666. event by calling XtAppNextEvent and then dispatches the
  12667.  
  12668.  
  12669.  
  12670.                  182
  12671.  
  12672.  
  12673.  
  12674.  
  12675.  
  12676. X Toolkit Intrinsics                 X11 Release 6.4
  12677.  
  12678.  
  12679. event to the appropriate registered procedure by calling
  12680. XtDispatchEvent.  This constitutes the main loop of X
  12681. Toolkit applications.  There is nothing special about
  12682. XtAppMainLoop; it simply calls XtAppNextEvent and then
  12683. XtDispatchEvent in a conditional loop.    At the bottom of the
  12684. loop, it checks to see if the specified application con-
  12685. text's destroy flag is set.  If the flag is set, the loop
  12686. breaks.  The whole loop is enclosed between a matching XtAp-
  12687. pLock and XtAppUnlock.
  12688.  
  12689. Applications can provide their own version of this loop,
  12690. which tests some global termination flag or tests that the
  12691. number of top-level widgets is larger than zero before cir-
  12692. cling back to the call to XtAppNextEvent.
  12693.  
  12694.  
  12695. 7.7.  Setting and Checking the Sensitivity State of a Widget
  12696.  
  12697. Many widgets have a mode in which they assume a different
  12698. appearance (for example, are grayed out or stippled), do not
  12699. respond to user events, and become dormant.
  12700.  
  12701. When dormant, a widget is considered to be insensitive.  If
  12702. a widget is insensitive, the event manager does not dispatch
  12703. any events to the widget with an event type of KeyPress,
  12704. KeyRelease, ButtonPress, ButtonRelease, MotionNotify,
  12705. EnterNotify, LeaveNotify, FocusIn, or FocusOut.
  12706.  
  12707. A widget can be insensitive because its sensitive field is
  12708. False or because one of its ancestors is insensitive and
  12709. thus the widget's ancestor_sensitive field also is False.  A
  12710. widget can but does not need to distinguish these two cases
  12711. visually.
  12712.  
  12713.                 Note
  12714.  
  12715.      Pop-up shells will have ancestor_sensitive False
  12716.      if the parent was insensitive when the shell was
  12717.      created.  Since XtSetSensitive on the parent will
  12718.      not modify the resource of the pop-up child,
  12719.      clients are advised to include a resource specifi-
  12720.      cation of the form ``*TransientShell.ancestorSen-
  12721.      sitive: True'' in the application defaults
  12722.      resource file or to otherwise ensure that the par-
  12723.      ent is sensitive when creating pop-up shells.
  12724.  
  12725.  
  12726.  
  12727. To set the sensitivity state of a widget, use
  12728. XtSetSensitive.
  12729.  
  12730.  
  12731.  
  12732.  
  12733.  
  12734.  
  12735.  
  12736.                  183
  12737.  
  12738.  
  12739.  
  12740.  
  12741.  
  12742. X Toolkit Intrinsics                 X11 Release 6.4
  12743.  
  12744. __
  12745. |
  12746. void XtSetSensitive(w, sensitive)
  12747.       Widget w;
  12748.       Boolean sensitive;
  12749.  
  12750.  
  12751. w      Specifies the widget.  Must be of class RectObj or
  12752.       any subclass thereof.
  12753.  
  12754. sensitive Specifies whether the widget should receive key-
  12755.       board, pointer, and focus events.
  12756. |__
  12757.  
  12758. The XtSetSensitive function first calls XtSetValues on the
  12759. current widget with an argument list specifying the XtNsen-
  12760. sitive resource and the new value.  If sensitive is False
  12761. and the widget's class is a subclass of Composite, XtSetSen-
  12762. sitive recursively propagates the new value down the child
  12763. tree by calling XtSetValues on each child to set ances-
  12764. tor_sensitive to False.  If sensitive is True and the wid-
  12765. get's class is a subclass of Composite and the widget's
  12766. ancestor_sensitive field is True, XtSetSensitive sets the
  12767. ancestor_sensitive of each child to True and then recur-
  12768. sively calls XtSetValues on each normal descendant that is
  12769. now sensitive to set ancestor_sensitive to True.
  12770.  
  12771. XtSetSensitive calls XtSetValues to change the sensitive and
  12772. ancestor_sensitive fields of each affected widget.  There-
  12773. fore, when one of these changes, the widget's set_values
  12774. procedure should take whatever display actions are needed
  12775. (for example, graying out or stippling the widget).
  12776.  
  12777. XtSetSensitive maintains the invariant that, if the parent
  12778. has either sensitive or ancestor_sensitive False, then all
  12779. children have ancestor_sensitive False.
  12780.  
  12781.  
  12782. To check the current sensitivity state of a widget, use
  12783. XtIsSensitive.
  12784.  
  12785. __
  12786. |
  12787. Boolean XtIsSensitive(w)
  12788.      Widget w;
  12789.  
  12790.  
  12791. w      Specifies the object.  Must be of class Object or
  12792.       any subclass thereof.
  12793. |__
  12794.  
  12795. The XtIsSensitive function returns True or False to indicate
  12796. whether user input events are being dispatched.  If object's
  12797. class is a subclass of RectObj and both sensitive and ances-
  12798. tor_sensitive are True, XtIsSensitive returns True;
  12799.  
  12800.  
  12801.  
  12802.                  184
  12803.  
  12804.  
  12805.  
  12806.  
  12807.  
  12808. X Toolkit Intrinsics                 X11 Release 6.4
  12809.  
  12810.  
  12811. otherwise, it returns False.
  12812.  
  12813.  
  12814. 7.8.  Adding Background Work Procedures
  12815.  
  12816. The Intrinsics have some limited support for background pro-
  12817. cessing.  Because most applications spend most of their time
  12818. waiting for input, you can register an idle-time work proce-
  12819. dure that is called when the toolkit would otherwise block
  12820. in XtAppNextEvent or XtAppProcessEvent.  Work procedure
  12821. pointers are of type XtWorkProc.
  12822.  
  12823. __
  12824. |
  12825. typedef Boolean (*XtWorkProc)(XtPointer);
  12826.       XtPointer client_data;
  12827.  
  12828.  
  12829. client_data
  12830.       Passes the client data specified when the work
  12831.       procedure was registered.
  12832. |__
  12833.  
  12834. This procedure should return True when it is done to indi-
  12835. cate that it should be removed.  If the procedure returns
  12836. False, it will remain registered and called again when the
  12837. application is next idle.  Work procedures should be very
  12838. judicious about how much they do.  If they run for more than
  12839. a small part of a second, interactive feel is likely to suf-
  12840. fer.
  12841.  
  12842.  
  12843. To register a work procedure for a given application, use
  12844. XtAppAddWorkProc.
  12845.  
  12846.  
  12847.  
  12848.  
  12849.  
  12850.  
  12851.  
  12852.  
  12853.  
  12854.  
  12855.  
  12856.  
  12857.  
  12858.  
  12859.  
  12860.  
  12861.  
  12862.  
  12863.  
  12864.  
  12865.  
  12866.  
  12867.  
  12868.                  185
  12869.  
  12870.  
  12871.  
  12872.  
  12873.  
  12874. X Toolkit Intrinsics                 X11 Release 6.4
  12875.  
  12876. __
  12877. |
  12878. XtWorkProcId XtAppAddWorkProc(app_context, proc, client_data)
  12879.       XtAppContext app_context;
  12880.       XtWorkProc proc;
  12881.       XtPointer client_data;
  12882.  
  12883.  
  12884. app_context
  12885.       Specifies the application context that identifies
  12886.       the application.
  12887.  
  12888. proc      Specifies the procedure to be called when the
  12889.       application is idle.
  12890.  
  12891. client_data
  12892.       Specifies the argument passed to the specified
  12893.       procedure when it is called.
  12894. |__
  12895.  
  12896. The XtAppAddWorkProc function adds the specified work proce-
  12897. dure for the application identified by app_context and
  12898. returns an opaque unique identifier for this work procedure.
  12899. Multiple work procedures can be registered, and the most
  12900. recently added one is always the one that is called.  How-
  12901. ever, if a work procedure adds another work procedure, the
  12902. newly added one has lower priority than the current one.
  12903.  
  12904.  
  12905. To remove a work procedure, either return True from the pro-
  12906. cedure when it is called or use XtRemoveWorkProc outside of
  12907. the procedure.
  12908.  
  12909. __
  12910. |
  12911. void XtRemoveWorkProc(id)
  12912.       XtWorkProcId id;
  12913.  
  12914.  
  12915. id      Specifies which work procedure to remove.
  12916. |__
  12917.  
  12918. The XtRemoveWorkProc function explicitly removes the speci-
  12919. fied background work procedure.
  12920.  
  12921.  
  12922. 7.9.  X Event Filters
  12923.  
  12924. The event manager provides filters that can be applied to
  12925. specific X events.  The filters, which screen out events
  12926. that are redundant or are temporarily unwanted, handle
  12927. pointer motion compression, enter/leave compression, and
  12928. exposure compression.
  12929.  
  12930.  
  12931.  
  12932.  
  12933.  
  12934.                  186
  12935.  
  12936.  
  12937.  
  12938.  
  12939.  
  12940. X Toolkit Intrinsics                 X11 Release 6.4
  12941.  
  12942.  
  12943. 7.9.1.    Pointer Motion Compression
  12944.  
  12945. Widgets can have a hard time keeping up with a rapid stream
  12946. of pointer motion events.  Furthermore, they usually do not
  12947. care about every motion event.    To throw out redundant
  12948. motion events, the widget class field compress_motion should
  12949. be True.  When a request for an event would return a motion
  12950. event, the Intrinsics check if there are any other motion
  12951. events for the same widget immediately following the current
  12952. one and, if so, skip all but the last of them.
  12953.  
  12954.  
  12955. 7.9.2.    Enter/Leave Compression
  12956.  
  12957. To throw out pairs of enter and leave events that have no
  12958. intervening events, as can happen when the user moves the
  12959. pointer across a widget without stopping in it, the widget
  12960. class field compress_enterleave should be True.  These enter
  12961. and leave events are not delivered to the client if they are
  12962. found together in the input queue.
  12963.  
  12964.  
  12965. 7.9.3.    Exposure Compression
  12966.  
  12967. Many widgets prefer to process a series of exposure events
  12968. as a single expose region rather than as individual rectan-
  12969. gles.  Widgets with complex displays might use the expose
  12970. region as a clip list in a graphics context, and widgets
  12971. with simple displays might ignore the region entirely and
  12972. redisplay their whole window or might get the bounding box
  12973. from the region and redisplay only that rectangle.
  12974.  
  12975. In either case, these widgets do not care about getting par-
  12976. tial exposure events.  The compress_exposure field in the
  12977. widget class structure specifies the type and number of
  12978. exposure events that are dispatched to the widget's expose
  12979. procedure.  This field must be initialized to one of the
  12980. following values:
  12981.  
  12982. __
  12983. |
  12984. #define XtExposeNoCompress    ((XtEnum)False)
  12985. #define XtExposeCompressSeries((XtEnum)True)
  12986. #define XtExposeCompressMultiple<implementation-defined>
  12987. #define XtExposeCompressMaximal<implementation-defined>
  12988.  
  12989. |__
  12990.  
  12991. optionally ORed with any combination of the following flags
  12992. (all with implementation-defined values):
  12993. XtExposeGraphicsExpose, XtExposeGraphicsExposeMerged,
  12994. XtExposeNoExpose, and XtExposeNoRegion.
  12995.  
  12996.  
  12997.  
  12998.  
  12999.  
  13000.                  187
  13001.  
  13002.  
  13003.  
  13004.  
  13005.  
  13006. X Toolkit Intrinsics                 X11 Release 6.4
  13007.  
  13008.  
  13009. If the compress_exposure field in the widget class structure
  13010. does not specify XtExposeNoCompress, the event manager calls
  13011. the widget's expose procedure only once for a series of
  13012. exposure events.  In this case, all Expose or GraphicsExpose
  13013. events are accumulated into a region.  When the final event
  13014. is received, the event manager replaces the rectangle in the
  13015. event with the bounding box for the region and calls the
  13016. widget's expose procedure, passing the modified exposure
  13017. event and (unless XtExposeNoRegion is specified) the region.
  13018. For more information on regions, see Section 16.5 in Xlib --
  13019. C Language X Interface.)
  13020.  
  13021. The values have the following interpretation:
  13022.  
  13023.  
  13024. XtExposeNoCompress
  13025.  
  13026.      No exposure compression is performed; every selected
  13027.      event is individually dispatched to the expose proce-
  13028.      dure with a region argument of NULL.
  13029.  
  13030.  
  13031. XtExposeCompressSeries
  13032.  
  13033.      Each series of exposure events is coalesced into a sin-
  13034.      gle event, which is dispatched when an exposure event
  13035.      with count equal to zero is reached.
  13036.  
  13037.  
  13038. XtExposeCompressMultiple
  13039.  
  13040.      Consecutive series of exposure events are coalesced
  13041.      into a single event, which is dispatched when an expo-
  13042.      sure event with count equal to zero is reached and
  13043.      either the event queue is empty or the next event is
  13044.      not an exposure event for the same widget.
  13045.  
  13046.  
  13047. XtExposeCompressMaximal
  13048.  
  13049.      All expose series currently in the queue for the widget
  13050.      are coalesced into a single event without regard to
  13051.      intervening nonexposure events.  If a partial series is
  13052.      in the end of the queue, the Intrinsics will block
  13053.      until the end of the series is received.
  13054.  
  13055.  
  13056. The additional flags have the following meaning:
  13057.  
  13058.  
  13059. XtExposeGraphicsExpose
  13060.  
  13061.      Specifies that GraphicsExpose events are also to be
  13062.      dispatched to the expose procedure.  GraphicsExpose
  13063.  
  13064.  
  13065.  
  13066.                  188
  13067.  
  13068.  
  13069.  
  13070.  
  13071.  
  13072. X Toolkit Intrinsics                 X11 Release 6.4
  13073.  
  13074.  
  13075.      events are compressed, if specified, in the same manner
  13076.      as Expose events.
  13077.  
  13078.  
  13079. XtExposeGraphicsExposeMerged
  13080.  
  13081.      Specifies in the case of XtExposeCompressMultiple and
  13082.      XtExposeCompressMaximal that series of GraphicsExpose
  13083.      and Expose events are to be compressed together, with
  13084.      the final event type determining the type of the event
  13085.      passed to the expose procedure.  If this flag is not
  13086.      set, then only series of the same event type as the
  13087.      event at the head of the queue are coalesced.  This
  13088.      flag also implies XtExposeGraphicsExpose.
  13089.  
  13090.  
  13091. XtExposeNoExpose
  13092.  
  13093.      Specifies that NoExpose events are also to be dis-
  13094.      patched to the expose procedure.  NoExpose events are
  13095.      never coalesced with other exposure events or with each
  13096.      other.
  13097.  
  13098.  
  13099. XtExposeNoRegion
  13100.  
  13101.      Specifies that the final region argument passed to the
  13102.      expose procedure is NULL.    The rectangle in the event
  13103.      will still contain bounding box information for the
  13104.      entire series of compressed exposure events.  This
  13105.      option saves processing time when the region is not
  13106.      needed by the widget.
  13107.  
  13108.  
  13109. 7.10.  Widget Exposure and Visibility
  13110.  
  13111. Every primitive widget and some composite widgets display
  13112. data on the screen by means of direct Xlib calls.  Widgets
  13113. cannot simply write to the screen and forget what they have
  13114. done.  They must keep enough state to redisplay the window
  13115. or parts of it if a portion is obscured and then reexposed.
  13116.  
  13117.  
  13118. 7.10.1.  Redisplay of a Widget: The expose Procedure
  13119.  
  13120. The expose procedure pointer in a widget class is of type
  13121. XtExposeProc.
  13122.  
  13123.  
  13124.  
  13125.  
  13126.  
  13127.  
  13128.  
  13129.  
  13130.  
  13131.  
  13132.                  189
  13133.  
  13134.  
  13135.  
  13136.  
  13137.  
  13138. X Toolkit Intrinsics                 X11 Release 6.4
  13139.  
  13140. __
  13141. |
  13142. typedef void (*XtExposeProc)(Widget, XEvent*, Region);
  13143.       Widget w;
  13144.       XEvent *event;
  13145.       Region region;
  13146.  
  13147.  
  13148. w      Specifies the widget instance requiring redisplay.
  13149.  
  13150. event      Specifies the exposure event giving the rectangle
  13151.       requiring redisplay.
  13152.  
  13153. region      Specifies the union of all rectangles in this
  13154.       exposure sequence.
  13155. |__
  13156.  
  13157. The redisplay of a widget upon exposure is the responsibil-
  13158. ity of the expose procedure in the widget's class record.
  13159. If a widget has no display semantics, it can specify NULL
  13160. for the expose field.  Many composite widgets serve only as
  13161. containers for their children and have no expose procedure.
  13162.  
  13163.                 Note
  13164.  
  13165.      If the expose procedure is NULL, XtRealizeWidget
  13166.      fills in a default bit gravity of NorthWestGravity
  13167.      before it calls the widget's realize procedure.
  13168.  
  13169.  
  13170. If the widget's compress_exposure class field specifies
  13171. XtExposeNoCompress or XtExposeNoRegion, or if the event type
  13172. is NoExpose (see Section 7.9.3), region is NULL.  If XtEx-
  13173. poseNoCompress is not specified and the event type is not
  13174. NoExpose, the event is the final event in the compressed
  13175. series but x, y, width, and height contain the bounding box
  13176. for all the compressed events.    The region is created and
  13177. destroyed by the Intrinsics, but the widget is permitted to
  13178. modify the region contents.
  13179.  
  13180. A small simple widget (for example, Label) can ignore the
  13181. bounding box information in the event and redisplay the
  13182. entire window.    A more complicated widget (for example,
  13183. Text) can use the bounding box information to minimize the
  13184. amount of calculation and redisplay it does.  A very complex
  13185. widget uses the region as a clip list in a GC and ignores
  13186. the event information.    The expose procedure is not chained
  13187. and is therefore responsible for exposure of all superclass
  13188. data as well as its own.
  13189.  
  13190. However, it often is possible to anticipate the display
  13191. needs of several levels of subclassing.  For example, rather
  13192. than implement separate display procedures for the widgets
  13193. Label, Pushbutton, and Toggle, you could write a single dis-
  13194. play routine in Label that uses display state fields like
  13195.  
  13196.  
  13197.  
  13198.                  190
  13199.  
  13200.  
  13201.  
  13202.  
  13203.  
  13204. X Toolkit Intrinsics                 X11 Release 6.4
  13205.  
  13206.  
  13207.      Boolean invert;
  13208.      Boolean highlight;
  13209.      Dimension highlight_width;
  13210.  
  13211. Label would have invert and highlight always False and high-
  13212. light_width zero.  Pushbutton would dynamically set high-
  13213. light and highlight_width, but it would leave invert always
  13214. False.    Finally, Toggle would dynamically set all three.  In
  13215. this case, the expose procedures for Pushbutton and Toggle
  13216. inherit their superclass's expose procedure; see Section
  13217. 1.6.10.
  13218.  
  13219.  
  13220. 7.10.2.  Widget Visibility
  13221.  
  13222. Some widgets may use substantial computing resources to pro-
  13223. duce the data they will display.  However, this effort is
  13224. wasted if the widget is not actually visible on the screen,
  13225. that is, if the widget is obscured by another application or
  13226. is iconified.
  13227.  
  13228. The visible field in the core widget structure provides a
  13229. hint to the widget that it need not compute display data.
  13230. This field is guaranteed to be True by the time an exposure
  13231. event is processed if any part of the widget is visible, but
  13232. is False if the widget is fully obscured.
  13233.  
  13234. Widgets can use or ignore the visible hint.  If they ignore
  13235. it, they should have visible_interest in their widget class
  13236. record set False.  In such cases, the visible field is ini-
  13237. tialized True and never changes.  If visible_interest is
  13238. True, the event manager asks for VisibilityNotify events for
  13239. the widget and sets visible to True on VisibilityUnobscured
  13240. or VisibilityPartiallyObscured events and False on Visibili-
  13241. tyFullyObscured events.
  13242.  
  13243.  
  13244. 7.11.  X Event Handlers
  13245.  
  13246. Event handlers are procedures called when specified events
  13247. occur in a widget.  Most widgets need not use event handlers
  13248. explicitly.  Instead, they use the Intrinsics translation
  13249. manager.  Event handler procedure pointers are of the type
  13250. XtEventHandler.
  13251.  
  13252.  
  13253.  
  13254.  
  13255.  
  13256.  
  13257.  
  13258.  
  13259.  
  13260.  
  13261.  
  13262.  
  13263.  
  13264.                  191
  13265.  
  13266.  
  13267.  
  13268.  
  13269.  
  13270. X Toolkit Intrinsics                 X11 Release 6.4
  13271.  
  13272. __
  13273. |
  13274. typedef void (*XtEventHandler)(Widget, XtPointer, XEvent*, Boolean*);
  13275.       Widget w;
  13276.       XtPointer client_data;
  13277.       XEvent *event;
  13278.       Boolean *continue_to_dispatch;
  13279.  
  13280.  
  13281. w      Specifies the widget for which the event arrived.
  13282.  
  13283. client_data
  13284.       Specifies any client-specific information regis-
  13285.       tered with the event handler.
  13286.  
  13287. event      Specifies the triggering event.
  13288.  
  13289. continue_to_dispatch
  13290.       Specifies whether the remaining event handlers
  13291.       registered for the current event should be called.
  13292. |__
  13293.  
  13294. After receiving an event and before calling any event han-
  13295. dlers, the Boolean pointed to by continue_to_dispatch is
  13296. initialized to True.  When an event handler is called, it
  13297. may decide that further processing of the event is not
  13298. desirable and may store False in this Boolean, in which case
  13299. any handlers remaining to be called for the event are
  13300. ignored.
  13301.  
  13302. The circumstances under which the Intrinsics may add event
  13303. handlers to a widget are currently implementation-dependent.
  13304. Clients must therefore be aware that storing False into the
  13305. continue_to_dispatch argument can lead to portability prob-
  13306. lems.
  13307.  
  13308.  
  13309. 7.11.1.  Event Handlers That Select Events
  13310.  
  13311. To register an event handler procedure with the dispatch
  13312. mechanism, use XtAddEventHandler.
  13313.  
  13314.  
  13315.  
  13316.  
  13317.  
  13318.  
  13319.  
  13320.  
  13321.  
  13322.  
  13323.  
  13324.  
  13325.  
  13326.  
  13327.  
  13328.  
  13329.  
  13330.                  192
  13331.  
  13332.  
  13333.  
  13334.  
  13335.  
  13336. X Toolkit Intrinsics                 X11 Release 6.4
  13337.  
  13338. __
  13339. |
  13340. void XtAddEventHandler(w, event_mask, nonmaskable, proc, client_data)
  13341.       Widget w;
  13342.       EventMask event_mask;
  13343.       Boolean nonmaskable;
  13344.       XtEventHandler proc;
  13345.       XtPointer client_data;
  13346.  
  13347.  
  13348. w      Specifies the widget for which this event handler
  13349.       is being registered.    Must be of class Core or any
  13350.       subclass thereof.
  13351.  
  13352. event_mask
  13353.       Specifies the event mask for which to call this
  13354.       procedure.
  13355.  
  13356. nonmaskable
  13357.       Specifies whether this procedure should be called
  13358.       on the nonmaskable events (GraphicsExpose,
  13359.       NoExpose, SelectionClear, SelectionRequest,
  13360.       SelectionNotify, ClientMessage, and
  13361.       MappingNotify).
  13362.  
  13363. proc      Specifies the procedure to be called.
  13364.  
  13365. client_data
  13366.       Specifies additional data to be passed to the
  13367.       event handler.
  13368. |__
  13369.  
  13370. The XtAddEventHandler function registers a procedure with
  13371. the dispatch mechanism that is to be called when an event
  13372. that matches the mask occurs on the specified widget.  Each
  13373. widget has a single registered event handler list, which
  13374. will contain any procedure/client_data pair exactly once
  13375. regardless of the manner in which it is registered.  If the
  13376. procedure is already registered with the same client_data
  13377. value, the specified mask augments the existing mask.  If
  13378. the widget is realized, XtAddEventHandler calls
  13379. XSelectInput, if necessary.  The order in which this proce-
  13380. dure is called relative to other handlers registered for the
  13381. same event is not defined.
  13382.  
  13383.  
  13384. To remove a previously registered event handler, use
  13385. XtRemoveEventHandler.
  13386.  
  13387.  
  13388.  
  13389.  
  13390.  
  13391.  
  13392.  
  13393.  
  13394.  
  13395.  
  13396.                  193
  13397.  
  13398.  
  13399.  
  13400.  
  13401.  
  13402. X Toolkit Intrinsics                 X11 Release 6.4
  13403.  
  13404. __
  13405. |
  13406. void XtRemoveEventHandler(w, event_mask, nonmaskable, proc, client_data)
  13407.       Widget w;
  13408.       EventMask event_mask;
  13409.       Boolean nonmaskable;
  13410.       XtEventHandler proc;
  13411.       XtPointer client_data;
  13412.  
  13413.  
  13414. w      Specifies the widget for which this procedure is
  13415.       registered.  Must be of class Core or any subclass
  13416.       thereof.
  13417.  
  13418. event_mask
  13419.       Specifies the event mask for which to unregister
  13420.       this procedure.
  13421.  
  13422. nonmaskable
  13423.       Specifies whether this procedure should be removed
  13424.       on the nonmaskable events (GraphicsExpose,
  13425.       NoExpose, SelectionClear, SelectionRequest,
  13426.       SelectionNotify, ClientMessage, and
  13427.       MappingNotify).
  13428.  
  13429. proc      Specifies the procedure to be removed.
  13430.  
  13431. client_data
  13432.       Specifies the registered client data.
  13433. |__
  13434.  
  13435. The XtRemoveEventHandler function unregisters an event han-
  13436. dler registered with XtAddEventHandler or XtInsertEven-
  13437. tHandler for the specified events.  The request is ignored
  13438. if client_data does not match the value given when the han-
  13439. dler was registered.  If the widget is realized and no other
  13440. event handler requires the event, XtRemoveEventHandler calls
  13441. XSelectInput.  If the specified procedure has not been reg-
  13442. istered or if it has been registered with a different value
  13443. of client_data, XtRemoveEventHandler returns without report-
  13444. ing an error.
  13445.  
  13446. To stop a procedure registered with XtAddEventHandler or
  13447. XtInsertEventHandler from receiving all selected events,
  13448. call XtRemoveEventHandler with an event_mask of XtAllEvents
  13449. and nonmaskable True.  The procedure will continue to
  13450. receive any events that have been specified in calls to
  13451. XtAddRawEventHandler or XtInsertRawEventHandler.
  13452.  
  13453.  
  13454. To register an event handler procedure that receives events
  13455. before or after all previously registered event handlers,
  13456. use XtInsertEventHandler.
  13457.  
  13458.  
  13459.  
  13460.  
  13461.  
  13462.                  194
  13463.  
  13464.  
  13465.  
  13466.  
  13467.  
  13468. X Toolkit Intrinsics                 X11 Release 6.4
  13469.  
  13470. __
  13471. |
  13472. typedef enum {XtListHead, XtListTail} XtListPosition;
  13473.  
  13474.  
  13475.  
  13476. void XtInsertEventHandler(w, event_mask, nonmaskable, proc, client_data, position)
  13477.       Widget w;
  13478.       EventMask event_mask;
  13479.       Boolean nonmaskable;
  13480.       XtEventHandler proc;
  13481.       XtPointer client_data;
  13482.       XtListPosition position;
  13483.  
  13484.  
  13485. w      Specifies the widget for which this event handler
  13486.       is being registered. Must be of class Core or any
  13487.       subclass thereof.
  13488.  
  13489. event_mask
  13490.       Specifies the event mask for which to call this
  13491.       procedure.
  13492.  
  13493. nonmaskable
  13494.       Specifies whether this procedure should be called
  13495.       on the nonmaskable events (GraphicsExpose,
  13496.       NoExpose, SelectionClear, SelectionRequest,
  13497.       SelectionNotify, ClientMessage, and
  13498.       MappingNotify).
  13499.  
  13500. proc      Specifies the procedure to be called.
  13501.  
  13502. client_data
  13503.       Specifies additional data to be passed to the
  13504.       client's event handler.
  13505.  
  13506. position  Specifies when the event handler is to be called
  13507.       relative to other previously registered handlers.
  13508. |__
  13509.  
  13510. XtInsertEventHandler is identical to XtAddEventHandler with
  13511. the additional position argument.  If position is
  13512. XtListHead, the event handler is registered so that it is
  13513. called before any event handlers that were previously regis-
  13514. tered for the same widget.  If position is XtListTail, the
  13515. event handler is registered to be called after any previ-
  13516. ously registered event handlers.  If the procedure is
  13517. already registered with the same client_data value, the
  13518. specified mask augments the existing mask and the procedure
  13519. is repositioned in the list.
  13520.  
  13521.  
  13522.  
  13523.  
  13524.  
  13525.  
  13526.  
  13527.  
  13528.                  195
  13529.  
  13530.  
  13531.  
  13532.  
  13533.  
  13534. X Toolkit Intrinsics                 X11 Release 6.4
  13535.  
  13536.  
  13537. 7.11.2.  Event Handlers That Do Not Select Events
  13538.  
  13539. On occasion, clients need to register an event handler pro-
  13540. cedure with the dispatch mechanism without explicitly caus-
  13541. ing the X server to select for that event.  To do this, use
  13542. XtAddRawEventHandler.
  13543.  
  13544. __
  13545. |
  13546. void XtAddRawEventHandler(w, event_mask, nonmaskable, proc, client_data)
  13547.       Widget w;
  13548.       EventMask event_mask;
  13549.       Boolean nonmaskable;
  13550.       XtEventHandler proc;
  13551.       XtPointer client_data;
  13552.  
  13553.  
  13554. w      Specifies the widget for which this event handler
  13555.       is being registered. Must be of class Core or any
  13556.       subclass thereof.
  13557.  
  13558. event_mask
  13559.       Specifies the event mask for which to call this
  13560.       procedure.
  13561.  
  13562. nonmaskable
  13563.       Specifies whether this procedure should be called
  13564.       on the nonmaskable events (GraphicsExpose,
  13565.       NoExpose, SelectionClear, SelectionRequest,
  13566.       SelectionNotify, ClientMessage, and
  13567.       MappingNotify).
  13568.  
  13569. proc      Specifies the procedure to be called.
  13570.  
  13571. client_data
  13572.       Specifies additional data to be passed to the
  13573.       client's event handler.
  13574. |__
  13575.  
  13576. The XtAddRawEventHandler function is similar to XtAddEven-
  13577. tHandler except that it does not affect the widget's event
  13578. mask and never causes an XSelectInput for its events.  Note
  13579. that the widget might already have those mask bits set
  13580. because of other nonraw event handlers registered on it.  If
  13581. the procedure is already registered with the same
  13582. client_data, the specified mask augments the existing mask.
  13583. The order in which this procedure is called relative to
  13584. other handlers registered for the same event is not defined.
  13585.  
  13586.  
  13587. To remove a previously registered raw event handler, use
  13588. XtRemoveRawEventHandler.
  13589.  
  13590.  
  13591.  
  13592.  
  13593.  
  13594.                  196
  13595.  
  13596.  
  13597.  
  13598.  
  13599.  
  13600. X Toolkit Intrinsics                 X11 Release 6.4
  13601.  
  13602. __
  13603. |
  13604. void XtRemoveRawEventHandler(w, event_mask, nonmaskable, proc, client_data)
  13605.       Widget w;
  13606.       EventMask event_mask;
  13607.       Boolean nonmaskable;
  13608.       XtEventHandler proc;
  13609.       XtPointer client_data;
  13610.  
  13611.  
  13612. w      Specifies the widget for which this procedure is
  13613.       registered.  Must be of class Core or any subclass
  13614.       thereof.
  13615.  
  13616. event_mask
  13617.       Specifies the event mask for which to unregister
  13618.       this procedure.
  13619.  
  13620. nonmaskable
  13621.       Specifies whether this procedure should be removed
  13622.       on the nonmaskable events (GraphicsExpose,
  13623.       NoExpose, SelectionClear, SelectionRequest,
  13624.       SelectionNotify, ClientMessage, and
  13625.       MappingNotify).
  13626.  
  13627. proc      Specifies the procedure to be registered.
  13628.  
  13629. client_data
  13630.       Specifies the registered client data.
  13631. |__
  13632.  
  13633. The XtRemoveRawEventHandler function unregisters an event
  13634. handler registered with XtAddRawEventHandler or XtInsertRaw-
  13635. EventHandler for the specified events without changing the
  13636. window event mask.  The request is ignored if client_data
  13637. does not match the value given when the handler was regis-
  13638. tered.    If the specified procedure has not been registered
  13639. or if it has been registered with a different value of
  13640. client_data, XtRemoveRawEventHandler returns without report-
  13641. ing an error.
  13642.  
  13643. To stop a procedure registered with XtAddRawEventHandler or
  13644. XtInsertRawEventHandler from receiving all nonselected
  13645. events, call XtRemoveRawEventHandler with an event_mask of
  13646. XtAllEvents and nonmaskable True.  The procedure will con-
  13647. tinue to receive any events that have been specified in
  13648. calls to XtAddEventHandler or XtInsertEventHandler.
  13649.  
  13650.  
  13651. To register an event handler procedure that receives events
  13652. before or after all previously registered event handlers
  13653. without selecting for the events, use
  13654. XtInsertRawEventHandler.
  13655.  
  13656.  
  13657.  
  13658.  
  13659.  
  13660.                  197
  13661.  
  13662.  
  13663.  
  13664.  
  13665.  
  13666. X Toolkit Intrinsics                 X11 Release 6.4
  13667.  
  13668. __
  13669. |
  13670. void XtInsertRawEventHandler(w, event_mask, nonmaskable, proc, client_data, position)
  13671.       Widget w;
  13672.       EventMask event_mask;
  13673.       Boolean nonmaskable;
  13674.       XtEventHandler proc;
  13675.       XtPointer client_data;
  13676.       XtListPosition position;
  13677.  
  13678.  
  13679. w      Specifies the widget for which this event handler
  13680.       is being registered. Must be of class Core or any
  13681.       subclass thereof.
  13682.  
  13683. event_mask
  13684.       Specifies the event mask for which to call this
  13685.       procedure.
  13686.  
  13687. nonmaskable
  13688.       Specifies whether this procedure should be called
  13689.       on the nonmaskable events (GraphicsExpose,
  13690.       NoExpose, SelectionClear, SelectionRequest,
  13691.       SelectionNotify, ClientMessage, and
  13692.       MappingNotify).
  13693.  
  13694. proc      Specifies the procedure to be registered.
  13695.  
  13696. client_data
  13697.       Specifies additional data to be passed to the
  13698.       client's event handler.
  13699.  
  13700. position  Specifies when the event handler is to be called
  13701.       relative to other previously registered handlers.
  13702. |__
  13703.  
  13704. The XtInsertRawEventHandler function is similar to XtIn-
  13705. sertEventHandler except that it does not modify the widget's
  13706. event mask and never causes an XSelectInput for the speci-
  13707. fied events.  If the procedure is already registered with
  13708. the same client_data value, the specified mask augments the
  13709. existing mask and the procedure is repositioned in the list.
  13710.  
  13711.  
  13712. 7.11.3.  Current Event Mask
  13713.  
  13714. To retrieve the event mask for a given widget, use
  13715. XtBuildEventMask.
  13716.  
  13717.  
  13718.  
  13719.  
  13720.  
  13721.  
  13722.  
  13723.  
  13724.  
  13725.  
  13726.                  198
  13727.  
  13728.  
  13729.  
  13730.  
  13731.  
  13732. X Toolkit Intrinsics                 X11 Release 6.4
  13733.  
  13734. __
  13735. |
  13736. EventMask XtBuildEventMask(w)
  13737.       Widget w;
  13738.  
  13739.  
  13740. w      Specifies the widget.  Must be of class Core or
  13741.       any subclass thereof.
  13742. |__
  13743.  
  13744. The XtBuildEventMask function returns the event mask repre-
  13745. senting the logical OR of all event masks for event handlers
  13746. registered on the widget with XtAddEventHandler and XtIn-
  13747. sertEventHandler and all event translations, including
  13748. accelerators, installed on the widget.    This is the same
  13749. event mask stored into the XSetWindowAttributes structure by
  13750. XtRealizeWidget and sent to the server when event handlers
  13751. and translations are installed or removed on the realized
  13752. widget.
  13753.  
  13754.  
  13755. 7.11.4.  Event Handlers for X11 Protocol Extensions
  13756.  
  13757. To register an event handler procedure with the Intrinsics
  13758. dispatch mechanism according to an event type, use
  13759. XtInsertEventTypeHandler.
  13760.  
  13761.  
  13762.  
  13763.  
  13764.  
  13765.  
  13766.  
  13767.  
  13768.  
  13769.  
  13770.  
  13771.  
  13772.  
  13773.  
  13774.  
  13775.  
  13776.  
  13777.  
  13778.  
  13779.  
  13780.  
  13781.  
  13782.  
  13783.  
  13784.  
  13785.  
  13786.  
  13787.  
  13788.  
  13789.  
  13790.  
  13791.  
  13792.                  199
  13793.  
  13794.  
  13795.  
  13796.  
  13797.  
  13798. X Toolkit Intrinsics                 X11 Release 6.4
  13799.  
  13800. __
  13801. |
  13802. void XtInsertEventTypeHandler(widget, event_type, select_data, proc, client_data, position)
  13803.       Widget widget;
  13804.       int event_type;
  13805.       XtPointer select_data;
  13806.       XtEventHandler proc;
  13807.       XtPointer client_data;
  13808.       XtListPosition position;
  13809.  
  13810.  
  13811. widget      Specifies the widget for which this event handler
  13812.       is being registered.    Must be of class Core or any
  13813.       subclass thereof.
  13814.  
  13815. event_type
  13816.       Specifies the event type for which to call this
  13817.       event handler.
  13818.  
  13819. select_data
  13820.       Specifies data used to request events of the spec-
  13821.       ified type from the server, or NULL.
  13822.  
  13823. proc      Specifies the event handler to be called.
  13824.  
  13825. client_data
  13826.       Specifies additional data to be passed to the
  13827.       event handler.
  13828.  
  13829. position  Specifies when the event handler is to be called
  13830.       relative to other previously registered handlers.
  13831. |__
  13832.  
  13833. XtInsertEventTypeHandler registers a procedure with the dis-
  13834. patch mechanism that is to be called when an event that
  13835. matches the specified event_type is dispatched to the speci-
  13836. fied widget.
  13837.  
  13838. If event_type specifies one of the core X protocol events,
  13839. then select_data must be a pointer to a value of type
  13840. EventMask, indicating the event mask to be used to select
  13841. for the desired event.    This event mask is included in the
  13842. value returned by XtBuildEventMask.  If the widget is real-
  13843. ized, XtInsertEventTypeHandler calls XSelectInput if neces-
  13844. sary.  Specifying NULL for select_data is equivalent to
  13845. specifying a pointer to an event mask containing 0.  This is
  13846. similar to the XtInsertRawEventHandler function.
  13847.  
  13848. If event_type specifies an extension event type, then the
  13849. semantics of the data pointed to by select_data are defined
  13850. by the extension selector registered for the specified event
  13851. type.
  13852.  
  13853. In either case the Intrinsics are not required to copy the
  13854. data pointed to by select_data, so the caller must ensure
  13855.  
  13856.  
  13857.  
  13858.                  200
  13859.  
  13860.  
  13861.  
  13862.  
  13863.  
  13864. X Toolkit Intrinsics                 X11 Release 6.4
  13865.  
  13866.  
  13867. that it remains valid as long as the event handler remains
  13868. registered with this value of select_data.
  13869.  
  13870. The position argument allows the client to control the order
  13871. of invocation of event handlers registered for the same
  13872. event type.  If the client does not care about the order, it
  13873. should normally specify XtListTail, which registers this
  13874. event handler after any previously registered handlers for
  13875. this event type.
  13876.  
  13877. Each widget has a single registered event handler list,
  13878. which will contain any procedure/client_data pair exactly
  13879. once if it is registered with XtInsertEventTypeHandler,
  13880. regardless of the manner in which it is registered and
  13881. regardless of the value(s) of select_data.  If the procedure
  13882. is already registered with the same client_data value, the
  13883. specified mask augments the existing mask and the procedure
  13884. is repositioned in the list.
  13885.  
  13886.  
  13887. To remove an event handler registered with
  13888. XtInsertEventTypeHandler, use XtRemoveEventTypeHandler.
  13889.  
  13890. __
  13891. |
  13892. void XtRemoveEventTypeHandler(widget, event_type, select_data, proc, client_data)
  13893.       Widget widget;
  13894.       int event_type;
  13895.       XtPointer select_data;
  13896.       XtEventHandler proc;
  13897.       XtPointer client_data;
  13898.  
  13899.  
  13900. widget      Specifies the widget for which the event handler
  13901.       was registered.  Must be of class Core or any sub-
  13902.       class thereof.
  13903.  
  13904. event_type
  13905.       Specifies the event type for which the handler was
  13906.       registered.
  13907.  
  13908. select_data
  13909.       Specifies data used to deselect events of the
  13910.       specified type from the server, or NULL.
  13911.  
  13912. proc      Specifies the event handler to be removed.
  13913.  
  13914. client_data
  13915.       Specifies the additional client data with which
  13916.       the procedure was registered.
  13917. |__
  13918.  
  13919. The XtRemoveEventTypeHandler function unregisters an event
  13920. handler registered with XtInsertEventTypeHandler for the
  13921.  
  13922.  
  13923.  
  13924.                  201
  13925.  
  13926.  
  13927.  
  13928.  
  13929.  
  13930. X Toolkit Intrinsics                 X11 Release 6.4
  13931.  
  13932.  
  13933. specified event type.  The request is ignored if client_data
  13934. does not match the value given when the handler was regis-
  13935. tered.
  13936.  
  13937. If event_type specifies one of the core X protocol events,
  13938. select_data must be a pointer to a value of type
  13939. EventMask,indicating mask to be used to deselect for the
  13940. appropriate event.  If the widget is realized,
  13941. XtRemoveEventTypeHandler calls XSelectInput if necessary.
  13942. Specifying NULL for select_data is equivalent to specifying
  13943. a pointer to an event mask containing 0.  This is similar to
  13944. the XtRemoveRawEventHandler function.
  13945.  
  13946. If event_type specifies an extension event type, then the
  13947. semantics of the data pointed to by select_data are defined
  13948. by the extension selector registered for the specified event
  13949. type.
  13950.  
  13951.  
  13952. To register a procedure to select extension events for a
  13953. widget, use XtRegisterExtensionSelector.
  13954.  
  13955. __
  13956. |
  13957. void XtRegisterExtensionSelector(display, min_event_type, max_event_type, proc,
  13958.                              client_data)
  13959.       Display *display;
  13960.       int min_event_type;
  13961.       int max_event_type;
  13962.       XtExtensionSelectProc proc;
  13963.       XtPointer client_data;
  13964.  
  13965.  
  13966. display        Specifies the display for which the extension
  13967.            selector is to be registered.
  13968.  
  13969. min_event_type
  13970.  
  13971. max_event_type Specifies the range of event types for the
  13972.            extension.
  13973.  
  13974. proc           Specifies the extension selector procedure.
  13975.  
  13976. client_data    Specifies additional data to be passed to the
  13977.            extension selector.
  13978. |__
  13979.  
  13980. The XtRegisterExtensionSelector function registers a proce-
  13981. dure to arrange for the delivery of extension events to wid-
  13982. gets.
  13983.  
  13984. If min_event_type and max_event_type match the parameters to
  13985. a previous call to XtRegisterExtensionSelector for the same
  13986. display, then proc and client_data replace the previously
  13987.  
  13988.  
  13989.  
  13990.                  202
  13991.  
  13992.  
  13993.  
  13994.  
  13995.  
  13996. X Toolkit Intrinsics                 X11 Release 6.4
  13997.  
  13998.  
  13999. registered values.  If the range specified by min_event_type
  14000. and max_event_type overlaps the range of the parameters to a
  14001. previous call for the same display in any other way, an
  14002. error results.
  14003.  
  14004. When a widget is realized, after the core.realize method is
  14005. called, the Intrinsics check to see if any event handler
  14006. specifies an event type within the range of a registered
  14007. extension selector.  If so, the Intrinsics call each such
  14008. selector.  If an event type handler is added or removed, the
  14009. Intrinsics check to see if the event type falls within the
  14010. range of a registered extension selector, and if it does,
  14011. calls the selector.  In either case the Intrinsics pass a
  14012. list of all the widget's event types that are within the
  14013. selector's range.  The corresponding select data are also
  14014. passed.  The selector is responsible for enabling the deliv-
  14015. ery of extension events required by the widget.
  14016.  
  14017.  
  14018. An extension selector is of type XtExtensionSelectProc.
  14019.  
  14020. __
  14021. |
  14022. typedef void (*XtExtensionSelectProc)(Widget, int *, XtPointer *, int, XtPointer);
  14023.       Widget widget;
  14024.       int *event_types;
  14025.       XtPointer *select_data;
  14026.       int count;
  14027.       XtPointer client_data;
  14028.  
  14029.  
  14030. widget      Specifies the widget that is being realized or is
  14031.       having an event handler added or removed.
  14032.  
  14033. event_types
  14034.       Specifies a list of event types that the widget
  14035.       has registered event handlers for.
  14036.  
  14037. select_data
  14038.       Specifies a list of the select_data parameters
  14039.       specified in XtInsertEventTypeHandler.
  14040.  
  14041. count      Specifies the number of entries in the event_types
  14042.       and select_data lists.
  14043.  
  14044. client_data
  14045.       Specifies the additional client data with which
  14046.       the procedure was registered.
  14047. |__
  14048.  
  14049. The event_types and select_data lists will always have the
  14050. same number of elements, specified by count.  Each event
  14051. type/select data pair represents one call to
  14052. XtInsertEventTypeHandler.
  14053.  
  14054.  
  14055.  
  14056.                  203
  14057.  
  14058.  
  14059.  
  14060.  
  14061.  
  14062. X Toolkit Intrinsics                 X11 Release 6.4
  14063.  
  14064.  
  14065. To register a procedure to dispatch events of a specific
  14066. type within XtDispatchEvent, use XtSetEventDispatcher.
  14067.  
  14068. __
  14069. |
  14070. XtEventDispatchProc XtSetEventDispatcher(display, event_type, proc)
  14071.       Display *display;
  14072.       int event_type;
  14073.       XtEventDispatchProc proc;
  14074.  
  14075.  
  14076. display   Specifies the display for which the event dis-
  14077.       patcher is to be registered.
  14078.  
  14079. event_type
  14080.       Specifies the event type for which the dispatcher
  14081.       should be invoked.
  14082.  
  14083. proc      Specifies the event dispatcher procedure.
  14084. |__
  14085.  
  14086. The XtSetEventDispatcher function registers the event dis-
  14087. patcher procedure specified by proc for events with the type
  14088. event_type.  The previously registered dispatcher (or the
  14089. default dispatcher if there was no previously registered
  14090. dispatcher) is returned.  If proc is NULL, the default pro-
  14091. cedure is restored for the specified type.
  14092.  
  14093. In the future, when XtDispatchEvent is called with an event
  14094. type of event_type, the specified proc (or the default dis-
  14095. patcher) is invoked to determine a widget to which to dis-
  14096. patch the event.
  14097.  
  14098. The default dispatcher handles the Intrinsics modal cascade
  14099. and keyboard focus mechanisms, handles the semantics of com-
  14100. press_enterleave and compress_motion, and discards all
  14101. extension events.
  14102.  
  14103.  
  14104. An event dispatcher procedure pointer is of type
  14105. XtEventDispatchProc.
  14106.  
  14107. __
  14108. |
  14109. typedef Boolean (*XtEventDispatchProc)(XEvent*)
  14110.       XEvent *event;
  14111.  
  14112.  
  14113. event      Passes the event to be dispatched.
  14114. |__
  14115.  
  14116. The event dispatcher procedure should determine whether this
  14117. event is of a type that should be dispatched to a widget.
  14118.  
  14119.  
  14120.  
  14121.  
  14122.                  204
  14123.  
  14124.  
  14125.  
  14126.  
  14127.  
  14128. X Toolkit Intrinsics                 X11 Release 6.4
  14129.  
  14130.  
  14131. If the event should be dispatched to a widget, the event
  14132. dispatcher procedure should determine the appropriate widget
  14133. to receive the event, call XFilterEvent with the window of
  14134. this widget, or None if the event is to be discarded, and if
  14135. XFilterEvent returns False, dispatch the event to the widget
  14136. using XtDispatchEventToWidget.    The procedure should return
  14137. True if either XFilterEvent or XtDispatchEventToWidget
  14138. returned True and False otherwise.
  14139.  
  14140. If the event should not be dispatched to a widget, the event
  14141. dispatcher procedure should attempt to dispatch the event
  14142. elsewhere as appropriate and return True if it successfully
  14143. dispatched the event and False otherwise.
  14144.  
  14145.  
  14146. Some dispatchers for extension events may wish to forward
  14147. events according to the Intrinsics' keyboard focus mecha-
  14148. nism.  To determine which widget is the end result of key-
  14149. board event forwarding, use XtGetKeyboardFocusWidget.
  14150.  
  14151. __
  14152. |
  14153. Widget XtGetKeyboardFocusWidget(widget)
  14154.       Widget widget;
  14155.  
  14156.  
  14157. widget      Specifies the widget to get forwarding information
  14158.       for.
  14159. |__
  14160.  
  14161. The XtGetKeyboardFocusWidget function returns the widget
  14162. that would be the end result of keyboard event forwarding
  14163. for a keyboard event for the specified widget.
  14164.  
  14165.  
  14166. To dispatch an event to a specified widget, use
  14167. XtDispatchEventToWidget.
  14168.  
  14169. __
  14170. |
  14171. Boolean XtDispatchEventToWidget(widget, event)
  14172.       Widget widget;
  14173.       XEvent *event;
  14174.  
  14175.  
  14176. widget      Specifies the widget to which to dispatch the
  14177.       event.
  14178.  
  14179. event      Specifies a pointer to the event to be dispatched.
  14180. |__
  14181.  
  14182. The XtDispatchEventToWidget function scans the list of reg-
  14183. istered event handlers for the specified widget and calls
  14184. each handler that has been registered for the specified
  14185.  
  14186.  
  14187.  
  14188.                  205
  14189.  
  14190.  
  14191.  
  14192.  
  14193.  
  14194. X Toolkit Intrinsics                 X11 Release 6.4
  14195.  
  14196.  
  14197. event type, subject to the continue_to_dispatch value
  14198. returned by each handler.  The Intrinsics behave as if event
  14199. handlers were registered at the head of the list for Expose,
  14200. NoExpose, GraphicsExpose, and VisibilityNotify events to
  14201. invoke the widget's expose procedure according to the expo-
  14202. sure compression rules and to update the widget's visible
  14203. field if visible_interest is True.  These internal event
  14204. handlers never set continue_to_dispatch to False.
  14205.  
  14206. XtDispatchEventToWidget returns True if any event handler
  14207. was called and False otherwise.
  14208.  
  14209.  
  14210. 7.12.  Using the Intrinsics in a Multi-Threaded Environment
  14211.  
  14212. The Intrinsics may be used in environments that offer multi-
  14213. ple threads of execution within the context of a single pro-
  14214. cess.  A multi-threaded application using the Intrinsics
  14215. must explicitly initialize the toolkit for mutually exclu-
  14216. sive access by calling XtToolkitThreadInitialize.
  14217.  
  14218.  
  14219. 7.12.1.  Initializing a Multi-Threaded Intrinsics Applica-
  14220. tion
  14221.  
  14222. To test and initialize Intrinsics support for mutually
  14223. exclusive thread access, call XtToolkitThreadInitialize.
  14224.  
  14225. __
  14226. |
  14227. Boolean XtToolkitThreadInitialize()
  14228.  
  14229. |__
  14230.  
  14231. XtToolkitThreadInitialize returns True if the Intrinsics
  14232. support mutually exclusive thread access, otherwise it
  14233. returns False. XtToolkitThreadInitialize must be called
  14234. before XtCreateApplicationContext, XtAppInitialize,
  14235. XtOpenApplication, or XtSetLanguageProc is called.
  14236. XtToolkitThreadInitialize may be called more than once; how-
  14237. ever, the application writer must ensure that it is not
  14238. called simultaneously by two or more threads.
  14239.  
  14240.  
  14241. 7.12.2.  Locking X Toolkit Data Structures
  14242.  
  14243. The Intrinsics employs two levels of locking: application
  14244. context and process.  Locking an application context ensures
  14245. mutually exclusive access by a thread to the state associ-
  14246. ated with the application context, including all displays
  14247. and widgets associated with it.  Locking a process ensures
  14248. mutually exclusive access by a thread to Intrinsics process
  14249. global data.
  14250.  
  14251.  
  14252.  
  14253.  
  14254.                  206
  14255.  
  14256.  
  14257.  
  14258.  
  14259.  
  14260. X Toolkit Intrinsics                 X11 Release 6.4
  14261.  
  14262.  
  14263. A client may acquire a lock multiple times and the effect is
  14264. cumulative.  The client must ensure that the lock is
  14265. released an equal number of times in order for the lock to
  14266. be acquired by another thread.
  14267.  
  14268. Most application writers will have little need to use lock-
  14269. ing as the Intrinsics performs the necessary locking inter-
  14270. nally.    Resource converters are an exception.  They require
  14271. the application context or process to be locked before the
  14272. application can safely call them directly, for example:
  14273.  
  14274.  
  14275.       ...
  14276.       XtAppLock(app_context);
  14277.       XtCvtStringToPixel(dpy, args, num_args, fromVal, toVal, closure_ret);
  14278.       XtAppUnlock(app_context);
  14279.       ...
  14280.  
  14281.  
  14282. When the application relies upon XtConvertAndStore or a con-
  14283. verter to provide the storage for the results of a conver-
  14284. sion, the application should acquire the process lock before
  14285. calling out and hold the lock until the results have been
  14286. copied.
  14287.  
  14288. Application writers who write their own utility functions,
  14289. such as one which retrieves the being_destroyed field from a
  14290. widget instance, must lock the application context before
  14291. accessing widget internal data.  For example:
  14292.  
  14293.  
  14294.      #include <X11/CoreP.h>
  14295.      Boolean BeingDestroyed (widget)
  14296.       Widget widget;
  14297.      {
  14298.       Boolean ret;
  14299.       XtAppLock(XtWidgetToApplicationContext(widget));
  14300.       ret = widget->core.being_destroyed;
  14301.       XtAppUnlock(XtWidgetToApplicationContext(widget));
  14302.       return ret;
  14303.      }
  14304.  
  14305. A client that wishes to atomically call two or more Intrin-
  14306. sics functions must lock the application context.  For exam-
  14307. ple:
  14308.  
  14309.  
  14310.  
  14311.  
  14312.  
  14313.  
  14314.  
  14315.  
  14316.  
  14317.  
  14318.  
  14319.  
  14320.                  207
  14321.  
  14322.  
  14323.  
  14324.  
  14325.  
  14326. X Toolkit Intrinsics                 X11 Release 6.4
  14327.  
  14328.  
  14329.       ...
  14330.       XtAppLock(XtWidgetToApplicationContext(widget));
  14331.       XtUnmanageChild (widget1);
  14332.       XtManageChild (widget2);
  14333.       XtAppUnlock(XtWidgetToApplicationContext(widget));
  14334.       ...
  14335.  
  14336.  
  14337.  
  14338. 7.12.2.1.  Locking the Application Context
  14339.  
  14340. To ensure mutual exclusion of application context, display,
  14341. or widget internal state, use XtAppLock.
  14342.  
  14343. __
  14344. |
  14345. void XtAppLock(app_context)
  14346.       XtAppContext app_context;
  14347.  
  14348.  
  14349. app_context
  14350.       Specifies the application context to lock.
  14351. |__
  14352.  
  14353. XtAppLock blocks until it is able to acquire the lock.
  14354. Locking the application context also ensures that only the
  14355. thread holding the lock makes Xlib calls from within Xt.  An
  14356. application that makes its own direct Xlib calls must either
  14357. lock the application context around every call or enable
  14358. thread locking in Xlib.
  14359.  
  14360. To unlock a locked application context, use XtAppUnlock.
  14361.  
  14362. __
  14363. |
  14364. void XtAppUnlock(app_context)
  14365.       XtAppContext app_context;
  14366.  
  14367.  
  14368. app_context
  14369.       Specifies the application context that was previ-
  14370.       ously locked.
  14371. |__
  14372.  
  14373.  
  14374.  
  14375. 7.12.2.2.  Locking the Process
  14376.  
  14377. To ensure mutual exclusion of X Toolkit process global data,
  14378. a widget writer must use XtProcessLock.
  14379.  
  14380.  
  14381.  
  14382.  
  14383.  
  14384.  
  14385.  
  14386.                  208
  14387.  
  14388.  
  14389.  
  14390.  
  14391.  
  14392. X Toolkit Intrinsics                 X11 Release 6.4
  14393.  
  14394. __
  14395. |
  14396. void XtProcessLock()
  14397.  
  14398. |__
  14399.  
  14400. XtProcessLock blocks until it is able to acquire the lock.
  14401. Widget writers may use XtProcessLock to guarantee mutually
  14402. exclusive access to widget static data.
  14403.  
  14404. To unlock a locked process, use XtProcessUnlock.
  14405.  
  14406. __
  14407. |
  14408. void XtProcessUnlock()
  14409.  
  14410. |__
  14411.  
  14412. To lock both an application context and the process at the
  14413. same time, call XtAppLock first and then XtProcessLock.  To
  14414. release both locks, call XtProcessUnlock first and then
  14415. XtAppUnlock.  The order is important to avoid deadlock.
  14416.  
  14417.  
  14418. 7.12.3.  Event Management in a Multi-Threaded Environment
  14419.  
  14420. In a nonthreaded environment an application writer could
  14421. reasonably assume that it is safe to exit the application
  14422. from a quit callback.  This assumption may no longer hold
  14423. true in a multi-threaded environment; therefore it is desir-
  14424. able to provide a mechanism to terminate an event-processing
  14425. loop without necessarily terminating its thread.
  14426.  
  14427. To indicate that the event loop should terminate after the
  14428. current event dispatch has completed, use XtAppSetExitFlag.
  14429.  
  14430. __
  14431. |
  14432. void XtAppSetExitFlag(app_context)
  14433.       XtAppContext app_context;
  14434.  
  14435.  
  14436. app_context
  14437.       Specifies the application context.
  14438. |__
  14439.  
  14440. XtAppMainLoop tests the value of the flag and will return if
  14441. the flag is True.
  14442.  
  14443. Application writers who implement their own main loop may
  14444. test the value of the exit flag with XtAppGetExitFlag.
  14445.  
  14446.  
  14447.  
  14448.  
  14449.  
  14450.  
  14451.  
  14452.                  209
  14453.  
  14454.  
  14455.  
  14456.  
  14457.  
  14458. X Toolkit Intrinsics                 X11 Release 6.4
  14459.  
  14460. __
  14461. |
  14462. Boolean XtAppGetExitFlag(app_context)
  14463.       XtAppContext app_context;
  14464.  
  14465.  
  14466. app_context
  14467.       Specifies the application context.
  14468. |__
  14469.  
  14470. XtAppGetExitFlag will normally return False, indicating that
  14471. event processing may continue.    When XtAppGetExitFlag
  14472. returns True, the loop must terminate and return to the
  14473. caller, which might then destroy the application context.
  14474.  
  14475. Application writers should be aware that, if a thread is
  14476. blocked in XtAppNextEvent, XtAppPeekEvent, or XtAppProces-
  14477. sEvent and another thread in the same application context
  14478. opens a new display, adds an alternate input, or a timeout,
  14479. any new source(s) will not normally be "noticed" by the
  14480. blocked thread.  Any new sources are "noticed" the next time
  14481. one of these functions is called.
  14482.  
  14483. The Intrinsics manage access to events on a last-in, first-
  14484. out basis.  If multiple threads in the same application con-
  14485. text block in XtAppNextEvent, XtAppPeekEvent, or
  14486. XtAppProcessEvent, the last thread to call one of these
  14487. functions is the first thread to return.
  14488.  
  14489.  
  14490.  
  14491.  
  14492.  
  14493.  
  14494.  
  14495.  
  14496.  
  14497.  
  14498.  
  14499.  
  14500.  
  14501.  
  14502.  
  14503.  
  14504.  
  14505.  
  14506.  
  14507.  
  14508.  
  14509.  
  14510.  
  14511.  
  14512.  
  14513.  
  14514.  
  14515.  
  14516.  
  14517.  
  14518.                  210
  14519.  
  14520.  
  14521.  
  14522.  
  14523.  
  14524. X Toolkit Intrinsics                 X11 Release 6.4
  14525.  
  14526.  
  14527.  
  14528.  
  14529.              Chapter 8
  14530.  
  14531.              Callbacks
  14532.  
  14533.  
  14534.  
  14535. Applications and other widgets often need to register a pro-
  14536. cedure with a widget that gets called under certain prespec-
  14537. ified conditions.  For example, when a widget is destroyed,
  14538. every procedure on the widget's destroy_callbacks list is
  14539. called to notify clients of the widget's impending doom.
  14540.  
  14541. Every widget has an XtNdestroyCallbacks callback list
  14542. resource.  Widgets can define additional callback lists as
  14543. they see fit.  For example, the Pushbutton widget has a
  14544. callback list to notify clients when the button has been
  14545. activated.
  14546.  
  14547. Except where otherwise noted, it is the intent that all
  14548. Intrinsics functions may be called at any time, including
  14549. from within callback procedures, action routines, and event
  14550. handlers.
  14551.  
  14552.  
  14553. 8.1.  Using Callback Procedure and Callback List Definitions
  14554.  
  14555. Callback procedure pointers for use in callback lists are of
  14556. type XtCallbackProc.
  14557.  
  14558. __
  14559. |
  14560. typedef void (*XtCallbackProc)(Widget, XtPointer, XtPointer);
  14561.       Widget w;
  14562.       XtPointer client_data;
  14563.       XtPointer call_data;
  14564.  
  14565.  
  14566. w      Specifies the widget owning the list in which the
  14567.       callback is registered.
  14568.  
  14569. client_data
  14570.       Specifies additional data supplied by the client
  14571.       when the procedure was registered.
  14572.  
  14573. call_data Specifies any callback-specific data the widget
  14574.       wants to pass to the client.    For example,  when
  14575.       Scrollbar executes its XtNthumbChanged callback
  14576.       list, it passes the new position of the thumb.
  14577. |__
  14578.  
  14579. The client_data argument provides a way for the client reg-
  14580. istering the callback procedure also to register client-
  14581.  
  14582.  
  14583.  
  14584.                  211
  14585.  
  14586.  
  14587.  
  14588.  
  14589.  
  14590. X Toolkit Intrinsics                 X11 Release 6.4
  14591.  
  14592.  
  14593. specific data, for example, a pointer to additional informa-
  14594. tion about the widget, a reason for invoking the callback,
  14595. and so on.  The client_data value may be NULL if all neces-
  14596. sary information is in the widget.  The call_data argument
  14597. is a convenience to avoid having simple cases where the
  14598. client could otherwise always call XtGetValues or a widget-
  14599. specific function to retrieve data from the widget.  Widgets
  14600. should generally avoid putting complex state information in
  14601. call_data.  The client can use the more general data
  14602. retrieval methods, if necessary.
  14603.  
  14604. Whenever a client wants to pass a callback list as an argu-
  14605. ment in an XtCreateWidget, XtSetValues, or XtGetValues call,
  14606. it should specify the address of a NULL-terminated array of
  14607. type XtCallbackList.
  14608.  
  14609. __
  14610. |
  14611. typedef struct {
  14612.      XtCallbackProc callback;
  14613.      XtPointer closure;
  14614. } XtCallbackRec, *XtCallbackList;
  14615.  
  14616. |__
  14617.  
  14618. For example, the callback list for procedures A and B with
  14619. client data clientDataA and clientDataB, respectively, is
  14620.  
  14621.  
  14622. static XtCallbackRec callbacks[] = {
  14623.      {A, (XtPointer) clientDataA},
  14624.      {B, (XtPointer) clientDataB},
  14625.      {(XtCallbackProc) NULL, (XtPointer) NULL}
  14626. };
  14627.  
  14628.  
  14629. Although callback lists are passed by address in arglists
  14630. and varargs lists, the Intrinsics recognize callback lists
  14631. through the widget resource list and will copy the contents
  14632. when necessary.  Widget initialize and set_values procedures
  14633. should not allocate memory for the callback list contents.
  14634. The Intrinsics automatically do this, potentially using a
  14635. different structure for their internal representation.
  14636.  
  14637.  
  14638. 8.2.  Identifying Callback Lists
  14639.  
  14640. Whenever a widget contains a callback list for use by
  14641. clients, it also exports in its public .h file the resource
  14642. name of the callback list.  Applications and client widgets
  14643. never access callback list fields directly.  Instead, they
  14644. always identify the desired callback list by using the
  14645. exported resource name.  All the callback manipulation func-
  14646. tions described in this chapter except XtCallCallbackList
  14647.  
  14648.  
  14649.  
  14650.                  212
  14651.  
  14652.  
  14653.  
  14654.  
  14655.  
  14656. X Toolkit Intrinsics                 X11 Release 6.4
  14657.  
  14658.  
  14659. check to see that the requested callback list is indeed
  14660. implemented by the widget.
  14661.  
  14662. For the Intrinsics to find and correctly handle callback
  14663. lists, they must be declared with a resource type of
  14664. XtRCallback.  The internal representation of a callback list
  14665. is implementation-dependent; widgets may make no assumptions
  14666. about the value stored in this resource if it is non-NULL.
  14667. Except to compare the value to NULL (which is equivalent to
  14668. XtCallbackStatus XtCallbackHasNone), access to callback list
  14669. resources must be made through other Intrinsics procedures.
  14670.  
  14671.  
  14672. 8.3.  Adding Callback Procedures
  14673.  
  14674. To add a callback procedure to a widget's callback list, use
  14675. XtAddCallback.
  14676.  
  14677. __
  14678. |
  14679. void XtAddCallback(w, callback_name, callback, client_data)
  14680.       Widget w;
  14681.       String callback_name;
  14682.       XtCallbackProc callback;
  14683.       XtPointer client_data;
  14684.  
  14685.  
  14686. w      Specifies the widget.  Must be of class Object or
  14687.       any subclass thereof.
  14688.  
  14689. callback_name
  14690.       Specifies the callback list to which the procedure
  14691.       is to be appended.
  14692.  
  14693. callback  Specifies the callback procedure.
  14694.  
  14695. client_data
  14696.       Specifies additional data to be passed to the
  14697.       specified procedure when it is invoked, or NULL.
  14698. |__
  14699.  
  14700. A callback will be invoked as many times as it occurs in the
  14701. callback list.
  14702.  
  14703.  
  14704. To add a list of callback procedures to a given widget's
  14705. callback list, use XtAddCallbacks.
  14706.  
  14707.  
  14708.  
  14709.  
  14710.  
  14711.  
  14712.  
  14713.  
  14714.  
  14715.  
  14716.                  213
  14717.  
  14718.  
  14719.  
  14720.  
  14721.  
  14722. X Toolkit Intrinsics                 X11 Release 6.4
  14723.  
  14724. __
  14725. |
  14726. void XtAddCallbacks(w, callback_name, callbacks)
  14727.       Widget w;
  14728.       String callback_name;
  14729.       XtCallbackList callbacks;
  14730.  
  14731.  
  14732. w      Specifies the widget.  Must be of class Object or
  14733.       any subclass thereof.
  14734.  
  14735. callback_name
  14736.       Specifies the callback list to which the proce-
  14737.       dures are to be appended.
  14738.  
  14739. callbacks Specifies the null-terminated list of callback
  14740.       procedures and corresponding client data.
  14741. |__
  14742.  
  14743.  
  14744. 8.4.  Removing Callback Procedures
  14745.  
  14746. To delete a callback procedure from a widget's callback
  14747. list, use XtRemoveCallback.
  14748.  
  14749. __
  14750. |
  14751. void XtRemoveCallback(w, callback_name, callback, client_data)
  14752.       Widget w;
  14753.       String callback_name;
  14754.       XtCallbackProc callback;
  14755.       XtPointer client_data;
  14756.  
  14757.  
  14758. w      Specifies the widget.  Must be of class Object or
  14759.       any subclass thereof.
  14760.  
  14761. callback_name
  14762.       Specifies the callback list from which the proce-
  14763.       dure is to be deleted.
  14764.  
  14765. callback  Specifies the callback procedure.
  14766.  
  14767. client_data
  14768.       Specifies the client data to match with the regis-
  14769.       tered callback entry.
  14770. |__
  14771.  
  14772. The XtRemoveCallback function removes a callback only if
  14773. both the procedure and the client data match.
  14774.  
  14775.  
  14776. To delete a list of callback procedures from a given wid-
  14777. get's callback list, use XtRemoveCallbacks.
  14778.  
  14779.  
  14780.  
  14781.  
  14782.                  214
  14783.  
  14784.  
  14785.  
  14786.  
  14787.  
  14788. X Toolkit Intrinsics                 X11 Release 6.4
  14789.  
  14790. __
  14791. |
  14792. void XtRemoveCallbacks(w, callback_name, callbacks)
  14793.       Widget w;
  14794.       String callback_name;
  14795.       XtCallbackList callbacks;
  14796.  
  14797.  
  14798. w      Specifies the widget.  Must be of class Object or
  14799.       any subclass thereof.
  14800.  
  14801. callback_name
  14802.       Specifies the callback list from which the proce-
  14803.       dures are to be deleted.
  14804.  
  14805. callbacks Specifies the null-terminated list of callback
  14806.       procedures and corresponding client data.
  14807. |__
  14808.  
  14809. To delete all callback procedures from a given widget's
  14810. callback list and free all storage associated with the call-
  14811. back list, use XtRemoveAllCallbacks.
  14812.  
  14813. __
  14814. |
  14815. void XtRemoveAllCallbacks(w, callback_name)
  14816.       Widget w;
  14817.       String callback_name;
  14818.  
  14819.  
  14820. w      Specifies the widget.  Must be of class Object or
  14821.       any subclass thereof.
  14822.  
  14823. callback_name
  14824.       Specifies the callback list to be cleared.
  14825. |__
  14826.  
  14827.  
  14828. 8.5.  Executing Callback Procedures
  14829.  
  14830. To execute the procedures in a given widget's callback list,
  14831. specifying the callback list by resource name, use
  14832. XtCallCallbacks.
  14833.  
  14834.  
  14835.  
  14836.  
  14837.  
  14838.  
  14839.  
  14840.  
  14841.  
  14842.  
  14843.  
  14844.  
  14845.  
  14846.  
  14847.  
  14848.                  215
  14849.  
  14850.  
  14851.  
  14852.  
  14853.  
  14854. X Toolkit Intrinsics                 X11 Release 6.4
  14855.  
  14856. __
  14857. |
  14858. void XtCallCallbacks(w, callback_name, call_data)
  14859.       Widget w;
  14860.       String callback_name;
  14861.       XtPointer call_data;
  14862.  
  14863.  
  14864. w      Specifies the widget.  Must be of class Object or
  14865.       any subclass thereof.
  14866.  
  14867. callback_name
  14868.       Specifies the callback list to be executed.
  14869.  
  14870. call_data Specifies a callback-list-specific data value to
  14871.       pass to each of the callback procedure in the
  14872.       list, or NULL.
  14873. |__
  14874.  
  14875.  
  14876. XtCallCallbacks calls each of the callback procedures in the
  14877. list named by callback_name in the specified widget, passing
  14878. the client data registered with the procedure and call-data.
  14879.  
  14880.  
  14881. To execute the procedures in a callback list, specifying the
  14882. callback list by address, use XtCallCallbackList.
  14883.  
  14884. __
  14885. |
  14886. void XtCallCallbackList(widget, callbacks, call_data)
  14887.       Widget widget;
  14888.       XtCallbackList callbacks;
  14889.       XtPointer call_data;
  14890.  
  14891.  
  14892. widget      Specifies the widget instance that contains the
  14893.       callback list.  Must be of class Object or any
  14894.       subclass thereof.
  14895.  
  14896. callbacks Specifies the callback list to be executed.
  14897.  
  14898. call_data Specifies a callback-list-specific data value to
  14899.       pass to each of the callback procedures in the
  14900.       list, or NULL.
  14901. |__
  14902.  
  14903. The callbacks parameter must specify the contents of a wid-
  14904. get or object resource declared with representation type
  14905. XtRCallback.  If callbacks is NULL, XtCallCallbackList
  14906. returns immediately; otherwise it calls each of the callback
  14907. procedures in the list, passing the client data and
  14908. call_data.
  14909.  
  14910.  
  14911.  
  14912.  
  14913.  
  14914.                  216
  14915.  
  14916.  
  14917.  
  14918.  
  14919.  
  14920. X Toolkit Intrinsics                 X11 Release 6.4
  14921.  
  14922.  
  14923. 8.6.  Checking the Status of a Callback List
  14924.  
  14925. To find out the status of a given widget's callback list,
  14926. use XtHasCallbacks.
  14927.  
  14928.  
  14929. __
  14930. |
  14931. typedef enum {XtCallbackNoList, XtCallbackHasNone, XtCallbackHasSome} XtCallbackStatus;
  14932.  
  14933. XtCallbackStatus XtHasCallbacks(w, callback_name)
  14934.       Widget w;
  14935.       String callback_name;
  14936.  
  14937.  
  14938. w      Specifies the widget.  Must be of class Object or
  14939.       any subclass thereof.
  14940.  
  14941. callback_name
  14942.       Specifies the callback list to be checked.
  14943. |__
  14944.  
  14945. The XtHasCallbacks function first checks to see if the wid-
  14946. get has a callback list identified by callback_name.  If the
  14947. callback list does not exist, XtHasCallbacks returns
  14948. XtCallbackNoList.  If the callback list exists but is empty,
  14949. it returns XtCallbackHasNone.  If the callback list exists
  14950. and has at least one callback registered, it returns
  14951. XtCallbackHasSome.
  14952.  
  14953.  
  14954.  
  14955.  
  14956.  
  14957.  
  14958.  
  14959.  
  14960.  
  14961.  
  14962.  
  14963.  
  14964.  
  14965.  
  14966.  
  14967.  
  14968.  
  14969.  
  14970.  
  14971.  
  14972.  
  14973.  
  14974.  
  14975.  
  14976.  
  14977.  
  14978.  
  14979.  
  14980.                  217
  14981.  
  14982.  
  14983.  
  14984.  
  14985.  
  14986. X Toolkit Intrinsics                 X11 Release 6.4
  14987.  
  14988.  
  14989.  
  14990.  
  14991.              Chapter 9
  14992.  
  14993.             Resource Management
  14994.  
  14995.  
  14996.  
  14997. A resource is a field in the widget record with a corre-
  14998. sponding resource entry in the resources list of the widget
  14999. or any of its superclasses.  This means that the field is
  15000. settable by XtCreateWidget (by naming the field in the argu-
  15001. ment list), by an entry in a resource file (by using either
  15002. the name or class), and by XtSetValues.  In addition, it is
  15003. readable by XtGetValues.  Not all fields in a widget record
  15004. are resources.    Some are for bookkeeping use by the generic
  15005. routines (like managed and being_destroyed).  Others can be
  15006. for local bookkeeping, and still others are derived from
  15007. resources (many graphics contexts and pixmaps).
  15008.  
  15009. Widgets typically need to obtain a large set of resources at
  15010. widget creation time.  Some of the resources come from the
  15011. argument list supplied in the call to XtCreateWidget, some
  15012. from the resource database, and some from the internal
  15013. defaults specified by the widget.  Resources are obtained
  15014. first from the argument list, then from the resource
  15015. database for all resources not specified in the argument
  15016. list, and last, from the internal default, if needed.
  15017.  
  15018.  
  15019. 9.1.  Resource Lists
  15020.  
  15021. A resource entry specifies a field in the widget, the tex-
  15022. tual name and class of the field that argument lists and
  15023. external resource files use to refer to the field, and a
  15024. default value that the field should get if no value is spec-
  15025. ified.    The declaration for the XtResource structure is
  15026.  
  15027. __
  15028. |
  15029. typedef struct {
  15030.      String resource_name;
  15031.      String resource_class;
  15032.      String resource_type;
  15033.      Cardinal resource_size;
  15034.      Cardinal resource_offset;
  15035.      String default_type;
  15036.      XtPointer default_addr;
  15037. } XtResource, *XtResourceList;
  15038. |__
  15039.  
  15040.  
  15041.  
  15042.  
  15043.  
  15044.  
  15045.  
  15046.                  218
  15047.  
  15048.  
  15049.  
  15050.  
  15051.  
  15052. X Toolkit Intrinsics                 X11 Release 6.4
  15053.  
  15054.  
  15055. When the resource list is specified as the CoreClassPart,
  15056. ObjectClassPart, RectObjClassPart, or ConstraintClassPart
  15057. resources field, the strings pointed to by resource_name,
  15058. resource_class, resource_type, and default_type must be per-
  15059. manently allocated prior to or during the execution of the
  15060. class initialization procedure and must not be subsequently
  15061. deallocated.
  15062.  
  15063.  
  15064. The resource_name field contains the name used by clients to
  15065. access the field in the widget.  By convention, it starts
  15066. with a lowercase letter and is spelled exactly like the
  15067. field name, except all underscores (_) are deleted and the
  15068. next letter is replaced by its uppercase counterpart.  For
  15069. example, the resource name for background_pixel becomes
  15070. backgroundPixel.  Resource names beginning with the two-
  15071. character sequence ``xt'', and resource classes beginning
  15072. with the two-character sequence ``Xt'' are reserved to the
  15073. Intrinsics for future standard and implementation-dependent
  15074. uses.  Widget header files typically contain a symbolic name
  15075. for each resource name.  All resource names, classes, and
  15076. types used by the Intrinsics are named in
  15077. <X11/StringDefs.h>.  The Intrinsics's symbolic resource
  15078. names begin with ``XtN'' and are followed by the string name
  15079. (for example, XtNbackgroundPixel for backgroundPixel).
  15080.  
  15081.  
  15082. The resource_class field contains the class string used in
  15083. resource specification files to identify the field.  A
  15084. resource class provides two functions:
  15085.  
  15086. o    It isolates an application from different representa-
  15087.      tions that widgets can use for a similar resource.
  15088.  
  15089. o    It lets you specify values for several actual resources
  15090.      with a single name.  A resource class should be chosen
  15091.      to span a group of closely related fields.
  15092.  
  15093. For example, a widget can have several pixel resources:
  15094. background, foreground, border, block cursor, pointer cur-
  15095. sor, and so on.  Typically, the background defaults to white
  15096. and everything else to black.  The resource class for each
  15097. of these resources in the resource list should be chosen so
  15098. that it takes the minimal number of entries in the resource
  15099. database to make the background ivory and everything else
  15100. darkblue.
  15101.  
  15102. In this case, the background pixel should have a resource
  15103. class of ``Background'' and all the other pixel entries a
  15104. resource class of ``Foreground''.  Then, the resource file
  15105. needs only two lines to change all pixels to ivory or dark-
  15106. blue:
  15107.  
  15108.  
  15109.  
  15110.  
  15111.  
  15112.                  219
  15113.  
  15114.  
  15115.  
  15116.  
  15117.  
  15118. X Toolkit Intrinsics                 X11 Release 6.4
  15119.  
  15120.  
  15121. *Background:   ivory
  15122. *Foreground:   darkblue
  15123.  
  15124.  
  15125. Similarly, a widget may have several font resources (such as
  15126. normal and bold), but all fonts should have the class Font.
  15127. Thus, changing all fonts simply requires only a single line
  15128. in the default resource file:
  15129.  
  15130.  
  15131. *Font:                  6x13
  15132.  
  15133.  
  15134. By convention, resource classes are always spelled starting
  15135. with a capital letter to distinguish them from resource
  15136. names.    Their symbolic names are preceded with ``XtC'' (for
  15137. example, XtCBackground).
  15138.  
  15139. The resource_type field gives the physical representation
  15140. type of the resource and also encodes information about the
  15141. specific usage of the field.  By convention, it starts with
  15142. an uppercase letter and is spelled identically to the type
  15143. name of the field.  The resource type is used when resources
  15144. are fetched to convert from the resource database format
  15145. (usually String) or the format of the resource default value
  15146. (almost anything, but often String) to the desired physical
  15147. representation (see Section 9.6).  The Intrinsics define the
  15148. following resource types:
  15149.  
  15150. ------------------------------------------------------
  15151. Resource Type            Structure or Field Type
  15152. ------------------------------------------------------
  15153. XtRAcceleratorTable        XtAccelerators
  15154. XtRAtom             Atom
  15155. XtRBitmap            Pixmap, depth=1
  15156. XtRBoolean            Boolean
  15157. XtRBool             Bool
  15158. XtRCallback            XtCallbackList
  15159. XtRCardinal            Cardinal
  15160. XtRColor            XColor
  15161. XtRColormap            Colormap
  15162. XtRCommandArgArray        String*
  15163. XtRCursor            Cursor
  15164. XtRDimension            Dimension
  15165. XtRDirectoryString        String
  15166. XtRDisplay            Display*
  15167. XtREnum             XtEnum
  15168. XtREnvironmentArray        String*
  15169. XtRFile             FILE*
  15170. XtRFloat            float
  15171. XtRFont             Font
  15172. XtRFontSet            XFontSet
  15173. XtRFontStruct            XFontStruct*
  15174.  
  15175.  
  15176.  
  15177.  
  15178.                  220
  15179.  
  15180.  
  15181.  
  15182.  
  15183.  
  15184. X Toolkit Intrinsics                 X11 Release 6.4
  15185.  
  15186.  
  15187. ------------------------------------------------------
  15188. Resource Type            Structure or Field Type
  15189. ------------------------------------------------------
  15190. XtRFunction            (*)()
  15191. XtRGeometry            char*, format as defined
  15192.                 by XParseGeometry
  15193. XtRGravity            int
  15194. XtRInitialState         int
  15195. XtRInt                int
  15196. XtRLongBoolean            long
  15197. XtRObject            Object
  15198. XtRPixel            Pixel
  15199. XtRPixmap            Pixmap
  15200. XtRPointer            XtPointer
  15201. XtRPosition            Position
  15202. XtRRestartStyle         unsigned char
  15203. XtRScreen            Screen*
  15204. XtRShort            short
  15205. XtRSmcConn            XtPointer
  15206. XtRString            String
  15207. XtRStringArray            String*
  15208. XtRStringTable            String*
  15209. XtRTranslationTable        XtTranslations
  15210. XtRUnsignedChar         unsigned char
  15211. XtRVisual            Visual*
  15212. XtRWidget            Widget
  15213. XtRWidgetClass            WidgetClass
  15214. XtRWidgetList            WidgetList
  15215. XtRWindow            Window
  15216. ------------------------------------------------------
  15217.  
  15218.  
  15219.  
  15220. <X11/StringDefs.h> also defines the following resource types
  15221. as a convenience for widgets, although they do not have any
  15222. corresponding data type assigned: XtREditMode, XtRJustify,
  15223. and XtROrientation.
  15224.  
  15225. The resource_size field is the size of the physical repre-
  15226. sentation in bytes; you should specify it as sizeof(type) so
  15227. that the compiler fills in the value.  The resource_offset
  15228. field is the offset in bytes of the field within the widget.
  15229. You should use the XtOffsetOf macro to retrieve this value.
  15230. The default_type field is the representation type of the
  15231. default resource value.  If default_type is different from
  15232. resource_type and the default value is needed, the resource
  15233. manager invokes a conversion procedure from default_type to
  15234. resource_type.    Whenever possible, the default type should
  15235. be identical to the resource type in order to minimize wid-
  15236. get creation time.  However, there are sometimes no values
  15237. of the type that the program can easily specify.  In this
  15238. case, it should be a value for which the converter is guar-
  15239. anteed to work (for example, XtDefaultForeground for a pixel
  15240. resource).  The default_addr field specifies the address of
  15241.  
  15242.  
  15243.  
  15244.                  221
  15245.  
  15246.  
  15247.  
  15248.  
  15249.  
  15250. X Toolkit Intrinsics                 X11 Release 6.4
  15251.  
  15252.  
  15253. the default resource value.  As a special case, if
  15254. default_type is XtRString, then the value in the
  15255. default_addr field is the pointer to the string rather than
  15256. a pointer to the pointer.  The default is used if a resource
  15257. is not specified in the argument list or in the resource
  15258. database or if the conversion from the representation type
  15259. stored in the resource database fails, which can happen for
  15260. various reasons (for example, a misspelled entry in a
  15261. resource file).
  15262.  
  15263. Two special representation types (XtRImmediate and XtRCall-
  15264. Proc) are usable only as default resource types.  XtRImmedi-
  15265. ate indicates that the value in the default_addr field is
  15266. the actual value of the resource rather than the address of
  15267. the value.  The value must be in the correct representation
  15268. type for the resource, coerced to an XtPointer.  No conver-
  15269. sion is possible, since there is no source representation
  15270. type.  XtRCallProc indicates that the value in the
  15271. default_addr field is a procedure pointer.  This procedure
  15272. is automatically invoked with the widget, resource_offset,
  15273. and a pointer to an XrmValue in which to store the result.
  15274. XtRCallProc procedure pointers are of type
  15275. XtResourceDefaultProc.
  15276.  
  15277. __
  15278. |
  15279. typedef void (*XtResourceDefaultProc)(Widget, int, XrmValue*);
  15280.       Widget w;
  15281.       int offset;
  15282.       XrmValue *value;
  15283.  
  15284.  
  15285. w      Specifies the widget whose resource value is to be
  15286.       obtained.
  15287.  
  15288. offset      Specifies the offset of the field in the widget
  15289.       record.
  15290.  
  15291. value      Specifies the resource value descriptor to return.
  15292. |__
  15293.  
  15294. The XtResourceDefaultProc procedure should fill in the
  15295. value->addr field with a pointer to the resource value in
  15296. its correct representation type.
  15297.  
  15298.  
  15299. To get the resource list structure for a particular class,
  15300. use XtGetResourceList.
  15301.  
  15302.  
  15303.  
  15304.  
  15305.  
  15306.  
  15307.  
  15308.  
  15309.  
  15310.                  222
  15311.  
  15312.  
  15313.  
  15314.  
  15315.  
  15316. X Toolkit Intrinsics                 X11 Release 6.4
  15317.  
  15318. __
  15319. |
  15320. void XtGetResourceList(class, resources_return, num_resources_return);
  15321.       WidgetClass class;
  15322.       XtResourceList *resources_return;
  15323.       Cardinal *num_resources_return;
  15324.  
  15325.  
  15326. class           Specifies the object class to be queried.  It
  15327.            must be objectClass or any subclass thereof.
  15328.  
  15329. resources_return
  15330.            Returns the resource list.
  15331.  
  15332. num_resources_return
  15333.            Returns the number of entries in the resource
  15334.            list.
  15335. |__
  15336.  
  15337. If XtGetResourceList is called before the class is initial-
  15338. ized, it returns the resource list as specified in the class
  15339. record.  If it is called after the class has been initial-
  15340. ized, XtGetResourceList returns a merged resource list that
  15341. includes the resources for all superclasses.  The list
  15342. returned by XtGetResourceList should be freed using XtFree
  15343. when it is no longer needed.
  15344.  
  15345.  
  15346. To get the constraint resource list structure for a particu-
  15347. lar widget class, use XtGetConstraintResourceList.
  15348.  
  15349. __
  15350. |
  15351. void XtGetConstraintResourceList(class, resources_return, num_resources_return)
  15352.       WidgetClass class;
  15353.       XtResourceList *resources_return;
  15354.       Cardinal *num_resources_return;
  15355.  
  15356.  
  15357. class           Specifies the object class to be queried.  It
  15358.            must be objectClass or any subclass thereof.
  15359.  
  15360. resources_return
  15361.            Returns the constraint resource list.
  15362.  
  15363. num_resources_return
  15364.            Returns the number of entries in the con-
  15365.            straint resource list.
  15366. |__
  15367.  
  15368. If XtGetConstraintResourceList is called before the widget
  15369. class is initialized, the resource list as specified in the
  15370. widget class Constraint part is returned.  If XtGetCon-
  15371. straintResourceList is called after the widget class has
  15372. been initialized, the merged resource list for the class and
  15373.  
  15374.  
  15375.  
  15376.                  223
  15377.  
  15378.  
  15379.  
  15380.  
  15381.  
  15382. X Toolkit Intrinsics                 X11 Release 6.4
  15383.  
  15384.  
  15385. all Constraint superclasses is returned.  If the specified
  15386. class is not a subclass of constraintWidgetClass,
  15387. *resources_return is set to NULL and *num_resources_return
  15388. is set to zero.  The list returned by XtGetConstraintRe-
  15389. sourceList should be freed using XtFree when it is no longer
  15390. needed.
  15391.  
  15392.  
  15393. The routines XtSetValues and XtGetValues also use the
  15394. resource list to set and get widget state; see Sections
  15395. 9.7.1 and 9.7.2.
  15396.  
  15397. Here is an abbreviated version of a possible resource list
  15398. for a Label widget:
  15399.  
  15400.  
  15401.      /* Resources specific to Label */
  15402.      static XtResource resources[] = {
  15403.      {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
  15404.     XtOffsetOf(LabelRec, label.foreground), XtRString, XtDefaultForeground},
  15405.      {XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct*),
  15406.     XtOffsetOf(LabelRec, label.font), XtRString, XtDefaultFont},
  15407.      {XtNlabel, XtCLabel, XtRString, sizeof(String),
  15408.     XtOffsetOf(LabelRec, label.label), XtRString, NULL},
  15409.       .
  15410.       .
  15411.       .
  15412.      }
  15413.  
  15414.  
  15415. The complete resource name for a field of a widget instance
  15416. is the concatenation of the application shell name (from
  15417. XtAppCreateShell), the instance names of all the widget's
  15418. parents up to the top of the widget tree, the instance name
  15419. of the widget itself, and the resource name of the specified
  15420. field of the widget.  Similarly, the full resource class of
  15421. a field of a widget instance is the concatenation of the
  15422. application class (from XtAppCreateShell), the widget class
  15423. names of all the widget's parents up to the top of the wid-
  15424. get tree, the widget class name of the widget itself, and
  15425. the resource class of the specified field of the widget.
  15426.  
  15427.  
  15428. 9.2.  Byte Offset Calculations
  15429.  
  15430. To determine the byte offset of a field within a structure
  15431. type, use XtOffsetOf.
  15432.  
  15433.  
  15434.  
  15435.  
  15436.  
  15437.  
  15438.  
  15439.  
  15440.  
  15441.  
  15442.                  224
  15443.  
  15444.  
  15445.  
  15446.  
  15447.  
  15448. X Toolkit Intrinsics                 X11 Release 6.4
  15449.  
  15450. __
  15451. |
  15452. Cardinal XtOffsetOf(structure_type, field_name)
  15453.       Type structure_type;
  15454.       Field field_name;
  15455.  
  15456.  
  15457. structure_type
  15458.       Specifies a type that is declared as a structure.
  15459.  
  15460. field_name
  15461.       Specifies the name of a member within the struc-
  15462.       ture.
  15463. |__
  15464.  
  15465. The XtOffsetOf macro expands to a constant expression that
  15466. gives the offset in bytes to the specified structure member
  15467. from the beginning of the structure.  It is normally used to
  15468. statically initialize resource lists and is more portable
  15469. than XtOffset, which serves the same function.
  15470.  
  15471.  
  15472. To determine the byte offset of a field within a structure
  15473. pointer type, use XtOffset.
  15474.  
  15475. __
  15476. |
  15477. Cardinal XtOffset(pointer_type, field_name)
  15478.       Type pointer_type;
  15479.       Field field_name;
  15480.  
  15481.  
  15482. pointer_type
  15483.       Specifies a type that is declared as a pointer to
  15484.       a structure.
  15485.  
  15486. field_name
  15487.       Specifies the name of a member within the struc-
  15488.       ture.
  15489. |__
  15490.  
  15491. The XtOffset macro expands to a constant expression that
  15492. gives the offset in bytes to the specified structure member
  15493. from the beginning of the structure.  It may be used to
  15494. statically initialize resource lists.  XtOffset is less
  15495. portable than XtOffsetOf.
  15496.  
  15497.  
  15498. 9.3.  Superclass-to-Subclass Chaining of Resource Lists
  15499.  
  15500. The XtCreateWidget function gets resources as a superclass-
  15501. to-subclass chained operation.    That is, the resources spec-
  15502. ified in the objectClass resource list are fetched, then
  15503. those in rectObjClass, and so on down to the resources spec-
  15504. ified for this widget's class. Within a class, resources are
  15505.  
  15506.  
  15507.  
  15508.                  225
  15509.  
  15510.  
  15511.  
  15512.  
  15513.  
  15514. X Toolkit Intrinsics                 X11 Release 6.4
  15515.  
  15516.  
  15517. fetched in the order they are declared.
  15518.  
  15519. In general, if a widget resource field is declared in a
  15520. superclass, that field is included in the superclass's
  15521. resource list and need not be included in the subclass's
  15522. resource list.    For example, the Core class contains a
  15523. resource entry for background_pixel.  Consequently, the
  15524. implementation of Label need not also have a resource entry
  15525. for background_pixel.  However, a subclass, by specifying a
  15526. resource entry for that field in its own resource list, can
  15527. override the resource entry for any field declared in a
  15528. superclass.  This is most often done to override the
  15529. defaults provided in the superclass with new ones.  At class
  15530. initialization time, resource lists for that class are
  15531. scanned from the superclass down to the class to look for
  15532. resources with the same offset.  A matching resource in a
  15533. subclass will be reordered to override the superclass entry.
  15534. If reordering is necessary, a copy of the superclass
  15535. resource list is made to avoid affecting other subclasses of
  15536. the superclass.
  15537.  
  15538. Also at class initialization time, the Intrinsics produce an
  15539. internal representation of the resource list to optimize
  15540. access time when creating widgets.  In order to save memory,
  15541. the Intrinsics may overwrite the storage allocated for the
  15542. resource list in the class record; therefore, widgets must
  15543. allocate resource lists in writable storage and must not
  15544. access the list contents directly after the class_initialize
  15545. procedure has returned.
  15546.  
  15547.  
  15548. 9.4.  Subresources
  15549.  
  15550. A widget does not do anything to retrieve its own resources;
  15551. instead, XtCreateWidget does this automatically before call-
  15552. ing the class initialize procedure.
  15553.  
  15554. Some widgets have subparts that are not widgets but for
  15555. which the widget would like to fetch resources.  Such wid-
  15556. gets call XtGetSubresources to accomplish this.
  15557.  
  15558.  
  15559.  
  15560.  
  15561.  
  15562.  
  15563.  
  15564.  
  15565.  
  15566.  
  15567.  
  15568.  
  15569.  
  15570.  
  15571.  
  15572.  
  15573.  
  15574.                  226
  15575.  
  15576.  
  15577.  
  15578.  
  15579.  
  15580. X Toolkit Intrinsics                 X11 Release 6.4
  15581.  
  15582. __
  15583. |
  15584. void XtGetSubresources(w, base, name, class, resources, num_resources, args, num_args)
  15585.       Widget w;
  15586.       XtPointer base;
  15587.       String name;
  15588.       String class;
  15589.       XtResourceList resources;
  15590.       Cardinal num_resources;
  15591.       ArgList args;
  15592.       Cardinal num_args;
  15593.  
  15594.  
  15595. w      Specifies the object used to qualify the subpart
  15596.       resource name and class.  Must be of class Object
  15597.       or any subclass thereof.
  15598.  
  15599. base      Specifies the base address of the subpart data
  15600.       structure into which the resources will be writ-
  15601.       ten.
  15602.  
  15603. name      Specifies the name of the subpart.
  15604.  
  15605. class      Specifies the class of the subpart.
  15606.  
  15607. resources Specifies the resource list for the subpart.
  15608.  
  15609. num_resources
  15610.       Specifies the number of entries in the resource
  15611.       list.
  15612.  
  15613. args      Specifies the argument list to override any other
  15614.       resource specifications.
  15615.  
  15616. num_args  Specifies the number of entries in the argument
  15617.       list.
  15618. |__
  15619.  
  15620. The XtGetSubresources function constructs a name and class
  15621. list from the application name and class, the names and
  15622. classes of all the object's ancestors, and the object
  15623. itself.  Then it appends to this list the name and class
  15624. pair passed in.  The resources are fetched from the argument
  15625. list, the resource database, or the default values in the
  15626. resource list.    Then they are copied into the subpart
  15627. record.  If args is NULL, num_args must be zero.  However,
  15628. if num_args is zero, the argument list is not referenced.
  15629.  
  15630. XtGetSubresources may overwrite the specified resource list
  15631. with an equivalent representation in an internal format,
  15632. which optimizes access time if the list is used repeatedly.
  15633. The resource list must be allocated in writable storage, and
  15634. the caller must not modify the list contents after the call
  15635. if the same list is to be used again.  Resources fetched by
  15636. XtGetSubresources are reference-counted as if they were
  15637.  
  15638.  
  15639.  
  15640.                  227
  15641.  
  15642.  
  15643.  
  15644.  
  15645.  
  15646. X Toolkit Intrinsics                 X11 Release 6.4
  15647.  
  15648.  
  15649. referenced by the specified object.  Subresources might
  15650. therefore be freed from the conversion cache and destroyed
  15651. when the object is destroyed, but not before then.
  15652.  
  15653.  
  15654. To fetch resources for widget subparts using varargs lists,
  15655. use XtVaGetSubresources.
  15656.  
  15657. __
  15658. |
  15659. void XtVaGetSubresources(w, base, name, class, resources, num_resources, ...)
  15660.     Widget w;
  15661.     XtPointer base;
  15662.     String name;
  15663.     String class;
  15664.     XtResourceList resources;
  15665.     Cardinal num_resources;
  15666.  
  15667.  
  15668. w      Specifies the object used to qualify the subpart
  15669.       resource name and class.  Must be of class Object
  15670.       or any subclass thereof.
  15671.  
  15672. base      Specifies the base address of the subpart data
  15673.       structure into which the resources will be writ-
  15674.       ten.
  15675.  
  15676. name      Specifies the name of the subpart.
  15677.  
  15678. class      Specifies the class of the subpart.
  15679.  
  15680. resources Specifies the resource list for the subpart.
  15681.  
  15682. num_resources
  15683.       Specifies the number of entries in the resource
  15684.       list.
  15685.  
  15686. ...      Specifies the variable argument list to override
  15687.       any other resource specifications.
  15688. |__
  15689.  
  15690. XtVaGetSubresources is identical in function to XtGetSubre-
  15691. sources with the args and num_args parameters replaced by a
  15692. varargs list, as described in Section 2.5.1.
  15693.  
  15694.  
  15695. 9.5.  Obtaining Application Resources
  15696.  
  15697. To retrieve resources that are not specific to a widget but
  15698. apply to the overall application, use
  15699. XtGetApplicationResources.
  15700.  
  15701.  
  15702.  
  15703.  
  15704.  
  15705.  
  15706.                  228
  15707.  
  15708.  
  15709.  
  15710.  
  15711.  
  15712. X Toolkit Intrinsics                 X11 Release 6.4
  15713.  
  15714. __
  15715. |
  15716. void XtGetApplicationResources(w, base, resources, num_resources, args, num_args)
  15717.       Widget w;
  15718.       XtPointer base;
  15719.       XtResourceList resources;
  15720.       Cardinal num_resources;
  15721.       ArgList args;
  15722.       Cardinal num_args;
  15723.  
  15724.  
  15725. w      Specifies the object that identifies the resource
  15726.       database to search (the database is that associ-
  15727.       ated with the display for this object).  Must be
  15728.       of class Object or any subclass thereof.
  15729.  
  15730. base      Specifies the base address into which the resource
  15731.       values will be written.
  15732.  
  15733. resources Specifies the resource list.
  15734.  
  15735. num_resources
  15736.       Specifies the number of entries in the resource
  15737.       list.
  15738.  
  15739. args      Specifies the argument list to override any other
  15740.       resource specifications.
  15741.  
  15742. num_args  Specifies the number of entries in the argument
  15743.       list.
  15744. |__
  15745.  
  15746. The XtGetApplicationResources function first uses the passed
  15747. object, which is usually an application shell widget, to
  15748. construct a resource name and class list.  The full name and
  15749. class of the specified object (that is, including its ances-
  15750. tors, if any) is logically added to the front of each
  15751. resource name and class.  Then it retrieves the resources
  15752. from the argument list, the resource database, or the
  15753. resource list default values.  After adding base to each
  15754. address, XtGetApplicationResources copies the resources into
  15755. the addresses obtained by adding base to each offset in the
  15756. resource list.    If args is NULL, num_args must be zero.
  15757. However, if num_args is zero, the argument list is not ref-
  15758. erenced.  The portable way to specify application resources
  15759. is to declare them as members of a structure and pass the
  15760. address of the structure as the base argument.
  15761.  
  15762. XtGetApplicationResources may overwrite the specified
  15763. resource list with an equivalent representation in an inter-
  15764. nal format, which optimizes access time if the list is used
  15765. repeatedly.  The resource list must be allocated in writable
  15766. storage, and the caller must not modify the list contents
  15767. after the call if the same list is to be used again.  Any
  15768. per-display resources fetched by XtGetApplicationResources
  15769.  
  15770.  
  15771.  
  15772.                  229
  15773.  
  15774.  
  15775.  
  15776.  
  15777.  
  15778. X Toolkit Intrinsics                 X11 Release 6.4
  15779.  
  15780.  
  15781. will not be freed from the resource cache until the display
  15782. is closed.
  15783.  
  15784.  
  15785. To retrieve resources for the overall application using
  15786. varargs lists, use XtVaGetApplicationResources.
  15787.  
  15788. __
  15789. |
  15790. void XtVaGetApplicationResources(w, base, resources, num_resources, ...)
  15791.       Widget w;
  15792.       XtPointer base;
  15793.       XtResourceList resources;
  15794.       Cardinal num_resources;
  15795.  
  15796.  
  15797. w      Specifies the object that identifies the resource
  15798.       database to search (the database is that associ-
  15799.       ated with the display for this object).  Must be
  15800.       of class Object or any subclass thereof.
  15801.  
  15802. base      Specifies the base address into which the resource
  15803.       values will be written.
  15804.  
  15805. resources Specifies the resource list for the subpart.
  15806.  
  15807. num_resources
  15808.       Specifies the number of entries in the resource
  15809.       list.
  15810.  
  15811. ...      Specifies the variable argument list to override
  15812.       any other resource specifications.
  15813. |__
  15814.  
  15815. XtVaGetApplicationResources is identical in function to
  15816. XtGetApplicationResources with the args and num_args parame-
  15817. ters replaced by a varargs list, as described in Section
  15818. 2.5.1.
  15819.  
  15820.  
  15821. 9.6.  Resource Conversions
  15822.  
  15823. The Intrinsics provide a mechanism for registering represen-
  15824. tation converters that are automatically invoked by the
  15825. resource-fetching routines.  The Intrinsics additionally
  15826. provide and register several commonly used converters.    This
  15827. resource conversion mechanism serves several purposes:
  15828.  
  15829. o    It permits user and application resource files to con-
  15830.      tain textual representations of nontextual values.
  15831.  
  15832. o    It allows textual or other representations of default
  15833.      resource values that are dependent on the display,
  15834.      screen, or colormap, and thus must be computed at
  15835.  
  15836.  
  15837.  
  15838.                  230
  15839.  
  15840.  
  15841.  
  15842.  
  15843.  
  15844. X Toolkit Intrinsics                 X11 Release 6.4
  15845.  
  15846.  
  15847.      runtime.
  15848.  
  15849. o    It caches conversion source and result data.  Conver-
  15850.      sions that require much computation or space (for exam-
  15851.      ple, string-to-translation-table) or that require
  15852.      round-trips to the server (for example, string-to-font
  15853.      or string-to-color) are performed only once.
  15854.  
  15855.  
  15856. 9.6.1.    Predefined Resource Converters
  15857.  
  15858. The Intrinsics define all the representations used in the
  15859. Object, RectObj, Core, Composite, Constraint, and Shell wid-
  15860. get classes.  The Intrinsics register the following resource
  15861. converters that accept input values of representation type
  15862. XtRString.
  15863.  
  15864.  
  15865. ---------------------------------------------------------------------------
  15866. Target Representation    Converter Name           Additional Args
  15867. ---------------------------------------------------------------------------
  15868. XtRAcceleratorTable    XtCvtStringToAccelera-
  15869.             torTable
  15870. XtRAtom         XtCvtStringToAtom       Display*
  15871. XtRBoolean        XtCvtStringToBoolean
  15872. XtRBool         XtCvtStringToBool
  15873. XtRCommandArgArray    XtCvtStringToCommandAr-
  15874.             gArray
  15875. XtRCursor        XtCvtStringToCursor       Display*
  15876. XtRDimension        XtCvtStringToDimension
  15877. XtRDirectoryString    XtCvtStringToDirectoryS-
  15878.             tring
  15879. XtRDisplay        XtCvtStringToDisplay
  15880. XtRFile         XtCvtStringToFile
  15881. XtRFloat        XtCvtStringToFloat
  15882. XtRFont         XtCvtStringToFont       Display*
  15883. XtRFontSet        XtCvtStringToFontSet       Display*, String locale
  15884. XtRFontStruct        XtCvtStringToFontStruct    Display*
  15885. XtRGravity        XtCvtStringToGravity
  15886. XtRInitialState     XtCvtStringToInitial-
  15887.             State
  15888. XtRInt            XtCvtStringToInt
  15889. XtRPixel        XtCvtStringToPixel       colorConvertArgs
  15890. XtRPosition        XtCvtStringToPosition
  15891. XtRRestartStyle     XtCvtStringToRestart-
  15892.             Style
  15893. XtRShort        XtCvtStringToShort
  15894. XtRTranslationTable    XtCvtStringToTransla-
  15895.             tionTable
  15896. XtRUnsignedChar     XtCvtStringToUnsigned-
  15897.             Char
  15898. XtRVisual        XtCvtStringToVisual       Screen*, Cardinal depth
  15899. ---------------------------------------------------------------------------
  15900.  
  15901.  
  15902.  
  15903.  
  15904.                  231
  15905.  
  15906.  
  15907.  
  15908.  
  15909.  
  15910. X Toolkit Intrinsics                 X11 Release 6.4
  15911.  
  15912.  
  15913. The String-to-Pixel conversion has two predefined constants
  15914. that are guaranteed to work and contrast with each other:
  15915. XtDefaultForeground and XtDefaultBackground.  They evaluate
  15916. to the black and white pixel values of the widget's screen,
  15917. respectively.  If the application resource reverseVideo is
  15918. True, they evaluate to the white and black pixel values of
  15919. the widget's screen, respectively.  Similarly, the String-
  15920. to-Font and String-to-FontStruct converters recognize the
  15921. constant XtDefaultFont and evaluate this in the following
  15922. manner:
  15923.  
  15924. o    Query the resource database for the resource whose full
  15925.      name is ``xtDefaultFont'', class ``XtDefaultFont''
  15926.      (that is, no widget name/class prefixes), and use a
  15927.      type XtRString value returned as the font name or a
  15928.      type XtRFont or XtRFontStruct value directly as the
  15929.      resource value.
  15930.  
  15931. o    If the resource database does not contain a value for
  15932.      xtDefaultFont, class XtDefaultFont, or if the returned
  15933.      font name cannot be successfully opened, an implementa-
  15934.      tion-defined font in ISO8859-1 character set encoding
  15935.      is opened.  (One possible algorithm is to perform an
  15936.      XListFonts using a wildcard font name and use the first
  15937.      font in the list.    This wildcard font name should be as
  15938.      broad as possible to maximize the probability of locat-
  15939.      ing a useable font; for example,
  15940.      "-*-*-*-R-*-*-*-120-*-*-*-*-ISO8859-1".)
  15941.  
  15942. o    If no suitable ISO8859-1 font can be found, issue a
  15943.      warning message and return False.
  15944.  
  15945. The String-to-FontSet converter recognizes the constant
  15946. XtDefaultFontSet and evaluate this in the following manner:
  15947.  
  15948. o    Query the resource database for the resource whose full
  15949.      name is ``xtDefaultFontSet'', class ``XtDefault-
  15950.      FontSet'' (that is, no widget name/class prefixes), and
  15951.      use a type XtRString value returned as the base font
  15952.      name list or a type XtRFontSet value directly as the
  15953.      resource value.
  15954.  
  15955. o    If the resource database does not contain a value for
  15956.      xtDefaultFontSet, class XtDefaultFontSet, or if a font
  15957.      set cannot be successfully created from this resource,
  15958.      an implementation-defined font set is created.  (One
  15959.      possible algorithm is to perform an XCreateFontSet
  15960.      using a wildcard base font name.  This wildcard base
  15961.      font name should be as broad as possible to maximize
  15962.      the probability of locating a useable font; for exam-
  15963.      ple, "-*-*-*-R-*-*-*-120-*-*-*-*".)
  15964.  
  15965. o    If no suitable font set can be created, issue a warning
  15966.      message and return False.
  15967.  
  15968.  
  15969.  
  15970.                  232
  15971.  
  15972.  
  15973.  
  15974.  
  15975.  
  15976. X Toolkit Intrinsics                 X11 Release 6.4
  15977.  
  15978.  
  15979. If a font set is created but missing_charset_list is not
  15980. empty, a warning is issued and the partial font set is
  15981. returned.  The Intrinsics register the String-to-FontSet
  15982. converter with a conversion argument list that extracts the
  15983. current process locale at the time the converter is invoked.
  15984. This ensures that the converter is invoked again if the same
  15985. conversion is required in a different locale.
  15986.  
  15987. The String-to-Gravity conversion accepts string values that
  15988. are the names of window and bit gravities and their numeri-
  15989. cal equivalents, as defined in Xlib -- C Language X Inter-
  15990. face: ForgetGravity, UnmapGravity, NorthWestGravity,
  15991. NorthGravity, NorthEastGravity, WestGravity, CenterGravity,
  15992. EastGravity, SouthWestGravity, SouthGravity,
  15993. SouthEastGravity, and StaticGravity.  Alphabetic case is not
  15994. significant in the conversion.
  15995.  
  15996. The String-to-CommandArgArray conversion parses a String
  15997. into an array of strings.  White space characters separate
  15998. elements of the command line.  The converter recognizes the
  15999. backslash character ``\'' as an escape character to allow
  16000. the following white space character to be part of the array
  16001. element.
  16002.  
  16003. The String-to-DirectoryString conversion recognizes the
  16004. string ``XtCurrentDirectory'' and returns the result of a
  16005. call to the operating system to get the current directory.
  16006.  
  16007. The String-to-RestartStyle conversion accepts the values
  16008. RestartIfRunning, RestartAnyway, RestartImmediately, and
  16009. RestartNever as defined by the X Session Management Proto-
  16010. col.
  16011.  
  16012. The String-to-InitialState conversion accepts the values
  16013. NormalState or IconicState as defined by the Inter-Client
  16014. Communication Conventions Manual.
  16015.  
  16016. The String-to-Visual conversion calls XMatchVisualInfo using
  16017. the screen and depth fields from the core part and returns
  16018. the first matching Visual on the list.    The widget resource
  16019. list must be certain to specify any resource of type XtRVi-
  16020. sual after the depth resource.    The allowed string values
  16021. are the visual class names defined in X Window System Proto-
  16022. col, Section 8; StaticGray, StaticColor, TrueColor,
  16023. GrayScale, PseudoColor, and DirectColor.
  16024.  
  16025.  
  16026. The Intrinsics register the following resource converter
  16027. that accepts an input value of representation type XtRColor.
  16028.  
  16029.  
  16030. -----------------------------------------------------------------
  16031. Target Representation    Converter Name         Additional Args
  16032.  
  16033.  
  16034.  
  16035.  
  16036.                  233
  16037.  
  16038.  
  16039.  
  16040.  
  16041.  
  16042. X Toolkit Intrinsics                 X11 Release 6.4
  16043.  
  16044.  
  16045. -----------------------------------------------------------------
  16046. XtRPixel        XtCvtColorToPixel
  16047. -----------------------------------------------------------------
  16048.  
  16049.  
  16050.  
  16051. The Intrinsics register the following resource converters
  16052. that accept input values of representation type XtRInt.
  16053.  
  16054.  
  16055. -----------------------------------------------------------------
  16056. Target Representation    Converter Name         Additional Args
  16057. -----------------------------------------------------------------
  16058. XtRBoolean        XtCvtIntToBoolean
  16059. XtRBool         XtCvtIntToBool
  16060. XtRColor        XtCvtIntToColor      colorConver-
  16061.                          tArgs
  16062. XtRDimension        XtCvtIntToDimension
  16063. XtRFloat        XtCvtIntToFloat
  16064. XtRFont         XtCvtIntToFont
  16065. XtRPixel        XtCvtIntToPixel
  16066. XtRPixmap        XtCvtIntToPixmap
  16067. XtRPosition        XtCvtIntToPosition
  16068. XtRShort        XtCvtIntToShort
  16069. XtRUnsignedChar     XtCvtIntToUnsignedChar
  16070. -----------------------------------------------------------------
  16071.  
  16072.  
  16073.  
  16074. The Intrinsics register the following resource converter
  16075. that accepts an input value of representation type XtRPixel.
  16076.  
  16077.  
  16078. -----------------------------------------------------------------
  16079. Target Representation    Converter Name         Additional Args
  16080. -----------------------------------------------------------------
  16081. XtRColor        XtCvtPixelToColor
  16082. -----------------------------------------------------------------
  16083.  
  16084.  
  16085.  
  16086. 9.6.2.    New Resource Converters
  16087.  
  16088. Type converters use pointers to XrmValue structures (defined
  16089. in <X11/Xresource.h>; see Section 15.4 in Xlib -- C Language
  16090. X Interface) for input and output values.
  16091.  
  16092.  
  16093.  
  16094.  
  16095.  
  16096.  
  16097.  
  16098.  
  16099.  
  16100.  
  16101.  
  16102.                  234
  16103.  
  16104.  
  16105.  
  16106.  
  16107.  
  16108. X Toolkit Intrinsics                 X11 Release 6.4
  16109.  
  16110. __
  16111. |
  16112. typedef struct {
  16113.      unsigned int size;
  16114.      XPointer addr;
  16115. } XrmValue, *XrmValuePtr;
  16116.  
  16117. |__
  16118.  
  16119. The addr field specifies the address of the data, and the
  16120. size field gives the total number of significant bytes in
  16121. the data.  For values of type String, addr is the address of
  16122. the first character and size includes the NULL-terminating
  16123. byte.
  16124.  
  16125. A resource converter procedure pointer is of type
  16126. XtTypeConverter.
  16127.  
  16128. __
  16129. |
  16130. typedef Boolean (*XtTypeConverter)(Display*, XrmValue*, Cardinal*,
  16131.                   XrmValue*, XrmValue*, XtPointer*);
  16132.       Display *display;
  16133.       XrmValue *args;
  16134.       Cardinal *num_args;
  16135.       XrmValue *from;
  16136.       XrmValue *to;
  16137.       XtPointer *converter_data;
  16138.  
  16139.  
  16140. display   Specifies the display connection with which this
  16141.       conversion is associated.
  16142.  
  16143. args      Specifies a list of additional XrmValue arguments
  16144.       to the converter if additional context is needed
  16145.       to perform the conversion, or NULL.  For example,
  16146.       the String-to-Font converter needs the widget's
  16147.       display, and the String-to-Pixel converter needs
  16148.       the widget's screen and colormap.
  16149.  
  16150. num_args  Specifies the number of entries in args.
  16151.  
  16152. from      Specifies the value to convert.
  16153.  
  16154. to      Specifies a descriptor for a location into which
  16155.       to store the converted value.
  16156.  
  16157. converter_data
  16158.       Specifies a location into which the converter may
  16159.       store converter-specific data associated with this
  16160.       conversion.
  16161. |__
  16162.  
  16163. The display argument is normally used only when generating
  16164. error messages, to identify the application context (with
  16165.  
  16166.  
  16167.  
  16168.                  235
  16169.  
  16170.  
  16171.  
  16172.  
  16173.  
  16174. X Toolkit Intrinsics                 X11 Release 6.4
  16175.  
  16176.  
  16177. the function XtDisplayToApplicationContext).
  16178.  
  16179. The to argument specifies the size and location into which
  16180. the converter should store the converted value.  If the addr
  16181. field is NULL, the converter should allocate appropriate
  16182. storage and store the size and location into the to descrip-
  16183. tor.  If the type converter allocates the storage, it
  16184. remains under the ownership of the converter and must not be
  16185. modified by the caller.  The type converter is permitted to
  16186. use static storage for this purpose, and therefore the
  16187. caller must immediately copy the data upon return from the
  16188. converter.  If the addr field is not NULL, the converter
  16189. must check the size field to ensure that sufficient space
  16190. has been allocated before storing the converted value.    If
  16191. insufficient space is specified, the converter should update
  16192. the size field with the number of bytes required and return
  16193. False without modifying the data at the specified location.
  16194. If sufficient space was allocated by the caller, the con-
  16195. verter should update the size field with the number of bytes
  16196. actually occupied by the converted value.  For converted
  16197. values of type XtRString, the size should include the NULL-
  16198. terminating byte, if any.  The converter may store any value
  16199. in the location specified in converter_data; this value will
  16200. be passed to the destructor, if any, when the resource is
  16201. freed by the Intrinsics.
  16202.  
  16203. The converter must return True if the conversion was suc-
  16204. cessful and False otherwise.  If the conversion cannot be
  16205. performed because of an improper source value, a warning
  16206. message should also be issued with XtAppWarningMsg.
  16207.  
  16208.  
  16209. Most type converters just take the data described by the
  16210. specified from argument and return data by writing into the
  16211. location specified in the to argument.    A few need other
  16212. information, which is available in args.  A type converter
  16213. can invoke another type converter, which allows differing
  16214. sources that may convert into a common intermediate result
  16215. to make maximum use of the type converter cache.
  16216.  
  16217. Note that if an address is written into to->addr, it cannot
  16218. be that of a local variable of the converter because the
  16219. data will not be valid after the converter returns.  Static
  16220. variables may be used, as in the following example.  If the
  16221. converter modifies the resource database, the changes affect
  16222. any in-progress widget creation, XtGetApplicationResources,
  16223. or XtGetSubresources in an implementation-defined manner;
  16224. however, insertion of new entries or changes to existing
  16225. entries is allowed and will not directly cause an error.
  16226.  
  16227.  
  16228. The following is an example of a converter that takes a
  16229. string and converts it to a Pixel.  Note that the display
  16230. parameter is used only to generate error messages; the
  16231.  
  16232.  
  16233.  
  16234.                  236
  16235.  
  16236.  
  16237.  
  16238.  
  16239.  
  16240. X Toolkit Intrinsics                 X11 Release 6.4
  16241.  
  16242.  
  16243. Screen conversion argument is still required to inform the
  16244. Intrinsics that the converted value is a function of the
  16245. particular display (and colormap).
  16246.  
  16247.  
  16248.  
  16249. #define done(type, value) \
  16250.    {                    \
  16251.        if (toVal->addr != NULL) {    \
  16252.       if (toVal->size < sizeof(type)) {\
  16253.          toVal->size = sizeof(type);\
  16254.          return False;        \
  16255.       }                \
  16256.       *(type*)(toVal->addr) = (value);\
  16257.        }                \
  16258.        else {                \
  16259.       static type static_val;    \
  16260.       static_val = (value);     \
  16261.       toVal->addr = (XPointer)&static_val;\
  16262.        }                \
  16263.        toVal->size = sizeof(type);    \
  16264.        return True;            \
  16265.    }
  16266.  
  16267. static Boolean CvtStringToPixel(dpy, args, num_args, fromVal, toVal, converter_data)
  16268.    Display   *dpy;
  16269.    XrmValue  *args;
  16270.    Cardinal  *num_args;
  16271.    XrmValue  *fromVal;
  16272.    XrmValue  *toVal;
  16273.    XtPointer *converter_data;
  16274. {
  16275.    static XColor screenColor;
  16276.    XColor    exactColor;
  16277.    Screen    *screen;
  16278.    Colormap     colormap;
  16279.    Status     status;
  16280.  
  16281.    if (*num_args != 2)
  16282.        XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
  16283.       "wrongParameters", "cvtStringToPixel", "XtToolkitError",
  16284.       "String to pixel conversion needs screen and colormap arguments",
  16285.       (String *)NULL, (Cardinal *)NULL);
  16286.  
  16287.    screen = *((Screen**) args[0].addr);
  16288.    colormap = *((Colormap *) args[1].addr);
  16289.  
  16290.    if (CompareISOLatin1(str, XtDefaultBackground) == 0) {
  16291.        *closure_ret = False;
  16292.        done(Pixel, WhitePixelOfScreen(screen));
  16293.    }
  16294.    if (CompareISOLatin1(str, XtDefaultForeground) == 0) {
  16295.        *closure_ret = False;
  16296.        done(Pixel, BlackPixelOfScreen(screen));
  16297.  
  16298.  
  16299.  
  16300.                  237
  16301.  
  16302.  
  16303.  
  16304.  
  16305.  
  16306. X Toolkit Intrinsics                 X11 Release 6.4
  16307.  
  16308.  
  16309.    }
  16310.  
  16311.  
  16312.    status = XAllocNamedColor(DisplayOfScreen(screen), colormap, (char*)fromVal->addr,
  16313.                 &screenColor, &exactColor);
  16314.  
  16315.    if (status == 0) {
  16316.        String params[1];
  16317.        Cardinal num_params = 1;
  16318.        params[0] = (String)fromVal->addr;
  16319.        XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
  16320.       "noColormap", "cvtStringToPixel", "XtToolkitError",
  16321.       "Cannot allocate colormap entry for \"%s\"", params, &num_params);
  16322.        *converter_data = (char *) False;
  16323.         return False;
  16324.    } else {
  16325.         *converter_data = (char *) True;
  16326.        done(Pixel, &screenColor.pixel);
  16327.    }
  16328. }
  16329.  
  16330.  
  16331. All type converters should define some set of conversion
  16332. values for which they are guaranteed to succeed so these can
  16333. be used in the resource defaults.  This issue arises only
  16334. with conversions, such as fonts and colors, where there is
  16335. no string representation that all server implementations
  16336. will necessarily recognize.  For resources like these, the
  16337. converter should define a symbolic constant in the same man-
  16338. ner as XtDefaultForeground, XtDefaultBackground, and
  16339. XtDefaultFont.
  16340.  
  16341.  
  16342. To allow the Intrinsics to deallocate resources produced by
  16343. type converters, a resource destructor procedure may also be
  16344. provided.
  16345.  
  16346. A resource destructor procedure pointer is of type
  16347. XtDestructor.
  16348.  
  16349.  
  16350.  
  16351.  
  16352.  
  16353.  
  16354.  
  16355.  
  16356.  
  16357.  
  16358.  
  16359.  
  16360.  
  16361.  
  16362.  
  16363.  
  16364.  
  16365.  
  16366.                  238
  16367.  
  16368.  
  16369.  
  16370.  
  16371.  
  16372. X Toolkit Intrinsics                 X11 Release 6.4
  16373.  
  16374. __
  16375. |
  16376. typedef void (*XtDestructor) (XtAppContext, XrmValue*, XtPointer, XrmValue*, Cardinal*);
  16377.       XtAppContext app;
  16378.       XrmValue *to;
  16379.       XtPointer converter_data;
  16380.       XrmValue *args;
  16381.       Cardinal *num_args;
  16382.  
  16383.  
  16384. app      Specifies an application context in which the
  16385.       resource is being freed.
  16386.  
  16387. to      Specifies a descriptor for the resource produced
  16388.       by the type converter.
  16389.  
  16390. converter_data
  16391.       Specifies the converter-specific data returned by
  16392.       the type converter.
  16393.  
  16394. args      Specifies the additional converter arguments as
  16395.       passed to the type converter when the conversion
  16396.       was performed.
  16397.  
  16398. num_args  Specifies the number of entries in args.
  16399. |__
  16400.  
  16401. The destructor procedure is responsible for freeing the
  16402. resource specified by the to argument, including any auxil-
  16403. iary storage associated with that resource, but not the mem-
  16404. ory directly addressed by the size and location in the to
  16405. argument or the memory specified by args.
  16406.  
  16407.  
  16408. 9.6.3.    Issuing Conversion Warnings
  16409.  
  16410. The XtDisplayStringConversionWarning procedure is a conve-
  16411. nience routine for resource type converters that convert
  16412. from string values.
  16413.  
  16414.  
  16415.  
  16416.  
  16417.  
  16418.  
  16419.  
  16420.  
  16421.  
  16422.  
  16423.  
  16424.  
  16425.  
  16426.  
  16427.  
  16428.  
  16429.  
  16430.  
  16431.  
  16432.                  239
  16433.  
  16434.  
  16435.  
  16436.  
  16437.  
  16438. X Toolkit Intrinsics                 X11 Release 6.4
  16439.  
  16440. __
  16441. |
  16442. void XtDisplayStringConversionWarning(display, from_value, to_type)
  16443.       Display *display;
  16444.       String from_value, to_type;
  16445.  
  16446.  
  16447. display   Specifies the display connection with which the
  16448.       conversion is associated.
  16449.  
  16450. from_value
  16451.       Specifies the string that could not be converted.
  16452.  
  16453. to_type   Specifies the target representation type
  16454.       requested.
  16455. |__
  16456.  
  16457. The XtDisplayStringConversionWarning procedure issues a
  16458. warning message using XtAppWarningMsg with name ``conver-
  16459. sionError'', type ``string'', class ``XtToolkitError'', and
  16460. the default message ``Cannot convert "from_value" to type
  16461. to_type''.
  16462.  
  16463. To issue other types of warning or error messages, the type
  16464. converter should use XtAppWarningMsg or XtAppErrorMsg.
  16465.  
  16466.  
  16467. To retrieve the application context associated with a given
  16468. display connection, use XtDisplayToApplicationContext.
  16469.  
  16470. __
  16471. |
  16472. XtAppContext XtDisplayToApplicationContext( display )
  16473.       Display *display;
  16474.  
  16475.  
  16476. display   Specifies an open and initialized display connec-
  16477.       tion.
  16478. |__
  16479.  
  16480. The XtDisplayToApplicationContext function returns the
  16481. application context in which the specified display was ini-
  16482. tialized.  If the display is not known to the Intrinsics, an
  16483. error message is issued.
  16484.  
  16485.  
  16486. 9.6.4.    Registering a New Resource Converter
  16487.  
  16488. When registering a resource converter, the client must spec-
  16489. ify the manner in which the conversion cache is to be used
  16490. when there are multiple calls to the converter.  Conversion
  16491. cache control is specified via an XtCacheType
  16492.  
  16493. argument.
  16494.  
  16495.  
  16496.  
  16497.  
  16498.                  240
  16499.  
  16500.  
  16501.  
  16502.  
  16503.  
  16504. X Toolkit Intrinsics                 X11 Release 6.4
  16505.  
  16506. __
  16507. |
  16508. typedef int XtCacheType;
  16509.  
  16510. |__
  16511.  
  16512. An XtCacheType field may contain one of the following val-
  16513. ues:
  16514.  
  16515.  
  16516. XtCacheNone
  16517.  
  16518.      Specifies that the results of a previous conversion may
  16519.      not be reused to satisfy any other resource requests;
  16520.      the specified converter will be called each time the
  16521.      converted value is required.
  16522.  
  16523.  
  16524. XtCacheAll
  16525.  
  16526.      Specifies that the results of a previous conversion
  16527.      should be reused for any resource request that depends
  16528.      upon the same source value and conversion arguments.
  16529.  
  16530.  
  16531. XtCacheByDisplay
  16532.  
  16533.      Specifies that the results of a previous conversion
  16534.      should be used as for XtCacheAll but the destructor
  16535.      will be called, if specified, if XtCloseDisplay is
  16536.      called for the display connection associated with the
  16537.      converted value, and the value will be removed from the
  16538.      conversion cache.
  16539.  
  16540. The qualifier XtCacheRefCount may be ORed with any of the
  16541. above values.  If XtCacheRefCount is specified, calls to
  16542. XtCreateWidget, XtCreateManagedWidget,
  16543. XtGetApplicationResources, and XtGetSubresources that use
  16544. the converted value will be counted.  When a widget using
  16545. the converted value is destroyed, the count is decremented,
  16546. and, if the count reaches zero, the destructor procedure
  16547. will be called and the converted value will be removed from
  16548. the conversion cache.
  16549.  
  16550.  
  16551. To register a type converter for all application contexts in
  16552. a process, use XtSetTypeConverter, and to register a type
  16553. converter in a single application context, use
  16554. XtAppSetTypeConverter.
  16555.  
  16556.  
  16557.  
  16558.  
  16559.  
  16560.  
  16561.  
  16562.  
  16563.  
  16564.                  241
  16565.  
  16566.  
  16567.  
  16568.  
  16569.  
  16570. X Toolkit Intrinsics                 X11 Release 6.4
  16571.  
  16572. __
  16573. |
  16574. void XtSetTypeConverter(from_type, to_type, converter, convert_args, num_args,
  16575.             cache_type, destructor)
  16576.       String from_type;
  16577.       String to_type;
  16578.       XtTypeConverter converter;
  16579.       XtConvertArgList convert_args;
  16580.       Cardinal num_args;
  16581.       XtCacheType cache_type;
  16582.       XtDestructor destructor;
  16583.  
  16584.  
  16585. from_type Specifies the source type.
  16586.  
  16587. to_type   Specifies the destination type.
  16588.  
  16589. converter Specifies the resource type converter procedure.
  16590.  
  16591. convert_args
  16592.       Specifies additional conversion arguments, or
  16593.       NULL.
  16594.  
  16595. num_args  Specifies the number of entries in convert_args.
  16596.  
  16597. cache_type
  16598.       Specifies whether or not resources produced by
  16599.       this converter are sharable or display-specific
  16600.       and when they should be freed.
  16601.  
  16602. destructor
  16603.       Specifies a destroy procedure for resources pro-
  16604.       duced by this conversion, or NULL if no additional
  16605.       action is required to deallocate resources pro-
  16606.       duced by the converter.
  16607.  
  16608.  
  16609. void XtAppSetTypeConverter(app_context, from_type, to_type, converter, convert_args,
  16610.                num_args, cache_type, destructor)
  16611.       XtAppContext app_context;
  16612.       String from_type;
  16613.       String to_type;
  16614.       XtTypeConverter converter;
  16615.       XtConvertArgList convert_args;
  16616.       Cardinal num_args;
  16617.       XtCacheType cache_type;
  16618.       XtDestructor destructor;
  16619.  
  16620.  
  16621. app_context
  16622.       Specifies the application context.
  16623.  
  16624. from_type Specifies the source type.
  16625.  
  16626. to_type   Specifies the destination type.
  16627.  
  16628.  
  16629.  
  16630.                  242
  16631.  
  16632.  
  16633.  
  16634.  
  16635.  
  16636. X Toolkit Intrinsics                 X11 Release 6.4
  16637.  
  16638.  
  16639. converter Specifies the resource type converter procedure.
  16640.  
  16641. convert_args
  16642.       Specifies additional conversion arguments, or
  16643.       NULL.
  16644.  
  16645. num_args  Specifies the number of entries in convert_args.
  16646.  
  16647. cache_type
  16648.       Specifies whether or not resources produced by
  16649.       this converter are sharable or display-specific
  16650.       and when they should be freed.
  16651.  
  16652. destructor
  16653.       Specifies a destroy procedure for resources pro-
  16654.       duced by this conversion, or NULL if no additional
  16655.       action is required to deallocate resources pro-
  16656.       duced by the converter.
  16657. |__
  16658.  
  16659. XtSetTypeConverter registers the specified type converter
  16660. and destructor in all application contexts created by the
  16661. calling process, including any future application contexts
  16662. that may be created.  XtAppSetTypeConverter registers the
  16663. specified type converter in the single application context
  16664. specified.  If the same from_type and to_type are specified
  16665. in multiple calls to either function, the most recent over-
  16666. rides the previous ones.
  16667.  
  16668.  
  16669. For the few type converters that need additional arguments,
  16670. the Intrinsics conversion mechanism provides a method of
  16671. specifying how these arguments should be computed.  The enu-
  16672. merated type XtAddressMode and the structure XtConvertArgRec
  16673. specify how each argument is derived.  These are defined in
  16674. <X11/Intrinsic.h>.
  16675.  
  16676.  
  16677.  
  16678.  
  16679.  
  16680.  
  16681.  
  16682.  
  16683.  
  16684.  
  16685.  
  16686.  
  16687.  
  16688.  
  16689.  
  16690.  
  16691.  
  16692.  
  16693.  
  16694.  
  16695.  
  16696.                  243
  16697.  
  16698.  
  16699.  
  16700.  
  16701.  
  16702. X Toolkit Intrinsics                 X11 Release 6.4
  16703.  
  16704. __
  16705. |
  16706. typedef enum {
  16707.      /* address mode     parameter representation */
  16708.     XtAddress,     /* address */
  16709.     XtBaseOffset,     /* offset */
  16710.     XtImmediate,     /* constant */
  16711.     XtResourceString,/* resource name string */
  16712.     XtResourceQuark, /* resource name quark */
  16713.     XtWidgetBaseOffset,/* offset */
  16714.     XtProcedureArg     /* procedure to call */
  16715. } XtAddressMode;
  16716.  
  16717. typedef struct {
  16718.      XtAddressMode address_mode;
  16719.      XtPointer address_id;
  16720.      Cardinal size;
  16721. } XtConvertArgRec, *XtConvertArgList;
  16722. |__
  16723.  
  16724.  
  16725. The size field specifies the length of the data in bytes.
  16726. The address_mode field specifies how the address_id field
  16727. should be interpreted.    XtAddress causes address_id to be
  16728. interpreted as the address of the data.  XtBaseOffset causes
  16729. address_id to be interpreted as the offset from the widget
  16730. base.  XtImmediate causes address_id to be interpreted as a
  16731. constant.  XtResourceString causes address_id to be inter-
  16732. preted as the name of a resource that is to be converted
  16733. into an offset from the widget base.  XtResourceQuark causes
  16734. address_id to be interpreted as the result of an XrmString-
  16735. ToQuark conversion on the name of a resource, which is to be
  16736. converted into an offset from the widget base.    XtWidget-
  16737. BaseOffset is similar to XtBaseOffset except that it
  16738. searches for the closest windowed ancestor if the object is
  16739. not of a subclass of Core (see Chapter 12).  XtProcedureArg
  16740. specifies that address_id is a pointer to a procedure to be
  16741. invoked to return the conversion argument.  If XtProce-
  16742. dureArg is specified, address_id must contain the address of
  16743. a function of type XtConvertArgProc.
  16744.  
  16745.  
  16746.  
  16747.  
  16748.  
  16749.  
  16750.  
  16751.  
  16752.  
  16753.  
  16754.  
  16755.  
  16756.  
  16757.  
  16758.  
  16759.  
  16760.  
  16761.  
  16762.                  244
  16763.  
  16764.  
  16765.  
  16766.  
  16767.  
  16768. X Toolkit Intrinsics                 X11 Release 6.4
  16769.  
  16770. __
  16771. |
  16772. typedef void (*XtConvertArgProc)(Widget, Cardinal*, XrmValue*);
  16773.       Widget object;
  16774.       Cardinal *size;
  16775.       XrmValue *value;
  16776.  
  16777.  
  16778. object      Passes the object for which the resource is being
  16779.       converted, or NULL if the converter was invoked by
  16780.       XtCallConverter or XtDirectConvert.
  16781.  
  16782. size      Passes a pointer to the size field from the
  16783.       XtConvertArgRec.
  16784.  
  16785. value      Passes a pointer to a descriptor into which the
  16786.       procedure must store the conversion argument.
  16787. |__
  16788.  
  16789. When invoked, the XtConvertArgProc procedure must derive a
  16790. conversion argument and store the address and size of the
  16791. argument in the location pointed to by value.
  16792.  
  16793. In order to permit reentrancy, the XtConvertArgProc should
  16794. return the address of storage whose lifetime is no shorter
  16795. than the lifetime of object.  If object is NULL, the life-
  16796. time of the conversion argument must be no shorter than the
  16797. lifetime of the resource with which the conversion argument
  16798. is associated.    The Intrinsics do not guarantee to copy this
  16799. storage but do guarantee not to reference it if the resource
  16800. is removed from the conversion cache.
  16801.  
  16802. The following example illustrates how to register the Cvt-
  16803. StringToPixel routine given earlier:
  16804.  
  16805.  
  16806.      static XtConvertArgRec colorConvertArgs[] = {
  16807.        {XtWidgetBaseOffset, (XtPointer)XtOffset(Widget, core.screen),  sizeof(Screen*)},
  16808.        {XtWidgetBaseOffset, (XtPointer)XtOffset(Widget, core.colormap),sizeof(Colormap)}
  16809.      };
  16810.  
  16811.      XtSetTypeConverter(XtRString, XtRPixel, CvtStringToPixel,
  16812.      colorConvertArgs, XtNumber(colorConvertArgs), XtCacheByDisplay, NULL);
  16813.  
  16814.  
  16815. The conversion argument descriptors colorConvertArgs and
  16816. screenConvertArg are predefined by the Intrinsics.  Both
  16817. take the values from the closest windowed ancestor if the
  16818. object is not of a subclass of Core.  The screenConvertArg
  16819. descriptor puts the widget's screen field into args[0].  The
  16820. colorConvertArgs descriptor puts the widget's screen field
  16821. into args[0], and the widget's colormap field into args[1].
  16822.  
  16823. Conversion routines should not just put a descriptor for the
  16824. address of the base of the widget into args[0], and use that
  16825.  
  16826.  
  16827.  
  16828.                  245
  16829.  
  16830.  
  16831.  
  16832.  
  16833.  
  16834. X Toolkit Intrinsics                 X11 Release 6.4
  16835.  
  16836.  
  16837. in the routine.  They should pass in the actual values on
  16838. which the conversion depends.  By keeping the dependencies
  16839. of the conversion procedure specific, it is more likely that
  16840. subsequent conversions will find what they need in the con-
  16841. version cache.    This way the cache is smaller and has fewer
  16842. and more widely applicable entries.
  16843.  
  16844. If any conversion arguments of type XtBaseOffset,
  16845. XtResourceString, XtResourceQuark, and XtWidgetBaseOffset
  16846. are specified for conversions performed by
  16847. XtGetApplicationResources, XtGetSubresources,
  16848. XtVaGetApplicationResources, or XtVaGetSubresources, the
  16849. arguments are computed with respect to the specified widget,
  16850. not the base address or resource list specified in the call.
  16851.  
  16852. If the XtConvertArgProc modifies the resource database, the
  16853. changes affect any in-progress widget creation,
  16854. XtGetApplicationResources, or XtGetSubresources in an imple-
  16855. mentation-defined manner; however, insertion of new entries
  16856. or changes to existing entries are allowed and will not
  16857. directly cause an error.
  16858.  
  16859.  
  16860. 9.6.5.    Resource Converter Invocation
  16861.  
  16862. All resource-fetching routines (for example,
  16863. XtGetSubresources, XtGetApplicationResources, and so on)
  16864. call resource converters if the resource database or varargs
  16865. list specifies a value that has a different representation
  16866. from the desired representation or if the widget's default
  16867. resource value representation is different from the desired
  16868. representation.
  16869.  
  16870.  
  16871. To invoke explicit resource conversions, use XtConvertAnd-
  16872. Store or XtCallConverter.
  16873.  
  16874.  
  16875.  
  16876.  
  16877.  
  16878.  
  16879.  
  16880.  
  16881.  
  16882.  
  16883.  
  16884.  
  16885.  
  16886.  
  16887.  
  16888.  
  16889.  
  16890.  
  16891.  
  16892.  
  16893.  
  16894.                  246
  16895.  
  16896.  
  16897.  
  16898.  
  16899.  
  16900. X Toolkit Intrinsics                 X11 Release 6.4
  16901.  
  16902. __
  16903. |
  16904. typedef XtPointer XtCacheRef;
  16905.  
  16906.  
  16907. Boolean XtCallConverter(display, converter, conversion_args, num_args, from, to_in_out,
  16908.                           cache_ref_return)
  16909.       Display* display;
  16910.       XtTypeConverter converter;
  16911.       XrmValuePtr conversion_args;
  16912.       Cardinal num_args;
  16913.       XrmValuePtr from;
  16914.       XrmValuePtr to_in_out;
  16915.       XtCacheRef *cache_ref_return;
  16916.  
  16917.  
  16918. display        Specifies the display with which the conver-
  16919.            sion is to be associated.
  16920.  
  16921. converter      Specifies the conversion procedure to be
  16922.            called.
  16923.  
  16924. conversion_args
  16925.            Specifies the additional conversion arguments
  16926.            needed to perform the conversion, or NULL.
  16927.  
  16928. num_args       Specifies the number of entries in conver-
  16929.            sion_args.
  16930.  
  16931. from           Specifies a descriptor for the source value.
  16932.  
  16933. to_in_out      Returns the converted value.
  16934.  
  16935. cache_ref_return
  16936.            Returns a conversion cache id.
  16937. |__
  16938.  
  16939. The XtCallConverter function looks up the specified type
  16940. converter in the application context associated with the
  16941. display and, if the converter was not registered or was reg-
  16942. istered with cache type XtCacheAll or XtCacheByDisplay,
  16943. looks in the conversion cache to see if this conversion pro-
  16944. cedure has been called with the specified conversion argu-
  16945. ments.    If so, it checks the success status of the prior
  16946. call, and if the conversion failed, XtCallConverter returns
  16947. False immediately; otherwise it checks the size specified in
  16948. the to argument, and, if it is greater than or equal to the
  16949. size stored in the cache, copies the information stored in
  16950. the cache into the location specified by to->addr, stores
  16951. the cache size into to->size, and returns True.  If the size
  16952. specified in the to argument is smaller than the size stored
  16953. in the cache, XtCallConverter copies the cache size into
  16954. to->size and returns False.  If the converter was registered
  16955. with cache type XtCacheNone or no value was found in the
  16956. conversion cache, XtCallConverter calls the converter, and
  16957.  
  16958.  
  16959.  
  16960.                  247
  16961.  
  16962.  
  16963.  
  16964.  
  16965.  
  16966. X Toolkit Intrinsics                 X11 Release 6.4
  16967.  
  16968.  
  16969. if it was not registered with cache type XtCacheNone, enters
  16970. the result in the cache.  XtCallConverter then returns what
  16971. the converter returned.
  16972.  
  16973. The cache_ref_return field specifies storage allocated by
  16974. the caller in which an opaque value will be stored.  If the
  16975. type converter has been registered with the XtCacheRefCount
  16976. modifier and if the value returned in cache_ref_return is
  16977. non-NULL, then the caller should store the cache_ref_return
  16978. value in order to decrement the reference count when the
  16979. converted value is no longer required.    The cache_ref_return
  16980. argument should be NULL if the caller is unwilling or unable
  16981. to store the value.
  16982.  
  16983.  
  16984. To explicitly decrement the reference counts for resources
  16985. obtained from XtCallConverter, use XtAppReleaseCacheRefs.
  16986.  
  16987. __
  16988. |
  16989. void XtAppReleaseCacheRefs(app_context, refs)
  16990.       XtAppContext app_context;
  16991.       XtCacheRef *refs;
  16992.  
  16993.  
  16994. app_context
  16995.       Specifies the application context.
  16996.  
  16997. refs      Specifies the list of cache references to be
  16998.       released.
  16999. |__
  17000.  
  17001. XtAppReleaseCacheRefs decrements the reference count for the
  17002. conversion entries identified by the refs argument.  This
  17003. argument is a pointer to a NULL-terminated list of
  17004. XtCacheRef values.  If any reference count reaches zero, the
  17005. destructor, if any, will be called and the resource removed
  17006. from the conversion cache.
  17007.  
  17008.  
  17009. As a convenience to clients needing to explicitly decrement
  17010. reference counts via a callback function, the Intrinsics
  17011. define two callback procedures, XtCallbackReleaseCacheRef
  17012. and XtCallbackReleaseCacheRefList.
  17013.  
  17014.  
  17015.  
  17016.  
  17017.  
  17018.  
  17019.  
  17020.  
  17021.  
  17022.  
  17023.  
  17024.  
  17025.  
  17026.                  248
  17027.  
  17028.  
  17029.  
  17030.  
  17031.  
  17032. X Toolkit Intrinsics                 X11 Release 6.4
  17033.  
  17034. __
  17035. |
  17036. void XtCallbackReleaseCacheRef(object, client_data, call_data)
  17037.       Widget object;
  17038.       XtPointer client_data;
  17039.       XtPointer call_data;
  17040.  
  17041.  
  17042. object      Specifies the object with which the resource is
  17043.       associated.
  17044.  
  17045. client_data
  17046.       Specifies the conversion cache entry to be
  17047.       released.
  17048.  
  17049. call_data Is ignored.
  17050. |__
  17051.  
  17052. This callback procedure may be added to a callback list to
  17053. release a previously returned XtCacheRef value.  When adding
  17054. the callback, the callback client_data argument must be
  17055. specified as the value of the XtCacheRef data cast to type
  17056. XtPointer.
  17057.  
  17058. __
  17059. |
  17060. void XtCallbackReleaseCacheRefList(object, client_data, call_data)
  17061.       Widget object;
  17062.       XtPointer client_data;
  17063.       XtPointer call_data;
  17064.  
  17065.  
  17066. object      Specifies the object with which the resources are
  17067.       associated.
  17068.  
  17069. client_data
  17070.       Specifies the conversion cache entries to be
  17071.       released.
  17072.  
  17073. call_data Is ignored.
  17074. |__
  17075.  
  17076. This callback procedure may be added to a callback list to
  17077. release a list of previously returned XtCacheRef values.
  17078. When adding the callback, the callback client_data argument
  17079. must be specified as a pointer to a NULL-terminated list of
  17080. XtCacheRef values.
  17081.  
  17082.  
  17083. To lookup and call a resource converter, copy the resulting
  17084. value, and free a cached resource when a widget is
  17085. destroyed, use XtConvertAndStore.
  17086.  
  17087.  
  17088.  
  17089.  
  17090.  
  17091.  
  17092.                  249
  17093.  
  17094.  
  17095.  
  17096.  
  17097.  
  17098. X Toolkit Intrinsics                 X11 Release 6.4
  17099.  
  17100. __
  17101. |
  17102. Boolean XtConvertAndStore(object, from_type, from, to_type, to_in_out)
  17103.       Widget object;
  17104.       String from_type;
  17105.       XrmValuePtr from;
  17106.       String to_type;
  17107.       XrmValuePtr to_in_out;
  17108.  
  17109.  
  17110. object      Specifies the object to use for additional argu-
  17111.       ments, if any are needed, and the destroy callback
  17112.       list.  Must be of class Object or any subclass
  17113.       thereof.
  17114.  
  17115. from_type Specifies the source type.
  17116.  
  17117. from      Specifies the value to be converted.
  17118.  
  17119. to_type   Specifies the destination type.
  17120.  
  17121. to_in_out Specifies a descriptor for storage into which the
  17122.       converted value will be returned.
  17123. |__
  17124.  
  17125. The XtConvertAndStore function looks up the type converter
  17126. registered to convert from_type to to_type, computes any
  17127. additional arguments needed, and then calls XtCallConverter
  17128. (or XtDirectConvert if an old-style converter was registered
  17129. with XtAddConverter or XtAppAddConverter; see Appendix C)
  17130. with the from and to_in_out arguments.    The to_in_out argu-
  17131. ment specifies the size and location into which the con-
  17132. verted value will be stored and is passed directly to the
  17133. converter.  If the location is specified as NULL, it will be
  17134. replaced with a pointer to private storage and the size will
  17135. be returned in the descriptor.    The caller is expected to
  17136. copy this private storage immediately and must not modify it
  17137. in any way.  If a non-NULL location is specified, the caller
  17138. must allocate sufficient storage to hold the converted value
  17139. and must also specify the size of that storage in the
  17140. descriptor.  The size field will be modified on return to
  17141. indicate the actual size of the converted data.  If the con-
  17142. version succeeds, XtConvertAndStore returns True; otherwise,
  17143. it returns False.
  17144.  
  17145. XtConvertAndStore adds XtCallbackReleaseCacheRef to the
  17146. destroyCallback list of the specified object if the conver-
  17147. sion returns an XtCacheRef value.  The resulting resource
  17148. should not be referenced after the object has been
  17149. destroyed.
  17150.  
  17151. XtCreateWidget performs processing equivalent to XtConver-
  17152. tAndStore when initializing the object instance.  Because
  17153. there is extra memory overhead required to implement refer-
  17154. ence counting, clients may distinguish those objects that
  17155.  
  17156.  
  17157.  
  17158.                  250
  17159.  
  17160.  
  17161.  
  17162.  
  17163.  
  17164. X Toolkit Intrinsics                 X11 Release 6.4
  17165.  
  17166.  
  17167. are never destroyed before the application exits from those
  17168. that may be destroyed and whose resources should be deallo-
  17169. cated.
  17170.  
  17171. To specify whether reference counting is to be enabled for
  17172. the resources of a particular object when the object is cre-
  17173. ated, the client can specify a value for the Boolean
  17174. resource XtNinitialResourcesPersistent, class XtCInitialRe-
  17175. sourcesPersistent.
  17176.  
  17177. When XtCreateWidget is called, if this resource is not spec-
  17178. ified as False in either the arglist or the resource
  17179. database, then the resources referenced by this object are
  17180. not reference-counted, regardless of how the type converter
  17181. may have been registered.  The effective default value is
  17182. True; thus clients that expect to destroy one or more
  17183. objects and want resources deallocated must explicitly spec-
  17184. ify False for XtNinitialResourcesPersistent.
  17185.  
  17186. The resources are still freed and destructors called when
  17187. XtCloseDisplay is called if the conversion was registered as
  17188. XtCacheByDisplay.
  17189.  
  17190.  
  17191. 9.7.  Reading and Writing Widget State
  17192.  
  17193. Any resource field in a widget can be read or written by a
  17194. client.  On a write operation, the widget decides what
  17195. changes it will actually allow and updates all derived
  17196. fields appropriately.
  17197.  
  17198.  
  17199. 9.7.1.    Obtaining Widget State
  17200.  
  17201. To retrieve the current values of resources associated with
  17202. a widget instance, use XtGetValues.
  17203.  
  17204.  
  17205.  
  17206.  
  17207.  
  17208.  
  17209.  
  17210.  
  17211.  
  17212.  
  17213.  
  17214.  
  17215.  
  17216.  
  17217.  
  17218.  
  17219.  
  17220.  
  17221.  
  17222.  
  17223.  
  17224.                  251
  17225.  
  17226.  
  17227.  
  17228.  
  17229.  
  17230. X Toolkit Intrinsics                 X11 Release 6.4
  17231.  
  17232. __
  17233. |
  17234. void XtGetValues(object, args, num_args)
  17235.       Widget object;
  17236.       ArgList args;
  17237.       Cardinal num_args;
  17238.  
  17239.  
  17240. object      Specifies the object whose resource values are to
  17241.       be returned.    Must be of class Object or any sub-
  17242.       class thereof.
  17243.  
  17244. args      Specifies the argument list of name/address pairs
  17245.       that contain the resource names and the addresses
  17246.       into which the resource values are to be stored.
  17247.       The resource names are widget-dependent.
  17248.  
  17249. num_args  Specifies the number of entries in the argument
  17250.       list.
  17251. |__
  17252.  
  17253. The XtGetValues function starts with the resources specified
  17254. for the Object class and proceeds down the subclass chain to
  17255. the class of the object.  The value field of a passed argu-
  17256. ment list must contain the address into which to copy the
  17257. contents of the corresponding object instance field.  If the
  17258. field is a pointer type, the lifetime of the pointed-to data
  17259. is defined by the object class.  For the Intrinsics-defined
  17260. resources, the following lifetimes apply:
  17261.  
  17262. o  Not valid following any operation that modifies the
  17263.    resource:
  17264.  
  17265.    -  XtNchildren resource of composite widgets.
  17266.  
  17267.    -  All resources of representation type XtRCallback.
  17268.  
  17269. o  Remain valid at least until the widget is destroyed:
  17270.  
  17271.    -  XtNaccelerators, XtNtranslations.
  17272.  
  17273. o  Remain valid until the Display is closed:
  17274.  
  17275.    -  XtNscreen.
  17276.  
  17277. It is the caller's responsibility to allocate and deallocate
  17278. storage for the copied data according to the size of the
  17279. resource representation type used within the object.
  17280.  
  17281. If the class of the object's parent is a subclass of
  17282. constraintWidgetClass, XtGetValues then fetches the values
  17283. for any constraint resources requested.  It starts with the
  17284. constraint resources specified for constraintWidgetClass and
  17285. proceeds down the subclass chain to the parent's constraint
  17286. resources.  If the argument list contains a resource name
  17287.  
  17288.  
  17289.  
  17290.                  252
  17291.  
  17292.  
  17293.  
  17294.  
  17295.  
  17296. X Toolkit Intrinsics                 X11 Release 6.4
  17297.  
  17298.  
  17299. that is not found in any of the resource lists searched, the
  17300. value at the corresponding address is not modified.  If any
  17301. get_values_hook procedures in the object's class or super-
  17302. class records are non-NULL, they are called in superclass-
  17303. to-subclass order after all the resource values have been
  17304. fetched by XtGetValues.  Finally, if the object's parent is
  17305. a subclass of constraintWidgetClass, and if any of the par-
  17306. ent's class or superclass records have declared Constraint-
  17307. ClassExtension records in the Constraint class part exten-
  17308. sion field with a record type of NULLQUARK, and if the
  17309. get_values_hook field in the extension record is non-NULL,
  17310. XtGetValues calls the get_values_hook procedures in super-
  17311. class-to-subclass order.  This permits a Constraint parent
  17312. to provide nonresource data via XtGetValues.
  17313.  
  17314. Get_values_hook procedures may modify the data stored at the
  17315. location addressed by the value field, including (but not
  17316. limited to) making a copy of data whose resource representa-
  17317. tion is a pointer.  None of the Intrinsics-defined object
  17318. classes copy data in this manner.  Any operation that modi-
  17319. fies the queried object resource may invalidate the pointed-
  17320. to data.
  17321.  
  17322.  
  17323.  
  17324. To retrieve the current values of resources associated with
  17325. a widget instance using varargs lists, use XtVaGetValues.
  17326.  
  17327. __
  17328. |
  17329. void XtVaGetValues(object, ...)
  17330.       Widget object;
  17331.  
  17332.  
  17333. object      Specifies the object whose resource values are to
  17334.       be returned.    Must be of class Object or any sub-
  17335.       class thereof.
  17336.  
  17337. ...      Specifies the variable argument list for the
  17338.       resources to be returned.
  17339. |__
  17340.  
  17341. XtVaGetValues is identical in function to XtGetValues with
  17342. the args and num_args parameters replaced by a varargs list,
  17343. as described in Section 2.5.1.    All value entries in the
  17344. list must specify pointers to storage allocated by the
  17345. caller to which the resource value will be copied.  It is
  17346. the caller's responsibility to ensure that sufficient stor-
  17347. age is allocated.  If XtVaTypedArg is specified, the type
  17348. argument specifies the representation desired by the caller
  17349. and the size argument specifies the number of bytes allo-
  17350. cated to store the result of the conversion.  If the size is
  17351. insufficient, a warning message is issued and the list entry
  17352. is skipped.
  17353.  
  17354.  
  17355.  
  17356.                  253
  17357.  
  17358.  
  17359.  
  17360.  
  17361.  
  17362. X Toolkit Intrinsics                 X11 Release 6.4
  17363.  
  17364.  
  17365. 9.7.1.1.  Widget Subpart Resource Data: The get_values_hook
  17366. Procedure
  17367.  
  17368. Widgets that have subparts can return resource values from
  17369. them through XtGetValues by supplying a get_values_hook pro-
  17370. cedure.  The get_values_hook procedure pointer is of type
  17371. XtArgsProc.
  17372.  
  17373. __
  17374. |
  17375. typedef void (*XtArgsProc)(Widget, ArgList, Cardinal*);
  17376.       Widget w;
  17377.       ArgList args;
  17378.       Cardinal *num_args;
  17379.  
  17380.  
  17381. w      Specifies the widget whose subpart resource values
  17382.       are to be retrieved.
  17383.  
  17384. args      Specifies the argument list that was passed to
  17385.       XtGetValues or the transformed varargs list passed
  17386.       to XtVaGetValues.
  17387.  
  17388. num_args  Specifies the number of entries in the argument
  17389.       list.
  17390. |__
  17391.  
  17392. The widget with subpart resources should call XtGetSubvalues
  17393. in the get_values_hook procedure and pass in its subresource
  17394. list and the args and num_args parameters.
  17395.  
  17396.  
  17397. 9.7.1.2.  Widget Subpart State
  17398.  
  17399. To retrieve the current values of subpart resource data
  17400. associated with a widget instance, use XtGetSubvalues.    For
  17401. a discussion of subpart resources, see Section 9.4.
  17402.  
  17403.  
  17404.  
  17405.  
  17406.  
  17407.  
  17408.  
  17409.  
  17410.  
  17411.  
  17412.  
  17413.  
  17414.  
  17415.  
  17416.  
  17417.  
  17418.  
  17419.  
  17420.  
  17421.  
  17422.                  254
  17423.  
  17424.  
  17425.  
  17426.  
  17427.  
  17428. X Toolkit Intrinsics                 X11 Release 6.4
  17429.  
  17430. __
  17431. |
  17432. void XtGetSubvalues(base, resources, num_resources, args, num_args)
  17433.       XtPointer base;
  17434.       XtResourceList resources;
  17435.       Cardinal num_resources;
  17436.       ArgList args;
  17437.       Cardinal num_args;
  17438.  
  17439.  
  17440. base      Specifies the base address of the subpart data
  17441.       structure for which the resources should be
  17442.       retrieved.
  17443.  
  17444. resources Specifies the subpart resource list.
  17445.  
  17446. num_resources
  17447.       Specifies the number of entries in the resource
  17448.       list.
  17449.  
  17450. args      Specifies the argument list of name/address pairs
  17451.       that contain the resource names and the addresses
  17452.       into which the resource values are to be stored.
  17453.  
  17454. num_args  Specifies the number of entries in the argument
  17455.       list.
  17456. |__
  17457.  
  17458. The XtGetSubvalues function obtains resource values from the
  17459. structure identified by base.  The value field in each argu-
  17460. ment entry must contain the address into which to store the
  17461. corresponding resource value.  It is the caller's responsi-
  17462. bility to allocate and deallocate this storage according to
  17463. the size of the resource representation type used within the
  17464. subpart.  If the argument list contains a resource name that
  17465. is not found in the resource list, the value at the corre-
  17466. sponding address is not modified.
  17467.  
  17468.  
  17469.  
  17470. To retrieve the current values of subpart resources associ-
  17471. ated with a widget instance using varargs lists, use
  17472. XtVaGetSubvalues.
  17473.  
  17474.  
  17475.  
  17476.  
  17477.  
  17478.  
  17479.  
  17480.  
  17481.  
  17482.  
  17483.  
  17484.  
  17485.  
  17486.  
  17487.  
  17488.                  255
  17489.  
  17490.  
  17491.  
  17492.  
  17493.  
  17494. X Toolkit Intrinsics                 X11 Release 6.4
  17495.  
  17496. __
  17497. |
  17498. void XtVaGetSubvalues(base, resources, num_resources, ...)
  17499.       XtPointer base;
  17500.       XtResourceList resources;
  17501.       Cardinal num_resources;
  17502.  
  17503.  
  17504. base      Specifies the base address of the subpart data
  17505.       structure for which the resources should be
  17506.       retrieved.
  17507.  
  17508. resources Specifies the subpart resource list.
  17509.  
  17510. num_resources
  17511.       Specifies the number of entries in the resource
  17512.       list.
  17513.  
  17514. ...      Specifies a variable argument list of name/address
  17515.       pairs that contain the resource names and the
  17516.       addresses into which the resource values are to be
  17517.       stored.
  17518. |__
  17519.  
  17520. XtVaGetSubvalues is identical in function to XtGetSubvalues
  17521. with the args and num_args parameters replaced by a varargs
  17522. list, as described in Section 2.5.1.  XtVaTypedArg is not
  17523. supported for XtVaGetSubvalues.  If XtVaTypedArg is speci-
  17524. fied in the list, a warning message is issued and the entry
  17525. is then ignored.
  17526.  
  17527.  
  17528. 9.7.2.    Setting Widget State
  17529.  
  17530. To modify the current values of resources associated with a
  17531. widget instance, use XtSetValues.
  17532.  
  17533.  
  17534.  
  17535.  
  17536.  
  17537.  
  17538.  
  17539.  
  17540.  
  17541.  
  17542.  
  17543.  
  17544.  
  17545.  
  17546.  
  17547.  
  17548.  
  17549.  
  17550.  
  17551.  
  17552.  
  17553.  
  17554.                  256
  17555.  
  17556.  
  17557.  
  17558.  
  17559.  
  17560. X Toolkit Intrinsics                 X11 Release 6.4
  17561.  
  17562. __
  17563. |
  17564. void XtSetValues(object, args, num_args)
  17565.       Widget object;
  17566.       ArgList args;
  17567.       Cardinal num_args;
  17568.  
  17569.  
  17570. object      Specifies the object whose resources are to be
  17571.       modified.  Must be of class Object or any subclass
  17572.       thereof.
  17573.  
  17574. args      Specifies the argument list of name/value pairs
  17575.       that contain the resources to be modified and
  17576.       their new values.
  17577.  
  17578. num_args  Specifies the number of entries in the argument
  17579.       list.
  17580. |__
  17581.  
  17582. The XtSetValues function starts with the resources specified
  17583. for the Object class fields and proceeds down the subclass
  17584. chain to the object.  At each stage, it replaces the object
  17585. resource fields with any values specified in the argument
  17586. list.  XtSetValues then calls the set_values procedures for
  17587. the object in superclass-to-subclass order.  If the object
  17588. has any non-NULL set_values_hook fields, these are called
  17589. immediately after the corresponding set_values procedure.
  17590. This procedure permits subclasses to set subpart data via
  17591. XtSetValues.
  17592.  
  17593. If the class of the object's parent is a subclass of
  17594. constraintWidgetClass, XtSetValues also updates the object's
  17595. constraints.  It starts with the constraint resources speci-
  17596. fied for constraintWidgetClass and proceeds down the sub-
  17597. class chain to the parent's class.  At each stage, it
  17598. replaces the constraint resource fields with any values
  17599. specified in the argument list.  It then calls the con-
  17600. straint set_values procedures from constraintWidgetClass
  17601. down to the parent's class.  The constraint set_values pro-
  17602. cedures are called with widget arguments, as for all
  17603. set_values procedures, not just the constraint records, so
  17604. that they can make adjustments to the desired values based
  17605. on full information about the widget.  Any arguments speci-
  17606. fied that do not match a resource list entry are silently
  17607. ignored.
  17608.  
  17609. If the object is of a subclass of RectObj, XtSetValues
  17610. determines if a geometry request is needed by comparing the
  17611. old object to the new object.  If any geometry changes are
  17612. required, XtSetValues restores the original geometry and
  17613. makes the request on behalf of the widget.  If the geometry
  17614. manager returns XtGeometryYes, XtSetValues calls the
  17615. object's resize procedure.  If the geometry manager returns
  17616. XtGeometryDone, XtSetValues continues, as the object's
  17617.  
  17618.  
  17619.  
  17620.                  257
  17621.  
  17622.  
  17623.  
  17624.  
  17625.  
  17626. X Toolkit Intrinsics                 X11 Release 6.4
  17627.  
  17628.  
  17629. resize procedure should have been called by the geometry
  17630. manager.  If the geometry manager returns XtGeometryNo,
  17631. XtSetValues ignores the geometry request and continues.  If
  17632. the geometry manager returns XtGeometryAlmost, XtSetValues
  17633. calls the set_values_almost procedure, which determines what
  17634. should be done.  XtSetValues then repeats this process,
  17635. deciding once more whether the geometry manager should be
  17636. called.
  17637.  
  17638. Finally, if any of the set_values procedures returned True,
  17639. and the widget is realized, XtSetValues causes the widget's
  17640. expose procedure to be invoked by calling XClearArea on the
  17641. widget's window.
  17642.  
  17643.  
  17644. To modify the current values of resources associated with a
  17645. widget instance using varargs lists, use XtVaSetValues.
  17646.  
  17647. __
  17648. |
  17649. void XtVaSetValues(object, ...)
  17650.       Widget object;
  17651.  
  17652.  
  17653. object      Specifies the object whose resources are to be
  17654.       modified.  Must be of class Object or any subclass
  17655.       thereof.
  17656.  
  17657. ...      Specifies the variable argument list of name/value
  17658.       pairs that contain the resources to be modified
  17659.       and their new values.
  17660. |__
  17661.  
  17662. XtVaSetValues is identical in function to XtSetValues with
  17663. the args and num_args parameters replaced by a varargs list,
  17664. as described in Section 2.5.1.
  17665.  
  17666.  
  17667. 9.7.2.1.  Widget State: The set_values Procedure
  17668.  
  17669. The set_values procedure pointer in a widget class is of
  17670. type XtSetValuesFunc.
  17671.  
  17672.  
  17673.  
  17674.  
  17675.  
  17676.  
  17677.  
  17678.  
  17679.  
  17680.  
  17681.  
  17682.  
  17683.  
  17684.  
  17685.  
  17686.                  258
  17687.  
  17688.  
  17689.  
  17690.  
  17691.  
  17692. X Toolkit Intrinsics                 X11 Release 6.4
  17693.  
  17694. __
  17695. |
  17696. typedef Boolean (*XtSetValuesFunc)(Widget, Widget, Widget, ArgList, Cardinal*);
  17697.       Widget current;
  17698.       Widget request;
  17699.       Widget new;
  17700.       ArgList args;
  17701.       Cardinal *num_args;
  17702.  
  17703.  
  17704. current   Specifies a copy of the widget as it was before
  17705.       the XtSetValues call.
  17706.  
  17707. request   Specifies a copy of the widget with all values
  17708.       changed as asked for by the XtSetValues call
  17709.       before any class set_values procedures have been
  17710.       called.
  17711.  
  17712. new      Specifies the widget with the new values that are
  17713.       actually allowed.
  17714.  
  17715. args      Specifies the argument list passed to XtSetValues
  17716.       or the transformed argument list passed to
  17717.       XtVaSetValues.
  17718.  
  17719. num_args  Specifies the number of entries in the argument
  17720.       list.
  17721. |__
  17722.  
  17723. The set_values procedure should recompute any field derived
  17724. from resources that are changed (for example, many GCs
  17725. depend on foreground and background pixels).  If no recompu-
  17726. tation is necessary, and if none of the resources specific
  17727. to a subclass require the window to be redisplayed when
  17728. their values are changed, you can specify NULL for the
  17729. set_values field in the class record.
  17730.  
  17731. Like the initialize procedure, set_values mostly deals only
  17732. with the fields defined in the subclass, but it has to
  17733. resolve conflicts with its superclass, especially conflicts
  17734. over width and height.
  17735.  
  17736. Sometimes a subclass may want to overwrite values filled in
  17737. by its superclass.  In particular, size calculations of a
  17738. superclass are often incorrect for a subclass, and, in this
  17739. case, the subclass must modify or recalculate fields
  17740. declared and computed by its superclass.
  17741.  
  17742. As an example, a subclass can visually surround its super-
  17743. class display.    In this case, the width and height calcu-
  17744. lated by the superclass set_values procedure are too small
  17745. and need to be incremented by the size of the surround.  The
  17746. subclass needs to know if its superclass's size was calcu-
  17747. lated by the superclass or was specified explicitly.  All
  17748. widgets must place themselves into whatever size is
  17749.  
  17750.  
  17751.  
  17752.                  259
  17753.  
  17754.  
  17755.  
  17756.  
  17757.  
  17758. X Toolkit Intrinsics                 X11 Release 6.4
  17759.  
  17760.  
  17761. explicitly given, but they should compute a reasonable size
  17762. if no size is requested.  How does a subclass know the dif-
  17763. ference between a specified size and a size computed by a
  17764. superclass?
  17765.  
  17766. The request and new parameters provide the necessary infor-
  17767. mation.  The request widget is a copy of the widget, updated
  17768. as originally requested.  The new widget starts with the
  17769. values in the request, but it has additionally been updated
  17770. by all superclass set_values procedures called so far.    A
  17771. subclass set_values procedure can compare these two to
  17772. resolve any potential conflicts.  The set_values procedure
  17773. need not refer to the request widget unless it must resolve
  17774. conflicts between the current and new widgets.    Any changes
  17775. the widget needs to make, including geometry changes, should
  17776. be made in the new widget.
  17777.  
  17778. In the above example, the subclass with the visual surround
  17779. can see if the width and height in the request widget are
  17780. zero.  If so, it adds its surround size to the width and
  17781. height fields in the new widget.  If not, it must make do
  17782. with the size originally specified.  In this case, zero is a
  17783. special value defined by the class to permit the application
  17784. to invoke this behavior.
  17785.  
  17786. The new widget is the actual widget instance record.  There-
  17787. fore, the set_values procedure should do all its work on the
  17788. new widget; the request widget should never be modified.  If
  17789. the set_values procedure needs to call any routines that
  17790. operate on a widget, it should specify new as the widget
  17791. instance.
  17792.  
  17793. Before calling the set_values procedures, the Intrinsics
  17794. modify the resources of the request widget according to the
  17795. contents of the arglist; if the widget names all its
  17796. resources in the class resource list, it is never necessary
  17797. to examine the contents of args.
  17798.  
  17799. Finally, the set_values procedure must return a Boolean that
  17800. indicates whether the widget needs to be redisplayed.  Note
  17801. that a change in the geometry fields alone does not require
  17802. the set_values procedure to return True; the X server will
  17803. eventually generate an Expose event, if necessary.  After
  17804. calling all the set_values procedures, XtSetValues forces a
  17805. redisplay by calling XClearArea if any of the set_values
  17806. procedures returned True.  Therefore, a set_values procedure
  17807. should not try to do its own redisplaying.
  17808.  
  17809. Set_values procedures should not do any work in response to
  17810. changes in geometry because XtSetValues eventually will per-
  17811. form a geometry request, and that request might be denied.
  17812. If the widget actually changes size in response to a call to
  17813. XtSetValues, its resize procedure is called.  Widgets should
  17814. do any geometry-related work in their resize procedure.
  17815.  
  17816.  
  17817.  
  17818.                  260
  17819.  
  17820.  
  17821.  
  17822.  
  17823.  
  17824. X Toolkit Intrinsics                 X11 Release 6.4
  17825.  
  17826.  
  17827. Note that it is permissible to call XtSetValues before a
  17828. widget is realized.  Therefore, the set_values procedure
  17829. must not assume that the widget is realized.
  17830.  
  17831.  
  17832. 9.7.2.2.  Widget State: The set_values_almost Procedure
  17833.  
  17834. The set_values_almost procedure pointer in the widget class
  17835. record is of type XtAlmostProc.
  17836.  
  17837. __
  17838. |
  17839. typedef void (*XtAlmostProc)(Widget, Widget, XtWidgetGeometry*, XtWidgetGeometry*);
  17840.       Widget old;
  17841.       Widget new;
  17842.       XtWidgetGeometry *request;
  17843.       XtWidgetGeometry *reply;
  17844.  
  17845.  
  17846. old      Specifies a copy of the object as it was before
  17847.       the XtSetValues call.
  17848.  
  17849. new      Specifies the object instance record.
  17850.  
  17851. request   Specifies the original geometry request that was
  17852.       sent to the geometry manager that caused XtGeome-
  17853.       tryAlmost to be returned.
  17854.  
  17855. reply      Specifies the compromise geometry that was
  17856.       returned by the geometry manager with
  17857.       XtGeometryAlmost.
  17858. |__
  17859.  
  17860. Most classes inherit the set_values_almost procedure from
  17861. their superclass by specifying XtInheritSetValuesAlmost in
  17862. the class initialization.  The set_values_almost procedure
  17863. in rectObjClass accepts the compromise suggested.
  17864.  
  17865. The set_values_almost procedure is called when a client
  17866. tries to set a widget's geometry by means of a call to
  17867. XtSetValues and the geometry manager cannot satisfy the
  17868. request but instead returns XtGeometryNo or XtGeometryAlmost
  17869. and a compromise geometry.  The new object is the actual
  17870. instance record.  The x, y, width, height, and border_width
  17871. fields contain the original values as they were before the
  17872. XtSetValues call, and all other fields contain the new val-
  17873. ues.  The request parameter contains the new geometry
  17874. request that was made to the parent.  The reply parameter
  17875. contains reply->request_mode equal to zero if the parent
  17876. returned XtGeometryNo and contains the parent's compromise
  17877. geometry otherwise.  The set_values_almost procedure takes
  17878. the original geometry and the compromise geometry and deter-
  17879. mines if the compromise is acceptable or whether to try a
  17880. different compromise.  It returns its results in the request
  17881.  
  17882.  
  17883.  
  17884.                  261
  17885.  
  17886.  
  17887.  
  17888.  
  17889.  
  17890. X Toolkit Intrinsics                 X11 Release 6.4
  17891.  
  17892.  
  17893. parameter, which is then sent back to the geometry manager
  17894. for another try.  To accept the compromise, the procedure
  17895. must copy the contents of the reply geometry into the
  17896. request geometry; to attempt an alternative geometry, the
  17897. procedure may modify any part of the request argument; to
  17898. terminate the geometry negotiation and retain the original
  17899. geometry, the procedure must set request->request_mode to
  17900. zero.  The geometry fields of the old and new instances must
  17901. not be modified directly.
  17902.  
  17903.  
  17904. 9.7.2.3.  Widget State: The ConstraintClassPart set_values
  17905. Procedure
  17906.  
  17907. The constraint set_values procedure pointer is of type
  17908. XtSetValuesFunc.  The values passed to the parent's con-
  17909. straint set_values procedure are the same as those passed to
  17910. the child's class set_values procedure.  A class can specify
  17911. NULL for the set_values field of the ConstraintPart if it
  17912. need not compute anything.
  17913.  
  17914. The constraint set_values procedure should recompute any
  17915. constraint fields derived from constraint resources that are
  17916. changed.  Furthermore, it may modify other widget fields as
  17917. appropriate.  For example, if a constraint for the maximum
  17918. height of a widget is changed to a value smaller than the
  17919. widget's current height, the constraint set_values procedure
  17920. may reset the height field in the widget.
  17921.  
  17922.  
  17923. 9.7.2.4.  Widget Subpart State
  17924.  
  17925. To set the current values of subpart resources associated
  17926. with a widget instance, use XtSetSubvalues.  For a discus-
  17927. sion of subpart resources, see Section 9.4.
  17928.  
  17929.  
  17930.  
  17931.  
  17932.  
  17933.  
  17934.  
  17935.  
  17936.  
  17937.  
  17938.  
  17939.  
  17940.  
  17941.  
  17942.  
  17943.  
  17944.  
  17945.  
  17946.  
  17947.  
  17948.  
  17949.  
  17950.                  262
  17951.  
  17952.  
  17953.  
  17954.  
  17955.  
  17956. X Toolkit Intrinsics                 X11 Release 6.4
  17957.  
  17958. __
  17959. |
  17960. void XtSetSubvalues(base, resources, num_resources, args, num_args)
  17961.       XtPointer base;
  17962.       XtResourceList resources;
  17963.       Cardinal num_resources;
  17964.       ArgList args;
  17965.       Cardinal num_args;
  17966.  
  17967.  
  17968. base      Specifies the base address of the subpart data
  17969.       structure into which the resources should be writ-
  17970.       ten.
  17971.  
  17972. resources Specifies the subpart resource list.
  17973.  
  17974. num_resources
  17975.       Specifies the number of entries in the resource
  17976.       list.
  17977.  
  17978. args      Specifies the argument list of name/value pairs
  17979.       that contain the resources to be modified and
  17980.       their new values.
  17981.  
  17982. num_args  Specifies the number of entries in the argument
  17983.       list.
  17984. |__
  17985.  
  17986. The XtSetSubvalues function updates the resource fields of
  17987. the structure identified by base.  Any specified arguments
  17988. that do not match an entry in the resource list are silently
  17989. ignored.
  17990.  
  17991.  
  17992. To set the current values of subpart resources associated
  17993. with a widget instance using varargs lists, use
  17994. XtVaSetSubvalues.
  17995.  
  17996.  
  17997.  
  17998.  
  17999.  
  18000.  
  18001.  
  18002.  
  18003.  
  18004.  
  18005.  
  18006.  
  18007.  
  18008.  
  18009.  
  18010.  
  18011.  
  18012.  
  18013.  
  18014.  
  18015.  
  18016.                  263
  18017.  
  18018.  
  18019.  
  18020.  
  18021.  
  18022. X Toolkit Intrinsics                 X11 Release 6.4
  18023.  
  18024. __
  18025. |
  18026. void XtVaSetSubvalues(base, resources, num_resources, ...)
  18027.       XtPointer base;
  18028.       XtResourceList resources;
  18029.       Cardinal num_resources;
  18030.  
  18031.  
  18032. base      Specifies the base address of the subpart data
  18033.       structure into which the resources should be writ-
  18034.       ten.
  18035.  
  18036. resources Specifies the subpart resource list.
  18037.  
  18038. num_resources
  18039.       Specifies the number of entries in the resource
  18040.       list.
  18041.  
  18042. ...      Specifies the variable argument list of name/value
  18043.       pairs that contain the resources to be modified
  18044.       and their new values.
  18045. |__
  18046.  
  18047. XtVaSetSubvalues is identical in function to XtSetSubvalues
  18048. with the args and num_args parameters replaced by a varargs
  18049. list, as described in Section 2.5.1.  XtVaTypedArg is not
  18050. supported for XtVaSetSubvalues.  If an entry containing
  18051. XtVaTypedArg is specified in the list, a warning message is
  18052. issued and the entry is ignored.
  18053.  
  18054.  
  18055. 9.7.2.5.  Widget Subpart Resource Data: The set_values_hook
  18056. Procedure
  18057.  
  18058.                 Note
  18059.  
  18060.      The set_values_hook procedure is obsolete, as the
  18061.      same information is now available to the set_val-
  18062.      ues procedure.  The procedure has been retained
  18063.      for those widgets that used it in versions prior
  18064.      to Release 4.
  18065.  
  18066.  
  18067. Widgets that have a subpart can set the subpart resource
  18068. values through XtSetValues by supplying a set_values_hook
  18069. procedure.  The set_values_hook procedure pointer in a wid-
  18070. get class is of type XtArgsFunc.
  18071.  
  18072.  
  18073.  
  18074.  
  18075.  
  18076.  
  18077.  
  18078.  
  18079.  
  18080.  
  18081.  
  18082.                  264
  18083.  
  18084.  
  18085.  
  18086.  
  18087.  
  18088. X Toolkit Intrinsics                 X11 Release 6.4
  18089.  
  18090. __
  18091. |
  18092. typedef Boolean (*XtArgsFunc)(Widget, Arglist, Cardinal*);
  18093.       Widget w;
  18094.       Arglist args;
  18095.       Cardinal *num_args;
  18096.  
  18097.  
  18098. w      Specifies the widget whose subpart resource values
  18099.       are to be changed.
  18100.  
  18101. args      Specifies the argument list that was passed to
  18102.       XtSetValues or the transformed varargs list passed
  18103.       to XtVaSetValues.
  18104.  
  18105. num_args  Specifies the number of entries in the argument
  18106.       list.
  18107. |__
  18108.  
  18109. The widget with subpart resources may call XtSetValues from
  18110. the set_values_hook procedure and pass in its subresource
  18111. list and the args and num_args parameters.
  18112.  
  18113.  
  18114.  
  18115.  
  18116.  
  18117.  
  18118.  
  18119.  
  18120.  
  18121.  
  18122.  
  18123.  
  18124.  
  18125.  
  18126.  
  18127.  
  18128.  
  18129.  
  18130.  
  18131.  
  18132.  
  18133.  
  18134.  
  18135.  
  18136.  
  18137.  
  18138.  
  18139.  
  18140.  
  18141.  
  18142.  
  18143.  
  18144.  
  18145.  
  18146.  
  18147.  
  18148.                  265
  18149.  
  18150.  
  18151.  
  18152.  
  18153.  
  18154. X Toolkit Intrinsics                 X11 Release 6.4
  18155.  
  18156.  
  18157.  
  18158.  
  18159.              Chapter 10
  18160.  
  18161.            Translation Management
  18162.  
  18163.  
  18164.  
  18165. Except under unusual circumstances, widgets do not hardwire
  18166. the mapping of user events into widget behavior by using the
  18167. event manager.    Instead, they provide a default mapping of
  18168. events into behavior that you can override.
  18169.  
  18170. The translation manager provides an interface to specify and
  18171. manage the mapping of X event sequences into widget-supplied
  18172. functionality, for example, calling procedure Abc when the y
  18173. key is pressed.
  18174.  
  18175. The translation manager uses two kinds of tables to perform
  18176. translations:
  18177.  
  18178. o    The action tables, which are in the widget class struc-
  18179.      ture, specify the mapping of externally available pro-
  18180.      cedure name strings to the corresponding procedure
  18181.      implemented by the widget class.
  18182.  
  18183. o    A translation table, which is in the widget class
  18184.      structure, specifies the mapping of event sequences to
  18185.      procedure name strings.
  18186.  
  18187. You can override the translation table in the class struc-
  18188. ture for a specific widget instance by supplying a different
  18189. translation table for the widget instance.  The resources
  18190. XtNtranslations and XtNbaseTranslations are used to modify
  18191. the class default translation table; see Section 10.3.
  18192.  
  18193.  
  18194. 10.1.  Action Tables
  18195.  
  18196. All widget class records contain an action table, an array
  18197. of XtActionsRec entries.  In addition, an application can
  18198. register its own action tables with the translation manager
  18199. so that the translation tables it provides to widget
  18200. instances can access application functionality directly.
  18201. The translation action procedure pointer is of type
  18202. XtActionProc.
  18203.  
  18204.  
  18205.  
  18206.  
  18207.  
  18208.  
  18209.  
  18210.  
  18211.  
  18212.  
  18213.  
  18214.                  266
  18215.  
  18216.  
  18217.  
  18218.  
  18219.  
  18220. X Toolkit Intrinsics                 X11 Release 6.4
  18221.  
  18222. __
  18223. |
  18224. typedef void (*XtActionProc)(Widget, XEvent*, String*, Cardinal*);
  18225.       Widget w;
  18226.       XEvent *event;
  18227.       String *params;
  18228.       Cardinal *num_params;
  18229.  
  18230.  
  18231. w      Specifies the widget that caused the action to be
  18232.       called.
  18233.  
  18234. event      Specifies the event that caused the action to be
  18235.       called.  If the action is called after a sequence
  18236.       of events, then the last event in the sequence is
  18237.       used.
  18238.  
  18239. params      Specifies a pointer to the list of strings that
  18240.       were specified in the translation table as argu-
  18241.       ments to the action, or NULL.
  18242.  
  18243. num_params
  18244.       Specifies the number of entries in params.
  18245.  
  18246.  
  18247. typedef struct _XtActionsRec {
  18248.      String string;
  18249.      XtActionProc proc;
  18250. } XtActionsRec, *XtActionList;
  18251.  
  18252. |__
  18253.  
  18254. The string field is the name used in translation tables to
  18255. access the procedure.  The proc field is a pointer to a pro-
  18256. cedure that implements the functionality.
  18257.  
  18258. When the action list is specified as the CoreClassPart
  18259. actions field, the string pointed to by string must be per-
  18260. manently allocated prior to or during the execution of the
  18261. class initialization procedure and must not be subsequently
  18262. deallocated.
  18263.  
  18264. Action procedures should not assume that the widget in which
  18265. they are invoked is realized; an accelerator specification
  18266. can cause an action procedure to be called for a widget that
  18267. does not yet have a window.  Widget writers should also note
  18268. which of a widget's callback lists are invoked from action
  18269. procedures and warn clients not to assume the widget is
  18270. realized in those callbacks.
  18271.  
  18272. For example, a Pushbutton widget has procedures to take the
  18273. following actions:
  18274.  
  18275. o    Set the button to indicate it is activated.
  18276.  
  18277.  
  18278.  
  18279.  
  18280.                  267
  18281.  
  18282.  
  18283.  
  18284.  
  18285.  
  18286. X Toolkit Intrinsics                 X11 Release 6.4
  18287.  
  18288.  
  18289. o    Unset the button back to its normal mode.
  18290.  
  18291. o    Highlight the button borders.
  18292.  
  18293. o    Unhighlight the button borders.
  18294.  
  18295. o    Notify any callbacks that the button has been acti-
  18296.      vated.
  18297.  
  18298. The action table for the Pushbutton widget class makes these
  18299. functions available to translation tables written for Push-
  18300. button or any subclass.  The string entry is the name used
  18301. in translation tables.    The procedure entry (usually spelled
  18302. identically to the string) is the name of the C procedure
  18303. that implements that function:
  18304.  
  18305.  
  18306.      XtActionsRec actionTable[] = {
  18307.       {"Set",   Set},
  18308.       {"Unset", Unset},
  18309.       {"Highlight",Highlight},
  18310.       {"Unhighlight",Unhighlight}
  18311.       {"Notify",Notify},
  18312.      };
  18313.  
  18314.  
  18315. The Intrinsics reserve all action names and parameters
  18316. starting with the characters ``Xt'' for future standard
  18317. enhancements.  Users, applications, and widgets should not
  18318. declare action names or pass parameters starting with these
  18319. characters except to invoke specified built-in Intrinsics
  18320. functions.
  18321.  
  18322.  
  18323. 10.1.1.  Action Table Registration
  18324.  
  18325. The actions and num_actions fields of CoreClassPart specify
  18326. the actions implemented by a widget class.  These are auto-
  18327. matically registered with the Intrinsics when the class is
  18328. initialized and must be allocated in writable storage prior
  18329. to Core class_part initialization, and never deallocated.
  18330. To save memory and optimize access, the Intrinsics may over-
  18331. write the storage in order to compile the list into an
  18332. internal representation.
  18333.  
  18334.  
  18335. To declare an action table within an application and regis-
  18336. ter it with the translation manager, use XtAppAddActions.
  18337.  
  18338.  
  18339.  
  18340.  
  18341.  
  18342.  
  18343.  
  18344.  
  18345.  
  18346.                  268
  18347.  
  18348.  
  18349.  
  18350.  
  18351.  
  18352. X Toolkit Intrinsics                 X11 Release 6.4
  18353.  
  18354. __
  18355. |
  18356. void XtAppAddActions(app_context, actions, num_actions)
  18357.       XtAppContext app_context;
  18358.       XtActionList actions;
  18359.       Cardinal num_actions;
  18360.  
  18361.  
  18362. app_context
  18363.       Specifies the application context.
  18364.  
  18365. actions   Specifies the action table to register.
  18366.  
  18367. num_actions
  18368.       Specifies the number of entries in this action
  18369.       table.
  18370. |__
  18371.  
  18372. If more than one action is registered with the same name,
  18373. the most recently registered action is used.  If duplicate
  18374. actions exist in an action table, the first is used.  The
  18375. Intrinsics register an action table containing XtMenuPopup
  18376. and XtMenuPopdown as part of XtCreateApplicationContext.
  18377.  
  18378.  
  18379. 10.1.2.  Action Names to Procedure Translations
  18380.  
  18381. The translation manager uses a simple algorithm to resolve
  18382. the name of a procedure specified in a translation table
  18383. into the actual procedure specified in an action table.
  18384. When the widget is realized, the translation manager per-
  18385. forms a search for the name in the following tables, in
  18386. order:
  18387.  
  18388. o    The widget's class and all superclass action tables, in
  18389.      subclass-to-superclass order.
  18390.  
  18391. o    The parent's class and all superclass action tables, in
  18392.      subclass-to-superclass order, then on up the ancestor
  18393.      tree.
  18394.  
  18395. o    The action tables registered with XtAppAddActions and
  18396.      XtAddActions from the most recently added table to the
  18397.      oldest table.
  18398.  
  18399. As soon as it finds a name, the translation manager stops
  18400. the search.  If it cannot find a name, the translation man-
  18401. ager generates a warning message.
  18402.  
  18403.  
  18404. 10.1.3.  Action Hook Registration
  18405.  
  18406. An application can specify a procedure that will be called
  18407. just before every action routine is dispatched by the trans-
  18408. lation manager.  To do so, the application supplies a
  18409.  
  18410.  
  18411.  
  18412.                  269
  18413.  
  18414.  
  18415.  
  18416.  
  18417.  
  18418. X Toolkit Intrinsics                 X11 Release 6.4
  18419.  
  18420.  
  18421. procedure pointer of type XtActionHookProc.
  18422.  
  18423. __
  18424. |
  18425. typedef void (*XtActionHookProc)(Widget, XtPointer, String, XEvent*, String*, Cardinal*);
  18426.       Widget w;
  18427.       XtPointer client_data;
  18428.       String action_name;
  18429.       XEvent* event;
  18430.       String* params;
  18431.       Cardinal* num_params;
  18432.  
  18433.  
  18434. w      Specifies the widget whose action is about to be
  18435.       dispatched.
  18436.  
  18437. client_data
  18438.       Specifies the application-specific closure that
  18439.       was passed to XtAppAddActionHook.
  18440.  
  18441. action_name
  18442.       Specifies the name of the action to be dispatched.
  18443.  
  18444. event      Specifies the event argument that will be passed
  18445.       to the action routine.
  18446.  
  18447. params      Specifies the action parameters that will be
  18448.       passed to the action routine.
  18449.  
  18450. num_params
  18451.       Specifies the number of entries in params.
  18452. |__
  18453.  
  18454. Action hooks should not modify any of the data pointed to by
  18455. the arguments other than the client_data argument.
  18456.  
  18457.  
  18458. To add an action hook, use XtAppAddActionHook.
  18459.  
  18460.  
  18461.  
  18462.  
  18463.  
  18464.  
  18465.  
  18466.  
  18467.  
  18468.  
  18469.  
  18470.  
  18471.  
  18472.  
  18473.  
  18474.  
  18475.  
  18476.  
  18477.  
  18478.                  270
  18479.  
  18480.  
  18481.  
  18482.  
  18483.  
  18484. X Toolkit Intrinsics                 X11 Release 6.4
  18485.  
  18486. __
  18487. |
  18488. XtActionHookId XtAppAddActionHook(app, proc, client_data)
  18489.       XtAppContext app;
  18490.       XtActionHookProc proc;
  18491.       XtPointer client_data;
  18492.  
  18493.  
  18494. app      Specifies the application context.
  18495.  
  18496. proc      Specifies the action hook procedure.
  18497.  
  18498. client_data
  18499.       Specifies application-specific data to be passed
  18500.       to the action hook.
  18501. |__
  18502.  
  18503. XtAppAddActionHook adds the specified procedure to the front
  18504. of a list maintained in the application context.  In the
  18505. future, when an action routine is about to be invoked for
  18506. any widget in this application context, either through the
  18507. translation manager or via XtCallActionProc, the action hook
  18508. procedures will be called in reverse order of registration
  18509. just prior to invoking the action routine.
  18510.  
  18511. Action hook procedures are removed automatically and the
  18512. XtActionHookIdis destroyed when the application context in
  18513. which they were added is destroyed.
  18514.  
  18515.  
  18516. To remove an action hook procedure without destroying the
  18517. application context, use XtRemoveActionHook.
  18518.  
  18519. __
  18520. |
  18521. void XtRemoveActionHook(id)
  18522.       XtActionHookId id;
  18523.  
  18524.  
  18525. id      Specifies the action hook id returned by
  18526.       XtAppAddActionHook.
  18527. |__
  18528.  
  18529. XtRemoveActionHook removes the specified action hook proce-
  18530. dure from the list in which it was registered.
  18531.  
  18532.  
  18533. 10.2.  Translation Tables
  18534.  
  18535. All widget instance records contain a translation table,
  18536. which is a resource with a default value specified elsewhere
  18537. in the class record.  A translation table specifies what
  18538. action procedures are invoked for an event or a sequence of
  18539. events.  A translation table is a string containing a list
  18540. of translations from an event sequence into one or more
  18541.  
  18542.  
  18543.  
  18544.                  271
  18545.  
  18546.  
  18547.  
  18548.  
  18549.  
  18550. X Toolkit Intrinsics                 X11 Release 6.4
  18551.  
  18552.  
  18553. action procedure calls.  The translations are separated from
  18554. one another by newline characters (ASCII LF).  The complete
  18555. syntax of translation tables is specified in Appendix B.
  18556.  
  18557. As an example, the default behavior of Pushbutton is
  18558.  
  18559. o    Highlight on enter window.
  18560.  
  18561. o    Unhighlight on exit window.
  18562.  
  18563. o    Invert on left button down.
  18564.  
  18565. o    Call callbacks and reinvert on left button up.
  18566.  
  18567. The following illustrates Pushbutton's default translation
  18568. table:
  18569.  
  18570.  
  18571.      static String defaultTranslations =
  18572.       "<EnterWindow>:Highlight()\n\
  18573.       <LeaveWindow>:Unhighlight()\n\
  18574.       <Btn1Down>:Set()\n\
  18575.       <Btn1Up>: Notify() Unset()";
  18576.  
  18577.  
  18578. The tm_table field of the CoreClassPart should be filled in
  18579. at class initialization time with the string containing the
  18580. class's default translations.  If a class wants to inherit
  18581. its superclass's translations, it can store the special
  18582. value XtInheritTranslations into tm_table.  In Core's class
  18583. part initialization procedure, the Intrinsics compile this
  18584. translation table into an efficient internal form.  Then, at
  18585. widget creation time, this default translation table is com-
  18586. bined with the XtNtranslations and XtNbaseTranslations
  18587. resources; see Section 10.3.
  18588.  
  18589. The resource conversion mechanism automatically compiles
  18590. string translation tables that are specified in the resource
  18591. database.  If a client uses translation tables that are not
  18592. retrieved via a resource conversion, it must compile them
  18593. itself using XtParseTranslationTable.
  18594.  
  18595. The Intrinsics use the compiled form of the translation
  18596. table to register the necessary events with the event man-
  18597. ager.  Widgets need do nothing other than specify the action
  18598. and translation tables for events to be processed by the
  18599. translation manager.
  18600.  
  18601.  
  18602. 10.2.1.  Event Sequences
  18603.  
  18604. An event sequence is a comma-separated list of X event
  18605. descriptions that describes a specific sequence of X events
  18606. to map to a set of program actions.  Each X event
  18607.  
  18608.  
  18609.  
  18610.                  272
  18611.  
  18612.  
  18613.  
  18614.  
  18615.  
  18616. X Toolkit Intrinsics                 X11 Release 6.4
  18617.  
  18618.  
  18619. description consists of three parts: The X event type, a
  18620. prefix consisting of the X modifier bits, and an event-spe-
  18621. cific suffix.
  18622.  
  18623. Various abbreviations are supported to make translation
  18624. tables easier to read.    The events must match incoming
  18625. events in left-to-right order to trigger the action
  18626. sequence.
  18627.  
  18628.  
  18629. 10.2.2.  Action Sequences
  18630.  
  18631. Action sequences specify what program or widget actions to
  18632. take in response to incoming X events. An action sequence
  18633. consists of space-separated action procedure call specifica-
  18634. tions.    Each action procedure call consists of the name of
  18635. an action procedure and a parenthesized list of zero or more
  18636. comma-separated string parameters to pass to that procedure.
  18637. The actions are invoked in left-to-right order as specified
  18638. in the action sequence.
  18639.  
  18640.  
  18641. 10.2.3.  Multi-Click Time
  18642.  
  18643. Translation table entries may specify actions that are taken
  18644. when two or more identical events occur consecutively within
  18645. a short time interval, called the multi-click time.  The
  18646. multi-click time value may be specified as an application
  18647. resource with name ``multiClickTime'' and class ``Mul-
  18648. tiClickTime'' and may also be modified dynamically by the
  18649. application.  The multi-click time is unique for each Dis-
  18650. play value and is retrieved from the resource database by
  18651. XtDisplayInitialize.  If no value is specified, the initial
  18652. value is 200 milliseconds.
  18653.  
  18654.  
  18655. To set the multi-click time dynamically, use
  18656. XtSetMultiClickTime.
  18657.  
  18658. __
  18659. |
  18660. void XtSetMultiClickTime(display, time)
  18661.       Display *display;
  18662.       int time;
  18663.  
  18664.  
  18665. display   Specifies the display connection.
  18666.  
  18667. time      Specifies the multi-click time in milliseconds.
  18668. |__
  18669.  
  18670. XtSetMultiClickTime sets the time interval used by the
  18671. translation manager to determine when multiple events are
  18672. interpreted as a repeated event.  When a repeat count is
  18673.  
  18674.  
  18675.  
  18676.                  273
  18677.  
  18678.  
  18679.  
  18680.  
  18681.  
  18682. X Toolkit Intrinsics                 X11 Release 6.4
  18683.  
  18684.  
  18685. specified in a translation entry, the interval between the
  18686. timestamps in each pair of repeated events (e.g., between
  18687. two ButtonPress events) must be less than the multi-click
  18688. time in order for the translation actions to be taken.
  18689.  
  18690.  
  18691. To read the multi-click time, use XtGetMultiClickTime.
  18692.  
  18693. __
  18694. |
  18695. int XtGetMultiClickTime(display)
  18696.       Display *display;
  18697.  
  18698.  
  18699. display   Specifies the display connection.
  18700. |__
  18701.  
  18702. XtGetMultiClickTime returns the time in milliseconds that
  18703. the translation manager uses to determine if multiple events
  18704. are to be interpreted as a repeated event for purposes of
  18705. matching a translation entry containing a repeat count.
  18706.  
  18707.  
  18708. 10.3.  Translation Table Management
  18709.  
  18710. Sometimes an application needs to merge its own translations
  18711. with a widget's translations.  For example, a window manager
  18712. provides functions to move a window.  The window manager
  18713. wishes to bind this operation to a specific pointer button
  18714. in the title bar without the possibility of user override
  18715. and bind it to other buttons that may be overridden by the
  18716. user.
  18717.  
  18718. To accomplish this, the window manager should first create
  18719. the title bar and then should merge the two translation
  18720. tables into the title bar's translations.  One translation
  18721. table contains the translations that the window manager
  18722. wants only if the user has not specified a translation for a
  18723. particular event or event sequence (i.e., those that may be
  18724. overridden).  The other translation table contains the
  18725. translations that the window manager wants regardless of
  18726. what the user has specified.
  18727.  
  18728. Three Intrinsics functions support this merging:
  18729.  
  18730. XtParseTransla-        Compiles a translation table.
  18731. tionTable
  18732.  
  18733. XtAugmentTransla-      Merges a compiled translation table
  18734. tions               into a widget's compiled translation
  18735.                table, ignoring any new translations
  18736.                that conflict with existing transla-
  18737.                tions.
  18738.  
  18739.  
  18740.  
  18741.  
  18742.                  274
  18743.  
  18744.  
  18745.  
  18746.  
  18747.  
  18748. X Toolkit Intrinsics                 X11 Release 6.4
  18749.  
  18750.  
  18751. XtOverrideTransla-     Merges a compiled translation table
  18752. tions               into a widget's compiled translation
  18753.                table, replacing any existing trans-
  18754.                lations that conflict with new trans-
  18755.                lations.
  18756.  
  18757.  
  18758.  
  18759. To compile a translation table, use XtParseTranslationTable.
  18760.  
  18761. __
  18762. |
  18763. XtTranslations XtParseTranslationTable(table)
  18764.       String table;
  18765.  
  18766.  
  18767. table      Specifies the translation table to compile.
  18768. |__
  18769.  
  18770. The XtParseTranslationTable function compiles the transla-
  18771. tion table, provided in the format given in Appendix B, into
  18772. an opaque internal representation of type XtTranslations.
  18773. Note that if an empty translation table is required for any
  18774. purpose, one can be obtained by calling XtParseTransla-
  18775. tionTable and passing an empty string.
  18776.  
  18777.  
  18778. To merge additional translations into an existing transla-
  18779. tion table, use XtAugmentTranslations.
  18780.  
  18781. __
  18782. |
  18783. void XtAugmentTranslations(w, translations)
  18784.       Widget w;
  18785.       XtTranslations translations;
  18786.  
  18787.  
  18788. w      Specifies the widget into which the new transla-
  18789.       tions are to be merged.  Must be of class Core or
  18790.       any subclass thereof.
  18791.  
  18792. translations
  18793.       Specifies the compiled translation table to merge
  18794.       in.
  18795. |__
  18796.  
  18797. The XtAugmentTranslations function merges the new transla-
  18798. tions into the existing widget translations, ignoring any
  18799. #replace, #augment, or #override directive that may have
  18800. been specified in the translation string.  The translation
  18801. table specified by translations is not altered by this pro-
  18802. cess.  XtAugmentTranslations logically appends the string
  18803. representation of the new translations to the string repre-
  18804. sentation of the widget's current translations and reparses
  18805.  
  18806.  
  18807.  
  18808.                  275
  18809.  
  18810.  
  18811.  
  18812.  
  18813.  
  18814. X Toolkit Intrinsics                 X11 Release 6.4
  18815.  
  18816.  
  18817. the result with no warning messages about duplicate left-
  18818. hand sides, then stores the result back into the widget
  18819. instance; i.e., if the new translations contain an event or
  18820. event sequence that already exists in the widget's transla-
  18821. tions, the new translation is ignored.
  18822.  
  18823.  
  18824. To overwrite existing translations with new translations,
  18825. use XtOverrideTranslations.
  18826.  
  18827. __
  18828. |
  18829. void XtOverrideTranslations(w, translations)
  18830.       Widget w;
  18831.       XtTranslations translations;
  18832.  
  18833.  
  18834. w      Specifies the widget into which the new transla-
  18835.       tions are to be merged. Must be of class Core or
  18836.       any subclass thereof.
  18837.  
  18838. translations
  18839.       Specifies the compiled translation table to merge
  18840.       in.
  18841. |__
  18842.  
  18843. The XtOverrideTranslations function merges the new transla-
  18844. tions into the existing widget translations, ignoring any
  18845. #replace, #augment, or #override directive that may have
  18846. been specified in the translation string.  The translation
  18847. table specified by translations is not altered by this pro-
  18848. cess.  XtOverrideTranslations logically appends the string
  18849. representation of the widget's current translations to the
  18850. string representation of the new translations and reparses
  18851. the result with no warning messages about duplicate left-
  18852. hand sides, then stores the result back into the widget
  18853. instance; i.e., if the new translations contain an event or
  18854. event sequence that already exists in the widget's transla-
  18855. tions, the new translation overrides the widget's transla-
  18856. tion.
  18857.  
  18858. To replace a widget's translations completely, use XtSetVal-
  18859. ues on the XtNtranslations resource and specify a compiled
  18860. translation table as the value.
  18861.  
  18862.  
  18863. To make it possible for users to easily modify translation
  18864. tables in their resource files, the string-to-translation-
  18865. table resource type converter allows the string to specify
  18866. whether the table should replace, augment, or override any
  18867. existing translation table in the widget.  To specify this,
  18868. a pound sign (#) is given as the first character of the
  18869. table followed by one of the keywords ``replace'', ``aug-
  18870. ment'', or ``override'' to indicate whether to replace,
  18871.  
  18872.  
  18873.  
  18874.                  276
  18875.  
  18876.  
  18877.  
  18878.  
  18879.  
  18880. X Toolkit Intrinsics                 X11 Release 6.4
  18881.  
  18882.  
  18883. augment, or override the existing table.  The replace or
  18884. merge operation is performed during the Core instance ini-
  18885. tialization.  Each merge operation produces a new transla-
  18886. tion resource value; if the original tables were shared by
  18887. other widgets, they are unaffected.  If no directive is
  18888. specified, ``#replace'' is assumed.
  18889.  
  18890. At instance initialization the XtNtranslations resource is
  18891. first fetched.    Then, if it was not specified or did not
  18892. contain ``#replace'', the resource database is searched for
  18893. the resource XtNbaseTranslations.  If XtNbaseTranslations is
  18894. found, it is merged into the widget class translation table.
  18895. Then the widget translations field is merged into the result
  18896. or into the class translation table if XtNbaseTranslations
  18897. was not found.    This final table is then stored into the
  18898. widget translations field.  If the XtNtranslations resource
  18899. specified ``#replace'', no merge is done.  If neither
  18900. XtNbaseTranslations or XtNtranslations are specified, the
  18901. class translation table is copied into the widget instance.
  18902.  
  18903.  
  18904. To completely remove existing translations, use
  18905. XtUninstallTranslations.
  18906.  
  18907. __
  18908. |
  18909. void XtUninstallTranslations(w)
  18910.       Widget w;
  18911.  
  18912.  
  18913. w      Specifies the widget from which the translations
  18914.       are to be removed.   Must be of class Core or any
  18915.       subclass thereof.
  18916. |__
  18917.  
  18918. The XtUninstallTranslations function causes the entire
  18919. translation table for the widget to be removed.
  18920.  
  18921.  
  18922. 10.4.  Using Accelerators
  18923.  
  18924. It is often desirable to be able to bind events in one wid-
  18925. get to actions in another.  In particular, it is often use-
  18926. ful to be able to invoke menu actions from the keyboard.
  18927. The Intrinsics provide a facility, called accelerators, that
  18928. lets you accomplish this.  An accelerator table is a trans-
  18929. lation table that is bound with its actions in the context
  18930. of a particular widget, the source widget.  The accelerator
  18931. table can then be installed on one or more destination wid-
  18932. gets.  When an event sequence in the destination widget
  18933. would cause an accelerator action to be taken, and if the
  18934. source widget is sensitive, the actions are executed as
  18935. though triggered by the same event sequence in the accelera-
  18936. tor source widget.  The event is passed to the action
  18937.  
  18938.  
  18939.  
  18940.                  277
  18941.  
  18942.  
  18943.  
  18944.  
  18945.  
  18946. X Toolkit Intrinsics                 X11 Release 6.4
  18947.  
  18948.  
  18949. procedure without modification.  The action procedures used
  18950. within accelerators must not assume that the source widget
  18951. is realized nor that any fields of the event are in refer-
  18952. ence to the source widget's window if the widget is real-
  18953. ized.
  18954.  
  18955. Each widget instance contains that widget's exported accel-
  18956. erator table as a resource.  Each class of widget exports a
  18957. method that takes a displayable string representation of the
  18958. accelerators so that widgets can display their current
  18959. accelerators.  The representation is the accelerator table
  18960. in canonical translation table form (see Appendix B).  The
  18961. display_accelerator procedure pointer is of type
  18962. XtStringProc.
  18963.  
  18964. __
  18965. |
  18966. typedef void (*XtStringProc)(Widget, String);
  18967.       Widget w;
  18968.       String string;
  18969.  
  18970.  
  18971. w      Specifies the source widget that supplied the
  18972.       accelerators.
  18973.  
  18974. string      Specifies the string representation of the accel-
  18975.       erators for this widget.
  18976. |__
  18977.  
  18978. Accelerators can be specified in resource files, and the
  18979. string representation is the same as for a translation
  18980. table.    However, the interpretation of the #augment and
  18981. #override directives applies to what will happen when the
  18982. accelerator is installed; that is, whether or not the accel-
  18983. erator translations will override the translations in the
  18984. destination widget.  The default is #augment, which means
  18985. that the accelerator translations have lower priority than
  18986. the destination translations.  The #replace directive is
  18987. ignored for accelerator tables.
  18988.  
  18989.  
  18990. To parse an accelerator table, use XtParseAcceleratorTable.
  18991.  
  18992. __
  18993. |
  18994. XtAccelerators XtParseAcceleratorTable(source)
  18995.       String source;
  18996.  
  18997.  
  18998. source      Specifies the accelerator table to compile.
  18999. |__
  19000.  
  19001. The XtParseAcceleratorTable function compiles the accelera-
  19002. tor table into an opaque internal representation.  The
  19003.  
  19004.  
  19005.  
  19006.                  278
  19007.  
  19008.  
  19009.  
  19010.  
  19011.  
  19012. X Toolkit Intrinsics                 X11 Release 6.4
  19013.  
  19014.  
  19015. client should set the XtNaccelerators resource of each wid-
  19016. get that is to be activated by these translations to the
  19017. returned value.
  19018.  
  19019.  
  19020. To install accelerators from a widget on another widget, use
  19021. XtInstallAccelerators.
  19022.  
  19023. __
  19024. |
  19025. void XtInstallAccelerators(destination, source)
  19026.       Widget destination;
  19027.       Widget source;
  19028.  
  19029.  
  19030. destination
  19031.       Specifies the widget on which the accelerators are
  19032.       to be installed.  Must be of class Core or any
  19033.       subclass thereof.
  19034.  
  19035. source      Specifies the widget from which the accelerators
  19036.       are to come.    Must be of class Core or any sub-
  19037.       class thereof.
  19038. |__
  19039.  
  19040. The XtInstallAccelerators function installs the accelerators
  19041. resource value from source onto destination by merging the
  19042. source accelerators into the destination translations.    If
  19043. the source display_accelerator field is non-NULL, XtInstal-
  19044. lAccelerators calls it with the source widget and a string
  19045. representation of the accelerator table, which indicates
  19046. that its accelerators have been installed and that it should
  19047. display them appropriately.  The string representation of
  19048. the accelerator table is its canonical translation table
  19049. representation.
  19050.  
  19051.  
  19052. As a convenience for installing all accelerators from a wid-
  19053. get and all its descendants onto one destination, use
  19054. XtInstallAllAccelerators.
  19055.  
  19056.  
  19057.  
  19058.  
  19059.  
  19060.  
  19061.  
  19062.  
  19063.  
  19064.  
  19065.  
  19066.  
  19067.  
  19068.  
  19069.  
  19070.  
  19071.  
  19072.                  279
  19073.  
  19074.  
  19075.  
  19076.  
  19077.  
  19078. X Toolkit Intrinsics                 X11 Release 6.4
  19079.  
  19080. __
  19081. |
  19082. void XtInstallAllAccelerators(destination, source)
  19083.       Widget destination;
  19084.       Widget source;
  19085.  
  19086.  
  19087. destination
  19088.       Specifies the widget on which the accelerators are
  19089.       to be installed.  Must be of class Core or any
  19090.       subclass thereof.
  19091.  
  19092. source      Specifies the root widget of the widget tree from
  19093.       which the accelerators are to come.  Must be of
  19094.       class Core or any subclass thereof.
  19095. |__
  19096.  
  19097. The XtInstallAllAccelerators function recursively descends
  19098. the widget tree rooted at source and installs the accelera-
  19099. tors resource value of each widget encountered onto destina-
  19100. tion.  A common use is to call XtInstallAllAccelerators and
  19101. pass the application main window as the source.
  19102.  
  19103.  
  19104. 10.5.  KeyCode-to-KeySym Conversions
  19105.  
  19106. The translation manager provides support for automatically
  19107. translating KeyCodes in incoming key events into KeySyms.
  19108. KeyCode-to-KeySym translator procedure pointers are of type
  19109. XtKeyProc.
  19110.  
  19111.  
  19112.  
  19113.  
  19114.  
  19115.  
  19116.  
  19117.  
  19118.  
  19119.  
  19120.  
  19121.  
  19122.  
  19123.  
  19124.  
  19125.  
  19126.  
  19127.  
  19128.  
  19129.  
  19130.  
  19131.  
  19132.  
  19133.  
  19134.  
  19135.  
  19136.  
  19137.  
  19138.                  280
  19139.  
  19140.  
  19141.  
  19142.  
  19143.  
  19144. X Toolkit Intrinsics                 X11 Release 6.4
  19145.  
  19146. __
  19147. |
  19148. typedef void (*XtKeyProc)(Display*, KeyCode, Modifiers, Modifiers*, KeySym*);
  19149.       Display *display;
  19150.       KeyCode keycode;
  19151.       Modifiers modifiers;
  19152.       Modifiers *modifiers_return;
  19153.       KeySym *keysym_return;
  19154.  
  19155.  
  19156. display    Specifies the display that the KeyCode is from.
  19157.  
  19158. keycode    Specifies the KeyCode to translate.
  19159.  
  19160. modifiers  Specifies the modifiers to the KeyCode.
  19161.  
  19162. modifiers_return
  19163.        Specifies a location in which to store a mask
  19164.        that indicates the subset of all modifiers that
  19165.        are examined by the key translator for the speci-
  19166.        fied keycode.
  19167.  
  19168. keysym_return
  19169.        Specifies a location in which to store the
  19170.        resulting KeySym.
  19171. |__
  19172.  
  19173. This procedure takes a KeyCode and modifiers and produces a
  19174. KeySym.  For any given key translator function and keyboard
  19175. encoding, modifiers_return will be a constant per KeyCode
  19176. that indicates the subset of all modifiers that are examined
  19177. by the key translator for that KeyCode.
  19178.  
  19179. The KeyCode-to-KeySym translator procedure must be imple-
  19180. mented such that multiple calls with the same display, key-
  19181. code, and modifiers return the same result until either a
  19182. new case converter, an XtCaseProc, is installed or a Map-
  19183. pingNotify event is received.
  19184.  
  19185.  
  19186.  
  19187. The Intrinsics maintain tables internally to map KeyCodes to
  19188. KeySyms for each open display.    Translator procedures and
  19189. other clients may share a single copy of this table to per-
  19190. form the same mapping.
  19191.  
  19192. To return a pointer to the KeySym-to-KeyCode mapping table
  19193. for a particular display, use XtGetKeysymTable.
  19194.  
  19195.  
  19196.  
  19197.  
  19198.  
  19199.  
  19200.  
  19201.  
  19202.  
  19203.  
  19204.                  281
  19205.  
  19206.  
  19207.  
  19208.  
  19209.  
  19210. X Toolkit Intrinsics                 X11 Release 6.4
  19211.  
  19212. __
  19213. |
  19214. KeySym *XtGetKeysymTable(display, min_keycode_return, keysyms_per_keycode_return)
  19215.       Display *display;
  19216.       KeyCode *min_keycode_return;
  19217.       int *keysyms_per_keycode_return;
  19218.  
  19219.  
  19220. display   Specifies the display whose table is required.
  19221.  
  19222. min_keycode_return
  19223.       Returns the minimum KeyCode valid for the display.
  19224.  
  19225. keysyms_per_keycode_return
  19226.       Returns the number of KeySyms stored for each Key-
  19227.       Code.
  19228. |__
  19229.  
  19230. XtGetKeysymTable returns a pointer to the Intrinsics' copy
  19231. of the server's KeyCode-to-KeySym table.  This table must
  19232. not be modified.  There are keysyms_per_keycode_return
  19233. KeySyms associated with each KeyCode, located in the table
  19234. with indices starting at index
  19235.  
  19236.      (test_keycode - min_keycode_return) *
  19237.      keysyms_per_keycode_return
  19238.  
  19239. for KeyCode test_keycode.  Any entries that have no KeySyms
  19240. associated with them contain the value NoSymbol.  Clients
  19241. should not cache the KeySym table but should call
  19242. XtGetKeysymTable each time the value is needed, as the table
  19243. may change prior to dispatching each event.
  19244.  
  19245. For more information on this table, see Section 12.7 in Xlib
  19246. -- C Language X Interface.
  19247.  
  19248.  
  19249. To register a key translator, use XtSetKeyTranslator.
  19250.  
  19251. __
  19252. |
  19253. void XtSetKeyTranslator(display, proc)
  19254.       Display *display;
  19255.       XtKeyProc proc;
  19256.  
  19257.  
  19258. display   Specifies the display from which to translate the
  19259.       events.
  19260.  
  19261. proc      Specifies the procedure to perform key transla-
  19262.       tions.
  19263. |__
  19264.  
  19265. The XtSetKeyTranslator function sets the specified procedure
  19266. as the current key translator.    The default translator is
  19267.  
  19268.  
  19269.  
  19270.                  282
  19271.  
  19272.  
  19273.  
  19274.  
  19275.  
  19276. X Toolkit Intrinsics                 X11 Release 6.4
  19277.  
  19278.  
  19279. XtTranslateKey, an XtKeyProc that uses the Shift, Lock, num-
  19280. lock, and group modifiers with the interpretations defined
  19281. in X Window System Protocol, Section 5.  It is provided so
  19282. that new translators can call it to get default KeyCode-to-
  19283. KeySym translations and so that the default translator can
  19284. be reinstalled.
  19285.  
  19286.  
  19287. To invoke the currently registered KeyCode-to-KeySym trans-
  19288. lator, use XtTranslateKeycode.
  19289.  
  19290. __
  19291. |
  19292. void XtTranslateKeycode(display, keycode, modifiers, modifiers_return, keysym_return)
  19293.       Display *display;
  19294.       KeyCode keycode;
  19295.       Modifiers modifiers;
  19296.       Modifiers *modifiers_return;
  19297.       KeySym *keysym_return;
  19298.  
  19299.  
  19300. display    Specifies the display that the KeyCode is from.
  19301.  
  19302. keycode    Specifies the KeyCode to translate.
  19303.  
  19304. modifiers  Specifies the modifiers to the KeyCode.
  19305.  
  19306. modifiers_return
  19307.        Returns a mask that indicates the modifiers actu-
  19308.        ally used to generate the KeySym.
  19309.  
  19310. keysym_return
  19311.        Returns the resulting KeySym.
  19312. |__
  19313.  
  19314. The XtTranslateKeycode function passes the specified argu-
  19315. ments directly to the currently registered KeyCode-to-KeySym
  19316. translator.
  19317.  
  19318.  
  19319. To handle capitalization of nonstandard KeySyms, the Intrin-
  19320. sics allow clients to register case conversion routines.
  19321. Case converter procedure pointers are of type XtCaseProc.
  19322.  
  19323.  
  19324.  
  19325.  
  19326.  
  19327.  
  19328.  
  19329.  
  19330.  
  19331.  
  19332.  
  19333.  
  19334.  
  19335.  
  19336.                  283
  19337.  
  19338.  
  19339.  
  19340.  
  19341.  
  19342. X Toolkit Intrinsics                 X11 Release 6.4
  19343.  
  19344. __
  19345. |
  19346. typedef void (*XtCaseProc)(Display*, KeySym, KeySym*, KeySym*);
  19347.       Display *display;
  19348.       KeySym keysym;
  19349.       KeySym *lower_return;
  19350.       KeySym *upper_return;
  19351.  
  19352.  
  19353. display   Specifies the display connection for which the
  19354.       conversion is required.
  19355.  
  19356. keysym      Specifies the KeySym to convert.
  19357.  
  19358. lower_return
  19359.       Specifies a location into which to store the low-
  19360.       ercase equivalent for the KeySym.
  19361.  
  19362. upper_return
  19363.       Specifies a location into which to store the
  19364.       uppercase equivalent for the KeySym.
  19365. |__
  19366.  
  19367. If there is no case distinction, this procedure should store
  19368. the KeySym into both return values.
  19369.  
  19370.  
  19371. To register a case converter, use XtRegisterCaseConverter.
  19372.  
  19373. __
  19374. |
  19375. void XtRegisterCaseConverter(display, proc, start, stop)
  19376.     Display *display;
  19377.     XtCaseProc proc;
  19378.     KeySym start;
  19379.     KeySym stop;
  19380.  
  19381.  
  19382. display   Specifies the display from which the key events
  19383.       are to come.
  19384.  
  19385. proc      Specifies the XtCaseProc to do the conversions.
  19386.  
  19387. start      Specifies the first KeySym for which this con-
  19388.       verter is valid.
  19389.  
  19390. stop      Specifies the last KeySym for which this converter
  19391.       is valid.
  19392. |__
  19393.  
  19394. The XtRegisterCaseConverter registers the specified case
  19395. converter.  The start and stop arguments provide the inclu-
  19396. sive range of KeySyms for which this converter is to be
  19397. called.  The new converter overrides any previous converters
  19398. for KeySyms in that range.  No interface exists to remove
  19399.  
  19400.  
  19401.  
  19402.                  284
  19403.  
  19404.  
  19405.  
  19406.  
  19407.  
  19408. X Toolkit Intrinsics                 X11 Release 6.4
  19409.  
  19410.  
  19411. converters; you need to register an identity converter.
  19412. When a new converter is registered, the Intrinsics  refresh
  19413. the keyboard state if necessary.  The default converter
  19414. understands case conversion for all Latin KeySyms defined in
  19415. X Window System Protocol, Appendix A.
  19416.  
  19417.  
  19418. To determine uppercase and lowercase equivalents for a
  19419. KeySym, use XtConvertCase.
  19420.  
  19421. __
  19422. |
  19423. void XtConvertCase(display, keysym, lower_return, upper_return)
  19424.     Display *display;
  19425.     KeySym keysym;
  19426.     KeySym *lower_return;
  19427.     KeySym *upper_return;
  19428.  
  19429.  
  19430. display   Specifies the display that the KeySym came from.
  19431.  
  19432. keysym      Specifies the KeySym to convert.
  19433.  
  19434. lower_return
  19435.       Returns the lowercase equivalent of the KeySym.
  19436.  
  19437. upper_return
  19438.       Returns the uppercase equivalent of the KeySym.
  19439. |__
  19440.  
  19441. The XtConvertCase function calls the appropriate converter
  19442. and returns the results.  A user-supplied XtKeyProc may need
  19443. to use this function.
  19444.  
  19445.  
  19446. 10.6.  Obtaining a KeySym in an Action Procedure
  19447.  
  19448. When an action procedure is invoked on a KeyPress or KeyRe-
  19449. lease event, it often has a need to retrieve the KeySym and
  19450. modifiers corresponding to the event that caused it to be
  19451. invoked.  In order to avoid repeating the processing that
  19452. was just performed by the Intrinsics to match the transla-
  19453. tion entry, the KeySym and modifiers are stored for the
  19454. duration of the action procedure and are made available to
  19455. the client.
  19456.  
  19457. To retrieve the KeySym and modifiers that matched the final
  19458. event specification in the translation table entry, use
  19459. XtGetActionKeysym.
  19460.  
  19461.  
  19462.  
  19463.  
  19464.  
  19465.  
  19466.  
  19467.  
  19468.                  285
  19469.  
  19470.  
  19471.  
  19472.  
  19473.  
  19474. X Toolkit Intrinsics                 X11 Release 6.4
  19475.  
  19476. __
  19477. |
  19478. KeySym XtGetActionKeysym(event, modifiers_return)
  19479.       XEvent *event;
  19480.       Modifiers *modifiers_return;
  19481.  
  19482.  
  19483. event        Specifies the event pointer passed to the action
  19484.         procedure by the Intrinsics.
  19485.  
  19486. modifiers_return
  19487.         Returns the modifiers that caused the match, if
  19488.         non-NULL.
  19489. |__
  19490.  
  19491. If XtGetActionKeysym is called after an action procedure has
  19492. been invoked by the Intrinsics and before that action proce-
  19493. dure returns, and if the event pointer has the same value as
  19494. the event pointer passed to that action routine, and if the
  19495. event is a KeyPress or KeyRelease event, then XtGetAction-
  19496. Keysym returns the KeySym that matched the final event spec-
  19497. ification in the translation table and, if modifiers_return
  19498. is non-NULL, the modifier state actually used to generate
  19499. this KeySym; otherwise, if the event is a KeyPress or KeyRe-
  19500. lease event, then XtGetActionKeysym calls XtTranslateKeycode
  19501. and returns the results; else it returns NoSymbol and does
  19502. not examine modifiers_return.
  19503.  
  19504. Note that if an action procedure invoked by the Intrinsics
  19505. invokes a subsequent action procedure (and so on) via
  19506. XtCallActionProc, the nested action procedure may also call
  19507. XtGetActionKeysym to retrieve the Intrinsics' KeySym and
  19508. modifiers.
  19509.  
  19510.  
  19511. 10.7.  KeySym-to-KeyCode Conversions
  19512.  
  19513. To return the list of KeyCodes that map to a particular
  19514. KeySym in the keyboard mapping table maintained by the
  19515. Intrinsics, use XtKeysymToKeycodeList.
  19516.  
  19517.  
  19518.  
  19519.  
  19520.  
  19521.  
  19522.  
  19523.  
  19524.  
  19525.  
  19526.  
  19527.  
  19528.  
  19529.  
  19530.  
  19531.  
  19532.  
  19533.  
  19534.                  286
  19535.  
  19536.  
  19537.  
  19538.  
  19539.  
  19540. X Toolkit Intrinsics                 X11 Release 6.4
  19541.  
  19542. __
  19543. |
  19544. void XtKeysymToKeycodeList(display, keysym, keycodes_return, keycount_return)
  19545.       Display *display;
  19546.       KeySym keysym;
  19547.       KeyCode **keycodes_return;
  19548.       Cardinal *keycount_return;
  19549.  
  19550.  
  19551. display     Specifies the display whose table is required.
  19552.  
  19553. keysym        Specifies the KeySym for which to search.
  19554.  
  19555. keycodes_return
  19556.         Returns a list of KeyCodes that have keysym
  19557.         associated with them, or NULL if keycount_return
  19558.         is 0.
  19559.  
  19560. keycount_return
  19561.         Returns the number of KeyCodes in the keycode
  19562.         list.
  19563. |__
  19564.  
  19565. The XtKeysymToKeycodeList procedure returns all the KeyCodes
  19566. that have keysym in their entry for the keyboard mapping
  19567. table associated with display.    For each entry in the table,
  19568. the first four KeySyms (groups 1 and 2) are interpreted as
  19569. specified by X Window System Protocol, Section 5.  If no
  19570. KeyCodes map to the specified KeySym, keycount_return is
  19571. zero and *keycodes_return is NULL.
  19572.  
  19573. The caller should free the storage pointed to by key-
  19574. codes_return using XtFree when it is no longer useful.    If
  19575. the caller needs to examine the KeyCode-to-KeySym table for
  19576. a particular KeyCode, it should call XtGetKeysymTable.
  19577.  
  19578.  
  19579. 10.8.  Registering Button and Key Grabs for Actions
  19580.  
  19581. To register button and key grabs for a widget's window
  19582. according to the event bindings in the widget's translation
  19583. table, use XtRegisterGrabAction.
  19584.  
  19585.  
  19586.  
  19587.  
  19588.  
  19589.  
  19590.  
  19591.  
  19592.  
  19593.  
  19594.  
  19595.  
  19596.  
  19597.  
  19598.  
  19599.  
  19600.                  287
  19601.  
  19602.  
  19603.  
  19604.  
  19605.  
  19606. X Toolkit Intrinsics                 X11 Release 6.4
  19607.  
  19608. __
  19609. |
  19610. void XtRegisterGrabAction(action_proc, owner_events, event_mask, pointer_mode, keyboard_mode)
  19611.       XtActionProc action_proc;
  19612.       Boolean owner_events;
  19613.       unsigned int event_mask;
  19614.       int pointer_mode, keyboard_mode;
  19615.  
  19616.  
  19617. action_proc
  19618.       Specifies the action procedure to search for in
  19619.       translation tables.
  19620.  
  19621.  
  19622. owner_events
  19623.  
  19624. event_mask
  19625.  
  19626. pointer_mode
  19627.  
  19628. keyboard_mode
  19629.       Specify arguments to XtGrabButton or XtGrabKey.
  19630. |__
  19631.  
  19632. XtRegisterGrabAction adds the specified action_proc to a
  19633. list known to the translation manager.    When a widget is
  19634. realized, or when the translations of a realized widget or
  19635. the accelerators installed on a realized widget are modi-
  19636. fied, its translation table and any installed accelerators
  19637. are scanned for action procedures on this list.  If any are
  19638. invoked on ButtonPress or KeyPress events as the only or
  19639. final event in a sequence, the Intrinsics will call XtGrab-
  19640. Button or XtGrabKey for the widget with every button or Key-
  19641. Code which maps to the event detail field, passing the spec-
  19642. ified owner_events, event_mask, pointer_mode, and key-
  19643. board_mode.  For ButtonPress events, the modifiers specified
  19644. in the grab are determined directly from the translation
  19645. specification and confine_to and cursor are specified as
  19646. None.  For KeyPress events, if the translation table entry
  19647. specifies colon (:) in the modifier list, the modifiers are
  19648. determined by calling the key translator procedure regis-
  19649. tered for the display and calling XtGrabKey for every combi-
  19650. nation of standard modifiers which map the KeyCode to the
  19651. specified event detail KeySym, and ORing any modifiers spec-
  19652. ified in the translation table entry, and event_mask is
  19653. ignored.  If the translation table entry does not specify
  19654. colon in the modifier list, the modifiers specified in the
  19655. grab are those specified in the translation table entry
  19656. only.  For both ButtonPress and KeyPress events, don't-care
  19657. modifiers are ignored unless the translation entry explic-
  19658. itly specifies ``Any'' in the modifiers field.
  19659.  
  19660. If the specified action_proc is already registered for the
  19661. calling process, the new values will replace the previously
  19662. specified values for any widgets that become realized
  19663.  
  19664.  
  19665.  
  19666.                  288
  19667.  
  19668.  
  19669.  
  19670.  
  19671.  
  19672. X Toolkit Intrinsics                 X11 Release 6.4
  19673.  
  19674.  
  19675. following the call, but existing grabs are not altered on
  19676. currently realized widgets.
  19677.  
  19678. When translations or installed accelerators are modified for
  19679. a realized widget, any previous key or button grabs regis-
  19680. tered as a result of the old bindings are released if they
  19681. do not appear in the new bindings and are not explicitly
  19682. grabbed by the client with XtGrabKey or XtGrabButton.
  19683.  
  19684.  
  19685. 10.9.  Invoking Actions Directly
  19686.  
  19687. Normally action procedures are invoked by the Intrinsics
  19688. when an event or event sequence arrives for a widget. To
  19689. invoke an action procedure directly, without generating (or
  19690. synthesizing) events, use XtCallActionProc.
  19691.  
  19692. __
  19693. |
  19694. void XtCallActionProc(widget, action, event, params, num_params)
  19695.       Widget widget;
  19696.       String action;
  19697.       XEvent *event;
  19698.       String *params;
  19699.       Cardinal num_params;
  19700.  
  19701.  
  19702. widget      Specifies the widget in which the action is to be
  19703.       invoked.  Must be of class Core or any subclass
  19704.       thereof.
  19705.  
  19706. action      Specifies the name of the action routine.
  19707.  
  19708. event      Specifies the contents of the event passed to the
  19709.       action routine.
  19710.  
  19711. params      Specifies the contents of the params passed to the
  19712.       action routine.
  19713.  
  19714. num_params
  19715.       Specifies the number of entries in params.
  19716. |__
  19717.  
  19718. XtCallActionProc searches for the named action routine in
  19719. the same manner and order as translation tables are bound,
  19720. as described in Section 10.1.2, except that application
  19721. action tables are searched, if necessary, as of the time of
  19722. the call to XtCallActionProc.  If found, the action routine
  19723. is invoked with the specified widget, event pointer, and
  19724. parameters.  It is the responsibility of the caller to
  19725. ensure that the contents of the event, params, and
  19726. num_params arguments are appropriate for the specified
  19727. action routine and, if necessary, that the specified widget
  19728. is realized or sensitive.  If the named action routine
  19729.  
  19730.  
  19731.  
  19732.                  289
  19733.  
  19734.  
  19735.  
  19736.  
  19737.  
  19738. X Toolkit Intrinsics                 X11 Release 6.4
  19739.  
  19740.  
  19741. cannot be found, XtCallActionProc generates a warning mes-
  19742. sage and returns.
  19743.  
  19744.  
  19745. 10.10.    Obtaining a Widget's Action List
  19746.  
  19747. Occasionally a subclass will require the pointers to one or
  19748. more of its superclass's action procedures.  This would be
  19749. needed, for example, in order to envelop the superclass's
  19750. action.  To retrieve the list of action procedures regis-
  19751. tered in the superclass's actions field, use
  19752. XtGetActionList.
  19753.  
  19754. __
  19755. |
  19756. void XtGetActionList(widget_class, actions_return, num_actions_return)
  19757.       WidgetClass widget_class;
  19758.       XtActionList *actions_return;
  19759.       Cardinal *num_actions_return;
  19760.  
  19761.  
  19762. widget_class   Specifies the widget class whose actions are
  19763.            to be returned.
  19764.  
  19765. actions_return Returns the action list.
  19766.  
  19767. num_actions_return
  19768.            Returns the number of action procedures
  19769.            declared by the class.
  19770. |__
  19771.  
  19772. XtGetActionList returns the action table defined by the
  19773. specified widget class.  This table does not include actions
  19774. defined by the superclasses.  If widget_class is not ini-
  19775. tialized, or is not coreWidgetClass or a subclass thereof,
  19776. or if the class does not define any actions, *actions_return
  19777. will be NULL and *num_actions_return will be zero.  If
  19778. *actions_return is non-NULL the client is responsible for
  19779. freeing the table using XtFree when it is no longer needed.
  19780.  
  19781.  
  19782.  
  19783.  
  19784.  
  19785.  
  19786.  
  19787.  
  19788.  
  19789.  
  19790.  
  19791.  
  19792.  
  19793.  
  19794.  
  19795.  
  19796.  
  19797.  
  19798.                  290
  19799.  
  19800.  
  19801.  
  19802.  
  19803.  
  19804. X Toolkit Intrinsics                 X11 Release 6.4
  19805.  
  19806.  
  19807.  
  19808.  
  19809.              Chapter 11
  19810.  
  19811.              Utility Functions
  19812.  
  19813.  
  19814.  
  19815. The Intrinsics provide a number of utility functions that
  19816. you can use to
  19817.  
  19818. o    Determine the number of elements in an array.
  19819.  
  19820. o    Translate strings to widget instances.
  19821.  
  19822. o    Manage memory usage.
  19823.  
  19824. o    Share graphics contexts.
  19825.  
  19826. o    Manipulate selections.
  19827.  
  19828. o    Merge exposure events into a region.
  19829.  
  19830. o    Translate widget coordinates.
  19831.  
  19832. o    Locate a widget given a window id.
  19833.  
  19834. o    Handle errors.
  19835.  
  19836. o    Set the WM_COLORMAP_WINDOWS property.
  19837.  
  19838. o    Locate files by name with string substitutions.
  19839.  
  19840. o    Register callback functions for external agents.
  19841.  
  19842. o    Locate all the displays of an application context.
  19843.  
  19844.  
  19845. 11.1.  Determining the Number of Elements in an Array
  19846.  
  19847. To determine the number of elements in a fixed-size array,
  19848. use XtNumber.
  19849.  
  19850. __
  19851. |
  19852. Cardinal XtNumber(array)
  19853.       ArrayType array;
  19854.  
  19855.  
  19856. array      Specifies a fixed-size array of arbitrary type.
  19857. |__
  19858.  
  19859. The XtNumber macro returns the number of elements allocated
  19860. to the array.
  19861.  
  19862.  
  19863.  
  19864.                  291
  19865.  
  19866.  
  19867.  
  19868.  
  19869.  
  19870. X Toolkit Intrinsics                 X11 Release 6.4
  19871.  
  19872.  
  19873. 11.2.  Translating Strings to Widget Instances
  19874.  
  19875. To translate a widget name to a widget instance, use
  19876. XtNameToWidget.
  19877.  
  19878. __
  19879. |
  19880. Widget XtNameToWidget(reference, names)
  19881.       Widget reference;
  19882.       String names;
  19883.  
  19884.  
  19885. reference Specifies the widget from which the search is to
  19886.       start.  Must be of class Core or any subclass
  19887.       thereof.
  19888.  
  19889. names      Specifies the partially qualified name of the
  19890.       desired widget.
  19891. |__
  19892.  
  19893. The XtNameToWidget function searches for a descendant of the
  19894. reference widget whose name matches the specified names.
  19895. The names parameter specifies a simple object name or a
  19896. series of simple object name components separated by periods
  19897. or asterisks.  XtNameToWidget returns the descendant with
  19898. the shortest name matching the specification according to
  19899. the following rules, where child is either a pop-up child or
  19900. a normal child if the widget's class is a subclass of Com-
  19901. posite :
  19902.  
  19903. o    Enumerate the object subtree rooted at the reference
  19904.      widget in breadth-first order, qualifying the name of
  19905.      each object with the names of all its ancestors up to,
  19906.      but not including, the reference widget.  The ordering
  19907.      between children of a common parent is not defined.
  19908.  
  19909. o    Return the first object in the enumeration that matches
  19910.      the specified name, where each component of names
  19911.      matches exactly the corresponding component of the
  19912.      qualified object name and asterisk matches any series
  19913.      of components, including none.
  19914.  
  19915. o    If no match is found, return NULL.
  19916.  
  19917. Since breadth-first traversal is specified, the descendant
  19918. with the shortest matching name (i.e., the fewest number of
  19919. components), if any, will always be returned.  However,
  19920. since the order of enumeration of children is undefined and
  19921. since the Intrinsics do not require that all children of a
  19922. widget have unique names, XtNameToWidget may return any
  19923. child that matches if there are multiple objects in the sub-
  19924. tree with the same name.  Consecutive separators (periods or
  19925. asterisks) including at least one asterisk are treated as a
  19926. single asterisk.  Consecutive periods are treated as a
  19927.  
  19928.  
  19929.  
  19930.                  292
  19931.  
  19932.  
  19933.  
  19934.  
  19935.  
  19936. X Toolkit Intrinsics                 X11 Release 6.4
  19937.  
  19938.  
  19939. single period.
  19940.  
  19941.  
  19942. 11.3.  Managing Memory Usage
  19943.  
  19944. The Intrinsics memory management functions provide uniform
  19945. checking for null pointers and error reporting on memory
  19946. allocation errors.  These functions are completely compati-
  19947. ble with their standard C language runtime counterparts
  19948. malloc, calloc, realloc, and free with the following added
  19949. functionality:
  19950.  
  19951. o    XtMalloc, XtCalloc, and XtRealloc give an error if
  19952.      there is not enough memory.
  19953.  
  19954. o    XtFree simply returns if passed a NULL pointer.
  19955.  
  19956. o    XtRealloc simply allocates new storage if passed a NULL
  19957.      pointer.
  19958.  
  19959. See the standard C library documentation on malloc, calloc,
  19960. realloc, and free for more information.
  19961.  
  19962.  
  19963. To allocate storage, use XtMalloc.
  19964.  
  19965. __
  19966. |
  19967. char *XtMalloc(size)
  19968.       Cardinal size;
  19969.  
  19970.  
  19971. size      Specifies the number of bytes desired.
  19972. |__
  19973.  
  19974. The XtMalloc function returns a pointer to a block of stor-
  19975. age of at least the specified size bytes.  If there is
  19976. insufficient memory to allocate the new block, XtMalloc
  19977. calls XtErrorMsg.
  19978.  
  19979.  
  19980. To allocate and initialize an array, use XtCalloc.
  19981.  
  19982.  
  19983.  
  19984.  
  19985.  
  19986.  
  19987.  
  19988.  
  19989.  
  19990.  
  19991.  
  19992.  
  19993.  
  19994.  
  19995.  
  19996.                  293
  19997.  
  19998.  
  19999.  
  20000.  
  20001.  
  20002. X Toolkit Intrinsics                 X11 Release 6.4
  20003.  
  20004. __
  20005. |
  20006. char *XtCalloc(num, size)
  20007.       Cardinal num;
  20008.       Cardinal size;
  20009.  
  20010.  
  20011. num      Specifies the number of array elements to allo-
  20012.       cate.
  20013.  
  20014. size      Specifies the size of each array element in bytes.
  20015. |__
  20016.  
  20017. The XtCalloc function allocates space for the specified num-
  20018. ber of array elements of the specified size and initializes
  20019. the space to zero.  If there is insufficient memory to allo-
  20020. cate the new block, XtCalloc calls XtErrorMsg.    XtCalloc
  20021. returns the address of the allocated storage.
  20022.  
  20023.  
  20024. To change the size of an allocated block of storage, use
  20025. XtRealloc.
  20026.  
  20027. __
  20028. |
  20029. char *XtRealloc(ptr, num)
  20030.       char *ptr;
  20031.       Cardinal num;
  20032.  
  20033.  
  20034. ptr      Specifies a pointer to the old storage allocated
  20035.       with XtMalloc, XtCalloc, or XtRealloc, or NULL.
  20036.  
  20037. num      Specifies number of bytes desired in new storage.
  20038. |__
  20039.  
  20040. The XtRealloc function changes the size of a block of stor-
  20041. age, possibly moving it.  Then it copies the old contents
  20042. (or as much as will fit) into the new block and frees the
  20043. old block.  If there is insufficient memory to allocate the
  20044. new block, XtRealloc calls XtErrorMsg.    If ptr is NULL,
  20045. XtRealloc simply calls XtMalloc.  XtRealloc then returns the
  20046. address of the new block.
  20047.  
  20048.  
  20049. To free an allocated block of storage, use XtFree.
  20050.  
  20051.  
  20052.  
  20053.  
  20054.  
  20055.  
  20056.  
  20057.  
  20058.  
  20059.  
  20060.  
  20061.  
  20062.                  294
  20063.  
  20064.  
  20065.  
  20066.  
  20067.  
  20068. X Toolkit Intrinsics                 X11 Release 6.4
  20069.  
  20070. __
  20071. |
  20072. void XtFree(ptr)
  20073.       char *ptr;
  20074.  
  20075.  
  20076. ptr      Specifies a pointer to a block of storage allo-
  20077.       cated with XtMalloc, XtCalloc, or XtRealloc, or
  20078.       NULL.
  20079. |__
  20080.  
  20081. The XtFree function returns storage, allowing it to be
  20082. reused.  If ptr is NULL, XtFree returns immediately.
  20083.  
  20084.  
  20085. To allocate storage for a new instance of a type, use XtNew.
  20086.  
  20087. __
  20088. |
  20089. type *XtNew(type)
  20090.       type t;
  20091.  
  20092.  
  20093. type      Specifies a previously declared type.
  20094. |__
  20095.  
  20096. XtNew returns a pointer to the allocated storage.  If there
  20097. is insufficient memory to allocate the new block, XtNew
  20098. calls XtErrorMsg.  XtNew is a convenience macro that calls
  20099. XtMalloc with the following arguments specified:
  20100.  
  20101.  
  20102.      ((type *) XtMalloc((unsigned) sizeof(type)))
  20103.  
  20104.  
  20105. The storage allocated by XtNew should be freed using XtFree.
  20106.  
  20107.  
  20108. To copy an instance of a string, use XtNewString.
  20109.  
  20110. __
  20111. |
  20112. String XtNewString(string)
  20113.       String string;
  20114.  
  20115.  
  20116. string      Specifies a previously declared string.
  20117. |__
  20118.  
  20119. XtNewString returns a pointer to the allocated storage.  If
  20120. there is insufficient memory to allocate the new block,
  20121. XtNewString calls XtErrorMsg.  XtNewString is a convenience
  20122. macro that calls XtMalloc with the following arguments spec-
  20123. ified:
  20124.  
  20125.  
  20126.  
  20127.  
  20128.                  295
  20129.  
  20130.  
  20131.  
  20132.  
  20133.  
  20134. X Toolkit Intrinsics                 X11 Release 6.4
  20135.  
  20136.  
  20137.      (strcpy(XtMalloc((unsigned)strlen(str) + 1), str))
  20138.  
  20139.  
  20140. The storage allocated by XtNewString should be freed using
  20141. XtFree.
  20142.  
  20143.  
  20144. 11.4.  Sharing Graphics Contexts
  20145.  
  20146. The Intrinsics provide a mechanism whereby cooperating
  20147. objects can share a graphics context (GC), thereby reducing
  20148. both the number of GCs created and the total number of
  20149. server calls in any given application.    The mechanism is a
  20150. simple caching scheme and allows for clients to declare both
  20151. modifiable and nonmodifiable fields of the shared GCs.
  20152.  
  20153. To obtain a shareable GC with modifiable fields, use
  20154. XtAllocateGC.
  20155.  
  20156. __
  20157. |
  20158. GC XtAllocateGC(widget, depth, value_mask, values, dynamic_mask, unused_mask)
  20159.       Widget object;
  20160.       Cardinal depth;
  20161.       XtGCMask value_mask;
  20162.       XGCValues *values;
  20163.       XtGCMask dynamic_mask;
  20164.       XtGCMask unused_mask;
  20165.  
  20166.  
  20167. object      Specifies an object, giving the screen for which
  20168.       the returned GC is valid.  Must be of class Object
  20169.       or any subclass thereof.
  20170.  
  20171. depth      Specifies the depth for which the returned GC is
  20172.       valid, or 0.
  20173.  
  20174. value_mask
  20175.       Specifies fields of the GC that are initialized
  20176.       from values.
  20177.  
  20178. values      Specifies the values for the initialized fields.
  20179.  
  20180. dynamic_mask
  20181.       Specifies fields of the GC that will be modified
  20182.       by the caller.
  20183.  
  20184. unused_mask
  20185.       Specifies fields of the GC that will not be needed
  20186.       by the caller.
  20187. |__
  20188.  
  20189. The XtAllocateGC function returns a shareable GC that may be
  20190. modified by the client.  The screen field of the specified
  20191.  
  20192.  
  20193.  
  20194.                  296
  20195.  
  20196.  
  20197.  
  20198.  
  20199.  
  20200. X Toolkit Intrinsics                 X11 Release 6.4
  20201.  
  20202.  
  20203. widget or of the nearest widget ancestor of the specified
  20204. object and the specified depth argument supply the root and
  20205. drawable depths for which the GC is to be valid.  If depth
  20206. is zero, the depth is taken from the depth field of the
  20207. specified widget or of the nearest widget ancestor of the
  20208. specified object.
  20209.  
  20210. The value_mask argument specifies fields of the GC that are
  20211. initialized with the respective member of the values struc-
  20212. ture.  The dynamic_mask argument specifies fields that the
  20213. caller intends to modify during program execution.  The
  20214. caller must ensure that the corresponding GC field is set
  20215. prior to each use of the GC.  The unused_mask argument spec-
  20216. ifies fields of the GC that are of no interest to the
  20217. caller.  The caller may make no assumptions about the con-
  20218. tents of any fields specified in unused_mask.  The caller
  20219. may assume that at all times all fields not specified in
  20220. either dynamic_mask or unused_mask have their default value
  20221. if not specified in value_mask or the value specified by
  20222. values.  If a field is specified in both value_mask and
  20223. dynamic_mask, the effect is as if it were specified only in
  20224. dynamic_mask and then immediately set to the value in val-
  20225. ues.  If a field is set in unused_mask and also in either
  20226. value_mask or dynamic_mask, the specification in unused_mask
  20227. is ignored.
  20228.  
  20229. XtAllocateGC tries to minimize the number of unique GCs cre-
  20230. ated by comparing the arguments with those of previous calls
  20231. and returning an existing GC when there are no conflicts.
  20232. XtAllocateGC may modify and return an existing GC if it was
  20233. allocated with a nonzero unused_mask.
  20234.  
  20235.  
  20236. To obtain a shareable GC with no modifiable fields, use
  20237. XtGetGC.
  20238.  
  20239.  
  20240.  
  20241.  
  20242.  
  20243.  
  20244.  
  20245.  
  20246.  
  20247.  
  20248.  
  20249.  
  20250.  
  20251.  
  20252.  
  20253.  
  20254.  
  20255.  
  20256.  
  20257.  
  20258.  
  20259.  
  20260.                  297
  20261.  
  20262.  
  20263.  
  20264.  
  20265.  
  20266. X Toolkit Intrinsics                 X11 Release 6.4
  20267.  
  20268. __
  20269. |
  20270. GC XtGetGC(object, value_mask, values)
  20271.       Widget object;
  20272.       XtGCMask value_mask;
  20273.       XGCValues *values;
  20274.  
  20275.  
  20276. object      Specifies an object, giving the screen and depth
  20277.       for which the returned GC is valid.  Must be of
  20278.       class Object or any subclass thereof.
  20279.  
  20280. value_mask
  20281.       Specifies which fields of the values structure are
  20282.       specified.
  20283.  
  20284. values      Specifies the actual values for this GC.
  20285. |__
  20286.  
  20287. The XtGetGC function returns a shareable, read-only GC.  The
  20288. parameters to this function are the same as those for XCre-
  20289. ateGC except that an Object is passed instead of a Display.
  20290. XtGetGC is equivalent to XtAllocateGC with depth,
  20291. dynamic_mask, and unused_mask all zero.
  20292.  
  20293. XtGetGC shares only GCs in which all values in the GC
  20294. returned by XCreateGC are the same.  In particular, it does
  20295. not use the value_mask provided to determine which fields of
  20296. the GC a widget considers relevant.  The value_mask is used
  20297. only to tell the server which fields should be filled in
  20298. from values and which it should fill in with default values.
  20299.  
  20300.  
  20301. To deallocate a shared GC when it is no longer needed, use
  20302. XtReleaseGC.
  20303.  
  20304. __
  20305. |
  20306. void XtReleaseGC(object, gc)
  20307.       Widget object;
  20308.       GC gc;
  20309.  
  20310.  
  20311. object      Specifies any object on the Display for which the
  20312.       GC was created.  Must be of class Object or any
  20313.       subclass thereof.
  20314.  
  20315. gc      Specifies the shared GC obtained with either XtAl-
  20316.       locateGC or XtGetGC.
  20317. |__
  20318.  
  20319. References to shareable GCs are counted and a free request
  20320. is generated to the server when the last user of a given GC
  20321. releases it.
  20322.  
  20323.  
  20324.  
  20325.  
  20326.                  298
  20327.  
  20328.  
  20329.  
  20330.  
  20331.  
  20332. X Toolkit Intrinsics                 X11 Release 6.4
  20333.  
  20334.  
  20335. 11.5.  Managing Selections
  20336.  
  20337. Arbitrary widgets in multiple applications can communicate
  20338. with each other by means of the Intrinsics global selection
  20339. mechanism, which conforms to the specifications in the
  20340. Inter-Client Communication Conventions Manual.    The Intrin-
  20341. sics supply functions for providing and receiving selection
  20342. data in one logical piece (atomic transfers) or in smaller
  20343. logical segments (incremental transfers).
  20344.  
  20345. The incremental interface is provided for a selection owner
  20346. or selection requestor that cannot or prefers not to pass
  20347. the selection value to and from the Intrinsics in a single
  20348. call.  For instance, either an application that is running
  20349. on a machine with limited memory may not be able to store
  20350. the entire selection value in memory or a selection owner
  20351. may already have the selection value available in discrete
  20352. chunks, and it would be more efficient not to have to allo-
  20353. cate additional storage to copy the pieces contiguously.
  20354. Any owner or requestor that prefers to deal with the selec-
  20355. tion value in segments can use the incremental interfaces to
  20356. do so.    The transfer between the selection owner or
  20357. requestor and the Intrinsics is not required to match the
  20358. underlying transport protocol between the application and
  20359. the X server; the Intrinsics will break too large a selec-
  20360. tion into smaller pieces for transport if necessary and will
  20361. coalesce a selection transmitted incrementally if the value
  20362. was requested atomically.
  20363.  
  20364.  
  20365. 11.5.1.  Setting and Getting the Selection Timeout Value
  20366.  
  20367. To set the Intrinsics selection timeout, use
  20368. XtAppSetSelectionTimeout.
  20369.  
  20370. __
  20371. |
  20372. void XtAppSetSelectionTimeout(app_context, timeout)
  20373.     XtAppContext app_context;
  20374.     unsigned long timeout;
  20375.  
  20376.  
  20377. app_context
  20378.       Specifies the application context.
  20379.  
  20380. timeo|__  Specifies the selection timeout in milliseconds.
  20381.  
  20382.  
  20383. To get the current selection timeout value, use
  20384. XtAppGetSelectionTimeout.
  20385.  
  20386.  
  20387.  
  20388.  
  20389.  
  20390.  
  20391.  
  20392.                  299
  20393.  
  20394.  
  20395.  
  20396.  
  20397.  
  20398. X Toolkit Intrinsics                 X11 Release 6.4
  20399.  
  20400. __
  20401. |
  20402. unsigned long XtAppGetSelectionTimeout(app_context)
  20403.      XtAppContext app_context;
  20404.  
  20405.  
  20406. app_context
  20407.       Specifies the application context.
  20408. |__
  20409.  
  20410. The XtAppGetSelectionTimeout function returns the current
  20411. selection timeout value in milliseconds.  The selection
  20412. timeout is the time within which the two communicating
  20413. applications must respond to one another.  The initial time-
  20414. out value is set by the selectionTimeout application
  20415. resource as retrieved by XtDisplayInitialize.  If selection-
  20416. Timeout is not specified, the default is five seconds.
  20417.  
  20418.  
  20419. 11.5.2.  Using Atomic Transfers
  20420.  
  20421. When using atomic transfers, the owner will completely pro-
  20422. cess one selection request at a time.  The owner may con-
  20423. sider each request individually, since there is no possibil-
  20424. ity for overlap between evaluation of two requests.
  20425.  
  20426.  
  20427. 11.5.2.1.  Atomic Transfer Procedures
  20428.  
  20429. The following procedures are used by the selection owner
  20430. when providing selection data in a single unit.
  20431.  
  20432. The procedure pointer specified by the owner to supply the
  20433. selection data to the Intrinsics is of type
  20434. XtConvertSelectionProc.
  20435.  
  20436.  
  20437.  
  20438.  
  20439.  
  20440.  
  20441.  
  20442.  
  20443.  
  20444.  
  20445.  
  20446.  
  20447.  
  20448.  
  20449.  
  20450.  
  20451.  
  20452.  
  20453.  
  20454.  
  20455.  
  20456.  
  20457.  
  20458.                  300
  20459.  
  20460.  
  20461.  
  20462.  
  20463.  
  20464. X Toolkit Intrinsics                 X11 Release 6.4
  20465.  
  20466. __
  20467. |
  20468. typedef Boolean (*XtConvertSelectionProc)(Widget, Atom*, Atom*, Atom*,
  20469.               XtPointer*, unsigned long*, int*);
  20470.     Widget w;
  20471.     Atom *selection;
  20472.     Atom *target;
  20473.     Atom *type_return;
  20474.     XtPointer *value_return;
  20475.     unsigned long *length_return;
  20476.     int *format_return;
  20477.  
  20478.  
  20479. w      Specifies the widget that currently owns this
  20480.       selection.
  20481.  
  20482. selection Specifies the atom naming the selection requested
  20483.       (for example, XA_PRIMARY or XA_SECONDARY).
  20484.  
  20485. target      Specifies the target type of the selection that
  20486.       has been requested, which indicates the desired
  20487.       information about the selection (for example, File
  20488.       Name, Text, Window).
  20489.  
  20490. type_return
  20491.       Specifies a pointer to an atom into which the
  20492.       property type of the converted value of the selec-
  20493.       tion is to be stored.  For instance, either File
  20494.       Name or Text might have property type XA_STRING.
  20495.  
  20496. value_return
  20497.       Specifies a pointer into which a pointer to the
  20498.       converted value of the selection is to be stored.
  20499.       The selection owner is responsible for allocating
  20500.       this storage.  If the selection owner has provided
  20501.       an XtSelectionDoneProc for the selection, this
  20502.       storage is owned by the selection owner; other-
  20503.       wise, it is owned by the Intrinsics selection
  20504.       mechanism, which frees it by calling XtFree when
  20505.       it is done with it.
  20506.  
  20507. length_return
  20508.       Specifies a pointer into which the number of ele-
  20509.       ments in value_return, each of size indicated by
  20510.       format_return, is to be stored.
  20511.  
  20512. format_return
  20513.       Specifies a pointer into which the size in bits of
  20514.       the data elements of the selection value is to be
  20515.       stored.
  20516. |__
  20517.  
  20518. This procedure is called by the Intrinsics selection mecha-
  20519. nism to get the value of a selection as a given type from
  20520. the current selection owner.  It returns True if the owner
  20521.  
  20522.  
  20523.  
  20524.                  301
  20525.  
  20526.  
  20527.  
  20528.  
  20529.  
  20530. X Toolkit Intrinsics                 X11 Release 6.4
  20531.  
  20532.  
  20533. successfully converted the selection to the target type or
  20534. False otherwise.  If the procedure returns False, the values
  20535. of the return arguments are undefined.    Each XtConvertSelec-
  20536. tionProc should respond to target value TARGETS by returning
  20537. a value containing the list of the targets into which it is
  20538. prepared to convert the selection.  The value returned in
  20539. format_return must be one of 8, 16, or 32 to allow the
  20540. server to byte-swap the data if necessary.
  20541.  
  20542. This procedure does not need to worry about responding to
  20543. the MULTIPLE or the TIMESTAMP target values (see Section
  20544. 2.6.2 in the Inter-Client Communication Conventions Manual).
  20545. A selection request with the MULTIPLE target type is trans-
  20546. parently transformed into a series of calls to this proce-
  20547. dure, one for each target type, and a selection request with
  20548. the TIMESTAMP target value is answered automatically by the
  20549. Intrinsics using the time specified in the call to XtOwnSe-
  20550. lection or XtOwnSelectionIncremental.
  20551.  
  20552.  
  20553. To retrieve the SelectionRequest event that triggered the
  20554. XtConvertSelectionProc procedure, use XtGetSelectionRequest.
  20555.  
  20556. __
  20557. |
  20558. XSelectionRequestEvent *XtGetSelectionRequest(w, selection, request_id)
  20559.       Widget w;
  20560.       Atom selection;
  20561.       XtRequestId request_id;
  20562.  
  20563.  
  20564. w      Specifies the widget that currently owns this
  20565.       selection.  Must be of class Core or any subclass
  20566.       thereof.
  20567.  
  20568. selection Specifies the selection being processed.
  20569.  
  20570. request_id
  20571.       Specifies the requestor id in the case of incre-
  20572.       mental selections, or NULL in the case of atomic
  20573.       transfers.
  20574. |__
  20575.  
  20576. XtGetSelectionRequest may be called only from within an
  20577. XtConvertSelectionProc procedure and returns a pointer to
  20578. the SelectionRequest event that caused the conversion proce-
  20579. dure to be invoked.  Request_id specifies a unique id for
  20580. the individual request in the case that multiple incremental
  20581. transfers are outstanding.  For atomic transfers, request_id
  20582. must be specified as NULL.  If no SelectionRequest event is
  20583. being processed for the specified widget, selection, and
  20584. request_id, XtGetSelectionRequest returns NULL.
  20585.  
  20586.  
  20587.  
  20588.  
  20589.  
  20590.                  302
  20591.  
  20592.  
  20593.  
  20594.  
  20595.  
  20596. X Toolkit Intrinsics                 X11 Release 6.4
  20597.  
  20598.  
  20599. The procedure pointer specified by the owner when it desires
  20600. notification upon losing ownership is of type
  20601. XtLoseSelectionProc.
  20602.  
  20603. __
  20604. |
  20605. typedef void (*XtLoseSelectionProc)(Widget, Atom*);
  20606.     Widget w;
  20607.     Atom *selection;
  20608.  
  20609.  
  20610. w      Specifies the widget that has lost selection own-
  20611.       ership.
  20612.  
  20613. selection Specifies the atom naming the selection.
  20614. |__
  20615.  
  20616. This procedure is called by the Intrinsics selection mecha-
  20617. nism to inform the specified widget that it has lost the
  20618. given selection.  Note that this procedure does not ask the
  20619. widget to relinquish the selection ownership; it is merely
  20620. informative.
  20621.  
  20622.  
  20623. The procedure pointer specified by the owner when it desires
  20624. notification of receipt of the data or when it manages the
  20625. storage containing the data is of type XtSelectionDoneProc.
  20626.  
  20627. __
  20628. |
  20629. typedef void (*XtSelectionDoneProc)(Widget, Atom*, Atom*);
  20630.       Widget w;
  20631.       Atom *selection;
  20632.       Atom *target;
  20633.  
  20634.  
  20635. w      Specifies the widget that owns the converted
  20636.       selection.
  20637.  
  20638. selection Specifies the atom naming the selection that was
  20639.       converted.
  20640.  
  20641. target      Specifies the target type to which the conversion
  20642.       was done.
  20643. |__
  20644.  
  20645. This procedure is called by the Intrinsics selection mecha-
  20646. nism to inform the selection owner that a selection
  20647. requestor has successfully retrieved a selection value.  If
  20648. the selection owner has registered an XtSelectionDoneProc,
  20649. it should expect it to be called once for each conversion
  20650. that it performs, after the converted value has been suc-
  20651. cessfully transferred to the requestor.  If the selection
  20652. owner has registered an XtSelectionDoneProc, it also owns
  20653.  
  20654.  
  20655.  
  20656.                  303
  20657.  
  20658.  
  20659.  
  20660.  
  20661.  
  20662. X Toolkit Intrinsics                 X11 Release 6.4
  20663.  
  20664.  
  20665. the storage containing the converted selection value.
  20666.  
  20667.  
  20668. 11.5.2.2.  Getting the Selection Value
  20669.  
  20670. The procedure pointer specified by the requestor to receive
  20671. the selection data from the Intrinsics is of type
  20672. XtSelectionCallbackProc.
  20673.  
  20674. __
  20675. |
  20676. typedef void (*XtSelectionCallbackProc)(Widget, XtPointer, Atom*, Atom*, XtPointer, unsigned long*, int*);
  20677.       Widget w;
  20678.       XtPointer client_data;
  20679.       Atom *selection;
  20680.       Atom *type;
  20681.       XtPointer value;
  20682.       unsigned long *length;
  20683.       int *format;
  20684.  
  20685.  
  20686. w      Specifies the widget that requested the selection
  20687.       value.
  20688.  
  20689. client_data
  20690.       Specifies a value passed in by the widget when it
  20691.       requested the selection.
  20692.  
  20693. selection Specifies the name of the selection that was
  20694.       requested.
  20695.  
  20696. type      Specifies the representation type of the selection
  20697.       value (for example, XA_STRING).  Note that it is
  20698.       not the target that was requested (which the
  20699.       client must remember for itself), but the type
  20700.       that is used to represent the target.  The special
  20701.       symbolic constant XT_CONVERT_FAIL is used to indi-
  20702.       cate that the selection conversion failed because
  20703.       the selection owner did not respond within the
  20704.       Intrinsics selection timeout interval.
  20705.  
  20706. value      Specifies a pointer to the selection value.  The
  20707.       requesting client owns this storage and is respon-
  20708.       sible for freeing it by calling XtFree when it is
  20709.       done with it.
  20710.  
  20711. length      Specifies the number of elements in value.
  20712.  
  20713. format      Specifies the size in bits of the data in each
  20714.       element of value.
  20715. |__
  20716.  
  20717. This procedure is called by the Intrinsics selection mecha-
  20718. nism to deliver the requested selection to the requestor.
  20719.  
  20720.  
  20721.  
  20722.                  304
  20723.  
  20724.  
  20725.  
  20726.  
  20727.  
  20728. X Toolkit Intrinsics                 X11 Release 6.4
  20729.  
  20730.  
  20731. If the SelectionNotify event returns a property of None,
  20732. meaning the conversion has been refused because there is no
  20733. owner for the specified selection or the owner cannot con-
  20734. vert the selection to the requested target for any reason,
  20735. the procedure is called with a value of NULL and a length of
  20736. zero.
  20737.  
  20738.  
  20739. To obtain the selection value in a single logical unit, use
  20740. XtGetSelectionValue or XtGetSelectionValues.
  20741.  
  20742. __
  20743. |
  20744. void XtGetSelectionValue(w, selection, target, callback, client_data, time)
  20745.       Widget w;
  20746.       Atom selection;
  20747.       Atom target;
  20748.       XtSelectionCallbackProc callback;
  20749.       XtPointer client_data;
  20750.       Time time;
  20751.  
  20752.  
  20753. w      Specifies the widget making the request.  Must be
  20754.       of class Core or any subclass thereof.
  20755.  
  20756. selection Specifies the particular selection desired; for
  20757.       example, XA_PRIMARY.
  20758.  
  20759. target      Specifies the type of information needed about the
  20760.       selection.
  20761.  
  20762. callback  Specifies the procedure to be called when the
  20763.       selection value has been obtained.  Note that this
  20764.       is how the selection value is communicated back to
  20765.       the client.
  20766.  
  20767. client_data
  20768.       Specifies additional data to be passed to the
  20769.       specified procedure when it is called.
  20770.  
  20771. time      Specifies the timestamp that indicates when the
  20772.       selection request was initiated.  This should be
  20773.       the timestamp of the event that triggered this
  20774.       request; the value CurrentTime is not acceptable.
  20775. |__
  20776.  
  20777. The XtGetSelectionValue function requests the value of the
  20778. selection converted to the target type.  The specified call-
  20779. back is called at some time after XtGetSelectionValue is
  20780. called, when the selection value is received from the X
  20781. server.  It may be called before or after XtGetSelectionVa-
  20782. lue returns.  For more information about selection, target,
  20783. and time, see Section 2.6 in the Inter-Client Communication
  20784. Conventions Manual.
  20785.  
  20786.  
  20787.  
  20788.                  305
  20789.  
  20790.  
  20791.  
  20792.  
  20793.  
  20794. X Toolkit Intrinsics                 X11 Release 6.4
  20795.  
  20796. __
  20797. |
  20798. void XtGetSelectionValues(w, selection, targets, count, callback, client_data, time)
  20799.       Widget w;
  20800.       Atom selection;
  20801.       Atom *targets;
  20802.       int count;
  20803.       XtSelectionCallbackProc callback;
  20804.       XtPointer *client_data;
  20805.       Time time;
  20806.  
  20807.  
  20808. w      Specifies the widget making the request.  Must be
  20809.       of class Core or any subclass thereof.
  20810.  
  20811. selection Specifies the particular selection desired (that
  20812.       is, primary or secondary).
  20813.  
  20814. targets   Specifies the types of information needed about
  20815.       the selection.
  20816.  
  20817. count      Specifies the length of the targets and
  20818.       client_data lists.
  20819.  
  20820. callback  Specifies the callback procedure to be called with
  20821.       each selection value obtained.  Note that this is
  20822.       how the selection values are communicated back to
  20823.       the client.
  20824.  
  20825. client_data
  20826.       Specifies a list of additional data values, one
  20827.       for each target type, that are passed to the call-
  20828.       back procedure when it is called for that target.
  20829.  
  20830. time      Specifies the timestamp that indicates when the
  20831.       selection request was initiated.  This should be
  20832.       the timestamp of the event that triggered this
  20833.       request; the value CurrentTime is not acceptable.
  20834. |__
  20835.  
  20836. The XtGetSelectionValues function is similar to multiple
  20837. calls to XtGetSelectionValue except that it guarantees that
  20838. no other client can assert ownership between requests and
  20839. therefore that all the conversions will refer to the same
  20840. selection value.  The callback is invoked once for each tar-
  20841. get value with the corresponding client data.  For more
  20842. information about selection, target, and time, see Section
  20843. 2.6 in the Inter-Client Communication Conventions Manual.
  20844.  
  20845.  
  20846. 11.5.2.3.  Setting the Selection Owner
  20847.  
  20848. To set the selection owner and indicate that the selection
  20849. value will be provided in one piece, use XtOwnSelection.
  20850.  
  20851.  
  20852.  
  20853.  
  20854.                  306
  20855.  
  20856.  
  20857.  
  20858.  
  20859.  
  20860. X Toolkit Intrinsics                 X11 Release 6.4
  20861.  
  20862. __
  20863. |
  20864. Boolean XtOwnSelection(w, selection, time, convert_proc, lose_selection, done_proc)
  20865.       Widget w;
  20866.       Atom selection;
  20867.       Time time;
  20868.       XtConvertSelectionProc convert_proc;
  20869.       XtLoseSelectionProc lose_selection;
  20870.       XtSelectionDoneProc done_proc;
  20871.  
  20872.  
  20873. w      Specifies the widget that wishes to become the
  20874.       owner.  Must be of class Core or any subclass
  20875.       thereof.
  20876.  
  20877. selection Specifies the name of the selection (for example,
  20878.       XA_PRIMARY).
  20879.  
  20880. time      Specifies the timestamp that indicates when the
  20881.       ownership request was initiated.  This should be
  20882.       the timestamp of the event that triggered owner-
  20883.       ship; the value CurrentTime is not acceptable.
  20884.  
  20885. convert_proc
  20886.       Specifies the procedure to be called whenever a
  20887.       client requests the current value of the selec-
  20888.       tion.
  20889.  
  20890. lose_selection
  20891.       Specifies the procedure to be called whenever the
  20892.       widget has lost selection ownership, or NULL if
  20893.       the owner is not interested in being called back.
  20894.  
  20895. done_proc Specifies the procedure called after the requestor
  20896.       has received the selection value, or NULL if the
  20897.       owner is not interested in being called back.
  20898. |__
  20899.  
  20900. The XtOwnSelection function informs the Intrinsics selection
  20901. mechanism that a widget wishes to own a selection.  It
  20902. returns True if the widget successfully becomes the owner
  20903. and False otherwise.  The widget may fail to become the
  20904. owner if some other widget has asserted ownership at a time
  20905. later than this widget.  The widget can lose selection own-
  20906. ership either because some other widget asserted later own-
  20907. ership of the selection or because the widget voluntarily
  20908. gave up ownership of the selection.  The lose_selection pro-
  20909. cedure is not called if the widget fails to obtain selection
  20910. ownership in the first place.
  20911.  
  20912. If a done_proc is specified, the client owns the storage
  20913. allocated for passing the value to the Intrinsics.  If
  20914. done_proc is NULL, the convert_proc must allocate storage
  20915. using XtMalloc, XtRealloc, or XtCalloc, and the value speci-
  20916. fied is freed by the Intrinsics when the transfer is
  20917.  
  20918.  
  20919.  
  20920.                  307
  20921.  
  20922.  
  20923.  
  20924.  
  20925.  
  20926. X Toolkit Intrinsics                 X11 Release 6.4
  20927.  
  20928.  
  20929. complete.
  20930.  
  20931.  
  20932. Usually, a selection owner maintains ownership indefinitely
  20933. until some other widget requests ownership, at which time
  20934. the Intrinsics selection mechanism informs the previous
  20935. owner that it has lost ownership of the selection.  However,
  20936. in response to some user actions (for example, when a user
  20937. deletes the information selected), the application may wish
  20938. to explicitly inform the Intrinsics by using XtDisownSelec-
  20939. tion that it no longer is to be the selection owner.
  20940.  
  20941. __
  20942. |
  20943. void XtDisownSelection(w, selection, time)
  20944.       Widget w;
  20945.       Atom selection;
  20946.       Time time;
  20947.  
  20948.  
  20949. w      Specifies the widget that wishes to relinquish
  20950.       ownership.
  20951.  
  20952. selection Specifies the atom naming the selection being
  20953.       given up.
  20954.  
  20955. time      Specifies the timestamp that indicates when the
  20956.       request to relinquish selection ownership was ini-
  20957.       tiated.
  20958. |__
  20959.  
  20960. The XtDisownSelection function informs the Intrinsics selec-
  20961. tion mechanism that the specified widget is to lose owner-
  20962. ship of the selection.    If the widget does not currently own
  20963. the selection, either because it lost the selection or
  20964. because it never had the selection to begin with, XtDisownS-
  20965. election does nothing.
  20966.  
  20967. After a widget has called XtDisownSelection, its convert
  20968. procedure is not called even if a request arrives later with
  20969. a timestamp during the period that this widget owned the
  20970. selection.  However, its done procedure is called if a con-
  20971. version that started before the call to XtDisownSelection
  20972. finishes after the call to XtDisownSelection.
  20973.  
  20974.  
  20975. 11.5.3.  Using Incremental Transfers
  20976.  
  20977. When using the incremental interface, an owner may have to
  20978. process more than one selection request for the same selec-
  20979. tion, converted to the same target, at the same time.  The
  20980. incremental functions take a request_id argument, which is
  20981. an identifier that is guaranteed to be unique among all
  20982. incremental requests that are active concurrently.
  20983.  
  20984.  
  20985.  
  20986.                  308
  20987.  
  20988.  
  20989.  
  20990.  
  20991.  
  20992. X Toolkit Intrinsics                 X11 Release 6.4
  20993.  
  20994.  
  20995. For example, consider the following:
  20996.  
  20997. o    Upon receiving a request for the selection value, the
  20998.      owner sends the first segment.
  20999.  
  21000. o    While waiting to be called to provide the next segment
  21001.      value but before sending it, the owner receives another
  21002.      request from a different requestor for the same selec-
  21003.      tion value.
  21004.  
  21005. o    To distinguish between the requests, the owner uses the
  21006.      request_id value.    This allows the owner to distinguish
  21007.      between the first requestor, which is asking for the
  21008.      second segment, and the second requestor, which is ask-
  21009.      ing for the first segment.
  21010.  
  21011.  
  21012. 11.5.3.1.  Incremental Transfer Procedures
  21013.  
  21014. The following procedures are used by selection owners who
  21015. wish to provide the selection data in multiple segments.
  21016.  
  21017. The procedure pointer specified by the incremental owner to
  21018. supply the selection data to the Intrinsics is of type
  21019. XtConvertSelectionIncrProc.
  21020.  
  21021.  
  21022.  
  21023.  
  21024.  
  21025.  
  21026.  
  21027.  
  21028.  
  21029.  
  21030.  
  21031.  
  21032.  
  21033.  
  21034.  
  21035.  
  21036.  
  21037.  
  21038.  
  21039.  
  21040.  
  21041.  
  21042.  
  21043.  
  21044.  
  21045.  
  21046.  
  21047.  
  21048.  
  21049.  
  21050.  
  21051.  
  21052.                  309
  21053.  
  21054.  
  21055.  
  21056.  
  21057.  
  21058. X Toolkit Intrinsics                 X11 Release 6.4
  21059.  
  21060. __
  21061. |
  21062. typedef XtPointer XtRequestId;
  21063.  
  21064.  
  21065. typedef Boolean (*XtConvertSelectionIncrProc)(Widget, Atom*, Atom*, Atom*, XtPointer*,
  21066.                    unsigned long*, int*, unsigned long*, XtPointer, XtRequestId*);
  21067.       Widget w;
  21068.       Atom *selection;
  21069.       Atom *target;
  21070.       Atom *type_return;
  21071.       XtPointer *value_return;
  21072.       unsigned long *length_return;
  21073.       int *format_return;
  21074.       unsigned long *max_length;
  21075.       XtPointer client_data;
  21076.       XtRequestId *request_id;
  21077.  
  21078.  
  21079. w      Specifies the widget that currently owns this
  21080.       selection.
  21081.  
  21082. selection Specifies the atom that names the selection
  21083.       requested.
  21084.  
  21085. target      Specifies the type of information required about
  21086.       the selection.
  21087.  
  21088. type_return
  21089.       Specifies a pointer to an atom into which the
  21090.       property type of the converted value of the selec-
  21091.       tion is to be stored.
  21092.  
  21093. value_return
  21094.       Specifies a pointer into which a pointer to the
  21095.       converted value of the selection is to be stored.
  21096.       The selection owner is responsible for allocating
  21097.       this storage.
  21098.  
  21099. length_return
  21100.       Specifies a pointer into which the number of ele-
  21101.       ments in value_return, each of size indicated by
  21102.       format_return, is to be stored.
  21103.  
  21104. format_return
  21105.       Specifies a pointer into which the size in bits of
  21106.       the data elements of the selection value is to be
  21107.       stored so that the server may byte-swap the data
  21108.       if necessary.
  21109.  
  21110. max_length
  21111.       Specifies the maximum number of bytes which may be
  21112.       transferred at any one time.
  21113.  
  21114. client_data
  21115.  
  21116.  
  21117.  
  21118.                  310
  21119.  
  21120.  
  21121.  
  21122.  
  21123.  
  21124. X Toolkit Intrinsics                 X11 Release 6.4
  21125.  
  21126.  
  21127.       Specifies the value passed in by the widget when
  21128.       it took ownership of the selection.
  21129.  
  21130. request_id
  21131.       Specifies an opaque identification for a specific
  21132.       request.
  21133. |__
  21134.  
  21135. This procedure is called repeatedly by the Intrinsics selec-
  21136. tion mechanism to get the next incremental chunk of data
  21137. from a selection owner who has called
  21138. XtOwnSelectionIncremental.  It must return True if the pro-
  21139. cedure has succeeded in converting the selection data or
  21140. False otherwise.  On the first call with a particular
  21141. request id, the owner must begin a new incremental transfer
  21142. for the requested selection and target.  On subsequent calls
  21143. with the same request id, the owner may assume that the pre-
  21144. viously supplied value is no longer needed by the Intrin-
  21145. sics; that is, a fixed transfer area may be allocated and
  21146. returned in value_return for each segment to be transferred.
  21147. This procedure should store a non-NULL value in value_return
  21148. and zero in length_return to indicate that the entire selec-
  21149. tion has been delivered.  After returning this final seg-
  21150. ment, the request id may be reused by the Intrinsics to
  21151. begin a new transfer.
  21152.  
  21153. To retrieve the SelectionRequest event that triggered the
  21154. selection conversion procedure, use XtGetSelectionRequest,
  21155. described in Section 11.5.2.1.
  21156.  
  21157.  
  21158. The procedure pointer specified by the incremental selection
  21159. owner when it desires notification upon no longer having
  21160. ownership is of type XtLoseSelectionIncrProc.
  21161.  
  21162. __
  21163. |
  21164. typedef void (*XtLoseSelectionIncrProc)(Widget, Atom*, XtPointer);
  21165.       Widget w;
  21166.       Atom *selection;
  21167.       XtPointer client_data;
  21168.  
  21169.  
  21170. w      Specifies the widget that has lost the selection
  21171.       ownership.
  21172.  
  21173. selection Specifies the atom that names the selection.
  21174.  
  21175. client_data
  21176.       Specifies the value passed in by the widget when
  21177.       it took ownership of the selection.
  21178. |__
  21179.  
  21180. This procedure, which is optional, is called by the
  21181.  
  21182.  
  21183.  
  21184.                  311
  21185.  
  21186.  
  21187.  
  21188.  
  21189.  
  21190. X Toolkit Intrinsics                 X11 Release 6.4
  21191.  
  21192.  
  21193. Intrinsics to inform the selection owner that it no longer
  21194. owns the selection.
  21195.  
  21196.  
  21197. The procedure pointer specified by the incremental selection
  21198. owner when it desires notification of receipt of the data or
  21199. when it manages the storage containing the data is of type
  21200. XtSelectionDoneIncrProc.
  21201.  
  21202. __
  21203. |
  21204. typedef void (*XtSelectionDoneIncrProc)(Widget, Atom*, Atom*, XtRequestId*, XtPointer);
  21205.       Widget w;
  21206.       Atom *selection;
  21207.       Atom *target;
  21208.       XtRequestId *request_id;
  21209.       XtPointer client_data;
  21210.  
  21211.  
  21212. w      Specifies the widget that owns the selection.
  21213.  
  21214. selection Specifies the atom that names the selection being
  21215.       transferred.
  21216.  
  21217. target      Specifies the target type to which the conversion
  21218.       was done.
  21219.  
  21220. request_id
  21221.       Specifies an opaque identification for a specific
  21222.       request.
  21223.  
  21224. client_data
  21225.       Specified the value passed in by the widget when
  21226.       it took ownership of the selection.
  21227. |__
  21228.  
  21229. This procedure, which is optional, is called by the Intrin-
  21230. sics after the requestor has retrieved the final (zero-
  21231. length) segment of the incremental transfer to indicate that
  21232. the entire transfer is complete.  If this procedure is not
  21233. specified, the Intrinsics will free only the final value
  21234. returned by the selection owner using XtFree.
  21235.  
  21236.  
  21237. The procedure pointer specified by the incremental selection
  21238. owner to notify it if a transfer should be terminated prema-
  21239. turely is of type XtCancelConvertSelectionProc.
  21240.  
  21241.  
  21242.  
  21243.  
  21244.  
  21245.  
  21246.  
  21247.  
  21248.  
  21249.  
  21250.                  312
  21251.  
  21252.  
  21253.  
  21254.  
  21255.  
  21256. X Toolkit Intrinsics                 X11 Release 6.4
  21257.  
  21258. __
  21259. |
  21260. typedef void (*XtCancelConvertSelectionProc)(Widget, Atom*, Atom*, XtRequestId*, XtPointer);
  21261.       Widget w;
  21262.       Atom *selection;
  21263.       Atom *target;
  21264.       XtRequestId *request_id;
  21265.       XtPointer client_data;
  21266.  
  21267.  
  21268. w      Specifies the widget that owns the selection.
  21269.  
  21270. selection Specifies the atom that names the selection being
  21271.       transferred.
  21272.  
  21273. target      Specifies the target type to which the conversion
  21274.       was done.
  21275.  
  21276. request_id
  21277.       Specifies an opaque identification for a specific
  21278.       request.
  21279.  
  21280. client_data
  21281.       Specifies the value passed in by the widget when
  21282.       it took ownership of the selection.
  21283. |__
  21284.  
  21285. This procedure is called by the Intrinsics when it has been
  21286. determined by means of a timeout or other mechanism that any
  21287. remaining segments of the selection no longer need to be
  21288. transferred.  Upon receiving this callback, the selection
  21289. request is considered complete and the owner can free the
  21290. memory and any other resources that have been allocated for
  21291. the transfer.
  21292.  
  21293.  
  21294. 11.5.3.2.  Getting the Selection Value Incrementally
  21295.  
  21296. To obtain the value of the selection using incremental
  21297. transfers, use XtGetSelectionValueIncremental or
  21298. XtGetSelectionValuesIncremental.
  21299.  
  21300.  
  21301.  
  21302.  
  21303.  
  21304.  
  21305.  
  21306.  
  21307.  
  21308.  
  21309.  
  21310.  
  21311.  
  21312.  
  21313.  
  21314.  
  21315.  
  21316.                  313
  21317.  
  21318.  
  21319.  
  21320.  
  21321.  
  21322. X Toolkit Intrinsics                 X11 Release 6.4
  21323.  
  21324. __
  21325. |
  21326. void XtGetSelectionValueIncremental(w, selection, target, selection_callback, client_data, time)
  21327.       Widget w;
  21328.       Atom selection;
  21329.       Atom target;
  21330.       XtSelectionCallbackProc selection_callback;
  21331.       XtPointer client_data;
  21332.       Time time;
  21333.  
  21334.  
  21335. w      Specifies the widget making the request.  Must be
  21336.       of class Core or any subclass thereof.
  21337.  
  21338. selection Specifies the particular selection desired.
  21339.  
  21340. target      Specifies the type of information needed about the
  21341.       selection.
  21342.  
  21343. selection_callback
  21344.       Specifies the callback procedure to be called to
  21345.       receive each data segment.
  21346.  
  21347. client_data
  21348.       Specifies client-specific data to be passed to the
  21349.       specified callback procedure when it is invoked.
  21350.  
  21351. time      Specifies the timestamp that indicates when the
  21352.       selection request was initiated.  This should be
  21353.       the timestamp of the event that triggered this
  21354.       request; the value CurrentTime is not acceptable.
  21355. |__
  21356.  
  21357. The XtGetSelectionValueIncremental function is similar to
  21358. XtGetSelectionValue except that the selection_callback pro-
  21359. cedure will be called repeatedly upon delivery of multiple
  21360. segments of the selection value.  The end of the selection
  21361. value is indicated when selection_callback is called with a
  21362. non-NULL value of length zero, which must still be freed by
  21363. the client.  If the transfer of the selection is aborted in
  21364. the middle of a transfer (for example, because of a time-
  21365. out), the selection_callback procedure is called with a type
  21366. value equal to the symbolic constant XT_CONVERT_FAIL so that
  21367. the requestor can dispose of the partial selection value it
  21368. has collected up until that point.  Upon receiving
  21369. XT_CONVERT_FAIL, the requesting client must determine for
  21370. itself whether or not a partially completed data transfer is
  21371. meaningful.  For more information about selection, target,
  21372. and time, see Section 2.6 in the Inter-Client Communication
  21373. Conventions Manual.
  21374.  
  21375.  
  21376.  
  21377.  
  21378.  
  21379.  
  21380.  
  21381.  
  21382.                  314
  21383.  
  21384.  
  21385.  
  21386.  
  21387.  
  21388. X Toolkit Intrinsics                 X11 Release 6.4
  21389.  
  21390. __
  21391. |
  21392. void XtGetSelectionValuesIncremental(w, selection, targets, count, selection_callback, client_data, time)
  21393.       Widget w;
  21394.       Atom selection;
  21395.       Atom *targets;
  21396.       int count;
  21397.       XtSelectionCallbackProc selection_callback;
  21398.       XtPointer *client_data;
  21399.       Time time;
  21400.  
  21401.  
  21402. w      Specifies the widget making the request.  Must be
  21403.       of class Core or any subclass thereof.
  21404.  
  21405. selection Specifies the particular selection desired.
  21406.  
  21407. targets   Specifies the types of information needed about
  21408.       the selection.
  21409.  
  21410. count      Specifies the length of the targets and
  21411.       client_data lists.
  21412.  
  21413. selection_callback
  21414.       Specifies the callback procedure to be called to
  21415.       receive each selection value.
  21416.  
  21417. client_data
  21418.       Specifies a list of client data (one for each tar-
  21419.       get type) values that are passed to the callback
  21420.       procedure when it is invoked for the corresponding
  21421.       target.
  21422.  
  21423. time      Specifies the timestamp that indicates when the
  21424.       selection request was initiated.  This should be
  21425.       the timestamp of the event that triggered this
  21426.       request; the value CurrentTime is not acceptable.
  21427. |__
  21428.  
  21429. The XtGetSelectionValuesIncremental function is similar to
  21430. XtGetSelectionValueIncremental except that it takes a list
  21431. of targets and client data.  XtGetSelectionValuesIncremental
  21432. is equivalent to calling XtGetSelectionValueIncremental suc-
  21433. cessively for each target/client_data pair except that
  21434. XtGetSelectionValuesIncremental does guarantee that all the
  21435. conversions will use the same selection value because the
  21436. ownership of the selection cannot change in the middle of
  21437. the list, as would be possible when calling XtGetSelection-
  21438. ValueIncremental repeatedly.  For more information about
  21439. selection, target, and time, see Section 2.6 in the Inter-
  21440. Client Communication Conventions Manual.
  21441.  
  21442.  
  21443.  
  21444.  
  21445.  
  21446.  
  21447.  
  21448.                  315
  21449.  
  21450.  
  21451.  
  21452.  
  21453.  
  21454. X Toolkit Intrinsics                 X11 Release 6.4
  21455.  
  21456.  
  21457. 11.5.3.3.  Setting the Selection Owner for Incremental
  21458. Transfers
  21459.  
  21460. To set the selection owner when using incremental transfers,
  21461. use XtOwnSelectionIncremental.
  21462.  
  21463.  
  21464.  
  21465.  
  21466.  
  21467.  
  21468.  
  21469.  
  21470.  
  21471.  
  21472.  
  21473.  
  21474.  
  21475.  
  21476.  
  21477.  
  21478.  
  21479.  
  21480.  
  21481.  
  21482.  
  21483.  
  21484.  
  21485.  
  21486.  
  21487.  
  21488.  
  21489.  
  21490.  
  21491.  
  21492.  
  21493.  
  21494.  
  21495.  
  21496.  
  21497.  
  21498.  
  21499.  
  21500.  
  21501.  
  21502.  
  21503.  
  21504.  
  21505.  
  21506.  
  21507.  
  21508.  
  21509.  
  21510.  
  21511.  
  21512.  
  21513.  
  21514.                  316
  21515.  
  21516.  
  21517.  
  21518.  
  21519.  
  21520. X Toolkit Intrinsics                 X11 Release 6.4
  21521.  
  21522. __
  21523. |
  21524. Boolean XtOwnSelectionIncremental(w, selection, time, convert_callback, lose_callback,
  21525.                   done_callback, cancel_callback, client_data)
  21526.       Widget w;
  21527.       Atom selection;
  21528.       Time time;
  21529.       XtConvertSelectionIncrProc convert_callback;
  21530.       XtLoseSelectionIncrProc lose_callback;
  21531.       XtSelectionDoneIncrProc done_callback;
  21532.       XtCancelConvertSelectionProc cancel_callback;
  21533.       XtPointer client_data;
  21534.  
  21535.  
  21536. w        Specifies the widget that wishes to become the
  21537.         owner.  Must be of class Core or any subclass
  21538.         thereof.
  21539.  
  21540. selection   Specifies the atom that names the selection.
  21541.  
  21542. time        Specifies the timestamp that indicates when the
  21543.         selection ownership request was initiated.    This
  21544.         should be the timestamp of the event that trig-
  21545.         gered ownership; the value CurrentTime is not
  21546.         acceptable.
  21547.  
  21548. convert_callback
  21549.         Specifies the procedure to be called whenever
  21550.         the current value of the selection is requested.
  21551.  
  21552. lose_callback
  21553.         Specifies the procedure to be called whenever
  21554.         the widget has lost selection ownership, or NULL
  21555.         if the owner is not interested in being noti-
  21556.         fied.
  21557.  
  21558. done_callback
  21559.         Specifies the procedure called after the
  21560.         requestor has received the entire selection, or
  21561.         NULL if the owner is not interested in being
  21562.         notified.
  21563.  
  21564. cancel_callback
  21565.         Specifies the callback procedure to be called
  21566.         when a selection request aborts because a time-
  21567.         out expires, or NULL if the owner is not inter-
  21568.         ested in being notified.
  21569.  
  21570. client_data Specifies the argument to be passed to each of
  21571.         the callback procedures when they are called.
  21572. |__
  21573.  
  21574. The XtOwnSelectionIncremental procedure informs the Intrin-
  21575. sics incremental selection mechanism that the specified wid-
  21576. get wishes to own the selection.  It returns True if the
  21577.  
  21578.  
  21579.  
  21580.                  317
  21581.  
  21582.  
  21583.  
  21584.  
  21585.  
  21586. X Toolkit Intrinsics                 X11 Release 6.4
  21587.  
  21588.  
  21589. specified widget successfully becomes the selection owner or
  21590. False otherwise.  For more information about selection, tar-
  21591. get, and time, see Section 2.6 in the Inter-Client Communi-
  21592. cation Conventions Manual.
  21593.  
  21594. If a done_callback procedure is specified, the client owns
  21595. the storage allocated for passing the value to the Intrin-
  21596. sics.  If done_callback is NULL, the convert_callback proce-
  21597. dure must allocate storage using XtMalloc, XtRealloc, or
  21598. XtCalloc, and the final value specified is freed by the
  21599. Intrinsics when the transfer is complete.  After a selection
  21600. transfer has started, only one of the done_callback or can-
  21601. cel_callback procedures is invoked to indicate completion of
  21602. the transfer.
  21603.  
  21604. The lose_callback procedure does not indicate completion of
  21605. any in-progress transfers; it is invoked at the time a
  21606. SelectionClear event is dispatched regardless of any active
  21607. transfers, which are still expected to continue.
  21608.  
  21609. A widget that becomes the selection owner using XtOwnSelec-
  21610. tionIncremental may use XtDisownSelection to relinquish
  21611. selection ownership.
  21612.  
  21613.  
  21614. 11.5.4.  Setting and Retrieving Selection Target Parameters
  21615.  
  21616. To specify target parameters for a selection request with a
  21617. single target, use XtSetSelectionParameters.
  21618.  
  21619.  
  21620.  
  21621.  
  21622.  
  21623.  
  21624.  
  21625.  
  21626.  
  21627.  
  21628.  
  21629.  
  21630.  
  21631.  
  21632.  
  21633.  
  21634.  
  21635.  
  21636.  
  21637.  
  21638.  
  21639.  
  21640.  
  21641.  
  21642.  
  21643.  
  21644.  
  21645.  
  21646.                  318
  21647.  
  21648.  
  21649.  
  21650.  
  21651.  
  21652. X Toolkit Intrinsics                 X11 Release 6.4
  21653.  
  21654. __
  21655. |
  21656. void XtSetSelectionParameters(requestor, selection, type, value, length, format)
  21657.       Widget requestor;
  21658.       Atom selection;
  21659.       Atom type;
  21660.       XtPointer value;
  21661.       unsigned long length;
  21662.       int format;
  21663.  
  21664.  
  21665. requestor Specifies the widget making the request.  Must be
  21666.       of class Core or any subclass thereof.
  21667.  
  21668. selection Specifies the atom that names the selection.
  21669.  
  21670. type      Specifies the type of the property in which the
  21671.       parameters are passed.
  21672.  
  21673. value      Specifies a pointer to the parameters.
  21674.  
  21675. length      Specifies the number of elements containing data
  21676.       in value, each element of a size indicated by for-
  21677.       mat.
  21678.  
  21679. format      Specifies the size in bits of the data in the ele-
  21680.       ments of value.
  21681.  
  21682. The specified parameters are copied and stored in a new
  21683. property of the specified type and format on the requestor's
  21684. window.  To initiate a selection request with a target and
  21685. these parameters, a subsequent call to XtGetSelectionValue
  21686. or to XtGetSelectionValueIncremental specifying the same
  21687. requestor widget and selection atom will generate a Convert-
  21688. Selection request referring to the property containing the
  21689. parameters.  If XtSetSelectionParameters is called more than
  21690. once with the same widget and selection without a call to
  21691. specify a request, the most recently specified parameters
  21692. are used in the subsequent request.
  21693. |__
  21694.  
  21695. The possible values of format are 8, 16, or 32.  If the for-
  21696. mat is 8, the elements of value are assumed to be
  21697. sizeof(char); if 16, sizeof(short); if 32, sizeof(long).
  21698.  
  21699. To generate a MULTIPLE target request with parameters for
  21700. any of the multiple targets of the selection request, pre-
  21701. cede individual calls to XtGetSelectionValue and XtGetSelec-
  21702. tionValueIncremental with corresponding individual calls to
  21703. XtSetSelectionParameters, and enclose these all within
  21704. XtCreateSelectionRequest and XtSendSelectionRequest. XtGetS-
  21705. electionValues and XtGetSelectionValuesIncremental cannot be
  21706. used to make selection requests with parameterized targets.
  21707.  
  21708.  
  21709.  
  21710.  
  21711.  
  21712.                  319
  21713.  
  21714.  
  21715.  
  21716.  
  21717.  
  21718. X Toolkit Intrinsics                 X11 Release 6.4
  21719.  
  21720.  
  21721. To retrieve any target parameters needed to perform a selec-
  21722. tion conversion, the selection owner calls
  21723. XtGetSelectionParameters.
  21724.  
  21725. __
  21726. |
  21727. void XtGetSelectionParameters(owner, selection, request_id, type_return, value_return,
  21728.                          length_return, format_return)
  21729.       Widget owner;
  21730.       Atom selection;
  21731.       XtRequestId request_id;
  21732.       Atom *type_return;
  21733.       XtPointer *value_return;
  21734.       unsigned long *length_return;
  21735.       int *format_return;
  21736.  
  21737.  
  21738. owner      Specifies the widget that owns the specified
  21739.       selection.
  21740.  
  21741. selection Specifies the selection being processed.
  21742.  
  21743. request_id
  21744.       Specifies the requestor id in the case of incre-
  21745.       mental selections, or NULL in the case of atomic
  21746.       transfers.
  21747.  
  21748. type_return
  21749.       Specifies a pointer to an atom in which the prop-
  21750.       erty type of the parameters is stored.
  21751.  
  21752. value_return
  21753.       Specifies a pointer into which a pointer to the
  21754.       parameters is to be stored.  A NULL is stored if
  21755.       no parameters accompany the request.
  21756.  
  21757. length_return
  21758.       Specifies a pointer into which the number of data
  21759.       elements in value_return of size indicated by for-
  21760.       mat_return are stored.
  21761.  
  21762. format_return
  21763.       Specifies a pointer into which the size in bits of
  21764.       the parameter data in the elements of value is
  21765.       stored.
  21766. |__
  21767.  
  21768. XtGetSelectionParameters may be called only from within an
  21769. XtConvertSelectionProc or from within the first call to an
  21770. XtConvertSelectionIncrProc with a new request_id.
  21771.  
  21772. It is the responsibility of the caller to free the returned
  21773. parameters using XtFree when the parameters are no longer
  21774. needed.
  21775.  
  21776.  
  21777.  
  21778.                  320
  21779.  
  21780.  
  21781.  
  21782.  
  21783.  
  21784. X Toolkit Intrinsics                 X11 Release 6.4
  21785.  
  21786.  
  21787. 11.5.5.  Generating MULTIPLE Requests
  21788.  
  21789. To have the Intrinsics bundle multiple calls to make selec-
  21790. tion requests into a single request using a MULTIPLE target,
  21791. use XtCreateSelectionRequest and XtSendSelectionRequest.
  21792.  
  21793. __
  21794. |
  21795. void XtCreateSelectionRequest(requestor, selection)
  21796.       Widget requestor;
  21797.       Atom selection;
  21798.  
  21799.  
  21800. requestor Specifies the widget making the request.  Must be
  21801.       of class Core or any subclass thereof.
  21802.  
  21803. selection Specifies the particular selection desired.
  21804. |__
  21805.  
  21806. When XtCreateSelectionRequest is called, subsequent calls to
  21807. XtGetSelectionValue, XtGetSelectionValueIncremental,
  21808. XtGetSelectionValues, and XtGetSelectionValuesIncremental,
  21809. with the requestor and selection as specified to
  21810. XtCreateSelectionRequest, are bundled into a single selec-
  21811. tion request with multiple targets.  The request is made by
  21812. calling XtSendSelectionRequest.
  21813.  
  21814. __
  21815. |
  21816. void XtSendSelectionRequest(requestor, selection, time)
  21817.       Widget requestor;
  21818.       Atom selection;
  21819.       Time time;
  21820.  
  21821.  
  21822. requestor Specifies the widget making the request.  Must be
  21823.       of class Core or any subclass thereof.
  21824.  
  21825. selection Specifies the particular selection desired.
  21826.  
  21827. time      Specifies the timestamp that indicates when the
  21828.       selection request was initiated.  The value Cur-
  21829.       rentTime is not acceptable.
  21830. |__
  21831.  
  21832. When XtSendSelectionRequest is called with a value of
  21833. requestor and selection matching a previous call to
  21834. XtCreateSelectionRequest, a selection request is sent to the
  21835. selection owner.  If a single target request is queued, that
  21836. request is made.  If multiple targets are queued, they are
  21837. bundled into a single request with a target of MULTIPLE
  21838. using the specified timestamp.    As the values are returned,
  21839. the callbacks specified in XtGetSelectionValue,
  21840. XtGetSelectionValueIncremental, XtGetSelectionValues, and
  21841.  
  21842.  
  21843.  
  21844.                  321
  21845.  
  21846.  
  21847.  
  21848.  
  21849.  
  21850. X Toolkit Intrinsics                 X11 Release 6.4
  21851.  
  21852.  
  21853. XtGetSelectionValueIncremental are invoked.
  21854.  
  21855. Multi-threaded applications should lock the application con-
  21856. text before calling XtCreateSelectionRequest and release the
  21857. lock after calling XtSendSelectionRequest to ensure that the
  21858. thread assembling the request is safe from interference by
  21859. another thread assembling a different request naming the
  21860. same widget and selection.
  21861.  
  21862.  
  21863. To relinquish the composition of a MULTIPLE request without
  21864. sending it, use XtCancelSelectionRequest.
  21865.  
  21866. __
  21867. |
  21868. void XtCancelSelectionRequest(requestor, selection)
  21869.       Widget requestor;
  21870.       Atom selection;
  21871.  
  21872.  
  21873. requestor Specifies the widget making the request.  Must be
  21874.       of class Core or any subclass thereof.
  21875.  
  21876. selection Specifies the particular selection desired.
  21877. |__
  21878.  
  21879. When XtCancelSelectionRequest is called, any requests queued
  21880. since the last call to XtCreateSelectionRequest for the same
  21881. widget and selection are discarded and any resources
  21882. reserved are released.    A subsequent call to XtSendSelec-
  21883. tionRequest will not result in any request being made.    Sub-
  21884. sequent calls to XtGetSelectionValue, XtGetSelectionValues,
  21885. XtGetSelectionValueIncremental, or XtGetSelectionValuesIn-
  21886. cremental will not be deferred.
  21887.  
  21888.  
  21889. 11.5.6.  Auxiliary Selection Properties
  21890.  
  21891. Certain uses of parameterized selections require clients to
  21892. name other window properties within a selection parameter.
  21893. To permit reuse of temporary property names in these circum-
  21894. stances and thereby reduce the number of unique atoms cre-
  21895. ated in the server, the Intrinsics provides two interfaces
  21896. for acquiring temporary property names.
  21897.  
  21898. To acquire a temporary property name atom for use in a
  21899. selection request, the client may call
  21900. XtReservePropertyAtom.
  21901.  
  21902.  
  21903.  
  21904.  
  21905.  
  21906.  
  21907.  
  21908.  
  21909.  
  21910.                  322
  21911.  
  21912.  
  21913.  
  21914.  
  21915.  
  21916. X Toolkit Intrinsics                 X11 Release 6.4
  21917.  
  21918. __
  21919. |
  21920. Atom XtReservePropertyAtom(w)
  21921.       Widget w;
  21922.  
  21923.  
  21924. w      Specifies the widget making a selection request.
  21925. |__
  21926.  
  21927. XtReservePropertyAtom returns an atom that may be used as a
  21928. property name during selection requests involving the speci-
  21929. fied widget.  As long as the atom remains reserved, it is
  21930. unique with respect to all other reserved atoms for the wid-
  21931. get.
  21932.  
  21933. To return a temporary property name atom for reuse and to
  21934. delete the property named by that atom, use
  21935. XtReleasePropertyAtom.
  21936.  
  21937. __
  21938. |
  21939. void XtReleasePropertyAtom(w, atom)
  21940.       Widget w;
  21941.       Atom atom;
  21942.  
  21943.  
  21944. w      Specifies the widget used to reserve the property
  21945.       name atom.
  21946.  
  21947. atom      Specifies the property name atom returned by XtRe-
  21948.       servePropertyAtom that is to be released for
  21949.       reuse.
  21950. |__
  21951.  
  21952. XtReleasePropertyAtom marks the specified property name atom
  21953. as no longer in use and ensures that any property having
  21954. that name on the specified widget's window is deleted.    If
  21955. atom does not specify a value returned by XtReserveProperty-
  21956. Atom for the specified widget, the results are undefined.
  21957.  
  21958.  
  21959. 11.5.7.  Retrieving the Most Recent Timestamp
  21960.  
  21961. To retrieve the timestamp from the most recent call to
  21962. XtDispatchEvent that contained a timestamp, use
  21963. XtLastTimestampProcessed.
  21964.  
  21965.  
  21966.  
  21967.  
  21968.  
  21969.  
  21970.  
  21971.  
  21972.  
  21973.  
  21974.  
  21975.  
  21976.                  323
  21977.  
  21978.  
  21979.  
  21980.  
  21981.  
  21982. X Toolkit Intrinsics                 X11 Release 6.4
  21983.  
  21984. __
  21985. |
  21986. Time XtLastTimestampProcessed(display)
  21987.       Display *display;
  21988.  
  21989.  
  21990. display   Specifies an open display connection.
  21991. |__
  21992.  
  21993. If no KeyPress, KeyRelease, ButtonPress, ButtonRelease,
  21994. MotionNotify, EnterNotify, LeaveNotify, PropertyNotify, or
  21995. SelectionClear event has yet been passed to XtDispatchEvent
  21996. for the specified display, XtLastTimestampProcessed returns
  21997. zero.
  21998.  
  21999.  
  22000. 11.5.8.  Retrieving the Most Recent Event
  22001.  
  22002. To retrieve the event from the most recent call to XtDis-
  22003. patchEvent for a specific display, use XtLastEventProcessed.
  22004.  
  22005. __
  22006. |
  22007. XEvent *XtLastEventProcessed(display)
  22008.       Display *display;
  22009.  
  22010.  
  22011. display   Specifies the display connection from which to
  22012.       retrieve the event.
  22013. |__
  22014.  
  22015. Returns the last event passed to XtDispatchEvent for the
  22016. specified display.  Returns NULL if there is no such event.
  22017. The client must not modify the contents of the returned
  22018. event.
  22019.  
  22020.  
  22021. 11.6.  Merging Exposure Events into a Region
  22022.  
  22023. The Intrinsics provide an XtAddExposureToRegion utility
  22024. function that merges Expose and GraphicsExpose events into a
  22025. region for clients to process at once rather than processing
  22026. individual rectangles.    For further information about
  22027. regions, see Section 16.5 in Xlib -- C Language X Interface.
  22028.  
  22029.  
  22030. To merge Expose and GraphicsExpose events into a region, use
  22031. XtAddExposureToRegion.
  22032.  
  22033.  
  22034.  
  22035.  
  22036.  
  22037.  
  22038.  
  22039.  
  22040.  
  22041.  
  22042.                  324
  22043.  
  22044.  
  22045.  
  22046.  
  22047.  
  22048. X Toolkit Intrinsics                 X11 Release 6.4
  22049.  
  22050. __
  22051. |
  22052. void XtAddExposureToRegion(event, region)
  22053.      XEvent *event;
  22054.      Region region;
  22055.  
  22056.  
  22057. event      Specifies a pointer to the Expose or GraphicsEx-
  22058.       pose event.
  22059.  
  22060. region      Specifies the region object (as defined in
  22061.       <X11/Xutil.h>).
  22062. |__
  22063.  
  22064. The XtAddExposureToRegion function computes the union of the
  22065. rectangle defined by the exposure event and the specified
  22066. region.  Then it stores the results back in region.  If the
  22067. event argument is not an Expose or GraphicsExpose event,
  22068. XtAddExposureToRegion returns without an error and without
  22069. modifying region.
  22070.  
  22071. This function is used by the exposure compression mechanism;
  22072. see Section 7.9.3.
  22073.  
  22074.  
  22075. 11.7.  Translating Widget Coordinates
  22076.  
  22077. To translate an x-y coordinate pair from widget coordinates
  22078. to root window absolute coordinates, use XtTranslateCoords.
  22079.  
  22080. __
  22081. |
  22082. void XtTranslateCoords(w, x, y, rootx_return, rooty_return)
  22083.       Widget w;
  22084.       Position x, y;
  22085.       Position *rootx_return, *rooty_return;
  22086.  
  22087.  
  22088. w      Specifies the widget.  Must be of class RectObj or
  22089.       any subclass thereof.
  22090.  
  22091. x
  22092.  
  22093. y      Specify the widget-relative x and y coordinates.
  22094.  
  22095. rootx_return
  22096.  
  22097. rooty_return
  22098.       Return the root-relative x and y coordinates.
  22099. |__
  22100.  
  22101. While XtTranslateCoords is similar to the Xlib XTranslateCo-
  22102. ordinates function, it does not generate a server request
  22103. because all the required information already is in the wid-
  22104. get's data structures.
  22105.  
  22106.  
  22107.  
  22108.                  325
  22109.  
  22110.  
  22111.  
  22112.  
  22113.  
  22114. X Toolkit Intrinsics                 X11 Release 6.4
  22115.  
  22116.  
  22117. 11.8.  Translating a Window to a Widget
  22118.  
  22119. To translate a given window and display pointer into a wid-
  22120. get instance, use XtWindowToWidget.
  22121.  
  22122. __
  22123. |
  22124. Widget XtWindowToWidget(display, window)
  22125.       Display *display;
  22126.       Window window;
  22127.  
  22128.  
  22129. display   Specifies the display on which the window is
  22130.       defined.
  22131.  
  22132. window      Specifies the drawable for which you want the wid-
  22133.       get.
  22134. |__
  22135.  
  22136. If there is a realized widget whose window is the specified
  22137. drawable on the specified display, XtWindowToWidget returns
  22138. that widget.  If not and if the drawable has been associated
  22139. with a widget through XtRegisterDrawable, XtWindowToWidget
  22140. returns the widget associated with the drawable.  In other
  22141. cases it returns NULL.
  22142.  
  22143.  
  22144. 11.9.  Handling Errors
  22145.  
  22146. The Intrinsics allow a client to register procedures that
  22147. are called whenever a fatal or nonfatal error occurs.  These
  22148. facilities are intended for both error reporting and logging
  22149. and for error correction or recovery.
  22150.  
  22151. Two levels of interface are provided:
  22152.  
  22153. o    A high-level interface that takes an error name and
  22154.      class and retrieves the error message text from an
  22155.      error resource database.
  22156.  
  22157. o    A low-level interface that takes a simple string to
  22158.      display.
  22159.  
  22160. The high-level functions construct a string to pass to the
  22161. lower-level interface.    The strings may be specified in
  22162. application code and are overridden by the contents of an
  22163. external systemwide file, the ``error database file''.    The
  22164. location and name of this file are implementation-dependent.
  22165.  
  22166.  
  22167.  
  22168.  
  22169.  
  22170.  
  22171.  
  22172.  
  22173.  
  22174.                  326
  22175.  
  22176.  
  22177.  
  22178.  
  22179.  
  22180. X Toolkit Intrinsics                 X11 Release 6.4
  22181.  
  22182.  
  22183.                 Note
  22184.  
  22185.      The application-context-specific error handling is
  22186.      not implemented on many systems, although the
  22187.      interfaces are always present.  Most implementa-
  22188.      tions will have just one set of error handlers for
  22189.      all application contexts within a process.  If
  22190.      they are set for different application contexts,
  22191.      the ones registered last will prevail.
  22192.  
  22193.  
  22194.  
  22195. To obtain the error database (for example, to merge with an
  22196. application- or widget-specific database), use
  22197. XtAppGetErrorDatabase.
  22198.  
  22199. __
  22200. |
  22201. XrmDatabase *XtAppGetErrorDatabase(app_context)
  22202.      XtAppContext app_context;
  22203.  
  22204.  
  22205. app_context
  22206.       Specifies the application context.
  22207. |__
  22208.  
  22209. The XtAppGetErrorDatabase function returns the address of
  22210. the error database.  The Intrinsics do a lazy binding of the
  22211. error database and do not merge in the database file until
  22212. the first call to XtAppGetErrorDatabaseText.
  22213.  
  22214. For a complete listing of all errors and warnings that can
  22215. be generated by the Intrinsics, see Appendix D.
  22216.  
  22217.  
  22218. The high-level error and warning handler procedure pointers
  22219. are of type XtErrorMsgHandler.
  22220.  
  22221.  
  22222.  
  22223.  
  22224.  
  22225.  
  22226.  
  22227.  
  22228.  
  22229.  
  22230.  
  22231.  
  22232.  
  22233.  
  22234.  
  22235.  
  22236.  
  22237.  
  22238.  
  22239.  
  22240.                  327
  22241.  
  22242.  
  22243.  
  22244.  
  22245.  
  22246. X Toolkit Intrinsics                 X11 Release 6.4
  22247.  
  22248. __
  22249. |
  22250. typedef void (*XtErrorMsgHandler)(String, String, String, String, String*, Cardinal*);
  22251.     String name;
  22252.     String type;
  22253.     String class;
  22254.     String defaultp;
  22255.     String *params;
  22256.     Cardinal *num_params;
  22257.  
  22258.  
  22259. name      Specifies the name to be concatenated with the
  22260.       specified type to form the resource name of the
  22261.       error message.
  22262.  
  22263. type      Specifies the type to be concatenated with the
  22264.       name to form the resource name of the error mes-
  22265.       sage.
  22266.  
  22267. class      Specifies the resource class of the error message.
  22268.  
  22269. defaultp  Specifies the default message to use if no error
  22270.       database entry is found.
  22271.  
  22272. params      Specifies a pointer to a list of parameters to be
  22273.       substituted in the message.
  22274.  
  22275. num_params
  22276.       Specifies the number of entries in params.
  22277. |__
  22278.  
  22279. The specified name can be a general kind of error, like
  22280. ``invalidParameters'' or ``invalidWindow'', and the speci-
  22281. fied type gives extra information such as the name of the
  22282. routine in which the error was detected.  Standard printf
  22283. notation is used to substitute the parameters into the mes-
  22284. sage.
  22285.  
  22286.  
  22287. An error message handler can obtain the error database text
  22288. for an error or a warning by calling
  22289. XtAppGetErrorDatabaseText.
  22290.  
  22291.  
  22292.  
  22293.  
  22294.  
  22295.  
  22296.  
  22297.  
  22298.  
  22299.  
  22300.  
  22301.  
  22302.  
  22303.  
  22304.  
  22305.  
  22306.                  328
  22307.  
  22308.  
  22309.  
  22310.  
  22311.  
  22312. X Toolkit Intrinsics                 X11 Release 6.4
  22313.  
  22314. __
  22315. |
  22316. void XtAppGetErrorDatabaseText(app_context, name, type, class, default, buffer_return, nbytes, database)
  22317.       XtAppContext app_context;
  22318.       String name, type, class;
  22319.       String default;
  22320.       String buffer_return;
  22321.       int nbytes;
  22322.       XrmDatabase database;
  22323.  
  22324.  
  22325. app_context
  22326.       Specifies the application context.
  22327.  
  22328. name
  22329.  
  22330. type      Specify the name and type concatenated to form the
  22331.       resource name of the error message.
  22332.  
  22333. class      Specifies the resource class of the error message.
  22334.  
  22335. default   Specifies the default message to use if an error
  22336.       database entry is not found.
  22337.  
  22338. buffer_return
  22339.       Specifies the buffer into which the error message
  22340.       is to be returned.
  22341.  
  22342. nbytes      Specifies the size of the buffer in bytes.
  22343.  
  22344. database  Specifies the name of the alternative database to
  22345.       be used, or NULL if the application context's
  22346.       error database is to be used.
  22347. |__
  22348.  
  22349. The XtAppGetErrorDatabaseText returns the appropriate mes-
  22350. sage from the error database or returns the specified
  22351. default message if one is not found in the error database.
  22352. To form the full resource name and class when querying the
  22353. database, the name and type are concatenated with a single
  22354. ``.''  between them and the class is concatenated with
  22355. itself with a single ``.'' if it does not already contain a
  22356. ``.''.
  22357.  
  22358.  
  22359. To return the application name and class as passed to XtDis-
  22360. playInitialize for a particular Display, use
  22361. XtGetApplicationNameAndClass.
  22362.  
  22363.  
  22364.  
  22365.  
  22366.  
  22367.  
  22368.  
  22369.  
  22370.  
  22371.  
  22372.                  329
  22373.  
  22374.  
  22375.  
  22376.  
  22377.  
  22378. X Toolkit Intrinsics                 X11 Release 6.4
  22379.  
  22380. __
  22381. |
  22382. void XtGetApplicationNameAndClass(display, name_return, class_return)
  22383.       Display* display;
  22384.       String* name_return;
  22385.       String* class_return;
  22386.  
  22387.  
  22388. display   Specifies an open display connection that has been
  22389.       initialized with XtDisplayInitialize.
  22390.  
  22391. name_return
  22392.       Returns the application name.
  22393.  
  22394. class_return
  22395.       Returns the application class.
  22396. |__
  22397.  
  22398. XtGetApplicationNameAndClass returns the application name
  22399. and class passed to XtDisplayInitialize for the specified
  22400. display.  If the display was never initialized or has been
  22401. closed, the result is undefined.  The returned strings are
  22402. owned by the Intrinsics and must not be modified or freed by
  22403. the caller.
  22404.  
  22405.  
  22406. To register a procedure to be called on fatal error condi-
  22407. tions, use XtAppSetErrorMsgHandler.
  22408.  
  22409. __
  22410. |
  22411. XtErrorMsgHandler XtAppSetErrorMsgHandler(app_context, msg_handler)
  22412.       XtAppContext app_context;
  22413.       XtErrorMsgHandler msg_handler;
  22414.  
  22415.  
  22416. app_context
  22417.       Specifies the application context.
  22418.  
  22419. msg_handler
  22420.       Specifies the new fatal error procedure, which
  22421.       should not return.
  22422. |__
  22423.  
  22424. XtAppSetErrorMsgHandler returns a pointer to the previously
  22425. installed high-level fatal error handler.  The default high-
  22426. level fatal error handler provided by the Intrinsics is
  22427. named _XtDefaultErrorMsg and constructs a string from the
  22428. error resource database and calls XtError.  Fatal error mes-
  22429. sage handlers should not return.  If one does, subsequent
  22430. Intrinsics behavior is undefined.
  22431.  
  22432.  
  22433. To call the high-level error handler, use XtAppErrorMsg.
  22434.  
  22435.  
  22436.  
  22437.  
  22438.                  330
  22439.  
  22440.  
  22441.  
  22442.  
  22443.  
  22444. X Toolkit Intrinsics                 X11 Release 6.4
  22445.  
  22446. __
  22447. |
  22448. void XtAppErrorMsg(app_context, name, type, class, default,  params, num_params)
  22449.       XtAppContext app_context;
  22450.       String name;
  22451.       String type;
  22452.       String class;
  22453.       String default;
  22454.       String *params;
  22455.       Cardinal *num_params;
  22456.  
  22457.  
  22458. app_context
  22459.       Specifies the application context.
  22460.  
  22461. name      Specifies the general kind of error.
  22462.  
  22463. type      Specifies the detailed name of the error.
  22464.  
  22465. class      Specifies the resource class.
  22466.  
  22467. default   Specifies the default message to use if an error
  22468.       database entry is not found.
  22469.  
  22470. params      Specifies a pointer to a list of values to be
  22471.       stored in the message.
  22472.  
  22473. num_params
  22474.       Specifies the number of entries in params.
  22475. |__
  22476.  
  22477. The Intrinsics internal errors all have class ``XtToolkitEr-
  22478. ror''.
  22479.  
  22480.  
  22481. To register a procedure to be called on nonfatal error con-
  22482. ditions, use XtAppSetWarningMsgHandler.
  22483.  
  22484. __
  22485. |
  22486. XtErrorMsgHandler XtAppSetWarningMsgHandler(app_context, msg_handler)
  22487.       XtAppContext app_context;
  22488.       XtErrorMsgHandler msg_handler;
  22489.  
  22490.  
  22491. app_context
  22492.       Specifies the application context.
  22493.  
  22494. msg_handler
  22495.       Specifies the new nonfatal error procedure, which
  22496.       usually returns.
  22497. |__
  22498.  
  22499. XtAppSetWarningMsgHandler returns a pointer to the previ-
  22500. ously installed high-level warning handler.  The default
  22501.  
  22502.  
  22503.  
  22504.                  331
  22505.  
  22506.  
  22507.  
  22508.  
  22509.  
  22510. X Toolkit Intrinsics                 X11 Release 6.4
  22511.  
  22512.  
  22513. high-level warning handler provided by the Intrinsics is
  22514. named _XtDefaultWarningMsg and constructs a string from the
  22515. error resource database and calls XtWarning.
  22516.  
  22517.  
  22518. To call the installed high-level warning handler, use
  22519. XtAppWarningMsg.
  22520.  
  22521. __
  22522. |
  22523. void XtAppWarningMsg(app_context, name, type, class, default, params, num_params)
  22524.       XtAppContext app_context;
  22525.       String name;
  22526.       String type;
  22527.       String class;
  22528.       String default;
  22529.       String *params;
  22530.       Cardinal *num_params;
  22531.  
  22532.  
  22533. app_context
  22534.       Specifies the application context.
  22535.  
  22536. name      Specifies the general kind of error.
  22537.  
  22538. type      Specifies the detailed name of the error.
  22539.  
  22540. class      Specifies the resource class.
  22541.  
  22542. default   Specifies the default message to use if an error
  22543.       database entry is not found.
  22544.  
  22545. params      Specifies a pointer to a list of values to be
  22546.       stored in the message.
  22547.  
  22548. num_params
  22549.       Specifies the number of entries in params.
  22550. |__
  22551.  
  22552. The Intrinsics internal warnings all have class
  22553. ``XtToolkitError''.
  22554.  
  22555.  
  22556. The low-level error and warning handler procedure pointers
  22557. are of type XtErrorHandler.
  22558.  
  22559.  
  22560.  
  22561.  
  22562.  
  22563.  
  22564.  
  22565.  
  22566.  
  22567.  
  22568.  
  22569.  
  22570.                  332
  22571.  
  22572.  
  22573.  
  22574.  
  22575.  
  22576. X Toolkit Intrinsics                 X11 Release 6.4
  22577.  
  22578. __
  22579. |
  22580. typedef void (*XtErrorHandler)(String);
  22581.       String message;
  22582.  
  22583.  
  22584. message   Specifies the error message.
  22585. |__
  22586.  
  22587. The error handler should display the message string in some
  22588. appropriate fashion.
  22589.  
  22590.  
  22591. To register a procedure to be called on fatal error condi-
  22592. tions, use XtAppSetErrorHandler.
  22593.  
  22594. __
  22595. |
  22596. XtErrorHandler XtAppSetErrorHandler(app_context, handler)
  22597.       XtAppContext app_context;
  22598.       XtErrorHandler handler;
  22599.  
  22600.  
  22601. app_context
  22602.       Specifies the application context.
  22603.  
  22604. handler   Specifies the new fatal error procedure, which
  22605.       should not return.
  22606. |__
  22607.  
  22608. XtAppSetErrorHandler returns a pointer to the previously
  22609. installed low-level fatal error handler.  The default low-
  22610. level error handler provided by the Intrinsics is
  22611. _XtDefaultError.  On POSIX-based systems, it prints the mes-
  22612. sage to standard error and terminates the application.
  22613. Fatal error message handlers should not return.  If one
  22614. does, subsequent Intrinsics behavior is undefined.
  22615.  
  22616.  
  22617. To call the installed fatal error procedure, use XtAppError.
  22618.  
  22619. __
  22620. |
  22621. void XtAppError(app_context, message)
  22622.       XtAppContext app_context;
  22623.       String message;
  22624.  
  22625.  
  22626. app_context
  22627.       Specifies the application context.
  22628.  
  22629. message   Specifies the message to be reported.
  22630. |__
  22631.  
  22632. Most programs should use XtAppErrorMsg, not XtAppError, to
  22633.  
  22634.  
  22635.  
  22636.                  333
  22637.  
  22638.  
  22639.  
  22640.  
  22641.  
  22642. X Toolkit Intrinsics                 X11 Release 6.4
  22643.  
  22644.  
  22645. provide for customization and internationalization of error
  22646. messages.
  22647.  
  22648.  
  22649. To register a procedure to be called on nonfatal error con-
  22650. ditions, use XtAppSetWarningHandler.
  22651.  
  22652. __
  22653. |
  22654. XtErrorHandler XtAppSetWarningHandler(app_context, handler)
  22655.       XtAppContext app_context;
  22656.       XtErrorHandler handler;
  22657.  
  22658.  
  22659. app_context
  22660.       Specifies the application context.
  22661.  
  22662. handler   Specifies the new nonfatal error procedure, which
  22663.       usually returns.
  22664. |__
  22665.  
  22666. XtAppSetWarningHandler returns a pointer to the previously
  22667. installed low-level warning handler.  The default low-level
  22668. warning handler provided by the Intrinsics is
  22669. _XtDefaultWarning.  On POSIX-based systems, it prints the
  22670. message to standard error and returns to the caller.
  22671.  
  22672.  
  22673. To call the installed nonfatal error procedure, use
  22674. XtAppWarning.
  22675.  
  22676. __
  22677. |
  22678. void XtAppWarning(app_context, message)
  22679.       XtAppContext app_context;
  22680.       String message;
  22681.  
  22682.  
  22683. app_context
  22684.       Specifies the application context.
  22685.  
  22686. message   Specifies the nonfatal error message to be
  22687.       reported.
  22688. |__
  22689.  
  22690. Most programs should use XtAppWarningMsg, not XtAppWarning,
  22691. to provide for customization and internationalization of
  22692. warning messages.
  22693.  
  22694.  
  22695. 11.10.    Setting WM_COLORMAP_WINDOWS
  22696.  
  22697. A client may set the value of the WM_COLORMAP_WINDOWS prop-
  22698. erty on a widget's window by calling XtSetWMColormapWindows.
  22699.  
  22700.  
  22701.  
  22702.                  334
  22703.  
  22704.  
  22705.  
  22706.  
  22707.  
  22708. X Toolkit Intrinsics                 X11 Release 6.4
  22709.  
  22710. __
  22711. |
  22712. void XtSetWMColormapWindows(widget, list, count)
  22713.       Widget widget;
  22714.       Widget* list;
  22715.       Cardinal count;
  22716.  
  22717.  
  22718. widget      Specifies the widget on whose window the WM_COL-
  22719.       ORMAP_WINDOWS property is stored.  Must be of
  22720.       class Core or any subclass thereof.
  22721.  
  22722. list      Specifies a list of widgets whose windows are
  22723.       potentially to be listed in the WM_COLORMAP_WIN-
  22724.       DOWS property.
  22725.  
  22726. count      Specifies the number of widgets in list.
  22727. |__
  22728.  
  22729. XtSetWMColormapWindows returns immediately if widget is not
  22730. realized or if count is 0.  Otherwise, XtSetWMColormapWin-
  22731. dows constructs an ordered list of windows by examining each
  22732. widget in list in turn and ignoring the widget if it is not
  22733. realized, or adding the widget's window to the window list
  22734. if the widget is realized and if its colormap resource is
  22735. different from the colormap resources of all widgets whose
  22736. windows are already on the window list.
  22737.  
  22738. Finally, XtSetWMColormapWindows stores the resulting window
  22739. list in the WM_COLORMAP_WINDOWS property on the specified
  22740. widget's window.  Refer to Section 4.1.8 in the Inter-Client
  22741. Communication Conventions Manual for details of the seman-
  22742. tics of the WM_COLORMAP_WINDOWS property.
  22743.  
  22744.  
  22745. 11.11.    Finding File Names
  22746.  
  22747. The Intrinsics provide procedures to look for a file by
  22748. name, allowing string substitutions in a list of file speci-
  22749. fications.  Two routines are provided for this: XtFindFile
  22750. and XtResolvePathname.    XtFindFile uses an arbitrary set of
  22751. client-specified substitutions, and XtResolvePathname uses a
  22752. set of standard substitutions corresponding to the X/Open
  22753. Portability Guide language localization conventions.  Most
  22754. applications should use XtResolvePathname.
  22755.  
  22756. A string substitution is defined by a list of Substitution
  22757. entries.
  22758.  
  22759.  
  22760.  
  22761.  
  22762.  
  22763.  
  22764.  
  22765.  
  22766.  
  22767.  
  22768.                  335
  22769.  
  22770.  
  22771.  
  22772.  
  22773.  
  22774. X Toolkit Intrinsics                 X11 Release 6.4
  22775.  
  22776. __
  22777. |
  22778. typedef struct {
  22779.      char match;
  22780.      String substitution;
  22781. } SubstitutionRec, *Substitution;
  22782. |__
  22783.  
  22784.  
  22785. File name evaluation is handled in an operating-system-
  22786. dependent fashion by an XtFilePredicate procedure.
  22787.  
  22788. __
  22789. |
  22790. typedef Boolean (*XtFilePredicate)(String);
  22791.       String filename;
  22792.  
  22793.  
  22794. filename  Specifies a potential filename.
  22795. |__
  22796.  
  22797. A file predicate procedure is called with a string that is
  22798. potentially a file name.  It should return True if this
  22799. string specifies a file that is appropriate for the intended
  22800. use and False otherwise.
  22801.  
  22802.  
  22803. To search for a file using substitutions in a path list, use
  22804. XtFindFile.
  22805.  
  22806. __
  22807. |
  22808. String XtFindFile(path, substitutions, num_substitutions, predicate)
  22809.       String path;
  22810.       Substitution substitutions;
  22811.       Cardinal num_substitutions;
  22812.       XtFilePredicate predicate;
  22813.  
  22814.  
  22815. path        Specifies a path of file names, including sub-
  22816.         stitution characters.
  22817.  
  22818. substitutions
  22819.         Specifies a list of substitutions to make into
  22820.         the path.
  22821.  
  22822. num_substitutions
  22823.         Specifies the number of substitutions passed in.
  22824.  
  22825. predicate   Specifies a procedure called to judge each
  22826.         potential file name, or NULL.
  22827. |__
  22828.  
  22829. The path parameter specifies a string that consists of a
  22830. series of potential file names delimited by colons.  Within
  22831.  
  22832.  
  22833.  
  22834.                  336
  22835.  
  22836.  
  22837.  
  22838.  
  22839.  
  22840. X Toolkit Intrinsics                 X11 Release 6.4
  22841.  
  22842.  
  22843. each name, the percent character specifies a string substi-
  22844. tution selected by the following character.  The character
  22845. sequence ``%:'' specifies an embedded colon that is not a
  22846. delimiter; the sequence is replaced by a single colon.    The
  22847. character sequence ``%%'' specifies a percent character that
  22848. does not introduce a substitution; the sequence is replaced
  22849. by a single percent character.    If a percent character is
  22850. followed by any other character, XtFindFile looks through
  22851. the specified substitutions for that character in the match
  22852. field and, if found, replaces the percent and match charac-
  22853. ters with the string in the corresponding substitution
  22854. field.    A substitution field entry of NULL is equivalent to
  22855. a pointer to an empty string.  If the operating system does
  22856. not interpret multiple embedded name separators in the path
  22857. (i.e., ``/'' in POSIX) the same way as a single separator,
  22858. XtFindFile will collapse multiple separators into a single
  22859. one after performing all string substitutions.    Except for
  22860. collapsing embedded separators, the contents of the string
  22861. substitutions are not interpreted by XtFindFile and may
  22862. therefore contain any operating-system-dependent characters,
  22863. including additional name separators.  Each resulting string
  22864. is passed to the predicate procedure until a string is found
  22865. for which the procedure returns True; this string is the
  22866. return value for XtFindFile.  If no string yields a True
  22867. return from the predicate, XtFindFile returns NULL.
  22868.  
  22869. If the predicate parameter is NULL, an internal procedure
  22870. that checks if the file exists, is readable, and is not a
  22871. directory is used.
  22872.  
  22873. It is the responsibility of the caller to free the returned
  22874. string using XtFree when it is no longer needed.
  22875.  
  22876.  
  22877. To search for a file using standard substitutions in a path
  22878. list, use XtResolvePathname.
  22879.  
  22880.  
  22881.  
  22882.  
  22883.  
  22884.  
  22885.  
  22886.  
  22887.  
  22888.  
  22889.  
  22890.  
  22891.  
  22892.  
  22893.  
  22894.  
  22895.  
  22896.  
  22897.  
  22898.  
  22899.  
  22900.                  337
  22901.  
  22902.  
  22903.  
  22904.  
  22905.  
  22906. X Toolkit Intrinsics                 X11 Release 6.4
  22907.  
  22908. __
  22909. |
  22910. String XtResolvePathname(display, type, filename, suffix, path, substitutions, num_substitutions, predicate)
  22911.       Display *display;
  22912.       String type, filename, suffix, path;
  22913.       Substitution substitutions;
  22914.       Cardinal num_substitutions;
  22915.       XtFilePredicate predicate;
  22916.  
  22917.  
  22918. display     Specifies the display to use to find the lan-
  22919.         guage for language substitutions.
  22920.  
  22921. type
  22922.  
  22923. filename
  22924.  
  22925. suffix        Specify values to substitute into the path.
  22926.  
  22927. path        Specifies the list of file specifications, or
  22928.         NULL.
  22929.  
  22930. substitutions
  22931.         Specifies a list of additional substitutions to
  22932.         make into the path, or NULL.
  22933.  
  22934. num_substitutions
  22935.         Specifies the number of entries in substitu-
  22936.         tions.
  22937.  
  22938. predicate   Specifies a procedure called to judge each
  22939.         potential file name, or NULL.
  22940. |__
  22941.  
  22942. The substitutions specified by XtResolvePathname are deter-
  22943. mined from the value of the language string retrieved by
  22944. XtDisplayInitialize for the specified display.    To set the
  22945. language for all applications specify ``*xnlLanguage: lang''
  22946. in the resource database.  The format and content of the
  22947. language string are implementation-defined.   One suggested
  22948. syntax is to compose the language string of three parts;  a
  22949. ``language  part'',  a ``territory  part'' and a ``codeset
  22950. part''.  The manner in which this composition is accom-
  22951. plished is implementation-defined, and the Intrinsics make
  22952. no interpretation of the parts other than to use them in
  22953. substitutions as described below.
  22954.  
  22955. XtResolvePathname calls XtFindFile with the following sub-
  22956. stitutions in addition to any passed by the caller and
  22957. returns the value returned by XtFindFile:
  22958.  
  22959. %N   The value of the filename parameter, or the applica-
  22960.      tion's class name if filename is NULL.
  22961.  
  22962.  
  22963.  
  22964.  
  22965.  
  22966.                  338
  22967.  
  22968.  
  22969.  
  22970.  
  22971.  
  22972. X Toolkit Intrinsics                 X11 Release 6.4
  22973.  
  22974.  
  22975. %T   The value of the type parameter.
  22976.  
  22977. %S   The value of the suffix parameter.
  22978.  
  22979. %L   The language string associated with the specified dis-
  22980.      play.
  22981.  
  22982. %l   The language part of the display's language string.
  22983.  
  22984. %t   The territory part of the display's language string.
  22985.  
  22986. %c   The codeset part of the display's language string.
  22987.  
  22988. %C   The customization string retrieved from the resource
  22989.      database associated with display.
  22990.  
  22991. %D   The value of the implementation-specific default path.
  22992.  
  22993. If a path is passed to XtResolvePathname, it is passed along
  22994. to XtFindFile.    If the path argument is NULL, the value of
  22995. the XFILESEARCHPATH environment variable is passed to
  22996. XtFindFile.  If XFILESEARCHPATH is not defined, an implemen-
  22997. tation-specific default path is used that contains at least
  22998. six entries.  These entries must contain the following sub-
  22999. stitutions:
  23000.  
  23001. 1. %C, %N, %S, %T, %L     or%C, %N, %S, %T, %l, %t, %c
  23002. 2. %C, %N, %S, %T, %l
  23003. 3. %C, %N, %S, %T
  23004. 4. %N, %S, %T, %L   or     %N, %S, %T, %l, %t, %c
  23005. 5. %N, %S, %T, %l
  23006. 6. %N, %S, %T
  23007.  
  23008. The order of these six entries within the path must be as
  23009. given above.  The order and use of substitutions within a
  23010. given entry are implementation-dependent.  If the path
  23011. begins with a colon, it is preceded by %N%S.  If the path
  23012. includes two adjacent colons, %N%S is inserted between them.
  23013.  
  23014. The type parameter is intended to be a category of files,
  23015. usually being translated into a directory in the pathname.
  23016. Possible values might include ``app-defaults'', ``help'',
  23017. and ``bitmap''.
  23018.  
  23019. The suffix parameter is intended to be appended to the file
  23020. name.  Possible values might include ``.txt'', ``.dat'', and
  23021. ``.bm''.
  23022.  
  23023. A suggested value for the default path on POSIX-based sys-
  23024. tems is
  23025.  
  23026.      /usr/lib/X11/%L/%T/%N%C%S:/usr/lib/X11/%l/%T/%N%C%S:\
  23027.      /usr/lib/X11/%T/%N%C%S:/usr/lib/X11/%L/%T/%N%S:\
  23028.      /usr/lib/X11/%l/%T/%N%S:/usr/lib/X11/%T/%N%S
  23029.  
  23030.  
  23031.  
  23032.                  339
  23033.  
  23034.  
  23035.  
  23036.  
  23037.  
  23038. X Toolkit Intrinsics                 X11 Release 6.4
  23039.  
  23040.  
  23041. Using this example, if the user has specified a language, it
  23042. is used as a subdirectory of /usr/lib/X11 that is searched
  23043. for other files.  If the desired file is not found there,
  23044. the lookup is tried again using just the language part of
  23045. the specification.  If the file is not there, it is looked
  23046. for in /usr/lib/X11.  The type parameter is used as a subdi-
  23047. rectory of the language directory or of /usr/lib/X11, and
  23048. suffix is appended to the file name.
  23049.  
  23050. The %D substitution allows the addition of path elements to
  23051. the implementation-specific default path, typically to allow
  23052. additional directories to be searched without preventing
  23053. resources in the system directories from being found.  For
  23054. example, a user installing resource files under a directory
  23055. called ``ourdir'' might set XFILESEARCHPATH to
  23056.  
  23057.      %D:ourdir/%T/%N%C:ourdir/%T/%N
  23058.  
  23059. The customization string is obtained by querying the
  23060. resource database currently associated with the display (the
  23061. database returned by XrmGetDatabase) for the resource appli-
  23062. cation_name.customization, class application_class.Cus-
  23063. tomization, where application_name and application_class are
  23064. the values returned by XtGetApplicationNameAndClass.  If no
  23065. value is specified in the database, the empty string is
  23066. used.
  23067.  
  23068. It is the responsibility of the caller to free the returned
  23069. string using XtFree when it is no longer needed.
  23070.  
  23071.  
  23072. 11.12.    Hooks for External Agents
  23073.  
  23074. Applications may register functions that are called at a
  23075. particular control points in the Intrinsics.  These func-
  23076. tions are intended to be used to provide notification of an
  23077. "X Toolkit event", such as widget creation, to an external
  23078. agent, such as an interactive resource editor, drag-and-drop
  23079. server, or an aid for physically challenged users.  The con-
  23080. trol points containing such registration hooks are identi-
  23081. fied in a "hook registration" object.
  23082.  
  23083. To retrieve the hook registration widget, use
  23084. XtHooksOfDisplay.
  23085.  
  23086.  
  23087.  
  23088.  
  23089.  
  23090.  
  23091.  
  23092.  
  23093.  
  23094.  
  23095.  
  23096.  
  23097.  
  23098.                  340
  23099.  
  23100.  
  23101.  
  23102.  
  23103.  
  23104. X Toolkit Intrinsics                 X11 Release 6.4
  23105.  
  23106. __
  23107. |
  23108. Widget XtHooksOfDisplay(display)
  23109.       Display *display;
  23110.  
  23111.  
  23112. display   Specifies the desired display.
  23113. |__
  23114.  
  23115. The class of this object is a private, implementation-depen-
  23116. dent subclass of Object.  The hook object has no parent.
  23117. The resources of this object are the callback lists for
  23118. hooks and the read-only resources for getting a list of par-
  23119. entless shells.  All of the callback lists are initially
  23120. empty.    When a display is closed, the hook object associated
  23121. with it is destroyed.
  23122.  
  23123. The following procedures can be called with the hook regis-
  23124. tration object as an argument:
  23125.  
  23126.  
  23127.      XtAddCallback, XtAddCallbacks, XtRemoveCallback,
  23128.      XtRemoveCallbacks, XtRemoveAllCallbacks,
  23129.      XtCallCallbacks, XtHasCallbacks, XtCallCallbackList
  23130.  
  23131.      XtClass, XtSuperclass, XtIsSubclass, XtCheckSubclass,
  23132.      XtIsObject, XtIsRectObj, XtIsWidget, XtIsComposite,
  23133.      XtIsConstraint, XtIsShell, XtIsOverrideShell,
  23134.      XtIsWMShell, XtIsVendorShell, XtIsTransientShell,
  23135.      XtIsToplevelShell, XtIsApplicationShell, XtIsSession-
  23136.      Shell
  23137.  
  23138.      XtWidgetToApplicationContext
  23139.  
  23140.      XtName, XtParent, XtDisplayOfObject, XtScreenOfObject
  23141.  
  23142.      XtSetValues, XtGetValues, XtVaSetValues, XtVaGetValues
  23143.  
  23144.  
  23145.  
  23146.  
  23147. 11.12.1.  Hook Object Resources
  23148.  
  23149. The resource names, classes, and representation types that
  23150. are specified in the hook object resource list are:
  23151.  
  23152.  
  23153.  
  23154.  
  23155.  
  23156.  
  23157.  
  23158.  
  23159.  
  23160.  
  23161.  
  23162.  
  23163.  
  23164.                  341
  23165.  
  23166.  
  23167.  
  23168.  
  23169.  
  23170. X Toolkit Intrinsics                 X11 Release 6.4
  23171.  
  23172.  
  23173. ---------------------------------------------------------------
  23174. Name           Class         Representation
  23175. ---------------------------------------------------------------
  23176. XtNcreateHook       XtCCallback         XtRCallback
  23177. XtNchangeHook       XtCCallback         XtRCallback
  23178. XtNconfigureHook   XtCCallback         XtRCallback
  23179. XtNgeometryHook    XtCCallback         XtRCallback
  23180. XtNdestroyHook       XtCCallback         XtRCallback
  23181. XtNshells       XtCReadOnly         XtRWidgetList
  23182. XtNnumShells       XtCReadOnly         XtRCardinal
  23183. ---------------------------------------------------------------
  23184.  
  23185.  
  23186. Descriptions of each of these resources:
  23187.  
  23188. The XtNcreateHook callback list is called from:
  23189. XtCreateWidget, XtCreateManagedWidget, XtCreatePopupShell,
  23190. XtAppCreateShell, and their corresponding varargs versions.
  23191.  
  23192. The call_data parameter in a createHook callback may be cast
  23193. to type XtCreateHookData.
  23194.  
  23195. __
  23196. |
  23197. typedef struct {
  23198.      String   type;
  23199.      Widget   widget;
  23200.      ArgList  args;
  23201.      Cardinal num_args;
  23202. } XtCreateHookDataRec, *XtCreateHookData;
  23203. |__
  23204.  
  23205.  
  23206. The type is set to XtHcreate, widget is the newly created
  23207. widget, and args and num_args are the arguments passed to
  23208. the create function. The callbacks are called before return-
  23209. ing from the create function.
  23210.  
  23211. The XtNchangeHook callback list is called from:
  23212.  
  23213.      XtSetValues, XtVaSetValues
  23214.  
  23215.      XtManageChild, XtManageChildren, XtUnmanageChild, XtUn-
  23216.      manageChildren
  23217.  
  23218.      XtRealizeWidget, XtUnrealizeWidget
  23219.  
  23220.      XtAddCallback, XtRemoveCallback, XtAddCallbacks,
  23221.      XtRemoveCallbacks, XtRemoveAllCallbacks
  23222.  
  23223.      XtAugmentTranslations, XtOverrideTranslations, XtUnin-
  23224.      stallTranslations
  23225.  
  23226.  
  23227.  
  23228.  
  23229.  
  23230.                  342
  23231.  
  23232.  
  23233.  
  23234.  
  23235.  
  23236. X Toolkit Intrinsics                 X11 Release 6.4
  23237.  
  23238.  
  23239.      XtSetKeyboardFocus, XtSetWMColormapWindows
  23240.  
  23241.      XtSetMappedWhenManaged, XtMapWidget, XtUnmapWidget
  23242.  
  23243.      XtPopup, XtPopupSpringLoaded, XtPopdown
  23244.  
  23245.  
  23246.  
  23247. The call_data parameter in a changeHook callback may be cast
  23248. to type XtChangeHookData.
  23249.  
  23250. __
  23251. |
  23252. typedef struct {
  23253.      String  type;
  23254.      Widget  widget;
  23255.      XtPointer event_data;
  23256.      Cardinal num_event_data;
  23257. } XtChangeHookDataRec, *XtChangeHookData;
  23258. |__
  23259.  
  23260.  
  23261. When the changeHook callbacks are called as a result of a
  23262. call to XtSetValues or XtVaSetValues, type is set to
  23263. XtHsetValues, widget is the new widget passed to the
  23264. set_values procedure, and event_data may be cast to type
  23265. XtChangeHookSetValuesData.
  23266.  
  23267. __
  23268. |
  23269. typedef struct {
  23270.      Widget   old, req;
  23271.      ArgList  args;
  23272.      Cardinal num_args;
  23273. } XtChangeHookSetValuesDataRec, *XtChangeHookSetValuesData;
  23274. |__
  23275.  
  23276.  
  23277. The old, req, args, and num_args are the parameters passed
  23278. to the set_values procedure.  The callbacks are called after
  23279. the set_values and constraint set_values procedures have
  23280. been called.
  23281.  
  23282. When the changeHook callbacks are called as a result of a
  23283. call to XtManageChild or XtManageChildren, type is set to
  23284. XtHmanageChildren, widget is the parent, event_data may be
  23285. cast to type WidgetList and is the list of children being
  23286. managed, and num_event_data is the length of the widget
  23287. list.  The callbacks are called after the children have been
  23288. managed.
  23289.  
  23290. When the changeHook callbacks are called as a result of a
  23291. call to XtUnmanageChild or XtUnmanageChildren, type is set
  23292. to XtHunmanageChildren, widget is the parent, event_data may
  23293.  
  23294.  
  23295.  
  23296.                  343
  23297.  
  23298.  
  23299.  
  23300.  
  23301.  
  23302. X Toolkit Intrinsics                 X11 Release 6.4
  23303.  
  23304.  
  23305. be cast to type WidgetList and is a list of the children
  23306. being unmanaged, and num_event_data is the length of the
  23307. widget list.  The callbacks are called after the children
  23308. have been unmanaged.
  23309.  
  23310. The changeHook callbacks are called twice as a result of a
  23311. call to XtChangeManagedSet, once after unmanaging and again
  23312. after managing.  When the callbacks are called the first
  23313. time, type is set to XtHunmanageSet, widget is the parent,
  23314. event_data may be cast to type WidgetList and is a list of
  23315. the children being unmanaged, and num_event_data is the
  23316. length of the widget list.  When the callbacks are called
  23317. the second time, the type is set to XtHmanageSet, widget is
  23318. the parent, event_data may be cast to type WidgetList and is
  23319. a list of the children being managed, and num_event_data is
  23320. the length of the widget list.
  23321.  
  23322. When the changeHook callbacks are called as a result of a
  23323. call to XtRealizeWidget, the type is set to XtHrealizeWidget
  23324. and widget is the widget being realized.  The callbacks are
  23325. called after the widget has been realized.
  23326.  
  23327. When the changeHook callbacks are called as a result of a
  23328. call to XtUnrealizeWidget, the type is set to
  23329. XtHunrealizeWidget, and widget is the widget being unreal-
  23330. ized.  The callbacks are called after the widget has been
  23331. unrealized.
  23332.  
  23333. When the changeHook callbacks are called as a result of a
  23334. call to XtAddCallback, type is set to XtHaddCallback, widget
  23335. is the widget to which the callback is being added, and
  23336. event_data may be cast to type String and is the name of the
  23337. callback being added.  The callbacks are called after the
  23338. callback has been added to the widget.
  23339.  
  23340. When the changeHook callbacks are called as a result of a
  23341. call to XtAddCallbacks, the type is set to XtHaddCallbacks,
  23342. widget is the widget to which the callbacks are being added,
  23343. and event_data may be cast to type String and is the name of
  23344. the callbacks being added.  The callbacks are called after
  23345. the callbacks have been added to the widget.
  23346.  
  23347. When the changeHook callbacks are called as a result of a
  23348. call to XtRemoveCallback, the type is set to
  23349. XtHremoveCallback, widget is the widget from which the call-
  23350. back is being removed, and event_data may be cast to type
  23351. String and is the name of the callback being removed.  The
  23352. callbacks are called after the callback has been removed
  23353. from the widget.
  23354.  
  23355. When the changeHook callbacks are called as a result of a
  23356. call to XtRemoveCallbacks, the type is set to
  23357. XtHremoveCallbacks, widget is the widget from which the
  23358. callbacks are being removed, and event_data may be cast to
  23359.  
  23360.  
  23361.  
  23362.                  344
  23363.  
  23364.  
  23365.  
  23366.  
  23367.  
  23368. X Toolkit Intrinsics                 X11 Release 6.4
  23369.  
  23370.  
  23371. type String and is the name of the callbacks being removed.
  23372. The callbacks are called after the callbacks have been
  23373. removed from the widget.
  23374.  
  23375. When the changeHook callbacks are called as a result of a
  23376. call to XtRemoveAllCallbacks, the type is set to XtHre-
  23377. moveAllCallbacks and widget is the widget from which the
  23378. callbacks are being removed.  The callbacks are called after
  23379. the callbacks have been removed from the widget.
  23380.  
  23381. When the changeHook callbacks are called as a result of a
  23382. call to XtAugmentTranslations, the type is set to XtHaug-
  23383. mentTranslations and widget is the widget whose translations
  23384. are being modified.  The callbacks are called after the wid-
  23385. get's translations have been modified.
  23386.  
  23387. When the changeHook callbacks are called as a result of a
  23388. call to XtOverrideTranslations, the type is set to XtHover-
  23389. rideTranslations and widget is the widget whose translations
  23390. are being modified.  The callbacks are called after the wid-
  23391. get's translations have been modified.
  23392.  
  23393. When the changeHook callbacks are called as a result of a
  23394. call to XtUninstallTranslations, The type is XtHuninstall-
  23395. Translations and widget is the widget whose translations are
  23396. being uninstalled.  The callbacks are called after the wid-
  23397. get's translations have been uninstalled.
  23398.  
  23399. When the changeHook callbacks are called as a result of a
  23400. call to XtSetKeyboardFocus, the type is set to XtHsetKey-
  23401. boardFocus and event_data may be cast to type Widget and is
  23402. the value of the descendant argument passed to XtSetKey-
  23403. boardFocus. The callbacks are called before returning from
  23404. XtSetKeyboardFocus.
  23405.  
  23406. When the changeHook callbacks are called as a result of a
  23407. call to XtSetWMColormapWindows, type is set to
  23408. XtHsetWMColormapWindows, event_data may be cast to type Wid-
  23409. getList and is the value of the list argument passed to
  23410. XtSetWMColormapWindows, and num_event_data is the length of
  23411. the list. The callbacks are called before returning from
  23412. XtSetWMColormapWindows.
  23413.  
  23414. When the changeHook callbacks are called as a result of a
  23415. call to XtSetMappedWhenManaged, the type is set to XtH-
  23416. setMappedWhenManaged and event_data may be cast to type
  23417. Boolean and is the value of the mapped_when_managed argument
  23418. passed to XtSetMappedWhenManaged.  The callbacks are called
  23419. after setting the widget's mapped_when_managed field and
  23420. before realizing or unrealizing the widget.
  23421.  
  23422. When the changeHook callbacks are called as a result of a
  23423. call to XtMapWidget, the type  is set to XtHmapWidget and
  23424. widget is the widget being mapped.  The callbacks are called
  23425.  
  23426.  
  23427.  
  23428.                  345
  23429.  
  23430.  
  23431.  
  23432.  
  23433.  
  23434. X Toolkit Intrinsics                 X11 Release 6.4
  23435.  
  23436.  
  23437. after mapping the widget.
  23438.  
  23439. When the changeHook callbacks are called as a result of a
  23440. call to XtUnmapWidget, the type  is set to XtHunmapWidget
  23441. and widget is the widget being unmapped.  The callbacks are
  23442. called after unmapping the widget.
  23443.  
  23444. When the changeHook callbacks are called as a result of a
  23445. call to XtPopup, the type is set to XtHpopup, widget is the
  23446. widget being popped up, and event_data may be cast to type
  23447. XtGrabKind and is the value of the grab_kind argument passed
  23448. to XtPopup.  The callbacks are called before returning from
  23449. XtPopup.
  23450.  
  23451. When the changeHook callbacks are called as a result of a
  23452. call to XtPopupSpringLoaded, the type is set to XtHpopup-
  23453. SpringLoaded and widget is the widget being popped up.    The
  23454. callbacks are called before returning from XtPopup-
  23455. SpringLoaded.
  23456.  
  23457. When the changeHook callbacks are called as a result of a
  23458. call to XtPopdown, the type is set to XtHpopdown and widget
  23459. is the widget being popped down.  The callbacks are called
  23460. before returning from XtPopdown.
  23461.  
  23462. A widget set that exports interfaces that change application
  23463. state without employing the Intrinsics library should invoke
  23464. the change hook itself.  This is done by:
  23465.  
  23466.  
  23467.          XtCallCallbacks(XtHooksOfDisplay(dpy), XtNchangeHook, call_data);
  23468.  
  23469.  
  23470.  
  23471. The XtNconfigureHook callback list is called any time the
  23472. Intrinsics move, resize, or configure a widget and when
  23473. XtResizeWindow is called.
  23474.  
  23475. The call_data parameter may be cast to type XtConfigureHook-
  23476. Data.
  23477.  
  23478. __
  23479. |
  23480. typedef struct {
  23481.      String type;
  23482.      Widget widget;
  23483.      XtGeometryMask changeMask;
  23484.      XWindowChanges changes;
  23485. } XtConfigureHookDataRec, *XtConfigureHookData;
  23486. |__
  23487.  
  23488.  
  23489.  
  23490.  
  23491.  
  23492.  
  23493.  
  23494.                  346
  23495.  
  23496.  
  23497.  
  23498.  
  23499.  
  23500. X Toolkit Intrinsics                 X11 Release 6.4
  23501.  
  23502.  
  23503. When the configureHook callbacks are called, the type is
  23504. XtHconfigure, widget is the widget being configured, and
  23505. changeMask and changes reflect the changes made to the wid-
  23506. get. The callbacks are called after changes have been made
  23507. to the widget.
  23508.  
  23509. The XtNgeometryHook callback list is called from XtMake-
  23510. GeometryRequest and XtMakeResizeRequest once before and once
  23511. after geometry negotiation occurs.
  23512.  
  23513. The call_data parameter may be cast to type
  23514. XtGeometryHookData.
  23515.  
  23516.  
  23517. __
  23518. |
  23519. typedef struct {
  23520.      String type;
  23521.      Widget widget;
  23522.      XtWidgetGeometry* request;
  23523.      XtWidgetGeometry* reply;
  23524.      XtGeometryResult result;
  23525. } XtGeometryHookDataRec, *XtGeometryHookData;
  23526. |__
  23527.  
  23528.  
  23529.  
  23530. When the geometryHook callbacks are called prior to geometry
  23531. negotiation, the type is XtHpreGeometry, widget is the wid-
  23532. get for which the request is being made, and request is the
  23533. requested geometry.  When the geometryHook callbacks are
  23534. called after geometry negotiation, the type is
  23535. XtHpostGeometry, widget is the widget for which the request
  23536. was made, request is the requested geometry, reply is the
  23537. resulting geometry granted, and result is the value returned
  23538. from the geometry negotiation.
  23539.  
  23540. The XtNdestroyHook callback list is called when a widget is
  23541. destroyed.  The call_data parameter may be cast to type
  23542. XtDestroyHookData.
  23543.  
  23544.  
  23545. __
  23546. |
  23547. typedef struct {
  23548.      String type;
  23549.      Widget widget;
  23550. } XtDestroyHookDataRec, *XtDestroyHookData;
  23551. |__
  23552.  
  23553.  
  23554.  
  23555. When the destroyHook callbacks are called as a result of a
  23556. call to XtDestroyWidget, the type is XtHdestroy and widget
  23557.  
  23558.  
  23559.  
  23560.                  347
  23561.  
  23562.  
  23563.  
  23564.  
  23565.  
  23566. X Toolkit Intrinsics                 X11 Release 6.4
  23567.  
  23568.  
  23569. is the widget being destroyed. The callbacks are called upon
  23570. completion of phase one destroy for a widget.
  23571.  
  23572. The XtNshells and XtnumShells are read-only resources that
  23573. report a list of all parentless shell widgets associated
  23574. with a display.
  23575.  
  23576. Clients who use these hooks must exercise caution in calling
  23577. Intrinsics functions in order to avoid recursion.
  23578.  
  23579.  
  23580. 11.12.2.  Querying Open Displays
  23581.  
  23582. To retrieve a list of the Displays associated with an appli-
  23583. cation context, use XtGetDisplays.
  23584.  
  23585. __
  23586. |
  23587. void XtGetDisplays(app_context, dpy_return, num_dpy_return)
  23588.       XtAppContext app_context;
  23589.       Display ***dpy_return;
  23590.       Cardinal *num_dpy_return;
  23591.  
  23592.  
  23593. app_context    Specifies the application context.
  23594.  
  23595. dpy_return     Returns a list of open Display connections in
  23596.            the specified application context.
  23597.  
  23598. num_dpy_return Returns the count of open Display connections
  23599.            in dpy_return.
  23600. |__
  23601.  
  23602. XtGetDisplays may be used by an external agent to query the
  23603. list of open displays that belong to an application context.
  23604. To free the list of displays, use XtFree.
  23605.  
  23606.  
  23607.  
  23608.  
  23609.  
  23610.  
  23611.  
  23612.  
  23613.  
  23614.  
  23615.  
  23616.  
  23617.  
  23618.  
  23619.  
  23620.  
  23621.  
  23622.  
  23623.  
  23624.  
  23625.  
  23626.                  348
  23627.  
  23628.  
  23629.  
  23630.  
  23631.  
  23632. X Toolkit Intrinsics                 X11 Release 6.4
  23633.  
  23634.  
  23635.  
  23636.  
  23637.              Chapter 12
  23638.  
  23639.              Nonwidget Objects
  23640.  
  23641.  
  23642.  
  23643.  
  23644. Although widget writers are free to treat Core as the base
  23645. class of the widget hierarchy, there are actually three
  23646. classes above it.  These classes are Object, RectObj (Rect-
  23647. angle Object), and (unnamed), and members of these classes
  23648. are referred to generically as objects.  By convention, the
  23649. term widget refers only to objects that are a subclass of
  23650. Core, and the term nonwidget refers to objects that are not
  23651. a subclass of Core.  In the preceding portion of this speci-
  23652. fication, the interface descriptions indicate explicitly
  23653. whether the generic widget argument is restricted to partic-
  23654. ular subclasses of Object.  Sections 12.2.5, 12.3.5, and
  23655. 12.5 summarize the permissible classes of the arguments to,
  23656. and return values from, each of the Intrinsics routines.
  23657.  
  23658.  
  23659. 12.1.  Data Structures
  23660.  
  23661. In order not to conflict with previous widget code, the data
  23662. structures used by nonwidget objects do not follow all the
  23663. same conventions as those for widgets.    In particular, the
  23664. class records are not composed of parts but instead are com-
  23665. plete data structures with filler for the widget fields they
  23666. do not use.  This allows the static class initializers for
  23667. existing widgets to remain unchanged.
  23668.  
  23669.  
  23670. 12.2.  Object Objects
  23671.  
  23672. The Object object contains the definitions of fields common
  23673. to all objects.  It encapsulates the mechanisms for resource
  23674. management.  All objects and widgets are members of sub-
  23675. classes of Object, which is defined by the ObjectClassPart
  23676. and ObjectPart structures.
  23677.  
  23678.  
  23679. 12.2.1.  ObjectClassPart Structure
  23680.  
  23681. The common fields for all object classes are defined in the
  23682. ObjectClassPart structure.  All fields have the same pur-
  23683. pose, function, and restrictions as the corresponding fields
  23684. in CoreClassPart; fields whose names are objn for some inte-
  23685. ger n are not used for Object, but exist to pad the data
  23686. structure so that it matches Core's class record.  The class
  23687. record initialization must fill all objn fields with NULL or
  23688. zero as appropriate to the type.
  23689.  
  23690.  
  23691.  
  23692.                  349
  23693.  
  23694.  
  23695.  
  23696.  
  23697.  
  23698. X Toolkit Intrinsics                 X11 Release 6.4
  23699.  
  23700. __
  23701. |
  23702. typedef struct _ObjectClassPart {
  23703.      WidgetClass superclass;
  23704.      String class_name;
  23705.      Cardinal widget_size;
  23706.      XtProc class_initialize;
  23707.      XtWidgetClassProc class_part_initialize;
  23708.      XtEnum class_inited;
  23709.      XtInitProc initialize;
  23710.      XtArgsProc initialize_hook;
  23711.      XtProc obj1;
  23712.      XtPointer obj2;
  23713.      Cardinal obj3;
  23714.      XtResourceList resources;
  23715.      Cardinal num_resources;
  23716.      XrmClass xrm_class;
  23717.      Boolean obj4;
  23718.      XtEnum obj5;
  23719.      Boolean obj6;
  23720.      Boolean obj7;
  23721.      XtWidgetProc destroy;
  23722.      XtProc obj8;
  23723.      XtProc obj9;
  23724.      XtSetValuesFunc set_values;
  23725.      XtArgsFunc set_values_hook;
  23726.      XtProc obj10;
  23727.      XtArgsProc get_values_hook;
  23728.      XtProc obj11;
  23729.      XtVersionType version;
  23730.      XtPointer callback_private;
  23731.      String obj12;
  23732.      XtProc obj13;
  23733.      XtProc obj14;
  23734.      XtPointer extension;
  23735. } ObjectClassPart;
  23736.  
  23737. |__
  23738.  
  23739. The extension record defined for ObjectClassPart with a
  23740. record_type equal to NULLQUARK is ObjectClassExtensionRec.
  23741.  
  23742.  
  23743.  
  23744.  
  23745.  
  23746.  
  23747.  
  23748.  
  23749.  
  23750.  
  23751.  
  23752.  
  23753.  
  23754.  
  23755.  
  23756.  
  23757.  
  23758.                  350
  23759.  
  23760.  
  23761.  
  23762.  
  23763.  
  23764. X Toolkit Intrinsics                 X11 Release 6.4
  23765.  
  23766. __
  23767. |
  23768. typedef struct {
  23769.      XtPointer next_extension;See Section 1.6.12
  23770.      XrmQuark record_type;    See Section 1.6.12
  23771.      long version;          See Section 1.6.12
  23772.      Cardinal record_size;    See Section 1.6.12
  23773.      XtAllocateProc allocate; See Section 2.5.5.
  23774.      XtDeallocateProc deallocate;See Section 2.8.4.
  23775. } ObjectClassExtensionRec, *ObjectClassExtension;
  23776.  
  23777. |__
  23778.  
  23779. The prototypical ObjectClass consists of just the
  23780. ObjectClassPart.
  23781.  
  23782. __
  23783. |
  23784. typedef struct _ObjectClassRec {
  23785.      ObjectClassPart object_class;
  23786. } ObjectClassRec, *ObjectClass;
  23787.  
  23788. |__
  23789.  
  23790. The predefined class record and pointer for ObjectClassRec
  23791. are
  23792.  
  23793. In IntrinsicP.h:
  23794. __
  23795. |
  23796. extern ObjectClassRec objectClassRec;
  23797.  
  23798. |__
  23799.  
  23800. In Intrinsic.h:
  23801. __
  23802. |
  23803. extern WidgetClass objectClass;
  23804.  
  23805. |__
  23806.  
  23807. The opaque types Object and ObjectClass and the opaque vari-
  23808. able objectClass are defined for generic actions on objects.
  23809. The symbolic constant for the ObjectClassExtension version
  23810. identifier is XtObjectExtensionVersion (see Section 1.6.12).
  23811. Intrinsic.h uses an incomplete structure definition to
  23812. ensure that the compiler catches attempts to access private
  23813. data:
  23814.  
  23815.  
  23816.  
  23817.  
  23818.  
  23819.  
  23820.  
  23821.  
  23822.  
  23823.  
  23824.                  351
  23825.  
  23826.  
  23827.  
  23828.  
  23829.  
  23830. X Toolkit Intrinsics                 X11 Release 6.4
  23831.  
  23832. __
  23833. |
  23834. typedef struct _ObjectClassRec* ObjectClass;
  23835.  
  23836. |__
  23837.  
  23838.  
  23839.  
  23840. 12.2.2.  ObjectPart Structure
  23841.  
  23842. The common fields for all object instances are defined in
  23843. the ObjectPart structure.  All fields have the same meaning
  23844. as the corresponding fields in CorePart.
  23845.  
  23846. __
  23847. |
  23848. typedef struct _ObjectPart {
  23849.      Widget self;
  23850.      WidgetClass widget_class;
  23851.      Widget parent;
  23852.      Boolean being_destroyed;
  23853.      XtCallbackList destroy_callbacks;
  23854.      XtPointer constraints;
  23855. } ObjectPart;
  23856.  
  23857. |__
  23858.  
  23859. All object instances have the Object fields as their first
  23860. component.  The prototypical type Object is defined with
  23861. only this set of fields.  Various routines can cast object
  23862. pointers, as needed, to specific object types.
  23863.  
  23864. In IntrinsicP.h:
  23865.  
  23866. __
  23867. |
  23868. typedef struct _ObjectRec {
  23869.      ObjectPart object;
  23870. } ObjectRec, *Object;
  23871.  
  23872. |__
  23873.  
  23874. In Intrinsic.h:
  23875.  
  23876. __
  23877. |
  23878. typedef struct _ObjectRec *Object;
  23879.  
  23880. |__
  23881.  
  23882.  
  23883.  
  23884.  
  23885.  
  23886.  
  23887.  
  23888.  
  23889.  
  23890.                  352
  23891.  
  23892.  
  23893.  
  23894.  
  23895.  
  23896. X Toolkit Intrinsics                 X11 Release 6.4
  23897.  
  23898.  
  23899. 12.2.3.  Object Resources
  23900.  
  23901. The resource names, classes, and representation types speci-
  23902. fied in the objectClassRec resource list are:
  23903.  
  23904.  
  23905. -----------------------------------------------------------------
  23906. Name             Class           Representation
  23907. -----------------------------------------------------------------
  23908. XtNdestroyCallback   XtCCallback       XtRCallback
  23909. -----------------------------------------------------------------
  23910.  
  23911.  
  23912.  
  23913. 12.2.4.  ObjectPart Default Values
  23914.  
  23915. All fields in ObjectPart have the same default values as the
  23916. corresponding fields in CorePart.
  23917.  
  23918.  
  23919. 12.2.5.  Object Arguments to Intrinsics Routines
  23920.  
  23921. The WidgetClass arguments to the following procedures may be
  23922. objectClass or any subclass:
  23923.  
  23924.  
  23925.      XtInitializeWidgetClass, XtCreateWidget, XtVaCreateWid-
  23926.      get
  23927.  
  23928.      XtIsSubclass, XtCheckSubclass
  23929.  
  23930.      XtGetResourceList, XtGetConstraintResourceList
  23931.  
  23932.  
  23933. The Widget arguments to the following procedures may be of
  23934. class Object or any subclass:
  23935.  
  23936.  
  23937.      XtCreateWidget, XtVaCreateWidget
  23938.  
  23939.      XtAddCallback, XtAddCallbacks, XtRemoveCallback,
  23940.      XtRemoveCallbacks, XtRemoveAllCallbacks,
  23941.      XtCallCallbacks, XtHasCallbacks, XtCallCallbackList
  23942.  
  23943.      XtClass, XtSuperclass, XtIsSubclass, XtCheckSubclass,
  23944.      XtIsObject, XtIsRectObj, XtIsWidget, XtIsComposite,
  23945.      XtIsConstraint, XtIsShell, XtIsOverrideShell,
  23946.      XtIsWMShell, XtIsVendorShell, XtIsTransientShell,
  23947.      XtIsToplevelShell, XtIsApplicationShell, XtIsSession-
  23948.      Shell
  23949.  
  23950.      XtIsManaged, XtIsSensitive
  23951.      (both will return False if argument is not a subclass
  23952.      of RectObj)
  23953.  
  23954.  
  23955.  
  23956.                  353
  23957.  
  23958.  
  23959.  
  23960.  
  23961.  
  23962. X Toolkit Intrinsics                 X11 Release 6.4
  23963.  
  23964.  
  23965.      XtIsRealized
  23966.      (returns the state of the nearest windowed ancestor if
  23967.      class of argument is not a subclass of Core)
  23968.  
  23969.      XtWidgetToApplicationContext
  23970.  
  23971.      XtDestroyWidget
  23972.  
  23973.      XtParent, XtDisplayOfObject, XtScreenOfObject, XtWin-
  23974.      dowOfObject
  23975.  
  23976.      XtSetKeyboardFocus (descendant)
  23977.  
  23978.      XtGetGC, XtReleaseGC
  23979.  
  23980.      XtName
  23981.  
  23982.      XtSetValues, XtGetValues, XtVaSetValues, XtVaGetValues
  23983.  
  23984.      XtGetSubresources, XtGetApplicationResources,
  23985.      XtVaGetSubresources, XtVaGetApplicationResources
  23986.  
  23987.      XtConvert, XtConvertAndStore
  23988.  
  23989.  
  23990. The return value of the following procedures will be of
  23991. class Object or a subclass:
  23992.  
  23993.  
  23994.      XtCreateWidget, XtVaCreateWidget
  23995.  
  23996.      XtParent
  23997.  
  23998.      XtNameToWidget
  23999.  
  24000.  
  24001. The return value of the following procedures will be object-
  24002. Class or a subclass:
  24003.  
  24004.  
  24005.      XtClass, XtSuperclass
  24006.  
  24007.  
  24008. 12.2.6.  Use of Objects
  24009.  
  24010. The Object class exists to enable programmers to use the
  24011. Intrinsics' classing and resource-handling mechanisms for
  24012. things smaller and simpler than widgets.  Objects make obso-
  24013. lete many common uses of subresources as described in Sec-
  24014. tions 9.4, 9.7.2.4, and 9.7.2.5.
  24015.  
  24016. Composite widget classes that wish to accept nonwidget chil-
  24017. dren must set the accepts_objects field in the Composite-
  24018. ClassExtension structure to True.  XtCreateWidget will
  24019.  
  24020.  
  24021.  
  24022.                  354
  24023.  
  24024.  
  24025.  
  24026.  
  24027.  
  24028. X Toolkit Intrinsics                 X11 Release 6.4
  24029.  
  24030.  
  24031. otherwise generate an error message on an attempt to create
  24032. a nonwidget child.
  24033.  
  24034. Of the classes defined by the Intrinsics, ApplicationShell
  24035. and SessionShell accept nonwidget children, and the class of
  24036. any nonwidget child must not be rectObjClass or any sub-
  24037. class.    The intent of allowing Object children of Applica-
  24038. tionShell and SessionShell is to provide clients a simple
  24039. mechanism for establishing the resource-naming root of an
  24040. object hierarchy.
  24041.  
  24042.  
  24043. 12.3.  Rectangle Objects
  24044.  
  24045. The class of rectangle objects is a subclass of Object that
  24046. represents rectangular areas.  It encapsulates the mecha-
  24047. nisms for geometry management and is called RectObj to avoid
  24048. conflict with the Xlib Rectangle data type.
  24049.  
  24050.  
  24051. 12.3.1.  RectObjClassPart Structure
  24052.  
  24053. As with the ObjectClassPart structure, all fields in the
  24054. RectObjClassPart structure have the same purpose and func-
  24055. tion as the corresponding fields in CoreClassPart; fields
  24056. whose names are rectn for some integer n are not used for
  24057. RectObj, but exist to pad the data structure so that it
  24058. matches Core's class record.  The class record initializa-
  24059. tion must fill all rectn fields with NULL or zero as appro-
  24060. priate to the type.
  24061.  
  24062.  
  24063.  
  24064.  
  24065.  
  24066.  
  24067.  
  24068.  
  24069.  
  24070.  
  24071.  
  24072.  
  24073.  
  24074.  
  24075.  
  24076.  
  24077.  
  24078.  
  24079.  
  24080.  
  24081.  
  24082.  
  24083.  
  24084.  
  24085.  
  24086.  
  24087.  
  24088.                  355
  24089.  
  24090.  
  24091.  
  24092.  
  24093.  
  24094. X Toolkit Intrinsics                 X11 Release 6.4
  24095.  
  24096. __
  24097. |
  24098. typedef struct _RectObjClassPart {
  24099.      WidgetClass superclass;
  24100.      String class_name;
  24101.      Cardinal widget_size;
  24102.      XtProc class_initialize;
  24103.      XtWidgetClassProc class_part_initialize;
  24104.      XtEnum class_inited;
  24105.      XtInitProc initialize;
  24106.      XtArgsProc initialize_hook;
  24107.      XtProc rect1;
  24108.      XtPointer rect2;
  24109.      Cardinal rect3;
  24110.      XtResourceList resources;
  24111.      Cardinal num_resources;
  24112.      XrmClass xrm_class;
  24113.      Boolean rect4;
  24114.      XtEnum rect5;
  24115.      Boolean rect6;
  24116.      Boolean rect7;
  24117.      XtWidgetProc destroy;
  24118.      XtWidgetProc resize;
  24119.      XtExposeProc expose;
  24120.      XtSetValuesFunc set_values;
  24121.      XtArgsFunc set_values_hook;
  24122.      XtAlmostProc set_values_almost;
  24123.      XtArgsProc get_values_hook;
  24124.      XtProc rect9;
  24125.      XtVersionType version;
  24126.      XtPointer callback_private;
  24127.      String rect10;
  24128.      XtGeometryHandler query_geometry;
  24129.      XtProc rect11;
  24130.      XtPointer extension ;
  24131. } RectObjClassPart;
  24132.  
  24133. |__
  24134.  
  24135. The RectObj class record consists of just the
  24136. RectObjClassPart.
  24137.  
  24138. __
  24139. |
  24140. typedef struct _RectObjClassRec {
  24141.      RectObjClassPart rect_class;
  24142. } RectObjClassRec, *RectObjClass;
  24143.  
  24144. |__
  24145.  
  24146. The predefined class record and pointer for RectObjClassRec
  24147. are
  24148.  
  24149. In Intrinsic.h:
  24150.  
  24151.  
  24152.  
  24153.  
  24154.                  356
  24155.  
  24156.  
  24157.  
  24158.  
  24159.  
  24160. X Toolkit Intrinsics                 X11 Release 6.4
  24161.  
  24162. __
  24163. |
  24164. extern RectObjClassRec rectObjClassRec;
  24165.  
  24166. |__
  24167.  
  24168. In Intrinsic.h:
  24169.  
  24170. __
  24171. |
  24172. extern WidgetClass rectObjClass;
  24173.  
  24174. |__
  24175.  
  24176. The opaque types RectObj and RectObjClass and the opaque
  24177. variable rectObjClass are defined for generic actions on
  24178. objects whose class is RectObj or a subclass of RectObj.
  24179. Intrinsic.h uses an incomplete structure definition to
  24180. ensure that the compiler catches attempts to access private
  24181. data:
  24182.  
  24183. __
  24184. |
  24185. typedef struct _RectObjClassRec* RectObjClass;
  24186.  
  24187. |__
  24188.  
  24189.  
  24190.  
  24191. 12.3.2.  RectObjPart Structure
  24192.  
  24193. In addition to the ObjectPart fields, RectObj objects have
  24194. the following fields defined in the RectObjPart structure.
  24195. All fields have the same meaning as the corresponding field
  24196. in CorePart.
  24197.  
  24198. __
  24199. |
  24200. typedef struct _RectObjPart {
  24201.      Position x, y;
  24202.      Dimension width, height;
  24203.      Dimension border_width;
  24204.      Boolean managed;
  24205.      Boolean sensitive;
  24206.      Boolean ancestor_sensitive;
  24207. } RectObjPart;
  24208.  
  24209. |__
  24210.  
  24211. RectObj objects have the RectObj fields immediately follow-
  24212. ing the Object fields.
  24213.  
  24214.  
  24215.  
  24216.  
  24217.  
  24218.  
  24219.  
  24220.                  357
  24221.  
  24222.  
  24223.  
  24224.  
  24225.  
  24226. X Toolkit Intrinsics                 X11 Release 6.4
  24227.  
  24228. __
  24229. |
  24230. typedef struct _RectObjRec {
  24231.      ObjectPart object;
  24232.      RectObjPart rectangle;
  24233. } RectObjRec, *RectObj;
  24234.  
  24235. |__
  24236.  
  24237. In Intrinsic.h:
  24238.  
  24239. __
  24240. |
  24241. typedef struct _RectObjRec* RectObj;
  24242.  
  24243. |__
  24244.  
  24245.  
  24246.  
  24247. 12.3.3.  RectObj Resources
  24248.  
  24249. The resource names, classes, and representation types that
  24250. are specified in the rectObjClassRec resource list are:
  24251.  
  24252. -------------------------------------------------------------------
  24253. Name               Class         Representation
  24254. -------------------------------------------------------------------
  24255. XtNancestorSensitive   XtCSensitive     XtRBoolean
  24256. XtNborderWidth           XtCBorderWidth     XtRDimension
  24257. XtNheight           XtCHeight     XtRDimension
  24258. XtNsensitive           XtCSensitive     XtRBoolean
  24259. XtNwidth           XtCWidth      XtRDimension
  24260. XtNx               XtCPosition     XtRPosition
  24261. XtNy               XtCPosition     XtRPosition
  24262. -------------------------------------------------------------------
  24263.  
  24264.  
  24265.  
  24266. 12.3.4.  RectObjPart Default Values
  24267.  
  24268. All fields in RectObjPart have the same default values as
  24269. the corresponding fields in CorePart.
  24270.  
  24271.  
  24272. 12.3.5.  Widget Arguments to Intrinsics Routines
  24273.  
  24274. The WidgetClass arguments to the following procedures may be
  24275. rectObjClass or any subclass:
  24276.  
  24277.  
  24278.      XtCreateManagedWidget, XtVaCreateManagedWidget
  24279.  
  24280.  
  24281. The Widget arguments to the following procedures may be of
  24282. class RectObj or any subclass:
  24283.  
  24284.  
  24285.  
  24286.                  358
  24287.  
  24288.  
  24289.  
  24290.  
  24291.  
  24292. X Toolkit Intrinsics                 X11 Release 6.4
  24293.  
  24294.  
  24295.      XtConfigureWidget, XtMoveWidget, XtResizeWidget
  24296.  
  24297.      XtMakeGeometryRequest, XtMakeResizeRequest
  24298.  
  24299.      XtManageChildren, XtManageChild, XtUnmanageChildren,
  24300.      XtUnmanageChild, XtChangeManagedSet
  24301.  
  24302.      XtQueryGeometry
  24303.  
  24304.      XtSetSensitive
  24305.  
  24306.      XtTranslateCoords
  24307.  
  24308.  
  24309. The return value of the following procedures will be of
  24310. class RectObj or a subclass:
  24311.  
  24312.  
  24313.      XtCreateManagedWidget, XtVaCreateManagedWidget
  24314.  
  24315.  
  24316. 12.3.6.  Use of Rectangle Objects
  24317.  
  24318. RectObj can be subclassed to provide widgetlike objects
  24319. (sometimes called gadgets) that do not use windows and do
  24320. not have those features that are seldom used in simple wid-
  24321. gets.  This can save memory resources both in the server and
  24322. in applications but requires additional support code in the
  24323. parent.  In the following discussion, rectobj refers only to
  24324. objects whose class is RectObj or a subclass of RectObj, but
  24325. not Core or a subclass of Core.
  24326.  
  24327. Composite widget classes that wish to accept rectobj chil-
  24328. dren must set the accepts_objects field in the Composite-
  24329. ClassExtension extension structure to True.  XtCreateWidget
  24330. or XtCreateManagedWidget will otherwise generate an error if
  24331. called to create a nonwidget child.  If the composite widget
  24332. supports only children of class RectObj or a subclass (i.e.,
  24333. not of the general Object class), it must declare an
  24334. insert_child procedure and check the subclass of each new
  24335. child in that procedure.  None of the classes defined by the
  24336. Intrinsics accept rectobj children.
  24337.  
  24338. If gadgets are defined in an object set, the parent is
  24339. responsible for much more than the parent of a widget.    The
  24340. parent must request and handle input events that occur for
  24341. the gadget and is responsible for making sure that when it
  24342. receives an exposure event the gadget children get drawn
  24343. correctly.  Rectobj children may have expose procedures
  24344. specified in their class records, but the parent is free to
  24345. ignore them, instead drawing the contents of the child
  24346. itself.  This can potentially save graphics context switch-
  24347. ing.  The precise contents of the exposure event and region
  24348. arguments to the RectObj expose procedure are not specified
  24349.  
  24350.  
  24351.  
  24352.                  359
  24353.  
  24354.  
  24355.  
  24356.  
  24357.  
  24358. X Toolkit Intrinsics                 X11 Release 6.4
  24359.  
  24360.  
  24361. by the Intrinsics; a particular rectangle object is free to
  24362. define the coordinate system origin (self-relative or par-
  24363. ent-relative) and whether or not the rectangle or region is
  24364. assumed to have been intersected with the visible region of
  24365. the object.
  24366.  
  24367. In general, it is expected that a composite widget that
  24368. accepts nonwidget children will document those children it
  24369. is able to handle, since a gadget cannot be viewed as a com-
  24370. pletely self-contained entity, as can a widget.  Since a
  24371. particular composite widget class is usually designed to
  24372. handle nonwidget children of only a limited set of classes,
  24373. it should check the classes of newly added children in its
  24374. insert_child procedure to make sure that it can deal with
  24375. them.
  24376.  
  24377. The Intrinsics will clear areas of a parent window obscured
  24378. by rectobj children, causing exposure events, under the fol-
  24379. lowing circumstances:
  24380.  
  24381. o    A rectobj child is managed or unmanaged.
  24382.  
  24383. o    In a call to XtSetValues on a rectobj child, one or
  24384.      more of the set_values procedures returns True.
  24385.  
  24386. o    In a call to XtConfigureWidget on a rectobj child,
  24387.      areas will be cleared corresponding to both the old and
  24388.      the new child geometries, including the border, if the
  24389.      geometry changes.
  24390.  
  24391. o    In a call to XtMoveWidget on a rectobj child, areas
  24392.      will be cleared corresponding to both the old and the
  24393.      new child geometries, including the border, if the
  24394.      geometry changes.
  24395.  
  24396. o    In a call to XtResizeWidget on a rectobj child, a sin-
  24397.      gle rectangle will be cleared corresponding to the
  24398.      larger of the old and the new child geometries if they
  24399.      are different.
  24400.  
  24401. o    In a call to XtMakeGeometryRequest (or
  24402.      XtMakeResizeRequest) on a rectobj child with XtQuery-
  24403.      Only not set, if the manager returns XtGeometryYes, two
  24404.      rectangles will be cleared corresponding to both the
  24405.      old and the new child geometries.
  24406.  
  24407. Stacking order is not supported for rectobj children.  Com-
  24408. posite widgets with rectobj children are free to define any
  24409. semantics desired if the child geometries overlap, including
  24410. making this an error.
  24411.  
  24412. When a rectobj is playing the role of a widget, developers
  24413. must be reminded to avoid making assumptions about the
  24414. object passed in the Widget argument to a callback
  24415.  
  24416.  
  24417.  
  24418.                  360
  24419.  
  24420.  
  24421.  
  24422.  
  24423.  
  24424. X Toolkit Intrinsics                 X11 Release 6.4
  24425.  
  24426.  
  24427. procedure.
  24428.  
  24429.  
  24430. 12.4.  Undeclared Class
  24431.  
  24432. The Intrinsics define an unnamed class between RectObj and
  24433. Core for possible future use by the X Consortium. The only
  24434. assumptions that may be made about the unnamed class are
  24435.  
  24436. o    The core_class.superclass field of coreWidgetClassRec
  24437.      contains a pointer to the unnamed class record.
  24438.  
  24439. o    A pointer to the unnamed class record when dereferenced
  24440.      as an ObjectClass will contain a pointer to rectObj-
  24441.      ClassRec in its object_class.superclass field.
  24442.  
  24443. Except for the above, the contents of the class record for
  24444. this class and the result of an attempt to subclass or to
  24445. create a widget of this unnamed class are undefined.
  24446.  
  24447.  
  24448. 12.5.  Widget Arguments to Intrinsics Routines
  24449.  
  24450. The WidgetClass arguments to the following procedures must
  24451. be of class Shell or a subclass:
  24452.  
  24453.  
  24454.      XtCreatePopupShell, XtVaCreatePopupShell,
  24455.      XtAppCreateShell, XtVaAppCreateShell,
  24456.      XtOpenApplication, XtVaOpenApplication
  24457.  
  24458.  
  24459. The Widget arguments to the following procedures must be of
  24460. class Core or any subclass:
  24461.  
  24462.  
  24463.      XtCreatePopupShell, XtVaCreatePopupShell
  24464.  
  24465.      XtAddEventHandler, XtAddRawEventHandler,
  24466.      XtRemoveEventHandler,
  24467.      XtRemoveRawEventHandler, XtInsertEventHandler, XtInser-
  24468.      tRawEventHandler
  24469.      XtInsertEventTypeHandler, XtRemoveEventTypeHandler,
  24470.  
  24471.      XtRegisterDrawable XtDispatchEventToWidget
  24472.  
  24473.      XtAddGrab, XtRemoveGrab, XtGrabKey, XtGrabKeyboard,
  24474.      XtUngrabKey, XtUngrabKeyboard, XtGrabButton,
  24475.      XtGrabPointer, XtUngrabButton,
  24476.      XtUngrabPointer
  24477.  
  24478.      XtBuildEventMask
  24479.  
  24480.  
  24481.  
  24482.  
  24483.  
  24484.                  361
  24485.  
  24486.  
  24487.  
  24488.  
  24489.  
  24490. X Toolkit Intrinsics                 X11 Release 6.4
  24491.  
  24492.  
  24493.      XtCreateWindow, XtDisplay, XtScreen, XtWindow
  24494.  
  24495.      XtNameToWidget
  24496.  
  24497.      XtGetSelectionValue, XtGetSelectionValues,
  24498.      XtOwnSelection, XtDisownSelection,
  24499.      XtOwnSelectionIncremental,
  24500.      XtGetSelectionValueIncremental,
  24501.      XtGetSelectionValuesIncremental,
  24502.      XtGetSelectionRequest
  24503.  
  24504.      XtInstallAccelerators, XtInstallAllAccelerators (both
  24505.      destination and source)
  24506.  
  24507.      XtAugmentTranslations, XtOverrideTranslations,
  24508.      XtUninstallTranslations,
  24509.      XtCallActionProc
  24510.  
  24511.      XtMapWidget, XtUnmapWidget
  24512.  
  24513.      XtRealizeWidget, XtUnrealizeWidget
  24514.  
  24515.      XtSetMappedWhenManaged
  24516.  
  24517.      XtCallAcceptFocus, XtSetKeyboardFocus (subtree)
  24518.  
  24519.      XtResizeWindow
  24520.  
  24521.      XtSetWMColormapWindows
  24522.  
  24523.  
  24524. The Widget arguments to the following procedures must be of
  24525. class Composite or any subclass:
  24526.  
  24527.  
  24528.      XtCreateManagedWidget, XtVaCreateManagedWidget
  24529.  
  24530.  
  24531. The Widget arguments to the following procedures must be of
  24532. a subclass of Shell:
  24533.  
  24534.  
  24535.      XtPopdown, XtCallbackPopdown, XtPopup, XtCallbackNone,
  24536.      XtCallbackNonexclusive, XtCallbackExclusive, XtPopup-
  24537.      SpringLoaded
  24538.  
  24539.  
  24540. The return value of the following procedure will be of class
  24541. Core or a subclass:
  24542.  
  24543.  
  24544.      XtWindowToWidget
  24545.  
  24546.  
  24547.  
  24548.  
  24549.  
  24550.                  362
  24551.  
  24552.  
  24553.  
  24554.  
  24555.  
  24556. X Toolkit Intrinsics                 X11 Release 6.4
  24557.  
  24558.  
  24559. The return value of the following procedures will be of a
  24560. subclass of Shell:
  24561.  
  24562.  
  24563.      XtAppCreateShell, XtVaAppCreateShell, XtAppInitialize,
  24564.      XtVaAppInitialize, XtCreatePopupShell, XtVaCreatePopup-
  24565.      Shell
  24566.  
  24567.  
  24568.  
  24569.  
  24570.  
  24571.  
  24572.  
  24573.  
  24574.  
  24575.  
  24576.  
  24577.  
  24578.  
  24579.  
  24580.  
  24581.  
  24582.  
  24583.  
  24584.  
  24585.  
  24586.  
  24587.  
  24588.  
  24589.  
  24590.  
  24591.  
  24592.  
  24593.  
  24594.  
  24595.  
  24596.  
  24597.  
  24598.  
  24599.  
  24600.  
  24601.  
  24602.  
  24603.  
  24604.  
  24605.  
  24606.  
  24607.  
  24608.  
  24609.  
  24610.  
  24611.  
  24612.  
  24613.  
  24614.  
  24615.  
  24616.                  363
  24617.  
  24618.  
  24619.  
  24620.  
  24621.  
  24622. X Toolkit Intrinsics                 X11 Release 6.4
  24623.  
  24624.  
  24625.  
  24626.  
  24627.                Chapter 13
  24628.  
  24629.            Evolution of the Intrinsics
  24630.  
  24631.  
  24632.  
  24633.  
  24634. The interfaces described by this specification have under-
  24635. gone several sets of revisions in the course of adoption as
  24636. an X Consortium standard specification.  Having now been
  24637. adopted by the Consortium as a standard part of the X Window
  24638. System, it is expected that this and future revisions will
  24639. retain backward compatibility in the sense that fully con-
  24640. forming implementations of these specifications may be pro-
  24641. duced that provide source compatibility with widgets and
  24642. applications written to previous Consortium standard revi-
  24643. sions.
  24644.  
  24645. The Intrinsics do not place any special requirement on wid-
  24646. get programmers to retain source or binary compatibility for
  24647. their widgets as they evolve, but several conventions have
  24648. been established to assist those developers who want to pro-
  24649. vide such compatibility.
  24650.  
  24651. In particular, widget programmers may wish to conform to the
  24652. convention described in Section 1.6.12 when defining class
  24653. extension records.
  24654.  
  24655.  
  24656. 13.1.  Determining Specification Revision Level
  24657.  
  24658. Widget and application developers who wish to maintain a
  24659. common source pool that will build properly with implementa-
  24660. tions of the Intrinsics at different revision levels of
  24661. these specifications but that take advantage of newer fea-
  24662. tures added in later revisions may use the symbolic macro
  24663. XtSpecificationRelease.
  24664.  
  24665.  
  24666. #define XtSpecificationRelease 6
  24667.  
  24668.  
  24669. As the symbol XtSpecificationRelease was new to Release 4,
  24670. widgets and applications desiring to build against earlier
  24671. implementations should test for the presence of this symbol
  24672. and assume only Release 3 interfaces if the definition is
  24673. not present.
  24674.  
  24675.  
  24676.  
  24677.  
  24678.  
  24679.  
  24680.  
  24681.  
  24682.                  364
  24683.  
  24684.  
  24685.  
  24686.  
  24687.  
  24688. X Toolkit Intrinsics                 X11 Release 6.4
  24689.  
  24690.  
  24691. 13.2.  Release 3 to Release 4 Compatibility
  24692.  
  24693. At the data structure level, Release 4 retains binary com-
  24694. patibility with Release 3 (the first X Consortium standard
  24695. release) for all data structures except WMShellPart,
  24696. TopLevelShellPart, and TransientShellPart.  Release 4
  24697. changed the argument type to most procedures that now take
  24698. arguments of type XtPointer and structure members that are
  24699. now of type XtPointer in order to avoid potential ANSI C
  24700. conformance problems.  It is expected that most implementa-
  24701. tions will be binary compatible with the previous defini-
  24702. tion.
  24703.  
  24704. Two fields in CoreClassPart were changed from Boolean to
  24705. XtEnum to allow implementations additional freedom in speci-
  24706. fying the representations of each.  This change should
  24707. require no source modification.
  24708.  
  24709.  
  24710. 13.2.1.  Additional Arguments
  24711.  
  24712. Arguments were added to the procedure definitions for
  24713. XtInitProc, XtSetValuesFunc, and XtEventHandler to provide
  24714. more information and to allow event handlers to abort fur-
  24715. ther dispatching of the current event (caution is advised!).
  24716. The added arguments to XtInitProc and XtSetValuesFunc make
  24717. the initialize_hook and set_values_hook methods obsolete,
  24718. but the hooks have been retained for those widgets that used
  24719. them in Release 3.
  24720.  
  24721.  
  24722. 13.2.2.  set_values_almost Procedures
  24723.  
  24724. The use of the arguments by a set_values_almost procedure
  24725. was poorly described in Release 3 and was inconsistent with
  24726. other conventions.
  24727.  
  24728. The current specification for the manner in which a set_val-
  24729. ues_almost procedure returns information to the Intrinsics
  24730. is not compatible with the Release 3 specification, and all
  24731. widget implementations should verify that any set_val-
  24732. ues_almost procedures conform to the current interface.
  24733.  
  24734. No known implementation of the Intrinsics correctly imple-
  24735. mented the Release 3 interface, so it is expected that the
  24736. impact of this specification change is small.
  24737.  
  24738.  
  24739. 13.2.3.  Query Geometry
  24740.  
  24741. A composite widget layout routine that calls XtQueryGeometry
  24742. is now expected to store the complete new geometry in the
  24743. intended structure; previously the specification said
  24744. ``store the changes it intends to make''.  Only by storing
  24745.  
  24746.  
  24747.  
  24748.                  365
  24749.  
  24750.  
  24751.  
  24752.  
  24753.  
  24754. X Toolkit Intrinsics                 X11 Release 6.4
  24755.  
  24756.  
  24757. the complete geometry does the child have any way to know
  24758. what other parts of the geometry may still be flexible.
  24759. Existing widgets should not be affected by this, except to
  24760. take advantage of the new information.
  24761.  
  24762.  
  24763. 13.2.4.  unrealizeCallback Callback List
  24764.  
  24765. In order to provide a mechanism for widgets to be notified
  24766. when they become unrealized through a call to
  24767. XtUnrealizeWidget, the callback list name ``unrealizeCall-
  24768. back'' has been defined by the Intrinsics.  A widget class
  24769. that requires notification on unrealize may declare a call-
  24770. back list resource by this name.  No class is required to
  24771. declare this resource, but any class that did so in a prior
  24772. revision may find it necessary to modify the resource name
  24773. if it does not wish to use the new semantics.
  24774.  
  24775.  
  24776. 13.2.5.  Subclasses of WMShell
  24777.  
  24778. The formal adoption of the Inter-Client Communication Con-
  24779. ventions Manual as an X Consortium standard has meant the
  24780. addition of four fields to WMShellPart and one field to
  24781. TopLevelShellPart.  In deference to some widget libraries
  24782. that had developed their own additional conventions to pro-
  24783. vide binary compatibility, these five new fields were added
  24784. at the end of the respective data structures.
  24785.  
  24786. To provide more convenience for TransientShells, a field was
  24787. added to the previously empty TransientShellPart.  On some
  24788. architectures the size of the part structure will not have
  24789. changed as a result of this.
  24790.  
  24791. Any widget implementation whose class is a subclass of
  24792. TopLevelShell or TransientShell must at minimum be recom-
  24793. piled with the new data structure declarations.  Because
  24794. WMShellPart no longer contains a contiguous XSizeHints data
  24795. structure, a subclass that expected to do a single structure
  24796. assignment of an XSizeHints structure to the size_hints
  24797. field of WMShellPart must be revised, though the old fields
  24798. remain at the same positions within WMShellPart.
  24799.  
  24800.  
  24801. 13.2.6.  Resource Type Converters
  24802.  
  24803. A new interface declaration for resource type converters was
  24804. defined to provide more information to converters, to sup-
  24805. port conversion cache cleanup with resource reference count-
  24806. ing, and to allow additional procedures to be declared to
  24807. free resources.  The old interfaces remain (in the compati-
  24808. bility section), and a new set of procedures was defined
  24809. that work only with the new type converter interface.
  24810.  
  24811.  
  24812.  
  24813.  
  24814.                  366
  24815.  
  24816.  
  24817.  
  24818.  
  24819.  
  24820. X Toolkit Intrinsics                 X11 Release 6.4
  24821.  
  24822.  
  24823. In the now obsolete old type converter interface, converters
  24824. are reminded that they must return the size of the converted
  24825. value as well as its address.  The example indicated this,
  24826. but the description of XtConverter was incomplete.
  24827.  
  24828.  
  24829. 13.2.7.  KeySym Case Conversion Procedure
  24830.  
  24831. The specification for the XtCaseProc function type has been
  24832. changed to match the Release 3 implementation, which
  24833. included necessary additional information required by the
  24834. function (a pointer to the display connection), and corrects
  24835. the argument type of the source KeySym parameter.  No known
  24836. implementation of the Intrinsics implemented the previously
  24837. documented interface.
  24838.  
  24839.  
  24840. 13.2.8.  Nonwidget Objects
  24841.  
  24842. Formal support for nonwidget objects is new to Release 4.  A
  24843. prototype implementation was latent in at least one Release
  24844. 3 implementation of the Intrinsics, but the specification
  24845. has changed somewhat.  The most significant change is the
  24846. requirement for a composite widget to declare the Composite-
  24847. ClassExtension record with the accepts_objects field set to
  24848. True in order to permit a client to create a nonwidget
  24849. child.
  24850.  
  24851. The addition of this extension field ensures that composite
  24852. widgets written under Release 3 will not encounter unex-
  24853. pected errors if an application attempts to create a nonwid-
  24854. get child.  In Release 4 there is no requirement that all
  24855. composite widgets implement the extra functionality required
  24856. to manage windowless children, so the accept_objects field
  24857. allows a composite widget to declare that it is not prepared
  24858. to do so.
  24859.  
  24860.  
  24861. 13.3.  Release 4 to Release 5 Compatibility
  24862.  
  24863. At the data structure level, Release 5 retains complete
  24864. binary compatibility with Release 4.  The specification of
  24865. the ObjectPart, RectObjPart, CorePart, CompositePart,
  24866. ShellPart, WMShellPart, TopLevelShellPart, and Application-
  24867. ShellPart instance records was made less strict to permit
  24868. implementations to add internal fields to these structures.
  24869. Any implementation that chooses to do so would, of course,
  24870. force a recompilation.    The Xlib specification for XrmValue
  24871. and XrmOptionDescRec was updated to use a new type,
  24872. XPointer, for the addr and value fields, respectively, to
  24873. avoid ANSI C conformance problems.  The definition of
  24874. XPointer is binary compatible with the previous implementa-
  24875. tion.
  24876.  
  24877.  
  24878.  
  24879.  
  24880.                  367
  24881.  
  24882.  
  24883.  
  24884.  
  24885.  
  24886. X Toolkit Intrinsics                 X11 Release 6.4
  24887.  
  24888.  
  24889. 13.3.1.  baseTranslations Resource
  24890.  
  24891.  
  24892. A new pseudo-resource, XtNbaseTranslations, was defined to
  24893. permit application developers to specify translation tables
  24894. in application defaults files while still giving end users
  24895. the ability to augment or override individual event
  24896. sequences.  This change will affect only those applications
  24897. that wish to take advantage of the new functionality or
  24898. those widgets that may have previously defined a resource
  24899. named ``baseTranslations''.
  24900.  
  24901. Applications wishing to take advantage of the new function-
  24902. ality would change their application defaults file, e.g.,
  24903. from
  24904.  
  24905.       app.widget.translations: value
  24906.  
  24907. to
  24908.  
  24909.       app.widget.baseTranslations: value
  24910.  
  24911. If it is important to the application to preserve complete
  24912. compatibility of the defaults file between different ver-
  24913. sions of the application running under Release 4 and Release
  24914. 5, the full translations can be replicated in both the
  24915. ``translations'' and the ``baseTranslations'' resource.
  24916.  
  24917.  
  24918. 13.3.2.  Resource File Search Path
  24919.  
  24920.  
  24921. The current specification allows implementations greater
  24922. flexibility in defining the directory structure used to hold
  24923. the application class and per-user application defaults
  24924. files.    Previous specifications required the substitution
  24925. strings to appear in the default path in a certain order,
  24926. preventing sites from collecting all the files for a spe-
  24927. cific application together in one directory.  The Release 5
  24928. specification allows the default path to specify the substi-
  24929. tution strings in any order within a single path entry.
  24930. Users will need to pay close attention to the documentation
  24931. for the specific implementation to know where to find these
  24932. files and how to specify their own XFILESEARCHPATH and
  24933. XUSERFILESEARCHPATH values when overriding the system
  24934. defaults.
  24935.  
  24936.  
  24937. 13.3.3.  Customization Resource
  24938.  
  24939.  
  24940. XtResolvePathname supports a new substitution string, %C,
  24941. for specifying separate application class resource files
  24942. according to arbitrary user-specified categories.  The
  24943.  
  24944.  
  24945.  
  24946.                  368
  24947.  
  24948.  
  24949.  
  24950.  
  24951.  
  24952. X Toolkit Intrinsics                 X11 Release 6.4
  24953.  
  24954.  
  24955. primary motivation for this addition was separate monochrome
  24956. and color application class defaults files.  The substitu-
  24957. tion value is obtained by querying the current resource
  24958. database for the application resource name ``customiza-
  24959. tion'', class ``Customization''.  Any application that pre-
  24960. viously used this resource name and class will need to be
  24961. aware of the possibly conflicting semantics.
  24962.  
  24963.  
  24964. 13.3.4.  Per-Screen Resource Database
  24965.  
  24966.  
  24967. To allow a user to specify separate preferences for each
  24968. screen of a display, a per-screen resource specification
  24969. string has been added and multiple resource databases are
  24970. created; one for each screen.  This will affect any applica-
  24971. tion that modified the (formerly unique) resource database
  24972. associated with the display subsequent to the Intrinsics
  24973. database initialization.  Such applications will need to be
  24974. aware of the particular screen on which each shell widget is
  24975. to be created.
  24976.  
  24977. Although the wording of the specification changed substan-
  24978. tially in the description of the process by which the
  24979. resource database(s) is initialized, the net effect is the
  24980. same as in prior releases with the exception of the added
  24981. per-screen resource specification and the new customization
  24982. substitution string in XtResolvePathname.
  24983.  
  24984.  
  24985. 13.3.5.  Internationalization of Applications
  24986.  
  24987.  
  24988. Internationalization as defined by ANSI is a technology that
  24989. allows support of an application in a single locale.  In
  24990. adding support for internationalization to the Intrinsics
  24991. the restrictions of this model have been followed.  In par-
  24992. ticular, the new Intrinsics interfaces are designed not to
  24993. preclude an application from using other alternatives.    For
  24994. this reason, no Intrinsics routine makes a call to establish
  24995. the locale.   However, a convenience routine to establish
  24996. the locale at initialize time has been provided, in the form
  24997. of a default procedure that must be explicitly installed if
  24998. the application desires ANSI C locale behavior.
  24999.  
  25000. As many objects in X, particularly resource databases, now
  25001. inherit the global locale when they are created, applica-
  25002. tions wishing to use the ANSI C locale model should use the
  25003. new function XtSetLanguageProc to do so.
  25004.  
  25005. The internationalization additions also define event filters
  25006. as a part of the Xlib Input Method specifications.  The
  25007. Intrinsics enable the use of event filters through additions
  25008. to XtDispatchEvent.  Applications that may not be
  25009.  
  25010.  
  25011.  
  25012.                  369
  25013.  
  25014.  
  25015.  
  25016.  
  25017.  
  25018. X Toolkit Intrinsics                 X11 Release 6.4
  25019.  
  25020.  
  25021. dispatching all events through XtDispatchEvent should be
  25022. reviewed in the context of this new input method mechanism.
  25023.  
  25024. In order to permit internationalization of error messages,
  25025. the name and path of the error database file are now allowed
  25026. to be implementation-dependent.  No adequate standard mecha-
  25027. nism has yet been suggested to allow the Intrinsics to
  25028. locate the database from localization information supplied
  25029. by the client.
  25030.  
  25031. The previous specification for the syntax of the language
  25032. string specified by xnlLanguage has been dropped to avoid
  25033. potential conflicts with other standards.  The language
  25034. string syntax is now implementation-defined.  The example
  25035. syntax cited is consistent with the previous specification.
  25036.  
  25037.  
  25038. 13.3.6.  Permanently Allocated Strings
  25039.  
  25040.  
  25041. In order to permit additional memory savings, an Xlib inter-
  25042. face was added to allow the resource manager to avoid copy-
  25043. ing certain string constants.  The Intrinsics specification
  25044. was updated to explicitly require the Object class_name,
  25045. resource_name, resource_class, resource_type, default_type
  25046. in resource tables, Core actions string field, and Con-
  25047. straint resource_name, resource_class, resource_type, and
  25048. default_type resource fields to be permanently allocated.
  25049. This explicit requirement is expected to affect only appli-
  25050. cations that may create and destroy classes on the fly.
  25051.  
  25052.  
  25053. 13.3.7.  Arguments to Existing Functions
  25054.  
  25055.  
  25056. The args argument to XtAppInitialize, XtVaAppInitialize,
  25057. XtOpenDisplay, XtDisplayInitialize, and XtInitialize were
  25058. changed from Cardinal* to int* to conform to pre-existing
  25059. convention and avoid otherwise annoying typecasting in ANSI
  25060. C environments.
  25061.  
  25062.  
  25063. 13.4.  Release 5 to Release 6 Compatibility
  25064.  
  25065. At the data structure level, Release 6 retains binary com-
  25066. patibility with Release 5 for all data structures except
  25067. WMShellPart.  Three resources were added to the specifica-
  25068. tion.  The known implementations had unused space in the
  25069. data structure, therefore on some architectures and imple-
  25070. mentations, the size of the part structure will not have
  25071. changed as a result of this.
  25072.  
  25073.  
  25074.  
  25075.  
  25076.  
  25077.  
  25078.                  370
  25079.  
  25080.  
  25081.  
  25082.  
  25083.  
  25084. X Toolkit Intrinsics                 X11 Release 6.4
  25085.  
  25086.  
  25087. 13.4.1.  Widget Internals
  25088.  
  25089. Two new widget methods for instance allocation and dealloca-
  25090. tion were added to the Object class.  These new methods
  25091. allow widgets to be treated as C++ objects in the C++ envi-
  25092. ronment when an appropriate allocation method is specified
  25093. or inherited by the widget class.
  25094.  
  25095. The textual descriptions of the processes of widget creation
  25096. and widget destruction have been edited to provide clarifi-
  25097. cation to widget writers.  Widgets writers may have reason
  25098. to rely on the specific order of the stages of widget cre-
  25099. ation and destruction; with that motivation, the specifica-
  25100. tion now more exactly describes the process.
  25101.  
  25102. As a convenience, an interface to locate a widget class
  25103. extension record on a linked list, XtGetClassExtension, has
  25104. been added.
  25105.  
  25106. A new option to allow bundled changes to the managed set of
  25107. a Composite widget is introduced in the Composite class
  25108. extension record.  Widgets that define a change_managed pro-
  25109. cedure that can accommodate additions and deletions to the
  25110. managed set of children in a single invocation should set
  25111. allows_change_managed_set to True in the extension record.
  25112.  
  25113. The wording of the process followed by XtUnmanageChildren
  25114. has changed slightly to better handle changes to the managed
  25115. set during phase 2 destroy processing.
  25116.  
  25117. A new exposure event compression flag, XtExposeNoRegion, was
  25118. added.    Many widgets specify exposure compression, but
  25119. either ignore the actual damage region passed to the core
  25120. expose procedure or use only the cumulative bounding box
  25121. data available in the event.  Widgets with expose procedures
  25122. that do not make use of exact exposure region information
  25123. can indicate that the Intrinsics need not compute the
  25124. region.
  25125.  
  25126.  
  25127. 13.4.2.  General Application Development
  25128.  
  25129. XtOpenApplication is a new convenience procedure to initial-
  25130. ize the toolkit, create an application context, open an X
  25131. display connection, and create the root of the widget
  25132. instance tree.    It is identical to the interface it
  25133. replaces, XtAppInitialize, in all respects except that it
  25134. takes an additional argument specifying the widget class of
  25135. the root shell to create.  This interface is now the recom-
  25136. mended one so that clients may easily become session partic-
  25137. ipants.  The old convenience procedures appear in the com-
  25138. patibility section.
  25139.  
  25140.  
  25141.  
  25142.  
  25143.  
  25144.                  371
  25145.  
  25146.  
  25147.  
  25148.  
  25149.  
  25150. X Toolkit Intrinsics                 X11 Release 6.4
  25151.  
  25152.  
  25153. The toolkit initialization function XtToolkitInitialize may
  25154. be called multiple times without penalty.
  25155.  
  25156. In order to optimize changes in geometry to a set of geome-
  25157. try-managed children, a new interface, XtChangeManagedSet,
  25158. has been added.
  25159.  
  25160.  
  25161. 13.4.3.  Communication with Window and Session Managers
  25162.  
  25163. The revision of the Inter-Client Communication Conventions
  25164. Manual as an X Consortium standard has resulted in the addi-
  25165. tion of three fields to the specification of WMShellPart.
  25166. These are urgency, client_leader, and window_role.
  25167.  
  25168. The adoption of the X Session Management Protocol as an X
  25169. Consortium standard has resulted in the addition of a new
  25170. shell widget, SessionShell, and an accompanying subclass
  25171. verification interface, XtIsSessionShell.  This widget pro-
  25172. vides support for communication between an application and a
  25173. session manager, as well as a window manager.  In order to
  25174. preserve compatibility with existing subclasses of
  25175. ApplicationShell, the ApplicationShell was subclassed to
  25176. create the new widget class.  The session protocol requires
  25177. a modal response to certain checkpointing operations by par-
  25178. ticipating applications.  The SessionShell structures the
  25179. application's notification of and responses to messages from
  25180. the session manager by use of various callback lists and by
  25181. use of the new interfaces XtSessionGetToken and
  25182. XtSessionReturnToken.  There is also a new command line
  25183. argument, -xtsessionID, which facilitates the session man-
  25184. ager in restarting applications based on the Intrinsics.
  25185.  
  25186. The resource name and class strings defined by the Intrin-
  25187. sics shell widgets in <X11/Shell.h> are now listed in
  25188. Appendix E.  The addition of a new symbol for the WMShell
  25189. wait_for_wm resource was made to bring the external symbol
  25190. and the string it represents into agreement.  The actual
  25191. resource name string in WMShell has not changed.  The
  25192. resource representation type of the XtNwinGravity resource
  25193. of the WMShell was changed to XtRGravity in order to regis-
  25194. ter a type converter so that window gravity resource values
  25195. could be specified by name.
  25196.  
  25197.  
  25198. 13.4.4.  Geometry Management
  25199.  
  25200. A clarification to the specification was made to indicate
  25201. that geometry requests may include current values along with
  25202. the requested changes.
  25203.  
  25204.  
  25205.  
  25206.  
  25207.  
  25208.  
  25209.  
  25210.                  372
  25211.  
  25212.  
  25213.  
  25214.  
  25215.  
  25216. X Toolkit Intrinsics                 X11 Release 6.4
  25217.  
  25218.  
  25219. 13.4.5.  Event Management
  25220.  
  25221. In Release 6, support is provided for registering selectors
  25222. and event handlers for events generated by X protocol exten-
  25223. sions and for dispatching those events to the appropriate
  25224. widget.  The new event handler registration interfaces are
  25225. XtInsertEventTypeHandler and XtRemoveEventTypeHandler.
  25226. Since the mechanism to indicate selection of extension
  25227. events is specific to the extension being used, the Intrin-
  25228. sics introduces XtRegisterExtensionSelector, which allows
  25229. the application to select for the events of interest.  In
  25230. order to change the dispatching algorithm to accommodate
  25231. extension events as well as core X protocol events, the
  25232. Intrinsics event dispatcher may now be replaced or enveloped
  25233. by the application with XtSetEventDispatcher.  The dis-
  25234. patcher may wish to call XtGetKeyboardFocusWidget to deter-
  25235. mine the widget with the current Intrinsics keyboard focus.
  25236. A dispatcher, after determining the destination widget, may
  25237. use XtDispatchEventToWidget to cause the event to be dis-
  25238. patched to the event handlers registered by a specific wid-
  25239. get.
  25240.  
  25241. To permit the dispatching of events for nonwidget drawables,
  25242. such as pixmaps that are not associated with a widget's win-
  25243. dow, XtRegisterDrawable and XtUnregisterDrawable have been
  25244. added to the library.  A related update was made to the
  25245. description of XtWindowToWidget.
  25246.  
  25247. The library is now thread-safe, allowing one thread at a
  25248. time to enter the library and protecting global data as nec-
  25249. essary from concurrent use.  Threaded toolkit applications
  25250. are supported by the new interfaces
  25251. XtToolkitThreadInitialize, XtAppLock, XtAppUnlock,
  25252. XtAppSetExitFlag, and XtAppGetExitFlag.  Widget writers may
  25253. also use XtProcessLock and XtProcessUnlock.
  25254.  
  25255. Safe handling of POSIX signals and other asynchronous noti-
  25256. fications is now provided by use of XtAppAddSignal,
  25257. XtNoticeSignal, and XtRemoveSignal.
  25258.  
  25259. The application can receive notification of an impending
  25260. block in the Intrinsics event manager by registering inter-
  25261. est through XtAppAddBlockHook and XtRemoveBlockHook.
  25262.  
  25263. XtLastEventProcessed returns the most recent event passed to
  25264. XtDispatchEvent for a specified display.
  25265.  
  25266.  
  25267. 13.4.6.  Resource Management
  25268.  
  25269. Resource converters are registered by the Intrinsics for
  25270. window gravity and for three new resource types associated
  25271. with session participation: RestartStyle, CommandArgArray
  25272. and DirectoryString.
  25273.  
  25274.  
  25275.  
  25276.                  373
  25277.  
  25278.  
  25279.  
  25280.  
  25281.  
  25282. X Toolkit Intrinsics                 X11 Release 6.4
  25283.  
  25284.  
  25285. The file search path syntax has been extended to make it
  25286. easier to include the default search path, which controls
  25287. resource database construction, by using the new substitu-
  25288. tion string, %D.
  25289.  
  25290.  
  25291. 13.4.7.  Translation Management
  25292.  
  25293. The default key translator now recognizes the NumLock modi-
  25294. fier.  If NumLock is on and the second keysym is a keypad
  25295. keysym (a standard keysym named with a ``KP'' prefix or a
  25296. vendor-specific keysym in the hexadecimal range 0x11000000
  25297. to 0x1100FFFF), then the default key translator will use the
  25298. first keysym if Shift and/or ShiftLock is on and will use
  25299. the second keysym if neither is on.  Otherwise, it will
  25300. ignore NumLock and apply the normal protocol semantics.
  25301.  
  25302.  
  25303. 13.4.8.  Selections
  25304.  
  25305. The targets of selection requests may be parameterized, as
  25306. described by the revised Inter-Client Communication Conven-
  25307. tions Manual.  When such requests are made, XtSetSelection-
  25308. Parameters is used by the requestor to specify the target
  25309. parameters and XtGetSelectionParameters is used by the
  25310. selection owner to retrieve the parameters.  When a parame-
  25311. terized target is specified in the context of a bundled
  25312. request for multiple targets, XtCreateSelectionRequest,
  25313. XtCancelSelectionRequest, and XtSendSelectionRequest are
  25314. used to envelop the assembly of the request.  When the
  25315. parameters themselves are the names of properties, the
  25316. Intrinsics provides support for the economical use of prop-
  25317. erty atom names; see XtReservePropertyAtom and
  25318. XtReleasePropertyAtom.
  25319.  
  25320.  
  25321. 13.4.9.  External Agent Hooks
  25322.  
  25323. External agent hooks were added for the benefit of applica-
  25324. tions that instrument other applications for purposes of
  25325. accessibility, testing, and customization.  The external
  25326. agent and the application communicate by a shared protocol
  25327. which is transparent to the application.  The hook callbacks
  25328. permit the external agent to register interest in groups or
  25329. classes of toolkit activity and to be notified of the type
  25330. and details of the activity as it occurs.  The new inter-
  25331. faces related to this effort are XtHooksOfDisplay, which
  25332. returns the hook registration widget, and XtGetDisplays,
  25333. which returns a list of the X displays associated with an
  25334. application context.
  25335.  
  25336.  
  25337.  
  25338.  
  25339.  
  25340.  
  25341.  
  25342.                  374
  25343.  
  25344.  
  25345.  
  25346.  
  25347.  
  25348. X Toolkit Intrinsics                 X11 Release 6.4
  25349.  
  25350.  
  25351.  
  25352.  
  25353.              Appendix A
  25354.  
  25355.             Resource File Format
  25356.  
  25357.  
  25358.  
  25359. A resource file contains text representing the default
  25360. resource values for an application or set of applications.
  25361.  
  25362. The format of resource files is defined by Xlib -- C Lan-
  25363. guage X Interface and is reproduced here for convenience
  25364. only.
  25365.  
  25366. The format of a resource specification is
  25367.  
  25368. ResourceLine    = Comment | IncludeFile | ResourceSpec | <empty line>
  25369. Comment     = ``!'' {<any character except null or newline>}
  25370. IncludeFile    = ``#'' WhiteSpace ``include'' WhiteSpace FileName WhiteSpace
  25371. FileName    = <valid filename for operating system>
  25372. ResourceSpec    = WhiteSpace ResourceName WhiteSpace ``:'' WhiteSpace Value
  25373. ResourceName    = [Binding] {Component Binding} ComponentName
  25374. Binding     = ``.'' | ``*''
  25375. WhiteSpace    = {<space> | <horizontal tab>}
  25376. Component    = ``?'' | ComponentName
  25377. ComponentName    = NameChar {NameChar}
  25378. NameChar    = ``a''-``z'' | ``A''-``Z'' | ``0''-``9'' | ``_'' | ``-''
  25379. Value        = {<any character except null or unescaped newline>}
  25380.  
  25381.  
  25382. Elements separated by vertical bar (|) are alternatives.
  25383. Curly braces ({...}) indicate zero or more repetitions of
  25384. the enclosed elements.    Square brackets ([...]) indicate
  25385. that the enclosed element is optional.    Quotes (``...'') are
  25386. used around literal characters.
  25387.  
  25388. If the last character on a line is a backslash (\), that
  25389. line is assumed to continue on the next line.
  25390.  
  25391. To allow a Value to begin with whitespace, the two-character
  25392. sequence ``\space'' (backslash followed by space) is recog-
  25393. nized and replaced by a space character, and the two-charac-
  25394. ter sequence ``\tab'' (backslash followed by horizontal tab)
  25395. is recognized and replaced by a horizontal tab character.
  25396.  
  25397. To allow a Value to contain embedded newline characters, the
  25398. two-character sequence ``\n'' is recognized and replaced by
  25399. a newline character.  To allow a Value to be broken across
  25400. multiple lines in a text file, the two-character sequence
  25401. ``\newline'' (backslash followed by newline) is recognized
  25402. and removed from the value.
  25403.  
  25404. To allow a Value to contain arbitrary character codes, the
  25405.  
  25406.  
  25407.  
  25408.                  375
  25409.  
  25410.  
  25411.  
  25412.  
  25413.  
  25414. X Toolkit Intrinsics                 X11 Release 6.4
  25415.  
  25416.  
  25417. four-character sequence ``\nnn'', where each n is a digit
  25418. character in the range of ``0''-``7'', is recognized and
  25419. replaced with a single byte that contains the octal value
  25420. specified by the sequence.  Finally, the two-character
  25421. sequence ``\\'' is recognized and replaced with a single
  25422. backslash.
  25423.  
  25424.  
  25425.  
  25426.  
  25427.  
  25428.  
  25429.  
  25430.  
  25431.  
  25432.  
  25433.  
  25434.  
  25435.  
  25436.  
  25437.  
  25438.  
  25439.  
  25440.  
  25441.  
  25442.  
  25443.  
  25444.  
  25445.  
  25446.  
  25447.  
  25448.  
  25449.  
  25450.  
  25451.  
  25452.  
  25453.  
  25454.  
  25455.  
  25456.  
  25457.  
  25458.  
  25459.  
  25460.  
  25461.  
  25462.  
  25463.  
  25464.  
  25465.  
  25466.  
  25467.  
  25468.  
  25469.  
  25470.  
  25471.  
  25472.  
  25473.  
  25474.                  376
  25475.  
  25476.  
  25477.  
  25478.  
  25479.  
  25480. X Toolkit Intrinsics                 X11 Release 6.4
  25481.  
  25482.  
  25483.  
  25484.  
  25485.              Appendix B
  25486.  
  25487.           Translation Table Syntax
  25488.  
  25489.  
  25490.  
  25491.  
  25492. Notation
  25493.  
  25494. Syntax is specified in EBNF notation with the following con-
  25495. ventions:
  25496.  
  25497. [ a ]        Means either nothing or ``a''
  25498. { a }        Means zero or more occurrences of ``a''
  25499. ( a | b )   Means either ``a'' or ``b''
  25500. \\n        Is the newline character
  25501.  
  25502.  
  25503. All terminals are enclosed in double quotation marks (``
  25504. '').  Informal descriptions are enclosed in angle brackets
  25505. (< >).
  25506.  
  25507. Syntax
  25508.  
  25509. The syntax of a translation table is
  25510.  
  25511. translationTable   = [ directive ] { production }
  25512. directive       = ( ``#replace'' | ``#override'' | ``#augment'' ) ``\\n''
  25513. production       = lhs ``:'' rhs ``\\n''
  25514. lhs           = ( event | keyseq ) { ``,'' (event | keyseq) }
  25515. keyseq           = ``"'' keychar {keychar} ``"''
  25516. keychar        = [ ``^'' | ``$'' | ``\\'' ] <ISO Latin 1 character>
  25517. event           = [modifier_list] ``<''event_type``>'' [ ``('' count[``+''] ``)'' ] {detail}
  25518. modifier_list       = ( [``!''] [``:''] {modifier} ) | ``None''
  25519. modifier       = [``~''] modifier_name
  25520. count           = (``1'' | ``2'' | ``3'' | ``4'' | ...)
  25521. modifier_name       = ``@'' <keysym> | <see ModifierNames table below>
  25522. event_type       = <see Event Types table below>
  25523. detail           = <event specific details>
  25524. rhs           = { name ``('' [params] ``)'' }
  25525. name           = namechar { namechar }
  25526. namechar       = { ``a''-``z'' | ``A''-``Z'' | ``0''-``9'' | ``_'' | ``-'' }
  25527. params           = string {``,'' string}
  25528. string           = quoted_string | unquoted_string
  25529. quoted_string       = ``"'' {<Latin 1 character> | escape_char} [``\\\\'' ] ``"''
  25530. escape_char       = ``\\"''
  25531. unquoted_string    = {<Latin 1 character except space, tab, ``,'', ``\\n'', ``)''>}
  25532.  
  25533.  
  25534.  
  25535. The params field is parsed into a list of String values that
  25536. will be passed to the named action procedure.  A quoted
  25537.  
  25538.  
  25539.  
  25540.                  377
  25541.  
  25542.  
  25543.  
  25544.  
  25545.  
  25546. X Toolkit Intrinsics                 X11 Release 6.4
  25547.  
  25548.  
  25549. string may contain an embedded quotation mark if the quota-
  25550. tion mark is preceded by a single backslash (\).  The three-
  25551. character sequence ``\\"'' is interpreted as ``single back-
  25552. slash followed by end-of-string''.
  25553.  
  25554.  
  25555. Modifier Names
  25556.  
  25557. The modifier field is used to specify standard X keyboard
  25558. and button modifier mask bits.    Modifiers are legal on event
  25559. types KeyPress, KeyRelease, ButtonPress, ButtonRelease,
  25560. MotionNotify, EnterNotify, LeaveNotify, and their abbrevia-
  25561. tions.    An error is generated when a translation table that
  25562. contains modifiers for any other events is parsed.
  25563.  
  25564. o    If the modifier list has no entries and is not
  25565.      ``None'', it means ``don't care'' on all modifiers.
  25566.  
  25567. o    If an exclamation point (!) is specified at the begin-
  25568.      ning of the modifier list, it means that the listed
  25569.      modifiers must be in the correct state and no other
  25570.      modifiers can be asserted.
  25571.  
  25572. o    If any modifiers are specified and an exclamation point
  25573.      (!) is not specified, it means that the listed modi-
  25574.      fiers must be in the correct state and ``don't care''
  25575.      about any other modifiers.
  25576.  
  25577. o    If a modifier is preceded by a tilde (~), it means that
  25578.      that modifier must not be asserted.
  25579.  
  25580. o    If ``None'' is specified, it means no modifiers can be
  25581.      asserted.
  25582.  
  25583. o    If a colon (:) is specified at the beginning of the
  25584.      modifier list, it directs the Intrinsics to apply any
  25585.      standard modifiers in the event to map the event key-
  25586.      code into a KeySym.  The default standard modifiers are
  25587.      Shift and Lock, with the interpretation as defined in X
  25588.      Window System Protocol, Section 5.  The resulting
  25589.      KeySym must exactly match the specified KeySym, and the
  25590.      nonstandard modifiers in the event must match the modi-
  25591.      fier list.  For example, ``:<Key>a'' is distinct from
  25592.      ``:<Key>A'', and ``:Shift<Key>A'' is distinct from
  25593.      ``:<Key>A''.
  25594.  
  25595. o    If both an exclamation point (!) and a colon (:) are
  25596.      specified at the beginning of the modifier list, it
  25597.      means that the listed modifiers must be in the correct
  25598.      state and that no other modifiers except the standard
  25599.      modifiers can be asserted.  Any standard modifiers in
  25600.      the event are applied as for colon (:) above.
  25601.  
  25602.  
  25603.  
  25604.  
  25605.  
  25606.                  378
  25607.  
  25608.  
  25609.  
  25610.  
  25611.  
  25612. X Toolkit Intrinsics                 X11 Release 6.4
  25613.  
  25614.  
  25615. o    If a colon (:) is not specified, no standard modifiers
  25616.      are applied.  Then, for example, ``<Key>A'' and
  25617.      ``<Key>a'' are equivalent.
  25618.  
  25619. In key sequences, a circumflex (^) is an abbreviation for
  25620. the Control modifier, a dollar sign ($) is an abbreviation
  25621. for Meta, and a backslash (\) can be used to quote any char-
  25622. acter, in particular a double quote ("), a circumflex (^), a
  25623. dollar sign ($), and another backslash (\).  Briefly:
  25624.  
  25625.  
  25626. No modifiers:         None <event> detail
  25627. Any modifiers:         <event> detail
  25628. Only these modifiers:     ! mod1 mod2 <event> detail
  25629. These modifiers and any others:mod1 mod2 <event> detail
  25630.  
  25631.  
  25632. The use of ``None'' for a modifier list is identical to the
  25633. use of an exclamation point with no modifers.
  25634.  
  25635.  
  25636. -----------------------------------------------------------
  25637. Modifier     Abbreviation   Meaning
  25638. -----------------------------------------------------------
  25639. Ctrl         c            Control modifier bit
  25640. Shift         s            Shift modifier bit
  25641. Lock         l            Lock modifier bit
  25642. Meta         m            Meta key modifier
  25643. Hyper         h            Hyper key modifier
  25644. Super         su         Super key modifier
  25645. Alt         a            Alt key modifier
  25646. Mod1                Mod1 modifier bit
  25647. Mod2                Mod2 modifier bit
  25648. Mod3                Mod3 modifier bit
  25649. Mod4                Mod4 modifier bit
  25650. Mod5                Mod5 modifier bit
  25651. Button1             Button1 modifier bit
  25652. Button2             Button2 modifier bit
  25653. Button3             Button3 modifier bit
  25654. Button4             Button4 modifier bit
  25655. Button5             Button5 modifier bit
  25656. None                No modifiers
  25657. Any                Any modifier combination
  25658. -----------------------------------------------------------
  25659.  
  25660.  
  25661. A key modifier is any modifier bit one of whose correspond-
  25662. ing KeyCodes contains the corresponding left or right
  25663. KeySym.  For example, ``m'' or ``Meta'' means any modifier
  25664. bit mapping to a KeyCode whose KeySym list contains
  25665. XK_Meta_L or XK_Meta_R.  Note that this interpretation is
  25666. for each display, not global or even for each application
  25667. context.  The Control, Shift, and Lock modifier names refer
  25668. explicitly to the corresponding modifier bits; there is no
  25669.  
  25670.  
  25671.  
  25672.                  379
  25673.  
  25674.  
  25675.  
  25676.  
  25677.  
  25678. X Toolkit Intrinsics                 X11 Release 6.4
  25679.  
  25680.  
  25681. additional interpretation of KeySyms for these modifiers.
  25682.  
  25683. Because it is possible to associate arbitrary KeySyms with
  25684. modifiers, the set of key modifiers is extensible.  The
  25685. ``@'' <keysym> syntax means any modifier bit whose corre-
  25686. sponding KeyCode contains the specified KeySym name.
  25687.  
  25688. A modifier_list/KeySym combination in a translation matches
  25689. a modifiers/KeyCode combination in an event in the following
  25690. ways:
  25691.  
  25692. 1.   If a colon (:) is used, the Intrinsics call the dis-
  25693.      play's XtKeyProc with the KeyCode and modifiers.  To
  25694.      match, (modifiers & ~modifiers_return) must equal modi-
  25695.      fier_list, and keysym_return must equal the given
  25696.      KeySym.
  25697.  
  25698. 2.   If (:) is not used, the Intrinsics mask off all don't-
  25699.      care bits from the modifiers.  This value must be equal
  25700.      to modifier_list.    Then, for each possible combination
  25701.      of don't-care modifiers in the modifier list, the
  25702.      Intrinsics call the display's XtKeyProc with the Key-
  25703.      Code and that combination ORed with the cared-about
  25704.      modifier bits from the event.  Keysym_return must match
  25705.      the KeySym in the translation.
  25706.  
  25707. Event Types
  25708.  
  25709. The event-type field describes XEvent types.  In addition to
  25710. the standard Xlib symbolic event type names, the following
  25711. event type synonyms are defined:
  25712.  
  25713. -------------------------------------------------
  25714. Type          Meaning
  25715. -------------------------------------------------
  25716. Key          KeyPress
  25717. KeyDown       KeyPress
  25718. KeyUp          KeyRelease
  25719. BtnDown       ButtonPress
  25720. BtnUp          ButtonRelease
  25721. Motion          MotionNotify
  25722. PtrMoved      MotionNotify
  25723. MouseMoved      MotionNotify
  25724. Enter          EnterNotify
  25725. EnterWindow      EnterNotify
  25726. Leave          LeaveNotify
  25727. LeaveWindow      LeaveNotify
  25728. FocusIn       FocusIn
  25729. FocusOut      FocusOut
  25730. Keymap          KeymapNotify
  25731. Expose          Expose
  25732. GrExp          GraphicsExpose
  25733. NoExp          NoExpose
  25734.  
  25735.  
  25736.  
  25737.  
  25738.                  380
  25739.  
  25740.  
  25741.  
  25742.  
  25743.  
  25744. X Toolkit Intrinsics                 X11 Release 6.4
  25745.  
  25746.  
  25747. -------------------------------------------------
  25748. Type          Meaning
  25749. -------------------------------------------------
  25750. Visible       VisibilityNotify
  25751. Create          CreateNotify
  25752. Destroy       DestroyNotify
  25753. Unmap          UnmapNotify
  25754. Map          MapNotify
  25755. MapReq          MapRequest
  25756. Reparent      ReparentNotify
  25757. Configure      ConfigureNotify
  25758. ConfigureReq      ConfigureRequest
  25759. Grav          GravityNotify
  25760. ResReq          ResizeRequest
  25761. Circ          CirculateNotify
  25762. CircReq       CirculateRequest
  25763. Prop          PropertyNotify
  25764. SelClr          SelectionClear
  25765. SelReq          SelectionRequest
  25766. Select          SelectionNotify
  25767. Clrmap          ColormapNotify
  25768. Message       ClientMessage
  25769. Mapping       MappingNotify
  25770. -------------------------------------------------
  25771.  
  25772. The supported abbreviations are:
  25773.  
  25774. ----------------------------------------------------------
  25775. Abbreviation      Event Type     Including
  25776. ----------------------------------------------------------
  25777. Ctrl          KeyPress     with Control modifier
  25778. Meta          KeyPress     with Meta modifier
  25779. Shift          KeyPress     with Shift modifier
  25780. Btn1Down      ButtonPress     with Button1 detail
  25781. Btn1Up          ButtonRe-     with Button1 detail
  25782.           lease
  25783. Btn2Down      ButtonPress     with Button2 detail
  25784. Btn2Up          ButtonRe-     with Button2 detail
  25785.           lease
  25786. Btn3Down      ButtonPress     with Button3 detail
  25787. Btn3Up          ButtonRe-     with Button3 detail
  25788.           lease
  25789. Btn4Down      ButtonPress     with Button4 detail
  25790. Btn4Up          ButtonRe-     with Button4 detail
  25791.           lease
  25792. Btn5Down      ButtonPress     with Button5 detail
  25793. Btn5Up          ButtonRe-     with Button5 detail
  25794.           lease
  25795. BtnMotion      MotionNotify     with any button modifier
  25796. Btn1Motion      MotionNotify     with Button1 modifier
  25797. Btn2Motion      MotionNotify     with Button2 modifier
  25798. Btn3Motion      MotionNotify     with Button3 modifier
  25799. Btn4Motion      MotionNotify     with Button4 modifier
  25800.  
  25801.  
  25802.  
  25803.  
  25804.                  381
  25805.  
  25806.  
  25807.  
  25808.  
  25809.  
  25810. X Toolkit Intrinsics                 X11 Release 6.4
  25811.  
  25812.  
  25813. ----------------------------------------------------------
  25814. Abbreviation      Event Type     Including
  25815. ----------------------------------------------------------
  25816. Btn5Motion      MotionNotify     with Button5 modifier
  25817. ----------------------------------------------------------
  25818.  
  25819.  
  25820.  
  25821. The detail field is event-specific and normally corresponds
  25822. to the detail field of the corresponding event as described
  25823. by X Window System Protocol, Section 11.  The detail field
  25824. is supported for the following event types:
  25825.  
  25826.  
  25827. ------------------------------------------------------
  25828. Event           Event Field
  25829. ------------------------------------------------------
  25830. KeyPress       KeySym from event detail (keycode)
  25831. KeyRelease       KeySym from event detail (keycode)
  25832. ButtonPress       button from event detail
  25833. ButtonRelease       button from event detail
  25834. MotionNotify       event detail
  25835. EnterNotify       event mode
  25836. LeaveNotify       event mode
  25837. FocusIn        event mode
  25838. FocusOut       event mode
  25839. PropertyNotify       atom
  25840. SelectionClear       selection
  25841. SelectionRequest   selection
  25842. SelectionNotify    selection
  25843. ClientMessage       type
  25844. MappingNotify       request
  25845. ------------------------------------------------------
  25846.  
  25847.  
  25848. If the event type is KeyPress or KeyRelease, the detail
  25849. field specifies a KeySym name in standard format which is
  25850. matched against the event as described above, for example,
  25851. <Key>A.
  25852.  
  25853. For the PropertyNotify, SelectionClear, SelectionRequest,
  25854. SelectionNotify, and ClientMessage events the detail field
  25855. is specified as an atom name; for example, <Message>WM_PRO-
  25856. TOCOLS.  For the MotionNotify, EnterNotify, LeaveNotify,
  25857. FocusIn, FocusOut, and MappingNotify events, either the sym-
  25858. bolic constants as defined by X Window System Protocol, Sec-
  25859. tion 11, or the numeric values may be specified.
  25860.  
  25861. If no detail field is specified, then any value in the event
  25862. detail is accepted as a match.
  25863.  
  25864. A KeySym can be specified as any of the standard KeySym
  25865. names, a hexadecimal number prefixed with ``0x'' or ``0X'',
  25866. an octal number prefixed with ``0'', or a decimal number.  A
  25867.  
  25868.  
  25869.  
  25870.                  382
  25871.  
  25872.  
  25873.  
  25874.  
  25875.  
  25876. X Toolkit Intrinsics                 X11 Release 6.4
  25877.  
  25878.  
  25879. KeySym expressed as a single digit is interpreted as the
  25880. corresponding Latin 1 KeySym, for example, ``0'' is the
  25881. KeySym XK_0.  Other single character KeySyms are treated as
  25882. literal constants from Latin 1, for example, ``!'' is
  25883. treated as 0x21.  Standard KeySym names are as defined in
  25884. <X11/keysymdef.h> with the ``XK_'' prefix removed.
  25885.  
  25886.  
  25887. Canonical Representation
  25888.  
  25889. Every translation table has a unique, canonical text repre-
  25890. sentation. This representation is passed to a widget's dis-
  25891. play_accelerator procedure to describe the accelerators
  25892. installed on that widget.  The canonical representation of a
  25893. translation table is (see also ``Syntax'')
  25894.  
  25895. translationTable   = { production }
  25896. production       = lhs ``:'' rhs ``\\n''
  25897. lhs           = event { ``,'' event  }
  25898. event           = [modifier_list] ``<''event_type``>'' [ ``('' count[``+''] ``)'' ] {detail}
  25899. modifier_list       = [``!''] [``:''] {modifier}
  25900. modifier       = [``~''] modifier_name
  25901. count           = (``1'' | ``2'' | ``3'' | ``4'' | ...)
  25902. modifier_name       = ``@'' <keysym> | <see canonical modifier names below>
  25903. event_type       = <see canonical event types below>
  25904. detail           = <event-specific details>
  25905. rhs           = { name ``('' [params] ``)'' }
  25906. name           = namechar { namechar }
  25907. namechar       = { ``a''-``z'' | ``A''-``Z'' | ``0''-``9'' | ``_'' | ``-'' }
  25908. params           = string {``,'' string}
  25909. string           = quoted_string
  25910. quoted_string       = ``"'' {<Latin 1 character> | escape_char} [``\\\\'' ] ``"''
  25911. escape_char       = ``\\"''
  25912.  
  25913.  
  25914. The canonical modifier names are
  25915.  
  25916.  
  25917.      Ctrl      Mod1          Button1
  25918.      Shift     Mod2          Button2
  25919.      Lock      Mod3          Button3
  25920.            Mod4          Button4
  25921.            Mod5          Button5
  25922.  
  25923.  
  25924. The canonical event types are
  25925.  
  25926.  
  25927.      KeyPress        KeyRelease
  25928.      ButtonPress    ButtonRelease
  25929.      MotionNotify    EnterNotify
  25930.      LeaveNotify    FocusIn
  25931.      FocusOut        KeymapNotify
  25932.  
  25933.  
  25934.  
  25935.  
  25936.                  383
  25937.  
  25938.  
  25939.  
  25940.  
  25941.  
  25942. X Toolkit Intrinsics                 X11 Release 6.4
  25943.  
  25944.  
  25945.      Expose        GraphicsExpose,
  25946.      NoExpose        VisibilityNotify
  25947.      CreateNotify    DestroyNotify
  25948.      UnmapNotify    MapNotify
  25949.      MapRequest     ReparentNotify
  25950.      ConfigureNotify    ConfigureRequest
  25951.      GravityNotify    ResizeRequest
  25952.      CirculateNotify    CirculateRequest
  25953.      PropertyNotify    SelectionClear
  25954.      SelectionRequest    SelectionNotify
  25955.      ColormapNotify    ClientMessage
  25956.  
  25957.  
  25958.  
  25959.  
  25960. Examples
  25961.  
  25962.  
  25963. o    Always put more specific events in the table before
  25964.      more general ones:
  25965.  
  25966.  
  25967.      Shift <Btn1Down> : twas()\n\
  25968.      <Btn1Down> : brillig()
  25969.  
  25970.  
  25971.  
  25972. o    For double-click on Button1 Up with Shift, use this
  25973.      specification:
  25974.  
  25975.  
  25976.       Shift<Btn1Up>(2) : and()
  25977.  
  25978.  
  25979.      This is equivalent to the following line with appropri-
  25980.      ate timers set between events:
  25981.  
  25982.  
  25983.       Shift<Btn1Down>,Shift<Btn1Up>,Shift<Btn1Down>,Shift<Btn1Up> : and()
  25984.  
  25985.  
  25986. o    For double-click on Button1 Down with Shift, use this
  25987.      specification:
  25988.  
  25989.  
  25990.       Shift<Btn1Down>(2) : the()
  25991.  
  25992.  
  25993.      This is equivalent to the following line with appropri-
  25994.      ate timers set between events:
  25995.  
  25996.  
  25997.       Shift<Btn1Down>,Shift<Btn1Up>,Shift<Btn1Down> : the()
  25998.  
  25999.  
  26000.  
  26001.  
  26002.                  384
  26003.  
  26004.  
  26005.  
  26006.  
  26007.  
  26008. X Toolkit Intrinsics                 X11 Release 6.4
  26009.  
  26010.  
  26011. o    Mouse motion is always discarded when it occurs between
  26012.      events in a table where no motion event is specified:
  26013.  
  26014.  
  26015.       <Btn1Down>,<Btn1Up> : slithy()
  26016.  
  26017.  
  26018.      This is taken, even if the pointer moves a bit between
  26019.      the down and up events.  Similarly, any motion event
  26020.      specified in a translation matches any number of motion
  26021.      events.  If the motion event causes an action procedure
  26022.      to be invoked, the procedure is invoked after each
  26023.      motion event.
  26024.  
  26025. o    If an event sequence consists of a sequence of events
  26026.      that is also a noninitial subsequence of another trans-
  26027.      lation, it is not taken if it occurs in the context of
  26028.      the longer sequence.  This occurs mostly in sequences
  26029.      like the following:
  26030.  
  26031.  
  26032.       <Btn1Down>,<Btn1Up> : toves()\n\
  26033.       <Btn1Up> :  did()
  26034.  
  26035.  
  26036.      The second translation is taken only if the button
  26037.      release is not preceded by a button press or if there
  26038.      are intervening events between the press and the
  26039.      release.  Be particularly aware of this when using the
  26040.      repeat notation, above, with buttons and keys, because
  26041.      their expansion includes additional events; and when
  26042.      specifying motion events, because they are implicitly
  26043.      included between any two other events.  In particular,
  26044.      pointer motion and double-click translations cannot
  26045.      coexist in the same translation table.
  26046.  
  26047. o    For single click on Button1 Up with Shift and Meta, use
  26048.      this specification:
  26049.  
  26050.  
  26051.       Shift Meta <Btn1Down>, Shift Meta<Btn1Up>: gyre()
  26052.  
  26053.  
  26054. o    For multiple clicks greater or equal to a minimum num-
  26055.      ber, a plus sign (+) may be appended to the final
  26056.      (rightmost) count in an event sequence.  The actions
  26057.      will be invoked on the count-th click and each subse-
  26058.      quent one arriving within the multi-click time inter-
  26059.      val.  For example:
  26060.  
  26061.  
  26062.       Shift <Btn1Up>(2+) : and()
  26063.  
  26064.  
  26065.  
  26066.  
  26067.  
  26068.                  385
  26069.  
  26070.  
  26071.  
  26072.  
  26073.  
  26074. X Toolkit Intrinsics                 X11 Release 6.4
  26075.  
  26076.  
  26077. o    To indicate EnterNotify with any modifiers, use this
  26078.      specification:
  26079.  
  26080.  
  26081.       <Enter> : gimble()
  26082.  
  26083.  
  26084. o    To indicate EnterNotify with no modifiers, use this
  26085.      specification:
  26086.  
  26087.  
  26088.       None <Enter> : in()
  26089.  
  26090.  
  26091. o    To indicate EnterNotify with Button1 Down and Button2
  26092.      Up and ``don't care'' about the other modifiers, use
  26093.      this specification:
  26094.  
  26095.  
  26096.       Button1 ~Button2 <Enter> : the()
  26097.  
  26098.  
  26099. o    To indicate EnterNotify with Button1 down and Button2
  26100.      down exclusively, use this specification:
  26101.  
  26102.  
  26103.       ! Button1 Button2 <Enter> : wabe()
  26104.  
  26105.  
  26106.      You do not need to use a tilde (~) with an exclamation
  26107.      point (!).
  26108.  
  26109.  
  26110.  
  26111.  
  26112.  
  26113.  
  26114.  
  26115.  
  26116.  
  26117.  
  26118.  
  26119.  
  26120.  
  26121.  
  26122.  
  26123.  
  26124.  
  26125.  
  26126.  
  26127.  
  26128.  
  26129.  
  26130.  
  26131.  
  26132.  
  26133.  
  26134.                  386
  26135.  
  26136.  
  26137.  
  26138.  
  26139.  
  26140. X Toolkit Intrinsics                 X11 Release 6.4
  26141.  
  26142.  
  26143.  
  26144.  
  26145.                Appendix C
  26146.  
  26147.              Compatibility Functions
  26148.  
  26149.  
  26150.  
  26151.  
  26152. In prototype versions of the X Toolkit each widget class
  26153. implemented an Xt<Widget>Create (for example, XtLabelCreate)
  26154. function, in which most of the code was identical from wid-
  26155. get to widget.    In the Intrinsics, a single generic XtCre-
  26156. ateWidget performs most of the common work and then calls
  26157. the initialize procedure implemented for the particular wid-
  26158. get class.
  26159.  
  26160. Each Composite class also implemented the procedures
  26161. Xt<Widget>Add and an Xt<Widget>Delete (for example, XtBut-
  26162. tonBoxAddButton and XtButtonBoxDeleteButton).  In the
  26163. Intrinsics, the Composite generic procedures XtManageChil-
  26164. dren and XtUnmanageChildren perform error checking and
  26165. screening out of certain children.  Then they call the
  26166. change_managed procedure implemented for the widget's Com-
  26167. posite class.  If the widget's parent has not yet been real-
  26168. ized, the call to the change_managed procedure is delayed
  26169. until realization time.
  26170.  
  26171. Old-style calls can be implemented in the X Toolkit by
  26172. defining one-line procedures or macros that invoke a generic
  26173. routine.  For example, you could define the macro XtLabel-
  26174. Create as:
  26175.  
  26176.  
  26177.      #define XtLabelCreate(name, parent, args, num_args) \
  26178.          ((LabelWidget) XtCreateWidget(name, labelWidgetClass,   parent, args, num_args))
  26179.  
  26180.  
  26181.  
  26182. Pop-up shells in some of the prototypes automatically per-
  26183. formed an XtManageChild on their child within their
  26184. insert_child procedure.  Creators of pop-up children need to
  26185. call XtManageChild themselves.
  26186.  
  26187.  
  26188. XtAppInitialize and XtVaAppInitialize have been replaced by
  26189. XtOpenApplication and XtVaOpenApplication.
  26190.  
  26191. To initialize the Intrinsics internals, create an applica-
  26192. tion context, open and initialize a display, and create the
  26193. initial application shell instance, an application may use
  26194. -----------
  26195. This appendix is part of the formal Intrinsics
  26196. Specification.
  26197.  
  26198.  
  26199.  
  26200.                  387
  26201.  
  26202.  
  26203.  
  26204.  
  26205.  
  26206. X Toolkit Intrinsics                 X11 Release 6.4
  26207.  
  26208.  
  26209. XtAppInitialize or XtVaAppInitialize.
  26210.  
  26211. __
  26212. |
  26213. Widget XtAppInitialize(app_context_return, application_class, options, num_options,
  26214.                argc_in_out, argv_in_out, fallback_resources, args, num_args)
  26215.       XtAppContext *app_context_return;
  26216.       String application_class;
  26217.       XrmOptionDescList options;
  26218.       Cardinal num_options;
  26219.       int *argc_in_out;
  26220.       String *argv_in_out;
  26221.       String *fallback_resources;
  26222.       ArgList args;
  26223.       Cardinal num_args;
  26224.  
  26225.  
  26226. app_context_return
  26227.            Returns the application context, if non-NULL.
  26228.  
  26229. application_class
  26230.            Specifies the class name of the application.
  26231.  
  26232. options        Specifies the command line options table.
  26233.  
  26234. num_options    Specifies the number of entries in options.
  26235.  
  26236. argc_in_out    Specifies a pointer to the number of command
  26237.            line arguments.
  26238.  
  26239. argv_in_out    Specifies a pointer to the command line argu-
  26240.            ments.
  26241.  
  26242. fallback_resources
  26243.            Specifies resource values to be used if the
  26244.            application class resource file cannot be
  26245.            opened or read, or NULL.
  26246.  
  26247. args           Specifies the argument list to override any
  26248.            other resource specifications for the created
  26249.            shell widget.
  26250.  
  26251. num_args       Specifies the number of entries in the argu-
  26252.            ment list.
  26253. |__
  26254.  
  26255. The XtAppInitialize function calls XtToolkitInitialize fol-
  26256. lowed by XtCreateApplicationContext, then calls XtOpenDis-
  26257. play with display_string NULL and application_name NULL, and
  26258. finally calls XtAppCreateShell with application_name NULL,
  26259. widget_class applicationShellWidgetClass, and the specified
  26260. args and num_args and returns the created shell.  The modi-
  26261. fied argc and argv returned by XtDisplayInitialize are
  26262. returned in argc_in_out and argv_in_out.  If
  26263.  
  26264.  
  26265.  
  26266.                  388
  26267.  
  26268.  
  26269.  
  26270.  
  26271.  
  26272. X Toolkit Intrinsics                 X11 Release 6.4
  26273.  
  26274.  
  26275. app_context_return is not NULL, the created application con-
  26276. text is also returned.    If the display specified by the com-
  26277. mand line cannot be opened, an error message is issued and
  26278. XtAppInitialize terminates the application.  If fall-
  26279. back_resources is non-NULL, XtAppSetFallbackResources is
  26280. called with the value prior to calling XtOpenDisplay.
  26281.  
  26282.  
  26283. __
  26284. |
  26285. Widget XtVaAppInitialize(app_context_return, application_class, options, num_options,
  26286.              argc_in_out, argv_in_out, fallback_resources, ...)
  26287.     XtAppContext *app_context_return;
  26288.     String application_class;
  26289.     XrmOptionDescList options;
  26290.     Cardinal num_options;
  26291.     int *argc_in_out;
  26292.     String *argv_in_out;
  26293.     String *fallback_resources;
  26294.  
  26295.  
  26296. app_context_return
  26297.            Returns the application context, if non-NULL.
  26298.  
  26299. application_class
  26300.            Specifies the class name of the application.
  26301.  
  26302. options        Specifies the command line options table.
  26303.  
  26304. num_options    Specifies the number of entries in options.
  26305.  
  26306. argc_in_out    Specifies a pointer to the number of command
  26307.            line arguments.
  26308.  
  26309. argv_in_out    Specifies the command line arguments array.
  26310.  
  26311. fallback_resources
  26312.            Specifies resource values to be used if the
  26313.            application class resource file cannot be
  26314.            opened, or NULL.
  26315.  
  26316. ...           Specifies the variable argument list to over-
  26317.            ride any other resource specifications for
  26318.            the created shell.
  26319. |__
  26320.  
  26321. The XtVaAppInitialize procedure is identical in function to
  26322. XtAppInitialize with the args and num_args parameters
  26323. replaced by a varargs list, as described in Section 2.5.1.
  26324.  
  26325.  
  26326. As a convenience to people converting from earlier versions
  26327. of the toolkit without application contexts, the following
  26328. routines exist: XtInitialize, XtMainLoop, XtNextEvent,
  26329.  
  26330.  
  26331.  
  26332.                  389
  26333.  
  26334.  
  26335.  
  26336.  
  26337.  
  26338. X Toolkit Intrinsics                 X11 Release 6.4
  26339.  
  26340.  
  26341. XtProcessEvent, XtPeekEvent, XtPending, XtAddInput,
  26342. XtAddTimeOut, XtAddWorkProc, XtCreateApplicationShell,
  26343. XtAddActions, XtSetSelectionTimeout, and
  26344. XtGetSelectionTimeout.
  26345.  
  26346. __
  26347. |
  26348. Widget XtInitialize(shell_name, application_class, options, num_options, argc, argv)
  26349.       String shell_name;
  26350.       String application_class;
  26351.       XrmOptionDescRec options[];
  26352.       Cardinal num_options;
  26353.       int *argc;
  26354.       String argv[];
  26355.  
  26356.  
  26357. shell_name
  26358.       This parameter is ignored; therefore, you can
  26359.       specify NULL.
  26360.  
  26361. application_class
  26362.       Specifies the class name of this application.
  26363.  
  26364. options   Specifies how to parse the command line for any
  26365.       application-specific resources.  The options argu-
  26366.       ment is passed as a parameter to XrmParseCommand.
  26367.  
  26368. num_options
  26369.       Specifies the number of entries in the options
  26370.       list.
  26371.  
  26372. argc      Specifies a pointer to the number of command line
  26373.       parameters.
  26374.  
  26375. argv      Specifies the command line parameters.
  26376. |__
  26377.  
  26378. XtInitialize calls XtToolkitInitialize to initialize the
  26379. toolkit internals, creates a default application context for
  26380. use by the other convenience routines, calls XtOpenDisplay
  26381. with display_string NULL and application_name NULL, and
  26382. finally calls XtAppCreateShell with application_name NULL
  26383. and returns the created shell.    The semantics of calling
  26384. XtInitialize more than once are undefined.  This routine has
  26385. been replaced by XtOpenApplication.
  26386.  
  26387. __
  26388. |
  26389. void XtMainLoop(void)
  26390.  
  26391. |__
  26392.  
  26393. XtMainLoop first reads the next alternate input, timer, or X
  26394. event by calling XtNextEvent.  Then it dispatches this to
  26395.  
  26396.  
  26397.  
  26398.                  390
  26399.  
  26400.  
  26401.  
  26402.  
  26403.  
  26404. X Toolkit Intrinsics                 X11 Release 6.4
  26405.  
  26406.  
  26407. the appropriate registered procedure by calling
  26408. XtDispatchEvent.  This routine has been replaced by
  26409. XtAppMainLoop.
  26410.  
  26411. __
  26412. |
  26413. void XtNextEvent(event_return)
  26414.       XEvent *event_return;
  26415.  
  26416.  
  26417. event_return
  26418.       Returns the event information to the specified
  26419.       event structure.
  26420. |__
  26421.  
  26422. If no input is on the X input queue for the default applica-
  26423. tion context, XtNextEvent flushes the X output buffer and
  26424. waits for an event while looking at the alternate input
  26425. sources and timeout values and calling any callback proce-
  26426. dures triggered by them.  This routine has been replaced by
  26427. XtAppNextEvent.  XtInitialize must be called before using
  26428. this routine.
  26429.  
  26430. __
  26431. |
  26432. void XtProcessEvent(mask)
  26433.       XtInputMask mask;
  26434.  
  26435.  
  26436. mask      Specifies the type of input to process.
  26437. |__
  26438.  
  26439. XtProcessEvent processes one X event, timeout, or alternate
  26440. input source (depending on the value of mask), blocking if
  26441. necessary.  It has been replaced by XtAppProcessEvent.
  26442. XtInitialize must be called before using this function.
  26443.  
  26444. __
  26445. |
  26446. Boolean XtPeekEvent(event_return)
  26447.       XEvent *event_return;
  26448.  
  26449.  
  26450. event_return
  26451.       Returns the event information to the specified
  26452.       event structure.
  26453. |__
  26454.  
  26455. If there is an event in the queue for the default applica-
  26456. tion context, XtPeekEvent fills in the event and returns a
  26457. nonzero value.    If no X input is on the queue, XtPeekEvent
  26458. flushes the output buffer and blocks until input is avail-
  26459. able, possibly calling some timeout callbacks in the pro-
  26460. cess.  If the input is an event, XtPeekEvent fills in the
  26461.  
  26462.  
  26463.  
  26464.                  391
  26465.  
  26466.  
  26467.  
  26468.  
  26469.  
  26470. X Toolkit Intrinsics                 X11 Release 6.4
  26471.  
  26472.  
  26473. event and returns a nonzero value.  Otherwise, the input is
  26474. for an alternate input source, and XtPeekEvent returns zero.
  26475. This routine has been replaced by XtAppPeekEvent.  XtIni-
  26476. tialize must be called before using this routine.
  26477.  
  26478. __
  26479. |
  26480. Boolean XtPending()
  26481.  
  26482. |__
  26483.  
  26484. XtPending returns a nonzero value if there are events pend-
  26485. ing from the X server or alternate input sources in the
  26486. default application context.  If there are no events pend-
  26487. ing, it flushes the output buffer and returns a zero value.
  26488. It has been replaced by XtAppPending.  XtInitialize must be
  26489. called before using this routine.
  26490.  
  26491. __
  26492. |
  26493. XtInputId XtAddInput(source, condition, proc, client_data)
  26494.       int source;
  26495.       XtPointer condition;
  26496.       XtInputCallbackProc proc;
  26497.       XtPointer client_data;
  26498.  
  26499.  
  26500. source      Specifies the source file descriptor on a POSIX-
  26501.       based system or other operating-system-dependent
  26502.       device specification.
  26503.  
  26504. condition Specifies the mask that indicates either a read,
  26505.       write, or exception condition or some operating-
  26506.       system-dependent condition.
  26507.  
  26508. proc      Specifies the procedure called when input is
  26509.       available.
  26510.  
  26511. client_data
  26512.       Specifies the parameter to be passed to proc when
  26513.       input is available.
  26514. |__
  26515.  
  26516. The XtAddInput function registers in the default application
  26517. context a new source of events, which is usually file input
  26518. but can also be file output.  (The word file should be
  26519. loosely interpreted to mean any sink or source of data.)
  26520. XtAddInput also specifies the conditions under which the
  26521. source can generate events.  When input is pending on this
  26522. source in the default application context, the callback pro-
  26523. cedure is called.  This routine has been replaced by
  26524. XtAppAddInput.    XtInitialize must be called before using
  26525. this routine.
  26526.  
  26527.  
  26528.  
  26529.  
  26530.                  392
  26531.  
  26532.  
  26533.  
  26534.  
  26535.  
  26536. X Toolkit Intrinsics                 X11 Release 6.4
  26537.  
  26538. __
  26539. |
  26540. XtIntervalId XtAddTimeOut(interval, proc, client_data)
  26541.       unsigned long interval;
  26542.       XtTimerCallbackProc proc;
  26543.       XtPointer client_data;
  26544.  
  26545.  
  26546. interval  Specifies the time interval in milliseconds.
  26547.  
  26548. proc      Specifies the procedure to be called when time
  26549.       expires.
  26550.  
  26551. client_data
  26552.       Specifies the parameter to be passed to proc when
  26553.       it is called.
  26554. |__
  26555.  
  26556. The XtAddTimeOut function creates a timeout in the default
  26557. application context and returns an identifier for it.  The
  26558. timeout value is set to interval.  The callback procedure
  26559. will be called after the time interval elapses, after which
  26560. the timeout is removed.  This routine has been replaced by
  26561. XtAppAddTimeOut.  XtInitialize must be called before using
  26562. this routine.
  26563.  
  26564. __
  26565. |
  26566. XtWorkProcId XtAddWorkProc(proc, client_data)
  26567.       XtWorkProc proc;
  26568.       XtPointer client_data;
  26569.  
  26570.  
  26571. proc      Procedure to call to do the work.
  26572.  
  26573. client_data
  26574.       Client data to pass to proc when it is called.
  26575. |__
  26576.  
  26577. This routine registers a work procedure in the default
  26578. application context. It has been replaced by
  26579. XtAppAddWorkProc.  XtInitialize must be called before using
  26580. this routine.
  26581.  
  26582.  
  26583.  
  26584.  
  26585.  
  26586.  
  26587.  
  26588.  
  26589.  
  26590.  
  26591.  
  26592.  
  26593.  
  26594.  
  26595.  
  26596.                  393
  26597.  
  26598.  
  26599.  
  26600.  
  26601.  
  26602. X Toolkit Intrinsics                 X11 Release 6.4
  26603.  
  26604. __
  26605. |
  26606. Widget XtCreateApplicationShell(name, widget_class, args, num_args)
  26607.       String name;
  26608.       WidgetClass widget_class;
  26609.       ArgList args;
  26610.       Cardinal num_args;
  26611.  
  26612.  
  26613. name      This parameter is ignored; therefore, you can
  26614.       specify NULL.
  26615.  
  26616. widget_class
  26617.       Specifies the widget class pointer for the created
  26618.       application shell widget.  This will usually be
  26619.       topLevelShellWidgetClass or a subclass thereof.
  26620.  
  26621. args      Specifies the argument list to override  any other
  26622.       resource specifications.
  26623.  
  26624. num_args  Specifies the number of entries in args.
  26625. |__
  26626.  
  26627. The procedure XtCreateApplicationShell calls XtAppCre-
  26628. ateShell with application_name NULL, the application class
  26629. passed to XtInitialize, and the default application context
  26630. created by XtInitialize.  This routine has been replaced by
  26631. XtAppCreateShell.
  26632.  
  26633.  
  26634. An old-format resource type converter procedure pointer is
  26635. of type XtConverter.
  26636.  
  26637. __
  26638. |
  26639. typedef void (*XtConverter)(XrmValue*, Cardinal*, XrmValue*, XrmValue*);
  26640.       XrmValue *args;
  26641.       Cardinal *num_args;
  26642.       XrmValue *from;
  26643.       XrmValue *to;
  26644.  
  26645.  
  26646. args      Specifies a list of additional XrmValue arguments
  26647.       to the converter if additional context is needed
  26648.       to perform the conversion, or NULL.
  26649.  
  26650. num_args  Specifies the number of entries in args.
  26651.  
  26652. from      Specifies the value to convert.
  26653.  
  26654. to      Specifies the descriptor to use to return the con-
  26655.       verted value.
  26656. |__
  26657.  
  26658. Type converters should perform the following actions:
  26659.  
  26660.  
  26661.  
  26662.                  394
  26663.  
  26664.  
  26665.  
  26666.  
  26667.  
  26668. X Toolkit Intrinsics                 X11 Release 6.4
  26669.  
  26670.  
  26671. o    Check to see that the number of arguments passed is
  26672.      correct.
  26673.  
  26674. o    Attempt the type conversion.
  26675.  
  26676. o    If successful, return the size and pointer to the data
  26677.      in the to argument; otherwise, call XtWarningMsg and
  26678.      return without modifying the to argument.
  26679.  
  26680. Most type converters just take the data described by the
  26681. specified from argument and return data by writing into the
  26682. specified to argument.    A few need other information, which
  26683. is available in the specified argument list.  A type con-
  26684. verter can invoke another type converter, which allows dif-
  26685. fering sources that may convert into a common intermediate
  26686. result to make maximum use of the type converter cache.
  26687.  
  26688. Note that the address returned in to->addr cannot be that of
  26689. a local variable of the converter because this is not valid
  26690. after the converter returns.  It should be a pointer to a
  26691. static variable.
  26692.  
  26693. The procedure type XtConverter has been replaced by
  26694. XtTypeConverter.
  26695.  
  26696.  
  26697. The XtStringConversionWarning function is a convenience rou-
  26698. tine for old-format resource converters that convert from
  26699. strings.
  26700.  
  26701. __
  26702. |
  26703. void XtStringConversionWarning(src, dst_type)
  26704.       String src, dst_type;
  26705.  
  26706.  
  26707. src      Specifies the string that could not be converted.
  26708.  
  26709. dst_type  Specifies the name of the type to which the string
  26710.       could not be converted.
  26711. |__
  26712.  
  26713. The XtStringConversionWarning function issues a warning mes-
  26714. sage with name ``conversionError'', type ``string'', class
  26715. ``XtToolkitError, and the default message string ``Cannot
  26716. convert "src" to type dst_type''.  This routine has been
  26717. superseded by XtDisplayStringConversionWarning.
  26718.  
  26719.  
  26720. To register an old-format converter, use XtAddConverter or
  26721. XtAppAddConverter.
  26722.  
  26723.  
  26724.  
  26725.  
  26726.  
  26727.  
  26728.                  395
  26729.  
  26730.  
  26731.  
  26732.  
  26733.  
  26734. X Toolkit Intrinsics                 X11 Release 6.4
  26735.  
  26736. __
  26737. |
  26738. void XtAddConverter(from_type, to_type, converter, convert_args, num_args)
  26739.       String from_type;
  26740.       String to_type;
  26741.       XtConverter converter;
  26742.       XtConvertArgList convert_args;
  26743.       Cardinal num_args;
  26744.  
  26745.  
  26746. from_type Specifies the source type.
  26747.  
  26748. to_type   Specifies the destination type.
  26749.  
  26750. converter Specifies the type converter procedure.
  26751.  
  26752. convert_args
  26753.       Specifies how to compute the additional arguments
  26754.       to the converter, or NULL.
  26755.  
  26756. num_args  Specifies the number of entries in convert_args.
  26757.  
  26758. |__
  26759.  
  26760. XtAddConverter is equivalent in function to XtSetTypeCon-
  26761. verter with cache_type equal to XtCacheAll for old-format
  26762. type converters.  It has been superseded by
  26763. XtSetTypeConverter.
  26764.  
  26765.  
  26766.  
  26767.  
  26768.  
  26769.  
  26770.  
  26771.  
  26772.  
  26773.  
  26774.  
  26775.  
  26776.  
  26777.  
  26778.  
  26779.  
  26780.  
  26781.  
  26782.  
  26783.  
  26784.  
  26785.  
  26786.  
  26787.  
  26788.  
  26789.  
  26790.  
  26791.  
  26792.  
  26793.  
  26794.                  396
  26795.  
  26796.  
  26797.  
  26798.  
  26799.  
  26800. X Toolkit Intrinsics                 X11 Release 6.4
  26801.  
  26802. __
  26803. |
  26804. void XtAppAddConverter(app_context, from_type, to_type, converter, convert_args, num_args)
  26805.       XtAppContext app_context;
  26806.       String from_type;
  26807.       String to_type;
  26808.       XtConverter converter;
  26809.       XtConvertArgList convert_args;
  26810.       Cardinal num_args;
  26811.  
  26812.  
  26813. app_context
  26814.       Specifies the application context.
  26815.  
  26816. from_type Specifies the source type.
  26817.  
  26818. to_type   Specifies the destination type.
  26819.  
  26820. converter Specifies the type converter procedure.
  26821.  
  26822. convert_args
  26823.       Specifies how to compute the additional arguments
  26824.       to the converter, or NULL.
  26825.  
  26826. num_args  Specifies the number of entries in convert_args.
  26827. |__
  26828.  
  26829. XtAppAddConverter is equivalent in function to XtAppSetType-
  26830. Converter with cache_type equal to XtCacheAll for old-format
  26831. type converters.  It has been superseded by
  26832. XtAppSetTypeConverter.
  26833.  
  26834.  
  26835. To invoke resource conversions, a client may use XtConvert
  26836. or, for old-format converters only, XtDirectConvert.
  26837.  
  26838.  
  26839.  
  26840.  
  26841.  
  26842.  
  26843.  
  26844.  
  26845.  
  26846.  
  26847.  
  26848.  
  26849.  
  26850.  
  26851.  
  26852.  
  26853.  
  26854.  
  26855.  
  26856.  
  26857.  
  26858.  
  26859.  
  26860.                  397
  26861.  
  26862.  
  26863.  
  26864.  
  26865.  
  26866. X Toolkit Intrinsics                 X11 Release 6.4
  26867.  
  26868. __
  26869. |
  26870. void XtConvert(w, from_type, from, to_type, to_return)
  26871.       Widget w;
  26872.       String from_type;
  26873.       XrmValuePtr from;
  26874.       String to_type;
  26875.       XrmValuePtr to_return;
  26876.  
  26877.  
  26878. w      Specifies the widget to use for additional argu-
  26879.       ments, if any are needed.
  26880.  
  26881. from_type Specifies the source type.
  26882.  
  26883. from      Specifies the value to be converted.
  26884.  
  26885. to_type   Specifies the destination type.
  26886.  
  26887. to_return Returns the converted value.
  26888.  
  26889.  
  26890. void XtDirectConvert(converter, args, num_args, from, to_return)
  26891.       XtConverter converter;
  26892.       XrmValuePtr args;
  26893.       Cardinal num_args;
  26894.       XrmValuePtr from;
  26895.       XrmValuePtr to_return;
  26896.  
  26897.  
  26898. converter Specifies the conversion procedure to be called.
  26899.  
  26900. args      Specifies the argument list that contains the
  26901.       additional arguments needed to perform the conver-
  26902.       sion (often NULL).
  26903.  
  26904. num_args  Specifies the number of entries in args.
  26905.  
  26906. from      Specifies the value to be converted.
  26907.  
  26908. to_return Returns the converted value.
  26909. |__
  26910.  
  26911. The XtConvert function looks up the type converter regis-
  26912. tered to convert from_type to to_type, computes any addi-
  26913. tional arguments needed, and then calls XtDirectConvert or
  26914. XtCallConverter.  The XtDirectConvert function looks in the
  26915. converter cache to see if this conversion procedure has been
  26916. called with the specified arguments.  If so, it returns a
  26917. descriptor for information stored in the cache; otherwise,
  26918. it calls the converter and enters the result in the cache.
  26919.  
  26920. Before calling the specified converter, XtDirectConvert sets
  26921. the return value size to zero and the return value address
  26922. to NULL.  To determine if the conversion was successful, the
  26923.  
  26924.  
  26925.  
  26926.                  398
  26927.  
  26928.  
  26929.  
  26930.  
  26931.  
  26932. X Toolkit Intrinsics                 X11 Release 6.4
  26933.  
  26934.  
  26935. client should check to_return.addr for non-NULL.  The data
  26936. returned by XtConvert must be copied immediately by the
  26937. caller, as it may point to static data in the type con-
  26938. verter.
  26939.  
  26940. XtConvert has been replaced by XtConvertAndStore, and XtDi-
  26941. rectConvert has been superseded by XtCallConverter.
  26942.  
  26943.  
  26944. To deallocate a shared GC when it is no longer needed, use
  26945. XtDestroyGC.
  26946.  
  26947. __
  26948. |
  26949. void XtDestroyGC(w, gc)
  26950.       Widget w;
  26951.       GC gc;
  26952.  
  26953.  
  26954. w      Specifies any object on the display for which the
  26955.       shared GC was created.  Must be of class Object or
  26956.       any subclass thereof.
  26957.  
  26958. gc      Specifies the shared GC to be deallocated.
  26959. |__
  26960.  
  26961. References to sharable GCs are counted and a free request is
  26962. generated to the server when the last user of a given GC
  26963. destroys it.  Note that some earlier versions of XtDestroyGC
  26964. had only a gc argument.  Therefore, this function is not
  26965. very portable, and you are encouraged to use XtReleaseGC
  26966. instead.
  26967.  
  26968.  
  26969. To declare an action table in the default application con-
  26970. text and register it with the translation manager, use
  26971. XtAddActions.
  26972.  
  26973. __
  26974. |
  26975. void XtAddActions(actions, num_actions)
  26976.       XtActionList actions;
  26977.       Cardinal num_actions;
  26978.  
  26979.  
  26980. actions   Specifies the action table to register.
  26981.  
  26982. num_actions
  26983.       Specifies the number of entries in actions.
  26984. |__
  26985.  
  26986. If more than one action is registered with the same name,
  26987. the most recently registered action is used.  If duplicate
  26988. actions exist in an action table, the first is used.  The
  26989.  
  26990.  
  26991.  
  26992.                  399
  26993.  
  26994.  
  26995.  
  26996.  
  26997.  
  26998. X Toolkit Intrinsics                 X11 Release 6.4
  26999.  
  27000.  
  27001. Intrinsics register an action table for XtMenuPopup and
  27002. XtMenuPopdown as part of X Toolkit initialization.  This
  27003. routine has been replaced by XtAppAddActions.  XtInitialize
  27004. must be called before using this routine.
  27005.  
  27006.  
  27007. To set the Intrinsics selection timeout in the default
  27008. application context, use XtSetSelectionTimeout.
  27009.  
  27010. __
  27011. |
  27012. void XtSetSelectionTimeout(timeout)
  27013.       unsigned long timeout;
  27014.  
  27015.  
  27016. timeout   Specifies the selection timeout in milliseconds.
  27017.       This routine has been replaced by
  27018.       XtAppSetSelectionTimeout.  XtInitialize must be
  27019.       called before using this routine.
  27020. |__
  27021.  
  27022.  
  27023.  
  27024. To get the current selection timeout value in the default
  27025. application context, use XtGetSelectionTimeout.
  27026.  
  27027. __
  27028. |
  27029. unsigned long XtGetSelectionTimeout()
  27030.  
  27031. |__
  27032.  
  27033. The selection timeout is the time within which the two com-
  27034. municating applications must respond to one another.  If one
  27035. of them does not respond within this interval, the Intrin-
  27036. sics abort the selection request.
  27037.  
  27038. This routine has been replaced by XtAppGetSelectionTimeout.
  27039. XtInitialize must be called before using this routine.
  27040.  
  27041.  
  27042. To obtain the global error database (for example, to merge
  27043. with an application- or widget-specific database), use
  27044. XtGetErrorDatabase.
  27045.  
  27046. __
  27047. |
  27048. XrmDatabase *XtGetErrorDatabase()
  27049.  
  27050. |__
  27051.  
  27052. The XtGetErrorDatabase function returns the address of the
  27053. error database.  The Intrinsics do a lazy binding of the
  27054. error database and do not merge in the database file until
  27055.  
  27056.  
  27057.  
  27058.                  400
  27059.  
  27060.  
  27061.  
  27062.  
  27063.  
  27064. X Toolkit Intrinsics                 X11 Release 6.4
  27065.  
  27066.  
  27067. the first call to XtGetErrorDatbaseText.  This routine has
  27068. been replaced by XtAppGetErrorDatabase.
  27069.  
  27070.  
  27071. An error message handler can obtain the error database text
  27072. for an error or a warning by calling XtGetErrorDatabaseText.
  27073.  
  27074. __
  27075. |
  27076. void XtGetErrorDatabaseText(name, type, class, default, buffer_return, nbytes)
  27077.       String name, type, class;
  27078.       String default;
  27079.       String buffer_return;
  27080.       int nbytes;
  27081.  
  27082.  
  27083. name
  27084.  
  27085. type      Specify the name and type that are concatenated to
  27086.       form the resource name of the error message.
  27087.  
  27088. class      Specifies the resource class of the error message.
  27089.  
  27090. default   Specifies the default message to use if an error
  27091.       database entry is not found.
  27092.  
  27093. buffer_return
  27094.       Specifies the buffer into which the error message
  27095.       is to be returned.
  27096.  
  27097. nbytes      Specifies the size of the buffer in bytes.
  27098. |__
  27099.  
  27100. The XtGetErrorDatabaseText returns the appropriate message
  27101. from the error database associated with the default applica-
  27102. tion context or returns the specified default message if one
  27103. is not found in the error database.  To form the full
  27104. resource name and class when querying the database, the name
  27105. and type are concatenated with a single ``.''  between them
  27106. and the class is concatenated with itself with a single
  27107. ``.'' if it does not already contain a ``.''.  This routine
  27108. has been superseded by XtAppGetErrorDatabaseText.
  27109.  
  27110.  
  27111. To register a procedure to be called on fatal error condi-
  27112. tions, use XtSetErrorMsgHandler.
  27113.  
  27114.  
  27115.  
  27116.  
  27117.  
  27118.  
  27119.  
  27120.  
  27121.  
  27122.  
  27123.  
  27124.                  401
  27125.  
  27126.  
  27127.  
  27128.  
  27129.  
  27130. X Toolkit Intrinsics                 X11 Release 6.4
  27131.  
  27132. __
  27133. |
  27134. void XtSetErrorMsgHandler(msg_handler)
  27135.       XtErrorMsgHandler msg_handler;
  27136.  
  27137.  
  27138. msg_handler
  27139.       Specifies the new fatal error procedure, which
  27140.       should not return.
  27141. |__
  27142.  
  27143. The default error handler provided by the Intrinsics con-
  27144. structs a string from the error resource database and calls
  27145. XtError.  Fatal error message handlers should not return.
  27146. If one does, subsequent Intrinsics behavior is undefined.
  27147. This routine has been superseded by XtAppSetErrorMsgHandler.
  27148.  
  27149.  
  27150. To call the high-level error handler, use XtErrorMsg.
  27151.  
  27152. __
  27153. |
  27154. void XtErrorMsg(name, type, class, default, params, num_params)
  27155.       String name;
  27156.       String type;
  27157.       String class;
  27158.       String default;
  27159.       String *params;
  27160.       Cardinal *num_params;
  27161.  
  27162.  
  27163. name      Specifies the general kind of error.
  27164.  
  27165. type      Specifies the detailed name of the error.
  27166.  
  27167. class      Specifies the resource class.
  27168.  
  27169. default   Specifies the default message to use if an error
  27170.       database entry is not found.
  27171.  
  27172. params      Specifies a pointer to a list of values to be
  27173.       stored in the message.
  27174.  
  27175. num_params
  27176.       Specifies the number of entries in params.
  27177. |__
  27178.  
  27179. This routine has been superseded by XtAppErrorMsg.
  27180.  
  27181.  
  27182. To register a procedure to be called on nonfatal error con-
  27183. ditions, use XtSetWarningMsgHandler.
  27184.  
  27185.  
  27186.  
  27187.  
  27188.  
  27189.  
  27190.                  402
  27191.  
  27192.  
  27193.  
  27194.  
  27195.  
  27196. X Toolkit Intrinsics                 X11 Release 6.4
  27197.  
  27198. __
  27199. |
  27200. void XtSetWarningMsgHandler(msg_handler)
  27201.       XtErrorMsgHandler msg_handler;
  27202.  
  27203.  
  27204. msg_handler
  27205.       Specifies the new nonfatal error procedure, which
  27206.       usually returns.
  27207. |__
  27208.  
  27209. The default warning handler provided by the Intrinsics con-
  27210. structs a string from the error resource database and calls
  27211. XtWarning.  This routine has been superseded by
  27212. XtAppSetWarningMsgHandler.
  27213.  
  27214.  
  27215. To call the installed high-level warning handler, use
  27216. XtWarningMsg.
  27217.  
  27218. __
  27219. |
  27220. void XtWarningMsg(name, type, class, default, params, num_params)
  27221.       String name;
  27222.       String type;
  27223.       String class;
  27224.       String default;
  27225.       String *params;
  27226.       Cardinal *num_params;
  27227.  
  27228.  
  27229. name      Specifies the general kind of error.
  27230.  
  27231. type      Specifies the detailed name of the error.
  27232.  
  27233. class      Specifies the resource class.
  27234.  
  27235. default   Specifies the default message to use if an error
  27236.       database entry is not found.
  27237.  
  27238. params      Specifies a pointer to a list of values to be
  27239.       stored in the message.
  27240.  
  27241. num_params
  27242.       Specifies the number of entries in params.
  27243. |__
  27244.  
  27245. This routine has been superseded by XtAppWarningMsg.
  27246.  
  27247.  
  27248. To register a procedure to be called on fatal error condi-
  27249. tions, use XtSetErrorHandler.
  27250.  
  27251.  
  27252.  
  27253.  
  27254.  
  27255.  
  27256.                  403
  27257.  
  27258.  
  27259.  
  27260.  
  27261.  
  27262. X Toolkit Intrinsics                 X11 Release 6.4
  27263.  
  27264. __
  27265. |
  27266. void XtSetErrorHandler(handler)
  27267.       XtErrorHandler handler;
  27268.  
  27269.  
  27270. handler   Specifies the new fatal error procedure, which
  27271.       should not return.
  27272. |__
  27273.  
  27274. The default error handler provided by the Intrinsics is
  27275. _XtError.  On POSIX-based systems, it prints the message to
  27276. standard error and terminates the application.    Fatal error
  27277. message handlers should not return.  If one does, subsequent
  27278. X Toolkit behavior is undefined.  This routine has been
  27279. superseded by XtAppSetErrorHandler.
  27280.  
  27281.  
  27282. To call the installed fatal error procedure, use XtError.
  27283.  
  27284. __
  27285. |
  27286. void XtError(message)
  27287.       String message;
  27288.  
  27289.  
  27290. message   Specifies the message to be reported.
  27291. |__
  27292.  
  27293. Most programs should use XtAppErrorMsg, not XtError, to pro-
  27294. vide for customization and internationalization of error
  27295. messages.  This routine has been superseded by XtAppError.
  27296.  
  27297.  
  27298. To register a procedure to be called on nonfatal error con-
  27299. ditions, use XtSetWarningHandler.
  27300.  
  27301. __
  27302. |
  27303. void XtSetWarningHandler(handler)
  27304.       XtErrorHandler handler;
  27305.  
  27306.  
  27307. handler   Specifies the new nonfatal error procedure, which
  27308.       usually returns.
  27309. |__
  27310.  
  27311. The default warning handler provided by the Intrinsics is
  27312. _XtWarning.  On POSIX-based systems, it prints the message
  27313. to standard error and returns to the caller.  This routine
  27314. has been superseded by XtAppSetWarningHandler.
  27315.  
  27316.  
  27317. To call the installed nonfatal error procedure, use
  27318. XtWarning.
  27319.  
  27320.  
  27321.  
  27322.                  404
  27323.  
  27324.  
  27325.  
  27326.  
  27327.  
  27328. X Toolkit Intrinsics                 X11 Release 6.4
  27329.  
  27330. __
  27331. |
  27332. void XtWarning(message)
  27333.       String message;
  27334.  
  27335.  
  27336. message   Specifies the nonfatal error message to be
  27337.       reported.
  27338. |__
  27339.  
  27340. Most programs should use XtAppWarningMsg, not XtWarning, to
  27341. provide for customization and internationalization of warn-
  27342. ing messages.  This routine has been superseded by
  27343. XtAppWarning.
  27344.  
  27345.  
  27346.  
  27347.  
  27348.  
  27349.  
  27350.  
  27351.  
  27352.  
  27353.  
  27354.  
  27355.  
  27356.  
  27357.  
  27358.  
  27359.  
  27360.  
  27361.  
  27362.  
  27363.  
  27364.  
  27365.  
  27366.  
  27367.  
  27368.  
  27369.  
  27370.  
  27371.  
  27372.  
  27373.  
  27374.  
  27375.  
  27376.  
  27377.  
  27378.  
  27379.  
  27380.  
  27381.  
  27382.  
  27383.  
  27384.  
  27385.  
  27386.  
  27387.  
  27388.                  405
  27389.  
  27390.  
  27391.  
  27392.  
  27393.  
  27394. X Toolkit Intrinsics                 X11 Release 6.4
  27395.  
  27396.  
  27397.  
  27398.  
  27399.              Appendix D
  27400.  
  27401.          Intrinsics Error Messages
  27402.  
  27403.  
  27404.  
  27405.  
  27406. All Intrinsics errors and warnings have class ``XtToolkitEr-
  27407. ror''.    The following two tables summarize the common errors
  27408. and warnings that can be generated by the Intrinsics.  Addi-
  27409. tional implementation-dependent messages are permitted.
  27410.  
  27411. Error Messages
  27412.  
  27413.  
  27414. -------------------------------------------------------------------------------------
  27415. Name             Type                   Default Message
  27416. -------------------------------------------------------------------------------------
  27417. allocError         calloc                Cannot perform calloc
  27418. allocError         malloc                Cannot perform malloc
  27419. allocError         realloc               Cannot perform realloc
  27420. internalError         xtMakeGeometryRequest           internal error; ShellClassEx-
  27421.                                tension is NULL
  27422. invalidArgCount      xtGetValues               Argument count > 0 on NULL
  27423.                                argument list in XtGetValues
  27424. invalidArgCount      xtSetValues               Argument count > 0 on NULL
  27425.                                argument list in XtSetValues
  27426. invalidClass         applicationShellInsertChild   ApplicationShell does not
  27427.                                accept RectObj children;
  27428.                                ignored
  27429. invalidClass         constraintSetValue           Subclass of Constraint
  27430.                                required in CallCon-
  27431.                                straintSetValues
  27432. invalidClass         xtAppCreateShell           XtAppCreateShell requires
  27433.                                non-NULL widget class
  27434. invalidClass         xtCreatePopupShell           XtCreatePopupShell requires
  27435.                                non-NULL widget class
  27436. invalidClass         xtCreateWidget            XtCreateWidget requires non-
  27437.                                NULL widget class
  27438. invalidClass         xtPopdown               XtPopdown requires a subclass
  27439.                                of shellWidgetClass
  27440. invalidClass         xtPopup               XtPopup requires a subclass
  27441.                                of shellWidgetClass
  27442. invalidDimension     xtCreateWindow            Widget %s has zero width
  27443.                                and/or height
  27444. invalidDimension     shellRealize               Shell widget %s has zero
  27445.                                width and/or height
  27446. invalidDisplay         xtInitialize               Can't open display: %s
  27447. invalidGetValues     xtGetValues               NULL ArgVal in XtGetValues
  27448. invalidExtension     shellClassPartInitialize      widget class %s has invalid
  27449.                                ShellClassExtension record
  27450.  
  27451.  
  27452.  
  27453.  
  27454.                  406
  27455.  
  27456.  
  27457.  
  27458.  
  27459.  
  27460. X Toolkit Intrinsics                 X11 Release 6.4
  27461.  
  27462.  
  27463. invalidExtension     xtMakeGeometryRequest           widget class %s has invalid
  27464.                                ShellClassExtension record
  27465. invalidGeometryManager     xtMakeGeometryRequest           XtMakeGeometryRequest - par-
  27466.                                ent has no geometry manager
  27467. invalidParameter     xtAddInput               invalid condition passed to
  27468.                                XtAddInput
  27469. invalidParameter     xtAddInput               invalid condition passed to
  27470.                                XtAppAddInput
  27471. invalidParent         xtChangeManagedSet           Attempt to manage a child
  27472.                                when parent is not Composite
  27473. invalidParent         xtChangeManagedSet           Attempt to unmanage a child
  27474.                                when parent is not Composite
  27475. invalidParent         xtCreatePopupShell           XtCreatePopupShell requires
  27476.                                non-NULL parent
  27477. invalidParent         xtCreateWidget            XtCreateWidget requires non-
  27478.                                NULL parent
  27479. invalidParent         xtMakeGeometryRequest           non-shell has no parent in
  27480.                                XtMakeGeometryRequest
  27481. invalidParent         xtMakeGeometryRequest           XtMakeGeometryRequest - par-
  27482.                                ent not composite
  27483. invalidParent         xtManageChildren           Attempt to manage a child
  27484.                                when parent is not Composite
  27485. invalidParent         xtUnmanageChildren           Attempt to unmanage a child
  27486.                                when parent is not Composite
  27487. invalidProcedure     inheritanceProc           Unresolved inheritance opera-
  27488.                                tion
  27489. invalidProcedure     realizeProc               No realize class procedure
  27490.                                defined
  27491. invalidWindow         eventHandler               Event with wrong window
  27492. missingWidget         fetchDisplayArg           FetchDisplayArg called with-
  27493.                                out a widget to reference
  27494. nonWidget         xtCreateWidget            attempt to add non-widget
  27495.                                child "%s" to parent "%s"
  27496.                                which supports only widgets
  27497. noPerDisplay         closeDisplay               Couldn't find per display
  27498.                                information
  27499. noPerDisplay         getPerDisplay               Couldn't find per display
  27500.                                information
  27501. noSelectionProperties     freeSelectionProperty           internal error: no selection
  27502.                                property context for display
  27503. noWidgetAncestor     windowedAncestor           Object "%s" does not have
  27504.                                windowed ancestor
  27505. nullDisplay         xtRegisterExtensionSelector   XtRegisterExtensionSelector
  27506.                                requires a non-NULL display
  27507. nullProc         insertChild               "%s" parent has NULL
  27508.                                insert_child method
  27509. r2versionMismatch     widget                Widget class %s must be re-
  27510.                                compiled.
  27511. R3versionMismatch     widget                Widget class %s must be re-
  27512.                                compiled.
  27513. R4orR5versionMismatch     widget                Widget class %s must be re-
  27514.                                compiled.
  27515.  
  27516.  
  27517.  
  27518.  
  27519.  
  27520.                  407
  27521.  
  27522.  
  27523.  
  27524.  
  27525.  
  27526. X Toolkit Intrinsics                 X11 Release 6.4
  27527.  
  27528.  
  27529. rangeError         xtRegisterExtensionSelector   Attempt to register multiple
  27530.                                selectors for one extension
  27531.                                event type
  27532. sessionManagement     SmcOpenConnection           Tried to connect to session
  27533.                                manager, %s
  27534. subclassMismatch     xtCheckSubclass           Widget class %s found when
  27535.                                subclass of %s expected: %s
  27536. -------------------------------------------------------------------------------------
  27537.  
  27538.  
  27539. Warning Messages
  27540.  
  27541.  
  27542. ---------------------------------------------------------------------------
  27543. Name             Type             Default Message
  27544. ---------------------------------------------------------------------------
  27545. ambiguousParent      xtChangeManagedSet      Not all children have same
  27546.                          parent
  27547. ambiguousParent      xtManageChildren         Not all children have same
  27548.                          parent in XtManageChildren
  27549. ambiguousParent      xtUnmanageChildren      Not all children have same
  27550.                          parent in XtUnmanageChildren
  27551. badFormat         xtGetSelectionValue     Selection owner returned type
  27552.                          INCR property with format !=
  27553.                          32
  27554. badGeometry         shellRealize         Shell widget "%s" has an
  27555.                          invalid geometry specifica-
  27556.                          tion: "%s"
  27557. badValue         cvtStringToPixel         Color name "%s" is not
  27558.                          defined
  27559. communicationError   select             Select failed; error code %s
  27560. conversionError      string             Cannot convert string "%s" to
  27561.                          type %s
  27562. conversionError      stringToVisual         Cannot find Visual of class
  27563.                          %s for display %s
  27564. conversionFailed     xtConvertVarToArgList   Type conversion failed
  27565. conversionFailed     xtGetTypedArg         Type conversion (%s to %s)
  27566.                          failed for widget '%s'
  27567. displayError         invalidDisplay         Can't find display structure
  27568. grabError         xtAddGrab             XtAddGrab requires exclusive
  27569.                          grab if spring_loaded is TRUE
  27570. grabError         xtRemoveGrab         XtRemoveGrab asked to remove
  27571.                          a widget not on the list
  27572.  
  27573.  
  27574. initializationError    xtInitialize           Initializing Resource Lists
  27575.                            twice
  27576. insufficientSpace      xtGetTypedArg           Insufficient space for con-
  27577.                            verted type '%s' in widget
  27578.                            '%s'
  27579. internalError           shell               Shell's window manager inter-
  27580.                            action is broken
  27581.  
  27582.  
  27583.  
  27584.  
  27585.  
  27586.                  408
  27587.  
  27588.  
  27589.  
  27590.  
  27591.  
  27592. X Toolkit Intrinsics                 X11 Release 6.4
  27593.  
  27594.  
  27595. invalidAddressMode     computeArgs           Conversion arguments for wid-
  27596.                            get '%s' contain an unsup-
  27597.                            ported address mode
  27598. invalidArgCount        getResources           argument count > 0 on NULL
  27599.                            argument list
  27600. invalidCallbackList    xtAddCallback           Cannot find callback list in
  27601.                            XtAddCallback
  27602. invalidCallbackList    xtAddCallback           Cannot find callback list in
  27603.                            XtAddCallbacks
  27604. invalidCallbackList    xtCallCallback           Cannot find callback list in
  27605.                            XtCallCallbacks
  27606. invalidCallbackList    xtRemoveAllCallback     Cannot find callback list in
  27607.                            XtRemoveAllCallbacks
  27608. invalidCallbackList    xtRemoveCallback        Cannot find callback list in
  27609.                            XtRemoveCallbacks
  27610. invalidChild           xtChangeManagedSet      Null child passed to Unman-
  27611.                            ageChildren
  27612. invalidChild           xtManageChildren        null child passed to Man-
  27613.                            ageChildren
  27614. invalidChild           xtManageChildren        null child passed to XtMan-
  27615.                            ageChildren
  27616. invalidChild           xtUnmanageChildren      Null child passed to XtUnman-
  27617.                            ageChildren
  27618. invalidChild           xtUnmanageChildren      Null child found in argument
  27619.                            list to unmanage
  27620. invalidDepth           setValues           Can't change widget depth
  27621. invalidExtension       xtCreateWidget           widget "%s" class %s has
  27622.                            invalid CompositeClassExten-
  27623.                            sion record
  27624. invalidExtension       xtCreateWidget           widget class %s has invalid
  27625.                            ConstraintClassExtension
  27626.                            record
  27627. invalidGrab           ungrabKeyOrButton       Attempt to remove nonexistent
  27628.                            passive grab
  27629. invalidGrabKind        xtPopup               grab kind argument has
  27630.                            invalid value; XtGrabNone
  27631.                            assumed
  27632. invalidParameters      freeTranslations        Freeing XtTranslations
  27633.                            requires no extra arguments
  27634. invalidParameters      mergeTranslations       MergeTM to TranslationTable
  27635.                            needs no extra arguments
  27636. invalidParameters      xtMenuPopdown           XtMenuPopdown called with
  27637.                            num_params != 0 or 1
  27638. invalidParameters      xtMenuPopupAction       MenuPopup wants exactly one
  27639.                            argument
  27640. invalidParent           xtCopyFromParent        CopyFromParent must have non-
  27641.                            NULL parent
  27642. invalidPopup           xtMenuPopup           Can't find popup widget "%s"
  27643.                            in XtMenuPopup
  27644. invalidPopup           xtMenuPopdown           Can't find popup in widget
  27645.                            "%s" in XtMenuPopdown
  27646.  
  27647.  
  27648.  
  27649.  
  27650.  
  27651.  
  27652.                  409
  27653.  
  27654.  
  27655.  
  27656.  
  27657.  
  27658. X Toolkit Intrinsics                 X11 Release 6.4
  27659.  
  27660.  
  27661. invalidPopup           unsupportedOperation    Pop-up menu creation is only
  27662.                            supported on ButtonPress,
  27663.                            KeyPress or EnterNotify
  27664.                            events.
  27665. invalidPopup           unsupportedOperation    Pop-up menu creation is only
  27666.                            supported on Button, Key or
  27667.                            EnterNotify events.
  27668. invalidProcedure       deleteChild           null delete_child procedure
  27669.                            for class %s in XtDestroy
  27670. invalidProcedure       inputHandler           XtRemoveInput: Input handler
  27671.                            not found
  27672. invalidProcedure       set_values_almost       set_values_almost procedure
  27673.                            shouldn't be NULL
  27674. invalidResourceCount   getResources           resource count > 0 on NULL
  27675.                            resource list
  27676. invalidResourceName    computeArgs           Cannot find resource name %s
  27677.                            as argument to conversion
  27678. invalidShell           xtTranslateCoords       Widget has no shell ancestor
  27679. invalidSizeOverride    xtDependencies           Representation size %d must
  27680.                            match superclass's to over-
  27681.                            ride %s
  27682. missingCharsetList     cvtStringToFontSet      Missing charsets in String to
  27683.                            FontSet conversion
  27684. noActionProc           xtCallActionProc        No action proc named "%s" is
  27685.                            registered for widget "%s"
  27686. noColormap           cvtStringToPixel        Cannot allocate colormap
  27687.                            entry for "%s"
  27688. noFont               cvtStringToFont           Unable to load any usable
  27689.                            ISO8859-1 font
  27690. noFont               cvtStringToFontSet      Unable to load any usable
  27691.                            fontset
  27692. noFont               cvtStringToFontStruct   Unable to load any usable
  27693.                            ISO8859-1 font
  27694.  
  27695.  
  27696. notInConvertSelection    xtGetSelectionRequest          XtGetSelectionRequest or
  27697.                               XtGetSelectionParameters
  27698.                               called for widget "%s" out-
  27699.                               side of ConvertSelection proc
  27700. notRectObj        xtChangeManagedSet          child "%s", class %s is not a
  27701.                               RectObj
  27702. notRectObj        xtManageChildren          child "%s", class %s is not a
  27703.                               RectObj
  27704. nullWidget        xtConvertVarToArgList          XtVaTypedArg conversion needs
  27705.                               non-NULL widget handle
  27706. r3versionMismatch    widget                  Shell Widget class %s binary
  27707.                               compiled for R3
  27708. translationError    nullTable              Can't remove accelerators
  27709.                               from NULL table
  27710. translationError    nullTable              Tried to remove nonexistent
  27711.                               accelerators
  27712. translationError    ambiguousActions          Overriding earlier transla-
  27713.                               tion manager actions.
  27714.  
  27715.  
  27716.  
  27717.  
  27718.                  410
  27719.  
  27720.  
  27721.  
  27722.  
  27723.  
  27724. X Toolkit Intrinsics                 X11 Release 6.4
  27725.  
  27726.  
  27727. translationError    newActions              New actions are:%s
  27728. translationError    nullTable              table to (un)merge must not
  27729.                               be null
  27730. translationError    nullTable              Can't translate event through
  27731.                               NULL table
  27732. translationError    oldActions              Previous entry was: %s %s
  27733. translationError    unboundActions              Actions not found: %s
  27734. translationError    xtTranslateInitialize          Initializing Translation man-
  27735.                               ager twice.
  27736. translationParseError    missingComma               ... possibly due to missing
  27737.                               ',' in event sequence.
  27738. translationParseError    nonLatin1               ... probably due to non-
  27739.                               Latin1 character in quoted
  27740.                               string
  27741. translationParseError    parseError              translation table syntax
  27742.                               error: %s
  27743. translationParseError    parseString              Missing '"'.
  27744. translationParseError    showLine               ... found while parsing '%s'
  27745. typeConversionError    noConverter              No type converter registered
  27746.                               for '%s' to '%s' conversion.
  27747. unknownType        xtConvertVarToArgList          Unable to find type of
  27748.                               resource for conversion
  27749. unknownType        xtGetTypedArg              Unable to find type of
  27750.                               resource for conversion
  27751. versionMismatch     widget                  Widget class %s version mis-
  27752.                               match (recompilation
  27753.                               needed):\n widget %d vs.
  27754.                               intrinsics %d.
  27755. wrongParameters     cvtIntOrPixelToXColor          Pixel to color conversion
  27756.                               needs screen and colormap
  27757.                               arguments
  27758. wrongParameters     cvtIntToBool              Integer to Bool conversion
  27759.                               needs no extra arguments
  27760. wrongParameters     cvtIntToBoolean           Integer to Boolean conversion
  27761.                               needs no extra arguments
  27762. wrongParameters     cvtIntToFloat              Integer to Float conversion
  27763.                               needs no extra arguments
  27764. wrongParameters     cvtIntToFont              Integer to Font conversion
  27765.                               needs no extra arguments
  27766. wrongParameters     cvtIntToPixel              Integer to Pixel conversion
  27767.                               needs no extra arguments
  27768. wrongParameters     cvtIntToPixmap              Integer to Pixmap conversion
  27769.                               needs no extra arguments
  27770. wrongParameters     cvtIntToShort              Integer to Short conversion
  27771.                               needs no extra arguments
  27772. wrongParameters     cvtIntToUnsignedChar          Integer to UnsignedChar con-
  27773.                               version needs no extra argu-
  27774.                               ments
  27775. wrongParameters     cvtStringToAcceleratorTable   String to AcceleratorTable
  27776.                               conversion needs no extra
  27777.                               arguments
  27778. wrongParameters     cvtStringToAtom           String to Atom conversion
  27779.                               needs Display argument
  27780.  
  27781.  
  27782.  
  27783.  
  27784.                  411
  27785.  
  27786.  
  27787.  
  27788.  
  27789.  
  27790. X Toolkit Intrinsics                 X11 Release 6.4
  27791.  
  27792.  
  27793. wrongParameters     cvtStringToBool           String to Bool conversion
  27794.                               needs no extra arguments
  27795. wrongParameters     cvtStringToBoolean          String to Boolean conversion
  27796.                               needs no extra arguments
  27797. wrongParameters     cvtStringToCommandArgArray    String to CommandArgArray
  27798.                               conversion needs no extra
  27799.                               arguments
  27800. wrongParameters     cvtStringToCursor          String to cursor conversion
  27801.                               needs display argument
  27802. wrongParameters     cvtStringToDimension          String to Dimension conver-
  27803.                               sion needs no extra arguments
  27804. wrongParameters     cvtStringToDirectoryString    String to DirectoryString
  27805.                               conversion needs no extra
  27806.                               arguments
  27807.  
  27808.  
  27809. wrongParameters   cvtStringToDisplay        String to Display conversion
  27810.                         needs no extra arguments
  27811. wrongParameters   cvtStringToFile        String to File conversion
  27812.                         needs no extra arguments
  27813. wrongParameters   cvtStringToFloat        String to Float conversion
  27814.                         needs no extra arguments
  27815. wrongParameters   cvtStringToFont        String to font conversion
  27816.                         needs display argument
  27817. wrongParameters   cvtStringToFontSet        String to FontSet conversion
  27818.                         needs display and locale
  27819.                         arguments
  27820. wrongParameters   cvtStringToFontStruct     String to font conversion
  27821.                         needs display argument
  27822. wrongParameters   cvtStringToGravity        String to Gravity conversion
  27823.                         needs no extra arguments
  27824. wrongParameters   cvtStringToInitialState    String to InitialState con-
  27825.                         version needs no extra argu-
  27826.                         ments
  27827. wrongParameters   cvtStringToInt        String to Integer conversion
  27828.                         needs no extra arguments
  27829. wrongParameters   cvtStringToPixel        String to pixel conversion
  27830.                         needs screen and colormap
  27831.                         arguments
  27832. wrongParameters   cvtStringToRestartStyle    String to RestartStyle con-
  27833.                         version needs no extra argu-
  27834.                         ments
  27835. wrongParameters   cvtStringToShort        String to Integer conversion
  27836.                         needs no extra arguments
  27837. wrongParameters   cvtStringToTranslationTable    String to TranslationTable
  27838.                         conversion needs no extra
  27839.                         arguments
  27840. wrongParameters   cvtStringToUnsignedChar    String to Integer conversion
  27841.                         needs no extra arguments
  27842. wrongParameters   cvtStringToVisual        String to Visual conversion
  27843.                         needs screen and depth argu-
  27844.                         ments
  27845.  
  27846.  
  27847.  
  27848.  
  27849.  
  27850.                  412
  27851.  
  27852.  
  27853.  
  27854.  
  27855.  
  27856. X Toolkit Intrinsics                 X11 Release 6.4
  27857.  
  27858.  
  27859. wrongParameters   cvtXColorToPixel        Color to Pixel conversion
  27860.                         needs no extra arguments
  27861. wrongParameters   freeCursor            Free Cursor requires display
  27862.                         argument
  27863. wrongParameters   freeDirectoryString        Free Directory String
  27864.                         requires no extra arguments
  27865. wrongParameters   freeFile            Free File requires no extra
  27866.                         arguments
  27867. wrongParameters   freeFont            Free Font needs display argu-
  27868.                         ment
  27869. wrongParameters   freeFontSet            FreeFontSet needs display and
  27870.                         locale arguments
  27871. wrongParameters   freeFontStruct        Free FontStruct requires dis-
  27872.                         play argument
  27873. wrongParameters   freePixel            Freeing a pixel requires
  27874.                         screen and colormap arguments
  27875. ------------------------------------------------------------------------------
  27876.  
  27877.  
  27878.  
  27879.  
  27880.  
  27881.  
  27882.  
  27883.  
  27884.  
  27885.  
  27886.  
  27887.  
  27888.  
  27889.  
  27890.  
  27891.  
  27892.  
  27893.  
  27894.  
  27895.  
  27896.  
  27897.  
  27898.  
  27899.  
  27900.  
  27901.  
  27902.  
  27903.  
  27904.  
  27905.  
  27906.  
  27907.  
  27908.  
  27909.  
  27910.  
  27911.  
  27912.  
  27913.  
  27914.  
  27915.  
  27916.                  413
  27917.  
  27918.  
  27919.  
  27920.  
  27921.  
  27922. X Toolkit Intrinsics                 X11 Release 6.4
  27923.  
  27924.  
  27925.  
  27926.  
  27927.              Appendix E
  27928.  
  27929.               Defined Strings
  27930.  
  27931.  
  27932.  
  27933.  
  27934. The StringDefs.h header file contains definitions for the
  27935. following resource name, class, and representation type sym-
  27936. bolic constants.
  27937.  
  27938. Resource names:
  27939.  
  27940. -------------------------------------------------------------
  27941. Symbol                Definition
  27942. -------------------------------------------------------------
  27943. XtNaccelerators         "accelerators"
  27944. XtNallowHoriz            "allowHoriz"
  27945. XtNallowVert            "allowVert"
  27946. XtNancestorSensitive        "ancestorSensitive"
  27947. XtNbackground            "background"
  27948. XtNbackgroundPixmap        "backgroundPixmap"
  27949. XtNbitmap            "bitmap"
  27950. XtNborder            "borderColor"
  27951. XtNborderColor            "borderColor"
  27952. XtNborderPixmap         "borderPixmap"
  27953. XtNborderWidth            "borderWidth"
  27954. XtNcallback            "callback"
  27955. XtNchangeHook            "changeHook"
  27956. XtNchildren            "children"
  27957. XtNcolormap            "colormap"
  27958. XtNconfigureHook        "configureHook"
  27959. XtNcreateHook            "createHook"
  27960. XtNdepth            "depth"
  27961. XtNdestroyCallback        "destroyCallback"
  27962. XtNdestroyHook            "destroyHook"
  27963. XtNeditType            "editType"
  27964. XtNfile             "file"
  27965. XtNfont             "font"
  27966. XtNfontSet            "fontSet"
  27967. XtNforceBars            "forceBars"
  27968. XtNforeground            "foreground"
  27969. XtNfunction            "function"
  27970. XtNgeometryHook         "geometryHook"
  27971. XtNheight            "height"
  27972. XtNhighlight            "highlight"
  27973. XtNhSpace            "hSpace"
  27974. XtNindex            "index"
  27975. XtNinitialResourcesPersistent    "initialResourcesPersistent"
  27976. XtNinnerHeight            "innerHeight"
  27977. XtNinnerWidth            "innerWidth"
  27978.  
  27979.  
  27980.  
  27981.  
  27982.                  414
  27983.  
  27984.  
  27985.  
  27986.  
  27987.  
  27988. X Toolkit Intrinsics                 X11 Release 6.4
  27989.  
  27990.  
  27991. XtNinnerWindow            "innerWindow"
  27992. XtNinsertPosition        "insertPosition"
  27993. XtNinternalHeight        "internalHeight"
  27994. XtNinternalWidth        "internalWidth"
  27995. XtNjumpProc            "jumpProc"
  27996. XtNjustify            "justify"
  27997. XtNknobHeight            "knobHeight"
  27998. XtNknobIndent            "knobIndent"
  27999. XtNknobPixel            "knobPixel"
  28000. XtNknobWidth            "knobWidth"
  28001. XtNlabel            "label"
  28002. XtNlength            "length"
  28003. XtNlowerRight            "lowerRight"
  28004. XtNmappedWhenManaged        "mappedWhenManaged"
  28005. XtNmenuEntry            "menuEntry"
  28006. XtNname             "name"
  28007. XtNnotify            "notify"
  28008. XtNnumChildren            "numChildren"
  28009. XtNnumShells            "numShells"
  28010. XtNorientation            "orientation"
  28011. XtNparameter            "parameter"
  28012. XtNpixmap            "pixmap"
  28013. XtNpopupCallback        "popupCallback"
  28014. XtNpopdownCallback        "popdownCallback"
  28015. XtNresize            "resize"
  28016. XtNreverseVideo         "reverseVideo"
  28017. XtNscreen            "screen"
  28018. XtNscrollProc            "scrollProc"
  28019. XtNscrollDCursor        "scrollDCursor"
  28020. XtNscrollHCursor        "scrollHCursor"
  28021. XtNscrollLCursor        "scrollLCursor"
  28022. XtNscrollRCursor        "scrollRCursor"
  28023. XtNscrollUCursor        "scrollUCursor"
  28024. XtNscrollVCursor        "scrollVCursor"
  28025. XtNselection            "selection"
  28026. XtNselectionArray        "selectionArray"
  28027. XtNsensitive            "sensitive"
  28028. XtNsession            "session"
  28029. XtNshells            "shells"
  28030. XtNshown            "shown"
  28031. XtNspace            "space"
  28032. XtNstring            "string"
  28033. XtNtextOptions            "textOptions"
  28034. XtNtextSink            "textSink"
  28035. XtNtextSource            "textSource"
  28036. XtNthickness            "thickness"
  28037. XtNthumb            "thumb"
  28038. XtNthumbProc            "thumbProc"
  28039. XtNtop                "top"
  28040. XtNtranslations         "translations"
  28041. XtNunrealizeCallback        "unrealizeCallback"
  28042. XtNupdate            "update"
  28043. XtNuseBottom            "useBottom"
  28044.  
  28045.  
  28046.  
  28047.  
  28048.                  415
  28049.  
  28050.  
  28051.  
  28052.  
  28053.  
  28054. X Toolkit Intrinsics                 X11 Release 6.4
  28055.  
  28056.  
  28057. XtNuseRight            "useRight"
  28058. XtNvalue            "value"
  28059. XtNvSpace            "vSpace"
  28060. XtNwidth            "width"
  28061. XtNwindow            "window"
  28062. XtNx                "x"
  28063. XtNy                "y"
  28064. -------------------------------------------------------------
  28065.  
  28066.  
  28067. Resource classes:
  28068.  
  28069. -------------------------------------------------------------
  28070. Symbol                Definition
  28071. -------------------------------------------------------------
  28072. XtCAccelerators         "Accelerators"
  28073. XtCBackground            "Background"
  28074. XtCBitmap            "Bitmap"
  28075. XtCBoolean            "Boolean"
  28076. XtCBorderColor            "BorderColor"
  28077. XtCBorderWidth            "BorderWidth"
  28078. XtCCallback            "Callback"
  28079. XtCColormap            "Colormap"
  28080. XtCColor            "Color"
  28081. XtCCursor            "Cursor"
  28082. XtCDepth            "Depth"
  28083. XtCEditType            "EditType"
  28084. XtCEventBindings        "EventBindings"
  28085. XtCFile             "File"
  28086. XtCFont             "Font"
  28087. XtCFontSet            "FontSet"
  28088. XtCForeground            "Foreground"
  28089. XtCFraction            "Fraction"
  28090. XtCFunction            "Function"
  28091. XtCHeight            "Height"
  28092. XtCHSpace            "HSpace"
  28093. XtCIndex            "Index"
  28094. XtCInitialResourcesPersistent    "InitialResourcesPersistent"
  28095. XtCInsertPosition        "InsertPosition"
  28096. XtCInterval            "Interval"
  28097. XtCJustify            "Justify"
  28098. XtCKnobIndent            "KnobIndent"
  28099. XtCKnobPixel            "KnobPixel"
  28100. XtCLabel            "Label"
  28101. XtCLength            "Length"
  28102. XtCMappedWhenManaged        "MappedWhenManaged"
  28103. XtCMargin            "Margin"
  28104. XtCMenuEntry            "MenuEntry"
  28105. XtCNotify            "Notify"
  28106. XtCOrientation            "Orientation"
  28107. XtCParameter            "Parameter"
  28108. XtCPixmap            "Pixmap"
  28109. XtCPosition            "Position"
  28110.  
  28111.  
  28112.  
  28113.  
  28114.                  416
  28115.  
  28116.  
  28117.  
  28118.  
  28119.  
  28120. X Toolkit Intrinsics                 X11 Release 6.4
  28121.  
  28122.  
  28123. XtCReadOnly            "ReadOnly"
  28124. XtCResize            "Resize"
  28125. XtCReverseVideo         "ReverseVideo"
  28126. XtCScreen            "Screen"
  28127. XtCScrollProc            "ScrollProc"
  28128. XtCScrollDCursor        "ScrollDCursor"
  28129. XtCScrollHCursor        "ScrollHCursor"
  28130. XtCScrollLCursor        "ScrollLCursor"
  28131. XtCScrollRCursor        "ScrollRCursor"
  28132. XtCScrollUCursor        "ScrollUCursor"
  28133. XtCScrollVCursor        "ScrollVCursor"
  28134. XtCSelection            "Selection"
  28135. XtCSelectionArray        "SelectionArray"
  28136. XtCSensitive            "Sensitive"
  28137. XtCSession            "Session"
  28138. XtCSpace            "Space"
  28139. XtCString            "String"
  28140. XtCTextOptions            "TextOptions"
  28141. XtCTextPosition         "TextPosition"
  28142. XtCTextSink            "TextSink"
  28143. XtCTextSource            "TextSource"
  28144. XtCThickness            "Thickness"
  28145. XtCThumb            "Thumb"
  28146. XtCTranslations         "Translations"
  28147. XtCValue            "Value"
  28148. XtCVSpace            "VSpace"
  28149. XtCWidth            "Width"
  28150. XtCWindow            "Window"
  28151. XtCX                "X"
  28152. XtCY                "Y"
  28153. -------------------------------------------------------------
  28154.  
  28155.  
  28156. Resource representation types:
  28157.  
  28158. -------------------------------------------------
  28159. Symbol               Definition
  28160. -------------------------------------------------
  28161. XtRAcceleratorTable    "AcceleratorTable"
  28162. XtRAtom            "Atom"
  28163. XtRBitmap           "Bitmap"
  28164. XtRBool            "Bool"
  28165. XtRBoolean           "Boolean"
  28166. XtRCallback           "Callback"
  28167. XtRCallProc           "CallProc"
  28168. XtRCardinal           "Cardinal"
  28169. XtRColor           "Color"
  28170. XtRColormap           "Colormap"
  28171. XtRCommandArgArray     "CommandArgArray"
  28172. XtRCursor           "Cursor"
  28173. XtRDimension           "Dimension"
  28174. XtRDirectoryString     "DirectoryString"
  28175. XtRDisplay           "Display"
  28176.  
  28177.  
  28178.  
  28179.  
  28180.                  417
  28181.  
  28182.  
  28183.  
  28184.  
  28185.  
  28186. X Toolkit Intrinsics                 X11 Release 6.4
  28187.  
  28188.  
  28189. XtREditMode           "EditMode"
  28190. XtREnum            "Enum"
  28191. XtREnvironmentArray    "EnvironmentArray"
  28192. XtRFile            "File"
  28193. XtRFloat           "Float"
  28194. XtRFont            "Font"
  28195. XtRFontSet           "FontSet"
  28196. XtRFontStruct           "FontStruct"
  28197. XtRFunction           "Function"
  28198. XtRGeometry           "Geometry"
  28199. XtRGravity           "Gravity"
  28200. XtRImmediate           "Immediate"
  28201. XtRInitialState        "InitialState"
  28202. XtRInt               "Int"
  28203. XtRJustify           "Justify"
  28204. XtRLongBoolean           XtRBool
  28205. XtRObject           "Object"
  28206. XtROrientation           "Orientation"
  28207. XtRPixel           "Pixel"
  28208. XtRPixmap           "Pixmap"
  28209. XtRPointer           "Pointer"
  28210. XtRPosition           "Position"
  28211. XtRRestartStyle        "RestartStyle"
  28212. XtRScreen           "Screen"
  28213. XtRShort           "Short"
  28214. XtRSmcConn           "SmcConn"
  28215. XtRString           "String"
  28216. XtRStringArray           "StringArray"
  28217. XtRStringTable           "StringTable"
  28218. XtRUnsignedChar        "UnsignedChar"
  28219. XtRTranslationTable    "TranslationTable"
  28220. XtRVisual           "Visual"
  28221. XtRWidget           "Widget"
  28222. XtRWidgetClass           "WidgetClass"
  28223. XtRWidgetList           "WidgetList"
  28224. XtRWindow           "Window"
  28225. -------------------------------------------------
  28226.  
  28227.  
  28228. Boolean enumeration constants:
  28229.  
  28230. -------------------------------------------------
  28231. Symbol               Definition
  28232. -------------------------------------------------
  28233. XtEoff               "off"
  28234. XtEfalse           "false"
  28235. XtEno               "no"
  28236. XtEon               "on"
  28237. XtEtrue            "true"
  28238. XtEyes               "yes"
  28239. -------------------------------------------------
  28240.  
  28241.  
  28242.  
  28243.  
  28244.  
  28245.  
  28246.                  418
  28247.  
  28248.  
  28249.  
  28250.  
  28251.  
  28252. X Toolkit Intrinsics                 X11 Release 6.4
  28253.  
  28254.  
  28255. Orientation enumeration constants:
  28256.  
  28257. -------------------------------------------------
  28258. Symbol               Definition
  28259. -------------------------------------------------
  28260. XtEvertical           "vertical"
  28261. XtEhorizontal           "horizontal"
  28262. -------------------------------------------------
  28263.  
  28264.  
  28265. Text edit enumeration constants:
  28266.  
  28267. -------------------------------------------------
  28268. Symbol               Definition
  28269. -------------------------------------------------
  28270. XtEtextRead           "read"
  28271. XtEtextAppend           "append"
  28272. XtEtextEdit           "edit"
  28273. -------------------------------------------------
  28274.  
  28275.  
  28276. Color enumeration constants:
  28277.  
  28278. ---------------------------------------------------
  28279. Symbol             Definition
  28280. ---------------------------------------------------
  28281. XtExtdefaultbackground     "xtdefaultbackground"
  28282. XtExtdefaultforeground     "xtdefaultforeground"
  28283. ---------------------------------------------------
  28284.  
  28285.  
  28286. Font constant:
  28287.  
  28288. -------------------------------------------------
  28289. Symbol               Definition
  28290. -------------------------------------------------
  28291. XtExtdefaultfont       "xtdefaultfont"
  28292. -------------------------------------------------
  28293.  
  28294.  
  28295. Hooks for External Agents constants:
  28296.  
  28297. -----------------------------------------------------
  28298. Symbol               Definition
  28299. -----------------------------------------------------
  28300. XtHcreate           "Xtcreate"
  28301. XtHsetValues           "Xtsetvalues"
  28302. XtHmanageChildren       "XtmanageChildren"
  28303. XtHunmanageChildren       "XtunmanageChildren"
  28304. XtHmanageSet           "XtmanageSet"
  28305. XtHunmanageSet           "XtunmanageSet"
  28306. XtHrealizeWidget       "XtrealizeWidget"
  28307. XtHunrealizeWidget       "XtunrealizeWidget"
  28308.  
  28309.  
  28310.  
  28311.  
  28312.                  419
  28313.  
  28314.  
  28315.  
  28316.  
  28317.  
  28318. X Toolkit Intrinsics                 X11 Release 6.4
  28319.  
  28320.  
  28321. XtHaddCallback           "XtaddCallback"
  28322. XtHaddCallbacks        "XtaddCallbacks"
  28323. XtHremoveCallback       "XtremoveCallback"
  28324. XtHremoveCallbacks       "XtremoveCallbacks"
  28325. XtHremoveAllCallbacks       "XtremoveAllCallbacks"
  28326. XtHaugmentTranslations       "XtaugmentTranslations"
  28327. XtHoverrideTranslations    "XtoverrideTranslations"
  28328. XtHuninstallTranslations   "XtuninstallTranslations"
  28329. XtHsetKeyboardFocus       "XtsetKeyboardFocus"
  28330. XtHsetWMColormapWindows    "XtsetWMColormapWindows"
  28331. XtHmapWidget           "XtmapWidget"
  28332. XtHunmapWidget           "XtunmapWidget"
  28333. XtHpopup           "Xtpopup"
  28334. XtHpopupSpringLoaded       "XtpopupSpringLoaded"
  28335. XtHpopdown           "Xtpopdown"
  28336. XtHconfigure           "Xtconfigure"
  28337. XtHpreGeometry           "XtpreGeometry"
  28338. XtHpostGeometry        "XtpostGeometry"
  28339. XtHdestroy           "Xtdestroy"
  28340. -----------------------------------------------------
  28341.  
  28342.  
  28343. The Shell.h header file contains definitions for the follow-
  28344. ing resource name, class, and representation type symbolic
  28345. constants.
  28346.  
  28347. Resource names:
  28348.  
  28349. ----------------------------------------------------
  28350. Symbol              Definition
  28351. ----------------------------------------------------
  28352. XtNallowShellResize      "allowShellResize"
  28353. XtNargc           "argc"
  28354. XtNargv           "argv"
  28355. XtNbaseHeight          "baseHeight"
  28356. XtNbaseWidth          "baseWidth"
  28357. XtNcancelCallback      "cancelCallback"
  28358. XtNclientLeader       "clientLeader"
  28359. XtNcloneCommand       "cloneCommand"
  28360. XtNconnection          "connection"
  28361. XtNcreatePopupChildProc   "createPopupChildProc"
  28362. XtNcurrentDirectory      "currentDirectory"
  28363. XtNdieCallback          "dieCallback"
  28364. XtNdiscardCommand      "discardCommand"
  28365. XtNenvironment          "environment"
  28366. XtNerrorCallback      "errorCallback"
  28367. XtNgeometry          "geometry"
  28368. XtNheightInc          "heightInc"
  28369. XtNiconMask          "iconMask"
  28370. XtNiconName          "iconName"
  28371. XtNiconNameEncoding      "iconNameEncoding"
  28372. XtNiconPixmap          "iconPixmap"
  28373. XtNiconWindow          "iconWindow"
  28374.  
  28375.  
  28376.  
  28377.  
  28378.                  420
  28379.  
  28380.  
  28381.  
  28382.  
  28383.  
  28384. X Toolkit Intrinsics                 X11 Release 6.4
  28385.  
  28386.  
  28387. XtNiconX          "iconX"
  28388. XtNiconY          "iconY"
  28389. XtNiconic          "iconic"
  28390. XtNinitialState       "initialState"
  28391. XtNinput          "input"
  28392. XtNinteractCallback      "interactCallback"
  28393. XtNjoinSession          "joinSession"
  28394. XtNmaxAspectX          "maxAspectX"
  28395. XtNmaxAspectY          "maxAspectY"
  28396. XtNmaxHeight          "maxHeight"
  28397. XtNmaxWidth          "maxWidth"
  28398. XtNminAspectX          "minAspectX"
  28399. XtNminAspectY          "minAspectY"
  28400. XtNminHeight          "minHeight"
  28401. XtNminWidth          "minWidth"
  28402. XtNoverrideRedirect      "overrideRedirect"
  28403. XtNprogramPath          "programPath"
  28404. XtNresignCommand      "resignCommand"
  28405. XtNrestartCommand      "restartCommand"
  28406. XtNrestartStyle       "restartStyle"
  28407. XtNsaveCallback       "saveCallback"
  28408. XtNsaveCompleteCallback   "saveCompleteCallback"
  28409. XtNsaveUnder          "saveUnder"
  28410. XtNsessionID          "sessionID"
  28411. XtNshutdownCommand      "shutdownCommand"
  28412. XtNtitle          "title"
  28413. XtNtitleEncoding      "titleEncoding"
  28414. XtNtransient          "transient"
  28415. XtNtransientFor       "transientFor"
  28416. XtNurgency          "urgency"
  28417. XtNvisual          "visual"
  28418. XtNwaitForWm          "waitforwm"
  28419. XtNwaitforwm          "waitforwm"
  28420. XtNwidthInc          "widthInc"
  28421. XtNwindowGroup          "windowGroup"
  28422. XtNwindowRole          "windowRole"
  28423. XtNwinGravity          "winGravity"
  28424. XtNwmTimeout          "wmTimeout"
  28425. ----------------------------------------------------
  28426.  
  28427.  
  28428. Resource classes:
  28429.  
  28430. ----------------------------------------------------
  28431. Symbol              Definition
  28432. ----------------------------------------------------
  28433. XtCAllowShellResize      "allowShellResize"
  28434. XtCArgc           "Argc"
  28435. XtCArgv           "Argv"
  28436. XtCBaseHeight          "BaseHeight"
  28437. XtCBaseWidth          "BaseWidth"
  28438. XtCClientLeader       "ClientLeader"
  28439. XtCCloneCommand       "CloneCommand"
  28440.  
  28441.  
  28442.  
  28443.  
  28444.                  421
  28445.  
  28446.  
  28447.  
  28448.  
  28449.  
  28450. X Toolkit Intrinsics                 X11 Release 6.4
  28451.  
  28452.  
  28453. XtCConnection          "Connection"
  28454. XtCCreatePopupChildProc   "CreatePopupChildProc"
  28455. XtCCurrentDirectory      "CurrentDirectory"
  28456. XtCDiscardCommand      "DiscardCommand"
  28457. XtCEnvironment          "Environment"
  28458. XtCGeometry          "Geometry"
  28459. XtCHeightInc          "HeightInc"
  28460. XtCIconMask          "IconMask"
  28461. XtCIconName          "IconName"
  28462. XtCIconNameEncoding      "IconNameEncoding"
  28463. XtCIconPixmap          "IconPixmap"
  28464. XtCIconWindow          "IconWindow"
  28465. XtCIconX          "IconX"
  28466. XtCIconY          "IconY"
  28467. XtCIconic          "Iconic"
  28468. XtCInitialState       "InitialState"
  28469. XtCInput          "Input"
  28470. XtCJoinSession          "JoinSession"
  28471. XtCMaxAspectX          "MaxAspectX"
  28472. XtCMaxAspectY          "MaxAspectY"
  28473. XtCMaxHeight          "MaxHeight"
  28474. XtCMaxWidth          "MaxWidth"
  28475. XtCMinAspectX          "MinAspectX"
  28476. XtCMinAspectY          "MinAspectY"
  28477. XtCMinHeight          "MinHeight"
  28478. XtCMinWidth          "MinWidth"
  28479. XtCOverrideRedirect      "OverrideRedirect"
  28480. XtCProgramPath          "ProgramPath"
  28481. XtCResignCommand      "ResignCommand"
  28482. XtCRestartCommand      "RestartCommand"
  28483. XtCRestartStyle       "RestartStyle"
  28484. XtCSaveUnder          "SaveUnder"
  28485. XtCSessionID          "SessionID"
  28486. XtCShutdownCommand      "ShutdownCommand"
  28487. XtCTitle          "Title"
  28488. XtCTitleEncoding      "TitleEncoding"
  28489. XtCTransient          "Transient"
  28490. XtCTransientFor       "TransientFor"
  28491. XtCUrgency          "Urgency"
  28492. XtCVisual          "Visual"
  28493. XtCWaitForWm          "Waitforwm"
  28494. XtCWaitforwm          "Waitforwm"
  28495. XtCWidthInc          "WidthInc"
  28496. XtCWindowGroup          "WindowGroup"
  28497. XtCWindowRole          "WindowRole"
  28498. XtCWinGravity          "WinGravity"
  28499. XtCWmTimeout          "WmTimeout"
  28500. ----------------------------------------------------
  28501.  
  28502.  
  28503. Resource representation types:
  28504.  
  28505.  
  28506.  
  28507.  
  28508.  
  28509.  
  28510.                  422
  28511.  
  28512.  
  28513.  
  28514.  
  28515.  
  28516. X Toolkit Intrinsics                 X11 Release 6.4
  28517.  
  28518.  
  28519. -------------------------------------------------
  28520. Symbol               Definition
  28521. -------------------------------------------------
  28522. XtRAtom            "Atom"
  28523. -------------------------------------------------
  28524.  
  28525.  
  28526.  
  28527.  
  28528.  
  28529.  
  28530.  
  28531.  
  28532.  
  28533.  
  28534.  
  28535.  
  28536.  
  28537.  
  28538.  
  28539.  
  28540.  
  28541.  
  28542.  
  28543.  
  28544.  
  28545.  
  28546.  
  28547.  
  28548.  
  28549.  
  28550.  
  28551.  
  28552.  
  28553.  
  28554.  
  28555.  
  28556.  
  28557.  
  28558.  
  28559.  
  28560.  
  28561.  
  28562.  
  28563.  
  28564.  
  28565.  
  28566.  
  28567.  
  28568.  
  28569.  
  28570.  
  28571.  
  28572.  
  28573.  
  28574.  
  28575.  
  28576.                  423
  28577.  
  28578.  
  28579.  
  28580.  
  28581.  
  28582. X Toolkit Intrinsics                 X11 Release 6.4
  28583.  
  28584.  
  28585.  
  28586.  
  28587.              Appendix F
  28588.  
  28589.          Resource Configuration Management
  28590.  
  28591.  
  28592.  
  28593. Setting and changing resources in X applications can be dif-
  28594. ficult for both the application programmer and the end user.
  28595. Resource Configuration Management (RCM) addresses this prob-
  28596. lem by changing the X Intrinsics to immediately modify a
  28597. resource for a specified widget and each child widget in the
  28598. hierarchy.  In this context, immediate means: no sourcing of
  28599. a resource file is required; the application does not need
  28600. to be restarted for the new resource values to take effect;
  28601. and the change occurs immediately.
  28602.  
  28603. The main difference between RCM and the Editres protocol is
  28604. that the RCM customizing hooks reside in the Intrinsics and
  28605. thus are linked with other toolkits such as Motif and the
  28606. Athena widgets.  However, the EditRes protocol requires the
  28607. application to link with the EditRes routines in the Xmu
  28608. library and Xmu is not used by all applications that use
  28609. Motif.    Also, the EditRes protocol uses ClientMessage,
  28610. whereas the RCM Intrinsics hooks use PropertyNotify events.
  28611.  
  28612. X Properties and the PropertyNotify events are used to
  28613. implement RCM and allow on-the-fly resource customization.
  28614. When the X Toolkit is initialized, two atoms are interned
  28615. with the strings Custom Init and Custom Data.  Both _XtCre-
  28616. atePopupShell and _XtAppCreateShell register a PropertyNo-
  28617. tify event handler to handle these properties.
  28618.  
  28619. A customization tool uses the Custom Init property to ping
  28620. an application to get the application's toplevel window.
  28621. When the application's property notify event handler is
  28622. invoked, the handler deletes the property.  No data is
  28623. transferred in this property.
  28624.  
  28625. A customization tool uses the Custom Data property to tell
  28626. an application that it should change a resource's value.
  28627. The data in the property contains the length of the resource
  28628. name (the number of bytes in the resource name), the
  28629. resource name and the new value for the resource.  This
  28630. property's type is XA_STRING and the format of the string
  28631. is:
  28632.  
  28633. 1.   The length of the resource name (the number of bytes in
  28634.      the resource name)
  28635.  
  28636. 2.   One space character
  28637.  
  28638.  
  28639.  
  28640.  
  28641.  
  28642.                  424
  28643.  
  28644.  
  28645.  
  28646.  
  28647.  
  28648. X Toolkit Intrinsics                 X11 Release 6.4
  28649.  
  28650.  
  28651. 3.   The resource name
  28652.  
  28653. 4.   One space character
  28654.  
  28655. 5.   The resource value
  28656.  
  28657. When setting the application's resource, the event handler
  28658. calls functions to walk the application's widget tree,
  28659. determining which widgets are affected by the resource
  28660. string, and then applying the value with XtSetValues. As the
  28661. widget tree is recursively descended, at each level in the
  28662. widget tree a resource part is tested for a match.  When the
  28663. entire resource string has been matched, the value is
  28664. applied to the widget or widgets.
  28665.  
  28666. Before a value is set on a widget, it is first determined if
  28667. the last part of the resource is a valid resource for that
  28668. widget.  It must also add the resource to the application's
  28669. resource database and then query it using specific resource
  28670. strings that is builds from the widget information.
  28671.  
  28672.  
  28673.  
  28674.  
  28675.  
  28676.  
  28677.  
  28678.  
  28679.  
  28680.  
  28681.  
  28682.  
  28683.  
  28684.  
  28685.  
  28686.  
  28687.  
  28688.  
  28689.  
  28690.  
  28691.  
  28692.  
  28693.  
  28694.  
  28695.  
  28696.  
  28697.  
  28698.  
  28699.  
  28700.  
  28701.  
  28702.  
  28703.  
  28704.  
  28705.  
  28706.  
  28707.  
  28708.                  425
  28709.  
  28710.  
  28711.  
  28712.  
  28713.  
  28714.  
  28715.  
  28716.  
  28717.  
  28718.  
  28719.  
  28720.  
  28721.  
  28722.  
  28723.  
  28724.  
  28725.  
  28726.  
  28727.  
  28728.  
  28729.  
  28730.  
  28731.  
  28732.  
  28733.  
  28734.  
  28735.  
  28736.  
  28737.  
  28738.  
  28739.  
  28740.  
  28741.  
  28742.  
  28743.  
  28744.  
  28745.  
  28746.  
  28747.  
  28748.  
  28749.  
  28750.  
  28751.  
  28752.  
  28753.  
  28754.  
  28755.  
  28756.  
  28757.  
  28758.  
  28759.  
  28760.  
  28761.  
  28762.  
  28763.  
  28764.  
  28765.  
  28766.  
  28767.  
  28768.  
  28769.  
  28770.  
  28771.  
  28772.  
  28773.  
  28774.                  426
  28775.  
  28776.  
  28777.  
  28778.  
  28779.  
  28780.  
  28781.  
  28782.  
  28783.              Table of Contents
  28784.  
  28785.  
  28786. Acknowledgments  . . . . . . . . . . . . . . . . . . . .  ix
  28787. About This Manual  . . . . . . . . . . . . . . . . . . . xii
  28788. Chapter 1 -- Intrinsics and Widgets  . . . . . . . . . .   1
  28789. 1.1. Intrinsics  . . . . . . . . . . . . . . . . . . . .   1
  28790. 1.2. Languages . . . . . . . . . . . . . . . . . . . . .   1
  28791. 1.3. Procedures and Macros . . . . . . . . . . . . . . .   2
  28792. 1.4. Widgets . . . . . . . . . . . . . . . . . . . . . .   2
  28793. 1.4.1. Core Widgets  . . . . . . . . . . . . . . . . . .   3
  28794. 1.4.1.1. CoreClassPart Structure . . . . . . . . . . . .   4
  28795. 1.4.1.2. CorePart Structure  . . . . . . . . . . . . . .   5
  28796. 1.4.1.3. Core Resources  . . . . . . . . . . . . . . . .   7
  28797. 1.4.1.4. CorePart Default Values . . . . . . . . . . . .   7
  28798. 1.4.2. Composite Widgets . . . . . . . . . . . . . . . .   8
  28799. 1.4.2.1. CompositeClassPart Structure  . . . . . . . . .   8
  28800. 1.4.2.2. CompositePart Structure . . . . . . . . . . . .  10
  28801. 1.4.2.3. Composite Resources . . . . . . . . . . . . . .  11
  28802. 1.4.2.4. CompositePart Default Values  . . . . . . . . .  11
  28803. 1.4.3. Constraint Widgets  . . . . . . . . . . . . . . .  11
  28804. 1.4.3.1. ConstraintClassPart Structure . . . . . . . . .  12
  28805. 1.4.3.2. ConstraintPart Structure  . . . . . . . . . . .  13
  28806. 1.4.3.3. Constraint Resources  . . . . . . . . . . . . .  14
  28807. 1.5. Implementation-Specific Types . . . . . . . . . . .  14
  28808. 1.6. Widget Classing . . . . . . . . . . . . . . . . . .  15
  28809. 1.6.1. Widget Naming Conventions . . . . . . . . . . . .  16
  28810. 1.6.2. Widget Subclassing in Public .h Files . . . . . .  18
  28811. 1.6.3. Widget Subclassing in Private .h Files  . . . . .  19
  28812. 1.6.4. Widget Subclassing in .c Files  . . . . . . . . .  21
  28813. 1.6.5. Widget Class and Superclass Look Up . . . . . . .  24
  28814. 1.6.6. Widget Subclass Verification  . . . . . . . . . .  25
  28815. 1.6.7. Superclass Chaining . . . . . . . . . . . . . . .  27
  28816. 1.6.8. Class Initialization: class_initialize and
  28817. class_part_initialize Procedures . . . . . . . . . . . .  28
  28818. 1.6.9. Initializing a Widget Class . . . . . . . . . . .  30
  28819. 1.6.10. Inheritance of Superclass Operations . . . . . .  30
  28820. 1.6.11. Invocation of Superclass Operations  . . . . . .  32
  28821. 1.6.12. Class Extension Records  . . . . . . . . . . . .  33
  28822. Chapter 2 -- Widget Instantiation  . . . . . . . . . . .  36
  28823. 2.1. Initializing the X Toolkit  . . . . . . . . . . . .  37
  28824. 2.2. Establishing the Locale . . . . . . . . . . . . . .  43
  28825. 2.3. Loading the Resource Database . . . . . . . . . . .  45
  28826. 2.4. Parsing the Command Line  . . . . . . . . . . . . .  50
  28827. 2.5. Creating Widgets  . . . . . . . . . . . . . . . . .  53
  28828. 2.5.1. Creating and Merging Argument Lists . . . . . . .  54
  28829. 2.5.2. Creating a Widget Instance  . . . . . . . . . . .  57
  28830. 2.5.3. Creating an Application Shell Instance  . . . . .  60
  28831. 2.5.4. Convenience Procedure to Initialize an Appli-
  28832. cation . . . . . . . . . . . . . . . . . . . . . . . . .  63
  28833. 2.5.5. Widget Instance Allocation: The allocate Pro-
  28834. cedure . . . . . . . . . . . . . . . . . . . . . . . . .  66
  28835. 2.5.6. Widget Instance Initialization: The initial-
  28836. ize Procedure  . . . . . . . . . . . . . . . . . . . . .  69
  28837.  
  28838.  
  28839.  
  28840.                  iii
  28841.  
  28842.  
  28843.  
  28844.  
  28845.  
  28846.  
  28847.  
  28848.  
  28849. 2.5.7. Constraint Instance Initialization: The Con-
  28850. straintClassPart initialize Procedure  . . . . . . . . .  72
  28851. 2.5.8. Nonwidget Data Initialization: The initial-
  28852. ize_hook Procedure . . . . . . . . . . . . . . . . . . .  72
  28853. 2.6. Realizing Widgets . . . . . . . . . . . . . . . . .  73
  28854. 2.6.1. Widget Instance Window Creation: The realize
  28855. Procedure  . . . . . . . . . . . . . . . . . . . . . . .  75
  28856. 2.6.2. Window Creation Convenience Routine . . . . . . .  77
  28857. 2.7. Obtaining Window Information from a Widget  . . . .  78
  28858. 2.7.1. Unrealizing Widgets . . . . . . . . . . . . . . .  81
  28859. 2.8. Destroying Widgets  . . . . . . . . . . . . . . . .  81
  28860. 2.8.1. Adding and Removing Destroy Callbacks . . . . . .  83
  28861. 2.8.2. Dynamic Data Deallocation: The destroy Proce-
  28862. dure . . . . . . . . . . . . . . . . . . . . . . . . . .  84
  28863. 2.8.3. Dynamic Constraint Data Deallocation: The
  28864. ConstraintClassPart destroy Procedure  . . . . . . . . .  85
  28865. 2.8.4. Widget Instance Deallocation: The deallocate
  28866. Procedure  . . . . . . . . . . . . . . . . . . . . . . .  85
  28867. 2.9. Exiting from an Application . . . . . . . . . . . .  86
  28868. Chapter 3 -- Composite Widgets and Their Children  . . .  87
  28869. 3.1. Addition of Children to a Composite Widget: The
  28870. insert_child Procedure . . . . . . . . . . . . . . . . .  88
  28871. 3.2. Insertion Order of Children: The insert_posi-
  28872. tion Procedure . . . . . . . . . . . . . . . . . . . . .  89
  28873. 3.3. Deletion of Children: The delete_child Proce-
  28874. dure . . . . . . . . . . . . . . . . . . . . . . . . . .  90
  28875. 3.4. Adding and Removing Children from the Managed
  28876. Set  . . . . . . . . . . . . . . . . . . . . . . . . . .  91
  28877. 3.4.1. Managing Children . . . . . . . . . . . . . . . .  91
  28878. 3.4.2. Unmanaging Children . . . . . . . . . . . . . . .  94
  28879. 3.4.3. Bundling Changes to the Managed Set . . . . . . .  95
  28880. 3.4.4. Determining if a Widget Is Managed  . . . . . . .  98
  28881. 3.5. Controlling When Widgets Get Mapped . . . . . . . .  99
  28882. 3.6. Constrained Composite Widgets . . . . . . . . . . . 100
  28883. Chapter 4 -- Shell Widgets . . . . . . . . . . . . . . . 103
  28884. 4.1. Shell Widget Definitions  . . . . . . . . . . . . . 103
  28885. 4.1.1. ShellClassPart Definitions  . . . . . . . . . . . 104
  28886. 4.1.2. ShellPart Definition  . . . . . . . . . . . . . . 109
  28887. 4.1.3. Shell Resources . . . . . . . . . . . . . . . . . 113
  28888. 4.1.4. ShellPart Default Values  . . . . . . . . . . . . 116
  28889. 4.2. Session Participation . . . . . . . . . . . . . . . 122
  28890. 4.2.1. Joining a Session . . . . . . . . . . . . . . . . 123
  28891. 4.2.2. Saving Application State  . . . . . . . . . . . . 124
  28892. 4.2.2.1. Requesting Interaction  . . . . . . . . . . . . 126
  28893. 4.2.2.2. Interacting with the User during a Check-
  28894. point  . . . . . . . . . . . . . . . . . . . . . . . . . 127
  28895. 4.2.2.3. Responding to a Shutdown Cancellation . . . . . 128
  28896. 4.2.2.4. Completing a Save . . . . . . . . . . . . . . . 128
  28897. 4.2.3. Responding to a Shutdown  . . . . . . . . . . . . 129
  28898. 4.2.4. Resigning from a Session  . . . . . . . . . . . . 129
  28899. Chapter 5 -- Pop-Up Widgets  . . . . . . . . . . . . . . 130
  28900. 5.1. Pop-Up Widget Types . . . . . . . . . . . . . . . . 130
  28901. 5.2. Creating a Pop-Up Shell . . . . . . . . . . . . . . 131
  28902. 5.3. Creating Pop-Up Children  . . . . . . . . . . . . . 133
  28903.  
  28904.  
  28905.  
  28906.                  iv
  28907.  
  28908.  
  28909.  
  28910.  
  28911.  
  28912.  
  28913.  
  28914.  
  28915. 5.4. Mapping a Pop-Up Widget . . . . . . . . . . . . . . 134
  28916. 5.5. Unmapping a Pop-Up Widget . . . . . . . . . . . . . 138
  28917. Chapter 6 -- Geometry Management . . . . . . . . . . . . 142
  28918. 6.1. Initiating Geometry Changes . . . . . . . . . . . . 142
  28919. 6.2. General Geometry Manager Requests . . . . . . . . . 143
  28920. 6.3. Resize Requests . . . . . . . . . . . . . . . . . . 146
  28921. 6.4. Potential Geometry Changes  . . . . . . . . . . . . 147
  28922. 6.5. Child Geometry Management: The geometry_manager
  28923. Procedure  . . . . . . . . . . . . . . . . . . . . . . . 148
  28924. 6.6. Widget Placement and Sizing . . . . . . . . . . . . 150
  28925. 6.7. Preferred Geometry  . . . . . . . . . . . . . . . . 153
  28926. 6.8. Size Change Management: The resize Procedure
  28927.  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
  28928. Chapter 7 -- Event Management  . . . . . . . . . . . . . 157
  28929. 7.1. Adding and Deleting Additional Event Sources
  28930.  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
  28931. 7.1.1. Adding and Removing Input Sources . . . . . . . . 158
  28932. 7.1.2. Adding and Removing Blocking Notifications
  28933.  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
  28934. 7.1.3. Adding and Removing Timeouts  . . . . . . . . . . 161
  28935. 7.1.4. Adding and Removing Signal Callbacks  . . . . . . 163
  28936. 7.2. Constraining Events to a Cascade of Widgets . . . . 165
  28937. 7.2.1. Requesting Key and Button Grabs . . . . . . . . . 167
  28938. 7.3. Focusing Events on a Child  . . . . . . . . . . . . 174
  28939. 7.3.1. Events for Drawables That Are Not a Widget's
  28940. Window . . . . . . . . . . . . . . . . . . . . . . . . . 177
  28941. 7.4. Querying Event Sources  . . . . . . . . . . . . . . 178
  28942. 7.5. Dispatching Events  . . . . . . . . . . . . . . . . 180
  28943. 7.6. The Application Input Loop  . . . . . . . . . . . . 182
  28944. 7.7. Setting and Checking the Sensitivity State of a
  28945. Widget . . . . . . . . . . . . . . . . . . . . . . . . . 183
  28946. 7.8. Adding Background Work Procedures . . . . . . . . . 185
  28947. 7.9. X Event Filters . . . . . . . . . . . . . . . . . . 186
  28948. 7.9.1. Pointer Motion Compression  . . . . . . . . . . . 187
  28949. 7.9.2. Enter/Leave Compression . . . . . . . . . . . . . 187
  28950. 7.9.3. Exposure Compression  . . . . . . . . . . . . . . 187
  28951. 7.10. Widget Exposure and Visibility . . . . . . . . . . 189
  28952. 7.10.1. Redisplay of a Widget: The expose Procedure
  28953.  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
  28954. 7.10.2. Widget Visibility  . . . . . . . . . . . . . . . 191
  28955. 7.11. X Event Handlers . . . . . . . . . . . . . . . . . 191
  28956. 7.11.1. Event Handlers That Select Events  . . . . . . . 192
  28957. 7.11.2. Event Handlers That Do Not Select Events . . . . 196
  28958. 7.11.3. Current Event Mask . . . . . . . . . . . . . . . 198
  28959. 7.11.4. Event Handlers for X11 Protocol Extensions
  28960.  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
  28961. 7.12. Using the Intrinsics in a Multi-Threaded Envi-
  28962. ronment  . . . . . . . . . . . . . . . . . . . . . . . . 206
  28963. 7.12.1. Initializing a Multi-Threaded Intrinsics
  28964. Application  . . . . . . . . . . . . . . . . . . . . . . 206
  28965. 7.12.2. Locking X Toolkit Data Structures  . . . . . . . 206
  28966. 7.12.2.1. Locking the Application Context  . . . . . . . 208
  28967. 7.12.2.2. Locking the Process  . . . . . . . . . . . . . 208
  28968. 7.12.3. Event Management in a Multi-Threaded Envi-
  28969.  
  28970.  
  28971.  
  28972.                   v
  28973.  
  28974.  
  28975.  
  28976.  
  28977.  
  28978.  
  28979.  
  28980.  
  28981. ronment  . . . . . . . . . . . . . . . . . . . . . . . . 209
  28982. Chapter 8 -- Callbacks . . . . . . . . . . . . . . . . . 211
  28983. 8.1. Using Callback Procedure and Callback List Def-
  28984. initions . . . . . . . . . . . . . . . . . . . . . . . . 211
  28985. 8.2. Identifying Callback Lists  . . . . . . . . . . . . 212
  28986. 8.3. Adding Callback Procedures  . . . . . . . . . . . . 213
  28987. 8.4. Removing Callback Procedures  . . . . . . . . . . . 214
  28988. 8.5. Executing Callback Procedures . . . . . . . . . . . 215
  28989. 8.6. Checking the Status of a Callback List  . . . . . . 217
  28990. Chapter 9 -- Resource Management . . . . . . . . . . . . 218
  28991. 9.1. Resource Lists  . . . . . . . . . . . . . . . . . . 218
  28992. 9.2. Byte Offset Calculations  . . . . . . . . . . . . . 224
  28993. 9.3. Superclass-to-Subclass Chaining of Resource
  28994. Lists  . . . . . . . . . . . . . . . . . . . . . . . . . 225
  28995. 9.4. Subresources  . . . . . . . . . . . . . . . . . . . 226
  28996. 9.5. Obtaining Application Resources . . . . . . . . . . 228
  28997. 9.6. Resource Conversions  . . . . . . . . . . . . . . . 230
  28998. 9.6.1. Predefined Resource Converters  . . . . . . . . . 231
  28999. 9.6.2. New Resource Converters . . . . . . . . . . . . . 234
  29000. 9.6.3. Issuing Conversion Warnings . . . . . . . . . . . 239
  29001. 9.6.4. Registering a New Resource Converter  . . . . . . 240
  29002. 9.6.5. Resource Converter Invocation . . . . . . . . . . 246
  29003. 9.7. Reading and Writing Widget State  . . . . . . . . . 251
  29004. 9.7.1. Obtaining Widget State  . . . . . . . . . . . . . 251
  29005. 9.7.1.1. Widget Subpart Resource Data: The get_val-
  29006. ues_hook Procedure . . . . . . . . . . . . . . . . . . . 254
  29007. 9.7.1.2. Widget Subpart State  . . . . . . . . . . . . . 254
  29008. 9.7.2. Setting Widget State  . . . . . . . . . . . . . . 256
  29009. 9.7.2.1. Widget State: The set_values Procedure  . . . . 258
  29010. 9.7.2.2. Widget State: The set_values_almost Proce-
  29011. dure . . . . . . . . . . . . . . . . . . . . . . . . . . 261
  29012. 9.7.2.3. Widget State: The ConstraintClassPart
  29013. set_values Procedure . . . . . . . . . . . . . . . . . . 262
  29014. 9.7.2.4. Widget Subpart State  . . . . . . . . . . . . . 262
  29015. 9.7.2.5. Widget Subpart Resource Data: The set_val-
  29016. ues_hook Procedure . . . . . . . . . . . . . . . . . . . 264
  29017. Chapter 10 -- Translation Management . . . . . . . . . . 266
  29018. 10.1. Action Tables  . . . . . . . . . . . . . . . . . . 266
  29019. 10.1.1. Action Table Registration  . . . . . . . . . . . 268
  29020. 10.1.2. Action Names to Procedure Translations . . . . . 269
  29021. 10.1.3. Action Hook Registration . . . . . . . . . . . . 269
  29022. 10.2. Translation Tables . . . . . . . . . . . . . . . . 271
  29023. 10.2.1. Event Sequences  . . . . . . . . . . . . . . . . 272
  29024. 10.2.2. Action Sequences . . . . . . . . . . . . . . . . 273
  29025. 10.2.3. Multi-Click Time . . . . . . . . . . . . . . . . 273
  29026. 10.3. Translation Table Management . . . . . . . . . . . 274
  29027. 10.4. Using Accelerators . . . . . . . . . . . . . . . . 277
  29028. 10.5. KeyCode-to-KeySym Conversions  . . . . . . . . . . 280
  29029. 10.6. Obtaining a KeySym in an Action Procedure  . . . . 285
  29030. 10.7. KeySym-to-KeyCode Conversions  . . . . . . . . . . 286
  29031. 10.8. Registering Button and Key Grabs for Actions
  29032.  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
  29033. 10.9. Invoking Actions Directly  . . . . . . . . . . . . 289
  29034. 10.10. Obtaining a Widget's Action List  . . . . . . . . 290
  29035.  
  29036.  
  29037.  
  29038.                  vi
  29039.  
  29040.  
  29041.  
  29042.  
  29043.  
  29044.  
  29045.  
  29046.  
  29047. Chapter 11 -- Utility Functions  . . . . . . . . . . . . 291
  29048. 11.1. Determining the Number of Elements in an Array
  29049.  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
  29050. 11.2. Translating Strings to Widget Instances  . . . . . 292
  29051. 11.3. Managing Memory Usage  . . . . . . . . . . . . . . 293
  29052. 11.4. Sharing Graphics Contexts  . . . . . . . . . . . . 296
  29053. 11.5. Managing Selections  . . . . . . . . . . . . . . . 299
  29054. 11.5.1. Setting and Getting the Selection Timeout
  29055. Value  . . . . . . . . . . . . . . . . . . . . . . . . . 299
  29056. 11.5.2. Using Atomic Transfers . . . . . . . . . . . . . 300
  29057. 11.5.2.1. Atomic Transfer Procedures . . . . . . . . . . 300
  29058. 11.5.2.2. Getting the Selection Value  . . . . . . . . . 304
  29059. 11.5.2.3. Setting the Selection Owner  . . . . . . . . . 306
  29060. 11.5.3. Using Incremental Transfers  . . . . . . . . . . 308
  29061. 11.5.3.1. Incremental Transfer Procedures  . . . . . . . 309
  29062. 11.5.3.2. Getting the Selection Value Incrementally
  29063.  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
  29064. 11.5.3.3. Setting the Selection Owner for Incremen-
  29065. tal Transfers  . . . . . . . . . . . . . . . . . . . . . 316
  29066. 11.5.4. Setting and Retrieving Selection Target
  29067. Parameters . . . . . . . . . . . . . . . . . . . . . . . 318
  29068. 11.5.5. Generating MULTIPLE Requests . . . . . . . . . . 321
  29069. 11.5.6. Auxiliary Selection Properties . . . . . . . . . 322
  29070. 11.5.7. Retrieving the Most Recent Timestamp . . . . . . 323
  29071. 11.5.8. Retrieving the Most Recent Event . . . . . . . . 324
  29072. 11.6. Merging Exposure Events into a Region  . . . . . . 324
  29073. 11.7. Translating Widget Coordinates . . . . . . . . . . 325
  29074. 11.8. Translating a Window to a Widget . . . . . . . . . 326
  29075. 11.9. Handling Errors  . . . . . . . . . . . . . . . . . 326
  29076. 11.10. Setting WM_COLORMAP_WINDOWS . . . . . . . . . . . 334
  29077. 11.11. Finding File Names  . . . . . . . . . . . . . . . 335
  29078. 11.12. Hooks for External Agents . . . . . . . . . . . . 340
  29079. 11.12.1. Hook Object Resources . . . . . . . . . . . . . 341
  29080. 11.12.2. Querying Open Displays  . . . . . . . . . . . . 348
  29081. Chapter 12 -- Nonwidget Objects  . . . . . . . . . . . . 349
  29082. 12.1. Data Structures  . . . . . . . . . . . . . . . . . 349
  29083. 12.2. Object Objects . . . . . . . . . . . . . . . . . . 349
  29084. 12.2.1. ObjectClassPart Structure  . . . . . . . . . . . 349
  29085. 12.2.2. ObjectPart Structure . . . . . . . . . . . . . . 352
  29086. 12.2.3. Object Resources . . . . . . . . . . . . . . . . 353
  29087. 12.2.4. ObjectPart Default Values  . . . . . . . . . . . 353
  29088. 12.2.5. Object Arguments to Intrinsics Routines  . . . . 353
  29089. 12.2.6. Use of Objects . . . . . . . . . . . . . . . . . 354
  29090. 12.3. Rectangle Objects  . . . . . . . . . . . . . . . . 355
  29091. 12.3.1. RectObjClassPart Structure . . . . . . . . . . . 355
  29092. 12.3.2. RectObjPart Structure  . . . . . . . . . . . . . 357
  29093. 12.3.3. RectObj Resources  . . . . . . . . . . . . . . . 358
  29094. 12.3.4. RectObjPart Default Values . . . . . . . . . . . 358
  29095. 12.3.5. Widget Arguments to Intrinsics Routines  . . . . 358
  29096. 12.3.6. Use of Rectangle Objects . . . . . . . . . . . . 359
  29097. 12.4. Undeclared Class . . . . . . . . . . . . . . . . . 361
  29098. 12.5. Widget Arguments to Intrinsics Routines  . . . . . 361
  29099. Chapter 13 -- Evolution of the Intrinsics  . . . . . . . 364
  29100. 13.1. Determining Specification Revision Level . . . . . 364
  29101.  
  29102.  
  29103.  
  29104.                  vii
  29105.  
  29106.  
  29107.  
  29108.  
  29109.  
  29110.  
  29111.  
  29112.  
  29113. 13.2. Release 3 to Release 4 Compatibility . . . . . . . 365
  29114. 13.2.1. Additional Arguments . . . . . . . . . . . . . . 365
  29115. 13.2.2. set_values_almost Procedures . . . . . . . . . . 365
  29116. 13.2.3. Query Geometry . . . . . . . . . . . . . . . . . 365
  29117. 13.2.4. unrealizeCallback Callback List  . . . . . . . . 366
  29118. 13.2.5. Subclasses of WMShell  . . . . . . . . . . . . . 366
  29119. 13.2.6. Resource Type Converters . . . . . . . . . . . . 366
  29120. 13.2.7. KeySym Case Conversion Procedure . . . . . . . . 367
  29121. 13.2.8. Nonwidget Objects  . . . . . . . . . . . . . . . 367
  29122. 13.3. Release 4 to Release 5 Compatibility . . . . . . . 367
  29123. 13.3.1. baseTranslations Resource  . . . . . . . . . . . 368
  29124. 13.3.2. Resource File Search Path  . . . . . . . . . . . 368
  29125. 13.3.3. Customization Resource . . . . . . . . . . . . . 368
  29126. 13.3.4. Per-Screen Resource Database . . . . . . . . . . 369
  29127. 13.3.5. Internationalization of Applications . . . . . . 369
  29128. 13.3.6. Permanently Allocated Strings  . . . . . . . . . 370
  29129. 13.3.7. Arguments to Existing Functions  . . . . . . . . 370
  29130. 13.4. Release 5 to Release 6 Compatibility . . . . . . . 370
  29131. 13.4.1. Widget Internals . . . . . . . . . . . . . . . . 371
  29132. 13.4.2. General Application Development  . . . . . . . . 371
  29133. 13.4.3. Communication with Window and Session Man-
  29134. agers  . . . . . . . . . . . . . . . . . . . . . . . . . 372
  29135. 13.4.4. Geometry Management  . . . . . . . . . . . . . . 372
  29136. 13.4.5. Event Management . . . . . . . . . . . . . . . . 373
  29137. 13.4.6. Resource Management  . . . . . . . . . . . . . . 373
  29138. 13.4.7. Translation Management . . . . . . . . . . . . . 374
  29139. 13.4.8. Selections . . . . . . . . . . . . . . . . . . . 374
  29140. 13.4.9. External Agent Hooks . . . . . . . . . . . . . . 374
  29141. Appendix A -- Resource File Format . . . . . . . . . . . 375
  29142. Appendix B -- Translation Table Syntax . . . . . . . . . 377
  29143. Appendix C -- Compatibility Functions  . . . . . . . . . 387
  29144. Appendix D -- Intrinsics Error Messages  . . . . . . . . 406
  29145. Appendix E -- Defined Strings  . . . . . . . . . . . . . 414
  29146. Appendix F -- Resource Configuration Management  . . . . 424
  29147. Index  . . . . . . . . . . . . . . . . . . . . . . . . . 427
  29148.  
  29149.  
  29150.  
  29151.  
  29152.  
  29153.  
  29154.  
  29155.  
  29156.  
  29157.  
  29158.  
  29159.  
  29160.  
  29161.  
  29162.  
  29163.  
  29164.  
  29165.  
  29166.  
  29167.  
  29168.  
  29169.  
  29170.                 viii
  29171.  
  29172.  
  29173.