home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 August - Disc 2 / chip_20018102_hu.iso / linux / X-4.1.0 / doc / icccm.txt < prev    next >
Text File  |  2001-06-27  |  207KB  |  6,799 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.        Inter-Client Communication Conventions Manual
  17.  
  18.              Version 2.0.xf86.1
  19.  
  20.                XFree86 4.0.2
  21.  
  22.                XFree86, Inc.
  23.  
  24.               based on
  25.  
  26.             Version 2.0
  27.  
  28.            X Consortium Standard
  29.  
  30.          X Version 11, Release 6.4
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.               David Rosenthal
  38.            Sun Microsystems, Inc.
  39.  
  40.  
  41.         Version 2 edited by Stuart W. Marks
  42.                SunSoft, Inc.
  43.  
  44.  
  45.  
  46.  
  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.  
  86. Copyright (C) 1988, 1991, 1993, 1994 X Consortium
  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.  
  116.  
  117. Copyright (C) 1987, 1988, 1989, 1993, 1994 Sun Microsystems,
  118. Inc.
  119.  
  120. Permission to use, copy, modify, and distribute this docu-
  121. mentation for any purpose and without fee is hereby granted,
  122. provided that the above copyright notice and this permission
  123. notice appear in all copies.  Sun Microsystems makes no rep-
  124. resentations about the suitability for any purpose of the
  125. information in this document.  This documentation is pro-
  126. vided as is without express or implied warranty.
  127.  
  128.  
  129.  
  130.                  ii
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  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.                  vi
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.            Preface to Version 2.0
  208.  
  209.  
  210.  
  211. The goal of the ICCCM Version 2.0 effort was to add new
  212. facilities, to fix problems with earlier drafts, and to
  213. improve readability and understandability, while maintaining
  214. compatibility with the earlier versions.  This document is
  215. the product of over two years of discussion among the mem-
  216. bers of the X Consortium's wmtalk working group.  The fol-
  217. lowing people deserve thanks for their contributions:
  218.  
  219.  
  220.      Gabe Beged-Dov           Bill Janssen
  221.      Chan Benson           Vania Joloboff
  222.      Jordan Brown           Phil Karlton
  223.      Larry Cable           Kaleb Keithley
  224.      Ellis Cohen           Mark Manasse
  225.      Donna Converse           Ralph Mor
  226.      Brian Cripe           Todd Newman
  227.      Susan Dahlberg           Bob Scheifler
  228.      Peter Daifuku           Keith Taylor
  229.      Andrew deBlois           Jim VanGilder
  230.      Clive Feather           Mike Wexler
  231.      Stephen Gildea           Michael Yee
  232.      Christian Jacobi
  233.  
  234.  
  235. It has been a privilege for me to work with this fine group
  236. of people.
  237.  
  238. Stuart W. Marks
  239. December 1993
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.                  vii
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.            Preface to Version 1.1
  274.  
  275.  
  276.  
  277. David Rosenthal had overall architectural responsibility for
  278. the conventions defined in this document; he wrote most of
  279. the text and edited the document, but its development has
  280. been a communal effort.  The details were thrashed out in
  281. meetings at the January 1988 MIT X Conference and at the
  282. 1988 Summer Usenix conference, and through months (and
  283. megabytes) of argument on the wmtalk mail alias.  Thanks are
  284. due to everyone who contributed, and especially to the fol-
  285. lowing people.
  286.  
  287. For the Selection section:
  288.  
  289.  
  290.      Jerry Farrell
  291.      Phil Karlton
  292.      Loretta Guarino Reid
  293.      Mark Manasse
  294.      Bob Scheifler
  295.  
  296.  
  297. For the Cut-Buffer section:
  298.  
  299.  
  300.      Andrew Palay
  301.  
  302.  
  303. For the Window and Session Manager sections:
  304.  
  305.  
  306.      Todd Brunhoff           Matt Landau
  307.      Ellis Cohen           Mark Manasse
  308.      Jim Fulton            Bob Scheifler
  309.      Hania Gajewska           Ralph Swick
  310.      Jordan Hubbard           Mike Wexler
  311.      Kerry Kimbrough           Glenn Widener
  312.      Audrey Ishizaki
  313.  
  314.  
  315. For the Device Color Characterization section:
  316.  
  317.      Keith Packard
  318.  
  319.  
  320. In addition, thanks are due to those who contributed to the
  321. public review:
  322.  
  323.  
  324.      Gary Combs            John Irwin
  325.  
  326.  
  327.  
  328.                 viii
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.      Errol Crary           Vania Joloboff
  338.      Nancy Cyprych           John Laporta
  339.      John Diamant           Ken Lee
  340.      Clive Feather           Stuart Marks
  341.      Burns Fisher           Alan Mimms
  342.      Richard Greco           Colas Nahaboo
  343.      Tim Greenwood           Mark Patrick
  344.      Kee Hinckley           Steve Pitschke
  345.      Brian Holt            Brad Reed
  346.      John Interrante           John Thomas
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.                  ix
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403. 1.  Introduction
  404.  
  405. It was an explicit design goal of X Version 11 to specify
  406. mechanism, not policy.    As a result, a client that converses
  407. with the server using the protocol defined by the X Window
  408. System Protocol, Version 11 may operate correctly in isola-
  409. tion but may not coexist properly with others sharing the
  410. same server.
  411.  
  412. Being a good citizen in the X Version 11 world involves
  413. adhering to conventions that govern inter-client communica-
  414. tions in the following areas:
  415.  
  416. o   Selection mechanism
  417.  
  418. o   Cut buffers
  419.  
  420. o   Window manager
  421.  
  422. o   Session manager
  423.  
  424. o   Manipulation of shared resources
  425.  
  426. o   Device color characterization
  427.  
  428. This document proposes suitable conventions without attempt-
  429. ing to enforce any particular user interface.  To permit
  430. clients written in different languages to communicate, these
  431. conventions are expressed solely in terms of protocol opera-
  432. tions, not in terms of their associated Xlib interfaces,
  433. which are probably more familiar.  The binding of these
  434. operations to the Xlib interface for C and to the equivalent
  435. interfaces for other languages is the subject of other docu-
  436. ments.
  437.  
  438. 1.1.  Evolution of the Conventions
  439.  
  440. In the interests of timely acceptance, the Inter-Client Com-
  441. munication Conventions Manual (ICCCM) covers only a minimal
  442. set of required conventions.  These conventions will be
  443. added to and updated as appropriate, based on the experi-
  444. ences of the X Consortium.
  445.  
  446. As far as possible, these conventions are upwardly compati-
  447. ble with those in the February 25, 1988, draft that was dis-
  448. tributed with the X Version 11, Release 2, of the software.
  449. In some areas, semantic problems were discovered with those
  450. conventions, and, thus, complete upward compatibility could
  451. not be assured.  These areas are noted in the text and are
  452. summarized in Appendix A.
  453.  
  454. In the course of developing these conventions, a number of
  455. minor changes to the protocol were identified as desirable.
  456. They also are identified in the text, are summarized in
  457.  
  458.  
  459.  
  460.                   1
  461.  
  462.  
  463.  
  464.  
  465.  
  466. Inter-Client Communication Conventions        X11, Release 6.4
  467.  
  468.  
  469. Appendix B, and are offered as input to a future protocol
  470. revision process.  If and when a protocol revision incorpo-
  471. rating these changes is undertaken, it is anticipated that
  472. the ICCCM will need to be revised.  Because it is difficult
  473. to ensure that clients and servers are upgraded simultane-
  474. ously, clients using the revised conventions should examine
  475. the minor protocol revision number and be prepared to use
  476. the older conventions when communicating with an older
  477. server.
  478.  
  479. It is expected that these revisions will ensure that clients
  480. using the conventions appropriate to protocol minor revision
  481. n will interoperate correctly with those that use the con-
  482. ventions appropriate to protocol minor revision n + 1 if the
  483. server supports both.
  484.  
  485. 1.2.  Atoms
  486.  
  487. Many of the conventions use atoms.  To assist the reader,
  488. the following sections attempt to amplify the description of
  489. atoms that is provided in the protocol specification.
  490.  
  491. 1.2.1.    What Are Atoms?
  492.  
  493. At the conceptual level, atoms are unique names that clients
  494. can use to communicate information to each other.  They can
  495. be thought of as a bundle of octets, like a string but with-
  496. out an encoding being specified.  The elements are not nec-
  497. essarily ASCII characters, and no case folding happens.1
  498.  
  499. The protocol designers felt that passing these sequences of
  500. bytes back and forth across the wire would be too costly.
  501. Further, they thought it important that events as they
  502. appear on the wire have a fixed size (in fact, 32 bytes) and
  503. that because some events contain atoms, a fixed-size repre-
  504. sentation for them was needed.
  505.  
  506. To allow a fixed-size representation, a protocol request
  507. (InternAtom) was provided to register a byte sequence with
  508. the server, which returns a 32-bit value (with the top three
  509. bits zero) that maps to the byte sequence.  The inverse
  510. operator is also available (GetAtomName).
  511.  
  512. 1.2.2.    Predefined Atoms
  513.  
  514. The protocol specifies a number of atoms as being prede-
  515. fined:
  516.  
  517.  
  518. -----------
  519.   1 The comment in the protocol specification for
  520. InternAtom that ISO Latin-1 encoding should be
  521. used is in the nature of a convention; the server
  522. treats the string as a byte sequence.
  523.  
  524.  
  525.  
  526.                   2
  527.  
  528.  
  529.  
  530.  
  531.  
  532. Inter-Client Communication Conventions        X11, Release 6.4
  533.  
  534.  
  535.      Predefined atoms are not strictly necessary and
  536.      may not be useful in all environments, but they
  537.      will eliminate many InternAtom requests in most
  538.      applications.  Note that they are predefined only
  539.      in the sense of having numeric values, not in the
  540.      sense of having required semantics.
  541.  
  542. Predefined atoms are an implementation trick to avoid the
  543. cost of interning many of the atoms that are expected to be
  544. used during the startup phase of all applications.  The
  545. results of the InternAtom requests, which require a hand-
  546. shake, can be assumed a priori.
  547.  
  548. Language interfaces should probably cache the atom-name map-
  549. pings and get them only when required.    The CLX interface,
  550. for instance, makes no distinction between predefined atoms
  551. and other atoms; all atoms are viewed as symbols at the
  552. interface.  However, a CLX implementation will typically
  553. keep a symbol or atom cache and will typically initialize
  554. this cache with the predefined atoms.
  555.  
  556. 1.2.3.    Naming Conventions
  557.  
  558. The built-in atoms are composed of uppercase ASCII charac-
  559. ters with the logical words separated by an underscore char-
  560. acter (_), for example, WM_ICON_NAME.  The protocol specifi-
  561. cation recommends that atoms used for private vendor-spe-
  562. cific reasons should begin with an underscore.    To prevent
  563. conflicts among organizations, additional prefixes should be
  564. chosen (for example,  _DEC_WM_DECORATION_GEOMETRY).
  565.  
  566. The names were chosen in this fashion to make it easy to use
  567. them in a natural way within LISP.  Keyword constructors
  568. allow the programmer to specify the atoms as LISP atoms.  If
  569. the atoms were not all uppercase, special quoting conven-
  570. tions would have to be used.
  571.  
  572. 1.2.4.    Semantics
  573.  
  574. The core protocol imposes no semantics on atoms except as
  575. they are used in FONTPROP structures.  For further informa-
  576. tion on FONTPROP semantics, see the X Logical Font Descrip-
  577. tion Conventions.
  578.  
  579. 1.2.5.    Name Spaces
  580.  
  581. The protocol defines six distinct spaces in which atoms are
  582. interpreted.  Any particular atom may or may not have some
  583. valid interpretation with respect to each of these name
  584. spaces.
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.                   3
  593.  
  594.  
  595.  
  596.  
  597.  
  598. Inter-Client Communication Conventions        X11, Release 6.4
  599.  
  600.  
  601. --------------------------------------------------------------------
  602. Space           Briefly     Examples
  603. --------------------------------------------------------------------
  604. Property name       Name        WM_HINTS, WM_NAME, RGB_BEST_MAP, ...
  605. Property type       Type        WM_HINTS, CURSOR, RGB_COLOR_MAP, ...
  606. Selection name       Selection   PRIMARY, SECONDARY, CLIPBOARD
  607. Selection target   Target      FILE_NAME, POSTSCRIPT, PIXMAP, ...
  608. Font property               QUAD_WIDTH, POINT_SIZE, ...
  609. ClientMessage               WM_SAVE_YOURSELF, _DEC_SAVE_EDITS,
  610. type                   ...
  611. --------------------------------------------------------------------
  612.  
  613.  
  614. 1.2.6.    Discriminated Names
  615.  
  616. Sometimes a protocol requires an arbitrary number of similar
  617. objects that need unique names (usually because the objects
  618. are created dynamically, so that names cannot be invented in
  619. advance). For example, a colormap-generating program might
  620. use the selection mechanism to offer colormaps for each
  621. screen and so needs a selection name for each screen.  Such
  622. names are called "discriminated names" and are discriminated
  623. by some entity. This entity can be:
  624.  
  625.      A screen
  626.      An X resource (a window, a colormap, a visual, etc.)
  627.      A client
  628.  
  629.  
  630. If it is only necessary to generate a fixed set of names for
  631. each value of the discriminating entity, then the discrimi-
  632. nated names are formed by suffixing an ordinary name accord-
  633. ing to the value of the entity.
  634.  
  635. If name is a descriptive portion for the name, d is a deci-
  636. mal number with no leading zeroes, and x is a hexadecimal
  637. number with exactly 8 digits, and using uppercase letters,
  638. then such discriminated names shall have the form:
  639.  
  640. ---------------------------------------------------------
  641. Name Discriminated by    Form      Example
  642. ---------------------------------------------------------
  643. screen number        name_Sd   WM_COMMS_S2
  644. X resource        name_Rx   GROUP_LEADER_R1234ABCD
  645. ---------------------------------------------------------
  646.  
  647.  
  648. To discriminate a name by client, use an X resource ID cre-
  649. ated by that client.  This resource can be of any type.
  650.  
  651. Sometimes it is simply necessary to generate a unique set of
  652. names (for example, for the properties on a window used by a
  653. MULTIPLE selection).  These names should have the form:
  654.  
  655.  
  656.  
  657.  
  658.                   4
  659.  
  660.  
  661.  
  662.  
  663.  
  664. Inter-Client Communication Conventions        X11, Release 6.4
  665.  
  666.  
  667.      Ud          (e.g.,  U0  U1  U2  U3  ...)
  668.  
  669.  
  670. if the names stand totally alone, and the form:
  671.  
  672.      name_Ud         (e.g.,  FOO_U0  BAR_U0  FOO_U1  BAR_U1  ...)
  673.  
  674.  
  675. if they come in sets (here there are two sets, named "FOO"
  676. and "BAR").  The stand-alone Ud form should be used only if
  677. it is clear that the module using it has complete control
  678. over the relevant namespace or has the active cooperation of
  679. all other entities that might also use these names. (Naming
  680. properties on a window created specifically for a particular
  681. selection is such a use; naming properties on the root win-
  682. dow is almost certainly not.)
  683.  
  684. In a particularly difficult case, it might be necessary to
  685. combine both forms of discrimination. If this happens, the U
  686. form should come after the other form, thus:
  687.  
  688.      FOO_R12345678_U23
  689.  
  690.  
  691.              Rationale
  692.  
  693.      Existing protocols will not be changed to use
  694.      these naming conventions, because doing so will
  695.      cause too much disruption.  However, it is
  696.      expected that future protocols -- both standard
  697.      and private -- will use these conventions.
  698.  
  699.  
  700. 2.  Peer-to-Peer Communication by Means of Selections
  701.  
  702. Selections are the primary mechanism that X Version 11
  703. defines for the exchange of information between clients, for
  704. example, by cutting and pasting between windows.  Note that
  705. there can be an arbitrary number of selections (each named
  706. by an atom) and that they are global to the server.  Section
  707. 2.6 discusses the choice of an atom.  Each selection is
  708. owned by a client and is attached to a window.
  709.  
  710. Selections communicate between an owner and a requestor.
  711. The owner has the data representing the value of its selec-
  712. tion, and the requestor receives it.  A requestor wishing to
  713. obtain the value of a selection provides the following:
  714.  
  715. o   The name of the selection
  716.  
  717. o   The name of a property
  718.  
  719. o   A window
  720.  
  721.  
  722.  
  723.  
  724.                   5
  725.  
  726.  
  727.  
  728.  
  729.  
  730. Inter-Client Communication Conventions        X11, Release 6.4
  731.  
  732.  
  733. o   The atom representing the data type required
  734.  
  735. o   Optionally, some parameters for the request
  736.  
  737. If the selection is currently owned, the owner receives an
  738. event and is expected to do the following:
  739.  
  740. o   Convert the contents of the selection to the requested
  741.     data type
  742.  
  743. o   Place this data in the named property on the named win-
  744.     dow
  745.  
  746. o   Send the requestor an event to let it know the property
  747.     is available
  748.  
  749. Clients are strongly encouraged to use this mechanism.    In
  750. particular, displaying text in a permanent window without
  751. providing the ability to select and convert it into a string
  752. is definitely considered antisocial.
  753.  
  754. Note that all data transferred between an owner and a
  755. requestor must usually go by means of the server in an X
  756. Version 11 environment.  A client cannot assume that another
  757. client can open the same files or even communicate directly.
  758. The other client may be talking to the server by means of a
  759. completely different networking mechanism (for example,  one
  760. client might be DECnet and the other TCP/IP).  Thus, passing
  761. indirect references to data (such as, file names, host
  762. names, and port numbers) is permitted only if both clients
  763. specifically agree.
  764.  
  765. 2.1.  Acquiring Selection Ownership
  766.  
  767. A client wishing to acquire ownership of a particular selec-
  768. tion should call SetSelectionOwner, which is defined as fol-
  769. lows:
  770.  
  771. __
  772. |    SetSelectionOwner
  773.  
  774.   selection: ATOM
  775.   owner: WINDOW or None
  776.   time: TIMESTAMP or CurrentTime
  777. |__
  778.  
  779.  
  780. The client should set the specified selection to the atom
  781. that represents the selection, set the specified owner to
  782. some window that the client created, and set the specified
  783. time to some time between the current last-change time of
  784. the selection concerned and the current server time.  This
  785. time value usually will be obtained from the timestamp of
  786. the event that triggers the acquisition of the selection.
  787.  
  788.  
  789.  
  790.                   6
  791.  
  792.  
  793.  
  794.  
  795.  
  796. Inter-Client Communication Conventions        X11, Release 6.4
  797.  
  798.  
  799. Clients should not set the time value to CurrentTime,
  800. because if they do so, they have no way of finding when they
  801. gained ownership of the selection.  Clients must use a win-
  802. dow they created so that requestors can route events to the
  803. owner of the selection.2
  804.  
  805.              Convention
  806.  
  807.      Clients attempting to acquire a selection must set
  808.      the time value of the SetSelectionOwner request to
  809.      the timestamp of the event triggering the acquisi-
  810.      tion attempt, not to CurrentTime.    A zero-length
  811.      append to a property is a way to obtain a time-
  812.      stamp for this purpose; the timestamp is in the
  813.      corresponding PropertyNotify event.
  814.  
  815.  
  816. If the time in the SetSelectionOwner request is in the
  817. future relative to the server's current time or is in the
  818. past relative to the last time the specified selection
  819. changed hands, the SetSelectionOwner request appears to the
  820. client to succeed, but ownership is not actually trans-
  821. ferred.
  822.  
  823. Because clients cannot name other clients directly, the
  824. specified owner window is used to refer to the owning client
  825. in the replies to GetSelectionOwner, in SelectionRequest and
  826. SelectionClear events, and possibly as a place to put prop-
  827. erties describing the selection in question.  To discover
  828. the owner of a particular selection, a client should invoke
  829. GetSelectionOwner, which is defined as follows:
  830.  
  831. __
  832. |    GetSelectionOwner
  833.  
  834.   selection: ATOM
  835.  
  836. ->
  837.  
  838.   owner: WINDOW or None
  839. |__
  840.  
  841.  
  842.              Convention
  843.  
  844.      Clients are expected to provide some visible con-
  845.      firmation of selection ownership.    To make this
  846.      feedback reliable, a client must perform a
  847.      sequence like the following:
  848. -----------
  849.   2 At present, no part of the protocol requires
  850. requestors to send events to the owner of a selec-
  851. tion.  This restriction is imposed to prepare for
  852. possible future extensions.
  853.  
  854.  
  855.  
  856.                   7
  857.  
  858.  
  859.  
  860.  
  861.  
  862. Inter-Client Communication Conventions        X11, Release 6.4
  863.  
  864.  
  865.      SetSelectionOwner(selection=PRIMARY, owner=Window, time=timestamp)
  866.      owner = GetSelectionOwner(selection=PRIMARY)
  867.      if (owner != Window) Failure
  868.  
  869.  
  870.  
  871. If the SetSelectionOwner request succeeds (not merely
  872. appears to succeed), the client that issues it is recorded
  873. by the server as being the owner of the selection for the
  874. time period starting at the specified time.
  875.  
  876. 2.2.  Responsibilities of the Selection Owner
  877.  
  878. When a requestor wants the value of a selection, the owner
  879. receives a SelectionRequest event, which is defined as fol-
  880. lows:
  881.  
  882. __
  883. |    SelectionRequest
  884.  
  885.   owner: WINDOW
  886.   selection: ATOM
  887.   target: ATOM
  888.   property: ATOM or None
  889.   requestor: WINDOW
  890.   time: TIMESTAMP or CurrentTime
  891. |__
  892.  
  893.  
  894. The specified owner and selection will be the values that
  895. were specified in the SetSelectionOwner request.  The owner
  896. should compare the timestamp with the period it has owned
  897. the selection and, if the time is outside, refuse the Selec-
  898. tionRequest by sending the requestor window a SelectionNo-
  899. tify event with the property set to None (by means of a
  900. SendEvent request with an empty event mask).
  901.  
  902. More advanced selection owners are free to maintain a his-
  903. tory of the value of the selection and to respond to
  904. requests for the value of the selection during periods they
  905. owned it even though they do not own it now.
  906.  
  907. If the specified property is None, the requestor is an obso-
  908. lete client.  Owners are encouraged to support these clients
  909. by using the specified target atom as the property name to
  910. be used for the reply.
  911.  
  912. Otherwise, the owner should use the target to decide the
  913. form into which the selection should be converted.  Some
  914. targets may be defined such that requestors can pass parame-
  915. ters along with the request.  The owner will find these
  916. parameters in the property named in the selection request.
  917. The type, format, and contents of this property are depen-
  918. dent upon the definition of the target.  If the target is
  919.  
  920.  
  921.  
  922.                   8
  923.  
  924.  
  925.  
  926.  
  927.  
  928. Inter-Client Communication Conventions        X11, Release 6.4
  929.  
  930.  
  931. not defined to have parameters, the owner should ignore the
  932. property if it is present.  If the selection cannot be con-
  933. verted into a form based on the target (and parameters, if
  934. any), the owner should refuse the SelectionRequest as previ-
  935. ously described.
  936.  
  937. If the specified property is not None, the owner should
  938. place the data resulting from converting the selection into
  939. the specified property on the requestor window and should
  940. set the property's type to some appropriate value, which
  941. need not be the same as the specified target.
  942.  
  943.              Convention
  944.  
  945.      All properties used to reply to SelectionRequest
  946.      events must be placed on the requestor window.
  947.  
  948.  
  949. In either case, if the data comprising the selection cannot
  950. be stored on the requestor window (for example, because the
  951. server cannot provide sufficient memory), the owner must
  952. refuse the SelectionRequest, as previously described.  See
  953. also section 2.5.
  954.  
  955. If the property is successfully stored, the owner should
  956. acknowledge the successful conversion by sending the
  957. requestor window a SelectionNotify event (by means of a
  958. SendEvent request with an empty mask).    SelectionNotify is
  959. defined as follows:
  960.  
  961. __
  962. |    SelectionNotify
  963.  
  964.   requestor: WINDOW
  965.   selection, target: ATOM
  966.   property: ATOM or None
  967.   time: TIMESTAMP or CurrentTime
  968. |__
  969.  
  970.  
  971. The owner should set the specified selection, target, time,
  972. and property arguments to the values received in the Selec-
  973. tionRequest event.  (Note that setting the property argument
  974. to None indicates that the conversion requested could not be
  975. made.)
  976.  
  977.              Convention
  978.  
  979.      The selection, target, time, and property argu-
  980.      ments in the SelectionNotify event should be set
  981.      to the values received in the SelectionRequest
  982.      event.
  983.  
  984.  
  985.  
  986.  
  987.  
  988.                   9
  989.  
  990.  
  991.  
  992.  
  993.  
  994. Inter-Client Communication Conventions        X11, Release 6.4
  995.  
  996.  
  997. If the owner receives more than one SelectionRequest event
  998. with the same requestor, selection, target, and timestamp it
  999. must respond to them in the same order in which they were
  1000. received.
  1001.  
  1002.              Rationale
  1003.  
  1004.      It is possible for a requestor to have multiple
  1005.      outstanding requests that use the same requestor
  1006.      window, selection, target, and timestamp, and that
  1007.      differ only in the property.  If this occurs, and
  1008.      one of the conversion requests fails, the result-
  1009.      ing SelectionNotify event will have its property
  1010.      argument set to None.  This may make it impossible
  1011.      for the requestor to determine which conversion
  1012.      request had failed, unless the requests are
  1013.      responded to in order.
  1014.  
  1015.  
  1016. The data stored in the property must eventually be deleted.
  1017. A convention is needed to assign the responsibility for
  1018. doing so.
  1019.  
  1020.              Convention
  1021.  
  1022.      Selection requestors are responsible for deleting
  1023.      properties whose names they receive in Selection-
  1024.      Notify events (see section 2.4) or in properties
  1025.      with type MULTIPLE.
  1026.  
  1027.  
  1028. A selection owner will often need confirmation that the data
  1029. comprising the selection has actually been transferred.
  1030. (For example, if the operation has side effects on the
  1031. owner's internal data structures, these should not take
  1032. place until the requestor has indicated that it has success-
  1033. fully received the data.)  Owners should express interest in
  1034. PropertyNotify events for the specified requestor window and
  1035. wait until the property in the SelectionNotify event has
  1036. been deleted before assuming that the selection data has
  1037. been transferred.  For the MULTIPLE request, if the differ-
  1038. ent conversions require separate confirmation, the selection
  1039. owner can also watch for the deletion of the individual
  1040. properties named in the property in the SelectionNotify
  1041. event.
  1042.  
  1043. When some other client acquires a selection, the previous
  1044. owner receives a SelectionClear event, which is defined as
  1045. follows:
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.                  10
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060. Inter-Client Communication Conventions        X11, Release 6.4
  1061.  
  1062. __
  1063. |    SelectionClear
  1064.  
  1065.   owner: WINDOW
  1066.   selection: ATOM
  1067.   time: TIMESTAMP
  1068. |__
  1069.  
  1070.  
  1071. The timestamp argument is the time at which the ownership
  1072. changed hands, and the owner argument is the window the pre-
  1073. vious owner specified in its SetSelectionOwner request.
  1074.  
  1075. If an owner loses ownership while it has a transfer in
  1076. progress (that is, before it receives notification that the
  1077. requestor has received all the data), it must continue to
  1078. service the ongoing transfer until it is complete.
  1079.  
  1080. If the selection value completely changes, but the owner
  1081. happens to be the same client (for example, selecting a
  1082. totally different piece of text in the same xterm as
  1083. before), then the client should reacquire the selection own-
  1084. ership as if it were not the owner, providing a new time-
  1085. stamp. If the selection value is modified, but can still
  1086. reasonably be viewed as the same selected object,3 the owner
  1087. should take no action.
  1088.  
  1089. 2.3.  Giving Up Selection Ownership
  1090.  
  1091. Clients may either give up selection ownership voluntarily
  1092. or lose it forcibly as the result of some other client's
  1093. actions.
  1094.  
  1095. 2.3.1.    Voluntarily Giving Up Selection Ownership
  1096.  
  1097. To relinquish ownership of a selection voluntarily, a client
  1098. should execute a SetSelectionOwner request for that selec-
  1099. tion atom, with owner specified as None and the time speci-
  1100. fied as the timestamp that was used to acquire the selec-
  1101. tion.
  1102.  
  1103. Alternatively, the client may destroy the window used as the
  1104. owner value of the SetSelectionOwner request, or the client
  1105. may terminate.    In both cases, the ownership of the selec-
  1106. tion involved will revert to None.
  1107.  
  1108. 2.3.2.    Forcibly Giving Up Selection Ownership
  1109.  
  1110. If a client gives up ownership of a selection or if some
  1111. other client executes a SetSelectionOwner for it and thus
  1112. reassigns it forcibly, the previous owner will receive a
  1113. -----------
  1114.   3 The division between these two cases is a mat-
  1115. ter of judgment on the part of the software devel-
  1116. oper.
  1117.  
  1118.  
  1119.  
  1120.                  11
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126. Inter-Client Communication Conventions        X11, Release 6.4
  1127.  
  1128.  
  1129. SelectionClear event. For the definition of a SelectionClear
  1130. event, see section 2.2.
  1131.  
  1132. The timestamp is the time the selection changed hands.    The
  1133. specified owner is the window that was specified by the cur-
  1134. rent owner in its SetSelectionOwner request.
  1135.  
  1136. 2.4.  Requesting a Selection
  1137.  
  1138. A client that wishes to obtain the value of a selection in a
  1139. particular form (the requestor) issues a ConvertSelection
  1140. request, which is defined as follows:
  1141.  
  1142. __
  1143. |    ConvertSelection
  1144.  
  1145.   selection, target: ATOM
  1146.   property: ATOM or None
  1147.   requestor: WINDOW
  1148.   time: TIMESTAMP or CurrentTime
  1149. |__
  1150.  
  1151.  
  1152. The selection argument specifies the particular selection
  1153. involved, and the target argument specifies the required
  1154. form of the information.  For information about the choice
  1155. of suitable atoms to use, see section 2.6.  The requestor
  1156. should set the requestor argument to a window that it cre-
  1157. ated; the owner will place the reply property there.  The
  1158. requestor should set the time argument to the timestamp on
  1159. the event that triggered the request for the selection
  1160. value.    Note that clients should not specify CurrentTime.
  1161.  
  1162.              Convention
  1163.  
  1164.      Clients should not use CurrentTime for the time
  1165.      argument of a ConvertSelection request.  Instead,
  1166.      they should use the timestamp of the event that
  1167.      caused the request to be made.
  1168.  
  1169.  
  1170. The requestor should set the property argument to the name
  1171. of a property that the owner can use to report the value of
  1172. the selection.    Requestors should ensure that the named
  1173. property does not exist on the window before issuing the
  1174. ConvertSelection request.4 The exception to this rule is
  1175. when the requestor intends to pass parameters with the
  1176. request (see below).
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.                  12
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192. Inter-Client Communication Conventions        X11, Release 6.4
  1193.  
  1194.  
  1195.              Rationale
  1196.  
  1197.      It is necessary for requestors to delete the prop-
  1198.      erty before issuing the request so that the target
  1199.      can later be extended to take parameters without
  1200.      introducing an incompatibility.  Also note that
  1201.      the requestor of a selection need not know the
  1202.      client that owns the selection nor the window on
  1203.      which the selection was acquired.
  1204.  
  1205.  
  1206. Some targets may be defined such that requestors can pass
  1207. parameters along with the request.  If the requestor wishes
  1208. to provide parameters to a request, they should be placed in
  1209. the specified property on the requestor window before the
  1210. requestor issues the ConvertSelection request, and this
  1211. property should be named in the request.
  1212.  
  1213. Some targets may be defined so that parameters are optional.
  1214. If no parameters are to be supplied with the request of such
  1215. a target, the requestor must ensure that the property does
  1216. not exist before issuing the ConvertSelection request.
  1217.  
  1218. The protocol allows the property field to be set to None, in
  1219. which case the owner is supposed to choose a property name.
  1220. However, it is difficult for the owner to make this choice
  1221. safely.
  1222.  
  1223.             Conventions
  1224.  
  1225.  
  1226.      1.   Requestors should not use None for the prop-
  1227.       erty argument of a ConvertSelection request.
  1228.  
  1229.      2.   Owners receiving ConvertSelection requests
  1230.       with a property argument of None are talking
  1231.       to an obsolete client.  They should choose
  1232.       the target atom as the property name to be
  1233.       used for the reply.
  1234.  
  1235.  
  1236. The result of the ConvertSelection request is that a Selec-
  1237. tionNotify event will be received.  For the definition of a
  1238. -----------
  1239.   4 This requirement is new in version 2.0, and,
  1240. in general, existing clients do not conform to
  1241. this requirement.  To prevent these clients from
  1242. breaking, no existing targets should be extended
  1243. to take parameters until sufficient time has
  1244. passed for clients to be updated.  Note that the
  1245. MULTIPLE target was defined to take parameters in
  1246. version 1.0 and its definition is not changing.
  1247. There is thus no conformance problem with MULTI-
  1248. PLE.
  1249.  
  1250.  
  1251.  
  1252.                  13
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258. Inter-Client Communication Conventions        X11, Release 6.4
  1259.  
  1260.  
  1261. SelectionNotify event, see section 2.2.
  1262.  
  1263. The requestor, selection, time, and target arguments will be
  1264. the same as those on the ConvertSelection request.
  1265.  
  1266. If the property argument is None, the conversion has been
  1267. refused.  This can mean either that there is no owner for
  1268. the selection, that the owner does not support the conver-
  1269. sion implied by the target, or that the server did not have
  1270. sufficient space to accommodate the data.
  1271.  
  1272. If the property argument is not None, then that property
  1273. will exist on the requestor window.  The value of the selec-
  1274. tion can be retrieved from this property by using the Get-
  1275. Property request, which is defined as follows:
  1276.  
  1277. __
  1278. |    GetProperty
  1279.  
  1280.   window: WINDOW
  1281.   property: ATOM
  1282.   type: ATOM or AnyPropertyType
  1283.   long-offset, long-length: CARD32
  1284.   delete: BOOL
  1285.  
  1286. ->
  1287.  
  1288.   type: ATOM or None
  1289.   format: {0, 8, 16, 32}
  1290.   bytes-after: CARD32
  1291.   value: LISTofINT8 or LISTofINT16 or LISTofINT32
  1292. |__
  1293.  
  1294.  
  1295. When using GetProperty to retrieve the value of a selection,
  1296. the property argument should be set to the corresponding
  1297. value in the SelectionNotify event.  Because the requestor
  1298. has no way of knowing beforehand what type the selection
  1299. owner will use, the type argument should be set to
  1300. AnyPropertyType.  Several GetProperty requests may be needed
  1301. to retrieve all the data in the selection; each should set
  1302. the long-offset argument to the amount of data received so
  1303. far, and the size argument to some reasonable buffer size
  1304. (see section 2.5).  If the returned value of bytes-after is
  1305. zero, the whole property has been transferred.
  1306.  
  1307. Once all the data in the selection has been retrieved (which
  1308. may require getting the values of several properties -- see
  1309. section 2.7), the requestor should delete the property in
  1310. the SelectionNotify request by using a GetProperty request
  1311. with the delete argument set to True.  As previously dis-
  1312. cussed, the owner has no way of knowing when the data has
  1313. been transferred to the requestor unless the property is
  1314. removed.
  1315.  
  1316.  
  1317.  
  1318.                  14
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324. Inter-Client Communication Conventions        X11, Release 6.4
  1325.  
  1326.  
  1327.              Convention
  1328.  
  1329.      The requestor must delete the property named in
  1330.      the SelectionNotify once all the data has been
  1331.      retrieved.  The requestor should invoke either
  1332.      DeleteProperty or GetProperty(delete==True) after
  1333.      it has successfully retrieved all the data in the
  1334.      selection.  For further information, see section
  1335.      2.5.
  1336.  
  1337.  
  1338. 2.5.  Large Data Transfers
  1339.  
  1340. Selections can get large, which poses two problems:
  1341.  
  1342. o   Transferring large amounts of data to the server is
  1343.     expensive.
  1344.  
  1345. o   All servers will have limits on the amount of data that
  1346.     can be stored in properties.  Exceeding this limit will
  1347.     result in an Alloc error on the ChangeProperty request
  1348.     that the selection owner uses to store the data.
  1349.  
  1350. The problem of limited server resources is addressed by the
  1351. following conventions:
  1352.  
  1353.             Conventions
  1354.  
  1355.  
  1356.      1.   Selection owners should transfer the data
  1357.       describing a large selection (relative to the
  1358.       maximum-request-size they received in the
  1359.       connection handshake) using the INCR property
  1360.       mechanism (see section 2.7.2).
  1361.  
  1362.      2.   Any client using SetSelectionOwner to acquire
  1363.       selection ownership should arrange to process
  1364.       Alloc errors in property change requests.
  1365.       For clients using Xlib, this involves using
  1366.       the XSetErrorHandler function to override the
  1367.       default handler.
  1368.  
  1369.      3.   A selection owner must confirm that no Alloc
  1370.       error occurred while storing the properties
  1371.       for a selection before replying with a con-
  1372.       firming SelectionNotify event.
  1373.  
  1374.      4.   When storing large amounts of data (relative
  1375.       to maximum-request-size), clients should use
  1376.       a sequence of ChangeProperty(mode==Append)
  1377.       requests for reasonable quantities of data.
  1378.       This avoids locking servers up and limits the
  1379.       waste of data an Alloc error would cause.
  1380.  
  1381.  
  1382.  
  1383.  
  1384.                  15
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390. Inter-Client Communication Conventions        X11, Release 6.4
  1391.  
  1392.  
  1393.      5.   If an Alloc error occurs during the storing
  1394.       of the selection data, all properties stored
  1395.       for this selection should be deleted and the
  1396.       ConvertSelection request should be refused
  1397.       (see section 2.2).
  1398.  
  1399.      6.   To avoid locking servers up for inordinate
  1400.       lengths of time, requestors retrieving large
  1401.       quantities of data from a property should
  1402.       perform a series of GetProperty requests,
  1403.       each asking for a reasonable amount of data.
  1404.  
  1405.  
  1406.            Advice to Implementors
  1407.  
  1408.      Single-threaded servers should take care to avoid
  1409.      locking up during large data transfers.
  1410.  
  1411.  
  1412. 2.6.  Use of Selection Atoms
  1413.  
  1414. Defining a new atom consumes resources in the server that
  1415. are not released until the server reinitializes.  Thus,
  1416. reducing the need for newly minted atoms is an important
  1417. goal for the use of the selection atoms.
  1418.  
  1419. 2.6.1.    Selection Atoms
  1420.  
  1421. There can be an arbitrary number of selections, each named
  1422. by an atom.  To conform with the inter-client conventions,
  1423. however, clients need deal with only these three selections:
  1424.  
  1425. o   PRIMARY
  1426.  
  1427. o   SECONDARY
  1428.  
  1429. o   CLIPBOARD
  1430.  
  1431. Other selections may be used freely for private communica-
  1432. tion among related groups of clients.
  1433.  
  1434. 2.6.1.1.  The PRIMARY Selection
  1435.  
  1436. The selection named by the atom PRIMARY is used for all com-
  1437. mands that take only a single argument and is the principal
  1438. means of communication between clients that use the selec-
  1439. tion mechanism.
  1440.  
  1441. 2.6.1.2.  The SECONDARY Selection
  1442.  
  1443. The selection named by the atom SECONDARY is used:
  1444.  
  1445. o   As the second argument to commands taking two arguments
  1446.     (for example, "exchange primary and secondary
  1447.  
  1448.  
  1449.  
  1450.                  16
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456. Inter-Client Communication Conventions        X11, Release 6.4
  1457.  
  1458.  
  1459.     selections")
  1460.  
  1461. o   As a means of obtaining data when there is a primary
  1462.     selection and the user does not want to disturb it
  1463.  
  1464. 2.6.1.3.  The CLIPBOARD Selection
  1465.  
  1466. The selection named by the atom CLIPBOARD is used to hold
  1467. data that is being transferred between clients, that is,
  1468. data that usually is being cut and then pasted or copied and
  1469. then pasted.  Whenever a client wants to transfer data to
  1470. the clipboard:
  1471.  
  1472. o   It should assert ownership of the CLIPBOARD.
  1473.  
  1474. o   If it succeeds in acquiring ownership, it should be pre-
  1475.     pared to respond to a request for the contents of the
  1476.     CLIPBOARD in the usual way (retaining the data to be
  1477.     able to return it).  The request may be generated by the
  1478.     clipboard client described below.
  1479.  
  1480. o   If it fails to acquire ownership, a cutting client
  1481.     should not actually perform the cut or provide feedback
  1482.     that would suggest that it has actually transferred data
  1483.     to the clipboard.
  1484.  
  1485. The owner should repeat this process whenever the data to be
  1486. transferred would change.
  1487.  
  1488. Clients wanting to paste data from the clipboard should
  1489. request the contents of the CLIPBOARD selection in the usual
  1490. way.
  1491.  
  1492. Except while a client is actually deleting or copying data,
  1493. the owner of the CLIPBOARD selection may be a single, spe-
  1494. cial client implemented for the purpose.  This client main-
  1495. tains the content of the clipboard up-to-date and responds
  1496. to requests for data from the clipboard as follows:
  1497.  
  1498. o   It should assert ownership of the CLIPBOARD selection
  1499.     and reassert it any time the clipboard data changes.
  1500.  
  1501. o   If it loses the selection (because another client has
  1502.     some new data for the clipboard), it should:
  1503.  
  1504.     -     Obtain the contents of the selection from the new
  1505.      owner by using the timestamp in the SelectionClear
  1506.      event.
  1507.  
  1508.     -     Attempt to reassert ownership of the CLIPBOARD
  1509.      selection by using the same timestamp.
  1510.  
  1511.     -     Restart the process using a newly acquired time-
  1512.      stamp if this attempt fails.  This timestamp should
  1513.  
  1514.  
  1515.  
  1516.                  17
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522. Inter-Client Communication Conventions        X11, Release 6.4
  1523.  
  1524.  
  1525.      be obtained by asking the current owner of the
  1526.      CLIPBOARD selection to convert it to a TIMESTAMP.
  1527.      If this conversion is refused or if the same time-
  1528.      stamp is received twice, the clipboard client
  1529.      should acquire a fresh timestamp in the usual way
  1530.      (for example by a zero-length append to a prop-
  1531.      erty).
  1532.  
  1533. o   It should respond to requests for the CLIPBOARD contents
  1534.     in the usual way.
  1535.  
  1536. A special CLIPBOARD client is not necessary.  The protocol
  1537. used by the cutting client and the pasting client is the
  1538. same whether the CLIPBOARD client is running or not.  The
  1539. reasons for running the special client include:
  1540.  
  1541. o   Stability - If the cutting client were to crash or ter-
  1542.     minate, the clipboard value would still be available.
  1543.  
  1544. o   Feedback - The clipboard client can display the contents
  1545.     of the clipboard.
  1546.  
  1547. o   Simplicity - A client deleting data does not have to
  1548.     retain it for so long, thus reducing the chance of race
  1549.     conditions causing problems.
  1550.  
  1551. The reasons not to run the clipboard client include:
  1552.  
  1553. o   Performance - Data is transferred only if it is actually
  1554.     required (that is, when some client actually wants the
  1555.     data).
  1556.  
  1557. o   Flexibility - The clipboard data may be available as
  1558.     more than one target.
  1559.  
  1560. 2.6.2.    Target Atoms
  1561.  
  1562. The atom that a requestor supplies as the target of a Con-
  1563. vertSelection request determines the form of the data sup-
  1564. plied.    The set of such atoms is extensible, but a generally
  1565. accepted base set of target atoms is needed.  As a starting
  1566. point for this, the following table contains those that have
  1567. been suggested so far.
  1568.  
  1569. ---------------------------------------------------------------------
  1570. Atom             Type         Data Received
  1571. ---------------------------------------------------------------------
  1572. ADOBE_PORTABLE_DOCUMENT_FORMAT
  1573.              STRING         [1]
  1574. APPLE_PICT         APPLE_PICT      [2]
  1575. BACKGROUND         PIXEL         A list of pixel values
  1576. BITMAP             BITMAP         A list of bitmap IDs
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.                  18
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588. Inter-Client Communication Conventions        X11, Release 6.4
  1589.  
  1590.  
  1591. ---------------------------------------------------------------------
  1592. Atom             Type         Data Received
  1593. ---------------------------------------------------------------------
  1594. CHARACTER_POSITION   SPAN         The start and end of the selec-
  1595.                      tion in bytes
  1596. CLASS             TEXT         (see section 4.1.2.5)
  1597. CLIENT_WINDOW         WINDOW         Any top-level window owned by
  1598.                      the selection owner
  1599. COLORMAP         COLORMAP         A list of colormap IDs
  1600. COLUMN_NUMBER         SPAN         The start and end column num-
  1601.                      bers
  1602. COMPOUND_TEXT         COMPOUND_TEXT   Compound Text
  1603. DELETE             NULL         (see section 2.6.3.1)
  1604. DRAWABLE         DRAWABLE         A list of drawable IDs
  1605. ENCAPSULATED_POSTSCRIPT
  1606.              STRING         [3], Appendix H5
  1607. ENCAPSULATED_POSTSCRIPT_INTERCHANGE
  1608.              STRING         [3], Appendix H
  1609. FILE_NAME         TEXT         The full path name of a file
  1610. FOREGROUND         PIXEL         A list of pixel values
  1611. HOST_NAME         TEXT         (see section 4.1.2.9)
  1612. INSERT_PROPERTY      NULL         (see section 2.6.3.3)
  1613. INSERT_SELECTION     NULL         (see section 2.6.3.2)
  1614. LENGTH             INTEGER         The number of bytes in the
  1615.                      selection6
  1616. LINE_NUMBER         SPAN         The start and end line numbers
  1617. LIST_LENGTH         INTEGER         The number of disjoint parts of
  1618.                      the selection
  1619. MODULE             TEXT         The name of the selected proce-
  1620.                      dure
  1621. MULTIPLE         ATOM_PAIR         (see the discussion that fol-
  1622.                      lows)
  1623. NAME             TEXT         (see section 4.1.2.1)
  1624. ODIF             TEXT         ISO Office Document Interchange
  1625.                      Format
  1626. OWNER_OS         TEXT         The operating system of the
  1627.                      owner client
  1628. PIXMAP             PIXMAP7         A list of pixmap IDs
  1629. POSTSCRIPT         STRING         [3]
  1630. PROCEDURE         TEXT         The name of the selected proce-
  1631.                      dure
  1632. PROCESS          INTEGER, TEXT   The process ID of the owner
  1633. STRING             STRING         ISO Latin-1 (+TAB+NEWLINE) text
  1634. TARGETS          ATOM         A list of valid target atoms
  1635. TASK             INTEGER, TEXT   The task ID of the owner
  1636. TEXT             TEXT         The text in the owner's choice
  1637.                      of encoding
  1638. TIMESTAMP         INTEGER         The timestamp used to acquire
  1639.                      the selection
  1640. USER             TEXT         The name of the user running
  1641.                      the owner
  1642. UTF8_STRING         TEXT         UTF-8 text
  1643. ---------------------------------------------------------------------
  1644.  
  1645.  
  1646.  
  1647.  
  1648.                  19
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654. Inter-Client Communication Conventions        X11, Release 6.4
  1655.  
  1656.  
  1657. References:
  1658.  
  1659. [1]  Adobe Systems, Incorporated.  Portable Document Format
  1660.      Reference Manual.    Reading, MA, Addison-Wesley, ISBN
  1661.      0-201-62628-4.
  1662.  
  1663. [2]  Apple Computer, Incorporated.  Inside Macintosh, Volume
  1664.      V.  Chapter 4, "Color QuickDraw," Color Picture Format.
  1665.      ISBN 0-201-17719-6.
  1666.  
  1667. [3]  Adobe Systems, Incorporated.  PostScript Language Ref-
  1668.      erence Manual.  Reading, MA, Addison-Wesley, ISBN
  1669.      0-201-18127-4.
  1670.  
  1671. It is expected that this table will grow over time.
  1672.  
  1673. Selection owners are required to support the following tar-
  1674. gets.  All other targets are optional.
  1675.  
  1676. o   TARGETS - The owner should return a list of atoms that
  1677.     represent the targets for which an attempt to convert
  1678.     the current selection will succeed (barring unforseeable
  1679.     problems such as Alloc errors).  This list should
  1680.     include all the required atoms.
  1681.  
  1682. o   MULTIPLE - The MULTIPLE target atom is valid only when a
  1683.     property is specified on the ConvertSelection request.
  1684.     If the property argument in the SelectionRequest event
  1685.     is None and the target is MULTIPLE, it should be
  1686.     refused.
  1687.  
  1688.  
  1689. -----------
  1690.   5 Earlier versions of this document erroneously
  1691. specified that conversion of the PIXMAP target
  1692. returns a property of type DRAWABLE instead of
  1693. PIXMAP.  Implementors should be aware of this and
  1694. may want to support the DRAWABLE type as well to
  1695. allow for compatibility with older clients.
  1696.   6 The targets ENCAPSULATED_POSTSCRIPT and ENCAP-
  1697. SULATED_POSTSCRIPT_INTERCHANGE are equivalent to
  1698. the targets _ADOBE_EPS and _ADOBE_EPSI (respec-
  1699. tively) that appear in the selection targets reg-
  1700. istry.    The _ADOBE_ targets are deprecated, but
  1701. clients are encouraged to continue to support them
  1702. for backward compatibility.
  1703.   7 This definition is ambiguous, as the selection
  1704. may be converted into any of several targets that
  1705. may return differing amounts of data.  The
  1706. requestor has no way of knowing which, if any, of
  1707. these targets corresponds to the result of LENGTH.
  1708. Clients are advised that no guarantees can be made
  1709. about the result of a conversion to LENGTH; its
  1710. use is thus deprecated.
  1711.  
  1712.  
  1713.  
  1714.                  20
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720. Inter-Client Communication Conventions        X11, Release 6.4
  1721.  
  1722.  
  1723.     When a selection owner receives a SelectionRequest(tar-
  1724.     get==MULTIPLE) request, the contents of the property
  1725.     named in the request will be a list of atom pairs: the
  1726.     first atom naming a target and the second naming a prop-
  1727.     erty (None is not valid here).  The effect should be as
  1728.     if the owner had received a sequence of SelectionRequest
  1729.     events (one for each atom pair) except that:
  1730.  
  1731.     -     The owner should reply with a SelectionNotify only
  1732.      when all the requested conversions have been per-
  1733.      formed.
  1734.  
  1735.     -     If the owner fails to convert the target named by
  1736.      an atom in the MULTIPLE property, it should replace
  1737.      that atom in the property with None.
  1738.  
  1739.                Convention
  1740.  
  1741.      The entries in a MULTIPLE property must be
  1742.      processed in the order they appear in the
  1743.      property.  For further information, see sec-
  1744.      tion 2.6.3.
  1745.  
  1746.  
  1747.     The requestor should delete each individual property
  1748.     when it has copied the data from that conversion, and
  1749.     the property specified in the MULTIPLE request when it
  1750.     has copied all the data.
  1751.  
  1752.     The requests are otherwise to be processed indepen-
  1753.     dently, and they should succeed or fail independently.
  1754.     The MULTIPLE target is an optimization that reduces the
  1755.     amount of protocol traffic between the owner and the
  1756.     requestor; it is not a transaction mechanism.  For exam-
  1757.     ple, a client may issue a MULTIPLE request with two tar-
  1758.     gets: a data target and the DELETE target.    The DELETE
  1759.     target will still be processed even if the conversion of
  1760.     the data target fails.
  1761.  
  1762. o   TIMESTAMP - To avoid some race conditions, it is impor-
  1763.     tant that requestors be able to discover the timestamp
  1764.     the owner used to acquire ownership.  Until and unless
  1765.     the protocol is changed so that a GetSelectionOwner
  1766.     request returns the timestamp used to acquire ownership,
  1767.     selection owners must support conversion to TIMESTAMP,
  1768.     returning the timestamp they used to obtain the selec-
  1769.     tion.
  1770.  
  1771. 2.6.3.    Selection Targets with Side Effects
  1772.  
  1773. Some targets (for example, DELETE) have side effects.  To
  1774. render these targets unambiguous, the entries in a MULTIPLE
  1775. property must be processed in the order that they appear in
  1776. the property.
  1777.  
  1778.  
  1779.  
  1780.                  21
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786. Inter-Client Communication Conventions        X11, Release 6.4
  1787.  
  1788.  
  1789. In general, targets with side effects will return no infor-
  1790. mation, that is, they will return a zero length property of
  1791. type NULL.  (Type NULL means the result of InternAtom on the
  1792. string "NULL", not the value zero.)  In all cases, the
  1793. requested side effect must be performed before the conver-
  1794. sion is accepted.  If the requested side effect cannot be
  1795. performed, the corresponding conversion request must be
  1796. refused.
  1797.  
  1798.             Conventions
  1799.  
  1800.  
  1801.      1.   Targets with side effects should return no
  1802.       information (that is, they should have a
  1803.       zero-length property of type NULL).
  1804.  
  1805.      2.   The side effect of a target must be performed
  1806.       before the conversion is accepted.
  1807.  
  1808.      3.   If the side effect of a target cannot be per-
  1809.       formed, the corresponding conversion request
  1810.       must be refused.
  1811.  
  1812.  
  1813.               Problem
  1814.  
  1815.      The need to delay responding to the ConvertSelec-
  1816.      tion request until a further conversion has suc-
  1817.      ceeded poses problems for the Intrinsics interface
  1818.      that need to be addressed.
  1819.  
  1820.  
  1821. These side-effect targets are used to implement operations
  1822. such as "exchange PRIMARY and SECONDARY selections."
  1823.  
  1824. 2.6.3.1.  DELETE
  1825.  
  1826. When the owner of a selection receives a request to convert
  1827. it to DELETE, it should delete the corresponding selection
  1828. (whatever doing so means for its internal data structures)
  1829. and return a zero-length property of type NULL if the dele-
  1830. tion was successful.
  1831.  
  1832. 2.6.3.2.  INSERT_SELECTION
  1833.  
  1834. When the owner of a selection receives a request to convert
  1835. it to INSERT_SELECTION, the property named will be of type
  1836. ATOM_PAIR.  The first atom will name a selection, and the
  1837. second will name a target.  The owner should use the selec-
  1838. tion mechanism to convert the named selection into the named
  1839. target and should insert it at the location of the selection
  1840. for which it got the INSERT_SELECTION request (whatever
  1841. doing so means for its internal data structures).
  1842.  
  1843.  
  1844.  
  1845.  
  1846.                  22
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852. Inter-Client Communication Conventions        X11, Release 6.4
  1853.  
  1854.  
  1855. 2.6.3.3.  INSERT_PROPERTY
  1856.  
  1857. When the owner of a selection receives a request to convert
  1858. it to INSERT_PROPERTY, it should insert the property named
  1859. in the request at the location of the selection for which it
  1860. got the INSERT_SELECTION request (whatever doing so means
  1861. for its internal data structures).
  1862.  
  1863. 2.7.  Use of Selection Properties
  1864.  
  1865. The names of the properties used in selection data transfer
  1866. are chosen by the requestor.  The use of None property
  1867. fields in ConvertSelection requests (which request the
  1868. selection owner to choose a name) is not permitted by these
  1869. conventions.
  1870.  
  1871. The selection owner always chooses the type of the property
  1872. in the selection data transfer.  Some types have special
  1873. semantics assigned by convention, and these are reviewed in
  1874. the following sections.
  1875.  
  1876. In all cases, a request for conversion to a target should
  1877. return either a property of one of the types listed in the
  1878. previous table for that target or a property of type INCR
  1879. and then a property of one of the listed types.
  1880.  
  1881. Certain selection properties may contain resource IDs.    The
  1882. selection owner should ensure that the resource is not
  1883. destroyed and that its contents are not changed until after
  1884. the selection transfer is complete.  Requestors that rely on
  1885. the existence or on the proper contents of a resource must
  1886. operate on the resource (for example, by copying the con-
  1887. tents of a pixmap) before deleting the selection property.
  1888.  
  1889. The selection owner will return a list of zero or more items
  1890. of the type indicated by the property type.  In general, the
  1891. number of items in the list will correspond to the number of
  1892. disjoint parts of the selection.  Some targets (for example,
  1893. side-effect targets) will be of length zero irrespective of
  1894. the number of disjoint selection parts.  In the case of
  1895. fixed-size items, the requestor may determine the number of
  1896. items by the property size.  Selection property types are
  1897. listed in the table below.  For variable-length items such
  1898. as text, the separators are also listed.
  1899.  
  1900. -------------------------------------
  1901. Type Atom    Format     Separator
  1902. -------------------------------------
  1903. APPLE_PICT      8     Self-sizing
  1904. ATOM          32     Fixed-size
  1905. ATOM_PAIR      32     Fixed-size
  1906. BITMAP          32     Fixed-size
  1907. C_STRING      8     Zero
  1908.  
  1909.  
  1910.  
  1911.  
  1912.                  23
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918. Inter-Client Communication Conventions        X11, Release 6.4
  1919.  
  1920.  
  1921. -------------------------------------
  1922. Type Atom    Format     Separator
  1923. -------------------------------------
  1924. COLORMAP      32     Fixed-size
  1925. COMPOUND_TEXT      8     Zero
  1926. DRAWABLE      32     Fixed-size
  1927. INCR          32     Fixed-size
  1928. INTEGER       32     Fixed-size
  1929. PIXEL          32     Fixed-size
  1930. PIXMAP          32     Fixed-size
  1931. SPAN          32     Fixed-size
  1932. STRING          8     Zero
  1933. UTF8_STRING      8     Zero
  1934. WINDOW          32     Fixed-size
  1935. -------------------------------------
  1936.  
  1937.  
  1938. It is expected that this table will grow over time.
  1939.  
  1940. 2.7.1.    TEXT Properties
  1941.  
  1942. In general, the encoding for the characters in a text string
  1943. property is specified by its type.  It is highly desirable
  1944. for there to be a simple, invertible mapping between string
  1945. property types and any character set names embedded within
  1946. font names in any font naming standard adopted by the Con-
  1947. sortium.
  1948.  
  1949. The atom TEXT is a polymorphic target.    Requesting conver-
  1950. sion into TEXT will convert into whatever encoding is conve-
  1951. nient for the owner.  The encoding chosen will be indicated
  1952. by the type of the property returned.  TEXT is not defined
  1953. as a type; it will never be the returned type from a selec-
  1954. tion conversion request.
  1955.  
  1956. If the requestor wants the owner to return the contents of
  1957. the selection in a specific encoding, it should request con-
  1958. version into the name of that encoding.
  1959.  
  1960. In the table in section 2.6.2, the word TEXT (in the Type
  1961. column) is used to indicate one of the registered encoding
  1962. names.    The type would not actually be TEXT; it would be
  1963. STRING or some other ATOM naming the encoding chosen by the
  1964. owner.
  1965.  
  1966. STRING as a type or a target specifies the ISO Latin-1 char-
  1967. acter set plus the control characters TAB (hex 09) and NEW-
  1968. LINE (hex 0A).    The spacing interpretation of TAB is context
  1969. dependent.  Other ASCII control characters are explicitly
  1970. not included in STRING at the present time.
  1971.  
  1972. COMPOUND_TEXT as a type or a target specifies the Compound
  1973. Text interchange format; see the Compound Text Encoding.
  1974.  
  1975.  
  1976.  
  1977.  
  1978.                  24
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984. Inter-Client Communication Conventions        X11, Release 6.4
  1985.  
  1986.  
  1987. UTF8_STRING as a type or a target specifies an UTF-8 encoded
  1988. string, with NEWLINE (U+000A, hex 0A) as end-of-line marker.
  1989.  
  1990. There are some text objects where the source or intended
  1991. user, as the case may be, does not have a specific character
  1992. set for the text, but instead merely requires a zero-termi-
  1993. nated sequence of bytes with no other restriction; no ele-
  1994. ment of the selection mechanism may assume that any byte
  1995. value is forbidden or that any two differing sequences are
  1996. equivalent.8  For these objects, the type C_STRING should be
  1997. used.
  1998.  
  1999.              Rationale
  2000.  
  2001.      An example of the need for C_STRING is to transmit
  2002.      the names of files; many operating systems do not
  2003.      interpret filenames as having a character set. For
  2004.      example, the same character string uses a differ-
  2005.      ent sequence of bytes in ASCII and EBCDIC, and so
  2006.      most operating systems see these as different
  2007.      filenames and offer no way to treat them as the
  2008.      same. Thus no character-set based property type is
  2009.      suitable.
  2010.  
  2011.  
  2012. Type STRING, COMPOUND_TEXT, UTF8_STRING, and C_STRING prop-
  2013. erties will consist of a list of elements separated by null
  2014. characters; other encodings will need to specify an appro-
  2015. priate list format.
  2016.  
  2017. 2.7.2.    INCR Properties
  2018.  
  2019. Requestors may receive a property of type INCR9 in response
  2020. to any target that results in selection data.  This indi-
  2021. cates that the owner will send the actual data incremen-
  2022. tally.    The contents of the INCR property will be an inte-
  2023. ger, which represents a lower bound on the number of bytes
  2024. of data in the selection.  The requestor and the selection
  2025. owner transfer the data in the selection in the following
  2026. manner.
  2027.  
  2028. The selection requestor starts the transfer process by
  2029. deleting the (type==INCR) property forming the reply to the
  2030. selection.
  2031. -----------
  2032.   8 Note that this is different from STRING, where
  2033. many byte values are forbidden, and from COM-
  2034. POUND_TEXT, where, for example, inserting the
  2035. sequence 27, 40, 66 (designate ASCII into GL) at
  2036. the start does not alter the meaning.
  2037.   9 These properties were called INCREMENTAL in an
  2038. earlier draft.    The protocol for using them has
  2039. changed, and so the name has changed to avoid con-
  2040. fusion.
  2041.  
  2042.  
  2043.  
  2044.                  25
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050. Inter-Client Communication Conventions        X11, Release 6.4
  2051.  
  2052.  
  2053. The selection owner then:
  2054.  
  2055. o   Appends the data in suitable-size chunks to the same
  2056.     property on the same window as the selection reply with
  2057.     a type corresponding to the actual type of the converted
  2058.     selection.    The size should be less than the maximum-
  2059.     request-size in the connection handshake.
  2060.  
  2061. o   Waits between each append for a
  2062.     PropertyNotify(state==Deleted) event that shows that the
  2063.     requestor has read the data.  The reason for doing this
  2064.     is to limit the consumption of space in the server.
  2065.  
  2066. o   Waits (after the entire data has been transferred to the
  2067.     server) until a PropertyNotify(state==Deleted) event
  2068.     that shows that the data has been read by the requestor
  2069.     and then writes zero-length data to the property.
  2070.  
  2071. The selection requestor:
  2072.  
  2073. o   Waits for the SelectionNotify event.
  2074.  
  2075. o   Loops:
  2076.  
  2077.     -     Retrieving data using GetProperty with the delete
  2078.      argument True.
  2079.  
  2080.     -     Waiting for a PropertyNotify with the state argu-
  2081.      ment NewValue.
  2082.  
  2083. o   Waits until the property named by the PropertyNotify
  2084.     event is zero-length.
  2085.  
  2086. o   Deletes the zero-length property.
  2087.  
  2088. The type of the converted selection is the type of the first
  2089. partial property.  The remaining partial properties must
  2090. have the same type.
  2091.  
  2092. 2.7.3.    DRAWABLE Properties
  2093.  
  2094. Requestors may receive properties of type PIXMAP, BITMAP,
  2095. DRAWABLE, or WINDOW, which contain an appropriate ID.  While
  2096. information about these drawables is available from the
  2097. server by means of the GetGeometry request, the following
  2098. items are not:
  2099.  
  2100. o   Foreground pixel
  2101.  
  2102. o   Background pixel
  2103.  
  2104. o   Colormap ID
  2105.  
  2106.  
  2107.  
  2108.  
  2109.  
  2110.                  26
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116. Inter-Client Communication Conventions        X11, Release 6.4
  2117.  
  2118.  
  2119. In general, requestors converting into targets whose
  2120. returned type in the table in section 2.6.2 is one of the
  2121. DRAWABLE types should expect to convert also into the fol-
  2122. lowing targets (using the MULTIPLE mechanism):
  2123.  
  2124. o   FOREGROUND returns a PIXEL value.
  2125.  
  2126. o   BACKGROUND returns a PIXEL value.
  2127.  
  2128. o   COLORMAP returns a colormap ID.
  2129.  
  2130. 2.7.4.    SPAN Properties
  2131.  
  2132. Properties with type SPAN contain a list of cardinal-pairs
  2133. with the length of the cardinals determined by the format.
  2134. The first specifies the starting position, and the second
  2135. specifies the ending position plus one.  The base is zero.
  2136. If they are the same, the span is zero-length and is before
  2137. the specified position.  The units are implied by the target
  2138. atom, such as LINE_NUMBER or CHARACTER_POSITION.
  2139.  
  2140. 2.8.  Manager Selections
  2141.  
  2142. Certain clients, often called managers, take on responsibil-
  2143. ity for managing shared resources.  A client that manages a
  2144. shared resource should take ownership of an appropriate
  2145. selection, named using the conventions described in sections
  2146. 1.2.3 and 1.2.6.  A client that manages multiple shared
  2147. resources (or groups of resources) should take ownership of
  2148. a selection for each one.
  2149.  
  2150. The manager may support conversion of various targets for
  2151. that selection.  Managers are encouraged to use this tech-
  2152. nique as the primary means by which clients interact with
  2153. the managed resource.  Note that the conventions for inter-
  2154. acting with the window manager predate this section; as a
  2155. result many interactions with the window manager use other
  2156. techniques.
  2157.  
  2158. Before a manager takes ownership of a manager selection, it
  2159. should use the GetSelectionOwner request to check whether
  2160. the selection is already owned by another client, and, where
  2161. appropriate, it should ask the user if the new manager
  2162. should replace the old one.  If so, it may then take owner-
  2163. ship of the selection.    Managers should acquire the selec-
  2164. tion using a window created expressly for this purpose.
  2165. Managers must conform to the rules for selection owners
  2166. described in sections 2.1 and 2.2, and they must also sup-
  2167. port the required targets listed in section 2.6.2.
  2168.  
  2169. If a manager loses ownership of a manager selection, this
  2170. means that a new manager is taking over its responsibili-
  2171. ties.  The old manager must release all resources it has
  2172. managed and must then destroy the window that owned the
  2173.  
  2174.  
  2175.  
  2176.                  27
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182. Inter-Client Communication Conventions        X11, Release 6.4
  2183.  
  2184.  
  2185. selection.  For example, a window manager losing ownership
  2186. of WM_S2 must deselect from SubstructureRedirect on the root
  2187. window of screen 2 before destroying the window that owned
  2188. WM_S2.
  2189.  
  2190. When the new manager notices that the window owning the
  2191. selection has been destroyed, it knows that it can success-
  2192. fully proceed to control the resource it is planning to man-
  2193. age.  If the old manager does not destroy the window within
  2194. a reasonable time, the new manager should check with the
  2195. user before destroying the window itself or killing the old
  2196. manager.
  2197.  
  2198. If a manager wants to give up, on its own, management of a
  2199. shared resource controlled by a selection, it must do so by
  2200. releasing the resources it is managing and then by destroy-
  2201. ing the window that owns the selection.  It should not first
  2202. disown the selection, since this introduces a race condi-
  2203. tion.
  2204.  
  2205. Clients who are interested in knowing when the owner of a
  2206. manager selection is no longer managing the corresponding
  2207. shared resource should select for StructureNotify on the
  2208. window owning the selection so they can be notified when the
  2209. window is destroyed.  Clients are warned that after doing a
  2210. GetSelectionOwner and selecting for StructureNotify, they
  2211. should do a GetSelectionOwner again to ensure that the owner
  2212. did not change after initially getting the selection owner
  2213. and before selecting for StructureNotify.
  2214.  
  2215. Immediately after a manager successfully acquires ownership
  2216. of a manager selection, it should announce its arrival by
  2217. sending a ClientMessage event.    This event should be sent
  2218. using the SendEvent protocol request with the following
  2219. arguments:
  2220.  
  2221. ---------------------------------------------------------------
  2222. Argument     Value
  2223. ---------------------------------------------------------------
  2224. destination:     the root window of screen 0, or the root win-
  2225.          dow of the appropriate screen if the manager
  2226.          is managing a screen-specific resource
  2227. propagate:     False
  2228. event-mask:     StructureNotify
  2229. event:         ClientMessage
  2230.     type:     MANAGER
  2231.     format:     32
  2232.     data[0]:10     timestamp
  2233.     data[1]:     manager selection atom
  2234.     data[2]:     the window owning the selection
  2235.     data[3]:     manager-selection-specific data
  2236.     data[4]:     manager-selection-specific data
  2237. ---------------------------------------------------------------
  2238.  
  2239.  
  2240.  
  2241.  
  2242.                  28
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248. Inter-Client Communication Conventions        X11, Release 6.4
  2249.  
  2250.  
  2251. Clients that wish to know when a specific manager has
  2252. started should select for StructureNotify on the appropriate
  2253. root window and should watch for the appropriate MANAGER
  2254. ClientMessage.
  2255.  
  2256. 3.  Peer-to-Peer Communication by Means of Cut Buffers
  2257.  
  2258. The cut buffer mechanism is much simpler but much less pow-
  2259. erful than the selection mechanism.  The selection mechanism
  2260. is active in that it provides a link between the owner and
  2261. requestor clients.  The cut buffer mechanism is passive; an
  2262. owner places data in a cut buffer from which a requestor
  2263. retrieves the data at some later time.
  2264.  
  2265. The cut buffers consist of eight properties on the root of
  2266. screen zero, named by the predefined atoms CUT_BUFFER0 to
  2267. CUT_BUFFER7.  These properties must, at present, have type
  2268. STRING and format 8.  A client that uses the cut buffer
  2269. mechanism must initially ensure that all eight properties
  2270. exist by using ChangeProperty requests to append zero-length
  2271. data to each.
  2272.  
  2273. A client that stores data in the cut buffers (an owner)
  2274. first must rotate the ring of buffers by plus 1 by using
  2275. RotateProperties requests to rename each buffer; that is,
  2276. CUT_BUFFER0 to CUT_BUFFER1, CUT_BUFFER1 to CUT_BUFFER2, ...,
  2277. and CUT_BUFFER7 to CUT_BUFFER0.  It then must store the data
  2278. into CUT_BUFFER0 by using a ChangeProperty request in mode
  2279. Replace.
  2280.  
  2281. A client that obtains data from the cut buffers should use a
  2282. GetProperty request to retrieve the contents of CUT_BUFFER0.
  2283.  
  2284. In response to a specific user request, a client may rotate
  2285. the cut buffers by minus 1 by using RotateProperties
  2286. requests to rename each buffer; that is, CUT_BUFFER7 to
  2287. CUT_BUFFER6, CUT_BUFFER6 to CUT_BUFFER5, ..., and
  2288. CUT_BUFFER0 to CUT_BUFFER7.
  2289.  
  2290. Data should be stored to the cut buffers and the ring
  2291. rotated only when requested by explicit user action.  Users
  2292. depend on their mental model of cut buffer operation and
  2293. need to be able to identify operations that transfer data to
  2294. and fro.
  2295.  
  2296.  
  2297.  
  2298.  
  2299. -----------
  2300.   10 We use the notation data[n] to indicate the
  2301. nth element of the LISTofINT8, LISTofINT16, or
  2302. LISTofINT32 in the data field of the
  2303. ClientMessage, according to the format field.  The
  2304. list is indexed from zero.
  2305.  
  2306.  
  2307.  
  2308.                  29
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314. Inter-Client Communication Conventions        X11, Release 6.4
  2315.  
  2316.  
  2317. 4.  Client-to-Window-Manager Communication
  2318.  
  2319. To permit window managers to perform their role of mediating
  2320. the competing demands for resources such as screen space,
  2321. the clients being managed must adhere to certain conventions
  2322. and must expect the window managers to do likewise.  These
  2323. conventions are covered here from the client's point of
  2324. view.
  2325.  
  2326. In general, these conventions are somewhat complex and will
  2327. undoubtedly change as new window management paradigms are
  2328. developed.  Thus, there is a strong bias toward defining
  2329. only those conventions that are essential and that apply
  2330. generally to all window management paradigms.  Clients
  2331. designed to run with a particular window manager can easily
  2332. define private protocols to add to these conventions, but
  2333. they must be aware that their users may decide to run some
  2334. other window manager no matter how much the designers of the
  2335. private protocol are convinced that they have seen the "one
  2336. true light" of user interfaces.
  2337.  
  2338. It is a principle of these conventions that a general client
  2339. should neither know nor care which window manager is running
  2340. or, indeed, if one is running at all.  The conventions do
  2341. not support all client functions without a window manager
  2342. running; for example, the concept of Iconic is not directly
  2343. supported by clients.  If no window manager is running, the
  2344. concept of Iconic does not apply.  A goal of the conventions
  2345. is to make it possible to kill and restart window managers
  2346. without loss of functionality.
  2347.  
  2348. Each window manager will implement a particular window man-
  2349. agement policy; the choice of an appropriate window manage-
  2350. ment policy for the user's circumstances is not one for an
  2351. individual client to make but will be made by the user or
  2352. the user's system administrator.  This does not exclude the
  2353. possibility of writing clients that use a private protocol
  2354. to restrict themselves to operating only under a specific
  2355. window manager.  Rather, it merely ensures that no claim of
  2356. general utility is made for such programs.
  2357.  
  2358. For example, the claim is often made: "The client I'm writ-
  2359. ing is important, and it needs to be on top." Perhaps it is
  2360. important when it is being run in earnest, and it should
  2361. then be run under the control of a window manager that rec-
  2362. ognizes "important" windows through some private protocol
  2363. and ensures that they are on top.  However, imagine, for
  2364. example, that the "important" client is being debugged.
  2365. Then,  ensuring that it is always on top is no longer the
  2366. appropriate window management policy, and it should be run
  2367. under a window manager that allows other windows (for exam-
  2368. ple, the debugger) to appear on top.
  2369.  
  2370.  
  2371.  
  2372.  
  2373.  
  2374.                  30
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380. Inter-Client Communication Conventions        X11, Release 6.4
  2381.  
  2382.  
  2383. 4.1.  Client's Actions
  2384.  
  2385. In general, the object of the X Version 11 design is that
  2386. clients should, as far as possible, do exactly what they
  2387. would do in the absence of a window manager, except for the
  2388. following:
  2389.  
  2390. o   Hinting to the window manager about the resources they
  2391.     would like to obtain
  2392.  
  2393. o   Cooperating with the window manager by accepting the
  2394.     resources they are allocated even if they are not those
  2395.     requested
  2396.  
  2397. o   Being prepared for resource allocations to change at any
  2398.     time
  2399.  
  2400. 4.1.1.    Creating a Top-Level Window
  2401.  
  2402. A client's top-level window is a window whose override-redi-
  2403. rect attribute is False.  It must either be a child of a
  2404. root window, or it must have been a child of a root window
  2405. immediately prior to having been reparented by the window
  2406. manager.  If the client reparents the window away from the
  2407. root, the window is no longer a top-level window; but it can
  2408. become a top-level window again if the client reparents it
  2409. back to the root.
  2410.  
  2411. A client usually would expect to create its top-level win-
  2412. dows as children of one or more of the root windows by using
  2413. some boilerplate like the following:
  2414.  
  2415.  
  2416. win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), xsh.x, xsh.y,
  2417.             xsh.width, xsh.height, bw, bd, bg);
  2418.  
  2419.  
  2420. If a particular one of the root windows was required, how-
  2421. ever, it could use something like the following:
  2422.  
  2423.  
  2424. win = XCreateSimpleWindow(dpy, RootWindow(dpy, screen), xsh.x, xsh.y,
  2425.             xsh.width, xsh.height, bw, bd, bg);
  2426.  
  2427.  
  2428. Ideally, it should be possible to override the choice of a
  2429. root window and allow clients (including window managers) to
  2430. treat a nonroot window as a pseudo-root.  This would allow,
  2431. for example, the testing of window managers and the use of
  2432. application-specific window managers to control the subwin-
  2433. dows owned by the members of a related suite of clients.
  2434. Doing so properly requires an extension, the design of which
  2435. is under study.
  2436.  
  2437.  
  2438.  
  2439.  
  2440.                  31
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446. Inter-Client Communication Conventions        X11, Release 6.4
  2447.  
  2448.  
  2449. From the client's point of view, the window manager will
  2450. regard its top-level window as being in one of three states:
  2451.  
  2452. o   Normal
  2453.  
  2454. o   Iconic
  2455.  
  2456. o   Withdrawn
  2457.  
  2458. Newly created windows start in the Withdrawn state.  Transi-
  2459. tions between states happen when the top-level window is
  2460. mapped and unmapped and when the window manager receives
  2461. certain messages.  For further details, see sections 4.1.2.4
  2462. and 4.1.4.
  2463.  
  2464. 4.1.2.    Client Properties
  2465.  
  2466. Once the client has one or more top-level windows, it should
  2467. place properties on those windows to inform the window man-
  2468. ager of the behavior that the client desires.  Window man-
  2469. agers will assume values they find convenient for any of
  2470. these properties that are not supplied; clients that depend
  2471. on particular values must explicitly supply them.  The win-
  2472. dow manager will not change properties written by the
  2473. client.
  2474.  
  2475. The window manager will examine the contents of these prop-
  2476. erties when the window makes the transition from the With-
  2477. drawn state and will monitor some properties for changes
  2478. while the window is in the Iconic or Normal state.  When the
  2479. client changes one of these properties, it must use Replace
  2480. mode to overwrite the entire property with new data; the
  2481. window manager will retain no memory of the old value of the
  2482. property.  All fields of the property must be set to suit-
  2483. able values in a single Replace mode ChangeProperty request.
  2484. This ensures that the full contents of the property will be
  2485. available to a new window manager if the existing one
  2486. crashes, if it is shut down and restarted, or if the session
  2487. needs to be shut down and restarted by the session manager.
  2488.  
  2489.              Convention
  2490.  
  2491.      Clients writing or rewriting window manager prop-
  2492.      erties must ensure that the entire content of each
  2493.      property remains valid at all times.
  2494.  
  2495.  
  2496. Some of these properties may contain the IDs of resources,
  2497. such as windows or pixmaps.  Clients should ensure that
  2498. these resources exist for at least as long as the window on
  2499. which the property resides.
  2500.  
  2501. If these properties are longer than expected, clients should
  2502. ignore the remainder of the property.  Extending these
  2503.  
  2504.  
  2505.  
  2506.                  32
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512. Inter-Client Communication Conventions        X11, Release 6.4
  2513.  
  2514.  
  2515. properties is reserved to the X Consortium; private exten-
  2516. sions to them are forbidden.  Private additional communica-
  2517. tion between clients and window managers should take place
  2518. using separate properties.  The only exception to this rule
  2519. is the WM_PROTOCOLS property, which may be of arbitrary
  2520. length and which may contain atoms representing private pro-
  2521. tocols (see section 4.1.2.7).
  2522.  
  2523. The next sections describe each of the properties the
  2524. clients need to set, in turn.  They are summarized in the
  2525. table in section 4.4.
  2526.  
  2527. 4.1.2.1.  WM_NAME Property
  2528.  
  2529. The WM_NAME property is an uninterpreted string that the
  2530. client wants the window manager to display in association
  2531. with the window (for example, in a window headline bar).
  2532.  
  2533. The encoding used for this string (and all other uninter-
  2534. preted string properties) is implied by the type of the
  2535. property.  The type atoms to be used for this purpose are
  2536. described in section 2.7.1.
  2537.  
  2538. Window managers are expected to make an effort to display
  2539. this information.  Simply ignoring WM_NAME is not acceptable
  2540. behavior.  Clients can assume that at least the first part
  2541. of this string is visible to the user and that if the infor-
  2542. mation is not visible to the user, it is because the user
  2543. has taken an explicit action to make it invisible.
  2544.  
  2545. On the other hand, there is no guarantee that the user can
  2546. see the WM_NAME string even if the window manager supports
  2547. window headlines.  The user may have placed the headline
  2548. off-screen or have covered it by other windows.  WM_NAME
  2549. should not be used for application-critical information or
  2550. to announce asynchronous changes of an application's state
  2551. that require timely user response.  The expected uses are to
  2552. permit the user to identify one of a number of instances of
  2553. the same client and to provide the user with noncritical
  2554. state information.
  2555.  
  2556. Even window managers that support headline bars will place
  2557. some limit on the length of the WM_NAME string that can be
  2558. visible; brevity here will pay dividends.
  2559.  
  2560. 4.1.2.2.  WM_ICON_NAME Property
  2561.  
  2562. The WM_ICON_NAME property is an uninterpreted string that
  2563. the client wants to be displayed in association with the
  2564. window when it is iconified (for example, in an icon label).
  2565. In other respects, including the type, it is similar to
  2566. WM_NAME.  For obvious geometric reasons, fewer characters
  2567. will normally be visible in WM_ICON_NAME than WM_NAME.
  2568.  
  2569.  
  2570.  
  2571.  
  2572.                  33
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578. Inter-Client Communication Conventions        X11, Release 6.4
  2579.  
  2580.  
  2581. Clients should not attempt to display this string in their
  2582. icon pixmaps or windows; rather, they should rely on the
  2583. window manager to do so.
  2584.  
  2585. 4.1.2.3.  WM_NORMAL_HINTS Property
  2586.  
  2587. The type of the WM_NORMAL_HINTS property is WM_SIZE_HINTS.
  2588. Its contents are as follows:
  2589.  
  2590. -------------------------------------------------------------
  2591. Field          Type          Comments
  2592. -------------------------------------------------------------
  2593. flags          CARD32          (see the next table)
  2594. pad          4*CARD32          For backwards compatibility
  2595. min_width     INT32          If missing, assume base_width
  2596. min_height    INT32          If missing, assume base_height
  2597. max_width     INT32
  2598. max_height    INT32
  2599. width_inc     INT32
  2600. height_inc    INT32
  2601. min_aspect    (INT32,INT32)
  2602. max_aspect    (INT32,INT32)
  2603. base_width    INT32          If missing, assume min_width
  2604. base_height   INT32          If missing, assume min_height
  2605. win_gravity   INT32          If missing, assume NorthWest
  2606. -------------------------------------------------------------
  2607.  
  2608.  
  2609. The WM_SIZE_HINTS.flags bit definitions are as follows:
  2610.  
  2611. -----------------------------------------------------------------
  2612. Name         Value   Field
  2613. -----------------------------------------------------------------
  2614. USPosition    1    User-specified x, y
  2615. USSize        2    User-specified width, height
  2616. PPosition    4    Program-specified position
  2617. PSize        8    Program-specified size
  2618. PMinSize       16    Program-specified minimum size
  2619. PMaxSize       32    Program-specified maximum size
  2620. PResizeInc     64    Program-specified resize increments
  2621. PAspect       128    Program-specified min and max aspect ratios
  2622. PBaseSize     256    Program-specified base size
  2623. PWinGrav-     512    Program-specified window gravity
  2624. ity
  2625. -----------------------------------------------------------------
  2626.  
  2627.  
  2628. To indicate that the size and position of the window (when a
  2629. transition from the Withdrawn state occurs) was specified by
  2630. the user, the client should set the USPosition and USSize
  2631. flags, which allow a window manager to know that the user
  2632. specifically asked where the window should be placed or how
  2633. the window should be sized and that further interaction is
  2634. superfluous.  To indicate that it was specified by the
  2635.  
  2636.  
  2637.  
  2638.                  34
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644. Inter-Client Communication Conventions        X11, Release 6.4
  2645.  
  2646.  
  2647. client without any user involvement, the client should set
  2648. PPosition and PSize.
  2649.  
  2650. The size specifiers refer to the width and height of the
  2651. client's window excluding borders.
  2652.  
  2653. The win_gravity may be any of the values specified for
  2654. WINGRAVITY in the core protocol except for Unmap: NorthWest
  2655. (1), North (2), NorthEast (3), West (4), Center (5), East
  2656. (6), SouthWest (7), South (8), and SouthEast (9).  It speci-
  2657. fies how and whether the client window wants to be shifted
  2658. to make room for the window manager frame.
  2659.  
  2660. If the win_gravity is Static, the window manager frame is
  2661. positioned so that the inside border of the client window
  2662. inside the frame is in the same position on the screen as it
  2663. was when the client requested the transition from Withdrawn
  2664. state.    Other values of win_gravity specify a window refer-
  2665. ence point.  For NorthWest, NorthEast, SouthWest, and South-
  2666. East the reference point is the specified outer corner of
  2667. the window (on the outside border edge).  For North, South,
  2668. East, and West the reference point is the center of the
  2669. specified outer edge of the window border.  For Center the
  2670. reference point is the center of the window.  The reference
  2671. point of the window manager frame is placed at the location
  2672. on the screen where the reference point of the client window
  2673. was when the client requested the transition from Withdrawn
  2674. state.
  2675.  
  2676. The min_width and min_height elements specify the minimum
  2677. size that the window can be for the client to be useful.
  2678. The max_width and max_height elements specify the maximum
  2679. size.  The base_width and base_height elements in conjunc-
  2680. tion with width_inc and height_inc define an arithmetic pro-
  2681. gression of preferred window widths and heights for non-neg-
  2682. ative integers i and j:
  2683.  
  2684.  
  2685.  
  2686.            width=base_width+(ixwidth_inc)
  2687.  
  2688.  
  2689.           height=base_height+(jxheight_inc)
  2690.  
  2691.  
  2692.  
  2693. Window managers are encouraged to use i and j instead of
  2694. width and height in reporting window sizes to users.  If a
  2695. base size is not provided, the minimum size is to be used in
  2696. its place and vice versa.
  2697.  
  2698. The min_aspect and max_aspect fields are fractions with the
  2699. numerator first and the denominator second, and they allow a
  2700. client to specify the range of aspect ratios it prefers.
  2701.  
  2702.  
  2703.  
  2704.                  35
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710. Inter-Client Communication Conventions        X11, Release 6.4
  2711.  
  2712.  
  2713. Window managers that honor aspect ratios should take into
  2714. account the base size in determining the preferred window
  2715. size.  If a base size is provided along with the aspect
  2716. ratio fields, the base size should be subtracted from the
  2717. window size prior to checking that the aspect ratio falls in
  2718. range.    If a base size is not provided, nothing should be
  2719. subtracted from the window size.  (The minimum size is not
  2720. to be used in place of the base size for this purpose.)
  2721.  
  2722. 4.1.2.4.  WM_HINTS Property
  2723.  
  2724. The WM_HINTS property (whose type is WM_HINTS) is used to
  2725. communicate to the window manager.  It conveys the informa-
  2726. tion the window manager needs other than the window geome-
  2727. try, which is available from the window itself; the con-
  2728. straints on that geometry, which is available from the
  2729. WM_NORMAL_HINTS structure; and various strings, which need
  2730. separate properties, such as WM_NAME.  The contents of the
  2731. properties are as follows:
  2732.  
  2733. -----------------------------------------------------------
  2734. Field        Type     Comments
  2735. -----------------------------------------------------------
  2736. flags        CARD32     (see the next table)
  2737. input        CARD32     The client's input model
  2738. initial_state    CARD32     The state when first mapped
  2739. icon_pixmap    PIXMAP     The pixmap for the icon image
  2740. icon_window    WINDOW     The window for the icon image
  2741. icon_x        INT32     The icon location
  2742. icon_y        INT32
  2743. icon_mask    PIXMAP     The mask for the icon shape
  2744. window_group    WINDOW     The ID of the group leader window
  2745. -----------------------------------------------------------
  2746.  
  2747.  
  2748. The WM_HINTS.flags bit definitions are as follows:
  2749.  
  2750. -------------------------------------------------
  2751. Name          Value   Field
  2752. -------------------------------------------------
  2753. InputHint         1      input
  2754. StateHint         2      initial_state
  2755. IconPixmapHint         4      icon_pixmap
  2756. IconWindowHint         8      icon_window
  2757. IconPosition-        16      icon_x & icon_y
  2758. Hint
  2759. IconMaskHint        32      icon_mask
  2760. WindowGroupHint     64      window_group
  2761. MessageHint       128      (this bit is obsolete)
  2762. UrgencyHint       256      urgency
  2763. -------------------------------------------------
  2764.  
  2765.  
  2766.  
  2767.  
  2768.  
  2769.  
  2770.                  36
  2771.  
  2772.  
  2773.  
  2774.  
  2775.  
  2776. Inter-Client Communication Conventions        X11, Release 6.4
  2777.  
  2778.  
  2779. Window managers are free to assume convenient values for all
  2780. fields of the WM_HINTS property if a window is mapped with-
  2781. out one.
  2782.  
  2783. The input field is used to communicate to the window manager
  2784. the input focus model used by the client (see section
  2785. 4.1.7).
  2786.  
  2787. Clients with the Globally Active and No Input models should
  2788. set the input flag to False.  Clients with the Passive and
  2789. Locally Active models should set the input flag to True.
  2790.  
  2791. From the client's point of view, the window manager will
  2792. regard the client's top-level window as being in one of
  2793. three states:
  2794.  
  2795. o   Normal
  2796.  
  2797. o   Iconic
  2798.  
  2799. o   Withdrawn
  2800.  
  2801. The semantics of these states are described in section
  2802. 4.1.4.    Newly created windows start in the Withdrawn state.
  2803. Transitions between states happen when a top-level window is
  2804. mapped and unmapped and when the window manager receives
  2805. certain messages.
  2806.  
  2807. The value of the initial_state field determines the state
  2808. the client wishes to be in at the time the top-level window
  2809. is mapped from the Withdrawn state, as shown in the follow-
  2810. ing table:
  2811.  
  2812. ---------------------------------------------
  2813. State          Value   Comments
  2814. ---------------------------------------------
  2815. NormalState    1     The window is visible.
  2816. IconicState    3     The icon is visible.
  2817. ---------------------------------------------
  2818.  
  2819.  
  2820. The icon_pixmap field may specify a pixmap to be used as an
  2821. icon.  This pixmap should be:
  2822.  
  2823. o   One of the sizes specified in the WM_ICON_SIZE property
  2824.     on the root if it exists (see section 4.1.3.2).
  2825.  
  2826. o   1-bit deep.  The window manager will select, through the
  2827.     defaults database, suitable background (for the 0 bits)
  2828.     and foreground (for the 1 bits) colors.  These defaults
  2829.     can, of course, specify different colors for the icons
  2830.     of different clients.
  2831.  
  2832.  
  2833.  
  2834.  
  2835.  
  2836.                  37
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842. Inter-Client Communication Conventions        X11, Release 6.4
  2843.  
  2844.  
  2845. The icon_mask specifies which pixels of the icon_pixmap
  2846. should be used as the icon, allowing for icons to appear
  2847. nonrectangular.
  2848.  
  2849. The icon_window field is the ID of a window the client wants
  2850. used as its icon.  Most, but not all, window managers will
  2851. support icon windows.  Those that do not are likely to have
  2852. a user interface in which small windows that behave like
  2853. icons are completely inappropriate.  Clients should not
  2854. attempt to remedy the omission by working around it.
  2855.  
  2856. Clients that need more capabilities from the icons than a
  2857. simple 2-color bitmap should use icon windows.    Rules for
  2858. clients that do are set out in section 4.1.9.
  2859.  
  2860. The (icon_x,icon_y) coordinate is a hint to the window man-
  2861. ager as to where it should position the icon.  The policies
  2862. of the window manager control the positioning of icons, so
  2863. clients should not depend on attention being paid to this
  2864. hint.
  2865.  
  2866. The window_group field lets the client specify that this
  2867. window belongs to a group of windows.  An example is a sin-
  2868. gle client manipulating multiple children of the root win-
  2869. dow.
  2870.  
  2871.             Conventions
  2872.  
  2873.  
  2874.      1.   The window_group field should be set to the
  2875.       ID of the group leader.  The window group
  2876.       leader may be a window that exists only for
  2877.       that purpose; a placeholder group leader of
  2878.       this kind would never be mapped either by the
  2879.       client or by the window manager.
  2880.  
  2881.      2.   The properties of the window group leader are
  2882.       those for the group as a whole (for example,
  2883.       the icon to be shown when the entire group is
  2884.       iconified).
  2885.  
  2886.  
  2887. Window managers may provide facilities for manipulating the
  2888. group as a whole.  Clients, at present, have no way to oper-
  2889. ate on the group as a whole.
  2890.  
  2891. The messages bit, if set in the flags field, indicates that
  2892. the client is using an obsolete window manager communication
  2893. protocol,11 rather than the WM_PROTOCOLS mechanism of sec-
  2894. tion 4.1.2.7.
  2895. -----------
  2896.   11 This obsolete protocol was described in the
  2897. July 27, 1988, draft of the ICCCM.  Windows using
  2898. it can also be detected because their WM_HINTS
  2899.  
  2900.  
  2901.  
  2902.                  38
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908. Inter-Client Communication Conventions        X11, Release 6.4
  2909.  
  2910.  
  2911. The UrgencyHint flag, if set in the flags field, indicates
  2912. that the client deems the window contents to be urgent,
  2913. requiring the timely response of the user.  The window man-
  2914. ager must make some effort to draw the user's attention to
  2915. this window while this flag is set.  The window manager must
  2916. also monitor the state of this flag for the entire time the
  2917. window is in the Normal or Iconic state and must take appro-
  2918. priate action when the state of the flag changes.  The flag
  2919. is otherwise independent of the window's state; in particu-
  2920. lar, the window manager is not required to deiconify the
  2921. window if the client sets the flag on an Iconic window.
  2922. Clients must provide some means by which the user can cause
  2923. the UrgencyHint flag to be set to zero or the window to be
  2924. withdrawn.  The user's action can either mitigate the actual
  2925. condition that made the window urgent, or it can merely shut
  2926. off the alarm.
  2927.  
  2928.              Rationale
  2929.  
  2930.      This mechanism is useful for alarm dialog boxes or
  2931.      reminder windows, in cases where mapping the win-
  2932.      dow is not enough (e.g., in the presence of multi-
  2933.      workspace or virtual desktop window managers), and
  2934.      where using an override-redirect window is too
  2935.      intrusive.  For example, the window manager may
  2936.      attract attention to an urgent window by adding an
  2937.      indicator to its title bar or its icon.  Window
  2938.      managers may also take additional action for a
  2939.      window that is newly urgent, such as by flashing
  2940.      its icon (if the window is iconic) or by raising
  2941.      it to the top of the stack.
  2942.  
  2943.  
  2944. 4.1.2.5.  WM_CLASS Property
  2945.  
  2946. The WM_CLASS property (of type STRING without control char-
  2947. acters) contains two consecutive null-terminated strings.
  2948. These specify the Instance and Class names to be used by
  2949. both the client and the window manager for looking up
  2950. resources for the application or as identifying information.
  2951. This property must be present when the window leaves the
  2952. Withdrawn state and may be changed only while the window is
  2953. in the Withdrawn state.  Window managers may examine the
  2954. property only when they start up and when the window leaves
  2955. the Withdrawn state, but there should be no need for a
  2956. client to change its state dynamically.
  2957.  
  2958. The two strings, respectively, are:
  2959.  
  2960. -----------
  2961. properties are 4 bytes longer than expected.  Win-
  2962. dow managers are free to support clients using the
  2963. obsolete protocol in a backwards compatibility
  2964. mode.
  2965.  
  2966.  
  2967.  
  2968.                  39
  2969.  
  2970.  
  2971.  
  2972.  
  2973.  
  2974. Inter-Client Communication Conventions        X11, Release 6.4
  2975.  
  2976.  
  2977. o   A string that names the particular instance of the
  2978.     application to which the client that owns this window
  2979.     belongs.  Resources that are specified by instance name
  2980.     override any resources that are specified by class name.
  2981.     Instance names can be specified by the user in an oper-
  2982.     ating-system specific manner.  On POSIX-conformant sys-
  2983.     tems, the following conventions are used:
  2984.  
  2985.     -     If "-name NAME" is given on the command line, NAME
  2986.      is used as the instance name.
  2987.  
  2988.     -     Otherwise, if the environment variable
  2989.      RESOURCE_NAME is set, its value will be used as the
  2990.      instance name.
  2991.  
  2992.     -     Otherwise, the trailing part of the name used to
  2993.      invoke the program (argv[0] stripped of any direc-
  2994.      tory names) is used as the instance name.
  2995.  
  2996. o   A string that names the general class of applications to
  2997.     which the client that owns this window belongs.
  2998.     Resources that are specified by class apply to all
  2999.     applications that have the same class name.  Class names
  3000.     are specified by the application writer.  Examples of
  3001.     commonly used class names include: "Emacs", "XTerm",
  3002.     "XClock", "XLoad", and so on.
  3003.  
  3004. Note that WM_CLASS strings are null-terminated and, thus,
  3005. differ from the general conventions that STRING properties
  3006. are null-separated.  This inconsistency is necessary for
  3007. backwards compatibility.
  3008.  
  3009. 4.1.2.6.  WM_TRANSIENT_FOR Property
  3010.  
  3011. The WM_TRANSIENT_FOR property (of type WINDOW) contains the
  3012. ID of another top-level window.  The implication is that
  3013. this window is a pop-up on behalf of the named window, and
  3014. window managers may decide not to decorate transient windows
  3015. or may treat them differently in other ways.  In particular,
  3016. window managers should present newly mapped WM_TRANSIENT_FOR
  3017. windows without requiring any user interaction, even if map-
  3018. ping top-level windows normally does require interaction.
  3019. Dialogue boxes, for example, are an example of windows that
  3020. should have WM_TRANSIENT_FOR set.
  3021.  
  3022. It is important not to confuse WM_TRANSIENT_FOR with over-
  3023. ride-redirect.    WM_TRANSIENT_FOR should be used in those
  3024. cases where the pointer is not grabbed while the window is
  3025. mapped (in other words, if other windows are allowed to be
  3026. active while the transient is up).  If other windows must be
  3027. prevented from processing input (for example, when imple-
  3028. menting pop-up menus), use override-redirect and grab the
  3029. pointer while the window is mapped.
  3030.  
  3031.  
  3032.  
  3033.  
  3034.                  40
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040. Inter-Client Communication Conventions        X11, Release 6.4
  3041.  
  3042.  
  3043. 4.1.2.7.  WM_PROTOCOLS Property
  3044.  
  3045. The WM_PROTOCOLS property (of type ATOM) is a list of atoms.
  3046. Each atom identifies a communication protocol between the
  3047. client and the window manager in which the client is willing
  3048. to participate.  Atoms can identify both standard protocols
  3049. and private protocols specific to individual window man-
  3050. agers.
  3051.  
  3052. All the protocols in which a client can volunteer to take
  3053. part involve the window manager sending the client a
  3054. ClientMessage event and the client taking appropriate
  3055. action.  For details of the contents of the event, see sec-
  3056. tion 4.2.8.  In each case, the protocol transactions are
  3057. initiated by the window manager.
  3058.  
  3059. The WM_PROTOCOLS property is not required.  If it is not
  3060. present, the client does not want to participate in any win-
  3061. dow manager protocols.
  3062.  
  3063. The X Consortium will maintain a registry of protocols to
  3064. avoid collisions in the name space.  The following table
  3065. lists the protocols that have been defined to date.
  3066.  
  3067. -----------------------------------------------------------------------
  3068. Protocol        Section    Purpose
  3069. -----------------------------------------------------------------------
  3070. WM_TAKE_FOCUS         4.1.7    Assignment of input focus
  3071. WM_SAVE_YOURSELF   Appendix C    Save client state request (deprecated)
  3072. WM_DELETE_WINDOW    4.2.8.1    Request to delete top-level window
  3073. -----------------------------------------------------------------------
  3074.  
  3075. It is expected that this table will grow over time.
  3076.  
  3077. 4.1.2.8.  WM_COLORMAP_WINDOWS Property
  3078.  
  3079. The WM_COLORMAP_WINDOWS property (of type WINDOW) on a top-
  3080. level window is a list of the IDs of windows that may need
  3081. colormaps installed that differ from the colormap of the
  3082. top-level window.  The window manager will watch this list
  3083. of windows for changes in their colormap attributes.  The
  3084. top-level window is always (implicitly or explicitly) on the
  3085. watch list.  For the details of this mechanism, see section
  3086. 4.1.8.
  3087.  
  3088. 4.1.2.9.  WM_CLIENT_MACHINE Property
  3089.  
  3090. The client should set the WM_CLIENT_MACHINE property (of one
  3091. of the TEXT types) to a string that forms the name of the
  3092. machine running the client as seen from the machine running
  3093. the server.
  3094.  
  3095.  
  3096.  
  3097.  
  3098.  
  3099.  
  3100.                  41
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106. Inter-Client Communication Conventions        X11, Release 6.4
  3107.  
  3108.  
  3109. 4.1.3.    Window Manager Properties
  3110.  
  3111. The properties that were described in the previous section
  3112. are those that the client is responsible for maintaining on
  3113. its top-level windows.    This section describes the proper-
  3114. ties that the window manager places on client's top-level
  3115. windows and on the root.
  3116.  
  3117. 4.1.3.1.  WM_STATE Property
  3118.  
  3119. The window manager will place a WM_STATE property (of type
  3120. WM_STATE) on each top-level client window that is not in the
  3121. Withdrawn state.  Top-level windows in the Withdrawn state
  3122. may or may not have the WM_STATE property.  Once the top-
  3123. level window has been withdrawn, the client may re-use it
  3124. for another purpose.  Clients that do so should remove the
  3125. WM_STATE property if it is still present.
  3126.  
  3127. Some clients (such as xprop) will ask the user to click over
  3128. a window on which the program is to operate.  Typically, the
  3129. intent is for this to be a top-level window.  To find a top-
  3130. level window, clients should search the window hierarchy
  3131. beneath the selected location for a window with the WM_STATE
  3132. property.  This search must be recursive in order to cover
  3133. all window manager reparenting possibilities.  If no window
  3134. with a WM_STATE property is found, it is recommended that
  3135. programs use a mapped child-of-root window if one is present
  3136. beneath the selected location.
  3137.  
  3138. The contents of the WM_STATE property are defined as fol-
  3139. lows:
  3140.  
  3141. --------------------------------------
  3142. Field    Type     Comments
  3143. --------------------------------------
  3144. state    CARD32     (see the next table)
  3145. icon    WINDOW     ID of icon window
  3146. --------------------------------------
  3147.  
  3148.  
  3149. The following table lists the WM_STATE.state values:
  3150.  
  3151. -----------------------
  3152. State         Value
  3153. -----------------------
  3154. WithdrawnState       0
  3155. NormalState       1
  3156. IconicState       3
  3157. -----------------------
  3158.  
  3159.  
  3160. Adding other fields to this property is reserved to the X
  3161. Consortium.  Values for the state field other than those
  3162. defined in the above table are reserved for use by the X
  3163.  
  3164.  
  3165.  
  3166.                  42
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172. Inter-Client Communication Conventions        X11, Release 6.4
  3173.  
  3174.  
  3175. Consortium.
  3176.  
  3177. The state field describes the window manager's idea of the
  3178. state the window is in, which may not match the client's
  3179. idea as expressed in the initial_state field of the WM_HINTS
  3180. property (for example, if the user has asked the window man-
  3181. ager to iconify the window).  If it is NormalState, the win-
  3182. dow manager believes the client should be animating its win-
  3183. dow.  If it is IconicState, the client should animate its
  3184. icon window.  In either state, clients should be prepared to
  3185. handle exposure events from either window.
  3186.  
  3187. When the window is withdrawn, the window manager will either
  3188. change the state field's value to WithdrawnState or it will
  3189. remove the WM_STATE property entirely.
  3190.  
  3191. The icon field should contain the window ID of the window
  3192. that the window manager uses as the icon for the window on
  3193. which this property is set.  If no such window exists, the
  3194. icon field should be None.  Note that this window could be
  3195. but is not necessarily the same window as the icon window
  3196. that the client may have specified in its WM_HINTS property.
  3197. The WM_STATE icon may be a window that the window manager
  3198. has supplied and that contains the client's icon pixmap, or
  3199. it may be an ancestor of the client's icon window.
  3200.  
  3201. 4.1.3.2.  WM_ICON_SIZE Property
  3202.  
  3203. A window manager that wishes to place constraints on the
  3204. sizes of icon pixmaps and/or windows should place a property
  3205. called WM_ICON_SIZE on the root.  The contents of this prop-
  3206. erty are listed in the following table.
  3207.  
  3208. --------------------------------------------------------
  3209. Field         Type     Comments
  3210. --------------------------------------------------------
  3211. min_width    CARD32   The data for the icon size series
  3212. min_height   CARD32
  3213. max_width    CARD32
  3214. max_height   CARD32
  3215. width_inc    CARD32
  3216. height_inc   CARD32
  3217. --------------------------------------------------------
  3218.  
  3219.  
  3220. For more details see section 14.1.12 in Xlib - C Language X
  3221. Interface.
  3222.  
  3223. 4.1.4.    Changing Window State
  3224.  
  3225. From the client's point of view, the window manager will
  3226. regard each of the client's top-level windows as being in
  3227. one of three states, whose semantics are as follows:
  3228.  
  3229.  
  3230.  
  3231.  
  3232.                  43
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238. Inter-Client Communication Conventions        X11, Release 6.4
  3239.  
  3240.  
  3241. o   NormalState - The client's top-level window is viewable.
  3242.  
  3243. o   IconicState - The client's top-level window is iconic
  3244.     (whatever that means for this window manager).  The
  3245.     client can assume that its top-level window is not view-
  3246.     able, its icon_window (if any) will be viewable and,
  3247.     failing that, its icon_pixmap (if any) or its
  3248.     WM_ICON_NAME will be displayed.
  3249.  
  3250. o   WithdrawnState - Neither the client's top-level window
  3251.     nor its icon is visible.
  3252.  
  3253. In fact, the window manager may implement states with seman-
  3254. tics other than those described above.    For example, a win-
  3255. dow manager might implement a concept of an "inactive" state
  3256. in which an infrequently used client's window would be rep-
  3257. resented as a string in a menu.  But this state is invisible
  3258. to the client, which would see itself merely as being in the
  3259. Iconic state.
  3260.  
  3261. Newly created top-level windows are in the Withdrawn state.
  3262. Once the window has been provided with suitable properties,
  3263. the client is free to change its state as follows:
  3264.  
  3265. o   Withdrawn -> Normal - The client should map the window
  3266.     with WM_HINTS.initial_state being NormalState.
  3267.  
  3268. o   Withdrawn -> Iconic - The client should map the window
  3269.     with WM_HINTS.initial_state being IconicState.
  3270.  
  3271. o   Normal -> Iconic - The client should send a ClientMes-
  3272.     sage event as described later in this section.
  3273.  
  3274. o   Normal -> Withdrawn - The client should unmap the window
  3275.     and follow it with a synthetic UnmapNotify event as
  3276.     described later in this section.
  3277.  
  3278. o   Iconic -> Normal - The client should map the window.
  3279.     The contents of WM_HINTS.initial_state are irrelevant in
  3280.     this case.
  3281.  
  3282. o   Iconic -> Withdrawn - The client should unmap the window
  3283.     and follow it with a synthetic UnmapNotify event as
  3284.     described later in this section.
  3285.  
  3286. Only the client can effect a transition into or out of the
  3287. Withdrawn state.  Once a client's window has left the With-
  3288. drawn state, the window will be mapped if it is in the Nor-
  3289. mal state and the window will be unmapped if it is in the
  3290. Iconic state.  Reparenting window managers must unmap the
  3291. client's window when it is in the Iconic state, even if an
  3292. ancestor window being unmapped renders the client's window
  3293. unviewable.  Conversely, if a reparenting window manager
  3294. renders the client's window unviewable by unmapping an
  3295.  
  3296.  
  3297.  
  3298.                  44
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304. Inter-Client Communication Conventions        X11, Release 6.4
  3305.  
  3306.  
  3307. ancestor, the client's window is by definition in the Iconic
  3308. state and must also be unmapped.
  3309.  
  3310.            Advice to Implementors
  3311.  
  3312.      Clients can select for StructureNotify on their
  3313.      top-level windows to track transitions between
  3314.      Normal and Iconic states.    Receipt of a MapNotify
  3315.      event will indicate a transition to the Normal
  3316.      state, and receipt of an UnmapNotify event will
  3317.      indicate a transition to the Iconic state.
  3318.  
  3319.  
  3320. When changing the state of the window to Withdrawn, the
  3321. client must (in addition to unmapping the window) send a
  3322. synthetic UnmapNotify event by using a SendEvent request
  3323. with the following arguments:
  3324.  
  3325. ----------------------------------------------------------------
  3326. Argument          Value
  3327. ----------------------------------------------------------------
  3328. destination:          The root
  3329. propagate:          False
  3330. event-mask:          (SubstructureRedirect|SubstructureNotify)
  3331. event: an UnmapNo-
  3332. tify with:
  3333.     event:          The root
  3334.     window:          The window itself
  3335.     from-configure:   False
  3336. ----------------------------------------------------------------
  3337.  
  3338.  
  3339.              Rationale
  3340.  
  3341.      The reason for requiring the client to send a syn-
  3342.      thetic UnmapNotify event is to ensure that the
  3343.      window manager gets some notification of the
  3344.      client's desire to change state, even though the
  3345.      window may already be unmapped when the desire is
  3346.      expressed.
  3347.  
  3348.  
  3349.            Advice to Implementors
  3350.  
  3351.      For compatibility with obsolete clients, window
  3352.      managers should trigger the transition to the
  3353.      Withdrawn state on the real UnmapNotify rather
  3354.      than waiting for the synthetic one.  They should
  3355.      also trigger the transition if they receive a syn-
  3356.      thetic UnmapNotify on a window for which they have
  3357.      not yet received a real UnmapNotify.
  3358.  
  3359.  
  3360.  
  3361.  
  3362.  
  3363.  
  3364.                  45
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370. Inter-Client Communication Conventions        X11, Release 6.4
  3371.  
  3372.  
  3373. When a client withdraws a window, the window manager will
  3374. then update or remove the WM_STATE property as described in
  3375. section 4.1.3.1.  Clients that want to re-use a client win-
  3376. dow (e.g., by mapping it again or reparenting it elsewhere)
  3377. after withdrawing it must wait for the withdrawal to be com-
  3378. plete before proceeding.  The preferred method for doing
  3379. this is for clients to wait for the window manager to update
  3380. or remove the WM_STATE property.12
  3381.  
  3382. If the transition is from the Normal to the Iconic state,
  3383. the client should send a ClientMessage event to the root
  3384. with:
  3385.  
  3386. o   Window == the window to be iconified
  3387.  
  3388. o   Type13 == the atom WM_CHANGE_STATE
  3389.  
  3390. o   Format == 32
  3391.  
  3392. o   Data[0] == IconicState
  3393.  
  3394.                Rationale
  3395.  
  3396.      The format of this ClientMessage event does
  3397.      not match the format of ClientMessages in sec-
  3398.      tion 4.2.8.  This is because they are sent by
  3399.      the window manager to clients, and this mes-
  3400.      sage is sent by clients to the window manager.
  3401.  
  3402.  
  3403. Other values of data[0] are reserved for future extensions
  3404. to these conventions.  The parameters of the SendEvent
  3405. request should be those described for the synthetic UnmapNo-
  3406. tify event.
  3407.  
  3408.  
  3409.  
  3410.  
  3411.  
  3412. -----------
  3413.   12 Earlier versions of these conventions prohib-
  3414. ited clients from reading the WM_STATE property.
  3415. Clients operating under the earlier conventions
  3416. used the technique of tracking ReparentNotify
  3417. events to wait for the top-level window to be
  3418. reparented back to the root window.  This is still
  3419. a valid technique; however, it works only for
  3420. reparenting window managers, and the WM_STATE
  3421. technique is to be preferred.
  3422.   13 The type field of the ClientMessage event
  3423. (called the message_type field by Xlib) should not
  3424. be confused with the code field of the event
  3425. itself, which will have the value 33
  3426. (ClientMessage).
  3427.  
  3428.  
  3429.  
  3430.                  46
  3431.  
  3432.  
  3433.  
  3434.  
  3435.  
  3436. Inter-Client Communication Conventions        X11, Release 6.4
  3437.  
  3438.  
  3439.            Advice to Implementors
  3440.  
  3441.      Clients can also select for VisibilityChange
  3442.      events on their top-level or icon windows.  They
  3443.      will then receive a VisibilityNotify(state==Fully-
  3444.      Obscured) event when the window concerned becomes
  3445.      completely obscured even though mapped (and thus,
  3446.      perhaps a waste of time to update) and a
  3447.      VisibilityNotify(state!=FullyObscured) event when
  3448.      it becomes even partly viewable.
  3449.  
  3450.  
  3451.            Advice to Implementors
  3452.  
  3453.      When a window makes a transition from the Normal
  3454.      state to either the Iconic or the Withdrawn state,
  3455.      clients should be aware that the window manager
  3456.      may make transients for this window inaccessible.
  3457.      Clients should not rely on transient windows being
  3458.      available to the user when the transient owner
  3459.      window is not in the Normal state.  When withdraw-
  3460.      ing a window, clients are advised to withdraw
  3461.      transients for the window.
  3462.  
  3463.  
  3464. 4.1.5.    Configuring the Window
  3465.  
  3466. Clients can resize and reposition their top-level windows by
  3467. using the ConfigureWindow request.  The attributes of the
  3468. window that can be altered with this request are as follows:
  3469.  
  3470. o   The [x,y] location of the window's upper left-outer cor-
  3471.     ner
  3472.  
  3473. o   The [width,height] of the inner region of the window
  3474.     (excluding borders)
  3475.  
  3476. o   The border width of the window
  3477.  
  3478. o   The window's position in the stack
  3479.  
  3480. The coordinate system in which the location is expressed is
  3481. that of the root (irrespective of any reparenting that may
  3482. have occurred).  The border width to be used and win_gravity
  3483. position hint to be used are those most recently requested
  3484. by the client.    Client configure requests are interpreted by
  3485. the window manager in the same manner as the initial window
  3486. geometry mapped from the Withdrawn state, as described in
  3487. section 4.1.2.3.  Clients must be aware that there is no
  3488. guarantee that the window manager will allocate them the
  3489. requested size or location and must be prepared to deal with
  3490. any size and location.    If the window manager decides to
  3491. respond to a ConfigureRequest request by:
  3492.  
  3493.  
  3494.  
  3495.  
  3496.                  47
  3497.  
  3498.  
  3499.  
  3500.  
  3501.  
  3502. Inter-Client Communication Conventions        X11, Release 6.4
  3503.  
  3504.  
  3505. o   Not changing the size, location, border width, or stack-
  3506.     ing order of the window at all.
  3507.  
  3508.     A client will receive a synthetic ConfigureNotify event
  3509.     that describes the (unchanged) geometry of the window.
  3510.     The (x,y) coordinates will be in the root coordinate
  3511.     system, adjusted for the border width the client
  3512.     requested, irrespective of any reparenting that has
  3513.     taken place.  The border_width will be the border width
  3514.     the client requested.  The client will not receive a
  3515.     real ConfigureNotify event because no change has actu-
  3516.     ally taken place.
  3517.  
  3518. o   Moving or restacking the window without resizing it or
  3519.     changing its border width.
  3520.  
  3521.     A client will receive a synthetic ConfigureNotify event
  3522.     following the change that describes the new geometry of
  3523.     the window.  The event's (x,y) coordinates will be in
  3524.     the root coordinate system adjusted for the border width
  3525.     the client requested.  The border_width will be the bor-
  3526.     der width the client requested.  The client may not
  3527.     receive a real ConfigureNotify event that describes this
  3528.     change because the window manager may have reparented
  3529.     the top-level window.  If the client does receive a real
  3530.     event, the synthetic event will follow the real one.
  3531.  
  3532. o   Resizing the window or changing its border width
  3533.     (regardless of whether the window was also moved or
  3534.     restacked).
  3535.  
  3536.     A client that has selected for StructureNotify events
  3537.     will receive a real ConfigureNotify event.    Note that
  3538.     the coordinates in this event are relative to the par-
  3539.     ent, which may not be the root if the window has been
  3540.     reparented.  The coordinates will reflect the actual
  3541.     border width of the window (which the window manager may
  3542.     have changed).  The TranslateCoordinates request can be
  3543.     used to convert the coordinates if required.
  3544.  
  3545. The general rule is that coordinates in real ConfigureNotify
  3546. events are in the parent's space; in synthetic events, they
  3547. are in the root space.
  3548.  
  3549.            Advice to Implementors
  3550.  
  3551.      Clients cannot distinguish between the case where
  3552.      a top-level window is resized and moved from the
  3553.      case where the window is resized but not moved,
  3554.      since a real ConfigureNotify event will be
  3555.      received in both cases.  Clients that are con-
  3556.      cerned with keeping track of the absolute position
  3557.      of a top-level window should keep a piece of state
  3558.      indicating whether they are certain of its
  3559.  
  3560.  
  3561.  
  3562.                  48
  3563.  
  3564.  
  3565.  
  3566.  
  3567.  
  3568. Inter-Client Communication Conventions        X11, Release 6.4
  3569.  
  3570.  
  3571.      position.    Upon receipt of a real ConfigureNotify
  3572.      event on the top-level window, the client should
  3573.      note that the position is unknown.  Upon receipt
  3574.      of a synthetic ConfigureNotify event, the client
  3575.      should note the position as known, using the posi-
  3576.      tion in this event.  If the client receives a
  3577.      KeyPress, KeyRelease, ButtonPress, ButtonRelease,
  3578.      MotionNotify, EnterNotify, or LeaveNotify event on
  3579.      the window (or on any descendant), the client can
  3580.      deduce the top-level window's position from the
  3581.      difference between the (event-x, event-y) and
  3582.      (root-x, root-y) coordinates in these events.
  3583.      Only when the position is unknown does the client
  3584.      need to use the TranslateCoordinates request to
  3585.      find the position of a top-level window.
  3586.  
  3587.  
  3588. Clients should be aware that their borders may not be visi-
  3589. ble.  Window managers are free to use reparenting techniques
  3590. to decorate client's top-level windows with borders contain-
  3591. ing titles,  controls, and other details to maintain a con-
  3592. sistent look-and-feel.    If they do, they are likely to over-
  3593. ride the client's attempts to set the border width and set
  3594. it to zero.  Clients, therefore, should not depend on the
  3595. top-level window's border being visible or use it to display
  3596. any critical information.  Other window managers will allow
  3597. the top-level windows border to be visible.
  3598.  
  3599.              Convention
  3600.  
  3601.      Clients should set the desired value of the bor-
  3602.      der-width attribute on all ConfigureWindow
  3603.      requests to avoid a race condition.
  3604.  
  3605.  
  3606. Clients that change their position in the stack must be
  3607. aware that they may have been reparented, which means that
  3608. windows that used to be siblings no longer are.  Using a
  3609. nonsibling as the sibling parameter on a ConfigureWindow
  3610. request will cause an error.
  3611.  
  3612.              Convention
  3613.  
  3614.      Clients that use a ConfigureWindow request to
  3615.      request a change in their position in the stack
  3616.      should do so using None in the sibling field.
  3617.  
  3618.  
  3619. Clients that must position themselves in the stack relative
  3620. to some window that was originally a sibling must do the
  3621. ConfigureWindow request (in case they are running under a
  3622. nonreparenting window manager), be prepared to deal with a
  3623. resulting error, and then follow with a synthetic Configur-
  3624. eRequest event by invoking a SendEvent request with the
  3625.  
  3626.  
  3627.  
  3628.                  49
  3629.  
  3630.  
  3631.  
  3632.  
  3633.  
  3634. Inter-Client Communication Conventions        X11, Release 6.4
  3635.  
  3636.  
  3637. following arguments:
  3638.  
  3639. ---------------------------------------------------------------
  3640. Argument         Value
  3641. ---------------------------------------------------------------
  3642. destination:         The root
  3643. propagate:         False
  3644. event-mask:         (SubstructureRedirect|SubstructureNotify)
  3645. event: a Configur-
  3646. eRequest with:
  3647.     event:         The root
  3648.     window:         The window itself
  3649.     ...          Other parameters from the ConfigureWindow
  3650.              request
  3651. ---------------------------------------------------------------
  3652.  
  3653.  
  3654. Window managers are in any case free to position windows in
  3655. the stack as they see fit, and so clients should not rely on
  3656. receiving the stacking order they have requested.  Clients
  3657. should ignore the above-sibling field of both real and syn-
  3658. thetic ConfigureNotify events received on their top-level
  3659. windows because this field may not contain useful informa-
  3660. tion.
  3661.  
  3662. 4.1.6.    Changing Window Attributes
  3663.  
  3664. The attributes that may be supplied when a window is created
  3665. may be changed by using the ChangeWindowAttributes request.
  3666. The window attributes are listed in the following table:
  3667.  
  3668. -------------------------------------------
  3669. Attribute         Private to Client
  3670. -------------------------------------------
  3671. Background pixmap        Yes
  3672. Background pixel        Yes
  3673. Border pixmap            Yes
  3674. Border pixel            Yes
  3675. Bit gravity            Yes
  3676. Window gravity            No
  3677. Backing-store hint        Yes
  3678. Save-under hint         No
  3679. Event mask            No
  3680. Do-not-propagate mask        Yes
  3681. Override-redirect flag        No
  3682. Colormap            Yes
  3683. Cursor                Yes
  3684. -------------------------------------------
  3685.  
  3686.  
  3687. Most attributes are private to the client and will never be
  3688. interfered with by the window manager.    For the attributes
  3689. that are not private to the client:
  3690.  
  3691.  
  3692.  
  3693.  
  3694.                  50
  3695.  
  3696.  
  3697.  
  3698.  
  3699.  
  3700. Inter-Client Communication Conventions        X11, Release 6.4
  3701.  
  3702.  
  3703. o   The window manager is free to override the window grav-
  3704.     ity; a reparenting window manager may want to set the
  3705.     top-level window's window gravity for its own purposes.
  3706.  
  3707. o   Clients are free to set the save-under hint on their
  3708.     top-level windows, but they must be aware that the hint
  3709.     may be overridden by the window manager.
  3710.  
  3711. o   Windows, in effect, have per-client event masks, and so,
  3712.     clients may select for whatever events are convenient
  3713.     irrespective of any events the window manager is select-
  3714.     ing for.  There are some events for which only one
  3715.     client at a time may select, but the window manager
  3716.     should not select for them on any of the client's win-
  3717.     dows.
  3718.  
  3719. o   Clients can set override-redirect on top-level windows
  3720.     but are encouraged not to do so except as described in
  3721.     sections 4.1.10 and 4.2.9.
  3722.  
  3723. 4.1.7.    Input Focus
  3724.  
  3725. There are four models of input handling:
  3726.  
  3727. o   No Input - The client never expects keyboard input.  An
  3728.     example would be xload or another output-only client.
  3729.  
  3730. o   Passive Input - The client expects keyboard input but
  3731.     never explicitly sets the input focus.  An example would
  3732.     be a simple client with no subwindows, which will accept
  3733.     input in PointerRoot mode or when the window manager
  3734.     sets the input focus to its top-level window (in click-
  3735.     to-type mode).
  3736.  
  3737. o   Locally Active Input - The client expects keyboard input
  3738.     and explicitly sets the input focus, but it only does so
  3739.     when one of its windows already has the focus.  An exam-
  3740.     ple would be a client with subwindows defining various
  3741.     data entry fields that uses Next and Prev keys to move
  3742.     the input focus between the fields.  It does so when its
  3743.     top-level window has acquired the focus in PointerRoot
  3744.     mode or when the window manager sets the input focus to
  3745.     its top-level window (in click-to-type mode).
  3746.  
  3747. o   Globally Active Input - The client expects keyboard
  3748.     input and explicitly sets the input focus, even when it
  3749.     is in windows the client does not own.  An example would
  3750.     be a client with a scroll bar that wants to allow users
  3751.     to scroll the window without disturbing the input focus
  3752.     even if it is in some other window.  It wants to acquire
  3753.     the input focus when the user clicks in the scrolled
  3754.     region but not when the user clicks in the scroll bar
  3755.     itself.  Thus, it wants to prevent the window manager
  3756.     from setting the input focus to any of its windows.
  3757.  
  3758.  
  3759.  
  3760.                  51
  3761.  
  3762.  
  3763.  
  3764.  
  3765.  
  3766. Inter-Client Communication Conventions        X11, Release 6.4
  3767.  
  3768.  
  3769. The four input models and the corresponding values of the
  3770. input field and the presence or absence of the WM_TAKE_FOCUS
  3771. atom in the WM_PROTOCOLS property are listed in the follow-
  3772. ing table:
  3773.  
  3774. ----------------------------------------------
  3775. Input Model      Input Field    WM_TAKE_FOCUS
  3776. ----------------------------------------------
  3777. No Input         False       Absent
  3778. Passive          True       Absent
  3779. Locally Active         True       Present
  3780. Globally Active      False       Present
  3781. ----------------------------------------------
  3782.  
  3783.  
  3784. Passive and Locally Active clients set the input field of
  3785. WM_HINTS to True, which indicates that they require window
  3786. manager assistance  in acquiring the input focus.  No Input
  3787. and Globally Active clients set the input field to False,
  3788. which requests that the window manager not set the input
  3789. focus to their top-level window.
  3790.  
  3791. Clients that use a SetInputFocus request must set the time
  3792. field to the timestamp of the event that caused them to make
  3793. the attempt.  This cannot be a FocusIn event because they do
  3794. not have timestamps.  Clients may also acquire the focus
  3795. without a corresponding EnterNotify.  Note that clients must
  3796. not use CurrentTime in the time field.
  3797.  
  3798. Clients using the Globally Active model can only use a Set-
  3799. InputFocus request to acquire the input focus when they do
  3800. not already have it on receipt of one of the following
  3801. events:
  3802.  
  3803. o   ButtonPress
  3804.  
  3805. o   ButtonRelease
  3806.  
  3807. o   Passive-grabbed KeyPress
  3808.  
  3809. o   Passive-grabbed KeyRelease
  3810.  
  3811. In general, clients should avoid using passive-grabbed key
  3812. events for this purpose, except when they are unavoidable
  3813. (as, for example, a selection tool that establishes a pas-
  3814. sive grab on the keys that cut,  copy,    or paste).
  3815.  
  3816. The method by which the user commands the window manager to
  3817. set the focus to a window is up to the window manager.    For
  3818. example, clients cannot determine whether they will see the
  3819. click that transfers the focus.
  3820.  
  3821. Windows with the atom WM_TAKE_FOCUS in their WM_PROTOCOLS
  3822. property may receive a ClientMessage event from the window
  3823.  
  3824.  
  3825.  
  3826.                  52
  3827.  
  3828.  
  3829.  
  3830.  
  3831.  
  3832. Inter-Client Communication Conventions        X11, Release 6.4
  3833.  
  3834.  
  3835. manager (as described in section 4.2.8) with WM_TAKE_FOCUS
  3836. in its data[0] field and a valid timestamp (i.e., not
  3837. CurrentTime) in its data[1] field.  If they want the focus,
  3838. they should respond with a SetInputFocus request with its
  3839. window field set to the window of theirs that last had the
  3840. input focus or to their default input window, and the time
  3841. field set to the timestamp in the message.  For further
  3842. information, see section 4.2.7.
  3843.  
  3844. A client could receive WM_TAKE_FOCUS when opening from an
  3845. icon or when the user has clicked outside the top-level win-
  3846. dow in an area that indicates to the window manager that it
  3847. should assign the focus (for example, clicking in the head-
  3848. line bar can be used to assign the focus).
  3849.  
  3850. The goal is to support window managers that want to assign
  3851. the input focus to a top-level window in such a way that the
  3852. top-level window either can assign it to one of its subwin-
  3853. dows or can decline the offer of the focus.  For example, a
  3854. clock or a text editor with no currently open frames might
  3855. not want to take focus even though the window manager gener-
  3856. ally believes that clients should take the input focus after
  3857. being deiconified or raised.
  3858.  
  3859. Clients that set the input focus need to decide a value for
  3860. the revert-to field of the SetInputFocus request.  This
  3861. determines the behavior of the input focus if the window the
  3862. focus has been set to becomes not viewable.  The value can
  3863. be any of the following:
  3864.  
  3865. o   Parent - In general, clients should use this value when
  3866.     assigning focus to one of their subwindows.  Unmapping
  3867.     the subwindow will cause focus to revert to the parent,
  3868.     which is probably what you want.
  3869.  
  3870. o   PointerRoot - Using this value with a click-to-type
  3871.     focus management policy leads to race conditions because
  3872.     the window becoming unviewable may coincide with the
  3873.     window manager deciding to move the focus elsewhere.
  3874.  
  3875. o   None - Using this value causes problems if the window
  3876.     manager reparents the window, as most window managers
  3877.     will, and then crashes.  The input focus will be None,
  3878.     and there will probably be no way to change it.
  3879.  
  3880. Note that neither PointerRoot nor None is really safe to
  3881. use.
  3882.  
  3883.              Convention
  3884.  
  3885.      Clients that invoke a SetInputFocus request should
  3886.      set the revert-to argument to Parent.
  3887.  
  3888.  
  3889.  
  3890.  
  3891.  
  3892.                  53
  3893.  
  3894.  
  3895.  
  3896.  
  3897.  
  3898. Inter-Client Communication Conventions        X11, Release 6.4
  3899.  
  3900.  
  3901. A convention is also required for clients that want to give
  3902. up the input focus.  There is no safe value set for them to
  3903. set the input focus to; therefore, they should ignore input
  3904. material.
  3905.  
  3906.              Convention
  3907.  
  3908.      Clients should not give up the input focus of
  3909.      their own volition.  They should ignore input that
  3910.      they receive instead.
  3911.  
  3912.  
  3913. 4.1.8.    Colormaps
  3914.  
  3915. The window manager is responsible for installing and unin-
  3916. stalling colormaps on behalf of clients with top-level win-
  3917. dows that the window manager manages.
  3918.  
  3919. Clients provide the window manager with hints as to which
  3920. colormaps to install and uninstall.  Clients must not
  3921. install or uninstall colormaps themselves (except under the
  3922. circumstances noted below).  When a client's top-level win-
  3923. dow gets the colormap focus (as a result of whatever col-
  3924. ormap focus policy is implemented by the window manager),
  3925. the window manager will ensure that one or more of the
  3926. client's colormaps are installed.
  3927.  
  3928. Clients whose top-level windows and subwindows all use the
  3929. same colormap should set its ID in the colormap field of the
  3930. top-level window's attributes.    They should not set a
  3931. WM_COLORMAP_WINDOWS property on the top-level window.  If
  3932. they want to change the colormap, they should change the
  3933. top-level window's colormap attribute.    The window manager
  3934. will track changes to the window's colormap attribute and
  3935. install colormaps as appropriate.
  3936.  
  3937. Clients that create windows can use the value CopyFromParent
  3938. to inherit their parent's colormap.  Window managers will
  3939. ensure that the root window's colormap field contains a col-
  3940. ormap that is suitable for clients to inherit.    In particu-
  3941. lar, the colormap will provide distinguishable colors for
  3942. BlackPixel and WhitePixel.
  3943.  
  3944. Top-level windows that have subwindows or override-redirect
  3945. pop-up windows whose colormap requirements differ from the
  3946. top-level window should have a WM_COLORMAP_WINDOWS property.
  3947. This property contains a list of IDs for windows whose col-
  3948. ormaps the window manager should attempt to have installed
  3949. when, in the course of its individual colormap focus policy,
  3950. it assigns the colormap focus to the top-level window (see
  3951. section 4.1.2.8).  The list is ordered by the importance to
  3952. the client of having the colormaps installed.  The window
  3953. manager will track changes to this property and will track
  3954. changes to the colormap attribute of the windows in the
  3955.  
  3956.  
  3957.  
  3958.                  54
  3959.  
  3960.  
  3961.  
  3962.  
  3963.  
  3964. Inter-Client Communication Conventions        X11, Release 6.4
  3965.  
  3966.  
  3967. property.
  3968.  
  3969. If the relative importance of colormaps changes, the client
  3970. should update the WM_COLORMAP_WINDOWS property to reflect
  3971. the new ordering.  If the top-level window does not appear
  3972. in the list, the window manager will assume it to be of
  3973. higher priority than any window in the list.
  3974.  
  3975. WM_TRANSIENT_FOR windows can either have their own WM_COL-
  3976. ORMAP_WINDOWS property or appear in the property of the win-
  3977. dow they are transient for, as appropriate.
  3978.  
  3979.              Rationale
  3980.  
  3981.      An alternative design was considered for how
  3982.      clients should hint to the window manager about
  3983.      their colormap requirements.  This alternative
  3984.      design specified a list of colormaps instead of a
  3985.      list of windows.  The current design, a list of
  3986.      windows, was chosen for two reasons.  First, it
  3987.      allows window managers to find the visuals of the
  3988.      colormaps, thus permitting visual-dependent col-
  3989.      ormap installation policies.  Second, it allows
  3990.      window managers to select for VisibilityChange
  3991.      events on the windows concerned and to ensure that
  3992.      colormaps are only installed if the windows that
  3993.      need them are visible.  The alternative design
  3994.      allows for neither of these policies.
  3995.  
  3996.  
  3997.            Advice to Implementors
  3998.  
  3999.      Clients should be aware of the min-installed-maps
  4000.      and max-installed-maps fields of the connection
  4001.      setup information, and the effect that the minimum
  4002.      value has on the "required list" defined by the
  4003.      Protocol in the description of the InstallColormap
  4004.      request.  Briefly, the min-installed-maps most
  4005.      recently installed maps are guaranteed to be
  4006.      installed.  This value is often one; clients need-
  4007.      ing multiple colormaps should beware.
  4008.  
  4009.  
  4010. Whenever possible, clients should use the mechanisms
  4011. described above and let the window manager handle colormap
  4012. installation.  However, clients are permitted to perform
  4013. colormap installation on their own while they have the
  4014. pointer grabbed.  A client performing colormap installation
  4015. must notify the window manager prior to the first installa-
  4016. tion.  When the client has finished its colormap installa-
  4017. tion, it must also notify the window manager.  The client
  4018. notifies the window manager by issuing a SendEvent request
  4019. with the following arguments:
  4020.  
  4021.  
  4022.  
  4023.  
  4024.                  55
  4025.  
  4026.  
  4027.  
  4028.  
  4029.  
  4030. Inter-Client Communication Conventions        X11, Release 6.4
  4031.  
  4032.  
  4033. ----------------------------------------------------------
  4034. Argument          Value
  4035. ----------------------------------------------------------
  4036. destination:          the root window of the screen on
  4037.               which the colormap is being
  4038.               installed
  4039. propagate:          False
  4040. event-mask:          ColormapChange
  4041. event: a ClientMes-
  4042. sage with:
  4043.   window:          the root window, as above
  4044.   type:           WM_COLORMAP_NOTIFY
  4045.   format:          32
  4046.   data[0]:          the timestamp of the event that
  4047.               caused the client to start or stop
  4048.               installing colormaps
  4049.   data[1]:          1 if the client is starting col-
  4050.               ormap installation, 0 if the client
  4051.               is finished with colormap installa-
  4052.               tion
  4053.   data[2]:          reserved, must be zero
  4054.   data[3]:          reserved, must be zero
  4055.   data[4]:          reserved, must be zero
  4056. ----------------------------------------------------------
  4057.  
  4058.  
  4059. This feature was introduced in version 2.0 of this document,
  4060. and there will be a significant period of time before all
  4061. window managers can be expected to implement this feature.
  4062. Before using this feature, clients must check the compliance
  4063. level of the window manager (using the mechanism described
  4064. in section 4.3) to verify that it supports this feature.
  4065. This is necessary to prevent colormap installation conflicts
  4066. between clients and older window managers.
  4067.  
  4068. Window managers should refrain from installing colormaps
  4069. while a client has requested control of colormap installa-
  4070. tion.  The window manager should continue to track the set
  4071. of installed colormaps so that it can reinstate its colormap
  4072. focus policy when the client has finished colormap installa-
  4073. tion.
  4074.  
  4075. This technique has race conditions that may result in the
  4076. colormaps continuing to be installed even after a client has
  4077. issued its notification message.  For example, the window
  4078. manager may have issued some InstallColormap requests that
  4079. are not executed until after the client's SendEvent and
  4080. InstallColormap requests, thus uninstalling the client's
  4081. colormaps.  If this occurs while the client still has the
  4082. pointer grabbed and before the client has issued the "fin-
  4083. ished" message, the client may reinstall the desired col-
  4084. ormaps.
  4085.  
  4086.  
  4087.  
  4088.  
  4089.  
  4090.                  56
  4091.  
  4092.  
  4093.  
  4094.  
  4095.  
  4096. Inter-Client Communication Conventions        X11, Release 6.4
  4097.  
  4098.  
  4099.            Advice to Implementors
  4100.  
  4101.      Clients are expected to use this mechanism for
  4102.      things such as pop-up windows and for animations
  4103.      that use override-redirect windows.
  4104.  
  4105.      If a client fails to issue the "finished" message,
  4106.      the window manager may be left in a state where
  4107.      its colormap installation policy is suspended.
  4108.      Window manager implementors may want to implement
  4109.      a feature that resets colormap installation policy
  4110.      in response to a command from the user.
  4111.  
  4112.  
  4113. 4.1.9.    Icons
  4114.  
  4115. A client can hint to the window manager about the desired
  4116. appearance of its icon by setting:
  4117.  
  4118. o   A string in WM_ICON_NAME.
  4119.  
  4120.     All clients should do this because it provides a fall-
  4121.     back for window managers whose ideas about icons differ
  4122.     widely from those of the client.
  4123.  
  4124. o   A Pixmap into the icon_pixmap field of the WM_HINTS
  4125.     property and possibly another into the icon_mask field.
  4126.  
  4127.     The window manager is expected to display the pixmap
  4128.     masked by the mask.  The pixmap should be one of the
  4129.     sizes found in the WM_ICON_SIZE property on the root.
  4130.     If this property is not found, the window manager is
  4131.     unlikely to display icon pixmaps.  Window managers usu-
  4132.     ally will clip or tile pixmaps that do not match
  4133.     WM_ICON_SIZE.
  4134.  
  4135. o   A window into the icon_window field of the WM_HINTS
  4136.     property.
  4137.  
  4138.     The window manager is expected to map that window when-
  4139.     ever the client is in the Iconic state.  In general, the
  4140.     size of the icon window should be one of those specified
  4141.     in WM_ICON_SIZE on the root, if it exists.    Window man-
  4142.     agers are free to resize icon windows.
  4143.  
  4144. In the Iconic state, the window manager usually will ensure
  4145. that:
  4146.  
  4147. o   If the window's WM_HINTS.icon_window is set, the window
  4148.     it names is visible.
  4149.  
  4150. o   If the window's WM_HINTS.icon_window is not set but the
  4151.     window's WM_HINTS.icon_pixmap is set, the pixmap it
  4152.     names is visible.
  4153.  
  4154.  
  4155.  
  4156.                  57
  4157.  
  4158.  
  4159.  
  4160.  
  4161.  
  4162. Inter-Client Communication Conventions        X11, Release 6.4
  4163.  
  4164.  
  4165. o   Otherwise, the window's WM_ICON_NAME string is visible.
  4166.  
  4167. Clients should observe the following conventions about their
  4168. icon windows:
  4169.  
  4170.             Conventions
  4171.  
  4172.  
  4173.      1.   The icon window should be an InputOutput
  4174.       child of the root.
  4175.  
  4176.      2.   The icon window should be one of the sizes
  4177.       specified in the WM_ICON_SIZE property on the
  4178.       root.
  4179.  
  4180.      3.   The icon window should use the root visual
  4181.       and default colormap for the screen in ques-
  4182.       tion.
  4183.  
  4184.      4.   Clients should not map their icon windows.
  4185.  
  4186.      5.   Clients should not unmap their icon windows.
  4187.  
  4188.      6.   Clients should not configure their icon win-
  4189.       dows.
  4190.  
  4191.      7.   Clients should not set override-redirect on
  4192.       their icon windows or select for Resize-
  4193.       Redirect events on them.
  4194.  
  4195.      8.   Clients must not depend on being able to
  4196.       receive input events by means of their icon
  4197.       windows.
  4198.  
  4199.      9.   Clients must not manipulate the borders of
  4200.       their icon windows.
  4201.  
  4202.      10.  Clients must select for Exposure events on
  4203.       their icon window and repaint it when
  4204.       requested.
  4205.  
  4206.  
  4207. Window managers will differ as to whether they support input
  4208. events to client's icon windows; most will allow the client
  4209. to receive some subset of the keys and buttons.
  4210.  
  4211. Window managers will ignore any WM_NAME, WM_ICON_NAME,
  4212. WM_NORMAL_HINTS, WM_HINTS, WM_CLASS, WM_TRANSIENT_FOR,
  4213. WM_PROTOCOLS, WM_COLORMAP_WINDOWS, WM_COMMAND, or
  4214. WM_CLIENT_MACHINE properties they find on icon windows.
  4215.  
  4216.  
  4217.  
  4218.  
  4219.  
  4220.  
  4221.  
  4222.                  58
  4223.  
  4224.  
  4225.  
  4226.  
  4227.  
  4228. Inter-Client Communication Conventions        X11, Release 6.4
  4229.  
  4230.  
  4231. 4.1.10.  Pop-up Windows
  4232.  
  4233. Clients that wish to pop up a window can do one of three
  4234. things:
  4235.  
  4236. 1.   They can create and map another normal top-level win-
  4237.      dow, which will get decorated and managed as normal by
  4238.      the window manager.  See the discussion of window
  4239.      groups that follows.
  4240.  
  4241. 2.   If the window will be visible for a relatively short
  4242.      time and deserves a somewhat lighter treatment, they
  4243.      can set the WM_TRANSIENT_FOR property.  They can expect
  4244.      less decoration but can set all the normal window man-
  4245.      ager properties on the window.  An example would be a
  4246.      dialog box.
  4247.  
  4248. 3.   If the window will be visible for a very short time and
  4249.      should not be decorated at all, the client can set
  4250.      override-redirect on the window.  In general, this
  4251.      should be done only if the pointer is grabbed while the
  4252.      window is mapped.    The window manager will never inter-
  4253.      fere with these windows, which should be used with cau-
  4254.      tion.  An example of an appropriate use is a pop-up
  4255.      menu.
  4256.  
  4257.              Advice to Implementors
  4258.  
  4259.       The user will not be able to move, resize,
  4260.       restack, or transfer the input focus to over-
  4261.       ride-redirect windows, since the window man-
  4262.       ager is not managing them.  If it is neces-
  4263.       sary for a client to receive keystrokes on an
  4264.       override-redirect window, either the client
  4265.       must grab the keyboard or the client must
  4266.       have another top-level window that is not
  4267.       override-redirect and that has selected the
  4268.       Locally Active or Globally Active focus
  4269.       model.  The client may set the focus to the
  4270.       override-redirect window when the other win-
  4271.       dow receives a WM_TAKE_FOCUS message or one
  4272.       of the events listed in section 4.1.7 in the
  4273.       description of the Globally Active focus
  4274.       model.
  4275.  
  4276.  
  4277. Window managers are free to decide if WM_TRANSIENT_FOR win-
  4278. dows should be iconified when the window they are transient
  4279. for is.  Clients displaying WM_TRANSIENT_FOR windows that
  4280. have (or request to have) the window they are transient for
  4281. iconified do not need to request that the same operation be
  4282. performed on the WM_TRANSIENT_FOR window; the window manager
  4283. will change its state if that is the policy it wishes to
  4284. enforce.
  4285.  
  4286.  
  4287.  
  4288.                  59
  4289.  
  4290.  
  4291.  
  4292.  
  4293.  
  4294. Inter-Client Communication Conventions        X11, Release 6.4
  4295.  
  4296.  
  4297. 4.1.11.  Window Groups
  4298.  
  4299. A set of top-level windows that should be treated from the
  4300. user's point of view as related (even though they may belong
  4301. to a number of clients) should be linked together using the
  4302. window_group field of the WM_HINTS structure.
  4303.  
  4304. One of the windows (that is, the one the others point to)
  4305. will be the group leader and will carry the group as opposed
  4306. to the individual properties.  Window managers may treat the
  4307. group leader differently from other windows in the group.
  4308. For example, group leaders may have the full set of decora-
  4309. tions, and other group members may have a restricted set.
  4310.  
  4311. It is not necessary that the client ever map the group
  4312. leader; it may be a window that exists solely as a place-
  4313. holder.
  4314.  
  4315. It is up to the window manager to determine the policy for
  4316. treating the windows in a group.  At present, there is no
  4317. way for a client to request a group, as opposed to an indi-
  4318. vidual, operation.
  4319.  
  4320. 4.2.  Client Responses to Window Manager Actions
  4321.  
  4322. The window manager performs a number of operations on client
  4323. resources, primarily on their top-level windows.  Clients
  4324. must not try to fight this but may elect to receive notifi-
  4325. cation of the window manager's operations.
  4326.  
  4327. 4.2.1.    Reparenting
  4328.  
  4329. Clients must be aware that some window managers will repar-
  4330. ent their top-level windows so that a window that was cre-
  4331. ated as a child of the root will be displayed as a child of
  4332. some window belonging to the window manager.  The effects
  4333. that this reparenting will have on the client are as fol-
  4334. lows:
  4335.  
  4336. o   The parent value returned by a QueryTree request will no
  4337.     longer be the value supplied to the CreateWindow request
  4338.     that created the reparented window.  There should be no
  4339.     need for the client to be aware of the identity of the
  4340.     window to which the top-level window has been repar-
  4341.     ented.  In particular, a client that wishes to create
  4342.     further top-level windows should continue to use the
  4343.     root as the parent for these new windows.
  4344.  
  4345. o   The server will interpret the (x,y) coordinates in a
  4346.     ConfigureWindow request in the new parent's coordinate
  4347.     space.  In fact, they usually will not be interpreted by
  4348.     the server because a reparenting window manager usually
  4349.     will have intercepted these operations (see section
  4350.     4.2.2).  Clients should use the root coordinate space
  4351.  
  4352.  
  4353.  
  4354.                  60
  4355.  
  4356.  
  4357.  
  4358.  
  4359.  
  4360. Inter-Client Communication Conventions        X11, Release 6.4
  4361.  
  4362.  
  4363.     for these requests (see section 4.1.5).
  4364.  
  4365. o   ConfigureWindow requests that name a specific sibling
  4366.     window may fail because the window named, which used to
  4367.     be a sibling, no longer is after the reparenting opera-
  4368.     tion (see section 4.1.5).
  4369.  
  4370. o   The (x,y) coordinates returned by a GetGeometry request
  4371.     are in the parent's coordinate space and are thus not
  4372.     directly useful after a reparent operation.
  4373.  
  4374. o   A background of ParentRelative will have unpredictable
  4375.     results.
  4376.  
  4377. o   A cursor of None will have unpredictable results.
  4378.  
  4379. Clients that want to be notified when they are reparented
  4380. can select for StructureNotify events on their top-level
  4381. window.  They will receive a ReparentNotify event if and
  4382. when reparenting takes place.  When a client withdraws a
  4383. top-level window, the window manager will reparent it back
  4384. to the root window if the window had been reparented else-
  4385. where.
  4386.  
  4387. If the window manager reparents a client's window, the
  4388. reparented window will be placed in the save-set of the par-
  4389. ent window.  This means that the reparented window will not
  4390. be destroyed if the window manager terminates and will be
  4391. remapped if it was unmapped.  Note that this applies to all
  4392. client windows the window manager reparents, including tran-
  4393. sient windows and client icon windows.
  4394.  
  4395. 4.2.2.    Redirection of Operations
  4396.  
  4397. Clients must be aware that some window managers will arrange
  4398. for some client requests to be intercepted and redirected.
  4399. Redirected requests are not executed; they result instead in
  4400. events being sent to the window manager, which may decide to
  4401. do nothing, to alter the arguments, or to perform the
  4402. request on behalf of the client.
  4403.  
  4404. The possibility that a request may be redirected means that
  4405. a client cannot assume that any redirectable request is
  4406. actually performed when the request is issued or is actually
  4407. performed at all.  The requests that may be redirected are
  4408. MapWindow, ConfigureWindow, and CirculateWindow.
  4409.  
  4410.            Advice to Implementors
  4411.  
  4412.      The following is incorrect because the MapWindow
  4413.      request may be intercepted and the PolyLine output
  4414.      made to an unmapped window:
  4415.  
  4416.  
  4417.  
  4418.  
  4419.  
  4420.                  61
  4421.  
  4422.  
  4423.  
  4424.  
  4425.  
  4426. Inter-Client Communication Conventions        X11, Release 6.4
  4427.  
  4428.  
  4429.       MapWindow A
  4430.       PolyLine A GC <point> <point> ...
  4431.  
  4432.  
  4433.      The client must wait for an Expose event before
  4434.      drawing in the window.14
  4435.  
  4436.      This next example incorrectly assumes that the
  4437.      ConfigureWindow request is actually executed with
  4438.      the arguments supplied:
  4439.  
  4440.  
  4441.       ConfigureWindow width=N height=M
  4442.       <output assuming window is N by M>
  4443.  
  4444.  
  4445.      The client should select for StructureNotify on
  4446.      its window and monitor the window's size by track-
  4447.      ing ConfigureNotify events.
  4448.  
  4449.      Clients must be especially careful when attempting
  4450.      to set the focus to a window that they have just
  4451.      mapped.  This sequence may result in an X protocol
  4452.      error:
  4453.  
  4454.  
  4455.       MapWindow B
  4456.       SetInputFocus B
  4457.  
  4458.  
  4459.      If the MapWindow request has been intercepted, the
  4460.      window will still be unmapped, causing the
  4461.      SetInputFocus request to generate the error.  The
  4462.      solution to this problem is for clients to select
  4463.      for VisibilityChange on the window and to delay
  4464.      the issuance of the SetInputFocus request until
  4465.      they have received a VisibilityNotify event indi-
  4466.      cating that the window is visible.
  4467.  
  4468.      This technique does not guarantee correct opera-
  4469.      tion.  The user may have iconified the window by
  4470.      the time the SetInputFocus request reaches the
  4471.      server, still causing an error.  Or the window
  4472.      manager may decide to map the window into Iconic
  4473.      state, in which case the window will not be visi-
  4474.      ble.  This will delay the generation of the
  4475.      VisibilityNotify event indefinitely.  Clients must
  4476.      be prepared to handle these cases.
  4477. -----------
  4478.   14 This is true even if the client set the back-
  4479. ing-store attribute to Always.    The backing-store
  4480. attribute is a only a hint, and the server may
  4481. stop maintaining backing store contents at any
  4482. time.
  4483.  
  4484.  
  4485.  
  4486.                  62
  4487.  
  4488.  
  4489.  
  4490.  
  4491.  
  4492. Inter-Client Communication Conventions        X11, Release 6.4
  4493.  
  4494.  
  4495. A window with the override-redirect bit set is immune from
  4496. redirection, but the bit should be set on top-level windows
  4497. only in cases where other windows should be prevented from
  4498. processing input while the override-redirect window is
  4499. mapped (see section 4.1.10) and while responding to Resiz-
  4500. eRequest events (see section 4.2.9).
  4501.  
  4502. Clients that have no non-Withdrawn top-level windows and
  4503. that map an override-redirect top-level window are taking
  4504. over total responsibility for the state of the system.    It
  4505. is their responsibility to:
  4506.  
  4507. o   Prevent any preexisting window manager from interfering
  4508.     with their activities
  4509.  
  4510. o   Restore the status quo exactly after they unmap the win-
  4511.     dow so that any preexisting window manager does not get
  4512.     confused
  4513.  
  4514. In effect,  clients of this kind are acting as temporary
  4515. window managers.  Doing so is strongly discouraged because
  4516. these clients will be unaware of the user interface policies
  4517. the window manager is trying to maintain and because their
  4518. user interface behavior is likely to conflict with that of
  4519. less demanding clients.
  4520.  
  4521. 4.2.3.    Window Move
  4522.  
  4523. If the window manager moves a top-level window without
  4524. changing its size, the client will receive a synthetic Con-
  4525. figureNotify event following the move that describes the new
  4526. location in terms of the root coordinate space.  Clients
  4527. must not respond to being moved by attempting to move them-
  4528. selves to a better location.
  4529.  
  4530. Any real ConfigureNotify event on a top-level window implies
  4531. that the window's position on the root may have changed,
  4532. even though the event reports that the window's position in
  4533. its parent is unchanged because the window may have been
  4534. reparented.  Note that the coordinates in the event will
  4535. not, in this case, be directly useful.
  4536.  
  4537. The window manager will send these events by using a SendE-
  4538. vent request with the following arguments:
  4539.  
  4540. -----------------------------------
  4541. Argument       Value
  4542. -----------------------------------
  4543. destination:   The client's window
  4544. propagate:     False
  4545. event-mask:    StructureNotify
  4546. -----------------------------------
  4547.  
  4548.  
  4549.  
  4550.  
  4551.  
  4552.                  63
  4553.  
  4554.  
  4555.  
  4556.  
  4557.  
  4558. Inter-Client Communication Conventions        X11, Release 6.4
  4559.  
  4560.  
  4561. 4.2.4.    Window Resize
  4562.  
  4563. The client can elect to receive notification of being
  4564. resized by selecting for StructureNotify events on its top-
  4565. level windows.    It will receive a ConfigureNotify event.
  4566. The size information in the event will be correct, but the
  4567. location will be in the parent window (which may not be the
  4568. root).
  4569.  
  4570. The response of the client to being resized should be to
  4571. accept the size it has been given and to do its best with
  4572. it.  Clients must not respond to being resized by attempting
  4573. to resize themselves to a better size.    If the size is
  4574. impossible to work with, clients are free to request to
  4575. change to the Iconic state.
  4576.  
  4577. 4.2.5.    Iconify and Deiconify
  4578.  
  4579. A top-level window that is not Withdrawn will be in the Nor-
  4580. mal state if it is mapped and in the Iconic state if it is
  4581. unmapped.  This will be true even if the window has been
  4582. reparented; the window manager will unmap the window as well
  4583. as its parent when switching to the Iconic state.
  4584.  
  4585. The client can elect to be notified of these state changes
  4586. by selecting for StructureNotify events on the top-level
  4587. window.  It will receive a UnmapNotify event when it goes
  4588. Iconic and a MapNotify event when it goes Normal.
  4589.  
  4590. 4.2.6.    Colormap Change
  4591.  
  4592. Clients that wish to be notified of their colormaps being
  4593. installed or uninstalled should select for ColormapNotify
  4594. events on their top-level windows and on any windows they
  4595. have named in WM_COLORMAP_WINDOWS properties on their top-
  4596. level windows.    They will receive ColormapNotify events with
  4597. the new field FALSE when the colormap for that window is
  4598. installed or uninstalled.
  4599.  
  4600. 4.2.7.    Input Focus
  4601.  
  4602. Clients can request notification that they have the input
  4603. focus by selecting for FocusChange events on their top-level
  4604. windows; they will receive FocusIn and FocusOut events.
  4605. Clients that need to set the input focus to one of their
  4606. subwindows should not do so unless they have set
  4607. WM_TAKE_FOCUS in their WM_PROTOCOLS property and have done
  4608. one of the following:
  4609.  
  4610. o   Set the input field of WM_HINTS to True and actually
  4611.     have the input focus in one of their top-level windows
  4612.  
  4613. o   Set the input field of WM_HINTS to False and have
  4614.     received a suitable event as described in section 4.1.7
  4615.  
  4616.  
  4617.  
  4618.                  64
  4619.  
  4620.  
  4621.  
  4622.  
  4623.  
  4624. Inter-Client Communication Conventions        X11, Release 6.4
  4625.  
  4626.  
  4627. o   Have received a WM_TAKE_FOCUS message as described in
  4628.     section 4.1.7
  4629.  
  4630. Clients should not warp the pointer in an attempt to trans-
  4631. fer the focus; they should set the focus and leave the
  4632. pointer alone.    For further information, see section 6.2.
  4633.  
  4634. Once a client satisfies these conditions, it may transfer
  4635. the focus to another of its windows by using the SetInputFo-
  4636. cus request, which is defined as follows:
  4637.  
  4638. __
  4639. |    SetInputFocus
  4640.  
  4641.   focus: WINDOW or PointerRoot or None
  4642.   revert-to: {Parent, PointerRoot, None}
  4643.   time: TIMESTAMP or CurrentTime
  4644. |__
  4645.  
  4646.  
  4647.             Conventions
  4648.  
  4649.  
  4650.      1.   Clients that use a SetInputFocus request must
  4651.       set the time argument to the timestamp of the
  4652.       event that caused them to make the attempt.
  4653.       This cannot be a FocusIn event because they
  4654.       do not have timestamps.  Clients may also
  4655.       acquire the focus without a corresponding
  4656.       EnterNotify event.  Clients must not use Cur-
  4657.       rentTime for the time argument.
  4658.  
  4659.      2.   Clients that use a SetInputFocus request to
  4660.       set the focus to one of their windows must
  4661.       set the revert-to field to Parent.
  4662.  
  4663.  
  4664. 4.2.8.    ClientMessage Events
  4665.  
  4666. There is no way for clients to prevent themselves being sent
  4667. ClientMessage events.
  4668.  
  4669. Top-level windows with a WM_PROTOCOLS property may be sent
  4670. ClientMessage events specific to the protocols named by the
  4671. atoms in the property (see section 4.1.2.7).  For all proto-
  4672. cols, the ClientMessage events have the following:
  4673.  
  4674. o   WM_PROTOCOLS as the type field
  4675.  
  4676. o   Format 32
  4677.  
  4678. o   The atom that names their protocol in the data[0] field
  4679.  
  4680.  
  4681.  
  4682.  
  4683.  
  4684.                  65
  4685.  
  4686.  
  4687.  
  4688.  
  4689.  
  4690. Inter-Client Communication Conventions        X11, Release 6.4
  4691.  
  4692.  
  4693. o   A timestamp in their data[1] field
  4694.  
  4695. The remaining fields of the event, including the window
  4696. field, are determined by the protocol.
  4697.  
  4698. These events will be sent by using a SendEvent request with
  4699. the following arguments:
  4700.  
  4701. --------------------------------------------
  4702. Argument       Value
  4703. --------------------------------------------
  4704. destination:   The client's window
  4705. propagate:     False
  4706. event-mask:    () empty
  4707. event:           As specified by the protocol
  4708. --------------------------------------------
  4709.  
  4710.  
  4711. 4.2.8.1.  Window Deletion
  4712.  
  4713. Clients, usually those with multiple top-level windows,
  4714. whose server connection must survive the deletion of some of
  4715. their top-level windows, should include the atom
  4716. WM_DELETE_WINDOW in the WM_PROTOCOLS property on each such
  4717. window.  They will receive a ClientMessage event as
  4718. described above whose data[0] field is WM_DELETE_WINDOW.
  4719.  
  4720. Clients receiving a WM_DELETE_WINDOW message should behave
  4721. as if the user selected "delete window" from a hypothetical
  4722. menu.  They should perform any confirmation dialog with the
  4723. user and, if they decide to complete the deletion, should do
  4724. the following:
  4725.  
  4726. o   Either change the window's state to Withdrawn (as
  4727.     described in section 4.1.4) or destroy the window.
  4728.  
  4729. o   Destroy any internal state associated with the window.
  4730.  
  4731. If the user aborts the deletion during the confirmation dia-
  4732. log, the client should ignore the message.
  4733.  
  4734. Clients are permitted to interact with the user and ask, for
  4735. example, whether a file associated with the window to be
  4736. deleted should be saved or the window deletion should be
  4737. cancelled.  Clients are not required to destroy the window
  4738. itself; the resource may be reused, but all associated state
  4739. (for example, backing store) should be released.
  4740.  
  4741. If the client aborts a destroy and the user then selects
  4742. DELETE WINDOW again, the window manager should start the
  4743. WM_DELETE_WINDOW protocol again.  Window managers should not
  4744. use DestroyWindow requests on a window that has
  4745. WM_DELETE_WINDOW in its WM_PROTOCOLS property.
  4746.  
  4747.  
  4748.  
  4749.  
  4750.                  66
  4751.  
  4752.  
  4753.  
  4754.  
  4755.  
  4756. Inter-Client Communication Conventions        X11, Release 6.4
  4757.  
  4758.  
  4759. Clients that choose not to include WM_DELETE_WINDOW in the
  4760. WM_PROTOCOLS property may be disconnected from the server if
  4761. the user asks for one of the client's top-level windows to
  4762. be deleted.
  4763.  
  4764. 4.2.9.    Redirecting Requests
  4765.  
  4766. Normal clients can use the redirection mechanism just as
  4767. window managers do by selecting for SubstructureRedirect
  4768. events on a parent window or ResizeRedirect events on a win-
  4769. dow itself.  However, at most, one client per window can
  4770. select for these events, and a convention is needed to avoid
  4771. clashes.
  4772.  
  4773.              Convention
  4774.  
  4775.      Clients (including window managers) should select
  4776.      for SubstructureRedirect and ResizeRedirect events
  4777.      only on windows that they own.
  4778.  
  4779.  
  4780. In particular, clients that need to take some special action
  4781. if they are resized can select for ResizeRedirect events on
  4782. their top-level windows.  They will receive a ResizeRequest
  4783. event if the window manager resizes their window, and the
  4784. resize will not actually take place.  Clients are free to
  4785. make what use they like of the information that the window
  4786. manager wants to change their size, but they must configure
  4787. the window to the width and height specified in the event in
  4788. a timely fashion.  To ensure that the resize will actually
  4789. happen at this stage instead of being intercepted and exe-
  4790. cuted by the window manager (and thus restarting the pro-
  4791. cess), the client needs temporarily to set override-redirect
  4792. on the window.
  4793.  
  4794.              Convention
  4795.  
  4796.      Clients receiving ResizeRequest events must
  4797.      respond by doing the following:
  4798.  
  4799.      o     Setting override-redirect on the window speci-
  4800.      fied in the event
  4801.  
  4802.      o     Configuring the window specified in the event
  4803.      to the width and height specified in the event
  4804.      as soon as possible and before making any
  4805.      other geometry requests
  4806.  
  4807.      o     Clearing override-redirect on the window spec-
  4808.      ified in the event
  4809.  
  4810.  
  4811. If a window manager detects that a client is not obeying
  4812. this convention, it is free to take whatever measures it
  4813.  
  4814.  
  4815.  
  4816.                  67
  4817.  
  4818.  
  4819.  
  4820.  
  4821.  
  4822. Inter-Client Communication Conventions        X11, Release 6.4
  4823.  
  4824.  
  4825. deems appropriate to deal with the client.
  4826.  
  4827. 4.3.  Communication with the Window Manager by Means of
  4828. Selections
  4829.  
  4830. For each screen they manage, window managers will acquire
  4831. ownership of a selection named WM_Sn, where n is the screen
  4832. number, as described in section 1.2.6.    Window managers
  4833. should comply with the conventions for "Manager Selections"
  4834. described in section 2.8.  The intent is for clients to be
  4835. able to request a variety of information or services by
  4836. issuing conversion requests on this selection.    Window man-
  4837. agers should support conversion of the following target on
  4838. their manager selection:
  4839.  
  4840.  
  4841. --------------------------------------------------------
  4842. Atom      Type        Data Received
  4843. --------------------------------------------------------
  4844. VERSION   INTEGER   Two integers, which are the major
  4845.             and minor release numbers (respec-
  4846.             tively) of the ICCCM with which the
  4847.             window manager complies.  For this
  4848.             version of the ICCCM, the numbers
  4849.             are 2 and 0.15
  4850. --------------------------------------------------------
  4851.  
  4852.  
  4853. 4.4.  Summary of Window Manager Property Types
  4854.  
  4855. The window manager properties are summarized in the follow-
  4856. ing table (see also section 14.1 of Xlib - C Language X
  4857. Interface).
  4858.  
  4859. -----------------------------------------------------------
  4860. Name              Type          Format   See Section
  4861. -----------------------------------------------------------
  4862. WM_CLASS          STRING         8     4.1.2.5
  4863. WM_CLIENT_MACHINE     TEXT             4.1.2.9
  4864. WM_COLORMAP_WINDOWS   WINDOW        32     4.1.2.8
  4865. WM_HINTS          WM_HINTS        32     4.1.2.4
  4866. WM_ICON_NAME          TEXT             4.1.2.2
  4867. WM_ICON_SIZE          WM_ICON_SIZE    32     4.1.3.2
  4868. WM_NAME           TEXT             4.1.2.1
  4869. WM_NORMAL_HINTS       WM_SIZE_HINTS    32     4.1.2.3
  4870. WM_PROTOCOLS          ATOM        32     4.1.2.7
  4871.  
  4872. -----------
  4873.   15 As a special case, clients not wishing to
  4874. implement a selection request may simply issue a
  4875. GetSelectionOwner request on the appropriate WM_Sn
  4876. selection.  If this selection is owned, clients
  4877. may assume that the window manager complies with
  4878. ICCCM version 2.0 or later.
  4879.  
  4880.  
  4881.  
  4882.                  68
  4883.  
  4884.  
  4885.  
  4886.  
  4887.  
  4888. Inter-Client Communication Conventions        X11, Release 6.4
  4889.  
  4890.  
  4891. -----------------------------------------------------------
  4892. Name              Type          Format   See Section
  4893. -----------------------------------------------------------
  4894. WM_STATE          WM_STATE        32     4.1.3.1
  4895. WM_TRANSIENT_FOR      WINDOW        32     4.1.2.6
  4896. -----------------------------------------------------------
  4897.  
  4898.  
  4899. 5.  Session Management and Additional Inter-Client Exchanges
  4900.  
  4901. This section contains some conventions for clients that par-
  4902. ticipate in session management.  See X Session Management
  4903. Protocol for further details.  Clients that do not support
  4904. this protocol cannot expect their window state (e.g.,
  4905. WM_STATE, position, size, and stacking order) to be pre-
  4906. served across sessions.
  4907.  
  4908. 5.1.  Client Support for Session Management
  4909.  
  4910. Each session participant will obtain a unique client identi-
  4911. fier (client-ID) from the session manager.  The client must
  4912. identify one top-level window as the "client leader." This
  4913. window must be created by the client.  It may be in any
  4914. state, including the Withdrawn state.  The client leader
  4915. window must have a SM_CLIENT_ID property, which contains the
  4916. client-ID obtained from the session management protocol.
  4917. That property must:
  4918.  
  4919. o   Be of type STRING
  4920.  
  4921. o   Be of format 8
  4922.  
  4923. o   Contain the client-ID as a string of XPCS characters
  4924.     encoded using ISO 8859-1
  4925.  
  4926. All top-level, nontransient windows created by a client on
  4927. the same display as the client leader must have a
  4928. WM_CLIENT_LEADER property. This property contains a window
  4929. ID that identifies the client leader window.  The client
  4930. leader window must have a WM_CLIENT_LEADER property contain-
  4931. ing its own window ID (i.e., the client leader window is
  4932. pointing to itself).  Transient windows need not have a
  4933. WM_CLIENT_LEADER property if the client leader can be deter-
  4934. mined using the information in the WM_TRANSIENT_FOR prop-
  4935. erty.  The WM_CLIENT_LEADER property must:
  4936.  
  4937. o   Be of type WINDOW
  4938.  
  4939. o   Be of format 32
  4940.  
  4941. o   Contain the window ID of the client leader window
  4942.  
  4943. A client must withdraw all of its top-level windows on the
  4944. same display before modifiying either the WM_CLIENT_LEADER
  4945.  
  4946.  
  4947.  
  4948.                  69
  4949.  
  4950.  
  4951.  
  4952.  
  4953.  
  4954. Inter-Client Communication Conventions        X11, Release 6.4
  4955.  
  4956.  
  4957. or the SM_CLIENT_ID property of its client leader window.
  4958.  
  4959. It is necessary that other clients be able to uniquely iden-
  4960. tify a window (across sessions) among all windows related to
  4961. the same client-ID.  For example, a window manager can
  4962. require this unique ID to restore geometry information from
  4963. a previous session, or a workspace manager could use it to
  4964. restore information about which windows are in which
  4965. workspace.  A client may optionally provide a WM_WINDOW_ROLE
  4966. property to uniquely identify a window within the scope
  4967. specified above.  The combination of SM_CLIENT_ID and
  4968. WM_WINDOW_ROLE can be used by other clients to uniquely
  4969. identify a window across sessions.
  4970.  
  4971. If the WM_WINDOW_ROLE property is not specified on a top-
  4972. level window, a client that needs to uniquely identify that
  4973. window will try to use instead the values of WM_CLASS and
  4974. WM_NAME.  If a client has multiple windows with identical
  4975. WM_CLASS and WM_NAME properties, then it should provide a
  4976. WM_WINDOW_ROLE property.
  4977.  
  4978. The client must set the WM_WINDOW_ROLE property to a string
  4979. that uniquely identifies that window among all windows that
  4980. have the same client leader window.  The property must:
  4981.  
  4982. o   Be of type STRING
  4983.  
  4984. o   Be of format 8
  4985.  
  4986. o   Contain a string restricted to the XPCS characters,
  4987.     encoded in ISO 8859-1
  4988.  
  4989. 5.2.  Window Manager Support for Session Management
  4990.  
  4991. A window manager supporting session management must register
  4992. with the session manager and obtain its own client-ID.    The
  4993. window manager should save and restore information such as
  4994. the WM_STATE, the layout of windows on the screen, and their
  4995. stacking order for every client window that has a valid
  4996. SM_CLIENT_ID property (on itself, or on the window named by
  4997. WM_CLIENT_LEADER) and that can be uniquely identified.
  4998. Clients are allowed to change this state during the first
  4999. phase of the session checkpoint process.  Therefore, window
  5000. managers should request a second checkpoint phase and save
  5001. clients' state only during that phase.
  5002.  
  5003. 5.3.  Support for ICE Client Rendezvous
  5004.  
  5005. The Inter-Client Exchange protocol (ICE) defined as of X11R6
  5006. specifies a generic communication framework, independent of
  5007. the X server, for data exchange between arbitrary clients.
  5008. ICE also defines a protocol for any two ICE clients who also
  5009. have X connections to the same X server to locate (ren-
  5010. dezvous with) each other.
  5011.  
  5012.  
  5013.  
  5014.                  70
  5015.  
  5016.  
  5017.  
  5018.  
  5019.  
  5020. Inter-Client Communication Conventions        X11, Release 6.4
  5021.  
  5022.  
  5023. This protocol, called the "ICE X Rendezvous" protocol, is
  5024. defined in the ICE specification, Appendix B, and uses the
  5025. property ICE_PROTOCOLS plus ClientMessage events.  Refer to
  5026. that specification for complete details.
  5027.  
  5028. 6.  Manipulation of Shared Resources
  5029.  
  5030. X Version 11 permits clients to manipulate a number of
  5031. shared resources, for example, the input focus, the pointer,
  5032. and colormaps.    Conventions are required so that clients
  5033. share resources in an orderly fashion.
  5034.  
  5035. 6.1.  The Input Focus
  5036.  
  5037. Clients that explicitly set the input focus must observe one
  5038. of two modes:
  5039.  
  5040. o   Locally active mode
  5041.  
  5042. o   Globally active mode
  5043.  
  5044.               Conventions
  5045.  
  5046.  
  5047.      1.   Locally active clients should set the input
  5048.       focus to one of their windows only when it is
  5049.       already in one of their windows or when they
  5050.       receive a WM_TAKE_FOCUS message.  They should
  5051.       set the input field of the WM_HINTS structure
  5052.       to True.
  5053.  
  5054.      2.   Globally active clients should set the input
  5055.       focus to one of their windows only when they
  5056.       receive a button event and a passive-grabbed
  5057.       key event, or when they receive a
  5058.       WM_TAKE_FOCUS message.  They should set the
  5059.       input field of the WM_HINTS structure to
  5060.       False.
  5061.  
  5062.      3.   In addition, clients should use the timestamp
  5063.       of the event that caused them to attempt to
  5064.       set the input focus as the time field on the
  5065.       SetInputFocus request, not CurrentTime.
  5066.  
  5067.  
  5068. 6.2.  The Pointer
  5069.  
  5070. In general, clients should not warp the pointer.  Window
  5071. managers, however, may do so (for example, to maintain the
  5072. invariant that the pointer is always in the window with the
  5073. input focus).  Other window managers may want to preserve
  5074. the illusion that the user is in sole control of the
  5075. pointer.
  5076.  
  5077.  
  5078.  
  5079.  
  5080.                  71
  5081.  
  5082.  
  5083.  
  5084.  
  5085.  
  5086. Inter-Client Communication Conventions        X11, Release 6.4
  5087.  
  5088.  
  5089.             Conventions
  5090.  
  5091.  
  5092.      1.   Clients should not warp the pointer.
  5093.  
  5094.      2.   Clients that insist on warping the pointer
  5095.       should do so only with the src-window argu-
  5096.       ment of the WarpPointer request set to one of
  5097.       their windows.
  5098.  
  5099.  
  5100. 6.3.  Grabs
  5101.  
  5102. A client's attempt to establish a button or a key grab on a
  5103. window will fail if some other client has already estab-
  5104. lished a conflicting grab on the same window.  The grabs,
  5105. therefore, are shared resources, and their use requires con-
  5106. ventions.
  5107.  
  5108. In conformance with the principle that clients should
  5109. behave, as far as possible, when a window manager is running
  5110. as they would when it is not, a client that has the input
  5111. focus may assume that it can receive all the available keys
  5112. and buttons.
  5113.  
  5114.              Convention
  5115.  
  5116.      Window managers should ensure that they provide
  5117.      some mechanism for their clients to receive events
  5118.      from all keys and all buttons, except for events
  5119.      involving keys whose KeySyms are registered as
  5120.      being for window management functions (for exam-
  5121.      ple, a hypothetical WINDOW KeySym).
  5122.  
  5123.  
  5124. In other words, window managers must provide some mechanism
  5125. by which a client can receive events from every key and but-
  5126. ton (regardless of modifiers) unless and until the X Consor-
  5127. tium registers some KeySyms as being reserved for window
  5128. management functions.  Currently, no KeySyms are registered
  5129. for window management functions.
  5130.  
  5131. Even so, clients are advised to allow the key and button
  5132. combinations used to elicit program actions to be modified,
  5133. because some window managers may choose not to observe this
  5134. convention or may not provide a convenient method for the
  5135. user to transmit events from some keys.
  5136.  
  5137.              Convention
  5138.  
  5139.      Clients should establish button and key grabs only
  5140.      on windows that they own.
  5141.  
  5142.  
  5143.  
  5144.  
  5145.  
  5146.                  72
  5147.  
  5148.  
  5149.  
  5150.  
  5151.  
  5152. Inter-Client Communication Conventions        X11, Release 6.4
  5153.  
  5154.  
  5155. In particular, this convention means that a window manager
  5156. that wishes to establish a grab over the client's top-level
  5157. window should either establish the grab on the root or
  5158. reparent the window and establish the grab on a proper
  5159. ancestor.  In some cases, a window manager may want to con-
  5160. sume the event received, placing the window in a state where
  5161. a subsequent such event will go to the client.    Examples
  5162. are:
  5163.  
  5164. o   Clicking in a window to set focus with the click not
  5165.     being offered to the client
  5166.  
  5167. o   Clicking in a buried window to raise it, again, with the
  5168.     click not offered to the client
  5169.  
  5170. More typically, a window manager should add to, rather than
  5171. replace, the client's semantics for key+button combinations
  5172. by allowing the event to be used by the client after the
  5173. window manager is done with it.  To ensure this, the window
  5174. manager should establish the grab on the parent by using the
  5175. following:
  5176.  
  5177.  
  5178.      pointer/keyboard-mode == Synchronous
  5179.  
  5180.  
  5181. Then, the window manager should release the grab by using an
  5182. AllowEvents request with the following specified:
  5183.  
  5184.  
  5185.      mode == ReplayPointer/Keyboard
  5186.  
  5187.  
  5188. In this way, the client will receive the events as if they
  5189. had not been intercepted.
  5190.  
  5191. Obviously, these conventions place some constraints on pos-
  5192. sible user interface policies.    There is a trade-off here
  5193. between freedom for window managers to implement their user
  5194. interface policies and freedom for clients to implement
  5195. theirs.  The dilemma is resolved by:
  5196.  
  5197. o   Allowing window managers to decide if and when a client
  5198.     will receive an event from any given key or button
  5199.  
  5200. o   Placing a requirement on the window manager to provide
  5201.     some mechanism, perhaps a "Quote" key, by which the user
  5202.     can send an event from any key or button to the client
  5203.  
  5204. 6.4.  Colormaps
  5205.  
  5206. Section 4.1.8 prescribes conventions for clients to communi-
  5207. cate with the window manager about their colormap needs.  If
  5208. your clients are DirectColor type applications, you should
  5209.  
  5210.  
  5211.  
  5212.                  73
  5213.  
  5214.  
  5215.  
  5216.  
  5217.  
  5218. Inter-Client Communication Conventions        X11, Release 6.4
  5219.  
  5220.  
  5221. consult section 14.3 of Xlib - C Language X Interface for
  5222. conventions connected with sharing standard colormaps.    They
  5223. should look for and create the properties described there on
  5224. the root window of the appropriate screen.
  5225.  
  5226. The contents of the RGB_COLOR_MAP type property are as fol-
  5227. lows:
  5228.  
  5229. ---------------------------------------------------------
  5230. Field         Type    Comments
  5231. ---------------------------------------------------------
  5232. colormap     COLORMAP    ID of the colormap described
  5233. red_max      CARD32    Values for pixel calculations
  5234. red_mult     CARD32
  5235. green_max    CARD32
  5236. green_mult   CARD32
  5237. blue_max     CARD32
  5238. blue_mult    CARD32
  5239. base_pixel   CARD32
  5240. visual_id    VISUALID    Visual to which colormap belongs
  5241. kill_id      CARD32    ID for destroying the resources
  5242. ---------------------------------------------------------
  5243.  
  5244.  
  5245. When deleting or replacing an RGB_COLOR_MAP, it is not suf-
  5246. ficient to delete the property; it is important to free the
  5247. associated colormap resources as well.    If kill_id is
  5248. greater than one, the resources should be freed by issuing a
  5249. KillClient request with kill_id as the argument.  If kill_id
  5250. is one, the resources should be freed by issuing a FreeCol-
  5251. ormap request with colormap as the colormap argument.  If
  5252. kill_id is zero, no attempt should be made to free the
  5253. resources.  A client that creates an RGB_COLOR_MAP for which
  5254. the colormap resource is created specifically for this pur-
  5255. pose should set kill_id to one (and can create more than one
  5256. such standard colormap using a single connection).  A client
  5257. that creates an RGB_COLOR_MAP for which the colormap
  5258. resource is shared in some way (for example, is the default
  5259. colormap for the root window) should create an arbitrary
  5260. resource and use its resource ID for kill_id (and should
  5261. create no other standard colormaps on the connection).
  5262.  
  5263.              Convention
  5264.  
  5265.      If an RGB_COLOR_MAP property is too short to con-
  5266.      tain the visual_id field, it can be assumed that
  5267.      the visual_id is the root visual of the appropri-
  5268.      ate screen.  If an RGB_COLOR_MAP property is too
  5269.      short to contain the kill_id field, a value of
  5270.      zero can be assumed.
  5271.  
  5272.  
  5273. During the connection handshake, the server informs the
  5274. client of the default colormap for each screen.  This is a
  5275.  
  5276.  
  5277.  
  5278.                  74
  5279.  
  5280.  
  5281.  
  5282.  
  5283.  
  5284. Inter-Client Communication Conventions        X11, Release 6.4
  5285.  
  5286.  
  5287. colormap for the root visual, and clients can use it to
  5288. improve the extent of colormap sharing if they use the root
  5289. visual.
  5290.  
  5291. 6.5.  The Keyboard Mapping
  5292.  
  5293. The X server contains a table (which is read by GetKey-
  5294. boardMapping requests) that describes the set of symbols
  5295. appearing on the corresponding key for each keycode gener-
  5296. ated by the server.  This table does not affect the server's
  5297. operations in any way; it is simply a database used by
  5298. clients that attempt to understand the keycodes they
  5299. receive.  Nevertheless, it is a shared resource and requires
  5300. conventions.
  5301.  
  5302. It is possible for clients to modify this table by using a
  5303. ChangeKeyboardMapping request.    In general, clients should
  5304. not do this.  In particular, this is not the way in which
  5305. clients should implement key bindings or key remapping.  The
  5306. conversion between a sequence of keycodes received from the
  5307. server and a string in a particular encoding is a private
  5308. matter for each client (as it must be in a world where
  5309. applications may be using different encodings to support
  5310. different languages and fonts).  See the Xlib reference man-
  5311. ual for converting keyboard events to text.
  5312.  
  5313. The only valid reason for using a ChangeKeyboardMapping
  5314. request is when the symbols written on the keys have changed
  5315. as, for example, when a Dvorak key conversion kit or a set
  5316. of APL keycaps has been installed.  Of course, a client may
  5317. have to take the change to the keycap on trust.
  5318.  
  5319. The following illustrates a permissible interaction between
  5320. a client and a user:
  5321.  
  5322. Client:   "You just started me on a server without a Pause
  5323.       key.    Please choose a key to be the Pause key and
  5324.       press it now."
  5325.  
  5326. User:      Presses the Scroll Lock key
  5327.  
  5328. Client:   "Adding Pause to the symbols on the Scroll Lock
  5329.       key: Confirm or Abort."
  5330.  
  5331. User:      Confirms
  5332.  
  5333. Client:   Uses a ChangeKeyboardMapping request to add Pause
  5334.       to the keycode that already contains Scroll Lock
  5335.       and issues this request, "Please paint Pause on
  5336.       the Scroll Lock key."
  5337.  
  5338.  
  5339.  
  5340.  
  5341.  
  5342.  
  5343.  
  5344.                  75
  5345.  
  5346.  
  5347.  
  5348.  
  5349.  
  5350. Inter-Client Communication Conventions        X11, Release 6.4
  5351.  
  5352.  
  5353.                   Convention
  5354.  
  5355.            Clients should not use ChangeKey-
  5356.            boardMapping requests.
  5357.  
  5358.  
  5359. If a client succeeds in changing the keyboard mapping table,
  5360. all clients will receive MappingNotify(request==Keyboard)
  5361. events.  There is no mechanism to avoid receiving these
  5362. events.
  5363.  
  5364.              Convention
  5365.  
  5366.      Clients receiving MappingNotify(request==Keyboard)
  5367.      events should update any internal keycode transla-
  5368.      tion tables they are using.
  5369.  
  5370.  
  5371. 6.6.  The Modifier Mapping
  5372.  
  5373. X Version 11 supports 8 modifier bits of which 3 are preas-
  5374. signed to Shift, Lock, and Control.  Each modifier bit is
  5375. controlled by the state of a set of keys, and these sets are
  5376. specified in a table accessed by GetModifierMapping and Set-
  5377. ModifierMapping requests.  This table is a shared resource
  5378. and requires conventions.
  5379.  
  5380. A client that needs to use one of the preassigned modifiers
  5381. should assume that the modifier table has been set up cor-
  5382. rectly to control these modifiers.  The Lock modifier should
  5383. be interpreted as Caps Lock or Shift Lock according as the
  5384. keycodes in its controlling set include XK_Caps_Lock or
  5385. XK_Shift_Lock.
  5386.  
  5387.              Convention
  5388.  
  5389.      Clients should determine the meaning of a modifier
  5390.      bit from the KeySyms being used to control it.
  5391.  
  5392.  
  5393. A client that needs to use an extra modifier (for example,
  5394. META) should do the following:
  5395.  
  5396. o   Scan the existing modifier mappings.  If it finds a mod-
  5397.     ifier that contains a keycode whose set of KeySyms
  5398.     includes XK_Meta_L or XK_Meta_R, it should use that mod-
  5399.     ifier bit.
  5400.  
  5401. o   If there is no existing modifier controlled by
  5402.     XK_Meta_L or XK_Meta_R, it should select an unused modi-
  5403.     fier bit (one with an empty controlling set) and do the
  5404.     following:
  5405.  
  5406.  
  5407.  
  5408.  
  5409.  
  5410.                  76
  5411.  
  5412.  
  5413.  
  5414.  
  5415.  
  5416. Inter-Client Communication Conventions        X11, Release 6.4
  5417.  
  5418.  
  5419.     -     If there is a keycode with XL_Meta_L in its set of
  5420.      KeySyms, add that keycode to the set for the chosen
  5421.      modifier.
  5422.  
  5423.     -     If there is a keycode with XL_Meta_R in its set of
  5424.      KeySyms, add that keycode to the set for the chosen
  5425.      modifier.
  5426.  
  5427.     -     If the controlling set is still empty, interact
  5428.      with the user to select one or more keys to be
  5429.      META.
  5430.  
  5431. o   If there are no unused modifier bits, ask the user to
  5432.     take corrective action.
  5433.  
  5434.               Conventions
  5435.  
  5436.  
  5437.      1.   Clients needing a modifier not currently in
  5438.       use should assign keycodes carrying suitable
  5439.       KeySyms to an unused modifier bit.
  5440.  
  5441.      2.   Clients assigning their own modifier bits
  5442.       should ask the user politely to remove his or
  5443.       her hands from the key in question if their
  5444.       SetModifierMapping request returns a Busy
  5445.       status.
  5446.  
  5447.  
  5448. There is no good solution to the problem of reclaiming
  5449. assignments to the five nonpreassigned modifiers when they
  5450. are no longer being used.
  5451.  
  5452.              Convention
  5453.  
  5454.      The user must use xmodmap or some other utility to
  5455.      deassign obsolete modifier mappings by hand.
  5456.  
  5457.  
  5458. When a client succeeds in performing a SetModifierMapping
  5459. request, all clients will receive
  5460. MappingNotify(request==Modifier) events.  There is no mecha-
  5461. nism for preventing these events from being received.  A
  5462. client that uses one of the nonpreassigned modifiers that
  5463. receives one of these events should do a GetModifierMapping
  5464. request to discover the new mapping, and if the modifier it
  5465. is using has been cleared, it should reinstall the modifier.
  5466.  
  5467. Note that a GrabServer request must be used to make the Get-
  5468. ModifierMapping and SetModifierMapping pair in these trans-
  5469. actions atomic.
  5470.  
  5471.  
  5472.  
  5473.  
  5474.  
  5475.  
  5476.                  77
  5477.  
  5478.  
  5479.  
  5480.  
  5481.  
  5482. Inter-Client Communication Conventions        X11, Release 6.4
  5483.  
  5484.  
  5485. 7.  Device Color Characterization
  5486.  
  5487. The X protocol provides explicit Red, Green, and Blue (RGB)
  5488. values, which are used to directly drive a monitor, and
  5489. color names.  RGB values provide a mechanism for accessing
  5490. the full capabilities of the display device, but at the
  5491. expense of having the color perceived by the user remain
  5492. unknowable through the protocol.  Color names were origi-
  5493. nally designed to provide access to a device-independent
  5494. color database by having the server vendor tune the defini-
  5495. tions of the colors in that textual database.  Unfortu-
  5496. nately, this still does not provide the client any way of
  5497. using an existing device-independent color, nor for the
  5498. client to get device-independent color information back
  5499. about colors that it has selected.
  5500.  
  5501. Furthermore, the client must be able to discover which set
  5502. of colors are displayable by the device (the device gamut),
  5503. both to allow colors to be intelligently modified to fit
  5504. within the device capabilities (gamut compression) and to
  5505. enable the user interface to display a representation of the
  5506. reachable color space to the user (gamut display).
  5507.  
  5508. Therefore, a system is needed that will provide full access
  5509. to device-independent color spaces for X clients.  This sys-
  5510. tem should use a standard mechanism for naming the colors,
  5511. be able to provide names for existing colors, and provide
  5512. means by which unreachable colors can be modified to fall
  5513. within the device gamut.
  5514.  
  5515. We are fortunate in this area to have a seminal work, the
  5516. 1931 CIE color standard, which is nearly universally agreed
  5517. upon as adequate for describing colors on CRT devices.    This
  5518. standard uses a tri-stimulus model called CIE XYZ in which
  5519. each perceivable color is specified as a triplet of numbers.
  5520. Other appropriate device-independent color models do exist,
  5521. but most of them are directly traceable back to this origi-
  5522. nal work.
  5523.  
  5524. X device color characterization provides device-independent
  5525. color spaces to X clients.  It does this by providing the
  5526. barest possible amount of information to the client that
  5527. allows the client to construct a mapping between CIE XYZ and
  5528. the regular X RGB color descriptions.
  5529.  
  5530. Device color characterization is defined by the name and
  5531. contents of two window properties that, together, permit
  5532. converting between CIE XYZ space and linear RGB device space
  5533. (such as standard CRTs).  Linear RGB devices require just
  5534. two pieces of information to completely characterize them:
  5535.  
  5536. o    A 3x3 matrix M and its inverse M-1, which convert
  5537.      between XYZ and RGB intensity (RGBintensity):
  5538.  
  5539.  
  5540.  
  5541.  
  5542.                  78
  5543.  
  5544.  
  5545.  
  5546.  
  5547.  
  5548. Inter-Client Communication Conventions        X11, Release 6.4
  5549.  
  5550.  
  5551.                RGBintensity=MxXYZ
  5552.  
  5553.  
  5554.               XYZ=M-1xRGBintensity
  5555.  
  5556.  
  5557. o    A way of mapping between RGB intensity and RGB protocol
  5558.      value.  XDCCC supports three mechanisms which will be
  5559.      outlined later.
  5560.  
  5561. If other device types are eventually necessary, additional
  5562. properties will be required to describe them.
  5563.  
  5564. 7.1.  XYZ -> RGB Conversion Matrices
  5565.  
  5566. Because of the limited dynamic range of both XYZ and RGB
  5567. intensity, these matrices will be encoded using a fixed-
  5568. point representation of a 32-bit two's complement number
  5569. scaled by 227, giving a range of -16 to 16-, where =2-27.
  5570.  
  5571. These matrices will be packed into an 18-element list of
  5572. 32-bit values, XYZ -> RGB matrix first, in row major order
  5573. and stored in the XDCCC_LINEAR_RGB_MATRICES properties (for-
  5574. mat = 32) on the root window of each screen, using values
  5575. appropriate for that screen.
  5576.  
  5577. This will be encoded as shown in the following table:
  5578.  
  5579.      XDCCC_LINEAR_RGB_MATRICES property contents
  5580. ---------------------------------------------------------------
  5581. Field     Type               Comments
  5582. ---------------------------------------------------------------
  5583. M0,0     INT32     Interpreted as a fixed-point number -16<=x<16
  5584. M0,1     INT32
  5585. ...
  5586. M3,3     INT32
  5587. M-10,0     INT32
  5588. M-10,1     INT32
  5589. ...
  5590. M-13,3     INT32
  5591. ---------------------------------------------------------------
  5592.  
  5593.  
  5594. 7.2.  Intensity -> RGB Value Conversion
  5595.  
  5596. XDCCC provides two representations for describing the con-
  5597. version between RGB intensity and the actual X protocol RGB
  5598. values:
  5599.  
  5600.      0      RGB value/RGB intensity level pairs
  5601.      1      RGB intensity ramp
  5602.  
  5603.  
  5604.  
  5605.  
  5606.  
  5607.  
  5608.                  79
  5609.  
  5610.  
  5611.  
  5612.  
  5613.  
  5614. Inter-Client Communication Conventions        X11, Release 6.4
  5615.  
  5616.  
  5617. In both cases, the relevant data will be stored in the
  5618. XDCCC_LINEAR_RGB_CORRECTION properties on the root window of
  5619. each screen, using values appropriate for that screen, in
  5620. whatever format provides adequate resolution.  Each property
  5621. can consist of multiple entries concatenated together, if
  5622. different visuals for the screen require different conver-
  5623. sion data.  An entry with a VisualID of 0 specifies data for
  5624. all visuals of the screen that are not otherwise explicitly
  5625. listed.
  5626.  
  5627. The first representation is an array of RGB value/intensity
  5628. level pairs, with the RGB values in strictly increasing
  5629. order.    When converting, the client must linearly interpo-
  5630. late between adjacent entries in the table to compute the
  5631. desired value.    This allows the server to perform gamma cor-
  5632. rection itself and encode that fact in a short two-element
  5633. correction table.  The intensity will be encoded as an
  5634. unsigned number to be interpreted as a value between 0 and 1
  5635. (inclusive).  The precision of this value will depend on the
  5636. format of the property in which it is stored (8, 16, or 32
  5637. bits).    For 16-bit and 32-bit formats, the RGB value will
  5638. simply be the value stored in the property.  When stored in
  5639. 8-bit format, the RGB value can be computed from the value
  5640. in the property by:
  5641.  
  5642.         RGBvalue=___________________
  5643.  
  5644.  
  5645. Because the three electron guns in the device may not be
  5646. exactly alike in response characteristics, it is necessary
  5647. to allow for three separate tables, one each for red, green,
  5648. and blue.  Therefore, each table will be preceded by the
  5649. number of entries in that table, and the set of tables will
  5650. be preceded by the number of tables.  When three tables are
  5651. provided, they will be in red, green, blue order.
  5652.  
  5653. This will be encoded as shown in the following table:
  5654.  
  5655.  XDCCC_LINEAR_RGB_CORRECTION Property Contents for Type 0 Correction
  5656. ----------------------------------------------------------------------
  5657.   Field     Type            Comments
  5658. ----------------------------------------------------------------------
  5659. VisualID0   CARD   Most significant portion of VisualID
  5660. VisualID1   CARD   Exists if and only if the property format is 8
  5661. VisualID2   CARD   Exists if and only if the property format is 8
  5662. VisualID3   CARD   Least significant portion, exists if and only if
  5663.            the property format is 8 or 16
  5664. type        CARD   0 for this type of correction
  5665. count        CARD   Number of tables following (either 1 or 3)
  5666. length        CARD   Number of pairs - 1 following in this table
  5667. value        CARD   X Protocol RGB value
  5668. intensity   CARD   Interpret as a number 0<=intensity<=1
  5669. ...        ...    Total of length+1 pairs of value/intensity values
  5670.  
  5671.  
  5672.  
  5673.  
  5674.                  80
  5675.  
  5676.  
  5677.  
  5678.  
  5679.  
  5680. Inter-Client Communication Conventions        X11, Release 6.4
  5681.  
  5682.  
  5683. lengthg     CARD   Number of pairs - 1 following in this table (if
  5684.            and only if count is 3)
  5685. value        CARD   X Protocol RGB value
  5686. intensity   CARD   Interpret as a number 0<=intensity<=1
  5687. ...        ...    Total of lengthg+1 pairs of value/intensity values
  5688. lengthb     CARD   Number of pairs - 1 following in this table (if
  5689.            and only if count is 3)
  5690. value        CARD   X Protocol RGB value
  5691. intensity   CARD   Interpret as a number 0<=intensity<=1
  5692. ...        ...    Total of lengthb+1 pairs of value/intensity values
  5693. ----------------------------------------------------------------------
  5694.  
  5695.  
  5696. The VisualID is stored in 4, 2, or 1 pieces, depending on
  5697. whether the property format is 8, 16, or 32, respectively.
  5698. The VisualID is always stored most significant piece first.
  5699. Note that the length fields are stored as one less than the
  5700. actual length, so 256 entries can be stored in format 8.
  5701.  
  5702. The second representation is a simple array of intensities
  5703. for a linear subset of RGB values.  The expected size of
  5704. this table is the bits-per-rgb-value of the screen, but it
  5705. can be any length.  This is similar to the first mechanism,
  5706. except that the RGB value numbers are implicitly defined by
  5707. the index in the array (indices start at 0):
  5708.  
  5709.           RGBvalue=________________
  5710.  
  5711. When converting, the client may linearly interpolate between
  5712. entries in this table.    The intensity values will be encoded
  5713. just as in the first representation.
  5714.  
  5715. This will be encoded as shown in the following table:
  5716.  
  5717. XDCCC_LINEAR_RGB_CORRECTION Property Contents for Type 1 Correction
  5718. --------------------------------------------------------------------
  5719.   Field      Type               Comments
  5720. --------------------------------------------------------------------
  5721. VisualID0    CARD   Most significant portion of VisualID
  5722. VisualID1    CARD   Exists if and only if the property format is 8
  5723. VisualID2    CARD   Exists if and only if the property format is 8
  5724. VisualID3    CARD   Least significant portion, exists if and only
  5725.             if the property format is 8 or 16
  5726. type         CARD   1 for this type of correction
  5727. count         CARD   Number of tables following (either 1 or 3)
  5728. length         CARD   Number of elements - 1 following in this table
  5729. intensity    CARD   Interpret as a number 0<=intensity<=1
  5730. ...         ...    Total of length+1 intensity elements
  5731. lengthg      CARD   Number of elements - 1 following in this table
  5732.             (if and only if count is 3)
  5733. intensity    CARD   Interpret as a number 0<=intensity<=1
  5734. ...         ...    Total of lengthg+1 intensity elements
  5735.  
  5736.  
  5737.  
  5738.  
  5739.  
  5740.                  81
  5741.  
  5742.  
  5743.  
  5744.  
  5745.  
  5746. Inter-Client Communication Conventions        X11, Release 6.4
  5747.  
  5748.  
  5749. lengthb      CARD   Number of elements - 1 following in this table
  5750.             (if and only if count is 3)
  5751. intensity    CARD   Interpret as a number 0<=intensity<=1
  5752. ...         ...    Total of lengthb+1 intensity elements
  5753. --------------------------------------------------------------------
  5754.  
  5755.  
  5756. 8.  Conclusion
  5757.  
  5758. This document provides the protocol-level specification of
  5759. the minimal conventions needed to ensure that X Version 11
  5760. clients can interoperate properly.  This document specifies
  5761. interoperability conventions only for the X Version 11 pro-
  5762. tocol.    Clients should be aware of other protocols that
  5763. should be used for better interoperation in the X environ-
  5764. ment.  The reader is referred to X Session Management Proto-
  5765. col for information on session management, and to Inter-
  5766. Client Exchange Protocol for information on general-purpose
  5767. communication among clients.
  5768.  
  5769. 8.1.  The X Registry
  5770.  
  5771. The X Consortium maintains a registry of certain X-related
  5772. items, to aid in avoiding conflicts and in sharing of such
  5773. items.    Readers are encouraged to use the registry.  The
  5774. classes of items kept in the registry that are relevant to
  5775. the ICCCM include property names, property types, selection
  5776. names, selection targets, WM_PROTOCOLS protocols, Client-
  5777. Message types, and application classes.  Requests to regis-
  5778. ter items, or questions about registration, should be
  5779. addressed to
  5780.  
  5781.       xregistry@x.org
  5782.  
  5783. or to
  5784.  
  5785.       Registry
  5786.       X Consortium
  5787.       201 Broadway
  5788.       Cambridge, MA 02139-1955
  5789.       USA
  5790.  
  5791. Electronic mail will be acknowledged upon receipt.  Please
  5792. allow up to 4 weeks for a formal response to registration
  5793. and inquiries.
  5794.  
  5795. The registry is published as part of the X software distri-
  5796. bution from the X Consortium.  All registered items must
  5797. have the postal address of someone responsible for the item
  5798. or a reference to a document describing the item and the
  5799. postal address of where to write to obtain the document.
  5800.  
  5801.  
  5802.  
  5803.  
  5804.  
  5805.  
  5806.                  82
  5807.  
  5808.  
  5809.  
  5810.  
  5811.  
  5812. Inter-Client Communication Conventions        X11, Release 6.4
  5813.  
  5814.  
  5815.  
  5816.  
  5817.              Appendix A
  5818.  
  5819.  
  5820. A.  Revision History
  5821.  
  5822. This appendix describes the revision history of this docu-
  5823. ment and summarizes the incompatibilities between this and
  5824. earlier versions.
  5825.  
  5826. A.1.  The X11R2 Draft
  5827.  
  5828. The February 25, 1988, draft that was distributed as part of
  5829. X Version 11, Release 2, was clearly labeled as such, and
  5830. many areas were explicitly labeled as liable to change.
  5831. Nevertheless, in the revision work done since then, we have
  5832. been very careful not to introduce gratuitous incompatibil-
  5833. ity.  As far as possible, we have tried to ensure that
  5834. clients obeying the conventions in the X11R2 draft would
  5835. still work.
  5836.  
  5837. A.2.  The July 27, 1988, Draft
  5838.  
  5839. The Consortium review was based on a draft dated July 27,
  5840. 1988.  This draft included several areas in which incompati-
  5841. bilities with the X11R2 draft were necessary:
  5842.  
  5843. o   The use of property None in ConvertSelection requests is
  5844.     no longer allowed.    Owners that receive them are free to
  5845.     use the target atom as the property to respond with,
  5846.     which will work in most cases.
  5847.  
  5848. o   The protocol for INCREMENTAL type properties as selec-
  5849.     tion replies has changed, and the name has been changed
  5850.     to INCR.  Selection requestors are free to implement the
  5851.     earlier protocol if they receive properties of type
  5852.     INCREMENTAL.
  5853.  
  5854. o   The protocol for INDIRECT type properties as selection
  5855.     replies has changed, and the name has been changed to
  5856.     MULTIPLE.  Selection requestors are free to implement
  5857.     the earlier protocol if they receive properties of type
  5858.     INDIRECT.
  5859.  
  5860. o   The protocol for the special CLIPBOARD client has
  5861.     changed.  The earlier protocol is subject to race condi-
  5862.     tions and should not be used.
  5863.  
  5864. o   The set of state values in WM_HINTS.initial_state has
  5865.     been reduced, but the values that are still valid are
  5866.     unchanged.    Window managers should treat the other val-
  5867.     ues sensibly.
  5868.  
  5869.  
  5870.  
  5871.  
  5872.                  83
  5873.  
  5874.  
  5875.  
  5876.  
  5877.  
  5878. Inter-Client Communication Conventions        X11, Release 6.4
  5879.  
  5880.  
  5881. o   The methods an application uses to change the state of
  5882.     its top-level window have changed but in such a way that
  5883.     cases that used to work will still work.
  5884.  
  5885. o   The x, y, width, and height fields have been removed
  5886.     from the WM_NORMAL_HINTS property and replaced by pad
  5887.     fields.  Values set into these fields will be ignored.
  5888.     The position and size of the window should be set by
  5889.     setting the appropriate window attributes.
  5890.  
  5891. o   A pair of base fields and a win_gravity field have been
  5892.     added to the WM_NORMAL_HINTS property.  Window managers
  5893.     will assume values for these fields if the client sets a
  5894.     short property.
  5895.  
  5896. A.3.  The Public Review Drafts
  5897.  
  5898. The Consortium review resulted in several incompatible
  5899. changes.  These changes were included in drafts that were
  5900. distributed for public review during the first half of 1989.
  5901.  
  5902. o   The messages field of the WM_HINTS property was found to
  5903.     be unwieldy and difficult to evolve.  It has been
  5904.     replaced by the WM_PROTOCOLS property, but clients that
  5905.     use the earlier mechanism can be detected because they
  5906.     set the messages bit in the flags field of the WM_HINTS
  5907.     property, and window managers can provide a backwards
  5908.     compatibility mode.
  5909.  
  5910. o   The mechanism described in the earlier draft by which
  5911.     clients installed their own subwindow colormaps could
  5912.     not be made to work reliably and mandated some features
  5913.     of the look and feel.  It has been replaced by the
  5914.     WM_COLORMAP_WINDOWS property.  Clients that use the ear-
  5915.     lier mechanism can be detected by the WM_COLORMAPS prop-
  5916.     erty they set on their top-level window, but providing a
  5917.     reliable backwards compatibility mode is not possible.
  5918.  
  5919. o   The recommendations for window manager treatment of top-
  5920.     level window borders have been changed as those in the
  5921.     earlier draft produced problems with Visibility events.
  5922.     For nonwindow manager clients, there is no incompatibil-
  5923.     ity.
  5924.  
  5925. o   The pseudoroot facility in the earlier draft has been
  5926.     removed.  Although it has been successfully implemented,
  5927.     it turns out to be inadequate to support the uses envis-
  5928.     aged.  An extension will be required to support these
  5929.     uses fully, and it was felt that the maximum freedom
  5930.     should be left to the designers of the extension.  In
  5931.     general, the previous mechanism was invisible to clients
  5932.     and no incompatibility should result.
  5933.  
  5934.  
  5935.  
  5936.  
  5937.  
  5938.                  84
  5939.  
  5940.  
  5941.  
  5942.  
  5943.  
  5944. Inter-Client Communication Conventions        X11, Release 6.4
  5945.  
  5946.  
  5947. o   The addition of the WM_DELETE_WINDOW protocol (which
  5948.     prevents the danger that multi-window clients may be
  5949.     terminated unexpectedly) has meant some changes in the
  5950.     WM_SAVE_YOURSELF protocol, to ensure that the two proto-
  5951.     cols are orthogonal.  Clients using the earlier protocol
  5952.     can be detected (see WM_PROTOCOLS above) and supported
  5953.     in a backwards compatibility mode.
  5954.  
  5955. o   The conventions in Section 14.3.1. of Xlib - C Language
  5956.     X Interface regarding properties of type RGB_COLOR_MAP
  5957.     have been changed, but clients that use the earlier con-
  5958.     ventions can be detected because their properties are 4
  5959.     bytes shorter.  These clients will work correctly if the
  5960.     server supports only a single Visual or if they use only
  5961.     the Visual of the root.  These are the only cases in
  5962.     which they would have worked, anyway.
  5963.  
  5964. A.4.  Version 1.0, July 1989
  5965.  
  5966. The public review resulted in a set of mostly editorial
  5967. changes.  The changes in version 1.0 that introduced some
  5968. degree of incompatibility with the earlier drafts are:
  5969.  
  5970. o   A new section (6.3) was added covering the window man-
  5971.     ager's use of Grabs.  The restrictions it imposes should
  5972.     affect only window managers.
  5973.  
  5974. o   The TARGETS selection target has been clarified, and it
  5975.     may be necessary for clients to add some entries to
  5976.     their replies.
  5977.  
  5978. o   A selection owner using INCR transfer should no longer
  5979.     replace targets in a MULTIPLE property with the atom
  5980.     INCR.
  5981.  
  5982. o   The contents of the ClientMessage event sent by a client
  5983.     to iconify itself has been clarified, but there should
  5984.     be no incompatibility because the earlier contents would
  5985.     not in fact have worked.
  5986.  
  5987. o   The border-width in synthetic ConfigureNotify events is
  5988.     now specified, but this should not cause any incompati-
  5989.     bility.
  5990.  
  5991. o   Clients are now asked to set a border-width on all Con-
  5992.     figureWindow requests.
  5993.  
  5994. o   Window manager properties on icon windows now will be
  5995.     ignored, but there should be no incompatibility because
  5996.     there was no specification that they be obeyed previ-
  5997.     ously.
  5998.  
  5999. o   The ordering of real and synthetic ConfigureNotify
  6000.     events is now specified, but any incompatibility should
  6001.  
  6002.  
  6003.  
  6004.                  85
  6005.  
  6006.  
  6007.  
  6008.  
  6009.  
  6010. Inter-Client Communication Conventions        X11, Release 6.4
  6011.  
  6012.  
  6013.     affect only window managers.
  6014.  
  6015. o   The semantics of WM_SAVE_YOURSELF have been clarified
  6016.     and restricted to be a checkpoint operation only.
  6017.     Clients that were using it as part of a shutdown
  6018.     sequence may need to be modified, especially if they
  6019.     were interacting with the user during the shutdown.
  6020.  
  6021. o   A kill_id field has been added to RGB_COLOR_MAP proper-
  6022.     ties.  Clients using earlier conventions can be detected
  6023.     by the size of their RGB_COLOR_MAP properties, and the
  6024.     cases that would have worked will still work.
  6025.  
  6026. A.5.  Version 1.1
  6027.  
  6028. Version 1.1 was released with X11R5 in September 1991.    In
  6029. addition to some minor editorial changes, there were a few
  6030. semantic changes since Version 1.0:
  6031.  
  6032. o   The section on Device Color Characterization was added.
  6033.  
  6034. o   The meaning of the NULL property type was clarified.
  6035.  
  6036. o   Appropriate references to Compound Text were added.
  6037.  
  6038. A.6.  Public Review Draft, December 1993
  6039.  
  6040. The following changes have been made in preparing the public
  6041. review draft for Version 2.0.
  6042.  
  6043. o   [P01] Addition of advice to clients on how to keep track
  6044.     of a top-level window's absolute position on the screen.
  6045.  
  6046. o   [P03] A technique for clients to detect when it is safe
  6047.     to reuse a top-level window has been added.
  6048.  
  6049. o   [P06] Section 4.1.8, on colormaps, has been rewritten.
  6050.     A new feature that allows clients to install their own
  6051.     colormaps has also been added.
  6052.  
  6053. o   [P08] The LENGTH target has been deprecated.
  6054.  
  6055. o   [P11] The manager selections facility was added.
  6056.  
  6057. o   [P17] The definition of the aspect ratio fields of the
  6058.     WM_NORMAL_HINTS property has been changed to include the
  6059.     base size.
  6060.  
  6061. o   [P19] StaticGravity has been added to the list of values
  6062.     allowed for the win_gravity field of the WM_HINTS prop-
  6063.     erty.  The meaning of the CenterGravity value has been
  6064.     clarified.
  6065.  
  6066.  
  6067.  
  6068.  
  6069.  
  6070.                  86
  6071.  
  6072.  
  6073.  
  6074.  
  6075.  
  6076. Inter-Client Communication Conventions        X11, Release 6.4
  6077.  
  6078.  
  6079. o   [P20] A means for clients to query the ICCCM compliance
  6080.     level of the window manager has been added.
  6081.  
  6082. o   [P22] The definition of the MULTIPLE selection target
  6083.     has been clarified.
  6084.  
  6085. o   [P25] A definition of "top-level window" has been added.
  6086.     The WM_STATE property has been defined and exposed to
  6087.     clients.
  6088.  
  6089. o   [P26] The definition of window states has been clarified
  6090.     and the wording regarding window state changes has been
  6091.     made more consistent.
  6092.  
  6093. o   [P27] Clarified the rules governing when window managers
  6094.     are required to send synthetic ConfigureNotify events.
  6095.  
  6096. o   [P28] Added a recommended technique for setting the
  6097.     input focus to a window as soon as it is mapped.
  6098.  
  6099. o   [P29] The required lifetime of resource IDs named in
  6100.     window manager properties has been specified.
  6101.  
  6102. o   [P30] Advice for dealing with keystrokes and override-
  6103.     redirect windows has been added.
  6104.  
  6105. o   [P31] A statement on the ownership of resources trans-
  6106.     ferred through the selection mechanism has been added.
  6107.  
  6108. o   [P32] The definition of the CLIENT_WINDOW target has
  6109.     been clarified.
  6110.  
  6111. o   [P33] A rule about requiring the selection owner to
  6112.     reacquire the selection under certain circumstances has
  6113.     been added.
  6114.  
  6115. o   [P42] Added several new selection targets.
  6116.  
  6117. o   [P44] Ambiguous wording regarding the withdrawal of top-
  6118.     level windows has been removed.
  6119.  
  6120. o   [P45] A facility for requestors to pass parameters dur-
  6121.     ing a selection request has been added.
  6122.  
  6123. o   [P49] A convention on discrimated names has been added.
  6124.  
  6125. o   [P57] The C_STRING property type was added.
  6126.  
  6127. o   [P62] An ordering requirement on processing selection
  6128.     requests was added.
  6129.  
  6130. o   [P63] The VisibleHint flag was added.
  6131.  
  6132.  
  6133.  
  6134.  
  6135.  
  6136.                  87
  6137.  
  6138.  
  6139.  
  6140.  
  6141.  
  6142. Inter-Client Communication Conventions        X11, Release 6.4
  6143.  
  6144.  
  6145. o   [P64] The session management section has been updated to
  6146.     align with the new session management protocol.  The old
  6147.     session management conventions have been moved to
  6148.     Appendix C.
  6149.  
  6150. o   References to the never-forthcoming Window and Session
  6151.     Manager Conventions Manual have been removed.
  6152.  
  6153. o   Information on the X Registry and references to the ses-
  6154.     sion management and ICE documents have been added.
  6155.  
  6156. o   Numerous editorial and typographical improvements have
  6157.     been made.
  6158.  
  6159. A.7.  Version 2.0, April 1994
  6160.  
  6161. The following changes have been made in preparation for
  6162. releasing the final edition of Version 2.0 with X11R6.
  6163.  
  6164. o   The PIXMAP selection target has been revised to return a
  6165.     property of type PIXMAP instead of type DRAWABLE.
  6166.  
  6167. o   The session management section has been revised slightly
  6168.     to correspond with the changes to the X Session Manage-
  6169.     ment Protocol.
  6170.  
  6171. o   Window managers are now prohibited from placing Current-
  6172.     Time in the timestamp field of WM_TAKE_FOCUS messages.
  6173.  
  6174. o   In the WM_HINTS property, the VisibleHint flag has been
  6175.     renamed to UrgencyHint.  Its semantics have also been
  6176.     defined more thoroughly.
  6177.  
  6178. o   Additional editorial and typographical changes have been
  6179.     made.
  6180.  
  6181.  
  6182.  
  6183.  
  6184.  
  6185.  
  6186.  
  6187.  
  6188.  
  6189.  
  6190.  
  6191.  
  6192.  
  6193.  
  6194.  
  6195.  
  6196.  
  6197.  
  6198.  
  6199.  
  6200.  
  6201.  
  6202.                  88
  6203.  
  6204.  
  6205.  
  6206.  
  6207.  
  6208. Inter-Client Communication Conventions        X11, Release 6.4
  6209.  
  6210.  
  6211.  
  6212.  
  6213.                Appendix B
  6214.  
  6215.  
  6216. B.  Suggested Protocol Revisions
  6217.  
  6218. During the development of these conventions, a number of
  6219. inadequacies have been discovered in the core X11 protocol.
  6220. They are summarized here as input to an eventual protocol
  6221. revision design process:
  6222.  
  6223. o   There is no way for anyone to find out the last-change
  6224.     time of a selection.  The GetSelectionOwner request
  6225.     should be changed to return the last-change time as well
  6226.     as the owner.
  6227.  
  6228. o   There is no way for a client to find out which selection
  6229.     atoms are valid.
  6230.  
  6231. o   There would be no need for WM_TAKE_FOCUS if the FocusIn
  6232.     event contained a timestamp and a previous-focus field.
  6233.     This could avoid the potential race condition.  There is
  6234.     space in the event for this information; it should be
  6235.     added at the next protocol revision.
  6236.  
  6237. o   There is a race condition in the InstallColormap
  6238.     request.  It does not take a timestamp and may be exe-
  6239.     cuted after the top-level colormap has been uninstalled.
  6240.     The next protocol revision should provide the timestamp
  6241.     in the InstallColormap, UninstallColormap, List-
  6242.     InstalledColormaps requests and in the ColormapNotify
  6243.     event.  The timestamp should be used in a similar way to
  6244.     the last-focus-change time for the input focus.  The
  6245.     lack of timestamps in these packets is the reason for
  6246.     restricting colormap installation to the window manager.
  6247.  
  6248. o   The protocol needs to be changed to provide some way of
  6249.     identifying the Visual and the Screen of a colormap.
  6250.  
  6251. o   There should be some way to reclaim assignments to the
  6252.     five nonpreassigned modifiers when they are no longer
  6253.     needed.  The manual method is unpleasantly low-tech.
  6254.  
  6255.  
  6256.  
  6257.  
  6258.  
  6259.  
  6260.  
  6261.  
  6262.  
  6263.  
  6264.  
  6265.  
  6266.  
  6267.  
  6268.                  89
  6269.  
  6270.  
  6271.  
  6272.  
  6273.  
  6274. Inter-Client Communication Conventions        X11, Release 6.4
  6275.  
  6276.  
  6277.  
  6278.  
  6279.                Appendix C
  6280.  
  6281.  
  6282. C.  Obsolete Session Manager Conventions
  6283.  
  6284. This appendix contains obsolete conventions for session man-
  6285. agement using X properties and messages.  The conventions
  6286. described here are deprecated and are described only for
  6287. historical interest.  For further information on session
  6288. management, see X Session Management Protocol.
  6289.  
  6290. C.1.  Properties
  6291.  
  6292. The client communicates with the session manager by placing
  6293. two properties (WM_COMMAND and WM_CLIENT_MACHINE) on its
  6294. top-level window.  If the client has a group of top-level
  6295. windows, these properties should be placed on the group
  6296. leader window.
  6297.  
  6298. The window manager is responsible for placing a WM_STATE
  6299. property on each top-level client window for use by session
  6300. managers and other clients that need to be able to identify
  6301. top-level client windows and their state.
  6302.  
  6303. C.1.1.    WM_COMMAND Property
  6304.  
  6305. The WM_COMMAND property represents the command used to start
  6306. or restart the client.    By updating this property, clients
  6307. should ensure that it always reflects a command that will
  6308. restart them in their current state.  The content and type
  6309. of the property depend on the operating system of the
  6310. machine running the client.  On POSIX-conformant systems
  6311. using ISO Latin-1 characters for their command lines, the
  6312. property should:
  6313.  
  6314. o   Be of type STRING
  6315.  
  6316. o   Contain a list of null-terminated strings
  6317.  
  6318. o   Be initialized from argv
  6319.  
  6320.     Other systems will need to set appropriate conventions
  6321.     for the type and contents of WM_COMMAND properties.
  6322.     Window and session managers should not assume that
  6323.     STRING is the type of WM_COMMAND or that they will be
  6324.     able to understand or display its contents.
  6325.  
  6326. Note that WM_COMMAND strings are null-terminated and differ
  6327. from the general conventions that STRING properties are
  6328. null-separated.  This inconsistency is necessary for back-
  6329. wards compatibility.
  6330.  
  6331.  
  6332.  
  6333.  
  6334.                  90
  6335.  
  6336.  
  6337.  
  6338.  
  6339.  
  6340. Inter-Client Communication Conventions        X11, Release 6.4
  6341.  
  6342.  
  6343. A client with multiple top-level windows should ensure that
  6344. exactly one of them has a WM_COMMAND with nonzero length.
  6345. Zero-length WM_COMMAND properties can be used to reply to
  6346. WM_SAVE_YOURSELF messages on other top-level windows but
  6347. will otherwise be ignored.
  6348.  
  6349. C.1.2.    WM_CLIENT_MACHINE Property
  6350.  
  6351. This property is described in section 4.1.2.9.
  6352.  
  6353. C.2.  Termination
  6354.  
  6355. Because they communicate by means of unreliable network con-
  6356. nections, clients must be prepared for their connection to
  6357. the server to be terminated at any time without warning.
  6358. They cannot depend on getting notification that termination
  6359. is imminent or on being able to use the server to negotiate
  6360. with the user about their fate.  For example, clients cannot
  6361. depend on being able to put up a dialog box.
  6362.  
  6363. Similarly, clients may terminate at any time without notice
  6364. to the session manager.  When a client terminates itself
  6365. rather than being terminated by the session manager, it is
  6366. viewed as having resigned from the session in question, and
  6367. it will not be revived if the session is revived.
  6368.  
  6369. C.3.  Client Responses to Session Manager Actions
  6370.  
  6371. Clients may need to respond to session manager actions in
  6372. two ways:
  6373.  
  6374. o   Saving their internal state
  6375.  
  6376. o   Deleting a window
  6377.  
  6378. C.3.1.    Saving Client State
  6379.  
  6380. Clients that want to be warned when the session manager
  6381. feels that they should save their internal state (for exam-
  6382. ple, when termination impends) should include the atom
  6383. WM_SAVE_YOURSELF in the WM_PROTOCOLS property on their top-
  6384. level windows to participate in the WM_SAVE_YOURSELF proto-
  6385. col.  They will receive a ClientMessage event as described
  6386. in section 4.2.8 with the atom WM_SAVE_YOURSELF in its
  6387. data[0] field.
  6388.  
  6389. Clients that receive WM_SAVE_YOURSELF should place them-
  6390. selves in a state from which they can be restarted and
  6391. should update WM_COMMAND to be a command that will restart
  6392. them in this state.  The session manager will be waiting for
  6393. a PropertyNotify event on WM_COMMAND as a confirmation that
  6394. the client has saved its state.  Therefore, WM_COMMAND
  6395. should be updated (perhaps with a zero-length append) even
  6396. if its contents are correct.  No interactions with the user
  6397.  
  6398.  
  6399.  
  6400.                  91
  6401.  
  6402.  
  6403.  
  6404.  
  6405.  
  6406. Inter-Client Communication Conventions        X11, Release 6.4
  6407.  
  6408.  
  6409. are permitted during this process.
  6410.  
  6411. Once it has received this confirmation, the session manager
  6412. will feel free to terminate the client if that is what the
  6413. user asked for.  Otherwise, if the user asked for the ses-
  6414. sion to be put to sleep, the session manager will ensure
  6415. that the client does not receive any mouse or keyboard
  6416. events.
  6417.  
  6418. After receiving a WM_SAVE_YOURSELF, saving its state, and
  6419. updating WM_COMMAND, the client should not change its state
  6420. (in the sense of doing anything that would require a change
  6421. to WM_COMMAND) until it receives a mouse or keyboard event.
  6422. Once it does so, it can assume that the danger is over.  The
  6423. session manager will ensure that these events do not reach
  6424. clients until the danger is over or until the clients have
  6425. been killed.
  6426.  
  6427. Irrespective of how they are arranged in window groups,
  6428. clients with multiple top-level windows should ensure the
  6429. following:
  6430.  
  6431. o   Only one of their top-level windows has a nonzero-length
  6432.     WM_COMMAND property.
  6433.  
  6434. o   They respond to a WM_SAVE_YOURSELF message by:
  6435.  
  6436.     -     First, updating the nonzero-length WM_COMMAND prop-
  6437.      erty, if necessary
  6438.  
  6439.     -     Second, updating the WM_COMMAND property on the
  6440.      window for which they received the WM_SAVE_YOURSELF
  6441.      message if it was not updated in the first step
  6442.  
  6443. Receiving WM_SAVE_YOURSELF on a window is, conceptually, a
  6444. command to save the entire client state.16
  6445.  
  6446. C.3.2.    Window Deletion
  6447.  
  6448. Windows are deleted using the WM_DELETE_WINDOW protocol,
  6449. which is described in section 4.2.8.1.
  6450.  
  6451.  
  6452.  
  6453. -----------
  6454.   16 This convention has changed since earlier
  6455. drafts because of the introduction of the protocol
  6456. in the next section.  In the public review draft,
  6457. there was ambiguity as to whether WM_SAVE_YOURSELF
  6458. was a checkpoint or a shutdown facility.  It is
  6459. now unambiguously a checkpoint facility; if a
  6460. shutdown facility is judged to be necessary, a
  6461. separate WM_PROTOCOLS protocol will be developed
  6462. and registered with the X Consortium.
  6463.  
  6464.  
  6465.  
  6466.                  92
  6467.  
  6468.  
  6469.  
  6470.  
  6471.  
  6472. Inter-Client Communication Conventions        X11, Release 6.4
  6473.  
  6474.  
  6475. C.4.  Summary of Session Manager Property Types
  6476.  
  6477. The session manager properties are listed in the following
  6478. table:
  6479.  
  6480. ----------------------------------------------------
  6481. Name            Type       Format    See Section
  6482. ----------------------------------------------------
  6483. WM_CLIENT_MACHINE   TEXT          4.1.2.9
  6484. WM_COMMAND        TEXT           C.1.1
  6485. WM_STATE        WM_STATE     32      4.1.3.1
  6486. ----------------------------------------------------
  6487.  
  6488.  
  6489.  
  6490.  
  6491.  
  6492.  
  6493.  
  6494.  
  6495.  
  6496.  
  6497.  
  6498.  
  6499.  
  6500.  
  6501.  
  6502.  
  6503.  
  6504.  
  6505.  
  6506.  
  6507.  
  6508.  
  6509.  
  6510.  
  6511.  
  6512.  
  6513.  
  6514.  
  6515.  
  6516.  
  6517.  
  6518.  
  6519.  
  6520.  
  6521.  
  6522.  
  6523.  
  6524.  
  6525.  
  6526.  
  6527.  
  6528.  
  6529.  
  6530.  
  6531.  
  6532.                  93
  6533.  
  6534.  
  6535.  
  6536.  
  6537.  
  6538. Inter-Client Communication Conventions        X11, Release 6.4
  6539.  
  6540.  
  6541.  
  6542.  
  6543.  
  6544.  
  6545.  
  6546.  
  6547.  
  6548.  
  6549.  
  6550.  
  6551.  
  6552.  
  6553.  
  6554.  
  6555.  
  6556.  
  6557.  
  6558.  
  6559.  
  6560.  
  6561.  
  6562.  
  6563.  
  6564.  
  6565.  
  6566.  
  6567.  
  6568.  
  6569.  
  6570.  
  6571.  
  6572.  
  6573.  
  6574.  
  6575.  
  6576.  
  6577.  
  6578.  
  6579.  
  6580.  
  6581.  
  6582.  
  6583.  
  6584.  
  6585.  
  6586.  
  6587.  
  6588.  
  6589.  
  6590.  
  6591.  
  6592.  
  6593.  
  6594.  
  6595.  
  6596.  
  6597.  
  6598.                  94
  6599.  
  6600.  
  6601.  
  6602.  
  6603.  
  6604. Inter-Client Communication Conventions        X11, Release 6.4
  6605.  
  6606.  
  6607.              Table of Contents
  6608.  
  6609.  
  6610. Preface to Version 2.0 . . . . . . . . . . . . . . . . . vii
  6611. Preface to Version 1.1 . . . . . . . . . . . . . . . . .viii
  6612. 1. Introduction  . . . . . . . . . . . . . . . . . . . .   1
  6613. 1.1. Evolution of the Conventions  . . . . . . . . . . .   1
  6614. 1.2. Atoms . . . . . . . . . . . . . . . . . . . . . . .   2
  6615. 1.2.1. What Are Atoms?     . . . . . . . . . . . . . . . .   2
  6616. 1.2.2. Predefined Atoms  . . . . . . . . . . . . . . . .   2
  6617. 1.2.3. Naming Conventions  . . . . . . . . . . . . . . .   3
  6618. 1.2.4. Semantics . . . . . . . . . . . . . . . . . . . .   3
  6619. 1.2.5. Name Spaces . . . . . . . . . . . . . . . . . . .   3
  6620. 1.2.6. Discriminated Names . . . . . . . . . . . . . . .   4
  6621. 2. Peer-to-Peer Communication by Means of Selections
  6622.  . . . . . . . . . . . . . . . . . . . . . . . . . . . .   5
  6623. 2.1. Acquiring Selection Ownership . . . . . . . . . . .   6
  6624. 2.2. Responsibilities of the Selection Owner . . . . . .   8
  6625. 2.3. Giving Up Selection Ownership . . . . . . . . . . .  11
  6626. 2.3.1. Voluntarily Giving Up Selection Ownership . . . .  11
  6627. 2.3.2. Forcibly Giving Up Selection Ownership  . . . . .  11
  6628. 2.4. Requesting a Selection  . . . . . . . . . . . . . .  12
  6629. 2.5. Large Data Transfers  . . . . . . . . . . . . . . .  15
  6630. 2.6. Use of Selection Atoms  . . . . . . . . . . . . . .  16
  6631. 2.6.1. Selection Atoms . . . . . . . . . . . . . . . . .  16
  6632. 2.6.1.1. The PRIMARY Selection . . . . . . . . . . . . .  16
  6633. 2.6.1.2. The SECONDARY Selection . . . . . . . . . . . .  16
  6634. 2.6.1.3. The CLIPBOARD Selection . . . . . . . . . . . .  17
  6635. 2.6.2. Target Atoms  . . . . . . . . . . . . . . . . . .  18
  6636. 2.6.3. Selection Targets with Side Effects . . . . . . .  21
  6637. 2.6.3.1. DELETE  . . . . . . . . . . . . . . . . . . . .  22
  6638. 2.6.3.2. INSERT_SELECTION  . . . . . . . . . . . . . . .  22
  6639. 2.6.3.3. INSERT_PROPERTY . . . . . . . . . . . . . . . .  23
  6640. 2.7. Use of Selection Properties . . . . . . . . . . . .  23
  6641. 2.7.1. TEXT Properties . . . . . . . . . . . . . . . . .  24
  6642. 2.7.2. INCR Properties . . . . . . . . . . . . . . . . .  25
  6643. 2.7.3. DRAWABLE Properties . . . . . . . . . . . . . . .  26
  6644. 2.7.4. SPAN Properties . . . . . . . . . . . . . . . . .  27
  6645. 2.8. Manager Selections  . . . . . . . . . . . . . . . .  27
  6646. 3. Peer-to-Peer Communication by Means of Cut
  6647. Buffers  . . . . . . . . . . . . . . . . . . . . . . . .  29
  6648. 4. Client-to-Window-Manager Communication  . . . . . . .  30
  6649. 4.1. Client's Actions  . . . . . . . . . . . . . . . . .  31
  6650. 4.1.1. Creating a Top-Level Window . . . . . . . . . . .  31
  6651. 4.1.2. Client Properties . . . . . . . . . . . . . . . .  32
  6652. 4.1.2.1. WM_NAME Property  . . . . . . . . . . . . . . .  33
  6653. 4.1.2.2. WM_ICON_NAME Property . . . . . . . . . . . . .  33
  6654. 4.1.2.3. WM_NORMAL_HINTS Property  . . . . . . . . . . .  34
  6655. 4.1.2.4. WM_HINTS Property . . . . . . . . . . . . . . .  36
  6656. 4.1.2.5. WM_CLASS Property . . . . . . . . . . . . . . .  39
  6657. 4.1.2.6. WM_TRANSIENT_FOR Property . . . . . . . . . . .  40
  6658. 4.1.2.7. WM_PROTOCOLS Property . . . . . . . . . . . . .  41
  6659. 4.1.2.8. WM_COLORMAP_WINDOWS Property  . . . . . . . . .  41
  6660. 4.1.2.9. WM_CLIENT_MACHINE Property  . . . . . . . . . .  41
  6661.  
  6662.  
  6663.  
  6664.                  iii
  6665.  
  6666.  
  6667.  
  6668.  
  6669.  
  6670. Inter-Client Communication Conventions        X11, Release 6.4
  6671.  
  6672.  
  6673. 4.1.3. Window Manager Properties . . . . . . . . . . . .  42
  6674. 4.1.3.1. WM_STATE Property . . . . . . . . . . . . . . .  42
  6675. 4.1.3.2. WM_ICON_SIZE Property . . . . . . . . . . . . .  43
  6676. 4.1.4. Changing Window State . . . . . . . . . . . . . .  43
  6677. 4.1.5. Configuring the Window  . . . . . . . . . . . . .  47
  6678. 4.1.6. Changing Window Attributes  . . . . . . . . . . .  50
  6679. 4.1.7. Input Focus . . . . . . . . . . . . . . . . . . .  51
  6680. 4.1.8. Colormaps . . . . . . . . . . . . . . . . . . . .  54
  6681. 4.1.9. Icons . . . . . . . . . . . . . . . . . . . . . .  57
  6682. 4.1.10. Pop-up Windows . . . . . . . . . . . . . . . . .  59
  6683. 4.1.11. Window Groups  . . . . . . . . . . . . . . . . .  60
  6684. 4.2. Client Responses to Window Manager Actions  . . . .  60
  6685. 4.2.1. Reparenting . . . . . . . . . . . . . . . . . . .  60
  6686. 4.2.2. Redirection of Operations . . . . . . . . . . . .  61
  6687. 4.2.3. Window Move . . . . . . . . . . . . . . . . . . .  63
  6688. 4.2.4. Window Resize . . . . . . . . . . . . . . . . . .  64
  6689. 4.2.5. Iconify and Deiconify . . . . . . . . . . . . . .  64
  6690. 4.2.6. Colormap Change . . . . . . . . . . . . . . . . .  64
  6691. 4.2.7. Input Focus . . . . . . . . . . . . . . . . . . .  64
  6692. 4.2.8. ClientMessage Events  . . . . . . . . . . . . . .  65
  6693. 4.2.8.1. Window Deletion . . . . . . . . . . . . . . . .  66
  6694. 4.2.9. Redirecting Requests  . . . . . . . . . . . . . .  67
  6695. 4.3. Communication with the Window Manager by Means
  6696. of Selections  . . . . . . . . . . . . . . . . . . . . .  68
  6697. 4.4. Summary of Window Manager Property Types  . . . . .  68
  6698. 5. Session Management and Additional Inter-Client
  6699. Exchanges  . . . . . . . . . . . . . . . . . . . . . . .  69
  6700. 5.1. Client Support for Session Management . . . . . . .  69
  6701. 5.2. Window Manager Support for Session Management
  6702.  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  70
  6703. 5.3. Support for ICE Client Rendezvous . . . . . . . . .  70
  6704. 6. Manipulation of Shared Resources  . . . . . . . . . .  71
  6705. 6.1. The Input Focus . . . . . . . . . . . . . . . . . .  71
  6706. 6.2. The Pointer . . . . . . . . . . . . . . . . . . . .  71
  6707. 6.3. Grabs . . . . . . . . . . . . . . . . . . . . . . .  72
  6708. 6.4. Colormaps . . . . . . . . . . . . . . . . . . . . .  73
  6709. 6.5. The Keyboard Mapping  . . . . . . . . . . . . . . .  75
  6710. 6.6. The Modifier Mapping  . . . . . . . . . . . . . . .  76
  6711. 7. Device Color Characterization . . . . . . . . . . . .  78
  6712. 7.1. XYZ -> RGB Conversion Matrices  . . . . . . . . . .  79
  6713. 7.2. Intensity -> RGB Value Conversion . . . . . . . . .  79
  6714. 8. Conclusion  . . . . . . . . . . . . . . . . . . . . .  82
  6715. 8.1. The X Registry  . . . . . . . . . . . . . . . . . .  82
  6716. A. Revision History  . . . . . . . . . . . . . . . . . .  83
  6717. A.1. The X11R2 Draft . . . . . . . . . . . . . . . . . .  83
  6718. A.2. The July 27, 1988, Draft  . . . . . . . . . . . . .  83
  6719. A.3. The Public Review Drafts  . . . . . . . . . . . . .  84
  6720. A.4. Version 1.0, July 1989  . . . . . . . . . . . . . .  85
  6721. A.5. Version 1.1 . . . . . . . . . . . . . . . . . . . .  86
  6722. A.6. Public Review Draft, December 1993  . . . . . . . .  86
  6723. A.7. Version 2.0, April 1994 . . . . . . . . . . . . . .  88
  6724. B. Suggested Protocol Revisions  . . . . . . . . . . . .  89
  6725. C. Obsolete Session Manager Conventions  . . . . . . . .  90
  6726. C.1. Properties  . . . . . . . . . . . . . . . . . . . .  90
  6727.  
  6728.  
  6729.  
  6730.                  iv
  6731.  
  6732.  
  6733.  
  6734.  
  6735.  
  6736. Inter-Client Communication Conventions        X11, Release 6.4
  6737.  
  6738.  
  6739. C.1.1. WM_COMMAND Property . . . . . . . . . . . . . . .  90
  6740. C.1.2. WM_CLIENT_MACHINE Property  . . . . . . . . . . .  91
  6741. C.2. Termination . . . . . . . . . . . . . . . . . . . .  91
  6742. C.3. Client Responses to Session Manager Actions . . . .  91
  6743. C.3.1. Saving Client State . . . . . . . . . . . . . . .  91
  6744. C.3.2. Window Deletion . . . . . . . . . . . . . . . . .  92
  6745. C.4. Summary of Session Manager Property Types . . . . .  93
  6746.  
  6747.  
  6748.  
  6749.  
  6750.  
  6751.  
  6752.  
  6753.  
  6754.  
  6755.  
  6756.  
  6757.  
  6758.  
  6759.  
  6760.  
  6761.  
  6762.  
  6763.  
  6764.  
  6765.  
  6766.  
  6767.  
  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.                   v
  6797.  
  6798.  
  6799.