1<?xml version="1.0" encoding="UTF-8" ?> 2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" 3 "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" 4[ 5<!ENTITY % defs SYSTEM "defs.ent"> %defs; 6]> 7 8 9<book id="icccm"> 10 11<bookinfo> 12 <title>Inter-Client Communication Conventions Manual</title> 13 <subtitle>X Consortium Standard</subtitle> 14 <authorgroup> 15 <author> 16 <firstname>David</firstname><surname>Rosenthal</surname> 17 <affiliation><orgname>Sun Microsystems, Inc.</orgname></affiliation> 18 </author> 19 <editor> 20 <firstname>Stuart</firstname><othername>W.</othername><surname>Marks</surname> 21 <affiliation><orgname>SunSoft, Inc.</orgname></affiliation> 22 </editor> 23 </authorgroup> 24 <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo> 25 <releaseinfo>Version 2.0</releaseinfo> 26 <copyright><year>1988</year><year>1991</year><year>1993</year><year>1994</year> 27 <holder>X Consortium</holder> 28 </copyright> 29 30<legalnotice> 31<para> 32Permission is hereby granted, free of charge, to any person obtaining 33a copy of this software and associated documentation files (the 34"Software"), to deal in the Software without restriction, including 35without limitation the rights to use, copy, modify, merge, publish, 36distribute, sublicense, and/or sell copies of the Software, and to 37permit persons to whom the Software is furnished to do so, subject to 38the following conditions: 39</para> 40<para> 41The above copyright notice and this permission notice shall be included 42in all copies or substantial portions of the Software. 43</para> 44<para> 45THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS 46OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 47MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 48IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR 49OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 50ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 51OTHER DEALINGS IN THE SOFTWARE. 52</para> 53<para> 54Except as contained in this notice, the name of the X Consortium shall 55not be used in advertising or otherwise to promote the sale, use or 56other dealings in this Software without prior written authorization 57from the X Consortium. 58</para> 59<para>X Window System is a trademark of The Open Group.</para> 60</legalnotice> 61 62<legalnotice> 63<para role="multiLicensing"> 64Copyright © 1987, 1988, 1989, 1993, 1994 Sun Microsystems, Inc 65</para> 66<para> 67Permission to use, copy, modify, and distribute this documentation 68for any purpose and without fee is hereby granted, provided 69that the above copyright notice and this permission 70notice appear in all copies. 71Sun Microsystems makes no representations about the 72suitability for any purpose of the information in this document. 73This documentation is provided as is without express or implied warranty. 74</para> 75</legalnotice> 76 77</bookinfo> 78 79<preface> 80<title>Preface to Version 2.0</title> 81<para> 82The goal of the ICCCM Version 2.0 effort was to add new facilities, to fix 83problems with earlier drafts, and to improve readability and 84understandability, while maintaining compatibility with the earlier 85versions. This document is the product of over two years of discussion among 86the members of the X Consortium's <function>wmtalk</function> working group. 87The following people deserve thanks for their contributions: 88</para> 89 90<literallayout class="monospaced"> 91Gabe Beged-Dov Bill Janssen 92Chan Benson Vania Joloboff 93Jordan Brown Phil Karlton 94Larry Cable Kaleb Keithley 95Ellis Cohen Mark Manasse 96Donna Converse Ralph Mor 97Brian Cripe Todd Newman 98Susan Dahlberg Bob Scheifler 99Peter Daifuku Keith Taylor 100Andrew deBlois Jim VanGilder 101Clive Feather Mike Wexler 102Stephen Gildea Michael Yee 103Christian Jacobi 104</literallayout> 105 106<para> 107It has been a privilege for me to work with this fine group of people. 108</para> 109<para> 110Stuart W. Marks 111</para> 112<para> 113December 1993 114</para> 115</preface> 116 117<preface> 118<title>Preface to Version 1.1</title> 119 120<para> 121David Rosenthal had overall architectural responsibility 122for the conventions defined in this document; 123he wrote most of the text and edited the document, 124but its development has been a communal effort. 125The details were thrashed out in meetings at the January 1988 MIT X Conference 126and at the 1988 Summer Usenix conference, 127and through months (and megabytes) of argument 128on the 129<function>wmtalk</function> 130mail alias. 131Thanks are due to everyone who contributed, 132and especially to the following people. 133</para> 134 135<para> 136<!-- .LP --> 137For the Selection section: 138</para> 139 140<literallayout class="monospaced"> 141Jerry Farrell 142Phil Karlton 143Loretta Guarino Reid 144Mark Manasse 145Bob Scheifler 146</literallayout> 147 148<para> 149For the Cut-Buffer section: 150</para> 151 152<literallayout class="monospaced"> 153Andrew Palay 154</literallayout> 155 156<para> 157For the Window and Session Manager sections: 158</para> 159<literallayout class="monospaced"> 160<!-- .ta 3i --> 161Todd Brunhoff Matt Landau 162Ellis Cohen Mark Manasse 163Jim Fulton Bob Scheifler 164Hania Gajewska Ralph Swick 165Jordan Hubbard Mike Wexler 166Kerry Kimbrough Glenn Widener 167Audrey Ishizaki 168</literallayout> 169 170<para> 171For the Device Color Characterization section: 172</para> 173 174<literallayout class="monospaced"> 175Keith Packard 176</literallayout> 177 178<para> 179In addition, thanks are due to those who contributed to the public review: 180</para> 181 182<literallayout class="monospaced"> 183Gary Combs John Irwin 184Errol Crary Vania Joloboff 185Nancy Cyprych John Laporta 186John Diamant Ken Lee 187Clive Feather Stuart Marks 188Burns Fisher Alan Mimms 189Richard Greco Colas Nahaboo 190Tim Greenwood Mark Patrick 191Kee Hinckley Steve Pitschke 192Brian Holt Brad Reed 193John Interrante John Thomas 194</literallayout> 195</preface> 196 197<chapter id='Introduction'> 198<title>Introduction</title> 199<para> 200It was an explicit design goal of X Version 11 to specify mechanism, 201not policy. 202As a result, 203a client that converses with the server using the protocol defined 204by the <emphasis remap='I'>X Window System Protocol</emphasis>, <emphasis remap='I'>Version 11</emphasis> may operate correctly 205in isolation but may not coexist properly with others sharing the same server. 206</para> 207 208<para> 209Being a good citizen in the X Version 11 world involves adhering to 210conventions that govern inter-client communications in the following areas: 211</para> 212 213<itemizedlist> 214 <listitem> 215 <para> 216Selection mechanism 217 </para> 218 </listitem> 219 <listitem> 220 <para> 221Cut buffers 222 </para> 223 </listitem> 224 <listitem> 225 <para> 226Window manager 227 </para> 228 </listitem> 229 <listitem> 230 <para> 231Session manager 232 </para> 233 </listitem> 234 <listitem> 235 <para> 236Manipulation of shared resources 237 </para> 238 </listitem> 239 <listitem> 240 <para> 241Device color characterization 242 </para> 243 </listitem> 244</itemizedlist> 245 246<para> 247<!-- .LP --> 248This document proposes suitable conventions without attempting to enforce 249any particular user interface. 250To permit clients written in different languages to communicate, 251these conventions are expressed solely in terms of protocol operations, 252not in terms of their associated Xlib interfaces, 253which are probably more familiar. 254The binding of these operations to the Xlib interface for C 255and to the equivalent interfaces for other languages 256is the subject of other documents. 257</para> 258 259<sect1 id='Evolution_of_the_Conventions'> 260<title>Evolution of the Conventions</title> 261<para> 262In the interests of timely acceptance, 263the <emphasis remap='I'>Inter-Client Communication Conventions Manual</emphasis> (ICCCM) 264covers only a minimal set of required conventions. 265These conventions will be added to and updated as appropriate, 266based on the experiences of the X Consortium. 267</para> 268<para> 269As far as possible, 270these conventions are upwardly compatible with those in the February 25, 1988, 271draft that was distributed with the X Version 11, Release 2, of the software. 272In some areas, 273semantic problems were discovered with those conventions, 274and, thus, complete upward compatibility could not be assured. 275These areas are noted in the text and are summarized in Appendix A. 276</para> 277<para> 278<!-- .LP --> 279In the course of developing these conventions, 280a number of minor changes to the protocol were identified as desirable. 281They also are identified in the text, are summarized in Appendix B, 282and are offered as input to a future protocol revision process. 283If and when a protocol revision incorporating these changes is undertaken, 284it is anticipated that the ICCCM will need to be revised. 285Because it is difficult to ensure that clients and servers are upgraded 286simultaneously, 287clients using the revised conventions should examine the minor protocol 288revision number and be prepared to use the older conventions 289when communicating with an older server. 290</para> 291<para> 292It is expected that these revisions will ensure that clients using 293the conventions appropriate to protocol minor revision <emphasis remap='I'>n</emphasis> 294will interoperate correctly with those that use the conventions 295appropriate to protocol minor revision 296<emphasis remap='I'>n</emphasis> + 1 if the server supports both. 297</para> 298</sect1> 299 300<sect1 id='Atoms'> 301<title>Atoms</title> 302<para> 303Many of the conventions use atoms. 304To assist the reader, 305the following sections attempt to amplify the description of atoms 306that is provided in the protocol specification. 307</para> 308<sect2 id='What_Are_Atoms'> 309<title>What Are Atoms?</title> 310<para> 311At the conceptual level, 312atoms are unique names that clients can use to communicate information 313to each other. 314They can be thought of as a bundle of octets, 315like a string but without an encoding being specified. 316The elements are not necessarily ASCII characters, 317and no case folding happens. 318<footnote><para> 319The comment in the protocol specification for 320<function>InternAtom</function> 321that ISO Latin-1 encoding should be used is in the nature of a convention; 322the server treats the string as a byte sequence. 323</para></footnote> 324</para> 325<para> 326The protocol designers felt that passing these 327sequences of bytes back and forth across the wire would be too costly. 328Further, they thought it important that events 329as they appear on the wire have a fixed size (in fact, 32 bytes) 330and that because some events contain atoms, a fixed-size representation 331for them was needed. 332</para> 333 334<para> 335To allow a fixed-size representation, 336a protocol request 337( <function>InternAtom</function> ) 338was provided to register a byte sequence with the server, 339which returns a 32-bit value (with the top three bits zero) 340that maps to the byte sequence. 341The inverse operator is also available 342( <function>GetAtomName</function> ). 343</para> 344</sect2> 345 346<sect2 id='Predefined_Atoms'> 347<title>Predefined Atoms</title> 348<para> 349The protocol specifies a number of atoms as being predefined: 350</para> 351<blockquote> 352<para> 353Predefined atoms are not strictly necessary 354and may not be useful in all environments, 355but they will eliminate many 356<function>InternAtom</function> 357requests in most applications. 358Note that they are predefined only in the sense of having numeric values, 359not in the sense of having required semantics. 360</para> 361</blockquote> 362 363<para> 364Predefined atoms are an implementation trick to avoid the cost of interning 365many of the atoms that are expected to be used during the startup phase 366of all applications. 367The results of the 368<function>InternAtom</function> 369requests, which require a handshake, can be assumed <emphasis remap='I'>a priori</emphasis>. 370</para> 371 372<para> 373Language interfaces should probably cache the atom-name mappings 374and get them only when required. 375The CLX interface, for instance, makes no distinction between predefined atoms 376and other atoms; all atoms are viewed as symbols at the interface. 377However, a CLX implementation will typically keep a symbol or atom cache 378and will typically initialize this cache with the predefined atoms. 379</para> 380</sect2> 381 382<sect2 id='Naming_Conventions'> 383<title>Naming Conventions</title> 384<para> 385The built-in atoms are composed of uppercase ASCII characters with the 386logical words separated by an underscore character (_), for example, 387WM_ICON_NAME. 388The protocol specification recommends that atoms used 389for private vendor-specific reasons should begin with an underscore. 390To prevent conflicts among organizations, 391additional prefixes should be chosen 392(for example, _DEC_WM_DECORATION_GEOMETRY). 393</para> 394 395<para> 396The names were chosen in this fashion to make it easy to use them in a 397natural way within LISP. 398Keyword constructors allow the programmer to specify the atoms as LISP atoms. 399If the atoms were not all uppercase, 400special quoting conventions would have to be used. 401</para> 402</sect2> 403 404<sect2 id='Semantics'> 405<title>Semantics</title> 406<para> 407The core protocol imposes no semantics on atoms except as they are used in 408FONTPROP structures. 409For further information on FONTPROP semantics, 410see the <emphasis remap='I'>X Logical Font Description Conventions</emphasis>. 411</para> 412</sect2> 413<sect2 id='Name_Spaces'> 414<title>Name Spaces</title> 415<para> 416The protocol defines six distinct spaces in which atoms are interpreted. 417Any particular atom may or may not have some valid interpretation 418with respect to each of these name spaces. 419</para> 420 421<informaltable frame="topbot"> 422 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 423 <colspec colname='c1' colwidth='1.5*'/> 424 <colspec colname='c2' colwidth='1.0*'/> 425 <colspec colname='c3' colwidth='3.0*'/> 426 <thead> 427 <row rowsep='1'> 428 <entry>Space</entry> 429 <entry>Briefly</entry> 430 <entry>Examples</entry> 431 </row> 432 </thead> 433 <tbody> 434 <row> 435 <entry>Property name</entry> 436 <entry>Name</entry> 437 <entry>WM_HINTS, WM_NAME, RGB_BEST_MAP, ...</entry> 438 </row> 439 <row> 440 <entry>Property type</entry> 441 <entry>Type</entry> 442 <entry>WM_HINTS, CURSOR, RGB_COLOR_MAP, ...</entry> 443 </row> 444 <row> 445 <entry>Selection name</entry> 446 <entry>Selection</entry> 447 <entry>PRIMARY, SECONDARY, CLIPBOARD</entry> 448 </row> 449 <row> 450 <entry>Selection target</entry> 451 <entry>Target</entry> 452 <entry>FILE_NAME, POSTSCRIPT, PIXMAP, ...</entry> 453 </row> 454 <row> 455 <entry>Font property</entry> 456 <entry></entry> 457 <entry>QUAD_WIDTH, POINT_SIZE, ...</entry> 458 </row> 459 <row> 460 <entry><function>ClientMessage</function> type</entry> 461 <entry></entry> 462 <entry>WM_SAVE_YOURSELF, _DEC_SAVE_EDITS, &...</entry> 463 </row> 464 </tbody> 465 </tgroup> 466</informaltable> 467</sect2> 468 469<sect2 id='Discriminated_Names'> 470<title>Discriminated Names</title> 471<para> 472Sometimes a protocol requires an arbitrary number of similar 473objects that need unique names (usually because the objects are created 474dynamically, so that names cannot be invented in advance). For example, a 475colormap-generating program might use the selection mechanism to offer 476colormaps for each screen and so needs a selection name for each screen. 477Such names are called "discriminated names" and are discriminated by 478some entity. This entity can be: 479</para> 480 481<literallayout class="monospaced"> 482 A screen 483 An X resource (a window, a colormap, a visual, etc.) 484 A client 485</literallayout> 486 487<para> 488If it is only necessary to generate a fixed set of names for each value 489of the discriminating entity, then the discriminated names are formed by 490suffixing an ordinary name according to the value of the entity. 491</para> 492 493<para> 494If <emphasis remap='I'>name</emphasis> is a descriptive portion for the name, <emphasis remap='I'>d</emphasis> is a decimal 495number with no leading zeroes, and <emphasis remap='I'>x</emphasis> is a hexadecimal number with 496exactly 8 digits, and using uppercase letters, then such discriminated names 497shall have the form: 498</para> 499 500<informaltable frame="topbot"> 501 <?dbfo keep-together="always" ?> 502 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 503 <colspec colname='c1' colwidth='2.0*'/> 504 <colspec colname='c2' colwidth='1.0*'/> 505 <colspec colname='c3' colwidth='2.0*'/> 506 <thead> 507 <row rowsep='1'> 508 <entry>Name Discriminated by</entry> 509 <entry>Form</entry> 510 <entry>Example</entry> 511 </row> 512 </thead> 513 <tbody> 514 <row> 515 <entry>screen number</entry> 516 <entry><emphasis remap='I'>name</emphasis>_S<emphasis remap='I'>d</emphasis></entry> 517 <entry>WM_COMMS_S2</entry> 518 </row> 519 <row> 520 <entry>X resource</entry> 521 <entry><emphasis remap='I'>name</emphasis>_R<emphasis remap='I'>x</emphasis></entry> 522 <entry>GROUP_LEADER_R1234ABCD</entry> 523 </row> 524 </tbody> 525 </tgroup> 526</informaltable> 527 528<para> 529To discriminate a name by client, use an X resource ID created by that 530client. This resource can be of any type. 531</para> 532 533<para> 534Sometimes it is simply necessary to generate a unique set of names (for 535example, for the properties on a window used by a MULTIPLE selection). 536These names should have the form: 537</para> 538 539<literallayout class="monospaced"> 540U<emphasis remap='I'>d</emphasis> (e.g., U0 U1 U2 U3 ...) 541</literallayout> 542 543<para> 544if the names stand totally alone, and the form: 545</para> 546 547<literallayout class="monospaced"> 548<emphasis remap='I'>name</emphasis>_U<emphasis remap='I'>d</emphasis> (e.g., FOO_U0 BAR_U0 FOO_U1 BAR_U1 ...) 549</literallayout> 550 551<para> 552if they come in sets (here there are two sets, named "FOO" and 553"BAR"). The stand-alone U<emphasis remap='I'>d</emphasis> form should be used only if it is 554clear that the module using it has complete control over the relevant 555namespace or has the active cooperation of all other entities that might 556also use these names. (Naming properties on a window created specifically 557for a particular selection is such a use; naming properties on the root 558window is almost certainly not.) 559</para> 560 561<para> 562In a particularly difficult case, it might be necessary to combine both 563forms of discrimination. If this happens, the U form should come after 564the other form, thus: 565</para> 566 567<literallayout class="monospaced"> 568 FOO_R12345678_U23 569</literallayout> 570 571<blockquote> 572<title>Rationale</title> 573<para> 574Existing protocols will not be changed to use these naming conventions, 575because doing so will cause too much disruption. However, it is expected 576that future protocols -- both standard and private -- will use these 577conventions. 578</para> 579</blockquote> 580</sect2> 581</sect1> 582</chapter> 583 584<chapter id='Peer_to_Peer_Communication_by_Means_of_Selections'> 585<title>Peer-to-Peer Communication by Means of Selections</title> 586<para> 587Selections are the primary mechanism that X Version 11 defines 588for the exchange of information between clients, 589for example, by cutting and pasting between windows. 590Note that there can be an arbitrary number of selections 591(each named by an atom) and that they are global to the server. 592<xref linkend='Use_of_Selection_Atoms' xrefstyle='select: title'/>. 593discusses the choice of an atom. 594Each selection is owned by a client and is attached to a window. 595</para> 596<para> 597Selections communicate between an owner and a requestor. 598The owner has the data representing the value of its selection, 599and the requestor receives it. 600A requestor wishing to obtain the value of a selection provides the following: 601</para> 602 603<itemizedlist> 604 <listitem> 605 <para> 606The name of the selection 607 </para> 608 </listitem> 609 <listitem> 610 <para> 611The name of a property 612 </para> 613 </listitem> 614 <listitem> 615 <para> 616A window 617 </para> 618 </listitem> 619 <listitem> 620 <para> 621The atom representing the data type required 622 </para> 623 </listitem> 624 <listitem> 625 <para> 626Optionally, some parameters for the request 627 </para> 628 </listitem> 629</itemizedlist> 630 631<para> 632If the selection is currently owned, 633the owner receives an event and is expected to do the following: 634</para> 635 636<itemizedlist> 637 <listitem> 638 <para> 639Convert the contents of the selection to the requested data type 640 </para> 641 </listitem> 642 <listitem> 643 <para> 644Place this data in the named property on the named window 645 </para> 646 </listitem> 647 <listitem> 648 <para> 649Send the requestor an event to let it know the property is available 650 </para> 651 </listitem> 652</itemizedlist> 653 654<para> 655Clients are strongly encouraged to use this mechanism. 656In particular, 657displaying text in a permanent window without providing the ability 658to select and convert it into a string is definitely considered antisocial. 659</para> 660 661<para> 662Note that all data transferred between an owner and a requestor must usually 663go by means of the server in an X Version 11 environment. 664A client cannot assume that another client can open the same files 665or even communicate directly. 666The other client may be talking to the server by means of 667a completely different networking mechanism (for example, one client might 668be DECnet and the other TCP/IP). 669Thus, passing indirect references to data 670(such as, file names, host names, and port numbers) 671is permitted only if both clients specifically agree. 672</para> 673 674<sect1 id='Acquiring_Selection_Ownership'> 675<title>Acquiring Selection Ownership</title> 676<para> 677A client wishing to acquire ownership of a particular selection 678should call 679<function>SetSelectionOwner,</function> 680which is defined as follows: 681</para> 682 683<para> 684<function>SetSelectionOwner</function> 685</para> 686 687<informaltable frame="none"> 688 <?dbfo keep-together="always" ?> 689 <tgroup cols='1' align='left' colsep='0' rowsep='0'> 690 <colspec colname='c1' colwidth='1.0*'/> 691 <tbody> 692 <row> 693 <entry><emphasis remap='I'>selection</emphasis>: ATOM</entry> 694 </row> 695 <row> 696 <entry> 697<emphasis remap='I'>owner</emphasis>: WINDOW or 698<function>None</function> 699 </entry> 700 </row> 701 <row> 702 <entry> 703<emphasis remap='I'>time</emphasis>: TIMESTAMP or 704<function>CurrentTime</function> 705 </entry> 706 </row> 707 </tbody> 708 </tgroup> 709</informaltable> 710 711<para> 712The client should set the specified selection to the atom that represents 713the selection, 714set the specified owner to some window that the client created, 715and set the specified time to some time between the current last-change time 716of the selection concerned and the current server time. 717This time value usually will be obtained from the timestamp of the event 718that triggers the acquisition of the selection. 719Clients should not set the time 720value to 721<function>CurrentTime</function>, 722because if they do so, they have no way of finding 723when they gained ownership of the selection. 724Clients must use a window they created so that requestors 725can route events to the owner of the selection.<footnote> 726<para> 727At present, no part of the protocol requires requestors 728to send events to the owner of a selection. 729This restriction is imposed to prepare for possible future extensions. 730</para> 731</footnote> 732</para> 733 734<blockquote> 735<title>Convention</title> 736<para> 737Clients attempting to acquire a selection must set the time value of the 738<function>SetSelectionOwner</function> 739request to the timestamp of the event triggering the acquisition attempt, 740not to 741<function>CurrentTime</function>. 742A zero-length append to a property is a way to obtain a timestamp for 743this purpose; 744the timestamp is in the corresponding 745<function>PropertyNotify</function> 746event. 747</para> 748</blockquote> 749 750<para> 751If the time in the 752<function>SetSelectionOwner</function> 753request is in the future relative to the server's current time 754or is in the past relative to the last time the specified selection 755changed hands, the 756<function>SetSelectionOwner</function> 757request appears to the client to succeed, 758but ownership is not actually transferred. 759</para> 760 761<para> 762Because clients cannot name other clients directly, 763the specified owner window is used to refer to the owning client 764in the replies to 765<function>GetSelectionOwner</function>, in 766<function>SelectionRequest</function> and 767<function>SelectionClear</function> 768events, and possibly as a place to put properties describing the selection 769in question. 770To discover the owner of a particular selection, 771a client should invoke 772<function>GetSelectionOwner</function>, 773which is defined as follows: 774</para> 775 776<para> 777<!-- .IN "GetSelectionOwner" "" "@DEF@" --> 778<function>GetSelectionOwner</function> 779</para> 780 781<informaltable frame="none"> 782 <?dbfo keep-together="always" ?> 783 <tgroup cols='1' align='left' colsep='0' rowsep='0'> 784 <colspec colname='c1' colwidth='1.0*'/> 785 <tbody> 786 <row> 787 <entry><emphasis remap='I'>selection</emphasis>: ATOM</entry> 788 </row> 789 <row> 790 <entry>-></entry> 791 </row> 792 <row> 793 <entry> 794<emphasis remap='I'>owner</emphasis>: WINDOW or 795<function>None</function> 796 </entry> 797 </row> 798 </tbody> 799 </tgroup> 800</informaltable> 801 802<blockquote> 803<title>Convention</title> 804<para> 805Clients are expected to provide some visible confirmation 806of selection ownership. 807To make this feedback reliable, 808a client must perform a sequence like the following: 809</para> 810</blockquote> 811 812<literallayout class="monospaced"> 813SetSelectionOwner(selection=PRIMARY, owner=Window, time=timestamp) 814owner = GetSelectionOwner(selection=PRIMARY) 815if (owner != Window) Failure 816</literallayout> 817 818<para> 819If the 820<function>SetSelectionOwner</function> 821request succeeds (not merely appears to succeed), 822the client that issues it is recorded by the server as being the owner 823of the selection for the time period starting at the specified time. 824</para> 825</sect1> 826 827<sect1 id='Responsibilities_of_the_Selection_Owner'> 828<title>Responsibilities of the Selection Owner</title> 829<para> 830When a requestor wants the value of a selection, 831the owner receives a 832<function>SelectionRequest</function> 833event, which is defined as follows: 834</para> 835 836<para> 837<function>SelectionRequest</function> 838</para> 839 840<informaltable frame="none"> 841 <?dbfo keep-together="always" ?> 842 <tgroup cols='1' align='left' colsep='0' rowsep='0'> 843 <colspec colname='c1' colwidth='1.0*'/> 844 <tbody> 845 <row> 846 <entry><emphasis remap='I'>owner</emphasis>: WINDOW</entry> 847 </row> 848 <row> 849 <entry><emphasis remap='I'>selection</emphasis>: ATOM</entry> 850 </row> 851 <row> 852 <entry><emphasis remap='I'>selection</emphasis>: ATOM</entry> 853 </row> 854 <row> 855 <entry><emphasis remap='I'>target</emphasis>: ATOM</entry> 856 </row> 857 <row> 858 <entry><emphasis remap='I'>property</emphasis>: ATOM or 859<function>None</function></entry> 860 </row> 861 <row> 862 <entry><emphasis remap='I'>requestor</emphasis>: WINDOW</entry> 863 </row> 864 <row> 865 <entry><emphasis remap='I'>time</emphasis>: TIMESTAMP or 866<function>CurrentTime</function></entry> 867 </row> 868 </tbody> 869 </tgroup> 870</informaltable> 871 872<para> 873The specified owner and selection will be the values that were specified in 874the 875<function>SetSelectionOwner</function> 876request. 877The owner should compare the timestamp with the period 878it has owned the selection and, if the time is outside, 879refuse the 880<function>SelectionRequest</function> 881by sending the requestor window a 882<function>SelectionNotify</function> 883event with the property set to 884<function>None</function> 885(by means of a 886<function>SendEvent</function> 887request with an empty event mask). 888</para> 889 890<para> 891More advanced selection owners are free to maintain a history 892of the value of the selection and to respond to requests for the 893value of the selection during periods they owned it 894even though they do not own it now. 895</para> 896 897<para> 898If the specified property is 899<function>None</function>, 900the requestor is an obsolete client. 901Owners are encouraged to support these clients by using the specified target 902atom as the property name to be used for the reply. 903</para> 904 905<para> 906Otherwise, 907the owner should use the target to decide the form into which the selection 908should be converted. 909Some targets may be defined such that requestors can pass parameters 910along with the request. The owner will find these parameters in the 911property named in the selection request. The type, format, and 912contents of this property are dependent upon the definition of the 913target. If the target is not defined to have parameters, the owner 914should ignore the property if it is present. 915If the selection cannot be converted 916into a form based on the target (and parameters, if any), 917the owner should refuse the 918<function>SelectionRequest</function> 919as previously described. 920</para> 921 922<para> 923If the specified property is not 924<function>None</function>, 925the owner should place the data resulting from converting the selection 926into the specified property on the requestor window 927and should set the property's type to some appropriate value, 928which need not be the same as the specified target. 929<blockquote> 930<title>Convention</title> 931<para> 932All properties used to reply to 933<function>SelectionRequest</function> 934events must be placed on the requestor window. 935</para> 936</blockquote> 937</para> 938 939<para> 940In either case, 941if the data comprising the selection cannot be stored on the requestor window 942(for example, because the server cannot provide sufficient memory), 943the owner must refuse the 944<function>SelectionRequest</function>, 945as previously described. 946See also 947<xref linkend='Large_Data_Transfers' xrefstyle='select: title'/>. 948 949</para> 950 951<para> 952If the property is successfully stored, 953the owner should acknowledge the successful conversion 954by sending the requestor window a 955<function>SelectionNotify</function> 956event (by means of a 957<function>SendEvent</function> 958request with an empty mask). 959<function>SelectionNotify</function> 960is defined as follows: 961</para> 962 963<para> 964<!-- .IN "SelectionNotify" "" "@DEF@" --> 965<function>SelectionNotify</function> 966</para> 967 968 969<informaltable frame="none"> 970 <?dbfo keep-together="always" ?> 971 <tgroup cols='1' align='left' colsep='0' rowsep='0'> 972 <colspec colname='c1' colwidth='1.0*'/> 973 <tbody> 974 <row> 975 <entry><emphasis remap='I'>requestor</emphasis>: WINDOW</entry> 976 </row> 977 <row> 978 <entry> 979<emphasis remap='I'>selection</emphasis>, 980<emphasis remap='I'>target</emphasis>: ATOM 981 </entry> 982 </row> 983 <row> 984 <entry> 985<emphasis remap='I'>property</emphasis>: ATOM or 986<function>None</function> 987 </entry> 988 </row> 989 <row> 990 <entry> 991<emphasis remap='I'>time</emphasis>: TIMESTAMP or 992<function>CurrentTime</function> 993 </entry> 994 </row> 995 </tbody> 996 </tgroup> 997</informaltable> 998 999<para> 1000The owner should set the specified selection, target, time, 1001and property arguments to the values received in the 1002<function>SelectionRequest</function> 1003event. 1004(Note that setting the property argument to 1005<function>None</function> 1006indicates that the conversion requested could not be made.) 1007</para> 1008 1009<blockquote> 1010<title>Convention</title> 1011<para> 1012The selection, target, time, and property arguments in the 1013<function>SelectionNotify</function> 1014event should be set to the values received in the 1015<function>SelectionRequest</function> 1016event. 1017</para> 1018</blockquote> 1019 1020<para> 1021If the owner receives more than one 1022<function>SelectionRequest</function> 1023event with the same requestor, selection, target, and timestamp it must 1024respond to them in the same order in which they were received. 1025</para> 1026 1027<blockquote> 1028<title>Rationale</title> 1029<para> 1030It is possible for a requestor to have multiple outstanding requests that 1031use the same requestor window, selection, target, and timestamp, and that 1032differ only in the property. If this occurs, and one of the conversion 1033requests fails, the resulting 1034<function>SelectionNotify</function> 1035event will have its property argument set to 1036<function>None</function>. 1037This may make it impossible for the requestor to determine which conversion 1038request had failed, unless the requests are responded to in order. 1039</para> 1040</blockquote> 1041 1042<para> 1043The data stored in the property must eventually be deleted. 1044A convention is needed to assign the responsibility for doing so. 1045</para> 1046 1047<blockquote> 1048<title>Convention</title> 1049<para> 1050Selection requestors are responsible for deleting properties whose 1051names they receive in 1052<function>SelectionNotify</function> 1053events (See 1054<xref linkend='Requesting_a_Selection' xrefstyle='select: title'/> 1055) or in properties with type MULTIPLE. 1056</para> 1057</blockquote> 1058 1059<para> 1060A selection owner will often need confirmation that the data comprising the 1061selection has actually been transferred. 1062(For example, 1063if the operation has side effects on the owner's internal data structures, 1064these should not take place until the requestor has indicated 1065that it has successfully received the data.) 1066Owners should express interest in 1067<function>PropertyNotify</function> 1068events for the specified requestor window 1069and wait until the property in the 1070<function>SelectionNotify</function> 1071event has been deleted before assuming that the selection data has been 1072transferred. For the MULTIPLE request, if the different conversions require 1073separate confirmation, the selection owner can also watch for the deletion 1074of the individual properties named in the property in the 1075<function>SelectionNotify</function> 1076event. 1077</para> 1078 1079<para> 1080When some other client acquires a selection, 1081the previous owner receives a 1082<function>SelectionClear</function> 1083event, which is defined as follows: 1084</para> 1085 1086<para> 1087<!-- .IN "SelectionClear" "" "@DEF@" --> 1088<function>SelectionClear</function> 1089</para> 1090 1091<informaltable frame="none"> 1092 <?dbfo keep-together="always" ?> 1093 <tgroup cols='1' align='left' colsep='0' rowsep='0'> 1094 <colspec colname='c1' colwidth='1.0*'/> 1095 <tbody> 1096 <row> 1097 <entry> 1098<emphasis remap='I'>owner</emphasis>: WINDOW 1099 </entry> 1100 </row> 1101 <row> 1102 <entry> 1103<emphasis remap='I'>selection</emphasis>: ATOM 1104 </entry> 1105 </row> 1106 <row> 1107 <entry> 1108<emphasis remap='I'>time</emphasis>: TIMESTAMP 1109 </entry> 1110 </row> 1111 </tbody> 1112 </tgroup> 1113</informaltable> 1114 1115 1116<para> 1117The timestamp argument is the time at which the ownership changed hands, 1118and the owner argument is the window the previous owner specified in its 1119<function>SetSelectionOwner</function> 1120request. 1121</para> 1122 1123<para> 1124If an owner loses ownership while it has a transfer in progress (that is, 1125before it receives notification that the requestor has received all the data), 1126it must continue to service the ongoing transfer until it is complete. 1127</para> 1128 1129<para> 1130If the selection value completely changes, but the owner happens 1131to be the same client (for example, selecting a totally different 1132piece of text in the same <function>xterm</function> as before), 1133then the client should 1134reacquire the selection ownership as if it were not the owner, 1135providing a new timestamp. If the selection value is modified, but 1136can still reasonably be viewed as the same selected object, 1137<footnote> 1138<para> 1139The division between these two cases is a matter of judgment 1140on the part of the software developer. 1141</para> 1142</footnote> 1143the owner should take no action. 1144</para> 1145 1146</sect1> 1147 1148<sect1 id='Giving_Up_Selection_Ownership'> 1149<title>Giving Up Selection Ownership</title> 1150<para> 1151Clients may either give up selection ownership voluntarily 1152or lose it forcibly as the result of some other client's actions. 1153</para> 1154 1155<sect2 id='Voluntarily_Giving_Up_Selection_Ownership'> 1156<title>Voluntarily Giving Up Selection Ownership</title> 1157<para> 1158To relinquish ownership of a selection voluntarily, 1159a client should execute a 1160<function>SetSelectionOwner</function> 1161request for that selection atom, with owner specified as 1162<function>None</function> 1163and the time specified as the timestamp that was used to acquire the selection. 1164</para> 1165 1166<para> 1167Alternatively, 1168the client may destroy the window used as the owner value of the 1169<function>SetSelectionOwner</function> 1170request, or the client may terminate. 1171In both cases, 1172the ownership of the selection involved will revert to 1173<function>None</function>. 1174</para> 1175</sect2> 1176 1177<sect2 id='Forcibly_Giving_Up_Selection_Ownership'> 1178<title>Forcibly Giving Up Selection Ownership</title> 1179<para> 1180If a client gives up ownership of a selection 1181or if some other client executes a 1182<function>SetSelectionOwner</function> 1183for it and thus reassigns it forcibly, 1184the previous owner will receive a 1185<function>SelectionClear</function> 1186event. For the definition of a 1187<function>SelectionClear</function> 1188event, see 1189<xref linkend='Responsibilities_of_the_Selection_Owner' xrefstyle='select: title'/> 1190</para> 1191 1192<para> 1193The timestamp is the time the selection changed hands. 1194The specified owner is the window that was specified by the current owner 1195in its 1196<function>SetSelectionOwner</function> 1197request. 1198</para> 1199</sect2> 1200</sect1> 1201 1202<sect1 id='Requesting_a_Selection'> 1203<title>Requesting a Selection</title> 1204<para> 1205A client that wishes to obtain the value of a selection in a particular 1206form (the requestor) issues a 1207<function>ConvertSelection</function> 1208request, which is defined as follows: 1209</para> 1210 1211<!-- .IN "ConvertSelection" "" "@DEF@" --> 1212<para> 1213<function>ConvertSelection</function> 1214</para> 1215 1216<informaltable frame="none"> 1217 <?dbfo keep-together="always" ?> 1218 <tgroup cols='1' align='left' colsep='0' rowsep='0'> 1219 <colspec colname='c1' colwidth='1.0*'/> 1220 <tbody> 1221 <row> 1222 <entry> 1223<emphasis remap='I'>selection</emphasis>, 1224<emphasis remap='I'>target</emphasis>: ATOM 1225 </entry> 1226 </row> 1227 <row> 1228 <entry> 1229<emphasis remap='I'>property</emphasis>: ATOM or 1230<function>None</function> 1231 </entry> 1232 </row> 1233 <row> 1234 <entry> 1235<emphasis remap='I'>requestor</emphasis>: WINDOW 1236 </entry> 1237 </row> 1238 <row> 1239 <entry> 1240<emphasis remap='I'>time</emphasis>: TIMESTAMP or 1241<function>CurrentTime</function> 1242 </entry> 1243 </row> 1244 </tbody> 1245 </tgroup> 1246</informaltable> 1247 1248<para> 1249The selection argument specifies the particular selection involved, 1250and the target argument specifies the required form of the information. 1251For information about the choice of suitable atoms to use, 1252see 1253<xref linkend='Use_of_Selection_Atoms' xrefstyle='select: title'/> 1254The requestor should set the requestor argument to a window that it created; 1255the owner will place the reply property there. 1256The requestor should set the time argument to the timestamp on the event 1257that triggered the request for the selection value. 1258Note that clients should not specify 1259<function>CurrentTime</function>. 1260</para> 1261 1262<blockquote> 1263<title>Convention</title> 1264<para> 1265Clients should not use 1266<function>CurrentTime</function> 1267for the time argument of a 1268<function>ConvertSelection</function> 1269request. 1270Instead, they should use the timestamp of the event that caused the request 1271to be made. 1272</para> 1273</blockquote> 1274 1275<para> 1276The requestor should set the property argument to the name of a property 1277that the owner can use to report the value of the selection. 1278Requestors should ensure that the named property does not exist 1279on the window before issuing the 1280<function>ConvertSelection</function> 1281request.<footnote> 1282<para> 1283This requirement is new in version 2.0, and, in general, existing 1284clients do not conform to this requirement. To prevent these clients 1285from breaking, no existing targets should be extended to take 1286parameters until sufficient time has passed for clients to be updated. 1287Note that the MULTIPLE target was defined to take parameters in version 12881.0 and its definition is not changing. There is thus no conformance 1289problem with MULTIPLE. 1290</para> 1291</footnote> 1292The exception to this rule is when the requestor intends to pass 1293parameters with the request (see below). 1294</para> 1295 1296<blockquote> 1297<title>Rationale</title> 1298<para> 1299It is necessary for requestors to delete the property before issuing the 1300request so that the target can later be extended to take parameters without 1301introducing an incompatibility. Also note that the requestor of a selection 1302need not know the client that owns the selection nor the window on which 1303the selection was acquired. 1304</para> 1305</blockquote> 1306 1307<para> 1308Some targets may be defined such that requestors can pass parameters 1309along with the request. If the requestor wishes to provide parameters 1310to a request, they should be placed in the specified property on the 1311requestor window before the requestor issues the 1312<function>ConvertSelection</function> 1313request, and this property should be named in the request. 1314</para> 1315 1316<para> 1317Some targets may be defined so that parameters are optional. If no 1318parameters are to be supplied with the request of such a target, the 1319requestor must ensure that the property does not exist before issuing 1320the 1321<function>ConvertSelection</function> 1322request. 1323</para> 1324 1325<para> 1326The protocol allows the property field to be set to 1327<function>None</function>, 1328in which case the owner is supposed to choose a property name. 1329However, it is difficult for the owner to make this choice safely. 1330</para> 1331 1332<para><emphasis role="bold">Conventions</emphasis></para> 1333 1334<itemizedlist> 1335 <listitem> 1336 <para> 1337Requestors should not use 1338<function>None</function> 1339for the property argument of a 1340<function>ConvertSelection</function> 1341request. 1342 </para> 1343 </listitem> 1344 <listitem> 1345 <para> 1346Owners receiving 1347<function>ConvertSelection</function> 1348requests with a property argument of 1349<function>None</function> 1350are talking to an obsolete client. 1351They should choose the target atom as the property name to be used 1352for the reply. 1353 </para> 1354 </listitem> 1355</itemizedlist> 1356 1357<para> 1358The result of the 1359<function>ConvertSelection</function> 1360request is that a 1361<function>SelectionNotify</function> 1362event will be received. 1363For the definition of a 1364<function>SelectionNotify</function> 1365event, see 1366<xref linkend='Responsibilities_of_the_Selection_Owner' xrefstyle='select: title'/>. 1367</para> 1368 1369<para> 1370The requestor, selection, time, and target arguments will be the same 1371as those on the 1372<function>ConvertSelection</function> 1373request. 1374</para> 1375 1376<para> 1377If the property argument is 1378<function>None</function>, 1379the conversion has been refused. 1380This can mean either that there is no owner for the selection, 1381that the owner does not support the conversion implied by the target, 1382or that the server did not have sufficient space to accommodate the data. 1383</para> 1384 1385<para> 1386If the property argument is not 1387<function>None</function>, 1388then that property will exist on the requestor window. 1389The value of the selection can be retrieved from this 1390property by using the 1391<function>GetProperty</function> 1392request, which is defined as follows: 1393</para> 1394 1395<para> 1396<!-- .IN "GetProperty" "" "@DEF@" --> 1397<function>GetProperty</function> 1398</para> 1399 1400<informaltable frame="none"> 1401 <tgroup cols='1' align='left' colsep='0' rowsep='0'> 1402 <colspec colname='c1' colwidth='1.0*'/> 1403 <tbody> 1404 <row> 1405 <entry> 1406<emphasis remap='I'>window</emphasis>: WINDOW 1407 </entry> 1408 </row> 1409 <row> 1410 <entry> 1411<emphasis remap='I'>property</emphasis>: ATOM 1412 </entry> 1413 </row> 1414 <row> 1415 <entry> 1416<emphasis remap='I'>type</emphasis>: ATOM or 1417<function>AnyPropertyType</function> 1418 </entry> 1419 </row> 1420 <row> 1421 <entry> 1422<emphasis remap='I'>long-offset</emphasis>, 1423<emphasis remap='I'>long-length</emphasis>: CARD32 1424 </entry> 1425 </row> 1426 <row> 1427 <entry> 1428<emphasis remap='I'>delete</emphasis>: BOOL 1429 </entry> 1430 </row> 1431 <row> 1432 <entry> 1433-> 1434 </entry> 1435 </row> 1436 <row> 1437 <entry> 1438type: ATOM or <function>None</function> 1439 </entry> 1440 </row> 1441 <row> 1442 <entry> 1443format: {0, 8, 16, 32} 1444 </entry> 1445 </row> 1446 <row> 1447 <entry> 1448bytes-after: CARD32 1449 </entry> 1450 </row> 1451 <row> 1452 <entry> 1453value: LISTofINT8 or LISTofINT16 or LISTofINT32 1454 </entry> 1455 </row> 1456 </tbody> 1457 </tgroup> 1458</informaltable> 1459 1460<para> 1461<!-- .LP --> 1462<function>GetProperty</function> 1463to retrieve the value of a selection, 1464the property argument should be set to the corresponding value in the 1465<function>SelectionNotify</function> 1466event. 1467Because the requestor has no way of knowing beforehand what type 1468the selection owner will use, 1469the type argument should be set to 1470<function>AnyPropertyType</function>. 1471Several 1472<function>GetProperty</function> 1473requests may be needed to retrieve all the data in the selection; 1474each should set the long-offset argument to the amount of data received so far, 1475and the size argument to some reasonable buffer size (see 1476<xref linkend='Large_Data_Transfers' xrefstyle='select: title'/>. 1477). 1478If the returned value of bytes-after is zero, <!-- xref --> 1479the whole property has been transferred. 1480</para> 1481 1482<para> 1483Once all the data in the selection has been retrieved 1484(which may require getting the values of several properties -- 1485see 1486<xref linkend='Use_of_Selection_Properties' xrefstyle='select: title'/>. 1487), 1488the requestor should delete the property in the 1489<function>SelectionNotify</function> 1490request by using a 1491<function>GetProperty</function> 1492request with the delete argument set to 1493<function>True</function>. 1494As previously discussed, 1495the owner has no way of knowing when the data has been 1496transferred to the requestor unless the property is removed. 1497</para> 1498 1499<blockquote> 1500<title>Convention</title> 1501<para> 1502The requestor must delete the property named in the 1503<function>SelectionNotify</function> 1504once all the data has been retrieved. 1505The requestor should invoke either 1506<function>DeleteProperty</function> or 1507<function>GetProperty</function> 1508(delete==True) 1509after it has successfully retrieved all the data in the selection. 1510For further information, 1511see 1512<xref linkend='Large_Data_Transfers' xrefstyle='select: title'/>. 1513 1514</para> 1515</blockquote> 1516</sect1> 1517 1518<sect1 id='Large_Data_Transfers'> 1519<title>Large Data Transfers</title> 1520<para> 1521Selections can get large, which poses two problems: 1522</para> 1523<itemizedlist> 1524 <listitem> 1525 <para> 1526Transferring large amounts of data to the server is expensive. 1527 </para> 1528 </listitem> 1529 <listitem> 1530 <para> 1531All servers will have limits on the amount of data that can be stored 1532in properties. 1533Exceeding this limit will result in an 1534<function>Alloc</function> 1535error on the 1536<function>ChangeProperty</function> 1537request that the selection owner uses to store the data. 1538 </para> 1539 </listitem> 1540</itemizedlist> 1541 1542<para> 1543The problem of limited server resources is addressed by the following 1544conventions: 1545</para> 1546 1547<para> 1548<emphasis role="bold">Conventions</emphasis> 1549</para> 1550 1551<itemizedlist> 1552 <listitem> 1553 <para> 1554Selection owners should transfer the data describing a large selection 1555(relative to the maximum-request-size they received 1556in the connection handshake) using the INCR property mechanism 1557(see 1558<xref linkend='INCR_Properties' xrefstyle='select: title'/>. 1559). <!-- xref --> 1560 </para> 1561 </listitem> 1562 <listitem> 1563 <para> 1564Any client using 1565<function>SetSelectionOwner</function> 1566to acquire selection ownership should arrange to process 1567<function>Alloc</function> 1568errors in property change requests. 1569For clients using Xlib, 1570this involves using the 1571<olink targetdoc='libX11' targetptr='XSetErrorHandler'><function>XSetErrorHandler</function></olink> 1572function to override the default handler. 1573 </para> 1574 </listitem> 1575 <listitem> 1576 <para> 1577A selection owner must confirm that no 1578<function>Alloc</function> 1579error occurred while storing the properties for a selection 1580before replying with a confirming 1581<function>SelectionNotify</function> 1582event. 1583 </para> 1584 </listitem> 1585 <listitem> 1586 <para> 1587When storing large amounts of data (relative to maximum-request-size), 1588clients should use a sequence of 1589<function>ChangeProperty (mode==Append)</function> 1590requests for reasonable quantities of data. 1591This avoids locking servers up and limits the waste of data an 1592<function>Alloc</function> 1593error would cause. 1594 </para> 1595 </listitem> 1596 <listitem> 1597 <para> 1598If an 1599<function>Alloc</function> 1600error occurs during the storing of the selection data, 1601all properties stored for this selection should be deleted 1602and the 1603<function>ConvertSelection</function> 1604request should be refused (see 1605<xref linkend='Responsibilities_of_the_Selection_Owner' xrefstyle='select: title'/>. 1606). <!-- xref --> 1607 </para> 1608 </listitem> 1609 <listitem> 1610 <para> 1611To avoid locking servers up for inordinate lengths of time, 1612requestors retrieving large quantities of data from a property 1613should perform a series of 1614<function>GetProperty</function> 1615requests, each asking for a reasonable amount of data. 1616 </para> 1617 </listitem> 1618</itemizedlist> 1619 1620<blockquote> 1621<title>Advice to Implementors</title> 1622<para> 1623Single-threaded servers should take care to avoid locking up during large 1624data transfers. 1625</para> 1626</blockquote> 1627</sect1> 1628 1629<sect1 id='Use_of_Selection_Atoms'> 1630<title>Use of Selection Atoms</title> 1631<para> 1632Defining a new atom consumes resources in the server 1633that are not released until the server reinitializes. 1634Thus, reducing the need for newly minted atoms is an important goal 1635for the use of the selection atoms. 1636</para> 1637 1638<sect2 id='Selection_Atoms'> 1639<title>Selection Atoms</title> 1640<para> 1641There can be an arbitrary number of selections, each named by an atom. 1642To conform with the inter-client conventions, however, 1643clients need deal with only these three selections: 1644</para> 1645<itemizedlist> 1646 <listitem> 1647 <para> 1648PRIMARY 1649 </para> 1650 </listitem> 1651 <listitem> 1652 <para> 1653SECONDARY 1654 </para> 1655 </listitem> 1656 <listitem> 1657 <para> 1658CLIPBOARD 1659 </para> 1660 </listitem> 1661</itemizedlist> 1662 1663<para> 1664Other selections may be used freely for private communication among 1665related groups of clients. 1666</para> 1667 1668<sect3 id='The_PRIMARY_Selection'> 1669<title>The PRIMARY Selection</title> 1670<para> 1671The selection named by the atom PRIMARY is used for all commands 1672that take only a single argument and is the principal means of communication 1673between clients that use the selection mechanism. 1674</para> 1675</sect3> 1676 1677<sect3 id='The_SECONDARY_Selection'> 1678<title>The SECONDARY Selection</title> 1679<para> 1680The selection named by the atom SECONDARY is used: 1681</para> 1682<itemizedlist> 1683 <listitem> 1684 <para> 1685As the second argument to commands taking two arguments 1686(for example, "exchange primary and secondary selections") 1687 </para> 1688 </listitem> 1689 <listitem> 1690 <para> 1691As a means of obtaining data when there is a primary selection 1692and the user does not want to disturb it 1693 </para> 1694 </listitem> 1695</itemizedlist> 1696 1697</sect3> 1698<sect3 id='The_CLIPBOARD_Selection'> 1699<title>The CLIPBOARD Selection</title> 1700<para> 1701The selection named by the atom CLIPBOARD is used to hold data 1702that is being transferred between clients, 1703that is, data that usually is being cut and then pasted 1704or copied and then pasted. 1705Whenever a client wants to transfer data to the clipboard: 1706</para> 1707 1708<itemizedlist> 1709 <listitem> 1710 <para> 1711It should assert ownership of the CLIPBOARD. 1712 </para> 1713 </listitem> 1714 <listitem> 1715 <para> 1716If it succeeds in acquiring ownership, 1717it should be prepared to respond to a request for the contents of the CLIPBOARD 1718in the usual way (retaining the data to be able to return it). 1719The request may be generated by the clipboard client described below. 1720 </para> 1721 </listitem> 1722 <listitem> 1723 <para> 1724If it fails to acquire ownership, 1725a cutting client should not actually perform the cut or provide feedback 1726that would suggest that it has actually transferred data to the clipboard. 1727 </para> 1728 </listitem> 1729</itemizedlist> 1730 1731<para> 1732The owner should repeat this process whenever the data to be transferred 1733would change. 1734</para> 1735 1736<para> 1737Clients wanting to paste data from the clipboard should request 1738the contents of the CLIPBOARD selection in the usual way. 1739</para> 1740 1741<para> 1742Except while a client is actually deleting or copying data, 1743the owner of the CLIPBOARD selection may be a single, special client 1744implemented for the purpose. 1745This client maintains the content of the clipboard up-to-date 1746and responds to requests for data from the clipboard as follows: 1747</para> 1748 1749 1750<itemizedlist> 1751 <listitem> 1752 <para> 1753It should assert ownership of the CLIPBOARD selection 1754and reassert it any time the clipboard data changes. 1755 </para> 1756 </listitem> 1757 <listitem> 1758 <para> 1759If it loses the selection (because another client has some new data 1760for the clipboard), 1761it should: 1762 </para> 1763 <itemizedlist> 1764 <listitem> 1765 <para> 1766Obtain the contents of the selection from the new owner by using the timestamp 1767in the 1768<function>SelectionClear</function> 1769event. 1770 </para> 1771 </listitem> 1772 <listitem> 1773 <para> 1774Attempt to reassert ownership of the CLIPBOARD selection 1775by using the same timestamp. 1776 </para> 1777 </listitem> 1778 <listitem> 1779 <para> 1780Restart the process using a newly acquired timestamp if this attempt fails. 1781This timestamp should be obtained by asking the current owner of the 1782CLIPBOARD selection to convert it to a TIMESTAMP. 1783If this conversion is refused or if the same timestamp is received twice, 1784the clipboard client should acquire a fresh timestamp in the 1785usual way (for example by a zero-length append to a property). 1786 </para> 1787 </listitem> 1788 </itemizedlist> 1789 </listitem> 1790 <listitem> 1791 <para> 1792It should respond to requests for the CLIPBOARD contents in the usual way. 1793 </para> 1794 </listitem> 1795</itemizedlist> 1796 1797<para> 1798A special CLIPBOARD client is not necessary. 1799The protocol used by the cutting client and the pasting client 1800is the same whether the CLIPBOARD client is running or not. 1801The reasons for running the special client include: 1802</para> 1803 1804<itemizedlist> 1805 <listitem> 1806 <para> 1807Stability - If the cutting client were to crash or terminate, 1808the clipboard value would still be available. 1809 </para> 1810 </listitem> 1811 <listitem> 1812 <para> 1813Feedback - The clipboard client can display the contents of the clipboard. 1814 </para> 1815 </listitem> 1816 <listitem> 1817 <para> 1818Simplicity - A client deleting data does not have to retain it for so long, 1819thus reducing the chance of race conditions causing problems. 1820 </para> 1821 </listitem> 1822</itemizedlist> 1823 1824<para> 1825The reasons not to run the clipboard client include: 1826</para> 1827 1828<itemizedlist> 1829 <listitem> 1830 <para> 1831Performance - Data is transferred only if it is actually required 1832(that is, when some client actually wants the data). 1833 </para> 1834 </listitem> 1835 <listitem> 1836 <para> 1837Flexibility - The clipboard data may be available as more than one target. 1838 </para> 1839 </listitem> 1840</itemizedlist> 1841</sect3> 1842</sect2> 1843 1844<sect2 id='Target_Atoms'> 1845<title>Target Atoms</title> 1846<para> 1847The atom that a requestor supplies as the target of a 1848<function>ConvertSelection</function> 1849request determines the form of the data supplied. 1850The set of such atoms is extensible, 1851but a generally accepted base set of target atoms is needed. 1852As a starting point for this, 1853the following table contains those that have been suggested so far. 1854</para> 1855 1856<!-- 1857This table has very tricky formatting. Several targets are too long to 1858fit, so the table format needs to change around them. If the table 1859format changes, it will need to be changed in several places. There are 1860also two footnotes in this table, but the footnote text can't be 1861embedded in the table. This means that the auto-numbering needs to be 1862dinked around with after the end of the table. 1863--> 1864 1865<informaltable frame="topbot"> 1866 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 1867 <colspec colname='c1' colwidth='1.5*'/> 1868 <colspec colname='c2' colwidth='1.0*'/> 1869 <colspec colname='c3' colwidth='1.5*'/> 1870 <thead> 1871 <row rowsep='1'> 1872 <entry>Atom</entry> 1873 <entry>Type </entry> 1874 <entry>Data Received</entry> 1875 </row> 1876 </thead> 1877 <tbody> 1878 <row> 1879 <entry>ADOBE_PORTABLE_­DOCUMENT_­FORMAT</entry> 1880 <entry>STRING</entry> 1881 <entry>[1]</entry> 1882 </row> 1883 <row> 1884 <entry>APPLE_PICT</entry> 1885 <entry>APPLE_PICT</entry> 1886 <entry>[2]</entry> 1887 </row> 1888 <row> 1889 <entry>BACKGROUND</entry> 1890 <entry>PIXEL</entry> 1891 <entry>A list of pixel values</entry> 1892 </row> 1893 <row> 1894 <entry>BITMAP</entry> 1895 <entry>BITMAP</entry> 1896 <entry>A list of bitmap IDs</entry> 1897 </row> 1898 <row> 1899 <entry>CHARACTER_POSITION</entry> 1900 <entry>SPAN</entry> 1901 <entry>The start and end of the selection in bytes</entry> 1902 </row> 1903 <row> 1904 <entry>CLASS</entry> 1905 <entry>TEXT</entry> 1906 <entry>(see 1907<xref linkend='WM_CLASS_Property' xrefstyle='select: title'/>. 1908)</entry> <!-- xref --> 1909 </row> 1910 <row> 1911 <entry>CLIENT_WINDOW</entry> 1912 <entry>WINDOW</entry> 1913 <entry>Any top-level window owned by the selection owner</entry> 1914 </row> 1915 <row> 1916 <entry>COLORMAP</entry> 1917 <entry>COLORMAP</entry> 1918 <entry>A list of colormap IDs</entry> 1919 </row> 1920 <row> 1921 <entry>COLUMN_NUMBER</entry> 1922 <entry>SPAN</entry> 1923 <entry>The start and end column numbers</entry> 1924 </row> 1925 <row> 1926 <entry>COMPOUND_TEXT</entry> 1927 <entry>COMPOUND_TEXT</entry> 1928 <entry>Compound Text</entry> 1929 </row> 1930 <row> 1931 <entry>DELETE</entry> 1932 <entry>NULL</entry> 1933 <entry>(see 1934<xref linkend='DELETE' xrefstyle='select: title'/>. 1935)</entry> 1936 </row> 1937 <row> 1938 <entry>DRAWABLE</entry> 1939 <entry>DRAWABLE</entry> 1940 <entry>A list of drawable IDs</entry> 1941 </row> 1942 <row> 1943 <entry>ENCAPSULATED_POSTSCRIPT</entry> 1944 <entry>STRING</entry> 1945 <entry>[3], Appendix H 1946<footnote><para> 1947Earlier versions of this document erroneously specified that conversion of 1948the PIXMAP target returns a property of type DRAWABLE instead of PIXMAP. 1949Implementors should be aware of this and may want to support the DRAWABLE 1950type as well to allow for compatibility with older clients. 1951</para></footnote> 1952 </entry> 1953 </row> 1954 <row> 1955 <entry>ENCAPSULATED_POSTSCRIPT_­INTERCHANGE</entry> 1956 <entry>STRING</entry> 1957 <entry>[3], Appendix H</entry> 1958 </row> 1959 <row> 1960 <entry>FILE_NAME</entry> 1961 <entry>TEXT</entry> 1962 <entry>The full path name of a file</entry> 1963 </row> 1964 <row> 1965 <entry>FOREGROUND</entry> 1966 <entry>PIXEL</entry> 1967 <entry>A list of pixel values</entry> 1968 </row> 1969 <row> 1970 <entry>HOST_NAME</entry> 1971 <entry>TEXT</entry> 1972 <entry>(see 1973<xref linkend='WM_CLIENT_MACHINE_Property' xrefstyle='select: title'/>. 1974)</entry> 1975 </row> 1976 <row> 1977 <entry>INSERT_PROPERTY</entry> 1978 <entry>NULL</entry> 1979 <entry>(see 1980<xref linkend='INSERT_PROPERTY' xrefstyle='select: title'/>. 1981)</entry> 1982 </row> 1983 <row> 1984 <entry>INSERT_SELECTION</entry> 1985 <entry>NULL</entry> 1986 <entry>(see 1987<xref linkend='INSERT_SELECTION' xrefstyle='select: title'/>. 1988)</entry> 1989 </row> 1990 <row> 1991 <entry>LENGTH</entry> 1992 <entry>INTEGER</entry> 1993 <entry>The number of bytes in the selection 1994<footnote><para> 1995The targets ENCAPSULATED_POSTSCRIPT and ENCAPSULATED_POSTSCRIPT_INTERCHANGE 1996are equivalent to the targets _ADOBE_EPS and _ADOBE_EPSI (respectively) that 1997appear in the selection targets registry. The _ADOBE_ targets are 1998deprecated, but clients are encouraged to continue to support them for 1999backward compatibility. 2000</para></footnote> 2001 </entry> 2002 </row> 2003 <row> 2004 <entry>LINE_NUMBER</entry> 2005 <entry>SPAN</entry> 2006 <entry>The start and end line numbers</entry> 2007 </row> 2008 <row> 2009 <entry>LIST_LENGTH</entry> 2010 <entry>INTEGER</entry> 2011 <entry>The number of disjoint parts of the selection</entry> 2012 </row> 2013 <row> 2014 <entry>MODULE</entry> 2015 <entry>TEXT</entry> 2016 <entry>The name of the selected procedure</entry> 2017 </row> 2018 <row> 2019 <entry>MULTIPLE</entry> 2020 <entry>ATOM_PAIR</entry> 2021 <entry>(see the discussion that follows)</entry> 2022 </row> 2023 <row> 2024 <entry>NAME</entry> 2025 <entry>TEXT</entry> 2026 <entry>(see 2027<xref linkend='WM_NAME_Property' xrefstyle='select: title'/>. 2028)</entry> <!-- xref --> 2029 </row> 2030 <row> 2031 <entry>ODIF</entry> 2032 <entry>TEXT</entry> 2033 <entry>ISO Office Document Interchange Format</entry> 2034 </row> 2035 <row> 2036 <entry>OWNER_OS</entry> 2037 <entry>TEXT</entry> 2038 <entry>The operating system of the owner client</entry> 2039 </row> 2040 <row> 2041 <entry>PIXMAP</entry> 2042 <entry>PIXMAP 2043<footnote> 2044<para> 2045This definition is ambiguous, as the selection may be converted into any of 2046several targets that may return differing amounts of data. The requestor 2047has no way of knowing which, if any, of these targets corresponds to the 2048result of LENGTH. Clients are advised that no guarantees can be made about 2049the result of a conversion to LENGTH; its use is thus deprecated. 2050</para> 2051</footnote> 2052 </entry> 2053 <entry>A list of pixmap IDs</entry> 2054 </row> 2055 <row> 2056 <entry>POSTSCRIPT</entry> 2057 <entry>STRING</entry> 2058 <entry>[3]</entry> 2059 </row> 2060 <row> 2061 <entry>PROCEDURE</entry> 2062 <entry>TEXT</entry> 2063 <entry>The name of the selected procedure</entry> 2064 </row> 2065 <row> 2066 <entry>PROCESS</entry> 2067 <entry>INTEGER, TEXT</entry> 2068 <entry>The process ID of the owner</entry> 2069 </row> 2070 <row> 2071 <entry>STRING</entry> 2072 <entry>STRING</entry> 2073 <entry>ISO Latin-1 (+TAB+NEWLINE) text</entry> 2074 </row> 2075 <row> 2076 <entry>TARGETS</entry> 2077 <entry>ATOM</entry> 2078 <entry>A list of valid target atoms</entry> 2079 </row> 2080 <row> 2081 <entry>TASK</entry> 2082 <entry>INTEGER, TEXT</entry> 2083 <entry>The task ID of the owner</entry> 2084 </row> 2085 <row> 2086 <entry>TEXT</entry> 2087 <entry>TEXT</entry> 2088 <entry>The text in the owner's choice of encoding</entry> 2089 </row> 2090 <row> 2091 <entry>TIMESTAMP</entry> 2092 <entry>INTEGER</entry> 2093 <entry>The timestamp used to acquire the selection</entry> 2094 </row> 2095 <row> 2096 <entry>USER</entry> 2097 <entry>TEXT</entry> 2098 <entry>The name of the user running the owner</entry> 2099 </row> 2100 </tbody> 2101 </tgroup> 2102</informaltable> 2103 2104<!-- 2105Conditionalized on groff because 2106groff keeps track of footnotes and fn references separately, 2107so resetting isn't necessary (and referencing \n* gives a warning). 2108.if !\n(GS .nr * \n*-3 \" decrement by the number of footnotes in the table 2109.if 0 \{\ 2110HACK! There are several footnotes in the table above, each marked with the 2111construct "*". The actual footnote text is here, because I haven't found 2112a way to place it within the table itself. This causes a numbering problem, 2113because each * increments the footnote counter (number register *) and the 2114FS macro uses its current value. To get around this, we decrement the * 2115register by the number of footnotes in the table. Then, before calling each 2116FS macro, we increment the register. 2117 2118Also note that footnotes must appear within the T{ T} construct in tables. 2119If they don't, strange numbering problems will result, probably as a result 2120of multiple evaluation. 2121\} 2122 --> 2123 2124<!-- .\" These footnotes are in the wrong order because Sun tbl numbers the --> 2125<!-- .\" footnote references wrong in the above table. Thus this doesn't --> 2126<!-- .\" do the right thing with gtbl, which gets the order right. --> 2127<!-- .if !\n(GS .nr * +1 --> 2128<!-- .FS --> 2129<!-- .FE --> 2130<!-- .if !\n(GS .nr * +1 --> 2131<!-- .FS --> 2132<!-- .FE --> 2133<!-- .if !\n(GS .nr * +1 --> 2134<!-- .FS --> 2135<!-- .FE --> 2136 2137<para> 2138References: 2139</para> 2140 2141<orderedlist> 2142 <listitem> 2143 <para> 2144Adobe Systems, Incorporated. 2145<emphasis>Portable Document Format Reference Manual.</emphasis> 2146Reading, MA, Addison-Wesley, ISBN 0-201-62628-4. 2147 </para> 2148 </listitem> 2149 <listitem> 2150 <para> 2151Apple Computer, Incorporated. 2152<emphasis>Inside Macintosh, Volume V.</emphasis> 2153Chapter 4, "Color QuickDraw," Color Picture Format. 2154ISBN 0-201-17719-6. 2155 </para> 2156 </listitem> 2157 <listitem> 2158 <para> 2159Adobe Systems, Incorporated. 2160<emphasis>PostScript Language Reference Manual.</emphasis> 2161Reading, MA, Addison-Wesley, ISBN 0-201-18127-4. 2162 </para> 2163 </listitem> 2164</orderedlist> 2165 2166<para> 2167It is expected that this table will grow over time. 2168</para> 2169 2170<para> 2171Selection owners are required to support the following targets. 2172All other targets are optional. 2173</para> 2174 2175<itemizedlist> 2176 <listitem> 2177 <para> 2178TARGETS - The owner should return a list of atoms that represent 2179the targets for which an attempt to convert the current selection 2180will succeed (barring unforseeable problems such as 2181<function>Alloc</function> 2182errors). 2183This list should include all the required atoms. 2184 </para> 2185 </listitem> 2186 <listitem> 2187 <para> 2188MULTIPLE - The MULTIPLE target atom is valid only when a property 2189is specified on the 2190<function>ConvertSelection</function> 2191request. 2192If the property argument in the 2193<function>SelectionRequest</function> 2194event is 2195<function>None</function> 2196and the target is MULTIPLE, 2197it should be refused. 2198 </para> 2199 <para> 2200When a selection owner receives a 2201<function>SelectionRequest (target==MULTIPLE)</function> 2202request, 2203the contents of the property named in the request will be a list of atom pairs: 2204the first atom naming a target and the second naming a property 2205<function>( None</function> 2206is not valid here). 2207The effect should be as if the owner had received a sequence of 2208<function>SelectionRequest</function> 2209events (one for each atom pair) except that: 2210<!-- .RS --> 2211 </para> 2212 <itemizedlist> 2213 <listitem> 2214 <para> 2215The owner should reply with a 2216<function>SelectionNotify</function> 2217only when all the requested conversions have been performed. 2218 </para> 2219 </listitem> 2220 <listitem> 2221 <para> 2222If the owner fails to convert the target named by an atom 2223in the MULTIPLE property, 2224it should replace that atom in the property with 2225<function>None</function>. 2226 </para> 2227 </listitem> 2228 </itemizedlist> 2229 <blockquote><title>Convention</title> 2230 <para> 2231The entries in a MULTIPLE property must be processed in the order 2232they appear in the property. 2233For further information, 2234see 2235<xref linkend='Selection_Targets_with_Side_Effects' xrefstyle='select: title'/>. 2236 </para> 2237 </blockquote> 2238 <para> 2239The requestor should delete each individual property when it has 2240copied the data from that conversion, and the property specified in the 2241MULTIPLE request when it has copied all the data. 2242 </para> 2243 <para> 2244The requests are otherwise to be processed independently, and they 2245should succeed or fail independently. The MULTIPLE target is an 2246optimization that reduces the amount of protocol traffic between the 2247owner and the requestor; it is not a transaction mechanism. For 2248example, a client may issue a MULTIPLE request with two targets: a data 2249target and the DELETE target. The DELETE target will still be processed 2250even if the conversion of the data target fails. 2251 </para> 2252 </listitem> 2253 <listitem> 2254 <para> 2255TIMESTAMP - To avoid some race conditions, 2256it is important that requestors be able to discover the timestamp 2257the owner used to acquire ownership. 2258Until and unless the protocol is changed so that a 2259<function>GetSelectionOwner</function> 2260request returns the timestamp used to acquire ownership, 2261selection owners must support conversion to TIMESTAMP, 2262returning the timestamp they used to obtain the selection. 2263 </para> 2264 </listitem> 2265</itemizedlist> 2266</sect2> 2267 2268<sect2 id='Selection_Targets_with_Side_Effects'> 2269<title>Selection Targets with Side Effects</title> 2270<para> 2271Some targets (for example, DELETE) have side effects. 2272To render these targets unambiguous, 2273the entries in a MULTIPLE property must be processed in the order 2274that they appear in the property. 2275</para> 2276<para> 2277In general, 2278targets with side effects will return no information, 2279that is, they will return a zero length property of type NULL. 2280(Type NULL means the result of 2281<function>InternAtom</function> 2282on the string "NULL", not the value zero.) 2283In all cases, 2284the requested side effect must be performed before the conversion is accepted. 2285If the requested side effect cannot be performed, 2286the corresponding conversion request must be refused. 2287</para> 2288 2289<blockquote> 2290<title>Conventions</title> 2291 2292<itemizedlist> 2293 <listitem> 2294 <para> 2295Targets with side effects should return no information 2296(that is, they should have a zero-length property of type NULL). 2297 </para> 2298 </listitem> 2299 <listitem> 2300 <para> 2301The side effect of a target must be performed before the conversion is accepted. 2302 </para> 2303 </listitem> 2304 <listitem> 2305 <para> 2306If the side effect of a target cannot be performed, 2307the corresponding conversion request must be refused. 2308 </para> 2309 </listitem> 2310</itemizedlist> 2311</blockquote> 2312 2313<blockquote> 2314<title>Problem</title> 2315 2316<para> 2317The need to delay responding to the 2318<function>ConvertSelection</function> 2319request until a further conversion has succeeded poses problems 2320for the Intrinsics interface that need to be addressed. 2321</para> 2322</blockquote> 2323 2324<para> 2325These side-effect targets are used to implement operations such as 2326"exchange PRIMARY and SECONDARY selections." 2327</para> 2328 2329<sect3 id='DELETE'> 2330<title>DELETE</title> 2331<para> 2332When the owner of a selection receives a request to convert it to DELETE, 2333it should delete the corresponding selection 2334(whatever doing so means for its internal data structures) 2335and return a zero-length property of type NULL if the deletion was successful. 2336</para> 2337</sect3> 2338 2339<sect3 id='INSERT_SELECTION'> 2340<title>INSERT_SELECTION</title> 2341<para> 2342When the owner of a selection receives a request to convert it to 2343INSERT_SELECTION, 2344the property named will be of type ATOM_PAIR. 2345The first atom will name a selection, 2346and the second will name a target. 2347The owner should use the selection mechanism to convert the named selection 2348into the named target and should insert it at the location of the selection 2349for which it got the INSERT_SELECTION request 2350(whatever doing so means for its internal data structures). 2351</para> 2352</sect3> 2353<sect3 id='INSERT_PROPERTY'> 2354<title>INSERT_PROPERTY</title> 2355<para> 2356When the owner of a selection receives a request to convert it to 2357INSERT_PROPERTY, 2358it should insert the property named in the request at the location 2359of the selection for which it got the INSERT_SELECTION request 2360(whatever doing so means for its internal data structures). 2361</para> 2362</sect3> 2363</sect2> 2364</sect1> 2365 2366<sect1 id='Use_of_Selection_Properties'> 2367<title>Use of Selection Properties</title> 2368<para> 2369The names of the properties used in selection data transfer are chosen by 2370the requestor. 2371The use of 2372<function>None</function> 2373property fields in 2374<function>ConvertSelection</function> 2375requests (which request the selection owner to choose a name) 2376is not permitted by these conventions. 2377</para> 2378<para> 2379The selection owner always chooses the type of the property 2380in the selection data transfer. 2381Some types have special semantics assigned by convention, 2382and these are reviewed in the following sections. 2383</para> 2384<para> 2385In all cases, 2386a request for conversion to a target should return either 2387a property of one of the types listed in the previous table for that target 2388or a property of type INCR and then a property of one of the listed types. 2389</para> 2390<para> 2391Certain selection properties may contain resource IDs. The selection owner 2392should ensure that the resource is not destroyed and that its contents are 2393not changed until after the selection transfer is complete. Requestors that 2394rely on the existence or on the proper contents of a resource must operate 2395on the resource (for example, by copying the contents of a pixmap) before 2396deleting the selection property. 2397</para> 2398<para> 2399The selection owner will return a list of zero or more items 2400of the type indicated by the property type. 2401In general, 2402the number of items in the list will correspond to the number 2403of disjoint parts of the selection. 2404Some targets (for example, side-effect targets) will be of length zero 2405irrespective of the number of disjoint selection parts. 2406In the case of fixed-size items, 2407the requestor may determine the number of items by the property size. 2408Selection property types are listed in the table below. 2409For variable-length items such as text, 2410the separators are also listed. 2411</para> 2412 2413<informaltable frame="topbot"> 2414 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 2415 <colspec colname='c1' colwidth='1.5*'/> 2416 <colspec colname='c2' colwidth='1.0*'/> 2417 <colspec colname='c3' colwidth='3.0*'/> 2418 <thead> 2419 <row rowsep='1'> 2420 <entry>Type Atom</entry> 2421 <entry>Format</entry> 2422 <entry>Separator</entry> 2423 </row> 2424 </thead> 2425 <tbody> 2426 <row> 2427 <entry>APPLE_PICT</entry> 2428 <entry>8</entry> 2429 <entry>Self-sizing</entry> 2430 </row> 2431 <row> 2432 <entry>ATOM</entry> 2433 <entry>32</entry> 2434 <entry>Fixed-size</entry> 2435 </row> 2436 <row> 2437 <entry>ATOM_PAIR</entry> 2438 <entry>32</entry> 2439 <entry>Fixed-size</entry> 2440 </row> 2441 <row> 2442 <entry>BITMAP</entry> 2443 <entry>32</entry> 2444 <entry>Fixed-size</entry> 2445 </row> 2446 <row> 2447 <entry>C_STRING</entry> 2448 <entry>8</entry> 2449 <entry>Zero</entry> 2450 </row> 2451 <row> 2452 <entry>COLORMAP</entry> 2453 <entry>32</entry> 2454 <entry>Fixed-size</entry> 2455 </row> 2456 <row> 2457 <entry>COMPOUND_TEXT</entry> 2458 <entry>8</entry> 2459 <entry>Zero</entry> 2460 </row> 2461 <row> 2462 <entry>DRAWABLE</entry> 2463 <entry>32</entry> 2464 <entry>Fixed-size</entry> 2465 </row> 2466 <row> 2467 <entry>INCR</entry> 2468 <entry>32</entry> 2469 <entry>Fixed-size</entry> 2470 </row> 2471 <row> 2472 <entry>INTEGER</entry> 2473 <entry>32</entry> 2474 <entry>Fixed-size</entry> 2475 </row> 2476 <row> 2477 <entry>PIXEL</entry> 2478 <entry>32</entry> 2479 <entry>Fixed-size</entry> 2480 </row> 2481 <row> 2482 <entry>PIXMAP</entry> 2483 <entry>32</entry> 2484 <entry>Fixed-size</entry> 2485 </row> 2486 <row> 2487 <entry>SPAN</entry> 2488 <entry>32</entry> 2489 <entry>Fixed-size</entry> 2490 </row> 2491 <row> 2492 <entry>STRING</entry> 2493 <entry>8</entry> 2494 <entry>Zero</entry> 2495 </row> 2496 <row> 2497 <entry>WINDOW</entry> 2498 <entry>32</entry> 2499 <entry>Fixed-size</entry> 2500 </row> 2501 </tbody> 2502 </tgroup> 2503</informaltable> 2504 2505<para> 2506It is expected that this table will grow over time. 2507</para> 2508 2509<sect2 id='TEXT_Properties'> 2510<title>TEXT Properties</title> 2511<para> 2512In general, 2513the encoding for the characters in a text string property is specified 2514by its type. 2515It is highly desirable for there to be a simple, invertible mapping 2516between string property types and any character set names 2517embedded within font names in any font naming standard adopted by the 2518Consortium. 2519</para> 2520 2521<para> 2522The atom TEXT is a polymorphic target. 2523Requesting conversion into TEXT will convert into whatever encoding 2524is convenient for the owner. 2525The encoding chosen will be indicated by the type of the property returned. 2526TEXT is not defined as a type; 2527it will never be the returned type from a selection conversion request. 2528</para> 2529 2530<para> 2531If the requestor wants the owner to return the contents of the selection 2532in a specific encoding, 2533it should request conversion into the name of that encoding. 2534</para> 2535 2536<para> 2537In the table in 2538<xref linkend='Target_Atoms' xrefstyle='select: title'/>, 2539the word TEXT (in the Type column) is used to indicate one 2540of the registered encoding names. 2541The type would not actually be TEXT; 2542it would be STRING or some other ATOM naming the encoding chosen by the owner. 2543</para> 2544 2545<para> 2546STRING as a type or a target specifies the ISO Latin-1 character set plus the 2547control characters TAB (octal 11) and NEWLINE (octal 12). 2548The spacing interpretation of TAB is context dependent. 2549Other ASCII control characters are explicitly not included in STRING 2550at the present time. 2551</para> 2552 2553<para> 2554COMPOUND_TEXT as a type or a target specifies the Compound Text interchange 2555format; see the 2556<emphasis remap='I'>Compound Text Encoding</emphasis>. <!-- xref --> 2557</para> 2558 2559<para> 2560<!-- .LP --> 2561There are some text objects where the source or intended user, as the 2562case may be, does not have a specific character set for the text, but 2563instead merely requires a zero-terminated sequence of bytes with no 2564other restriction; no element of the selection mechanism may assume that 2565any byte value is forbidden or that any two differing sequences are 2566equivalent. 2567 <footnote> 2568 <para> 2569Note that this is different from STRING, where many byte values are 2570forbidden, and from COMPOUND_TEXT, where, for example, inserting the 2571sequence 27,\ 40,\ 66 (designate ASCII into GL) at the start does not alter 2572the meaning. 2573 </para> 2574 </footnote> 2575 For these objects, the type C_STRING should be used. 2576</para> 2577<blockquote> 2578<title>Rationale</title> 2579<para> 2580An example of the need for C_STRING is to transmit the names of 2581files; many operating systems do not interpret filenames as having 2582a character set. For example, the same character string uses a 2583different sequence of bytes in ASCII and EBCDIC, and so most 2584operating systems see these as different filenames and offer no 2585way to treat them as the same. Thus no character-set based 2586property type is suitable. 2587</para> 2588</blockquote> 2589 2590<para> 2591Type STRING, COMPOUND_TEXT, and C_STRING properties will consist of a list 2592of elements separated by null characters; other encodings will need to 2593specify an appropriate list format. 2594</para> 2595</sect2> 2596 2597<sect2 id='INCR_Properties'> 2598<title>INCR Properties</title> 2599<para> 2600Requestors may receive a property of type INCR 2601<footnote> 2602<para> 2603These properties were called INCREMENTAL in an earlier draft. 2604The protocol for using them has changed, 2605and so the name has changed to avoid confusion. 2606</para> 2607</footnote> 2608in response to any target that results in selection data. 2609</para> 2610<para> 2611This indicates that the owner will send the actual data incrementally. 2612The contents of the INCR property will be an integer, 2613which represents a lower bound on the number of bytes of data in the selection. 2614The requestor and the selection owner transfer the data in the selection 2615in the following manner. 2616</para> 2617<para> 2618The selection requestor starts the transfer process by deleting 2619the (type==INCR) property forming the reply to the selection. 2620</para> 2621<para> 2622The selection owner then: 2623</para> 2624 2625<itemizedlist> 2626 <listitem> 2627 <para> 2628Appends the data in suitable-size chunks to the 2629same property on the same window as the selection reply 2630with a type corresponding to the actual type of the converted selection. 2631The size should be less than the maximum-request-size in the connection 2632handshake. 2633 </para> 2634 </listitem> 2635 <listitem> 2636 <para> 2637Waits between each append for a 2638<function>PropertyNotify</function> 2639(state==Deleted) event that shows that the requestor has read the data. 2640The reason for doing this is to limit the consumption of space in the server. 2641 </para> 2642 </listitem> 2643 <listitem> 2644 <para> 2645Waits (after the entire data has been transferred to the server) until a 2646<function>PropertyNotify</function> 2647(state==Deleted) 2648event that shows that the data has been read by the requestor 2649and then writes zero-length data to the property. 2650 </para> 2651 </listitem> 2652</itemizedlist> 2653 2654<para> 2655The selection requestor: 2656</para> 2657 2658<itemizedlist> 2659 <listitem> 2660 <para> 2661Waits for the 2662<function>SelectionNotify</function> 2663event. 2664 </para> 2665 </listitem> 2666 <listitem> 2667 <para> 2668Loops: 2669 </para> 2670 <itemizedlist> 2671 <listitem> 2672 <para> 2673Retrieving data using 2674<function>GetProperty</function> 2675with the delete argument 2676<function>True</function>. 2677 </para> 2678 </listitem> 2679 <listitem> 2680 <para> 2681Waiting for a 2682<function>PropertyNotify</function> 2683with the state argument 2684<function>NewValue</function>. 2685 </para> 2686 </listitem> 2687 </itemizedlist> 2688 </listitem> 2689 <listitem> 2690 <para> 2691Waits until the property named by the 2692<function>PropertyNotify</function> 2693event is zero-length. 2694 </para> 2695 </listitem> 2696 <listitem> 2697 <para> 2698Deletes the zero-length property. 2699 </para> 2700 </listitem> 2701</itemizedlist> 2702 2703<para> 2704The type of the converted selection is the type of the first partial property. 2705The remaining partial properties must have the same type. 2706</para> 2707</sect2> 2708 2709<sect2 id='DRAWABLE_Properties'> 2710<title>DRAWABLE Properties</title> 2711<para> 2712Requestors may receive properties of type PIXMAP, BITMAP, DRAWABLE, or WINDOW, 2713which contain an appropriate ID. 2714While information about these drawables is available from the server by means of 2715the 2716<function>GetGeometry</function> request, 2717the following items are not: 2718</para> 2719 2720<itemizedlist> 2721 <listitem> 2722 <para> 2723Foreground pixel 2724 </para> 2725 </listitem> 2726 <listitem> 2727 <para> 2728Background pixel 2729 </para> 2730 </listitem> 2731 <listitem> 2732 <para> 2733Colormap ID 2734 </para> 2735 </listitem> 2736</itemizedlist> 2737 2738<para> 2739In general, 2740requestors converting into targets whose returned type in the table in 2741<xref linkend='Target_Atoms' xrefstyle='select: title'/> 2742is one of the DRAWABLE types should expect to convert also 2743into the following targets (using the MULTIPLE mechanism): 2744</para> 2745 2746 2747<itemizedlist> 2748 <listitem> 2749 <para> 2750FOREGROUND returns a PIXEL value. 2751 </para> 2752 </listitem> 2753 <listitem> 2754 <para> 2755BACKGROUND returns a PIXEL value. 2756 </para> 2757 </listitem> 2758 <listitem> 2759 <para> 2760COLORMAP returns a colormap ID. 2761 </para> 2762 </listitem> 2763</itemizedlist> 2764 2765</sect2> 2766 2767<sect2 id='SPAN_Properties'> 2768<title>SPAN Properties</title> 2769<para> 2770Properties with type SPAN contain a list of cardinal-pairs 2771with the length of the cardinals determined by the format. 2772The first specifies the starting position, 2773and the second specifies the ending position plus one. 2774The base is zero. 2775If they are the same, 2776the span is zero-length and is before the specified position. 2777The units are implied by the target atom, 2778such as LINE_NUMBER or CHARACTER_POSITION. 2779</para> 2780</sect2> 2781</sect1> 2782 2783<sect1 id='Manager_Selections'> 2784<title>Manager Selections</title> 2785<para> 2786Certain clients, often called managers, take on responsibility 2787for managing shared resources. A client that manages a shared 2788resource should take ownership of an appropriate selection, 2789named using the conventions described in 2790<xref linkend='Naming_Conventions' xrefstyle='select: title'/> 2791and 2792<xref linkend='Discriminated_Names' xrefstyle='select: title'/>. 2793A client that manages multiple 2794shared resources (or groups of resources) should take 2795ownership of a selection for each one. 2796</para> 2797<para> 2798The manager may support conversion of various targets 2799for that selection. Managers are encouraged to use this 2800technique as the primary means by which clients interact 2801with the managed resource. Note that the conventions for 2802interacting with the window manager predate this section; 2803as a result many interactions with the window manager use 2804other techniques. 2805</para> 2806<para> 2807Before a manager takes ownership of a manager selection, it 2808should use the 2809<function>GetSelectionOwner</function> 2810request to check whether the selection is already owned by another client, 2811and, where appropriate, it should ask the user if the new manager should 2812replace the old one. If so, it may then take ownership of the selection. 2813Managers should acquire the selection using a window created expressly for 2814this purpose. Managers must conform to the rules for selection owners 2815described in 2816<xref linkend='Acquiring_Selection_Ownership' xrefstyle='select: title'/> 2817and 2818<xref linkend='Responsibilities_of_the_Selection_Owner' xrefstyle='select: title'/> 2819, and they must also support the required 2820targets listed in 2821<xref linkend='Use_of_Selection_Atoms' xrefstyle='select: title'/>. 2822</para> 2823 2824<para> 2825If a manager loses ownership of a manager selection, this 2826means that a new manager is taking over its responsibilities. 2827The old manager must release all resources it has managed 2828and must then destroy the window that owned the selection. 2829For example, a window manager losing ownership of WM_S2 2830must deselect from 2831<function>SubstructureRedirect</function> 2832on the root window of screen 2 before destroying the window that owned 2833WM_S2. 2834</para> 2835 2836<para> 2837When the new manager notices that the window owning the selection 2838has been destroyed, it knows that it can successfully proceed to 2839control the resource it is planning to manage. If the old 2840manager does not destroy the window within a reasonable time, 2841the new manager should check with the user before destroying 2842the window itself or killing the old manager. 2843</para> 2844<para> 2845<!-- .LP --> 2846If a manager wants to give up, on its own, management of a shared 2847resource controlled by a selection, it must do so by releasing 2848the resources it is managing and then by destroying the 2849window that owns the selection. It should not first disown 2850the selection, since this introduces a race condition. 2851</para> 2852<para> 2853<!-- .LP --> 2854Clients who are interested in knowing when the owner of a 2855manager selection is no longer managing the corresponding shared 2856resource should select for 2857<function>StructureNotify</function> 2858on the window owning the selection so they can be notified when the window 2859is destroyed. Clients are warned that after doing a 2860<function>GetSelectionOwner</function> 2861and selecting for 2862<function>StructureNotify</function>, 2863they should do a 2864<function>GetSelectionOwner</function> 2865again to ensure that the owner did not change after initially getting the 2866selection owner and before selecting for 2867<function>StructureNotify</function>. 2868</para> 2869 2870<para> 2871Immediately after a manager successfully acquires ownership of a 2872manager selection, it should announce its arrival by sending a 2873<function>ClientMessage</function> 2874event. This event should be sent using the 2875<function>SendEvent</function> 2876protocol request with the following arguments: 2877</para> 2878 2879<!-- .br --> 2880<!-- .ne 6 --> 2881<informaltable frame="topbot"> 2882 <tgroup cols='2' align='left' colsep='0' rowsep='0'> 2883 <colspec colname='c1' colwidth='1.0*'/> 2884 <colspec colname='c2' colwidth='3.0*'/> 2885 <thead> 2886 <row rowsep='1'> 2887 <entry>Argument</entry> 2888 <entry>Value</entry> 2889 </row> 2890 </thead> 2891 <tbody> 2892 <row> 2893 <entry>destination:</entry> 2894 <entry> 2895the root window of screen 0, or the root 2896window of the appropriate screen if the 2897manager is managing a screen-specific resource</entry> 2898 </row> 2899 <row> 2900 <entry>propogate:</entry> 2901 <entry>False</entry> 2902 </row> 2903 <row> 2904 <entry>event-mask:</entry> 2905 <entry><function>StructureNotify</function></entry> 2906 </row> 2907 <row> 2908 <entry>event:</entry> 2909 <entry><function>ClientMessage</function></entry> 2910 </row> 2911 <row> 2912 <entry> type:</entry> 2913 <entry>MANAGER</entry> 2914 </row> 2915 <row> 2916 <entry> format:</entry> 2917 <entry>32</entry> 2918 </row> 2919 <row> 2920 <entry> data[0] 2921<footnote> 2922<para> 2923We use the notation data[n] to indicate the n 2924<superscript>th</superscript> element 2925of the LISTofINT8, LISTofINT16, or LISTofINT32 in the data field of the 2926<function>ClientMessage</function>, 2927according to the format field. 2928The list is indexed from zero. 2929</para> 2930</footnote> 2931 </entry> 2932 <entry>timestamp</entry> 2933 </row> 2934 <row> 2935 <entry> data[1]:</entry> 2936 <entry>manager selection atom</entry> 2937 </row> 2938 <row> 2939 <entry> data[2]:</entry> 2940 <entry>the window owning the selection</entry> 2941 </row> 2942 <row> 2943 <entry> data[3]:</entry> 2944 <entry>manager-selection-specific data</entry> 2945 </row> 2946 <row> 2947 <entry> data[4]:</entry> 2948 <entry>manager-selection-specific data</entry> 2949 </row> 2950 </tbody> 2951 </tgroup> 2952</informaltable> 2953 2954<para> 2955Clients that wish to know when a specific manager has started should 2956select for 2957<function>StructureNotify</function> 2958on the appropriate root window and should watch for the appropriate MANAGER 2959<function>ClientMessage</function>. 2960</para> 2961</sect1> 2962</chapter> 2963 2964<chapter id='Peer_to_Peer_Communication_by_Means_of_Cut_Buffers'> 2965<title>Peer-to-Peer Communication by Means of Cut Buffers</title> 2966<para> 2967The cut buffer mechanism is much simpler but much less powerful 2968than the selection mechanism. 2969The selection mechanism is active in that it provides a link 2970between the owner and requestor clients. 2971The cut buffer mechanism is passive; 2972an owner places data in a cut buffer from which a requestor retrieves 2973the data at some later time. 2974</para> 2975 2976<para> 2977The cut buffers consist of eight properties on the root of screen zero, 2978named by the predefined atoms CUT_BUFFER0 to CUT_BUFFER7. 2979These properties must, at present, have type STRING and format 8. 2980A client that uses the cut buffer mechanism must initially ensure that 2981all eight properties exist by using 2982<function>ChangeProperty</function> 2983requests to append zero-length data to each. 2984</para> 2985 2986<para> 2987A client that stores data in the cut buffers (an owner) first must rotate the 2988ring of buffers by plus 1 by using 2989<function>RotateProperties</function> 2990requests to rename each buffer; 2991that is, CUT_BUFFER0 to CUT_BUFFER1, CUT_BUFFER1 to CUT_BUFFER2, ..., 2992and CUT_BUFFER7 to CUT_BUFFER0. 2993It then must store the data into CUT_BUFFER0 by using a 2994<function>ChangeProperty</function> 2995request in mode 2996<olink targetdoc='libXaw' targetptr='Replace'><function>Replace</function></olink>. 2997</para> 2998 2999<para> 3000A client that obtains data from the cut buffers should use a 3001<function>GetProperty</function> 3002request to retrieve the contents of CUT_BUFFER0. 3003</para> 3004 3005<para> 3006In response to a specific user request, 3007a client may rotate the cut buffers by minus 1 by using 3008<function>RotateProperties</function> 3009requests to rename each buffer; 3010that is, CUT_BUFFER7 to CUT_BUFFER6, CUT_BUFFER6 to CUT_BUFFER5, ..., 3011and CUT_BUFFER0 to CUT_BUFFER7. 3012</para> 3013 3014<para> 3015Data should be stored to the cut buffers 3016and the ring rotated only when requested by explicit user action. 3017Users depend on their mental model of cut buffer operation 3018and need to be able to identify operations that transfer data to and fro. 3019</para> 3020</chapter> 3021 3022<chapter id='Client_to_Window_Manager_Communication'> 3023<title>Client-to-Window-Manager Communication</title> 3024<para> 3025To permit window managers to perform their role of mediating the competing 3026demands for resources such as screen space, 3027the clients being managed must adhere to certain conventions 3028and must expect the window managers to do likewise. 3029These conventions are covered here from the client's point of view. 3030</para> 3031<para> 3032In general, 3033these conventions are somewhat complex 3034and will undoubtedly change as new window management paradigms are developed. 3035Thus, there is a strong bias toward defining only those conventions 3036that are essential and that apply generally to all window management paradigms. 3037Clients designed to run with a particular window manager can easily 3038define private protocols to add to these conventions, 3039but they must be aware that their users may decide to run some other 3040window manager no matter how much the designers of the private protocol 3041are convinced that they have seen the "one true light" of user interfaces. 3042</para> 3043<para> 3044It is a principle of these conventions that a general client should 3045neither know nor care which window manager is running or, indeed, 3046if one is running at all. 3047The conventions do not support all client functions 3048without a window manager running; 3049for example, the concept of Iconic 3050is not directly supported by clients. 3051If no window manager is running, 3052the concept of Iconic does not apply. 3053A goal of the conventions is to make it possible to kill and 3054restart window managers without loss of functionality. 3055</para> 3056<para> 3057Each window manager will implement a particular window management policy; 3058the choice of an appropriate window management policy 3059for the user's circumstances is not one for an individual client to 3060make but will be made by the user or the user's system administrator. 3061This does not exclude the possibility of writing clients that 3062use a private protocol to restrict themselves to operating only 3063under a specific window manager. 3064Rather, 3065it merely ensures that no claim of general utility is made for such programs. 3066</para> 3067 3068<para> 3069For example, 3070the claim is often made: 3071"The client I'm writing is important, and it needs to be on top." 3072Perhaps it is important when it is being run in earnest, 3073and it should then be run under the control of a window manager 3074that recognizes "important" windows through some private protocol 3075and ensures that they are on top. 3076However, imagine, for example, that the "important" client is being debugged. 3077Then, ensuring that it is always on top is no longer 3078the appropriate window management policy, 3079and it should be run under a window manager that allows other windows 3080(for example, the debugger) to appear on top. 3081</para> 3082 3083<sect1 id='Clients_Actions'> 3084<title>Client's Actions</title> 3085<para> 3086In general, 3087the object of the X Version 11 design is that clients should, 3088as far as possible, do exactly what they would do in the absence 3089of a window manager, except for the following: 3090</para> 3091<itemizedlist> 3092 <listitem> 3093 <para> 3094Hinting to the window manager about the resources they would like 3095to obtain 3096 </para> 3097 </listitem> 3098 <listitem> 3099 <para> 3100Cooperating with the window manager by accepting the resources they 3101are allocated even if they are not those requested 3102 </para> 3103 </listitem> 3104 <listitem> 3105 <para> 3106Being prepared for resource allocations to change at any time 3107 </para> 3108 </listitem> 3109</itemizedlist> 3110 3111<sect2 id='Creating_a_Top_Level_Window'> 3112<title>Creating a Top-Level Window</title> 3113<para> 3114A client's 3115<emphasis remap='I'>top-level window</emphasis> is a window whose 3116override-redirect attribute is 3117<function>False</function>. 3118It must either be a child of a root window, or it must have been a child of 3119a root window immediately prior to having been reparented by the window 3120manager. If the client reparents the window away from the root, the window 3121is no longer a top-level window; but it can become a top-level window again 3122if the client reparents it back to the root. 3123</para> 3124<para> 3125A client usually would expect to create its top-level windows 3126as children of one or more of the root windows by using some 3127boilerplate like the following: 3128</para> 3129 3130<literallayout class="monospaced"> 3131win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), xsh.x, xsh.y, 3132 xsh.width, xsh.height, bw, bd, bg); 3133</literallayout> 3134 3135<para> 3136If a particular one of the root windows was required, however, 3137it could use something like the following: 3138</para> 3139 3140<literallayout class="monospaced"> 3141win = XCreateSimpleWindow(dpy, RootWindow(dpy, screen), xsh.x, xsh.y, 3142 xsh.width, xsh.height, bw, bd, bg); 3143</literallayout> 3144 3145<para> 3146Ideally, 3147it should be possible to override the choice of a root window 3148and allow clients (including window managers) to treat a nonroot window 3149as a pseudo-root. 3150This would allow, for example, the testing of window managers and the 3151use of application-specific window managers to control the subwindows 3152owned by the members of a related suite of clients. 3153Doing so properly requires an extension, 3154the design of which is under study. 3155</para> 3156 3157<para> 3158From the client's point of view, 3159the window manager will regard its top-level window as being in 3160one of three states: 3161</para> 3162 3163<itemizedlist> 3164 <listitem> 3165 <para> 3166Normal 3167 </para> 3168 </listitem> 3169 <listitem> 3170 <para> 3171Iconic 3172 </para> 3173 </listitem> 3174 <listitem> 3175 <para> 3176Withdrawn 3177 </para> 3178 </listitem> 3179</itemizedlist> 3180 3181<para> 3182Newly created windows start in the Withdrawn state. 3183Transitions between states happen when the top-level window is mapped 3184and unmapped and when the window manager receives certain messages. 3185For further details, see 3186<xref linkend='WM_HINTS_Property' xrefstyle='select: title'/>. 3187 and 3188<xref linkend='Changing_Window_State' xrefstyle='select: title'/>. 3189</para> 3190</sect2> 3191 3192<sect2 id='Client_Properties'> 3193<title>Client Properties</title> 3194<para> 3195Once the client has one or more top-level windows, 3196it should place properties on those windows to inform the window manager 3197of the behavior that the client desires. 3198Window managers will assume values they find convenient 3199for any of these properties that are not supplied; 3200clients that depend on particular values must explicitly supply them. 3201The window manager will not change properties written by the client. 3202</para> 3203<para> 3204The window manager will examine the contents of these 3205properties when the window makes the transition from the Withdrawn state 3206and will monitor some properties for changes while the window is 3207in the Iconic or Normal state. 3208When the client changes one of these properties, 3209it must use 3210<olink targetdoc='libXaw' targetptr='Replace'><function>Replace</function></olink> 3211mode to overwrite the entire property with new data; 3212the window manager will retain no memory of the old value of the property. 3213All fields of the property must be set to suitable values in a single 3214<olink targetdoc='libXaw' targetptr='Replace'><function>Replace</function></olink> 3215mode <function>ChangeProperty</function> 3216request. 3217This ensures that the full contents of the property will be 3218available to a new window manager if the existing one crashes, 3219if it is shut down and restarted, 3220or if the session needs to be shut down and restarted by the session manager. 3221</para> 3222 3223<blockquote><title>Convention</title> 3224<para> 3225Clients writing or rewriting window manager properties must 3226ensure that the entire content of each property remains valid 3227at all times. 3228</para> 3229</blockquote> 3230 3231<para> 3232Some of these properties may contain the IDs of resources, such as 3233windows or pixmaps. Clients should ensure that these resources exist 3234for at least as long as the window on which the property resides. 3235</para> 3236<para> 3237If these properties are longer than expected, 3238clients should ignore the remainder of the property. 3239Extending these properties is reserved to the X Consortium; 3240private extensions to them are forbidden. 3241Private additional communication between clients and window managers 3242should take place using separate properties. 3243The only exception to this rule is the WM_PROTOCOLS property, which may be 3244of arbitrary length and which may contain atoms representing private 3245protocols (see 3246<xref linkend='WM_PROTOCOLS_Property' xrefstyle='select: title'/> 3247). 3248</para> 3249 3250<para> 3251The next sections describe each of the properties the clients 3252need to set, in turn. 3253They are summarized in the table in 3254<xref linkend='Summary_of_Window_Manager_Property_Types' xrefstyle='select: title'/> 3255 3256</para> 3257 3258<sect3 id='WM_NAME_Property'> 3259<title>WM_NAME Property</title> 3260<para> 3261The WM_NAME property is an uninterpreted string 3262that the client wants the window manager to display 3263in association with the window (for example, in a window headline bar). 3264</para> 3265<para> 3266The encoding used for this string 3267(and all other uninterpreted string properties) 3268is implied by the type of the property. 3269The type atoms to be used for this purpose are described in 3270<xref linkend='TEXT_Properties' xrefstyle='select: title'/>. 3271</para> 3272 3273<para> 3274Window managers are expected to make an effort to display this information. 3275Simply ignoring WM_NAME is not acceptable behavior. 3276Clients can assume that at least the first part of this string 3277is visible to the user and that if the information is not visible to the user, 3278it is because the user has taken an explicit action to make it invisible. 3279</para> 3280 3281<para> 3282On the other hand, 3283there is no guarantee that the user can see the WM_NAME string 3284even if the window manager supports window headlines. 3285The user may have placed the headline off-screen 3286or have covered it by other windows. 3287WM_NAME should not be used for application-critical information 3288or to announce asynchronous changes of an application's state 3289that require timely user response. 3290The expected uses are to permit the user to identify one of a 3291number of instances of the same client 3292and to provide the user with noncritical state information. 3293</para> 3294 3295<para> 3296Even window managers that support headline bars will place some limit 3297on the length of the WM_NAME string that can be visible; 3298brevity here will pay dividends. 3299</para> 3300</sect3> 3301 3302<sect3 id='WM_ICON_NAME_Property'> 3303<title>WM_ICON_NAME Property</title> 3304<para> 3305The WM_ICON_NAME property is an uninterpreted string 3306that the client wants to be displayed in association with the window 3307when it is iconified (for example, in an icon label). 3308In other respects, 3309including the type, it is similar to WM_NAME. 3310For obvious geometric reasons, 3311fewer characters will normally be visible in WM_ICON_NAME than WM_NAME. 3312</para> 3313 3314<para> 3315Clients should not attempt to display this string in their icon pixmaps 3316or windows; rather, they should rely on the window manager to do so. 3317</para> 3318</sect3> 3319 3320<sect3 id='WM_NORMAL_HINTS_Property'> 3321<title>WM_NORMAL_HINTS Property</title> 3322<para> 3323The type of the WM_NORMAL_HINTS property is WM_SIZE_HINTS. 3324Its contents are as follows: 3325</para> 3326 3327<informaltable frame="topbot"> 3328 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 3329 <colspec colname='c1' colwidth='1.0*'/> 3330 <colspec colname='c2' colwidth='1.0*'/> 3331 <colspec colname='c3' colwidth='1.0*'/> 3332 <thead> 3333 <row rowsep='1'> 3334 <entry>Field</entry> 3335 <entry>Type</entry> 3336 <entry>Comments</entry> 3337 </row> 3338 </thead> 3339 <tbody> 3340 <row> 3341 <entry>flags</entry> 3342 <entry>CARD32</entry> 3343 <entry>(see the next table)</entry> 3344 </row> 3345 <row> 3346 <entry>pad</entry> 3347 <entry>4*CARD32</entry> 3348 <entry>For backwards compatibility</entry> 3349 </row> 3350 <row> 3351 <entry>min_width</entry> 3352 <entry>INT32</entry> 3353 <entry>If missing, assume base_width</entry> 3354 </row> 3355 <row> 3356 <entry>min_height</entry> 3357 <entry>INT32</entry> 3358 <entry>If missing, assume base_height</entry> 3359 </row> 3360 <row> 3361 <entry>max_width</entry> 3362 <entry>INT32</entry> 3363 </row> 3364 <row> 3365 <entry>max_height</entry> 3366 <entry>INT32</entry> 3367 </row> 3368 <row> 3369 <entry>width_inc</entry> 3370 <entry>INT32</entry> 3371 </row> 3372 <row> 3373 <entry>height_inc</entry> 3374 <entry>INT32</entry> 3375 </row> 3376 <row> 3377 <entry>min_aspect</entry> 3378 <entry>(INT32,INT32)</entry> 3379 </row> 3380 <row> 3381 <entry>max_aspect</entry> 3382 <entry>(INT32,INT32)</entry> 3383 </row> 3384 <row> 3385 <entry>base_width</entry> 3386 <entry>INT32</entry> 3387 <entry>If missing, assume min_width</entry> 3388 </row> 3389 <row> 3390 <entry>base_height</entry> 3391 <entry>INT32</entry> 3392 <entry>If missing, assume min_height</entry> 3393 </row> 3394 <row> 3395 <entry>win_gravity</entry> 3396 <entry>INT32</entry> 3397 <entry>If missing, assume <function>NorthWest</function></entry> 3398 </row> 3399 </tbody> 3400 </tgroup> 3401</informaltable> 3402 3403<para> 3404The WM_SIZE_HINTS.flags bit definitions are as follows: 3405</para> 3406 3407<informaltable frame="topbot"> 3408 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 3409 <colspec colname='c1' colwidth='2.0*'/> 3410 <colspec colname='c2' colwidth='1.0*'/> 3411 <colspec colname='c3' colwidth='3.0*'/> 3412 <thead> 3413 <row rowsep='1'> 3414 <entry>Name</entry> 3415 <entry>Value</entry> 3416 <entry>Field</entry> 3417 </row> 3418 </thead> 3419 <tbody> 3420 <row> 3421 <entry><function>USPosition</function></entry> 3422 <entry>1</entry> 3423 <entry>User-specified x, y</entry> 3424 </row> 3425 <row> 3426 <entry><function>USSize</function></entry> 3427 <entry>2</entry> 3428 <entry>User-specified width, height</entry> 3429 </row> 3430 <row> 3431 <entry><function>PPosition</function></entry> 3432 <entry>4</entry> 3433 <entry>Program-specified position</entry> 3434 </row> 3435 <row> 3436 <entry><function>PSize</function></entry> 3437 <entry>8</entry> 3438 <entry>Program-specified size</entry> 3439 </row> 3440 <row> 3441 <entry><function>PMinSize</function></entry> 3442 <entry>16</entry> 3443 <entry>Program-specified minimum size</entry> 3444 </row> 3445 <row> 3446 <entry><function>PMaxSize</function></entry> 3447 <entry>32</entry> 3448 <entry>Program-specified maximum size</entry> 3449 </row> 3450 <row> 3451 <entry><function>PResizeInc</function></entry> 3452 <entry>64</entry> 3453 <entry>Program-specified resize increments</entry> 3454 </row> 3455 <row> 3456 <entry><function>PAspect</function></entry> 3457 <entry>128</entry> 3458 <entry>Program-specified min and max aspect ratios</entry> 3459 </row> 3460 <row> 3461 <entry><function>PBaseSize</function></entry> 3462 <entry>256</entry> 3463 <entry>Program-specified base size</entry> 3464 </row> 3465 <row> 3466 <entry><function>PWinGravity</function></entry> 3467 <entry>512</entry> 3468 <entry>Program-specified window gravity</entry> 3469 </row> 3470 </tbody> 3471 </tgroup> 3472</informaltable> 3473 3474<para> 3475To indicate that the size and position of the window 3476(when a transition from the Withdrawn state occurs) was specified by the user, 3477the client should set the 3478<function>USPosition</function> 3479and 3480<function>USSize</function> 3481flags, 3482which allow a window manager to know that the user specifically asked where 3483the window should be placed or how the window should be sized and that 3484further interaction is superfluous. 3485To indicate that it was specified by the client without any user involvement, 3486the client should set 3487<function>PPosition</function> 3488and 3489<function>PSize</function>. 3490</para> 3491 3492<para> 3493The size specifiers refer to the width and height of the client's 3494window excluding borders. 3495</para> 3496 3497<para> 3498The win_gravity may be any of the values specified for WINGRAVITY in 3499the core protocol except for 3500<function>Unmap</function>: 3501<function>NorthWest</function> 3502(1), 3503<function>North</function> 3504(2), 3505<function>NorthEast</function> 3506(3), 3507<function>West</function> 3508(4), 3509<function>Center</function> 3510(5), 3511<function>East</function> 3512(6), 3513<function>SouthWest</function> 3514(7), 3515<function>South</function> 3516(8), and 3517<function>SouthEast</function> 3518(9). It specifies how and whether the client window wants to be shifted to 3519make room for the window manager frame. 3520</para> 3521 3522<para> 3523If the win_gravity is 3524<function>Static</function>, 3525the window manager frame is positioned 3526so that the inside border of the client window inside the frame is 3527in the same position on the screen as it was when the client 3528requested the transition from Withdrawn state. Other values of 3529win_gravity specify a window reference point. For 3530<function>NorthWest</function>, 3531<function>NorthEast</function>, 3532<function>SouthWest</function>, 3533and 3534<function>SouthEast</function> 3535the reference point is the specified outer corner of the window (on the 3536outside border edge). For 3537<function>North</function>, 3538<function>South</function>, 3539<function>East</function> 3540and 3541<function>West</function> 3542the reference point is the center of the specified outer edge of the window 3543border. For 3544<function>Center</function> 3545the reference point is the center of the window. The reference point of the 3546window manager frame is placed at the location on the screen where the 3547reference point of the client window was when the client requested the 3548transition from Withdrawn state. 3549</para> 3550 3551<para> 3552The min_width and min_height elements specify the 3553minimum size that the window can be for the client to be useful. 3554The max_width and max_height elements specify the maximum size. 3555The base_width and base_height elements in conjunction with width_inc 3556and height_inc define an arithmetic progression of preferred window 3557widths and heights for non-negative integers 3558<emphasis remap='I'>i</emphasis> and <emphasis remap='I'>j</emphasis>: 3559</para> 3560 3561<literallayout class="monospaced"> 3562width = base_width + ( i x width_inc ) 3563 3564height = base_height + ( j x height_inc ) 3565</literallayout> 3566 3567<para> 3568Window managers are encouraged to use 3569<emphasis remap='I'>i</emphasis> and <emphasis remap='I'>j</emphasis> 3570instead of width and height in reporting window sizes to users. 3571If a base size is not provided, 3572the minimum size is to be used in its place and vice versa. 3573</para> 3574 3575<para> 3576The min_aspect and max_aspect fields are fractions with the numerator first 3577and the denominator second, and they allow a client to specify the range of 3578aspect ratios it prefers. Window managers that honor aspect ratios should 3579take into account the base size in determining the preferred window size. If 3580a base size is provided along with the aspect ratio fields, the base size 3581should be subtracted from the window size prior to checking that the aspect 3582ratio falls in range. If a base size is not provided, nothing should be 3583subtracted from the window size. (The minimum size is not to be used in 3584place of the base size for this purpose.) 3585</para> 3586</sect3> 3587 3588<sect3 id='WM_HINTS_Property'> 3589<title>WM_HINTS Property</title> 3590<para> 3591The WM_HINTS property (whose type is WM_HINTS) 3592is used to communicate to the window manager. 3593It conveys the information the window manager needs 3594other than the window geometry, 3595which is available from the window itself; 3596the constraints on that geometry, 3597which is available from the WM_NORMAL_HINTS structure; 3598and various strings, 3599which need separate properties, such as WM_NAME. 3600The contents of the properties are as follows: 3601</para> 3602 3603<informaltable frame="topbot"> 3604 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 3605 <colspec colname='c1' colwidth='1.3*'/> 3606 <colspec colname='c2' colwidth='1.0*'/> 3607 <colspec colname='c3' colwidth='3.0*'/> 3608 <thead> 3609 <row rowsep='1'> 3610 <entry>Field</entry> 3611 <entry>Type</entry> 3612 <entry>Comments</entry> 3613 </row> 3614 </thead> 3615 <tbody> 3616 <row> 3617 <entry>flags</entry> 3618 <entry>CARD32</entry> 3619 <entry>(see the next table)</entry> 3620 </row> 3621 <row> 3622 <entry>input</entry> 3623 <entry>CARD32</entry> 3624 <entry>The client's input model</entry> 3625 </row> 3626 <row> 3627 <entry>initial_state</entry> 3628 <entry>CARD32</entry> 3629 <entry>The state when first mapped</entry> 3630 </row> 3631 <row> 3632 <entry>icon_pixmap</entry> 3633 <entry>PIXMAP</entry> 3634 <entry>The pixmap for the icon image</entry> 3635 </row> 3636 <row> 3637 <entry>icon_window</entry> 3638 <entry>WINDOW</entry> 3639 <entry>The window for the icon image</entry> 3640 </row> 3641 <row> 3642 <entry>icon_x</entry> 3643 <entry>INT32</entry> 3644 <entry>The icon location</entry> 3645 </row> 3646 <row> 3647 <entry>icon_y</entry> 3648 <entry>INT32</entry> 3649 </row> 3650 <row> 3651 <entry>icon_mask</entry> 3652 <entry>PIXMAP</entry> 3653 <entry>The mask for the icon shape</entry> 3654 </row> 3655 <row> 3656 <entry>window_group</entry> 3657 <entry>WINDOW</entry> 3658 <entry>The ID of the group leader window</entry> 3659 </row> 3660 </tbody> 3661 </tgroup> 3662</informaltable> 3663 3664<para> 3665The WM_HINTS.flags bit definitions are as follows: 3666</para> 3667 3668<informaltable frame="topbot"> 3669 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 3670 <colspec colname='c1' colwidth='1.3*'/> 3671 <colspec colname='c2' colwidth='1.0*'/> 3672 <colspec colname='c3' colwidth='3.0*'/> 3673 <thead> 3674 <row rowsep='1'> 3675 <entry>Name</entry> 3676 <entry>Value</entry> 3677 <entry>Field</entry> 3678 </row> 3679 </thead> 3680 <tbody> 3681 <row> 3682 <entry><function>InputHint</function></entry> 3683 <entry>1</entry> 3684 <entry>input</entry> 3685 </row> 3686 <row> 3687 <entry><function>StateHint</function></entry> 3688 <entry>2</entry> 3689 <entry>initial_state</entry> 3690 </row> 3691 <row> 3692 <entry><function>IconPixmapHint</function></entry> 3693 <entry>4</entry> 3694 <entry>icon_pixmap</entry> 3695 </row> 3696 <row> 3697 <entry><function>IconWindowHint</function></entry> 3698 <entry>8</entry> 3699 <entry>icon_window</entry> 3700 </row> 3701 <row> 3702 <entry><function>IconPositionHint</function></entry> 3703 <entry>16</entry> 3704 <entry>icon_x & icon_y</entry> 3705 </row> 3706 <row> 3707 <entry><function>IconMaskHint</function></entry> 3708 <entry>32</entry> 3709 <entry>icon_mask</entry> 3710 </row> 3711 <row> 3712 <entry><function>WindowGroupHint</function></entry> 3713 <entry>64</entry> 3714 <entry>window_group</entry> 3715 </row> 3716 <row> 3717 <entry><function>MessageHint</function></entry> 3718 <entry>128</entry> 3719 <entry>(this bit is obsolete)</entry> 3720 </row> 3721 <row> 3722 <entry><function>UrgencyHint</function></entry> 3723 <entry>256</entry> 3724 <entry>urgency</entry> 3725 </row> 3726 </tbody> 3727 </tgroup> 3728</informaltable> 3729 3730<para> 3731Window managers are free to assume convenient values for all fields of 3732the WM_HINTS property if a window is mapped without one. 3733</para> 3734 3735<para> 3736The input field is used to communicate to the window manager the input focus 3737model used by the client (see 3738<xref linkend='Input_Focus' xrefstyle='select: title'/> 3739). 3740</para> 3741 3742<para> 3743Clients with the Globally Active and No Input models should set the 3744input flag to 3745<function>False</function>. 3746Clients with the Passive and Locally Active models should set the input 3747flag to 3748<function>True</function>. 3749</para> 3750 3751<para> 3752From the client's point of view, 3753the window manager will regard the client's top-level window as being 3754in one of three states: 3755</para> 3756 3757<itemizedlist> 3758 <listitem> 3759 <para> 3760Normal 3761 </para> 3762 </listitem> 3763 <listitem> 3764 <para> 3765Iconic 3766 </para> 3767 </listitem> 3768 <listitem> 3769 <para> 3770Withdrawn 3771 </para> 3772 </listitem> 3773</itemizedlist> 3774 3775<para> 3776The semantics of these states are described in 3777<xref linkend='Changing_Window_State' xrefstyle='select: title'/>. 3778Newly created windows start in the Withdrawn state. 3779Transitions between states happen when a 3780top-level window is mapped and unmapped 3781and when the window manager receives certain messages. 3782</para> 3783 3784<para> 3785The value of the initial_state field determines the state the client 3786wishes to be in at the time the top-level window is mapped 3787from the Withdrawn state, as shown in the following table: 3788</para> 3789 3790<informaltable frame="topbot"> 3791 <?dbfo keep-together="always" ?> 3792 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 3793 <colspec colname='c1' colwidth='1.3*'/> 3794 <colspec colname='c2' colwidth='1.0*'/> 3795 <colspec colname='c3' colwidth='3.0*'/> 3796 <thead> 3797 <row rowsep='1'> 3798 <entry>State</entry> 3799 <entry>Value</entry> 3800 <entry>Comments</entry> 3801 </row> 3802 </thead> 3803 <tbody> 3804 <row> 3805 <entry>NormalState</entry> 3806 <entry>1</entry> 3807 <entry>The window is visible</entry> 3808 </row> 3809 <row> 3810 <entry>IconicState</entry> 3811 <entry>3</entry> 3812 <entry>The icon is visible</entry> 3813 </row> 3814 </tbody> 3815 </tgroup> 3816</informaltable> 3817 3818<para> 3819The icon_pixmap field may specify a pixmap to be used as an icon. 3820This pixmap should be: 3821</para> 3822 3823<itemizedlist> 3824 <listitem> 3825 <para> 3826One of the sizes specified in the WM_ICON_SIZE property 3827on the root if it exists (see 3828<xref linkend='WM_ICON_SIZE_Property' xrefstyle='select: title'/> 3829). 3830 </para> 3831 </listitem> 3832 <listitem> 3833 <para> 38341-bit deep. 3835The window manager will select, through the defaults database, 3836suitable background (for the 0 bits) and foreground (for the 1 bits) colors. 3837These defaults can, of course, specify different colors for the icons 3838of different clients. 3839 </para> 3840 </listitem> 3841</itemizedlist> 3842 3843<para> 3844The icon_mask specifies which pixels of the icon_pixmap should be used as the 3845icon, allowing for icons to appear nonrectangular. 3846</para> 3847<para> 3848The icon_window field is the ID of a window the client wants used as its icon. 3849Most, but not all, window managers will support icon windows. 3850Those that do not are likely to have a user interface in which small 3851windows that behave like icons are completely inappropriate. 3852Clients should not attempt to remedy the omission by working around it. 3853</para> 3854<para> 3855Clients that need more capabilities from the icons than a simple 2-color 3856bitmap should use icon windows. 3857Rules for clients that do are set out in 3858<xref linkend='Icons' xrefstyle='select: title'/>. 3859</para> 3860 3861<para> 3862The (icon_x,icon_y) coordinate is a hint to the window manager 3863as to where it should position the icon. 3864The policies of the window manager control the positioning of icons, 3865so clients should not depend on attention being paid to this hint. 3866</para> 3867 3868<para> 3869The window_group field lets the client specify that this window belongs 3870to a group of windows. 3871An example is a single client manipulating multiple 3872children of the root window. 3873</para> 3874 3875<blockquote> 3876<title>Conventions</title> 3877 3878<itemizedlist> 3879 <listitem> 3880 <para> 3881The window_group field should be set to the ID of the group leader. 3882The window group leader may be a window that exists only for that purpose; 3883a placeholder group leader of this kind would never be mapped 3884either by the client or by the window manager. 3885 </para> 3886 </listitem> 3887 <listitem> 3888 <para> 3889The properties of the window group leader are those for the group as 3890a whole (for example, the icon to be shown when the entire group is iconified). 3891<!-- .NE --> 3892 </para> 3893 </listitem> 3894</itemizedlist> 3895</blockquote> 3896 3897<para> 3898Window managers may provide facilities for manipulating the group as a whole. 3899Clients, at present, have no way to operate on the group as a whole. 3900</para> 3901 3902<para> 3903The messages bit, if set in the flags field, indicates that the 3904client is using an obsolete window manager communication protocol, 3905<footnote> 3906<para> 3907This obsolete protocol was described in the July 27, 1988, 3908draft of the ICCCM. 3909Windows using it can also be detected because their WM_HINTS properties are 39104 bytes longer than expected. 3911Window managers are free to support clients using the obsolete protocol 3912in a backwards compatibility mode. 3913</para> 3914</footnote> 3915rather than the WM_PROTOCOLS mechanism of 3916<xref linkend='WM_PROTOCOLS_Property' xrefstyle='select: title'/> 3917</para> 3918 3919<para> 3920The 3921<function>UrgencyHint</function> 3922flag, if set in the flags field, indicates that the client deems the window 3923contents to be urgent, requiring the timely response of the user. The 3924window manager must make some effort to draw the user's attention to this 3925window while this flag is set. The window manager must also monitor the 3926state of this flag for the entire time the window is in the Normal or Iconic 3927state and must take appropriate action when the state of the flag changes. 3928The flag is otherwise independent of the window's state; in particular, the 3929window manager is not required to deiconify the window if the client sets 3930the flag on an Iconic window. Clients must provide some means by which the 3931user can cause the 3932<function>UrgencyHint</function> 3933flag to be set to zero or the window to be withdrawn. The user's action can 3934either mitigate the actual condition that made the window urgent, or it can 3935merely shut off the alarm. 3936</para> 3937 3938<blockquote><title>Rationale</title> 3939<para> 3940This mechanism is useful for alarm dialog boxes or reminder windows, in 3941cases where mapping the window is not enough (e.g., in the presence of 3942multi-workspace or virtual desktop window managers), and where using an 3943override-redirect window is too intrusive. For example, the window manager 3944may attract attention to an urgent window by adding an indicator to its 3945title bar or its icon. Window managers may also take additional action 3946for a window that is newly urgent, such as by flashing its icon (if the 3947window is iconic) or by raising it to the top of the stack. 3948</para> 3949</blockquote> 3950</sect3> 3951 3952<sect3 id='WM_CLASS_Property'> 3953<title>WM_CLASS Property</title> 3954<para> 3955The WM_CLASS property (of type STRING without control characters) 3956contains two consecutive null-terminated strings. 3957These specify the Instance and Class names to be used by both the client 3958and the window manager for looking up resources for the application 3959or as identifying information. 3960This property must be present when the window leaves the Withdrawn state 3961and may be changed only while the window is in the Withdrawn state. 3962Window managers may examine the property only when they start up 3963and when the window leaves the Withdrawn state, 3964but there should be no need for a client to change its state dynamically. 3965</para> 3966<para> 3967The two strings, respectively, are: 3968</para> 3969 3970<itemizedlist> 3971 <listitem> 3972 <para> 3973A string that names the particular instance of the application to which 3974the client that owns this window belongs. 3975Resources that are specified by instance name override any resources 3976that are specified by class name. 3977Instance names can be specified by the user in an operating-system specific 3978manner. 3979On POSIX-conformant systems, 3980the following conventions are used: 3981 </para> 3982 <itemizedlist> 3983 <listitem> 3984 <para> 3985If "-name NAME" is given on the command line, 3986NAME is used as the instance name. 3987 </para> 3988 </listitem> 3989 <listitem> 3990 <para> 3991Otherwise, if the environment variable RESOURCE_NAME is set, 3992its value will be used as the instance name. 3993 </para> 3994 </listitem> 3995 <listitem> 3996 <para> 3997Otherwise, the trailing part of the name used to invoke the program 3998(argv[0] stripped of any directory names) is used as the instance name. 3999 </para> 4000 </listitem> 4001 </itemizedlist> 4002 </listitem> 4003 <listitem> 4004 <para> 4005A string that names the general class of applications to which the client 4006that owns this window belongs. 4007Resources that are specified by class apply to all applications 4008that have the same class name. 4009Class names are specified by the application writer. 4010Examples of commonly used class names include: 4011"Emacs", "XTerm", "XClock", "XLoad", and so on. 4012 </para> 4013 </listitem> 4014</itemizedlist> 4015 4016<para> 4017Note that WM_CLASS strings are null-terminated 4018and, thus, differ from the general conventions that STRING properties 4019are null-separated. 4020This inconsistency is necessary for backwards compatibility. 4021</para> 4022</sect3> 4023 4024<sect3 id='WM_TRANSIENT_FOR_Property'> 4025<title>WM_TRANSIENT_FOR Property</title> 4026<para> 4027The WM_TRANSIENT_FOR property (of type WINDOW) 4028contains the ID of another top-level window. 4029The implication is that this window is a pop-up on behalf of the named window, 4030and window managers may decide not to decorate transient windows 4031or may treat them differently in other ways. 4032In particular, 4033window managers should present newly mapped WM_TRANSIENT_FOR 4034windows without requiring any user interaction, 4035even if mapping top-level windows normally does require interaction. 4036Dialogue boxes, for example, are an example of windows that should have 4037WM_TRANSIENT_FOR set. 4038</para> 4039 4040<para> 4041It is important not to confuse WM_TRANSIENT_FOR with override-redirect. 4042WM_TRANSIENT_FOR should be used in those cases where the pointer 4043is not grabbed while the window is mapped (in other words, 4044if other windows are allowed to be active while the transient is up). 4045If other windows must be prevented from processing input 4046(for example, when implementing pop-up menus), 4047use override-redirect and grab the pointer while the window is mapped. 4048</para> 4049</sect3> 4050 4051<sect3 id='WM_PROTOCOLS_Property'> 4052<title>WM_PROTOCOLS Property</title> 4053<para> 4054The WM_PROTOCOLS property (of type ATOM) is a list of atoms. 4055Each atom identifies a communication protocol between the client 4056and the window manager in which the client is willing to participate. 4057Atoms can identify both standard protocols and private protocols 4058specific to individual window managers. 4059</para> 4060<para> 4061All the protocols in which a client can volunteer to take part 4062involve the window manager sending the client a 4063<function>ClientMessage</function> 4064event and the client taking appropriate action. 4065For details of the contents of the event, 4066see 4067<xref linkend='ClientMessage_Events' xrefstyle='select: title'/> 4068In each case, 4069the protocol transactions are initiated by the window manager. 4070</para> 4071<para> 4072The WM_PROTOCOLS property is not required. 4073If it is not present, 4074the client does not want to participate in any window manager protocols. 4075</para> 4076<para> 4077The X Consortium will maintain a registry of protocols to avoid collisions 4078in the name space. 4079The following table lists the protocols that have been defined to date. 4080</para> 4081 4082<informaltable frame="topbot"> 4083 <?dbfo keep-together="always" ?> 4084 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 4085 <colspec colname='c1' colwidth='1.0*'/> 4086 <colspec colname='c2' colwidth='1.0*'/> 4087 <colspec colname='c3' colwidth='1.5*'/> 4088 <thead> 4089 <row rowsep='1'> 4090 <entry>Protocol</entry> 4091 <entry>Section</entry> 4092 <entry>Purpose</entry> 4093 </row> 4094 </thead> 4095 <tbody> 4096 <row> 4097 <entry>WM_TAKE_FOCUS</entry> 4098 <entry> 4099<xref linkend='Input_Focus' xrefstyle='select: title'/> 4100 </entry> 4101 <entry>Assignment of input focus</entry> 4102 </row> 4103 <row> 4104 <entry>WM_SAVE_YOURSELF</entry> 4105 <entry>Appendix C</entry> 4106 <entry>Save client state request (deprecated)</entry> 4107 </row> 4108 <row> 4109 <entry>WM_DELETE_WINDOW</entry> 4110 <entry> 4111<xref linkend='Window_Deletion' xrefstyle='select: title'/> 4112 </entry> 4113 <entry>Request to delete top-level window</entry> 4114 </row> 4115 </tbody> 4116 </tgroup> 4117</informaltable> 4118 4119<para> 4120It is expected that this table will grow over time. 4121</para> 4122</sect3> 4123 4124<sect3 id='WM_COLORMAP_WINDOWS_Property'> 4125<title>WM_COLORMAP_WINDOWS Property</title> 4126<para> 4127The WM_COLORMAP_WINDOWS property (of type WINDOW) on a top-level window 4128is a list of the IDs of windows that may need colormaps installed 4129that differ from the colormap of the top-level window. 4130The window manager will watch this list of windows for changes in their 4131colormap attributes. 4132The top-level window is always (implicitly or explicitly) on the watch list. 4133For the details of this mechanism, 4134see 4135<xref linkend='Colormaps' xrefstyle='select: title'/> 4136</para> 4137</sect3> 4138 4139<sect3 id='WM_CLIENT_MACHINE_Property'> 4140<title>WM_CLIENT_MACHINE Property</title> 4141<para> 4142The client should set the WM_CLIENT_MACHINE property (of one of the TEXT 4143types) to a string that forms the name of the machine running the client as 4144seen from the machine running the server. 4145</para> 4146</sect3> 4147</sect2> 4148 4149<sect2 id='Window_Manager_Properties'> 4150<title>Window Manager Properties</title> 4151<para> 4152The properties that were described in the previous section are those 4153that the client is responsible for maintaining on its top-level windows. 4154This section describes the properties that the window manager places on 4155client's top-level windows and on the root. 4156</para> 4157 4158<sect3 id='WM_STATE_Property'> 4159<title>WM_STATE Property</title> 4160<para> 4161The window manager will place a WM_STATE property (of type WM_STATE) on each 4162top-level client window that is not in the Withdrawn state. Top-level 4163windows in the Withdrawn state may or may not have the WM_STATE property. 4164Once the top-level window has been withdrawn, the client may re-use it for 4165another purpose. Clients that do so should remove the WM_STATE property if 4166it is still present. 4167</para> 4168<para> 4169 4170Some clients (such as <function>xprop</function>) will ask the user to 4171click over a window 4172on which the program is to operate. Typically, the intent is for this to be 4173a top-level window. To find a top-level window, clients should search the 4174window hierarchy beneath the selected location for a window with the 4175WM_STATE property. This search must be recursive in order to cover all 4176window manager reparenting possibilities. If no window with a WM_STATE 4177property is found, it is recommended that programs use a mapped 4178child-of-root window if one is present beneath the selected location. 4179</para> 4180 4181<para> 4182The contents of the WM_STATE property are defined as follows: 4183</para> 4184 4185<informaltable frame="topbot"> 4186 <?dbfo keep-together="always" ?> 4187 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 4188 <colspec colname='c1' colwidth='1.3*'/> 4189 <colspec colname='c2' colwidth='1.0*'/> 4190 <colspec colname='c3' colwidth='3.0*'/> 4191 <thead> 4192 <row rowsep='1'> 4193 <entry>Field</entry> 4194 <entry>Type</entry> 4195 <entry>Comments</entry> 4196 </row> 4197 </thead> 4198 <tbody> 4199 <row> 4200 <entry>state</entry> 4201 <entry>CARD32</entry> 4202 <entry>(see the next table)</entry> 4203 </row> 4204 <row> 4205 <entry>icon</entry> 4206 <entry>WINDOW</entry> 4207 <entry>ID of icon window</entry> 4208 </row> 4209 </tbody> 4210 </tgroup> 4211</informaltable> 4212 4213<para> 4214The following table lists the WM_STATE.state values: 4215</para> 4216 4217<informaltable frame="topbot"> 4218 <?dbfo keep-together="always" ?> 4219 <tgroup cols='2' align='left' colsep='0' rowsep='0'> 4220 <colspec colname='c1' colwidth='1.3*'/> 4221 <colspec colname='c2' colwidth='5.0*'/> 4222 <thead> 4223 <row rowsep='1'> 4224 <entry>State</entry> 4225 <entry>Value</entry> 4226 </row> 4227 </thead> 4228 <tbody> 4229 <row> 4230 <entry>WithdrawnState</entry> 4231 <entry>0</entry> 4232 </row> 4233 <row> 4234 <entry>NormalState</entry> 4235 <entry>1</entry> 4236 </row> 4237 <row> 4238 <entry>IconicState</entry> 4239 <entry>3</entry> 4240 </row> 4241 </tbody> 4242 </tgroup> 4243</informaltable> 4244 4245<para> 4246Adding other fields to this property is reserved to the X Consortium. 4247Values for the state field other than those defined in the above 4248table are reserved for use by the X Consortium. 4249</para> 4250<para> 4251<!-- .LP --> 4252The state field describes the window manager's idea of the state 4253the window is in, which may not match the client's idea as expressed 4254in the initial_state field of the WM_HINTS property 4255(for example, if the user has asked the window manager to iconify the window). 4256If it is 4257<function>NormalState</function>, 4258the window manager believes the client should be animating its window. 4259If it is 4260<function>IconicState</function>, 4261the client should animate its icon window. 4262In either state, 4263clients should be prepared to handle exposure events from either window. 4264</para> 4265<para> 4266<!-- .LP --> 4267When the window is withdrawn, the window manager will either change the 4268state field's value to 4269<function>WithdrawnState</function> 4270or it will remove the WM_STATE property entirely. 4271</para> 4272<para> 4273<!-- .LP --> 4274The icon field should contain the window ID of the window that the 4275window manager uses as the icon for the window on which this property is 4276set. If no such window exists, the icon field should be 4277<function>None</function>. 4278Note that this window could be but is not necessarily the same window as the 4279icon window that the client may have specified in its WM_HINTS property. 4280The WM_STATE icon may be a window that the window manager has supplied and 4281that contains the client's icon pixmap, or it may be an ancestor of the 4282client's icon window. 4283</para> 4284</sect3> 4285 4286<sect3 id='WM_ICON_SIZE_Property'> 4287<title>WM_ICON_SIZE Property</title> 4288<para> 4289A window manager that wishes to place constraints on the sizes of icon 4290pixmaps and/or windows should place a property called WM_ICON_SIZE on the root. 4291The contents of this property are listed in the following table. 4292</para> 4293 4294<informaltable frame="topbot"> 4295 <?dbfo keep-together="always" ?> 4296 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 4297 <colspec colname='c1' colwidth='1.0*'/> 4298 <colspec colname='c2' colwidth='1.0*'/> 4299 <colspec colname='c3' colwidth='3.0*'/> 4300 <thead> 4301 <row rowsep='1'> 4302 <entry>Field</entry> 4303 <entry>Type</entry> 4304 <entry>Comments</entry> 4305 </row> 4306 </thead> 4307 <tbody> 4308 <row> 4309 <entry>min_width</entry> 4310 <entry>CARD32</entry> 4311 <entry>The data for the icon size series</entry> 4312 </row> 4313 <row> 4314 <entry>min_height</entry> 4315 <entry>CARD32</entry> 4316 </row> 4317 <row> 4318 <entry>max_width</entry> 4319 <entry>CARD32</entry> 4320 </row> 4321 <row> 4322 <entry>max_height</entry> 4323 <entry>CARD32</entry> 4324 </row> 4325 <row> 4326 <entry>width_inc</entry> 4327 <entry>CARD32</entry> 4328 </row> 4329 <row> 4330 <entry>height_inc</entry> 4331 <entry>CARD32</entry> 4332 </row> 4333 </tbody> 4334 </tgroup> 4335</informaltable> 4336 4337<para> 4338For more details see section 14.1.12 in <!-- xref --> 4339<emphasis remap='I'>Xlib - C Language X Interface</emphasis>. 4340</para> 4341</sect3> 4342</sect2> 4343 4344<sect2 id='Changing_Window_State'> 4345<title>Changing Window State</title> 4346<para> 4347From the client's point of view, 4348the window manager will regard each of the client's top-level 4349windows as being in one of three states, 4350whose semantics are as follows: 4351</para> 4352<itemizedlist> 4353 <listitem> 4354 <para> 4355<function>NormalState</function> 4356- The client's top-level window is viewable. 4357 </para> 4358 </listitem> 4359 <listitem> 4360 <para> 4361<function>IconicState</function> 4362- The client's top-level window is iconic 4363(whatever that means for this window manager). 4364The client can assume that its top-level window is not viewable, 4365its icon_window (if any) will be viewable 4366and, failing that, 4367its icon_pixmap (if any) or its WM_ICON_NAME will be displayed. 4368 </para> 4369 </listitem> 4370 <listitem> 4371 <para> 4372<function>WithdrawnState</function> 4373- Neither the client's top-level window nor its icon is visible. 4374 </para> 4375 </listitem> 4376</itemizedlist> 4377 4378<para> 4379In fact, 4380the window manager may implement states with semantics 4381other than those described above. 4382For example, 4383a window manager might implement a concept of an "inactive" state 4384in which an infrequently used client's window would be represented 4385as a string in a menu. 4386But this state is invisible to the client, 4387which would see itself merely as being in the Iconic state. 4388</para> 4389 4390<para> 4391Newly created top-level windows are in the Withdrawn state. 4392Once the window has been provided with suitable properties, 4393the client is free to change its state as follows: 4394</para> 4395 4396<itemizedlist> 4397 <listitem> 4398 <para> 4399Withdrawn -> Normal - The client should map the window with 4400WM_HINTS.initial_state being 4401<function>NormalState</function>. 4402 </para> 4403 </listitem> 4404 <listitem> 4405 <para> 4406Withdrawn -> Iconic - The client should map the window with 4407WM_HINTS.initial_state being 4408<function>IconicState</function>. 4409 </para> 4410 </listitem> 4411 <listitem> 4412 <para> 4413Normal -> Iconic - The client should send a 4414<function>ClientMessage</function> 4415event as described later in this section. 4416 </para> 4417 </listitem> 4418 <listitem> 4419 <para> 4420Normal -> Withdrawn - The client should unmap the window and follow it 4421with a synthetic 4422<function>UnmapNotify</function> 4423event as described later in this section. 4424 </para> 4425 </listitem> 4426 <listitem> 4427 <para> 4428Iconic -> Normal - The client should map the window. 4429The contents of WM_HINTS.initial_state are irrelevant in this case. 4430 </para> 4431 </listitem> 4432 <listitem> 4433 <para> 4434Iconic -> Withdrawn - The client should unmap the window 4435and follow it with a synthetic 4436<function>UnmapNotify</function> 4437event as described later in this section. 4438 </para> 4439 </listitem> 4440</itemizedlist> 4441 4442<para> 4443Only the client can effect a transition into or out of the Withdrawn 4444state. 4445Once a client's window 4446has left the Withdrawn state, 4447the window will be mapped if it is in the Normal state and the window will be 4448unmapped if it is in the Iconic state. Reparenting window managers 4449must unmap the client's window when it is in the Iconic state, even if an 4450ancestor window being unmapped renders the client's window unviewable. 4451Conversely, if a reparenting window manager renders the client's window 4452unviewable by unmapping an ancestor, the client's window is by definition in 4453the Iconic state and must also be unmapped. 4454</para> 4455 4456<blockquote><title>Advice to Implementors</title> 4457<para> 4458Clients can select for 4459<function>StructureNotify</function> 4460on their 4461top-level windows to track transitions between Normal and Iconic states. 4462Receipt of a 4463<function>MapNotify</function> 4464event will indicate a transition to the Normal state, and receipt of an 4465<function>UnmapNotify</function> 4466event will indicate a transition to the Iconic state. 4467</para> 4468</blockquote> 4469 4470<para> 4471When changing the state of the window to Withdrawn, the client must (in 4472addition to unmapping the window) send a synthetic 4473<function>UnmapNotify</function> 4474event by 4475using a 4476<function>SendEvent</function> 4477request with the following arguments: 4478</para> 4479 4480<informaltable frame="topbot"> 4481 <?dbfo keep-together="always" ?> 4482 <tgroup cols='2' align='left' colsep='0' rowsep='0'> 4483 <colspec colname='c2' colwidth='1.0*'/> 4484 <colspec colname='c3' colwidth='3.0*'/> 4485 <thead> 4486 <row rowsep='1'> 4487 <entry>Argument</entry> 4488 <entry>Value</entry> 4489 </row> 4490 </thead> 4491 <tbody> 4492 <row> 4493 <entry>destination</entry> 4494 <entry>The root</entry> 4495 </row> 4496 <row> 4497 <entry>propogate</entry> 4498 <entry><emphasis role="bold">False</emphasis></entry> 4499 </row> 4500 <row> 4501 <entry>event-mask</entry> 4502 <entry>(<emphasis role="bold">SubstructureRedirect|SubstructureNotify</emphasis>)</entry> 4503 </row> 4504 <row> 4505 <entry>event: an <function>UnmapNotify</function> with:</entry> 4506 </row> 4507 <row> 4508 <entry> event:</entry> 4509 <entry>The root</entry> 4510 </row> 4511 <row> 4512 <entry> window:</entry> 4513 <entry>The window itself</entry> 4514 </row> 4515 <row> 4516 <entry> from-configure:</entry> 4517 <entry><emphasis role="bold">False</emphasis></entry> 4518 </row> 4519 </tbody> 4520 </tgroup> 4521</informaltable> 4522 4523<blockquote> 4524<title>Rationale</title> 4525<para> 4526The reason for requiring the client to send a synthetic 4527<function>UnmapNotify</function> 4528event is to ensure that the window manager 4529gets some notification of the client's desire to change state, 4530even though the window may already be unmapped when the desire is expressed. 4531</para> 4532</blockquote> 4533 4534<blockquote> 4535<title>Advice to Implementors</title> 4536<para> 4537For compatibility with obsolete clients, 4538window managers should trigger the transition to the Withdrawn state 4539on the real 4540<function>UnmapNotify</function> 4541rather than waiting for the synthetic one. 4542They should also trigger the transition if they receive a synthetic 4543<function>UnmapNotify</function> 4544on a window for which they have not yet received a real 4545<function>UnmapNotify</function>. 4546</para> 4547</blockquote> 4548 4549<para> 4550When a client withdraws a window, 4551the window manager will then update or remove the WM_STATE 4552property as described in 4553<xref linkend='WM_STATE_Property' xrefstyle='select: title'/>. 4554Clients that want to re-use a client window (e.g., by mapping it again or 4555reparenting it elsewhere) after withdrawing it must wait for the 4556withdrawal to be complete before proceeding. The preferred method for 4557doing this is for clients to wait for the window manager to update or 4558remove the WM_STATE property. 4559<footnote><para> 4560Earlier versions of these conventions prohibited clients from 4561reading the WM_STATE property. Clients operating under the earlier 4562conventions used the technique of tracking 4563<function>ReparentNotify</function> 4564events to wait for the top-level window to be reparented back to the root 4565window. This is still a valid technique; however, it works only for 4566reparenting window managers, and the WM_STATE technique is to be preferred. 4567</para></footnote> 4568</para> 4569 4570<para> 4571If the transition is from the Normal to the Iconic state, 4572the client should send a 4573<function>ClientMessage</function> 4574event to the root with: 4575</para> 4576<itemizedlist> 4577 <listitem> 4578 <para> 4579Window == the window to be iconified 4580 </para> 4581 </listitem> 4582 <listitem> 4583 <para> 4584Type 4585<footnote> 4586<para> 4587The type field of the 4588<function>ClientMessage</function> 4589event (called the message_type field by Xlib) should not be confused with 4590the code field of the event itself, 4591which will have the value 33 4592<function>( ClientMessage</function>). 4593</para> 4594</footnote> 4595== the atom WM_CHANGE_STATE 4596 </para> 4597 </listitem> 4598 <listitem> 4599 <para> 4600Format == 32 4601 </para> 4602 </listitem> 4603 <listitem> 4604 <para> 4605Data[0] == IconicState 4606 </para> 4607 </listitem> 4608</itemizedlist> 4609 4610<blockquote><title>Rationale</title> 4611<para> 4612The format of this 4613<function>ClientMessage</function> 4614event does not match the format of 4615<function>ClientMessages</function> 4616in 4617<xref linkend='ClientMessage_Events' xrefstyle='select: title'/>. 4618This is because they are sent by the window manager to clients, 4619and this message is sent by clients to the window manager. 4620</para> 4621</blockquote> 4622 4623<para> 4624Other values of data[0] are reserved for future extensions to these 4625conventions. The parameters of the 4626<function>SendEvent</function> 4627request should be those described for the synthetic 4628<function>UnmapNotify</function> 4629event. 4630</para> 4631 4632<blockquote><title>Advice to Implementors</title> 4633<para> 4634Clients can also select for 4635<function>VisibilityChange</function> 4636events on their top-level or icon windows. 4637They will then receive a 4638<function>VisibilityNotify</function> 4639(state==FullyObscured) 4640event when the window concerned becomes completely 4641obscured even though mapped (and thus, perhaps a waste 4642of time to update) and a 4643<function>VisibilityNotify</function> 4644(state!=FullyObscured) 4645event when it becomes even partly viewable. 4646</para> 4647</blockquote> 4648 4649<blockquote><title>Advice to Implementors</title> 4650<para> 4651When a window makes a transition from the Normal state to either the Iconic 4652or the Withdrawn state, clients should be aware that the window manager 4653may make transients for this window inaccessible. Clients should not rely 4654on transient windows being available to the user when the transient owner 4655window is not in the Normal state. When withdrawing a window, clients are 4656advised to withdraw transients for the window. 4657</para> 4658</blockquote> 4659 4660</sect2> 4661 4662<sect2 id='Configuring_the_Window'> 4663<title>Configuring the Window</title> 4664<para> 4665Clients can resize and reposition their top-level windows by using the 4666<function>ConfigureWindow</function> 4667request. 4668The attributes of the window that can be altered 4669with this request are as follows: 4670</para> 4671 4672<itemizedlist> 4673 <listitem> 4674 <para> 4675The [x,y] location of the window's upper left-outer corner 4676 </para> 4677 </listitem> 4678 <listitem> 4679 <para> 4680The [width,height] of the inner region of the window (excluding 4681borders) 4682 </para> 4683 </listitem> 4684 <listitem> 4685 <para> 4686The border width of the window 4687 </para> 4688 </listitem> 4689 <listitem> 4690 <para> 4691The window's position in the stack 4692 </para> 4693 </listitem> 4694</itemizedlist> 4695 4696<para> 4697The coordinate system in which the location is expressed is that of the root 4698(irrespective of any reparenting that may have occurred). 4699The border width to be used and win_gravity position hint 4700to be used are those most recently requested by the client. 4701Client configure requests are interpreted by the window manager 4702in the same manner as the initial window geometry mapped from 4703the Withdrawn state, as described in 4704<xref linkend='WM_NORMAL_HINTS_Property' xrefstyle='select: title'/> 4705Clients must be aware that there is no guarantee that the window manager 4706will allocate them the requested size or location and must be prepared to 4707deal with any size and location. 4708If the window manager decides to respond to a 4709<function>ConfigureRequest</function> 4710request by: 4711</para> 4712 4713<itemizedlist> 4714 <listitem> 4715 <para> 4716Not changing the size, location, border width, or stacking order 4717of the window at all. 4718</para> 4719 <para> 4720A client will receive a synthetic 4721<function>ConfigureNotify</function> 4722event that describes the (unchanged) geometry of the window. 4723The (x,y) coordinates will be in the root coordinate system, 4724adjusted for the border width the client requested, 4725irrespective of any reparenting that has taken place. 4726The border_width will be the border width the client requested. 4727The client will not receive a real 4728<function>ConfigureNotify</function> 4729event because no change has actually taken place. 4730 </para> 4731 </listitem> 4732 <listitem> 4733 <para> 4734Moving or restacking the window without resizing it or 4735changing its border width. 4736 </para> 4737 <para> 4738A client will receive a synthetic 4739<function>ConfigureNotify</function> 4740event following the change that describes the new geometry of the window. 4741The event's (x,y) coordinates will be in the root coordinate system adjusted 4742for the border width the client requested. 4743The border_width will be the border width the client requested. 4744The client may not receive a real 4745<function>ConfigureNotify</function> 4746event that describes this change because the window manager may have reparented 4747the top-level window. 4748If the client does receive a real event, 4749the synthetic event will follow the real one. 4750 </para> 4751 </listitem> 4752 <listitem> 4753 <para> 4754Resizing the window or changing its border width (regardless of whether the 4755window was also moved or restacked). 4756 </para> 4757 <para> 4758A client that has selected for 4759<function>StructureNotify</function> 4760events will receive a real 4761<function>ConfigureNotify</function> 4762event. 4763Note that the coordinates in this event are relative to the parent, 4764which may not be the root if the window has been reparented. 4765The coordinates will reflect the actual border width of the window 4766(which the window manager may have changed). 4767The 4768<function>TranslateCoordinates</function> 4769request can be used to convert the coordinates if required. 4770 </para> 4771 </listitem> 4772</itemizedlist> 4773 4774<para> 4775The general rule is that coordinates in real 4776<function>ConfigureNotify</function> 4777events are in the parent's space; 4778in synthetic events, they are in the root space. 4779</para> 4780 4781<blockquote> 4782<title>Advice to Implementors</title> 4783<para> 4784Clients cannot distinguish between the case where a top-level window is 4785resized and moved from the case where the window is resized but not moved, 4786since a real 4787<function>ConfigureNotify</function> 4788event will be received in both cases. Clients that are concerned with 4789keeping track of the absolute position of a top-level window should keep a 4790piece of state indicating whether they are certain of its position. Upon 4791receipt of a real 4792<function>ConfigureNotify</function> 4793event on the top-level window, the client should note that the position is 4794unknown. Upon receipt of a synthetic 4795<function>ConfigureNotify</function> 4796event, the client should note the position as known, using the position in 4797this event. If the client receives a 4798<function>KeyPress</function>, 4799<function>KeyRelease</function>, 4800<function>ButtonPress</function>, 4801<function>ButtonRelease</function>, 4802<function>MotionNotify</function>, 4803<function>EnterNotify</function> 4804or 4805<function>LeaveNotify</function> 4806event on the window (or on any descendant), the client can deduce the 4807top-level window's position from the difference between the (event-x, 4808event-y) and (root-x, root-y) coordinates in these events. Only when the 4809position is unknown does the client need to use the 4810<function>TranslateCoordinates</function> 4811request to find the position of a top-level window. 4812</para> 4813</blockquote> 4814 4815<para> 4816Clients should be aware that their borders may not be visible. 4817Window managers are free to use reparenting techniques to 4818decorate client's top-level windows with borders containing 4819titles, controls, and other details to maintain a consistent look-and-feel. 4820If they do, 4821they are likely to override the client's attempts to set the border width 4822and set it to zero. 4823Clients, therefore, should not depend on the top-level window's border 4824being visible or use it to display any critical information. 4825Other window managers will allow the top-level windows border to 4826be visible. 4827</para> 4828 4829<blockquote> 4830<title>Convention</title> 4831<para> 4832Clients should set the desired value of the border-width attribute on all 4833<function>ConfigureWindow</function> 4834requests to avoid a race condition. 4835</para> 4836</blockquote> 4837 4838<para> 4839Clients that change their position in the stack must be aware 4840that they may have been reparented, 4841which means that windows that used to be siblings no longer are. 4842Using a nonsibling as the sibling parameter on a 4843<function>ConfigureWindow</function> 4844request will cause an error. 4845</para> 4846 4847<blockquote> 4848<title>Convention</title> 4849<para> 4850Clients that use a 4851<function>ConfigureWindow</function> 4852request to request a change in their position in the stack 4853should do so using 4854<function>None</function> 4855in the sibling field. 4856</para> 4857</blockquote> 4858 4859<para> 4860Clients that must position themselves in the stack relative to some 4861window that was originally a sibling must do the 4862<function>ConfigureWindow</function> 4863request (in case they are running under a nonreparenting window manager), 4864be prepared to deal with a resulting error, 4865and then follow with a synthetic 4866<function>ConfigureRequest</function> 4867event by invoking a 4868<function>SendEvent</function> 4869request with the following arguments: 4870</para> 4871 4872<informaltable frame="topbot"> 4873 <?dbfo keep-together="always" ?> 4874 <tgroup cols='2' align='left' colsep='0' rowsep='0'> 4875 <colspec colname='c1' colwidth='1.0*'/> 4876 <colspec colname='c2' colwidth='3.0*'/> 4877 <thead> 4878 <row rowsep='1'> 4879 <entry>Argument</entry> 4880 <entry>Value</entry> 4881 </row> 4882 </thead> 4883 <tbody> 4884 <row> 4885 <entry>destination</entry> 4886 <entry>The root</entry> 4887 </row> 4888 <row> 4889 <entry>propogate</entry> 4890 <entry><emphasis role="bold">False</emphasis></entry> 4891 </row> 4892 <row> 4893 <entry>event-mask</entry> 4894 <entry>(<emphasis role="bold">SubstructureRedirect|SubstructureNotify</emphasis>)</entry> 4895 </row> 4896 <row> 4897 <entry>event: an <function>ConfigureRequest</function> with:</entry> 4898 </row> 4899 <row> 4900 <entry> event:</entry> 4901 <entry>The root</entry> 4902 </row> 4903 <row> 4904 <entry> window:</entry> 4905 <entry>The window itself</entry> 4906 </row> 4907 <row> 4908 <entry> ...</entry> 4909 <entry>Other parameters from the <emphasis role="bold">ConfigureWindow</emphasis> request</entry> 4910 </row> 4911 </tbody> 4912 </tgroup> 4913</informaltable> 4914 4915<para> 4916Window managers are in any case free to position windows in the stack as 4917they see fit, and so clients should not rely on receiving the stacking 4918order they have requested. Clients should ignore the above-sibling 4919field of both real and synthetic 4920<function>ConfigureNotify</function> 4921events received on their top-level windows because this field may not 4922contain useful information. 4923</para> 4924</sect2> 4925 4926<sect2 id='Changing_Window_Attributes'> 4927<title>Changing Window Attributes</title> 4928<para> 4929The attributes that may be supplied when a window is created may be 4930changed by using the 4931<function>ChangeWindowAttributes</function> 4932request. 4933The window attributes are listed in the following table: 4934</para> 4935 4936<informaltable frame="topbot"> 4937 <tgroup cols='2' align='left' colsep='0' rowsep='0'> 4938 <colspec colname='c1' colwidth='1.0*'/> 4939 <colspec colname='c2' colwidth='3.0*'/> 4940 <thead> 4941 <row rowsep='1'> 4942 <entry>Attribute</entry> 4943 <entry>Private to Client</entry> 4944 </row> 4945 </thead> 4946 <tbody> 4947 <row> 4948 <entry>Background pixmap</entry> 4949 <entry>Yes</entry> 4950 </row> 4951 <row> 4952 <entry>Background pixel</entry> 4953 <entry>Yes</entry> 4954 </row> 4955 <row> 4956 <entry>Border pixmap</entry> 4957 <entry>Yes</entry> 4958 </row> 4959 <row> 4960 <entry>Border pixel</entry> 4961 <entry>Yes</entry> 4962 </row> 4963 <row> 4964 <entry>Bit gravity</entry> 4965 <entry>Yes</entry> 4966 </row> 4967 <row> 4968 <entry>Window gravity</entry> 4969 <entry>No</entry> 4970 </row> 4971 <row> 4972 <entry>Backing-store hint</entry> 4973 <entry>Yes</entry> 4974 </row> 4975 <row> 4976 <entry>Save-under hint</entry> 4977 <entry>No</entry> 4978 </row> 4979 <row> 4980 <entry>Event Mask</entry> 4981 <entry>No</entry> 4982 </row> 4983 <row> 4984 <entry>Do-not-propagate mask</entry> 4985 <entry>Yes</entry> 4986 </row> 4987 <row> 4988 <entry>Override-redirect flag</entry> 4989 <entry>No</entry> 4990 </row> 4991 <row> 4992 <entry>Colormap</entry> 4993 <entry>Yes</entry> 4994 </row> 4995 <row> 4996 <entry>Cursor</entry> 4997 <entry>Yes</entry> 4998 </row> 4999 </tbody> 5000 </tgroup> 5001</informaltable> 5002 5003<para> 5004Most attributes are private to the client and will never be interfered with 5005by the window manager. 5006For the attributes that are not private to the client: 5007</para> 5008 5009<itemizedlist> 5010 <listitem> 5011 <para> 5012The window manager is free to override the window gravity; 5013a reparenting window manager may want to set the top-level window's 5014window gravity for its own purposes. 5015 </para> 5016 </listitem> 5017 <listitem> 5018 <para> 5019Clients are free to set the save-under hint on their top-level windows, 5020but they must be aware that the hint may be overridden by the window manager. 5021 </para> 5022 </listitem> 5023 <listitem> 5024 <para> 5025Windows, in effect, have per-client event masks, 5026and so, clients may select for whatever events are convenient irrespective 5027of any events the window manager is selecting for. 5028There are some events for which only one client at a time may select, 5029but the window manager should not select for them on any of the client's 5030windows. 5031 </para> 5032 </listitem> 5033 <listitem> 5034 <para> 5035Clients can set override-redirect on top-level windows but are 5036encouraged not to do so except as described in 5037<xref linkend='Pop_up_Windows' xrefstyle='select: title'/>. 5038and 5039<xref linkend='Redirecting_Requests' xrefstyle='select: title'/>. 5040<!-- xref --> 5041 </para> 5042 </listitem> 5043</itemizedlist> 5044</sect2> 5045 5046<sect2 id='Input_Focus'> 5047<title>Input Focus</title> 5048<para> 5049There are four models of input handling: 5050</para> 5051<itemizedlist> 5052 <listitem> 5053 <para> 5054No Input - The client never expects keyboard input. 5055An example would be 5056<function>xload</function> 5057or another output-only client. 5058 </para> 5059 </listitem> 5060 <listitem> 5061 <para> 5062<!-- .bP --> 5063Passive Input - The client expects keyboard input but never explicitly sets 5064the input focus. 5065An example would be a simple client with no subwindows, 5066which will accept input in 5067<function>PointerRoot</function> 5068mode or when the window manager sets the input focus to its top-level window 5069(in click-to-type mode). 5070 </para> 5071 </listitem> 5072 <listitem> 5073 <para> 5074Locally Active Input - The client expects keyboard input and explicitly sets 5075the input focus, 5076but it only does so when one of its windows already has the focus. 5077An example would be a client with subwindows defining various data 5078entry fields that uses Next and Prev keys to move the input focus 5079between the fields. 5080It does so when its top-level window has acquired the focus in 5081<function>PointerRoot</function> 5082mode or when the window manager sets the input focus to its top-level window 5083(in click-to-type mode). 5084 </para> 5085 </listitem> 5086 <listitem> 5087 <para> 5088Globally Active Input - The client expects keyboard input and explicitly sets 5089the input focus, 5090even when it is in windows the client does not own. 5091An example would be a client with a scroll bar that wants to allow 5092users to scroll the window without disturbing the input focus even if 5093it is in some other window. 5094It wants to acquire the input focus when the user clicks in the scrolled 5095region but not when the user clicks in the scroll bar itself. 5096Thus, it wants to prevent the window manager from setting the input focus 5097to any of its windows. 5098 </para> 5099 </listitem> 5100</itemizedlist> 5101 5102<para> 5103The four input models and the corresponding values of the input field 5104and the presence or absence of the WM_TAKE_FOCUS atom in the 5105WM_PROTOCOLS property are listed in the following table: 5106</para> 5107 5108<informaltable frame="topbot"> 5109 <?dbfo keep-together="always" ?> 5110 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 5111 <colspec colname='c1' colwidth='1.0*'/> 5112 <colspec colname='c2' colwidth='1.0*'/> 5113 <colspec colname='c3' colwidth='3.0*'/> 5114 <thead> 5115 <row rowsep='1'> 5116 <entry>Input Model</entry> 5117 <entry>Input Field</entry> 5118 <entry>WM_TAKE_FOCUS</entry> 5119 </row> 5120 </thead> 5121 <tbody> 5122 <row> 5123 <entry>No Input</entry> 5124 <entry><emphasis role="bold">False</emphasis></entry> 5125 <entry>Absent</entry> 5126 </row> 5127 <row> 5128 <entry>Passive</entry> 5129 <entry><emphasis role="bold">True</emphasis></entry> 5130 <entry>Absent</entry> 5131 </row> 5132 <row> 5133 <entry>Locally Active</entry> 5134 <entry><emphasis role="bold">True</emphasis></entry> 5135 <entry>Present</entry> 5136 </row> 5137 <row> 5138 <entry>Globally Active</entry> 5139 <entry><emphasis role="bold">False</emphasis></entry> 5140 <entry>Present</entry> 5141 </row> 5142 </tbody> 5143 </tgroup> 5144</informaltable> 5145 5146<para> 5147Passive and Locally Active clients set the input field of WM_HINTS to 5148<function>True</function>, 5149which indicates that they require window manager assistance in acquiring the 5150input focus. 5151No Input and Globally Active clients set the input field to 5152<function>False</function>, 5153which requests that the window manager not set the input focus 5154to their top-level window. 5155</para> 5156 5157<para> 5158Clients that use a 5159<function>SetInputFocus</function> 5160request must set the time field to the timestamp of the event 5161that caused them to make the attempt. 5162This cannot be a 5163<function>FocusIn</function> 5164event because they do not have timestamps. 5165Clients may also acquire 5166the focus without a corresponding 5167<function>EnterNotify</function>. 5168Note that clients must not use 5169<function>CurrentTime</function> 5170in the time field. 5171</para> 5172 5173<para> 5174Clients using the Globally Active model can only use a 5175<function>SetInputFocus</function> 5176request to acquire the input focus when they do not already have it on 5177receipt of one of the following events: 5178</para> 5179 5180<itemizedlist> 5181 <listitem> 5182 <para> 5183<function>ButtonPress</function> 5184 </para> 5185 </listitem> 5186 <listitem> 5187 <para> 5188<function>ButtonRelease</function> 5189 </para> 5190 </listitem> 5191 <listitem> 5192 <para> 5193Passive-grabbed 5194<function>KeyPress</function> 5195 </para> 5196 </listitem> 5197 <listitem> 5198 <para> 5199Passive-grabbed 5200<function>KeyRelease</function> 5201 </para> 5202 </listitem> 5203</itemizedlist> 5204 5205<para> 5206In general, 5207clients should avoid using passive-grabbed key events for this purpose, 5208except when they are unavoidable (as, for example, a selection tool 5209that establishes a passive grab on the keys that cut, copy, or paste). 5210</para> 5211 5212<para> 5213The method by which the user commands the window manager to 5214set the focus to a window is up to the window manager. 5215For example, 5216clients cannot determine whether they will see the click 5217that transfers the focus. 5218</para> 5219 5220<para> 5221Windows with the atom WM_TAKE_FOCUS in their WM_PROTOCOLS property 5222may receive a 5223<function>ClientMessage</function> 5224event from the window manager (as described in 5225<xref linkend='ClientMessage_Events' xrefstyle='select: title'/>. 5226) 5227with WM_TAKE_FOCUS in its data[0] field and a valid timestamp 5228(i.e., not 5229<function>CurrentTime</function>) 5230in its data[1] field. 5231If they want the focus, 5232they should respond with a 5233<function>SetInputFocus</function> 5234request with its window field set to the window of theirs 5235that last had the input focus or to their default input window, 5236and the time field set to the timestamp in the message. 5237For further information, 5238see 5239<xref linkend='Input_Focus' xrefstyle='select: title'/> 5240</para> 5241<para> 5242<!-- .LP --> 5243A client could receive WM_TAKE_FOCUS when opening from an icon 5244or when the user has clicked outside the top-level window in an area that 5245indicates to the window manager that it should assign the focus 5246(for example, clicking in the headline bar can be used to assign the focus). 5247</para> 5248<para> 5249<!-- .LP --> 5250The goal is to support window managers that want to assign the input focus 5251to a top-level window in such a way that the top-level window either 5252can assign it to one of its subwindows or can decline the offer of the focus. 5253For example, a clock or a text editor with no currently open frames 5254might not want to take focus even though the window manager generally 5255believes that clients should take the input focus after being deiconified 5256or raised. 5257</para> 5258<para> 5259<!-- .LP --> 5260Clients that set the input focus need to decide a value for the 5261revert-to field of the 5262<function>SetInputFocus</function> 5263request. 5264This determines the behavior of the input focus 5265if the window the focus has been set to becomes not viewable. 5266The value can be any of the following: 5267</para> 5268 5269<itemizedlist> 5270 <listitem> 5271 <para> 5272<function>Parent</function> 5273- In general, 5274clients should use this value when assigning focus to one of their subwindows. 5275Unmapping the subwindow will cause focus to revert to the parent, 5276which is probably what you want. 5277 </para> 5278 </listitem> 5279 <listitem> 5280 <para> 5281<!-- .bP --> 5282<function>PointerRoot</function> 5283- Using 5284this value with a click-to-type focus management policy 5285leads to race conditions because the window becoming unviewable may 5286coincide with the window manager deciding to move the focus elsewhere. 5287 </para> 5288 </listitem> 5289 <listitem> 5290 <para> 5291<function>None</function> 5292- Using 5293this value causes problems if the window manager reparents 5294the window, as most window managers will, and then crashes. 5295The input focus will be 5296<function>None</function>, 5297and there will probably be no way to change it. 5298 </para> 5299 </listitem> 5300</itemizedlist> 5301 5302<para> 5303Note that neither 5304<function>PointerRoot</function> 5305nor 5306<function>None</function> 5307is really safe to use. 5308</para> 5309 5310<blockquote> 5311<title>Convention</title> 5312<para> 5313Clients that invoke a 5314<function>SetInputFocus</function> 5315request should set the revert-to argument to 5316<function>Parent</function>. 5317</para> 5318</blockquote> 5319 5320<para> 5321A convention is also required for clients that want to give up the 5322input focus. 5323There is no safe value set for them to set the input focus to; 5324therefore, they should ignore input material. 5325</para> 5326 5327<blockquote> 5328<title>Convention</title> 5329<para> 5330Clients should not give up the input focus of their own volition. 5331They should ignore input that they receive instead. 5332</para> 5333</blockquote> 5334</sect2> 5335 5336<sect2 id='Colormaps'> 5337<title>Colormaps</title> 5338<para> 5339The window manager is responsible for installing and uninstalling 5340colormaps on behalf of clients with top-level windows that 5341the window manager manages. 5342</para> 5343<para> 5344Clients provide the window manager with hints as to which colormaps to 5345install and uninstall. Clients must not install or uninstall colormaps 5346themselves (except under the circumstances noted below). When a client's 5347top-level window gets the colormap focus (as a result of whatever colormap 5348focus policy is implemented by the window manager), the window manager will 5349ensure that one or more of the client's colormaps are installed. 5350</para> 5351<para> 5352<!-- .LP --> 5353Clients whose top-level windows and subwindows all use the same colormap 5354should set its ID in the colormap field of the top-level window's 5355attributes. They should not set a WM_COLORMAP_WINDOWS property on the 5356top-level window. If they want to change the colormap, they should change 5357the top-level window's colormap attribute. The window manager will track 5358changes to the window's colormap attribute and install colormaps as 5359appropriate. 5360</para> 5361<para> 5362<!-- .LP --> 5363Clients that create windows can use the value 5364<function>CopyFromParent</function> 5365to inherit their parent's colormap. Window managers will ensure that the 5366root window's colormap field contains a colormap that is suitable for 5367clients to inherit. In particular, the colormap will provide 5368distinguishable colors for 5369<function>BlackPixel</function> 5370and 5371<function>WhitePixel</function>. 5372</para> 5373<para> 5374<!-- .LP --> 5375Top-level windows that have subwindows or override-redirect pop-up windows 5376whose colormap requirements differ from the top-level window should have a 5377WM_COLORMAP_WINDOWS property. This property contains a list of IDs for 5378windows whose colormaps the window manager should attempt to have installed 5379when, in the course of its individual colormap focus policy, it assigns the 5380colormap focus to the top-level window (see 5381<xref linkend='WM_COLORMAP_WINDOWS_Property' xrefstyle='select: title'/> 5382). The list is 5383ordered by the importance to the client of having the colormaps installed. 5384The window manager will track changes to this property and will track 5385changes to the colormap attribute of the windows in the property. 5386</para> 5387<para> 5388<!-- .LP --> 5389If the relative importance of colormaps changes, the client should update 5390the WM_COLORMAP_WINDOWS property to reflect the new ordering. If the 5391top-level window does not appear in the list, the window manager will assume 5392it to be of higher priority than any window in the list. 5393</para> 5394<para> 5395<!-- .LP --> 5396WM_TRANSIENT_FOR windows can either have their own WM_COLORMAP_WINDOWS 5397property or appear in the property of the window they are transient for, 5398as appropriate. 5399</para> 5400 5401<blockquote> 5402<title>Rationale</title> 5403<para> 5404An alternative design was considered for how clients should hint to the 5405window manager about their colormap requirements. This alternative design 5406specified a list of colormaps instead of a list of windows. The current 5407design, a list of windows, was chosen for two reasons. First, it allows 5408window managers to find the visuals of the colormaps, thus permitting 5409visual-dependent colormap installation policies. Second, it allows window 5410managers to select for 5411<function>VisibilityChange</function> 5412events on the windows concerned and to ensure that colormaps are only 5413installed if the windows that need them are visible. The alternative design 5414allows for neither of these policies. 5415</para> 5416</blockquote> 5417 5418<blockquote> 5419<title>Advice to Implementors</title> 5420<para> 5421Clients should be aware of the min-installed-maps and max-installed-maps 5422fields of the connection setup information, and the effect that the minimum 5423value has on the "required list" defined by the Protocol in the 5424description of the 5425<function>InstallColormap</function> 5426request. Briefly, the min-installed-maps most recently installed maps are 5427guaranteed to be installed. This value is often one; clients needing 5428multiple colormaps should beware. 5429</para> 5430</blockquote> 5431 5432<para> 5433Whenever possible, clients should use the mechanisms described above and let 5434the window manager handle colormap installation. However, clients are 5435permitted to perform colormap installation on their own while they have the 5436pointer grabbed. A client performing colormap installation must notify the 5437window manager prior to the first installation. When the client has 5438finished its colormap installation, it must also notify the window manager. 5439The client notifies the window manager by issuing a 5440<function>SendEvent</function> 5441request with the following arguments: 5442</para> 5443 5444<informaltable frame="topbot"> 5445 <?dbfo keep-together="always" ?> 5446 <tgroup cols='2' align='left' colsep='0' rowsep='0'> 5447 <colspec colname='c1' colwidth='1.0*'/> 5448 <colspec colname='c2' colwidth='3.0*'/> 5449 <thead> 5450 <row rowsep='1'> 5451 <entry>Argument</entry> 5452 <entry>Value</entry> 5453 </row> 5454 </thead> 5455 <tbody> 5456 <row> 5457 <entry>destination</entry> 5458 <entry> 5459The root window of the screen on which the colormap is installed 5460 </entry> 5461 </row> 5462 <row> 5463 <entry>propogate</entry> 5464 <entry><emphasis role="bold">False</emphasis></entry> 5465 </row> 5466 <row> 5467 <entry>event-mask</entry> 5468 <entry><emphasis role="bold">ColormapChange</emphasis></entry> 5469 </row> 5470 <row> 5471 <entry>event: an <function>ClientMessage</function> with:</entry> 5472 <entry></entry> 5473 </row> 5474 <row> 5475 <entry> window:</entry> 5476 <entry>The root window, as above</entry> 5477 </row> 5478 <row> 5479 <entry> type:</entry> 5480 <entry>WM_COLORMAP_NOTIFY</entry> 5481 </row> 5482 <row> 5483 <entry> format</entry> 5484 <entry>32</entry> 5485 </row> 5486 <row> 5487 <entry> data[0]</entry> 5488 <entry> 5489the timestamp of the event that caused the client to start or stop 5490installing colormaps 5491 </entry> 5492 </row> 5493 <row> 5494 <entry> data[1]</entry> 5495 <entry> 54961 if the client is starting colormap installation, 54970 if the client is finished with colormap installation 5498 </entry> 5499 </row> 5500 <row> 5501 <entry> data[2]</entry> 5502 <entry> 5503reserved, must be zero 5504 </entry> 5505 </row> 5506 <row> 5507 <entry> data[3]</entry> 5508 <entry> 5509reserved, must be zero 5510 </entry> 5511 </row> 5512 <row> 5513 <entry> data[4]</entry> 5514 <entry> 5515reserved, must be zero 5516 </entry> 5517 </row> 5518 </tbody> 5519 </tgroup> 5520</informaltable> 5521 5522 5523 5524<para> 5525This feature was introduced in version 2.0 of this document, and there will 5526be a significant period of time before all window managers can be expected 5527to implement this feature. Before using this feature, clients must check 5528the compliance level of the window manager (using the mechanism described in 5529<xref linkend='Communication_with_the_Window_Manager_by_Means_of_Selections' xrefstyle='select: title'/> 5530) to verify that it supports this feature. This is necessary to 5531prevent colormap installation conflicts between clients and older window 5532managers. 5533</para> 5534<para> 5535<!-- .LP --> 5536Window managers should refrain from installing colormaps while a client has 5537requested control of colormap installation. The window manager should 5538continue to track the set of installed colormaps so that it can reinstate 5539its colormap focus policy when the client has finished colormap installation. 5540</para> 5541<para> 5542<!-- .LP --> 5543This technique has race conditions that may result in the colormaps 5544continuing to be installed even after a client has issued its notification 5545message. For example, the window manager may have issued some 5546<function>InstallColormap</function> 5547requests that are not executed until after the 5548client's 5549<function>SendEvent</function> 5550and 5551<function>InstallColormap</function> 5552requests, thus uninstalling the client's colormaps. If this occurs while 5553the client still has the pointer grabbed and before the client has issued 5554the "finished" message, the client may reinstall the desired colormaps. 5555</para> 5556 5557 5558<blockquote> 5559<title>Advice to Implementors</title> 5560<para> 5561Clients are expected to use this mechanism for things such as 5562pop-up windows and for animations that use override-redirect windows. 5563</para> 5564<!-- .\" Avoid .LP within a .NT, because it resets the margins. The .NT --> 5565<!-- .\" macro should probably be fixed. --> 5566<!-- .br --> 5567<!-- .sp \n(PDu --> 5568<para> 5569If a client fails to issue the "finished" message, the window manager 5570may be left in a state where its colormap installation policy is suspended. 5571Window manager implementors may want to implement a feature that resets 5572colormap installation policy in response to a command from the user. 5573</para> 5574</blockquote> 5575</sect2> 5576 5577<sect2 id='Icons'> 5578<title>Icons</title> 5579<para> 5580A client can hint to the window manager about the desired appearance 5581of its icon by setting: 5582</para> 5583 5584<itemizedlist> 5585 <listitem> 5586 <para> 5587A string in WM_ICON_NAME. 5588 </para> 5589 </listitem> 5590 <listitem> 5591 <para> 5592All clients should do this 5593because it provides a fallback for window managers whose ideas 5594about icons differ widely from those of the client. 5595 </para> 5596 <para> 5597A 5598<function>Pixmap</function> 5599into the icon_pixmap field of the WM_HINTS property 5600and possibly another into the icon_mask field. 5601 </para> 5602 </listitem> 5603 <listitem> 5604 <para> 5605The window manager is expected to display the pixmap masked by the mask. 5606The pixmap should be one of the sizes found in the WM_ICON_SIZE property 5607on the root. 5608If this property is not found, 5609the window manager is unlikely to display icon pixmaps. 5610Window managers usually will clip or tile pixmaps that do not match 5611WM_ICON_SIZE. 5612 </para> 5613 </listitem> 5614 <listitem> 5615 <para> 5616A window into the icon_window field of the WM_HINTS property. 5617 </para> 5618 <para> 5619The window manager is expected to map that window whenever the client is 5620in the Iconic state. 5621In general, 5622the size of the icon window should be one of those specified in WM_ICON_SIZE 5623on the root, if it exists. 5624Window managers are free to resize icon windows. 5625 </para> 5626 </listitem> 5627</itemizedlist> 5628 5629<para> 5630In the Iconic state, 5631the window manager usually will ensure that: 5632</para> 5633 5634<itemizedlist> 5635 <listitem> 5636 <para> 5637If the window's WM_HINTS.icon_window is set, 5638the window it names is visible. 5639 </para> 5640 </listitem> 5641 <listitem> 5642 <para> 5643If the window's WM_HINTS.icon_window is not set 5644but the window's WM_HINTS.icon_pixmap is set, 5645the pixmap it names is visible. 5646 </para> 5647 </listitem> 5648 <listitem> 5649 <para> 5650Otherwise, 5651the window's WM_ICON_NAME string is visible. 5652 </para> 5653 </listitem> 5654</itemizedlist> 5655 5656<para> 5657Clients should observe the following conventions about their icon windows: 5658</para> 5659 5660<blockquote> 5661<title>Conventions</title> 5662 5663<itemizedlist> 5664 <listitem> 5665 <para> 5666The icon window should be an 5667<function>InputOutput</function> 5668child of the root. 5669 </para> 5670 </listitem> 5671 <listitem> 5672 <para> 5673The icon window should be one of the sizes specified 5674in the WM_ICON_SIZE property on the root. 5675 </para> 5676 </listitem> 5677 <listitem> 5678 <para> 5679The icon window should use the root visual and default colormap 5680for the screen in question. 5681 </para> 5682 </listitem> 5683 <listitem> 5684 <para> 5685Clients should not map their icon windows. 5686 </para> 5687 </listitem> 5688 <listitem> 5689 <para> 5690Clients should not unmap their icon windows. 5691 </para> 5692 </listitem> 5693 <listitem> 5694 <para> 5695Clients should not configure their icon windows. 5696 </para> 5697 </listitem> 5698 <listitem> 5699 <para> 5700Clients should not set override-redirect on their icon windows 5701or select for 5702<function>ResizeRedirect</function> 5703events on them. 5704 </para> 5705 </listitem> 5706 <listitem> 5707 <para> 5708Clients must not depend on being able to receive input events 5709by means of their icon windows. 5710 </para> 5711 </listitem> 5712 <listitem> 5713 <para> 5714Clients must not manipulate the borders of their icon windows. 5715 </para> 5716 </listitem> 5717 <listitem> 5718 <para> 5719Clients must select for 5720<function>Exposure</function> 5721events on their icon window and repaint it when requested. 5722<!-- .NE --> 5723 </para> 5724 </listitem> 5725</itemizedlist> 5726</blockquote> 5727 5728<para> 5729Window managers will differ as to whether they support input events 5730to client's icon windows; 5731most will allow the client to receive some subset of the keys and buttons. 5732</para> 5733<para> 5734<!-- .LP --> 5735Window managers will ignore any WM_NAME, WM_ICON_NAME, WM_NORMAL_HINTS, 5736WM_HINTS, WM_CLASS, WM_TRANSIENT_FOR, WM_PROTOCOLS, WM_COLORMAP_WINDOWS, 5737WM_COMMAND, or WM_CLIENT_MACHINE 5738properties they find on icon windows. 5739</para> 5740</sect2> 5741 5742<sect2 id='Pop_up_Windows'> 5743<title>Pop-up Windows</title> 5744<para> 5745Clients that wish to pop up a window can do one of three things: 5746</para> 5747 5748<itemizedlist> 5749 <listitem> 5750 <para> 5751They can create and map another normal top-level window, 5752which will get decorated and managed as normal by the window manager. 5753See the discussion of window groups that follows. 5754 </para> 5755 </listitem> 5756 <listitem> 5757 <para> 5758If the window will be visible for a relatively short time 5759and deserves a somewhat lighter treatment, 5760they can set the WM_TRANSIENT_FOR property. 5761They can expect less decoration but can set all the normal 5762window manager properties on the window. 5763An example would be a dialog box. 5764 </para> 5765 </listitem> 5766 <listitem> 5767 <para> 5768If the window will be visible for a very short time 5769and should not be decorated at all, 5770the client can set override-redirect on the window. 5771In general, 5772this should be done only if the pointer is grabbed while the window is mapped. 5773The window manager will never interfere with these windows, 5774which should be used with caution. 5775An example of an appropriate use is a pop-up menu. 5776 </para> 5777 </listitem> 5778</itemizedlist> 5779 5780<blockquote> 5781<title>Advice to Implementors</title> 5782<para> 5783The user will not be able to move, resize, restack, or transfer the input 5784focus to override-redirect windows, since the window manager is not managing 5785them. If it is necessary for a client to receive keystrokes on an 5786override-redirect window, either the client must grab the keyboard or the 5787client must have another top-level window that is not override-redirect and 5788that has selected the Locally Active or Globally Active focus model. The 5789client may set the focus to the override-redirect window when the other 5790window receives a WM_TAKE_FOCUS message or one of the events listed in 5791<xref linkend='Input_Focus' xrefstyle='select: title'/> 5792in the description of the Globally Active focus model. 5793</para> 5794</blockquote> 5795 5796<para> 5797Window managers are free to decide if WM_TRANSIENT_FOR windows 5798should be iconified when the window they are transient for is. 5799Clients displaying WM_TRANSIENT_FOR windows that have 5800(or request to have) the window they are transient for iconified 5801do not need to request that the same operation be performed 5802on the WM_TRANSIENT_FOR window; 5803the window manager will change its state if that is the policy it wishes 5804to enforce. 5805</para> 5806</sect2> 5807 5808<sect2 id='Window_Groups'> 5809<title>Window Groups</title> 5810<para> 5811A set of top-level windows that should be treated from the user's point of view 5812as related (even though they may belong to a number of clients) should be linked 5813together using the window_group field of the WM_HINTS structure. 5814</para> 5815<para> 5816One of the windows (that is, the one the others point to) 5817will be the group leader and will carry the group as opposed 5818to the individual properties. 5819Window managers may treat the group leader differently 5820from other windows in the group. 5821For example, 5822group leaders may have the full set of decorations, 5823and other group members may have a restricted set. 5824</para> 5825<para> 5826<!-- .LP --> 5827It is not necessary that the client ever map the group leader; 5828it may be a window that exists solely as a placeholder. 5829</para> 5830<para> 5831<!-- .LP --> 5832It is up to the window manager to determine the policy 5833for treating the windows in a group. 5834At present, 5835there is no way for a client to request a group, 5836as opposed to an individual, operation. 5837</para> 5838</sect2> 5839</sect1> 5840 5841<sect1 id='Client_Responses_to_Window_Manager_Actions'> 5842<title>Client Responses to Window Manager Actions</title> 5843<para> 5844The window manager performs a number of operations on client resources, 5845primarily on their top-level windows. 5846Clients must not try to fight this but may elect to receive notification 5847of the window manager's operations. 5848</para> 5849 5850<sect2 id='Reparenting'> 5851<title>Reparenting</title> 5852<para> 5853Clients must be aware that some window managers will reparent 5854their top-level windows 5855so that a window that was created as a child of the root will be displayed 5856as a child of some window belonging to the window manager. 5857The effects that this reparenting will have on the client are as follows: 5858</para> 5859 5860 5861<itemizedlist> 5862 <listitem> 5863 <para> 5864The parent value returned by a 5865<function>QueryTree</function> 5866request will no longer be the value supplied to the 5867<function>CreateWindow</function> 5868request that created the reparented window. 5869There should be no need for the client to be aware of the identity 5870of the window to which the top-level window has been reparented. 5871In particular, 5872a client that wishes to create further top-level windows should continue 5873to use the root as the parent for these new windows. 5874 </para> 5875 </listitem> 5876 <listitem> 5877 <para> 5878<!-- .bP --> 5879The server will interpret the (x,y) coordinates in a 5880<function>ConfigureWindow</function> 5881request in the new parent's coordinate space. 5882In fact, they usually will not be interpreted by the server 5883because a reparenting window manager usually will have intercepted 5884these operations (see 5885<xref linkend='Redirection_of_Operations' xrefstyle='select: title'/> 5886). 5887Clients should use the root coordinate space for these requests 5888(see 5889<xref linkend='Configuring_the_Window' xrefstyle='select: title'/> 5890). 5891 </para> 5892 </listitem> 5893 <listitem> 5894 <para> 5895<!-- .bP --> 5896<function>ConfigureWindow</function> 5897requests that name a specific sibling window may fail because the window named, 5898which used to be a sibling, no longer is after the reparenting operation 5899(see 5900<xref linkend='Configuring_the_Window' xrefstyle='select: title'/> 5901). 5902 </para> 5903 </listitem> 5904 <listitem> 5905 <para> 5906<!-- .bP --> 5907The (x,y) coordinates returned by a 5908<function>GetGeometry</function> 5909request are in the parent's coordinate space 5910and are thus not directly useful after a reparent operation. 5911 </para> 5912 </listitem> 5913 <listitem> 5914 <para> 5915<!-- .bP --> 5916A background of 5917<function>ParentRelative</function> 5918will have unpredictable results. 5919 </para> 5920 </listitem> 5921 <listitem> 5922 <para> 5923<!-- .bP --> 5924A cursor of 5925<function>None</function> 5926will have unpredictable results. 5927 </para> 5928 </listitem> 5929</itemizedlist> 5930 5931<para> 5932Clients that want to be notified when they are reparented can select for 5933<function>StructureNotify</function> 5934events on their top-level window. 5935They will receive a 5936<function>ReparentNotify</function> 5937event if and when reparenting takes place. 5938When a client withdraws a top-level window, the window manager will 5939reparent it back to the root window if the window had been reparented 5940elsewhere. 5941</para> 5942 5943<para> 5944If the window manager reparents a client's window, 5945the reparented window will be placed in the save-set 5946of the parent window. 5947This means that the reparented window will not be destroyed 5948if the window manager terminates and will be remapped if it was unmapped. 5949Note that this applies to all client windows the window manager reparents, 5950including transient windows and client icon windows. 5951</para> 5952</sect2> 5953 5954<sect2 id='Redirection_of_Operations'> 5955<title>Redirection of Operations</title> 5956<para> 5957Clients must be aware that some window managers will arrange 5958for some client requests to be intercepted and redirected. 5959Redirected requests are not executed; 5960they result instead in events being sent to the window manager, 5961which may decide to do nothing, to alter the arguments, 5962or to perform the request on behalf of the client. 5963</para> 5964 5965<para> 5966The possibility that a request may be redirected means 5967that a client cannot assume that any redirectable request is actually 5968performed when the request is issued or is actually performed at all. 5969The requests that may be redirected are 5970<function>MapWindow</function>, 5971<function>ConfigureWindow</function>, 5972and 5973<function>CirculateWindow</function>. 5974</para> 5975 5976<blockquote> 5977<title>Advice to Implementors</title> 5978<para> 5979The following is incorrect because the 5980<function>MapWindow</function> 5981request may be intercepted and the 5982<function>PolyLine</function> 5983output made to an unmapped window: 5984</para> 5985<literallayout class="monospaced"> 5986MapWindow A 5987PolyLine A GC <point> <point> ... 5988</literallayout> 5989 5990<para> 5991The client must wait for an 5992<function>Expose</function> 5993event before drawing in the window. 5994<footnote><para> 5995This is true even if the client set the backing-store attribute to 5996<function>Always</function>. 5997The backing-store attribute is a only a hint, 5998and the server may stop maintaining backing store contents at any time. 5999</para> 6000</footnote> 6001</para> 6002 6003<para> 6004This next example incorrectly assumes that the 6005<function>ConfigureWindow</function> 6006request is actually executed with the arguments supplied: 6007</para> 6008 6009<literallayout class="monospaced"> 6010ConfigureWindow width=N height=M 6011<output assuming window is N by M> 6012</literallayout> 6013 6014<para> 6015The client should select for 6016<function>StructureNotify</function> 6017on its window and monitor the window's size by tracking 6018<function>ConfigureNotify</function> 6019events. 6020</para> 6021 6022<para> 6023Clients must be especially careful when attempting to set the focus to a 6024window that they have just mapped. This sequence may result in an X 6025protocol error: 6026</para> 6027 6028<literallayout class="monospaced"> 6029MapWindow B 6030SetInputFocus B 6031</literallayout> 6032 6033<para> 6034If the 6035<function>MapWindow</function> 6036request has been intercepted, the window will still be 6037unmapped, causing the 6038<function>SetInputFocus</function> 6039request to generate the error. The solution to this problem is for clients 6040to select for 6041<function>VisibilityChange</function> 6042on the window and to delay the issuance of the 6043<function>SetInputFocus</function> 6044request until they have received a 6045<function>VisibilityNotify</function> 6046event indicating that the window is visible. 6047</para> 6048 6049<para> 6050This technique does not guarantee correct operation. The user may have 6051iconified the window by the time the 6052<function>SetInputFocus</function> 6053request reaches the server, still causing an error. Or the window manager 6054may decide to map the window into Iconic state, in which case the window 6055will not be visible. This will delay the generation of the 6056<function>VisibilityNotify</function> 6057event indefinitely. Clients must be prepared to handle these cases. 6058</para> 6059</blockquote> 6060 6061<para> 6062A window with the override-redirect bit set is immune from redirection, 6063but the bit should be set on top-level windows only in cases 6064where other windows should be prevented from processing input 6065while the override-redirect window is mapped (see 6066<xref linkend='Pop_up_Windows' xrefstyle='select: title'/> 6067) 6068and while responding to 6069<function>ResizeRequest</function> 6070events (see 6071<xref linkend='Redirecting_Requests' xrefstyle='select: title'/> 6072). 6073</para> 6074 6075<para> 6076Clients that have no non-Withdrawn top-level windows 6077and that map an override-redirect top-level window are taking over total 6078responsibility for the state of the system. 6079It is their responsibility to: 6080</para> 6081 6082<itemizedlist> 6083 <listitem> 6084 <para> 6085Prevent any preexisting window manager from interfering with their activities 6086 </para> 6087 </listitem> 6088 <listitem> 6089 <para> 6090Restore the status quo exactly after they unmap the window 6091so that any preexisting window manager does not get confused 6092 </para> 6093 </listitem> 6094</itemizedlist> 6095 6096<para> 6097In effect, clients of this kind are acting as temporary window managers. 6098Doing so is strongly discouraged because these clients will be unaware 6099of the user interface policies the window manager is trying to maintain 6100and because their user interface behavior is likely to conflict with that of 6101less demanding clients. 6102</para> 6103</sect2> 6104 6105<sect2 id='Window_Move'> 6106<title>Window Move</title> 6107 6108<para> 6109If the window manager moves a top-level window without changing its size, 6110the client will receive a synthetic 6111<function>ConfigureNotify</function> 6112event following the move that describes the new location 6113in terms of the root coordinate space. 6114Clients must not respond to being moved by attempting to move 6115themselves to a better location. 6116</para> 6117 6118<para> 6119Any real 6120<function>ConfigureNotify</function> 6121event on a top-level window implies that the window's position 6122on the root may have changed, 6123even though the event reports that the window's position 6124in its parent is unchanged because the window may have been reparented. 6125Note that the coordinates in the event will not, in this case, 6126be directly useful. 6127</para> 6128 6129<para> 6130The window manager will send these events by using a 6131<function>SendEvent</function> 6132request with the following arguments: 6133</para> 6134 6135<informaltable frame="topbot"> 6136 <?dbfo keep-together="always" ?> 6137 <tgroup cols='2' align='left' colsep='0' rowsep='0'> 6138 <colspec colname='c1' colwidth='1.0*'/> 6139 <colspec colname='c2' colwidth='3.0*'/> 6140 <thead> 6141 <row rowsep='1'> 6142 <entry>Argument</entry> 6143 <entry>Value</entry> 6144 </row> 6145 </thead> 6146 <tbody> 6147 <row> 6148 <entry>destination</entry> 6149 <entry>The client's window</entry> 6150 </row> 6151 <row> 6152 <entry>propagate</entry> 6153 <entry><emphasis role="bold">False</emphasis></entry> 6154 </row> 6155 <row> 6156 <entry>event-mask</entry> 6157 <entry><emphasis role="bold">StructureNotify</emphasis></entry> 6158 </row> 6159 </tbody> 6160 </tgroup> 6161</informaltable> 6162</sect2> 6163 6164 6165<sect2 id='Window_Resize'> 6166<title>Window Resize</title> 6167<para> 6168The client can elect to receive notification of being resized by selecting for 6169<function>StructureNotify</function> 6170events on its top-level windows. 6171It will receive a 6172<function>ConfigureNotify</function> 6173event. 6174The size information in the event will be correct, 6175but the location will be in the parent window (which may not be the root). 6176</para> 6177 6178<para> 6179The response of the client to being resized should be to accept 6180the size it has been given and to do its best with it. 6181Clients must not respond to being resized by attempting to resize 6182themselves to a better size. 6183If the size is impossible to work with, 6184clients are free to request to change to the Iconic state. 6185</para> 6186</sect2> 6187 6188<sect2 id='Iconify_and_Deiconify'> 6189<title>Iconify and Deiconify</title> 6190<para> 6191A top-level window that is not Withdrawn will be 6192in the Normal state if it is mapped and in the Iconic state if it is unmapped. 6193This will be true even if the window has been reparented; 6194the window manager will unmap the window as well as its parent 6195when switching to the Iconic state. 6196</para> 6197 6198<para> 6199The client can elect to be notified of these state changes by selecting for 6200<function>StructureNotify</function> 6201events on the top-level window. 6202It will receive a 6203<function>UnmapNotify</function> 6204event when it goes Iconic and a 6205<function>MapNotify</function> 6206event when it goes Normal. 6207</para> 6208</sect2> 6209 6210<sect2 id='Colormap_Change'> 6211<title>Colormap Change</title> 6212<para> 6213Clients that wish to be notified of their colormaps being installed 6214or uninstalled should select for 6215<function>ColormapNotify</function> 6216events on their top-level windows and on any windows they have named 6217in WM_COLORMAP_WINDOWS properties on their top-level windows. 6218They will receive 6219<function>ColormapNotify</function> 6220events with the new field FALSE when the colormap for that window 6221is installed or uninstalled. 6222</para> 6223</sect2> 6224 6225<sect2 id='Input_Focus_2'> 6226<title>Input Focus</title> 6227<para> 6228Clients can request notification that they have the input focus by selecting 6229for 6230<function>FocusChange</function> 6231events on their top-level windows; 6232they will receive 6233<function>FocusIn</function> 6234and 6235<function>FocusOut</function> 6236events. 6237Clients that need to set the input focus to one of their 6238subwindows should not do so unless 6239they have set WM_TAKE_FOCUS in their WM_PROTOCOLS property 6240and have done one of the following: 6241</para> 6242 6243<itemizedlist> 6244 <listitem> 6245 <para> 6246Set the input field of WM_HINTS to 6247<function>True</function> 6248and actually have the input focus in one of their top-level windows 6249 </para> 6250 </listitem> 6251 <listitem> 6252 <para> 6253Set the input field of WM_HINTS to 6254<function>False</function> 6255and have received a suitable event as described in 6256<xref linkend='Input_Focus' xrefstyle='select: title'/>. 6257 </para> 6258 </listitem> 6259 <listitem> 6260 <para> 6261Have received a WM_TAKE_FOCUS message as described in 6262<xref linkend='Input_Focus' xrefstyle='select: title'/>. 6263 </para> 6264 </listitem> 6265</itemizedlist> 6266<para> 6267Clients should not warp the pointer in an attempt to transfer the focus; 6268they should set the focus and leave the pointer alone. 6269For further information, 6270see 6271<xref linkend='The_Pointer' xrefstyle='select: title'/>. 6272</para> 6273<para> 6274<!-- .LP --> 6275Once a client satisfies these conditions, 6276it may transfer the focus to another of its windows by using the 6277<function>SetInputFocus</function> 6278request, which is defined as follows: 6279</para> 6280 6281<!-- .IN "SetInputFocus" "" "@DEF@" --> 6282<para> 6283<function>SetInputFocus</function> 6284</para> 6285 6286<informaltable frame="none"> 6287 <?dbfo keep-together="always" ?> 6288 <tgroup cols='1' align='left' colsep='0' rowsep='0'> 6289 <colspec colname='c1' colwidth='1.0*'/> 6290 <tbody> 6291 <row> 6292 <entry> 6293<emphasis remap='I'>focus</emphasis>: WINDOW or 6294<emphasis role="bold">PointerRoot</emphasis> or 6295<emphasis role="bold">None</emphasis> 6296 </entry> 6297 </row> 6298 <row> 6299 <entry> 6300<emphasis remap='I'>revert-to</emphasis>: 6301{ <emphasis role="bold">Parent</emphasis>, 6302<emphasis role="bold">PointerRoot</emphasis>, 6303<emphasis role="bold">None</emphasis> } 6304 </entry> 6305 </row> 6306 <row> 6307 <entry> 6308<emphasis remap='I'>time</emphasis>: TIMESTAMP or CurrentTime 6309 </entry> 6310 </row> 6311 </tbody> 6312 </tgroup> 6313</informaltable> 6314 6315 6316 6317<blockquote> 6318<title>Conventions</title> 6319 6320<itemizedlist> 6321 <listitem> 6322 <para> 6323Clients that use a 6324<function>SetInputFocus</function> 6325request must set the time argument to the timestamp of the event 6326that caused them to make the attempt. 6327This cannot be a 6328<function>FocusIn</function> 6329event because they do not have timestamps. 6330Clients may also acquire the focus without a corresponding 6331<function>EnterNotify</function> 6332event. 6333Clients must not use 6334<function>CurrentTime</function> 6335for the time argument. 6336 </para> 6337 </listitem> 6338 <listitem> 6339 <para> 6340Clients that use a 6341<function>SetInputFocus</function> 6342request to set the focus to one of their windows must set 6343the revert-to field to 6344<function>Parent</function>. 6345<!-- .NE --> 6346 </para> 6347 </listitem> 6348</itemizedlist> 6349</blockquote> 6350 6351</sect2> 6352 6353<sect2 id='ClientMessage_Events'> 6354<title>ClientMessage Events</title> 6355<para> 6356There is no way for clients to prevent themselves being sent 6357<function>ClientMessage</function> 6358events. 6359</para> 6360<para> 6361Top-level windows with a WM_PROTOCOLS property may be sent 6362<function>ClientMessage</function> 6363events specific to the protocols named by the atoms in the property 6364(see 6365<xref linkend='WM_PROTOCOLS_Property' xrefstyle='select: title'/> 6366). 6367For all protocols, the 6368<function>ClientMessage</function> 6369events have the following: 6370</para> 6371 6372<itemizedlist> 6373 <listitem> 6374 <para> 6375WM_PROTOCOLS as the type field 6376 </para> 6377 </listitem> 6378 <listitem> 6379 <para> 6380Format 32 6381 </para> 6382 </listitem> 6383 <listitem> 6384 <para> 6385The atom that names their protocol in the data[0] field 6386 </para> 6387 </listitem> 6388 <listitem> 6389 <para> 6390A timestamp in their data[1] field 6391 </para> 6392 </listitem> 6393</itemizedlist> 6394 6395<para> 6396The remaining fields of the event, 6397including the window field, 6398are determined by the protocol. 6399</para> 6400 6401<para> 6402These events will be sent by using a 6403<function>SendEvent</function> 6404request with the following arguments: 6405</para> 6406 6407<informaltable frame="topbot"> 6408 <?dbfo keep-together="always" ?> 6409 <tgroup cols='2' align='left' colsep='0' rowsep='0'> 6410 <colspec colname='c1' colwidth='1.0*'/> 6411 <colspec colname='c2' colwidth='3.0*'/> 6412 <thead> 6413 <row rowsep='1'> 6414 <entry>Argument</entry> 6415 <entry>Value</entry> 6416 </row> 6417 </thead> 6418 <tbody> 6419 <row> 6420 <entry>destination</entry> 6421 <entry>The client's window</entry> 6422 </row> 6423 <row> 6424 <entry>propagate</entry> 6425 <entry><emphasis role="bold">False</emphasis></entry> 6426 </row> 6427 <row> 6428 <entry>event-mask</entry> 6429 <entry>() empty</entry> 6430 </row> 6431 <row> 6432 <entry>event</entry> 6433 <entry>As specified by the protocol</entry> 6434 </row> 6435 </tbody> 6436 </tgroup> 6437</informaltable> 6438 6439<sect3 id='Window_Deletion'> 6440<title>Window Deletion</title> 6441<para> 6442Clients, usually those with multiple top-level windows, whose server 6443connection must survive the deletion of some of their top-level windows, 6444should include the atom WM_DELETE_WINDOW in the WM_PROTOCOLS property on 6445each such window. They will receive a 6446<function>ClientMessage</function> 6447event as described above whose data[0] field is WM_DELETE_WINDOW. 6448</para> 6449 6450<para> 6451Clients receiving a WM_DELETE_WINDOW message should behave as if the user 6452selected "delete window" from a hypothetical menu. 6453They should perform any confirmation dialog with the user 6454and, if they decide to complete the deletion, should do the following: 6455</para> 6456 6457<itemizedlist> 6458 <listitem> 6459 <para> 6460Either change the window's state to Withdrawn (as described in 6461<xref linkend='Changing_Window_State' xrefstyle='select: title'/> 6462) 6463or destroy the window. 6464 </para> 6465 </listitem> 6466 <listitem> 6467 <para> 6468Destroy any internal state associated with the window. 6469 </para> 6470 </listitem> 6471</itemizedlist> 6472 6473<para> 6474If the user aborts the deletion during the confirmation dialog, 6475the client should ignore the message. 6476</para> 6477 6478<para> 6479Clients are permitted to interact with the user and ask, for example, 6480whether a file associated with the window to be deleted should be saved 6481or the window deletion should be cancelled. 6482Clients are not required to destroy the window itself; 6483the resource may be reused, 6484but all associated state (for example, backing store) should be released. 6485</para> 6486 6487<para> 6488If the client aborts a destroy and the user then selects DELETE WINDOW again, 6489the window manager should start the WM_DELETE_WINDOW protocol again. 6490Window managers should not use 6491<function>DestroyWindow</function> 6492requests on a window that has WM_DELETE_WINDOW in its WM_PROTOCOLS property. 6493</para> 6494 6495<para> 6496Clients that choose not to include WM_DELETE_WINDOW in the WM_PROTOCOLS 6497property may be disconnected from the server 6498if the user asks for one of the client's top-level windows to be deleted. 6499</para> 6500</sect3> 6501</sect2> 6502 6503<sect2 id='Redirecting_Requests'> 6504<title>Redirecting Requests</title> 6505<para> 6506Normal clients can use the redirection mechanism just as window managers do 6507by selecting for 6508<function>SubstructureRedirect</function> 6509events on a parent window or 6510<function>ResizeRedirect</function> 6511events on a window itself. 6512However, at most, 6513one client per window can select for these events, 6514and a convention is needed to avoid clashes. 6515</para> 6516 6517<blockquote> 6518<title>Convention</title> 6519<para> 6520Clients (including window managers) should select for 6521<function>SubstructureRedirect</function> 6522and 6523<function>ResizeRedirect</function> 6524events only on windows that they own. 6525</para> 6526</blockquote> 6527 6528<para> 6529In particular, 6530clients that need to take some special action if they are resized can select 6531for 6532<function>ResizeRedirect</function> 6533events on their top-level windows. 6534They will receive a 6535<function>ResizeRequest</function> 6536event if the window manager resizes their window, 6537and the resize will not actually take place. 6538Clients are free to make what use they like of the information 6539that the window manager wants to change their size, 6540but they must configure the window to the width and height specified 6541in the event in a timely fashion. 6542To ensure that the resize will actually happen at this stage 6543instead of being intercepted and executed by the window manager 6544(and thus restarting the process), 6545the client needs temporarily to set override-redirect on the window. 6546</para> 6547 6548<blockquote> 6549<title>Convention</title> 6550<para> 6551Clients receiving 6552<function>ResizeRequest</function> 6553events must respond by doing the following: 6554</para> 6555 6556<itemizedlist> 6557 <listitem> 6558 <para> 6559Setting override-redirect on the window specified in the event 6560 </para> 6561 </listitem> 6562 <listitem> 6563 <para> 6564Configuring the window specified in the event 6565to the width and height specified in the event as soon as possible 6566and before making any other geometry requests 6567 </para> 6568 </listitem> 6569 <listitem> 6570 <para> 6571Clearing override-redirect on the window specified in the event 6572 </para> 6573 </listitem> 6574</itemizedlist> 6575</blockquote> 6576 6577<para> 6578If a window manager detects that a client is not obeying this convention, 6579it is free to take whatever measures it deems appropriate to deal with 6580the client. 6581</para> 6582</sect2> 6583</sect1> 6584 6585<sect1 id='Communication_with_the_Window_Manager_by_Means_of_Selections'> 6586<title>Communication with the Window Manager by Means of Selections</title> 6587<para> 6588For each screen they manage, window managers will acquire ownership of a 6589selection named WM_S<emphasis remap='I'>n</emphasis>, where 6590<emphasis remap='I'>n</emphasis> is the screen number, as 6591described in 6592<xref linkend='Discriminated_Names' xrefstyle='select: title'/> 6593Window managers should comply with the 6594conventions for "Manager Selections" described in 6595<xref linkend='Manager_Selections' xrefstyle='select: title'/>. 6596The 6597intent is for clients to be able to request a variety of information or 6598services by issuing conversion requests on this selection. Window managers 6599should support conversion of the following target on their manager 6600selection: 6601</para> 6602 6603<informaltable frame="topbot"> 6604 <?dbfo keep-together="always" ?> 6605 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 6606 <colspec colname='c1' colwidth='1.0*'/> 6607 <colspec colname='c2' colwidth='1.0*'/> 6608 <colspec colname='c3' colwidth='3.0*'/> 6609 <thead> 6610 <row rowsep='1'> 6611 <entry>Atom</entry> 6612 <entry>Type</entry> 6613 <entry>Data Received</entry> 6614 </row> 6615 </thead> 6616 <tbody> 6617 <row> 6618 <entry>VERSION</entry> 6619 <entry>INTEGER</entry> 6620 <entry> 6621Two integers, which are the major and minor release numbers (respectively) of 6622the ICCCM with which the window manager complies. For this version of the 6623ICCCM, the numbers are 2 and 0. 6624<footnote> 6625<para> 6626As a special case, clients not wishing to implement a selection 6627request may simply issue a 6628<function>GetSelectionOwner</function> 6629request on the appropriate WM_S<emphasis remap='I'>n</emphasis> selection. 6630If this selection is owned, 6631clients may assume that the window manager complies with ICCCM version 2.0 6632or later. 6633</para> 6634</footnote> 6635 </entry> 6636 </row> 6637 </tbody> 6638 </tgroup> 6639</informaltable> 6640</sect1> 6641 6642<sect1 id='Summary_of_Window_Manager_Property_Types'> 6643<title>Summary of Window Manager Property Types</title> 6644<para> 6645The window manager properties are summarized in the following table 6646(see also section 14.1 of <!-- xref --> 6647<emphasis remap='I'>Xlib - C Language X Interface</emphasis>). 6648</para> 6649 6650<informaltable frame="topbot"> 6651 <tgroup cols='4' align='left' colsep='0' rowsep='0'> 6652 <colspec colname='c1' colwidth='3.0*'/> 6653 <colspec colname='c2' colwidth='2.0*'/> 6654 <colspec colname='c3' colwidth='1.0*'/> 6655 <colspec colname='c4' colwidth='3.0*'/> 6656 <thead> 6657 <row rowsep='1'> 6658 <entry>Name</entry> 6659 <entry>Type</entry> 6660 <entry>Format</entry> 6661 <entry>See Section</entry> 6662 </row> 6663 </thead> 6664 <tbody> 6665 <row> 6666 <entry>WM_CLASS</entry> 6667 <entry>STRING</entry> 6668 <entry>8</entry> 6669 <entry> 6670<xref linkend='WM_CLASS_Property' xrefstyle='select: title'/> 6671 </entry> 6672 </row> 6673 <row> 6674 <entry>WM_CLIENT_MACHINE</entry> 6675 <entry>TEXT</entry> 6676 <entry></entry> 6677 <entry> 6678<xref linkend='WM_CLIENT_MACHINE_Property' xrefstyle='select: title'/> 6679 </entry> 6680 </row> 6681 <row> 6682 <entry>WM_COLORMAP_WINDOWS</entry> 6683 <entry>WINDOW</entry> 6684 <entry>32</entry> 6685 <entry> 6686<xref linkend='WM_COLORMAP_WINDOWS_Property' xrefstyle='select: title'/> 6687 </entry> 6688 </row> 6689 <row> 6690 <entry>WM_HINTS</entry> 6691 <entry>WM_HINTS</entry> 6692 <entry>32</entry> 6693 <entry> 6694<xref linkend='WM_HINTS_Property' xrefstyle='select: title'/> 6695 </entry> 6696 </row> 6697 <row> 6698 <entry>WM_ICON_NAME</entry> 6699 <entry>TEXT</entry> 6700 <entry></entry> 6701 <entry> 6702<xref linkend='WM_ICON_NAME_Property' xrefstyle='select: title'/> 6703 </entry> 6704 </row> 6705 <row> 6706 <entry>WM_ICON_SIZE</entry> 6707 <entry>WM_ICON_SIZE</entry> 6708 <entry>32</entry> 6709 <entry> 6710<xref linkend='WM_ICON_SIZE_Property' xrefstyle='select: title'/> 6711 </entry> 6712 </row> 6713 <row> 6714 <entry>WM_NAME</entry> 6715 <entry>TEXT</entry> 6716 <entry></entry> 6717 <entry> 6718<xref linkend='WM_NAME_Property' xrefstyle='select: title'/> 6719 </entry> 6720 </row> 6721 <row> 6722 <entry>WM_NORMAL_HINTS</entry> 6723 <entry>WM_SIZE_HINTS</entry> 6724 <entry>32</entry> 6725 <entry> 6726<xref linkend='WM_NORMAL_HINTS_Property' xrefstyle='select: title'/> 6727 </entry> 6728 </row> 6729 <row> 6730 <entry>WM_PROTOCOLS</entry> 6731 <entry>ATOM</entry> 6732 <entry>32</entry> 6733 <entry> 6734<xref linkend='WM_PROTOCOLS_Property' xrefstyle='select: title'/> 6735 </entry> 6736 </row> 6737 <row> 6738 <entry>WM_STATE</entry> 6739 <entry>WM_STATE</entry> 6740 <entry>32</entry> 6741 <entry> 6742<xref linkend='WM_STATE_Property' xrefstyle='select: title'/> 6743 </entry> 6744 </row> 6745 <row> 6746 <entry>WM_TRANSIENT_FOR</entry> 6747 <entry>WINDOW</entry> 6748 <entry>32</entry> 6749 <entry> 6750<xref linkend='WM_TRANSIENT_FOR_Property' xrefstyle='select: title'/> 6751 </entry> 6752 </row> 6753 </tbody> 6754 </tgroup> 6755</informaltable> 6756</sect1> 6757</chapter> 6758 6759<chapter id='Session_Management_and_Additional_Inter_Client_Exchanges'> 6760<title>Session Management and Additional Inter-Client Exchanges</title> 6761<para> 6762This section contains some conventions for clients that participate in 6763session management. See 6764<emphasis remap='I'>X Session Management Protocol</emphasis> 6765for further details. Clients that do not support this protocol cannot 6766expect their window state (e.g., WM_STATE, position, size, and stacking order) 6767to be preserved across sessions. 6768</para> 6769 6770<sect1 id='Client_Support_for_Session_Management'> 6771<title>Client Support for Session Management</title> 6772<para> 6773Each session participant will obtain a unique client identifier (client-ID) 6774from the session manager. The client must identify one top-level window as 6775the "client leader." This window must be created by the client. It may 6776be in any state, including the Withdrawn state. The client leader window 6777must have a SM_CLIENT_ID property, which contains the client-ID obtained 6778from the session management protocol. That property must: 6779</para> 6780 6781<itemizedlist> 6782 <listitem> 6783 <para> 6784Be of type STRING 6785 </para> 6786 </listitem> 6787 <listitem> 6788 <para> 6789Be of format 8 6790 </para> 6791 </listitem> 6792 <listitem> 6793 <para> 6794Contain the client-ID as a string of XPCS characters encoded using ISO 67958859-1 6796 </para> 6797 </listitem> 6798</itemizedlist> 6799 6800<para> 6801All top-level, nontransient windows created by a client on the same display 6802as the client leader must have a WM_CLIENT_LEADER property. This property 6803contains a window ID that identifies the client leader window. The client 6804leader window must have a WM_CLIENT_LEADER property containing its own 6805window ID (i.e., the client leader window is pointing to itself). Transient 6806windows need not have a WM_CLIENT_LEADER property if the client leader can 6807be determined using the information in the WM_TRANSIENT_FOR property. The 6808WM_CLIENT_LEADER property must: 6809</para> 6810 6811<itemizedlist> 6812 <listitem> 6813 <para> 6814Be of type WINDOW 6815 </para> 6816 </listitem> 6817 <listitem> 6818 <para> 6819Be of format 32 6820 </para> 6821 </listitem> 6822 <listitem> 6823 <para> 6824Contain the window ID of the client leader window 6825 </para> 6826 </listitem> 6827</itemizedlist> 6828 6829<para> 6830A client must withdraw all of its top-level windows on the same display 6831before modifying either the WM_CLIENT_LEADER or the SM_CLIENT_ID property 6832of its client leader window. 6833</para> 6834 6835<para> 6836It is necessary that other clients be able to uniquely identify a window 6837(across sessions) among all windows related to the same client-ID. For 6838example, a window manager can require this unique ID to restore geometry 6839information from a previous session, or a workspace manager could use it to 6840restore information about which windows are in which workspace. A client 6841may optionally provide a WM_WINDOW_ROLE property to uniquely identify a 6842window within the scope specified above. The combination of SM_CLIENT_ID 6843and WM_WINDOW_ROLE can be used by other clients to uniquely identify a 6844window across sessions. 6845</para> 6846 6847<para> 6848If the WM_WINDOW_ROLE property is not specified on a top-level window, a 6849client that needs to uniquely identify that window will try to use instead 6850the values of WM_CLASS and WM_NAME. If a client has multiple windows with 6851identical WM_CLASS and WM_NAME properties, then it should provide a 6852WM_WINDOW_ROLE property. 6853</para> 6854 6855<para> 6856The client must set the WM_WINDOW_ROLE property to a string that uniquely 6857identifies that window among all windows that have the same client leader 6858window. The property must: 6859</para> 6860 6861<itemizedlist> 6862 <listitem> 6863 <para> 6864Be of type STRING 6865 </para> 6866 </listitem> 6867 <listitem> 6868 <para> 6869Be of format 8 6870 </para> 6871 </listitem> 6872 <listitem> 6873 <para> 6874Contain a string restricted to the XPCS characters, encoded in ISO 8859-1 6875 </para> 6876 </listitem> 6877</itemizedlist> 6878</sect1> 6879 6880<sect1 id='Window_Manager_Support_for_Session_Management'> 6881<title>Window Manager Support for Session Management</title> 6882<para> 6883A window manager supporting session management must register with the 6884session manager and obtain its own client-ID. The window manager should 6885save and restore information such as the WM_STATE, the layout of windows on 6886the screen, and their stacking order for every client window that has a 6887valid SM_CLIENT_ID property (on itself, or on the window named by 6888WM_CLIENT_LEADER) and that can be uniquely identified. 6889Clients are allowed to change this state during the first phase of the 6890session checkpoint process. Therefore, window managers should request a 6891second checkpoint phase and save clients' state only during that phase. 6892</para> 6893</sect1> 6894 6895<sect1 id='Support_for_ICE_Client_Rendezvous'> 6896<title>Support for ICE Client Rendezvous</title> 6897<para> 6898The Inter-Client Exchange protocol (ICE) defined as of X11R6 6899specifies a generic communication framework, independent of the X 6900server, for data exchange between arbitrary clients. ICE also defines 6901a protocol for any two ICE clients who also have X connections 6902to the same X server to locate (rendezvous with) each other. 6903</para> 6904<para> 6905This protocol, called the "ICE X Rendezvous" protocol, is defined in 6906the ICE specification, Appendix B, 6907and uses the property ICE_PROTOCOLS plus 6908<function>ClientMessage</function> 6909events. Refer to that specification for complete details. 6910</para> 6911</sect1> 6912</chapter> 6913 6914<chapter id='Manipulation_of_Shared_Resources'> 6915<title>Manipulation of Shared Resources</title> 6916<para> 6917X Version 11 permits clients to manipulate a number of shared resources, 6918for example, the input focus, the pointer, and colormaps. 6919Conventions are required so that clients share resources in an 6920orderly fashion. 6921</para> 6922<sect1 id='The_Input_Focus'> 6923<title>The Input Focus</title> 6924<para> 6925Clients that explicitly set the input focus must observe one of two modes: 6926</para> 6927 6928<itemizedlist> 6929 <listitem> 6930 <para> 6931Locally active mode 6932 </para> 6933 </listitem> 6934 <listitem> 6935 <para> 6936Globally active mode 6937 </para> 6938 </listitem> 6939</itemizedlist> 6940 6941<blockquote> 6942<title>Conventions</title> 6943<itemizedlist> 6944 <listitem> 6945 <para> 6946Locally active clients should set the input focus to one of their windows 6947only when it is already in one of their windows 6948or when they receive a WM_TAKE_FOCUS message. 6949They should set the input field of the WM_HINTS structure to 6950<function>True</function>. 6951 </para> 6952 </listitem> 6953 <listitem> 6954 <para> 6955Globally active clients should set the input focus to one of their windows 6956only when they receive a button event and a passive-grabbed key event, 6957or when they receive a WM_TAKE_FOCUS message. 6958They should set the input field of the WM_HINTS structure to 6959<function>False</function>. 6960 </para> 6961 </listitem> 6962 <listitem> 6963 <para> 6964In addition, clients should use the timestamp of the event 6965that caused them to attempt to set the input focus as the time field on the 6966<function>SetInputFocus</function> 6967request, not 6968<function>CurrentTime</function>. 6969 </para> 6970 </listitem> 6971</itemizedlist> 6972</blockquote> 6973 6974</sect1> 6975 6976<sect1 id='The_Pointer'> 6977<title>The Pointer</title> 6978<para> 6979In general, clients should not warp the pointer. 6980Window managers, however, may do so 6981(for example, to maintain the invariant that the pointer is always 6982in the window with the input focus). 6983Other window managers may want to preserve the illusion that the user 6984is in sole control of the pointer. 6985</para> 6986<blockquote> 6987<title>Conventions</title> 6988 6989<itemizedlist> 6990 <listitem> 6991 <para> 6992Clients should not warp the pointer. 6993 </para> 6994 </listitem> 6995 <listitem> 6996 <para> 6997Clients that insist on warping the pointer should do so only 6998with the src-window argument of the 6999<function>WarpPointer</function> 7000request set to one of their windows. 7001 </para> 7002 </listitem> 7003</itemizedlist> 7004</blockquote> 7005</sect1> 7006 7007<sect1 id='Grabs'> 7008<title>Grabs</title> 7009<para> 7010A client's attempt to establish a button or a key grab on a window 7011will fail if some other client has already established a conflicting 7012grab on the same window. 7013The grabs, therefore, are shared resources, 7014and their use requires conventions. 7015</para> 7016<para> 7017In conformance with the principle that clients should behave, 7018as far as possible, 7019when a window manager is running as they would when it is not, 7020a client that has the input focus may assume that it can receive all 7021the available keys and buttons. 7022</para> 7023 7024<blockquote> 7025<title>Convention</title> 7026<para> 7027Window managers should ensure that they provide some mechanism for 7028their clients to receive events from all keys and all buttons, 7029except for events involving keys whose KeySyms are registered as being for 7030window management functions (for example, a hypothetical WINDOW KeySym). 7031</para> 7032</blockquote> 7033 7034<para> 7035In other words, 7036window managers must provide some mechanism by which a client 7037can receive events from every key and button (regardless of modifiers) 7038unless and until the X Consortium registers some KeySyms as being reserved 7039for window management functions. 7040Currently, no KeySyms are registered for window management functions. 7041</para> 7042<para> 7043Even so, clients are advised to allow the key and button combinations 7044used to elicit program actions to be modified, 7045because some window managers may choose not to observe this convention 7046or may not provide a convenient method for the user to transmit events 7047from some keys. 7048</para> 7049<blockquote> 7050<title>Convention</title> 7051<para> 7052Clients should establish button and key grabs only on windows that 7053they own. 7054</para> 7055</blockquote> 7056 7057<para> 7058In particular, this convention means that a window manager that wishes 7059to establish a grab over the client's top-level window should either establish 7060the grab on the root or reparent the window and establish the grab 7061on a proper ancestor. 7062In some cases, 7063a window manager may want to consume the event received, 7064placing the window in a state where a subsequent such event will go to 7065the client. 7066Examples are: 7067</para> 7068 7069<itemizedlist> 7070 <listitem> 7071 <para> 7072Clicking in a window to set focus with the click not being offered 7073to the client 7074 </para> 7075 </listitem> 7076 <listitem> 7077 <para> 7078Clicking in a buried window to raise it, again, with the click not offered 7079to the client 7080 </para> 7081 </listitem> 7082</itemizedlist> 7083 7084<para> 7085More typically, 7086a window manager should add to, rather than replace, the client's semantics 7087for key+button combinations by allowing the event to be used by the client 7088after the window manager is done with it. 7089To ensure this, 7090the window manager should establish the grab on the parent 7091by using the following: 7092</para> 7093 7094<literallayout class="monospaced"> 7095pointer/keyboard-mode == Synchronous 7096</literallayout> 7097 7098<para> 7099Then, the window manager should release the grab by using an 7100<function>AllowEvents</function> 7101request with the following specified: 7102</para> 7103 7104<literallayout class="monospaced"> 7105mode == ReplayPointer/Keyboard 7106</literallayout> 7107 7108<para> 7109In this way, 7110the client will receive the events as if they had not been intercepted. 7111</para> 7112 7113<para> 7114Obviously, 7115these conventions place some constraints on possible user interface policies. 7116There is a trade-off here between freedom for window managers to implement 7117their user interface policies and freedom for clients to implement theirs. 7118The dilemma is resolved by: 7119</para> 7120 7121<itemizedlist> 7122 <listitem> 7123 <para> 7124Allowing window managers to decide if and when a client will receive an 7125event from any given key or button 7126 </para> 7127 </listitem> 7128 <listitem> 7129 <para> 7130Placing a requirement on the window manager to provide some mechanism, 7131perhaps a "Quote" key, 7132by which the user can send an event from any key or button to the client 7133 </para> 7134 </listitem> 7135</itemizedlist> 7136 7137</sect1> 7138<sect1 id='Colormaps_2'> 7139<title>Colormaps</title> 7140<para> 7141<xref linkend='Colormaps' xrefstyle='select: title'/> 7142prescribes conventions for clients to communicate with the 7143window manager about their colormap needs. If your clients are 7144<function>DirectColor</function> 7145type applications, 7146you should consult section 14.3 of 7147<emphasis remap='I'>Xlib - C Language X Interface</emphasis> 7148for conventions connected with sharing standard colormaps. 7149They should look for and create the properties described there on 7150the root window of the appropriate screen. 7151</para> 7152 7153<para> 7154The contents of the RGB_COLOR_MAP type property are as follows: 7155</para> 7156 7157<informaltable frame="topbot"> 7158 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 7159 <colspec colname='c1' colwidth='1.0*'/> 7160 <colspec colname='c2' colwidth='1.0*'/> 7161 <colspec colname='c3' colwidth='3.0*'/> 7162 <thead> 7163 <row rowsep='1'> 7164 <entry>Field</entry> 7165 <entry>Type</entry> 7166 <entry>Comments</entry> 7167 </row> 7168 </thead> 7169 <tbody> 7170 <row> 7171 <entry>colormap</entry> 7172 <entry>COLORMAP</entry> 7173 <entry>ID of the colormap described</entry> 7174 </row> 7175 <row> 7176 <entry>red_max</entry> 7177 <entry>CARD32</entry> 7178 <entry>Values for pixel calculations</entry> 7179 </row> 7180 <row> 7181 <entry>red_mult</entry> 7182 <entry>CARD32</entry> 7183 <entry></entry> 7184 </row> 7185 <row> 7186 <entry>green_max</entry> 7187 <entry>CARD32</entry> 7188 <entry></entry> 7189 </row> 7190 <row> 7191 <entry>green_mult</entry> 7192 <entry>CARD32</entry> 7193 <entry></entry> 7194 </row> 7195 <row> 7196 <entry>blue_max</entry> 7197 <entry>CARD32</entry> 7198 <entry></entry> 7199 </row> 7200 <row> 7201 <entry>blue_mult</entry> 7202 <entry>CARD32</entry> 7203 <entry></entry> 7204 </row> 7205 <row> 7206 <entry>base_pixel</entry> 7207 <entry>CARD32</entry> 7208 <entry></entry> 7209 </row> 7210 <row> 7211 <entry>visual_id</entry> 7212 <entry>VISUALID</entry> 7213 <entry>Visual to which colormap belongs</entry> 7214 </row> 7215 <row> 7216 <entry>kill_id</entry> 7217 <entry>CARD32</entry> 7218 <entry>ID for destroying the resources</entry> 7219 </row> 7220 </tbody> 7221 </tgroup> 7222</informaltable> 7223 7224<para> 7225When deleting or replacing an RGB_COLOR_MAP, 7226it is not sufficient to delete the property; 7227it is important to free the associated colormap resources as well. 7228If kill_id is greater than one, 7229the resources should be freed by issuing a 7230<function>KillClient</function> 7231request with kill_id as the argument. 7232If kill_id is one, 7233the resources should be freed by issuing a 7234<function>FreeColormap</function> 7235request with colormap as the colormap 7236argument. 7237If kill_id is zero, 7238no attempt should be made to free the resources. 7239A client that creates an RGB_COLOR_MAP for which the colormap resource 7240is created specifically for this purpose should set kill_id to one 7241(and can create more than one such standard colormap 7242using a single connection). 7243A client that creates an RGB_COLOR_MAP for which the colormap resource 7244is shared in some way (for example, is the default colormap 7245for the root window) should create an arbitrary resource and use its 7246resource ID for kill_id (and should create no other standard colormaps 7247on the connection). 7248</para> 7249 7250<blockquote> 7251<title>Convention</title> 7252<para> 7253If an RGB_COLOR_MAP property is too short to contain the visual_id field, 7254it can be assumed that the visual_id is the root visual 7255of the appropriate screen. 7256If an RGB_COLOR_MAP property is too short to contain the kill_id field, 7257a value of zero can be assumed. 7258</para> 7259</blockquote> 7260 7261<para> 7262During the connection handshake, 7263the server informs the client of the default colormap for each screen. 7264This is a colormap for the root visual, 7265and clients can use it to improve the extent of colormap sharing 7266if they use the root visual. 7267</para> 7268</sect1> 7269 7270<sect1 id='The_Keyboard_Mapping'> 7271<title>The Keyboard Mapping</title> 7272<para> 7273The X server contains a table (which is read by 7274<function>GetKeyboardMapping</function> 7275requests) that describes the set of symbols appearing 7276on the corresponding key for each keycode generated by the server. 7277This table does not affect the server's operations in any way; 7278it is simply a database used by clients that attempt to understand 7279the keycodes they receive. 7280Nevertheless, it is a shared resource and requires conventions. 7281</para> 7282<para> 7283It is possible for clients to modify this table by using a 7284<function>ChangeKeyboardMapping</function> 7285request. 7286In general, clients should not do this. 7287In particular, this is not the way in which clients should implement 7288key bindings or key remapping. 7289The conversion between a sequence of keycodes received from the server 7290and a string in a particular encoding is a private matter for each client 7291(as it must be in a world where applications may be using different 7292encodings to support different languages and fonts). 7293See the Xlib reference manual for converting keyboard events to text. 7294</para> 7295<para> 7296The only valid reason for using a 7297<function>ChangeKeyboardMapping</function> 7298request is when the symbols written on the keys have changed as, for example, 7299when a Dvorak key conversion kit or a set of APL keycaps has been installed. 7300Of course, a client may have to take the change to the keycap on trust. 7301</para> 7302<para> 7303<!-- .LP --> 7304The following illustrates a permissible interaction between a client 7305and a user: 7306</para> 7307<itemizedlist> 7308 <listitem> 7309 <para> 7310"You just started me on a server without a Pause key. 7311Please choose a key to be the Pause key and press it now." 7312 </para> 7313 </listitem> 7314 <listitem> 7315 <para> 7316Presses the Scroll Lock key 7317 </para> 7318 </listitem> 7319 <listitem> 7320 <para> 7321"Adding Pause to the symbols on the Scroll Lock key: Confirm or Abort." 7322 </para> 7323 </listitem> 7324 <listitem> 7325 <para> 7326Confirms 7327 </para> 7328 </listitem> 7329 <listitem> 7330 <para> 7331Uses a 7332<function>ChangeKeyboardMapping</function> 7333request to add Pause to the keycode that already contains Scroll Lock and 7334issues this request, "Please paint Pause on the Scroll Lock key." 7335<!-- .NT Convention --> 7336Clients should not use 7337<function>ChangeKeyboardMapping</function> 7338requests. 7339<!-- .NE --> 7340 </para> 7341 </listitem> 7342</itemizedlist> 7343 7344<para> 7345If a client succeeds in changing the keyboard mapping table, 7346all clients will receive 7347<function>MappingNotify</function> 7348(request==Keyboard) events. 7349There is no mechanism to avoid receiving these events. 7350</para> 7351 7352<blockquote> 7353<title>Convention</title> 7354<para> 7355Clients receiving 7356<function>MappingNotify</function> 7357(request==Keyboard) 7358events should update any internal keycode translation tables they are using. 7359</para> 7360</blockquote> 7361 7362</sect1> 7363 7364<sect1 id='The_Modifier_Mapping'> 7365<title>The Modifier Mapping</title> 7366<para> 7367X Version 11 supports 8 modifier bits of which 3 are preassigned 7368to Shift, Lock, and Control. 7369Each modifier bit is controlled by the state of a set of keys, 7370and these sets are specified in a table accessed by 7371<function>GetModifierMapping</function> and 7372<function>SetModifierMapping</function> requests. 7373This table is a shared resource and requires conventions. 7374</para> 7375 7376<para> 7377A client that needs to use one of the preassigned modifiers should assume 7378that the modifier table has been set up correctly to control these modifiers. 7379The Lock modifier should be interpreted as Caps Lock or Shift Lock 7380according as the keycodes in its controlling set include XK_Caps_Lock 7381or XK_Shift_Lock. 7382</para> 7383 7384 7385<blockquote> 7386<title>Convention</title> 7387<para> 7388Clients should determine the meaning of a modifier bit from the KeySyms 7389being used to control it. 7390</para> 7391</blockquote> 7392 7393<para> 7394A client that needs to use an extra modifier (for example, META) should do 7395the following: 7396</para> 7397 7398<itemizedlist> 7399 <listitem> 7400 <para> 7401Scan the existing modifier mappings. 7402If it finds a modifier that contains a keycode whose set of KeySyms 7403includes XK_Meta_L or XK_Meta_R, 7404it should use that modifier bit. 7405 </para> 7406 </listitem> 7407 <listitem> 7408 <para> 7409If there is no existing modifier controlled by XK_Meta_L or XK_Meta_R, 7410it should select an unused modifier bit (one with an empty controlling set) 7411and do the following: 7412 </para> 7413 <itemizedlist> 7414 <listitem> 7415 <para> 7416If there is a keycode with XL_Meta_L in its set of KeySyms, 7417add that keycode to the set for the chosen modifier. 7418 </para> 7419 </listitem> 7420 <listitem> 7421 <para> 7422If there is a keycode with XL_Meta_R in its set of KeySyms, 7423add that keycode to the set for the chosen modifier. 7424 </para> 7425 </listitem> 7426 <listitem> 7427 <para> 7428If the controlling set is still empty, 7429interact with the user to select one or more keys to be META. 7430 </para> 7431 </listitem> 7432 </itemizedlist> 7433 </listitem> 7434 <listitem> 7435 <para> 7436If there are no unused modifier bits, 7437ask the user to take corrective action. 7438 </para> 7439 7440 <blockquote> 7441 <title>Conventions</title> 7442 <itemizedlist> 7443 <listitem> 7444 <para> 7445Clients needing a modifier not currently in use should assign keycodes 7446carrying suitable KeySyms to an unused modifier bit. 7447 </para> 7448 </listitem> 7449 <listitem> 7450 <para> 7451Clients assigning their own modifier bits should ask the user politely to 7452remove his or her hands from the key in question if their 7453<function>SetModifierMapping</function> 7454request returns a 7455<function>Busy</function> 7456status. 7457 </para> 7458 </listitem> 7459 </itemizedlist> 7460 </blockquote> 7461 </listitem> 7462</itemizedlist> 7463 7464<para> 7465There is no good solution to the problem of reclaiming assignments 7466to the five nonpreassigned modifiers when they are no longer being used. 7467</para> 7468 7469<blockquote> 7470<title>Convention</title> 7471<para> 7472The user must use 7473<function>xmodmap</function> 7474or some other utility to deassign obsolete modifier mappings by hand. 7475</para> 7476</blockquote> 7477 7478<para> 7479When a client succeeds in performing a 7480<function>SetModifierMapping</function> 7481request, 7482all clients will receive 7483<function>MappingNotify</function> 7484(request==Modifier) events. 7485There is no mechanism for preventing these events from being received. 7486A client that uses one of the nonpreassigned modifiers that receives 7487one of these events should do a 7488<function>GetModifierMapping</function> 7489request to discover the new mapping, 7490and if the modifier it is using has been cleared, 7491it should reinstall the modifier. 7492</para> 7493 7494<para> 7495Note that a 7496<function>GrabServer</function> 7497request must be used to make the 7498<function>GetModifierMapping</function> 7499and 7500<function>SetModifierMapping</function> 7501pair in these transactions atomic. 7502</para> 7503</sect1> 7504</chapter> 7505 7506<chapter id='Device_Color_Characterization'> 7507<title>Device Color Characterization</title> 7508<!-- .EQ --> 7509<!-- 7510delim @@ 7511define oc % "\\fR{\\fP" % 7512define cc % "\\fR}\\fP" % 7513--> 7514<para> 7515The X protocol provides explicit Red, Green, and Blue (RGB) values, 7516which are used to directly drive a monitor, and color names. RGB values 7517provide a mechanism for accessing the full capabilities of the display 7518device, but at the expense of having the color perceived by the user remain 7519unknowable through the protocol. Color names were originally designed to 7520provide access to a device-independent color database by having the server 7521vendor tune the definitions of the colors in that textual database. 7522Unfortunately, this still does not provide the client any way of using 7523an existing device-independent color, nor for the client to get 7524device-independent color information back about colors that it has selected. 7525</para> 7526<para> 7527Furthermore, the client must be able to discover which set of colors are 7528displayable by the device (the device gamut), both to allow colors to be 7529intelligently modified to fit within the device capabilities (gamut 7530compression) and to enable the user interface to display a representation of 7531the reachable color space to the user (gamut display). 7532</para> 7533<para> 7534Therefore, a system is needed that will provide full access to 7535device-independent color spaces for X clients. This system should use a 7536standard mechanism for naming the colors, be able to provide names for 7537existing colors, and provide means by which unreachable colors can be 7538modified to fall within the device gamut. 7539</para> 7540<para> 7541We are fortunate in this area to have a seminal work, the 1931 CIE color 7542standard, which is nearly universally agreed upon as adequate for describing 7543colors on CRT devices. This standard uses a tri-stimulus model called CIE 7544XYZ in which each perceivable color is specified as a triplet of numbers. 7545Other appropriate device-independent color models do exist, but most of them 7546are directly traceable back to this original work. 7547</para> 7548<para> 7549X device color characterization 7550provides device-independent color spaces to X clients. It does this by 7551providing the barest possible amount of information to the client that 7552allows the client to construct a mapping between CIE XYZ and the regular X 7553RGB color descriptions. 7554</para> 7555<para> 7556Device color characterization is defined by 7557the name and contents of two window properties that, 7558together, permit converting between CIE XYZ space and 7559linear RGB device space (such as standard CRTs). 7560Linear RGB devices require just two 7561pieces of information to completely characterize them: 7562</para> 7563 7564<itemizedlist> 7565 <listitem> 7566 <para> 7567A 3 x 3 matrix M and its inverse M<superscript>-1</superscript>, 7568which convert between 7569XYZ and RGB intensity (RGB<subscript>intensity</subscript>): 7570<blockquote> 7571 7572<para> 7573RGB<subscript>intensity</subscript> = M x XYZ 7574</para> 7575 7576<para> 7577XYZ = M<superscript>-1</superscript> x RGB<subscript>intensity</subscript> 7578</para> 7579 7580</blockquote> 7581 </para> 7582 </listitem> 7583 <listitem> 7584 <para> 7585A way of mapping between RGB intensity and RGB protocol value. XDCCC 7586supports three mechanisms which will be outlined later. 7587 </para> 7588 </listitem> 7589</itemizedlist> 7590 7591<para> 7592If other device types are eventually necessary, additional 7593properties will be required to describe them. 7594</para> 7595 7596<sect1 id='XYZ_lt_gt_RGB_Conversion_Matrices'> 7597<title>XYZ <-> RGB Conversion Matrices</title> 7598<para> 7599Because of the limited dynamic range of both XYZ and RGB intensity, 7600these matrices will be encoded using a fixed-point representation of a 760132-bit two's complement number scaled by 2<superscript>27</superscript>, 7602giving a range of -16 to 16 - Ε, where 7603Ε = 2<superscript>-27</superscript>. 7604</para> 7605 7606<para> 7607These matrices will be packed into an 18-element list of 32-bit values, 7608XYZ -> RGB matrix first, in row major order and stored in the 7609XDCCC_LINEAR_RGB_MATRICES properties (format = 32) on the root window of 7610each screen, using values appropriate for that screen. 7611</para> 7612 7613<para> 7614This will be encoded as shown in the following table: 7615</para> 7616 7617<informaltable frame="topbot"> 7618 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 7619 <colspec colname='c1' colwidth='1.0*'/> 7620 <colspec colname='c2' colwidth='1.0*'/> 7621 <colspec colname='c3' colwidth='3.0*'/> 7622 <thead> 7623 <row rowsep='1'> 7624 <entry>Field</entry> 7625 <entry>Type</entry> 7626 <entry>Comments</entry> 7627 </row> 7628 </thead> 7629 <tbody> 7630 <row> 7631 <entry>M<subscript>0,0</subscript></entry> 7632 <entry>INT32</entry> 7633 <entry>Interpreted as a fixed-point number -16 ≤ x < 16</entry> 7634 </row> 7635 <row> 7636 <entry>M<subscript>0,1</subscript></entry> 7637 <entry>INT32</entry> 7638 <entry></entry> 7639 </row> 7640 <row> 7641 <entry>...</entry> 7642 <entry>INT32</entry> 7643 <entry></entry> 7644 </row> 7645 <row> 7646 <entry>M<subscript>3,3</subscript></entry> 7647 <entry>INT32</entry> 7648 <entry></entry> 7649 </row> 7650 <row> 7651 <entry>M<superscript>-1</superscript><subscript>0,0</subscript></entry> 7652 <entry>INT32</entry> 7653 <entry></entry> 7654 </row> 7655 <row> 7656 <entry>M<superscript>-1</superscript><subscript>0,1</subscript></entry> 7657 <entry>INT32</entry> 7658 <entry></entry> 7659 </row> 7660 <row> 7661 <entry>...</entry> 7662 <entry>INT32</entry> 7663 <entry></entry> 7664 </row> 7665 <row> 7666 <entry>M<superscript>-1</superscript><subscript>3,3</subscript></entry> 7667 <entry>INT32</entry> 7668 <entry></entry> 7669 </row> 7670 </tbody> 7671 </tgroup> 7672</informaltable> 7673</sect1> 7674 7675<sect1 id='Intensity_dA_RGB_Value_Conversion'> 7676<title>Intensity (dA RGB Value Conversion</title> 7677<para> 7678XDCCC provides two representations for describing the conversion 7679between RGB intensity and the actual X protocol RGB values: 7680</para> 7681 7682<literallayout class="monospaced"> 76830 RGB value/RGB intensity level pairs 76841 RGB intensity ramp 7685</literallayout> 7686 7687<para> 7688In both cases, the relevant data will be stored in the 7689XDCCC_LINEAR_RGB_CORRECTION properties on the root window of each screen, 7690using values appropriate for that screen, in whatever format provides 7691adequate resolution. Each property can consist of multiple entries 7692concatenated together, if different visuals for the screen require different 7693conversion data. An entry with a VisualID of 0 specifies data for all 7694visuals of the screen that are not otherwise explicitly listed. 7695</para> 7696<para> 7697The first representation is an array of RGB value/intensity level pairs, with 7698the RGB values in strictly increasing order. When converting, the client must 7699linearly interpolate between adjacent entries in the table to compute the 7700desired value. This allows the server to perform gamma correction 7701itself and encode that fact in a short two-element correction table. The 7702intensity will be encoded as an unsigned number to be interpreted as a value 7703between 0 and 1 (inclusive). The precision of this value will depend on the 7704format of the property in which it is stored (8, 16, or 32 bits). For 16-bit 7705and 32-bit formats, the RGB value will simply be the value stored in the 7706property. When stored in 8-bit format, the RGB value can be computed from 7707the value in the property by: 7708<!-- FIXME: --> 7709</para> 7710<para> 7711<!-- .EQ C --> 7712RGB sub value ~ = ~ { Property ~ Value ~ times ~ 65535 } over 255 7713<!-- .EN --> 7714</para> 7715<para> 7716Because the three electron guns in the device may not be exactly alike in 7717response characteristics, it is necessary to allow for three separate 7718tables, one each for red, green, and blue. Therefore, each table will be 7719preceded by the number of entries in that table, and the set of tables will be 7720preceded by the number of tables. 7721When three tables are provided, they will be in red, green, blue order. 7722</para> 7723<para> 7724This will be encoded as shown in the following table: 7725</para> 7726 7727<para> 7728XDCCC_LINEAR_RGB_CORRECTION Property Contents for Type 0 Correction 7729</para> 7730<informaltable frame="topbot"> 7731 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 7732 <colspec colname='c1' colwidth='1.0*'/> 7733 <colspec colname='c2' colwidth='1.0*'/> 7734 <colspec colname='c3' colwidth='3.0*'/> 7735 <thead> 7736 <row rowsep='1'> 7737 <entry>Field</entry> 7738 <entry>Type</entry> 7739 <entry>Comments</entry> 7740 </row> 7741 </thead> 7742 <tbody> 7743 <row> 7744 <entry>VisualID0</entry> 7745 <entry>CARD</entry> 7746 <entry>Most significant portion of VisualID</entry> 7747 </row> 7748 <row> 7749 <entry>VisualID1</entry> 7750 <entry>CARD</entry> 7751 <entry>Exists if and only if the property format is 8</entry> 7752 </row> 7753 <row> 7754 <entry>VisualID2</entry> 7755 <entry>CARD</entry> 7756 <entry>Exists if and only if the property format is 8</entry> 7757 </row> 7758 <row> 7759 <entry>VisualID3</entry> 7760 <entry>CARD</entry> 7761 <entry> 7762Least significant portion, exists if and only if the property 7763format is 8 or 16 7764 </entry> 7765 </row> 7766 <row> 7767 <entry>type</entry> 7768 <entry>CARD</entry> 7769 <entry>0 for this type of correction</entry> 7770 </row> 7771 <row> 7772 <entry>count</entry> 7773 <entry>CARD</entry> 7774 <entry>Number of tables following (either 1 or 3)</entry> 7775 </row> 7776 <row> 7777 <entry>length</entry> 7778 <entry>CARD</entry> 7779 <entry>Number of pairs -1 following in this table</entry> 7780 </row> 7781 <row> 7782 <entry>value</entry> 7783 <entry>CARD</entry> 7784 <entry>X Protocol RBG value</entry> 7785 </row> 7786 <row> 7787 <entry>intensity</entry> 7788 <entry>CARD</entry> 7789 <entry> 7790Interpret as number 0 ≤ <emphasis>intensity</emphasis> ≤ 1 7791 </entry> 7792 </row> 7793 <row> 7794 <entry>...</entry> 7795 <entry>...</entry> 7796 <entry> 7797Total of <emphasis remap='I'>length+1</emphasis> pairs of 7798value/intensity values 7799 </entry> 7800 </row> 7801 <row> 7802 <entry>lengthg</entry> 7803 <entry>CARD</entry> 7804 <entry> 7805Number of pairs -1 following in this table (if and only if 7806<emphasis>count</emphasis> is 3 7807 </entry> 7808 </row> 7809 <row> 7810 <entry>value</entry> 7811 <entry>CARD</entry> 7812 <entry>X Protocol RBG value</entry> 7813 </row> 7814 <row> 7815 <entry>intensity</entry> 7816 <entry>CARD</entry> 7817 <entry> 7818Interpret as a number 0 ≤ <emphasis>intensity</emphasis> ≤ 1 7819 </entry> 7820 </row> 7821 <row> 7822 <entry>...</entry> 7823 <entry>...</entry> 7824 <entry> 7825Total of <emphasis remap='I'>length+1</emphasis> pairs of 7826value/intensity values 7827 </entry> 7828 </row> 7829 <row> 7830 <entry>lengthb</entry> 7831 <entry>CARD</entry> 7832 <entry> 7833Number of pairs -1 following in this table (if and only if 7834<emphasis>count</emphasis> is 3 7835 </entry> 7836 </row> 7837 <row> 7838 <entry>value</entry> 7839 <entry>CARD</entry> 7840 <entry>X Protocol RBG value</entry> 7841 </row> 7842 <row> 7843 <entry>intensity</entry> 7844 <entry>CARD</entry> 7845 <entry> 7846Interpret as a number 0 ≤ <emphasis>intensity</emphasis> ≤ 1 7847 </entry> 7848 </row> 7849 <row> 7850 <entry>...</entry> 7851 <entry>...</entry> 7852 <entry> 7853Total of <emphasis remap='I'>length+1</emphasis> pairs of 7854value/intensity values 7855 </entry> 7856 </row> 7857 </tbody> 7858 </tgroup> 7859</informaltable> 7860 7861<para> 7862The VisualID is stored in 4, 2, or 1 pieces, depending on whether 7863the property format is 8, 16, or 32, respectively. The VisualID is always 7864stored most significant piece first. 7865Note that the length fields are stored as one less than the actual length, 7866so 256 entries can be stored in format 8. 7867</para> 7868<para> 7869The second representation is a simple array of intensities for a linear subset 7870of RGB values. The expected size of this table is the bits-per-rgb-value of 7871the screen, but it can be any length. This is similar to the first mechanism, 7872except that the RGB value numbers are implicitly defined by the index in the 7873array (indices start at 0): 7874</para> 7875<blockquote> 7876<para> 7877<!-- FIXME --> 7878<!-- .EQ C --> 7879RGB sub value ~ = ~ { Array ~ Index ~ times ~ 65535 } over 7880{ Array ~ Size ~ - ~ 1 } 7881</para> 7882</blockquote> 7883 7884<para> 7885When converting, the client may linearly interpolate between entries in this 7886table. The intensity values will be encoded just as in the first 7887representation. 7888</para> 7889 7890<para> 7891This will be encoded as shown in the following table: 7892</para> 7893 7894<para> 7895XDCCC_LINEAR_RGB_CORRECTION Property Contents for Type 1 Correction 7896</para> 7897 7898<informaltable frame="topbot"> 7899 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 7900 <colspec colname='c1' colwidth='1.0*'/> 7901 <colspec colname='c2' colwidth='1.0*'/> 7902 <colspec colname='c3' colwidth='3.0*'/> 7903 <thead> 7904 <row rowsep='1'> 7905 <entry>Field</entry> 7906 <entry>Type</entry> 7907 <entry>Comments</entry> 7908 </row> 7909 </thead> 7910 <tbody> 7911 <row> 7912 <entry>VisualID0</entry> 7913 <entry>CARD</entry> 7914 <entry>Most significant portion of VisualID</entry> 7915 </row> 7916 <row> 7917 <entry>VisualID1</entry> 7918 <entry>CARD</entry> 7919 <entry>Exists if and only if the property format is 8</entry> 7920 </row> 7921 <row> 7922 <entry>VisualID2</entry> 7923 <entry>CARD</entry> 7924 <entry>Exists if and only if the property format is 8</entry> 7925 </row> 7926 <row> 7927 <entry>VisualID3</entry> 7928 <entry>CARD</entry> 7929 <entry> 7930Least significant portion, exists if and only if the property 7931format is 8 or 16 7932 </entry> 7933 </row> 7934 <row> 7935 <entry>type</entry> 7936 <entry>CARD</entry> 7937 <entry>1 for this type of correction</entry> 7938 </row> 7939 <row> 7940 <entry>count</entry> 7941 <entry>CARD</entry> 7942 <entry>Number of tables following (either 1 or 3)</entry> 7943 </row> 7944 <row> 7945 <entry>length</entry> 7946 <entry>CARD</entry> 7947 <entry>Number of pairs -1 following in this table</entry> 7948 </row> 7949 <row> 7950 <entry>intensity</entry> 7951 <entry>CARD</entry> 7952 <entry> 7953Interpret as number 0 ≤ <emphasis>intensity</emphasis> ≤ 1 7954 </entry> 7955 </row> 7956 <row> 7957 <entry>...</entry> 7958 <entry>...</entry> 7959 <entry> 7960Total of <emphasis remap='I'>length+1</emphasis> pairs of 7961value/intensity values 7962 </entry> 7963 </row> 7964 <row> 7965 <entry>lengthg</entry> 7966 <entry>CARD</entry> 7967 <entry> 7968Number of pairs -1 following in this table (if and only if 7969<emphasis>count</emphasis> is 3 7970 </entry> 7971 </row> 7972 <row> 7973 <entry>intensity</entry> 7974 <entry>CARD</entry> 7975 <entry> 7976Interpret as a number 0 ≤ <emphasis>intensity</emphasis> ≤ 1 7977 </entry> 7978 </row> 7979 <row> 7980 <entry>...</entry> 7981 <entry>...</entry> 7982 <entry> 7983Total of <emphasis remap='I'>length+1</emphasis> pairs of 7984value/intensity values 7985 </entry> 7986 </row> 7987 <row> 7988 <entry>lengthb</entry> 7989 <entry>CARD</entry> 7990 <entry> 7991Number of pairs -1 following in this table (if and only if 7992<emphasis>count</emphasis> is 3 7993 </entry> 7994 </row> 7995 <row> 7996 <entry>intensity</entry> 7997 <entry>CARD</entry> 7998 <entry> 7999Interpret as a number 0 ≤ <emphasis>intensity</emphasis> ≤ 1 8000 </entry> 8001 </row> 8002 <row> 8003 <entry>...</entry> 8004 <entry>...</entry> 8005 <entry> 8006Total of <emphasis remap='I'>length+1</emphasis> pairs of 8007value/intensity values 8008 </entry> 8009 </row> 8010 </tbody> 8011 </tgroup> 8012</informaltable> 8013</sect1> 8014</chapter> 8015 8016<chapter id='Conclusion'> 8017<title>Conclusion</title> 8018<para> 8019This document provides the protocol-level specification of the minimal 8020conventions needed to ensure that X Version 11 clients can interoperate 8021properly. This document specifies interoperability conventions only for the 8022X Version 11 protocol. Clients should be aware of other protocols that 8023should be used for better interoperation in the X environment. The reader 8024is referred to 8025<emphasis remap='I'>X Session Management Protocol</emphasis> 8026for information on session management, and to 8027<emphasis remap='I'>Inter-Client Exchange Protocol</emphasis> 8028for information on general-purpose communication among clients. 8029</para> 8030 8031<sect1 id='The_X_Registry'> 8032<title>The X Registry</title> 8033<!-- .IN "X Registry" --> 8034<para> 8035The X Consortium maintains a registry of certain X-related items, to aid in 8036avoiding conflicts and in sharing of such items. Readers are 8037encouraged to use the registry. The classes of items kept in the registry 8038that are relevant to the ICCCM include property names, property types, 8039selection names, selection targets, WM_PROTOCOLS protocols, 8040<function>ClientMessage</function> 8041types, and application classes. Requests to register items, or questions 8042about registration, should be addressed to 8043 <address> 8044 xregistry@x.org 8045 </address> 8046or to 8047 <address> 8048 The X.Org Foundation -- X11 Registry 8049 c/o Alan Coopersmith 8050 Oracle Corporation 8051 M/S SCA17-3824 8052 4170 Network Circle 8053 Santa Clara, CA 95054 8054 USA 8055 </address> 8056</para> 8057<para> 8058Electronic mail will be acknowledged upon receipt. Please allow up to 4 8059weeks for a formal response to registration and inquiries. 8060</para> 8061<para> 8062The registry is published as part of the X software distribution from the 8063X.Org Foundation. All registered items must have the postal address of someone 8064responsible for the item or a reference to a document describing the item 8065and the postal address of where to write to obtain the document. 8066</para> 8067<!-- .bp --> 8068<!-- .\" Set registers to number the appendixes A.1, B.1, C.1, ... --> 8069<!-- .nr H1 0 --> 8070<!-- .af H1 A --> 8071<!-- .cT "Appendix A" no --> 8072</sect1> 8073</chapter> 8074 8075<appendix id="revision_history"> 8076<title>Revision History</title> 8077<para> 8078This appendix describes the revision history of this document and 8079summarizes the incompatibilities between this and earlier versions. 8080</para> 8081<sect1 id='The_X11R2_Draft'> 8082<title>The X11R2 Draft</title> 8083<para> 8084The February 25, 1988, draft that was distributed as part of X Version 11, 8085Release 2, was clearly labeled as such, 8086and many areas were explicitly labeled as liable to change. 8087Nevertheless, in the revision work done since then, 8088we have been very careful not to introduce gratuitous incompatibility. 8089As far as possible, 8090we have tried to ensure that clients obeying the conventions 8091in the X11R2 draft would still work. 8092</para> 8093</sect1> 8094 8095<sect1 id='The_July_27_1988_Draft'> 8096<title>The July 27, 1988, Draft</title> 8097<para> 8098The Consortium review was based on a draft dated July 27, 1988. This draft 8099included several areas in which incompatibilities with the X11R2 draft were 8100necessary: 8101</para> 8102 8103<itemizedlist> 8104 <listitem> 8105 <para> 8106The use of property 8107<function>None</function> 8108in 8109<function>ConvertSelection</function> 8110requests is no longer allowed. 8111Owners that receive them are free to use the target atom as the property 8112to respond with, 8113which will work in most cases. 8114 </para> 8115 </listitem> 8116 <listitem> 8117 <para> 8118The protocol for INCREMENTAL type properties as selection replies has changed, 8119and the name has been changed to INCR. 8120Selection requestors are free to implement the earlier protocol 8121if they receive properties of type INCREMENTAL. 8122 </para> 8123 </listitem> 8124 <listitem> 8125 <para> 8126The protocol for INDIRECT type properties as selection replies has changed, 8127and the name has been changed to MULTIPLE. 8128Selection requestors are free to implement the earlier protocol 8129if they receive properties of type INDIRECT. 8130 </para> 8131 </listitem> 8132 <listitem> 8133 <para> 8134The protocol for the special CLIPBOARD client has changed. 8135The earlier protocol is subject to race conditions and should not be used. 8136 </para> 8137 </listitem> 8138 <listitem> 8139 <para> 8140The set of state values in WM_HINTS.initial_state has been reduced, 8141but the values that are still valid are unchanged. 8142Window managers should treat the other values sensibly. 8143 </para> 8144 </listitem> 8145 <listitem> 8146 <para> 8147The methods an application uses to change the state of its top-level window 8148have changed but in such a way that cases that used to work will still work. 8149 </para> 8150 </listitem> 8151 <listitem> 8152 <para> 8153The x, y, width, and height fields have been removed from the WM_NORMAL_HINTS 8154property and replaced by pad fields. 8155Values set into these fields will be ignored. 8156The position and size of the window should be set by setting the appropriate 8157window attributes. 8158 </para> 8159 </listitem> 8160 <listitem> 8161 <para> 8162A pair of base fields and a win_gravity field have been added 8163to the WM_NORMAL_HINTS property. 8164Window managers will assume values for these fields if the client 8165sets a short property. 8166 </para> 8167 </listitem> 8168</itemizedlist> 8169</sect1> 8170 8171<sect1 id='The_Public_Review_Drafts'> 8172<title>The Public Review Drafts</title> 8173<para> 8174The Consortium review resulted in several incompatible changes. These 8175changes were included in drafts that were distributed for public review 8176during the first half of 1989. 8177</para> 8178 8179<itemizedlist> 8180 <listitem> 8181 <para> 8182The messages field of the WM_HINTS property was found to be unwieldy 8183and difficult to evolve. 8184It has been replaced by the WM_PROTOCOLS property, 8185but clients that use the earlier mechanism can be detected 8186because they set the messages bit in the flags field of the WM_HINTS property, 8187and window managers can provide a backwards compatibility mode. 8188 </para> 8189 </listitem> 8190 <listitem> 8191 <para> 8192The mechanism described in the earlier draft by which clients installed 8193their own subwindow colormaps could not be made to work reliably 8194and mandated some features of the look and feel. 8195It has been replaced by the WM_COLORMAP_WINDOWS property. 8196Clients that use the earlier mechanism can be detected by the WM_COLORMAPS 8197property they set on their top-level window, 8198but providing a reliable backwards compatibility mode is not possible. 8199 </para> 8200 </listitem> 8201 <listitem> 8202 <para> 8203The recommendations for window manager treatment of top-level window borders 8204have been changed as those in the earlier draft produced problems 8205with Visibility events. 8206For nonwindow manager clients, 8207there is no incompatibility. 8208 </para> 8209 </listitem> 8210 <listitem> 8211 <para> 8212The pseudoroot facility in the earlier draft has been removed. 8213Although it has been successfully implemented, 8214it turns out to be inadequate to support the uses envisaged. 8215An extension will be required to support these uses fully, 8216and it was felt that the maximum freedom should be left to the designers 8217of the extension. 8218In general, 8219the previous mechanism was invisible to clients and no incompatibility 8220should result. 8221 </para> 8222 </listitem> 8223 <listitem> 8224 <para> 8225The addition of the WM_DELETE_WINDOW protocol (which prevents the danger 8226that multi-window clients may be terminated unexpectedly) 8227has meant some changes in the WM_SAVE_YOURSELF protocol, 8228to ensure that the two protocols are orthogonal. 8229Clients using the earlier protocol can be detected (see WM_PROTOCOLS above) 8230and supported in a backwards compatibility mode. 8231 </para> 8232 </listitem> 8233 <listitem> 8234 <para> 8235The conventions in Section 14.3.1. of 8236<emphasis remap='I'>Xlib - C Language X Interface</emphasis> 8237regarding properties of type RGB_COLOR_MAP have been changed, 8238but clients that use the earlier conventions can be detected 8239because their properties are 4 bytes shorter. 8240These clients will work correctly if the server supports only a single Visual 8241or if they use only the Visual of the root. 8242These are the only cases in which they would have worked, anyway. 8243 </para> 8244 </listitem> 8245</itemizedlist> 8246</sect1> 8247 8248<sect1 id='Version_10_July_1989'> 8249<title>Version 1.0, July 1989</title> 8250<para> 8251The public review resulted in a set of mostly editorial changes. The 8252changes in version 1.0 that introduced some degree of incompatibility with 8253the earlier drafts are: 8254</para> 8255<itemizedlist> 8256 <listitem> 8257 <para> 8258A new section ( 8259<xref linkend='Grabs' xrefstyle='select: title'/> 8260) was added covering the window manager's 8261use of Grabs. 8262The restrictions it imposes should affect only window managers. 8263 </para> 8264 </listitem> 8265 <listitem> 8266 <para> 8267<!-- .bP --> 8268The TARGETS selection target has been clarified, 8269and it may be necessary for clients to add some entries to their replies. 8270 </para> 8271 </listitem> 8272 <listitem> 8273 <para> 8274<!-- .bP --> 8275A selection owner using INCR transfer should no longer replace targets in 8276a MULTIPLE property with the atom INCR. 8277 </para> 8278 </listitem> 8279 <listitem> 8280 <para> 8281<!-- .bP --> 8282The contents of the 8283<function>ClientMessage</function> 8284event sent by a client to iconify itself has been clarified, 8285but there should be no incompatibility because the earlier contents 8286would not in fact have worked. 8287 </para> 8288 </listitem> 8289 <listitem> 8290 <para> 8291<!-- .bP --> 8292The border-width in synthetic 8293<function>ConfigureNotify</function> 8294events is now specified, 8295but this should not cause any incompatibility. 8296 </para> 8297 </listitem> 8298 <listitem> 8299 <para> 8300<!-- .bP --> 8301Clients are now asked to set a border-width on all 8302<function>ConfigureWindow</function> 8303requests. 8304 </para> 8305 </listitem> 8306 <listitem> 8307 <para> 8308<!-- .bP --> 8309Window manager properties on icon windows now will be ignored, 8310but there should be no incompatibility 8311because there was no specification that they be obeyed previously. 8312 </para> 8313 </listitem> 8314 <listitem> 8315 <para> 8316<!-- .bP --> 8317The ordering of real and synthetic 8318<function>ConfigureNotify</function> 8319events is now specified, 8320but any incompatibility should affect only window managers. 8321 </para> 8322 </listitem> 8323 <listitem> 8324 <para> 8325<!-- .bP --> 8326The semantics of WM_SAVE_YOURSELF have been clarified and restricted to 8327be a checkpoint operation only. 8328Clients that were using it as part of a shutdown sequence may need to 8329be modified, 8330especially if they were interacting with the user during the shutdown. 8331 </para> 8332 </listitem> 8333 <listitem> 8334 <para> 8335<!-- .bP --> 8336A kill_id field has been added to RGB_COLOR_MAP properties. 8337Clients using earlier conventions can be detected by the size of their 8338RGB_COLOR_MAP properties, 8339and the cases that would have worked will still work. 8340 </para> 8341 </listitem> 8342</itemizedlist> 8343</sect1> 8344 8345<sect1 id='Version_11'> 8346<title>Version 1.1</title> 8347<para> 8348Version 1.1 was released with X11R5 in September 1991. In addition to some 8349minor editorial changes, there were a few semantic changes since Version 83501.0: 8351</para> 8352 8353 8354<itemizedlist> 8355 <listitem> 8356 <para> 8357<!-- .bP --> 8358The section on Device Color Characterization was added. 8359 </para> 8360 </listitem> 8361 <listitem> 8362 <para> 8363<!-- .bP --> 8364The meaning of the NULL property type was clarified. 8365 </para> 8366 </listitem> 8367 <listitem> 8368 <para> 8369<!-- .bP --> 8370Appropriate references to Compound Text were added. 8371 </para> 8372 </listitem> 8373</itemizedlist> 8374</sect1> 8375 8376<sect1 id='Public_Review_Draft_December_1993'> 8377<title>Public Review Draft, December 1993</title> 8378<para> 8379The following changes have been made in preparing the public review draft 8380for Version 2.0. 8381</para> 8382 8383<itemizedlist> 8384 <listitem> 8385 <para> 8386[P01] Addition of advice to clients on how to keep track of a top-level 8387window's absolute position on the screen. 8388 </para> 8389 </listitem> 8390 <listitem> 8391 <para> 8392<!-- .bP --> 8393[P03] A technique for clients to detect when it is safe to reuse a 8394top-level window has been added. 8395 </para> 8396 </listitem> 8397 <listitem> 8398 <para> 8399<!-- .bP --> 8400[P06] 8401<xref linkend='Colormaps' xrefstyle='select: title'/> 8402, on colormaps, has been rewritten. A new feature that 8403allows clients to install their own colormaps has also been added. 8404 </para> 8405 </listitem> 8406 <listitem> 8407 <para> 8408<!-- .bP --> 8409[P08] The LENGTH target has been deprecated. 8410 </para> 8411 </listitem> 8412 <listitem> 8413 <para> 8414<!-- .bP --> 8415[P11] The manager selections facility was added. 8416 </para> 8417 </listitem> 8418 <listitem> 8419 <para> 8420<!-- .bP --> 8421[P17] The definition of the aspect ratio fields of the WM_NORMAL_HINTS 8422property has been changed to include the base size. 8423 </para> 8424 </listitem> 8425 <listitem> 8426 <para> 8427<!-- .bP --> 8428[P19] 8429<function>StaticGravity</function> 8430has been added to the list of values allowed for the win_gravity field of 8431the WM_HINTS property. The meaning of the 8432<function>CenterGravity</function> 8433value has been clarified. 8434 </para> 8435 </listitem> 8436 <listitem> 8437 <para> 8438<!-- .bP --> 8439[P20] A means for clients to query the ICCCM compliance level of the window 8440manager has been added. 8441 </para> 8442 </listitem> 8443 <listitem> 8444 <para> 8445<!-- .bP --> 8446[P22] The definition of the MULTIPLE selection target has been clarified. 8447 </para> 8448 </listitem> 8449 <listitem> 8450 <para> 8451<!-- .bP --> 8452[P25] A definition of "top-level window" has been added. The WM_STATE 8453property has been defined and exposed to clients. 8454 </para> 8455 </listitem> 8456 <listitem> 8457 <para> 8458<!-- .bP --> 8459[P26] The definition of window states has been clarified and the wording 8460regarding window state changes has been made more consistent. 8461 </para> 8462 </listitem> 8463 <listitem> 8464 <para> 8465<!-- .bP --> 8466[P27] Clarified the rules governing when window managers are required to send 8467synthetic 8468<function>ConfigureNotify</function> 8469events. 8470 </para> 8471 </listitem> 8472 <listitem> 8473 <para> 8474<!-- .bP --> 8475[P28] Added a recommended technique for setting the input focus to a window 8476as soon as it is mapped. 8477 </para> 8478 </listitem> 8479 <listitem> 8480 <para> 8481<!-- .bP --> 8482[P29] The required lifetime of resource IDs named in window manager 8483properties has been specified. 8484 </para> 8485 </listitem> 8486 <listitem> 8487 <para> 8488<!-- .bP --> 8489[P30] Advice for dealing with keystrokes and override-redirect windows has 8490been added. 8491 </para> 8492 </listitem> 8493 <listitem> 8494 <para> 8495<!-- .bP --> 8496[P31] A statement on the ownership of resources transferred through the 8497selection mechanism has been added. 8498 </para> 8499 </listitem> 8500 <listitem> 8501 <para> 8502<!-- .bP --> 8503[P32] The definition of the CLIENT_WINDOW target has been clarified. 8504 </para> 8505 </listitem> 8506 <listitem> 8507 <para> 8508<!-- .bP --> 8509[P33] A rule about requiring the selection owner to reacquire the 8510selection under certain circumstances has been added. 8511 </para> 8512 </listitem> 8513 <listitem> 8514 <para> 8515<!-- .bP --> 8516[P42] Added several new selection targets. 8517 </para> 8518 </listitem> 8519 <listitem> 8520 <para> 8521<!-- .bP --> 8522[P44] Ambiguous wording regarding the withdrawal of top-level windows 8523has been removed. 8524 </para> 8525 </listitem> 8526 <listitem> 8527 <para> 8528<!-- .bP --> 8529[P45] A facility for requestors to pass parameters during a selection 8530request has been added. 8531 </para> 8532 </listitem> 8533 <listitem> 8534 <para> 8535<!-- .bP --> 8536[P49] A convention on discriminated names has been added. 8537 </para> 8538 </listitem> 8539 <listitem> 8540 <para> 8541<!-- .bP --> 8542[P57] The C_STRING property type was added. 8543 </para> 8544 </listitem> 8545 <listitem> 8546 <para> 8547<!-- .bP --> 8548[P62] An ordering requirement on processing selection requests was added. 8549 </para> 8550 </listitem> 8551 <listitem> 8552 <para> 8553<!-- .bP --> 8554[P63] The 8555<function>VisibleHint</function> 8556flag was added. 8557 </para> 8558 </listitem> 8559 <listitem> 8560 <para> 8561<!-- .bP --> 8562[P64] The session management section has been updated to align with the new 8563session management protocol. The old session management conventions have 8564been moved to Appendix C. 8565 </para> 8566 </listitem> 8567 <listitem> 8568 <para> 8569<!-- .bP --> 8570References to the never-forthcoming 8571<emphasis remap='I'>Window and Session Manager 8572Conventions Manual</emphasis> have been removed. 8573 </para> 8574 </listitem> 8575 <listitem> 8576 <para> 8577<!-- .bP --> 8578Information on the X Registry and references to the session management and 8579ICE documents have been added. 8580 </para> 8581 </listitem> 8582 <listitem> 8583 <para> 8584<!-- .bP --> 8585Numerous editorial and typographical improvements have been made. 8586 </para> 8587 </listitem> 8588</itemizedlist> 8589</sect1> 8590 8591<sect1 id='Version_20_April_1994'> 8592<title>Version 2.0, April 1994</title> 8593<para> 8594The following changes have been made in preparation for releasing 8595the final edition of Version 2.0 with X11R6. 8596</para> 8597<itemizedlist> 8598 <listitem> 8599 <para> 8600<!-- .bP --> 8601The PIXMAP selection target has been revised to return a property of type 8602PIXMAP instead of type DRAWABLE. 8603 </para> 8604 </listitem> 8605 <listitem> 8606 <para> 8607<!-- .bP --> 8608The session management section has been revised slightly to correspond with 8609the changes to the 8610<emphasis remap='I'>X Session Management Protocol</emphasis>. 8611 </para> 8612 </listitem> 8613 <listitem> 8614 <para> 8615<!-- .bP --> 8616Window managers are now prohibited from placing 8617<function>CurrentTime</function> 8618in the timestamp field of WM_TAKE_FOCUS messages. 8619 </para> 8620 </listitem> 8621 <listitem> 8622 <para> 8623<!-- .bP --> 8624In the WM_HINTS property, the 8625<function>VisibleHint</function> 8626flag has been renamed to 8627<function>UrgencyHint</function>. 8628Its semantics have also been defined more thoroughly. 8629 </para> 8630 </listitem> 8631 <listitem> 8632 <para> 8633<!-- .bP --> 8634Additional editorial and typographical changes have been made. 8635 </para> 8636 </listitem> 8637</itemizedlist> 8638<!-- .bp --> 8639<!-- .cT "Appendix B" no --> 8640</sect1> 8641</appendix> 8642 8643<appendix id="suggested_protocol_revisions"> 8644<title>Suggested Protocol Revisions</title> 8645<para> 8646During the development of these conventions, 8647a number of inadequacies have been discovered in the 8648core X11 protocol. 8649They are summarized here as input to an eventual protocol revision 8650design process: 8651</para> 8652 8653<itemizedlist> 8654 <listitem> 8655 <para> 8656There is no way for anyone to find out the last-change time of 8657a selection. 8658The 8659<function>GetSelectionOwner</function> 8660request should be changed to return the last-change time as well as the owner. 8661 </para> 8662 </listitem> 8663 <listitem> 8664 <para> 8665<!-- .bP --> 8666There is no way for a client to find out which selection atoms are valid. 8667 </para> 8668 </listitem> 8669 <listitem> 8670 <para> 8671<!-- .bP --> 8672There would be no need for WM_TAKE_FOCUS if the 8673<function>FocusIn</function> 8674event contained a timestamp and a previous-focus field. 8675This could avoid the potential race condition. 8676There is space in the event for this information; 8677it should be added at the next protocol revision. 8678 </para> 8679 </listitem> 8680 <listitem> 8681 <para> 8682<!-- .bP --> 8683There is a race condition in the 8684<function>InstallColormap</function> 8685request. 8686It does not take a timestamp and may be executed after the top-level colormap 8687has been uninstalled. 8688The next protocol revision should provide the timestamp in the 8689<function>InstallColormap</function>, 8690<function>UninstallColormap</function>, 8691<function>ListInstalledColormaps</function> 8692requests and in the 8693<function>ColormapNotify</function> 8694event. 8695The timestamp should be used in a similar way to the last-focus-change 8696time for the input focus. The lack of timestamps in these packets is the 8697reason for restricting colormap installation to the window manager. 8698 </para> 8699 </listitem> 8700 <listitem> 8701 <para> 8702<!-- .bP --> 8703The protocol needs to be changed to provide some way of identifying 8704the Visual and the Screen of a colormap. 8705 </para> 8706 </listitem> 8707 <listitem> 8708 <para> 8709<!-- .bP --> 8710There should be some way to reclaim assignments to the five nonpreassigned 8711modifiers when they are no longer needed. The manual method is unpleasantly 8712low-tech. 8713 </para> 8714 </listitem> 8715</itemizedlist> 8716<!-- .bp --> 8717</appendix> 8718 8719<appendix id="obsolete_session_manager_conventions"> 8720<title>Obsolete Session Manager Conventions</title> 8721 8722<para> 8723This appendix contains obsolete conventions for session management using X 8724properties and messages. The conventions described here are deprecated and 8725are described only for historical interest. For further information on 8726session management, see 8727<emphasis remap='I'>X Session Management Protocol</emphasis>. 8728</para> 8729 8730<sect1 id='Properties'> 8731<title>Properties</title> 8732<para> 8733The client communicates with the session manager by placing two properties 8734(WM_COMMAND and WM_CLIENT_MACHINE) on its top-level window. 8735If the client has a group of top-level windows, 8736these properties should be placed on the group leader window. 8737</para> 8738<para> 8739The window manager is responsible for placing a WM_STATE property 8740on each top-level client window for use by session managers and other clients 8741that need to be able to identify top-level client windows and their state. 8742</para> 8743 8744<sect2 id='WM_COMMAND_Property'> 8745<title>WM_COMMAND Property</title> 8746<para> 8747The WM_COMMAND property represents the command used to start or restart the 8748client. By updating this property, clients should ensure that it always 8749reflects a command that will restart them in their current state. The 8750content and type of the property depend on the operating system of the 8751machine running the client. On POSIX-conformant systems using ISO Latin-1 8752characters for their command lines, the property should: 8753</para> 8754 8755<!-- .bP --> 8756<itemizedlist> 8757 <listitem> 8758 <para> 8759Be of type STRING 8760 </para> 8761 </listitem> 8762 <listitem> 8763 <para> 8764Contain a list of null-terminated strings 8765 </para> 8766 </listitem> 8767 <listitem> 8768 <para> 8769Be initialized from argv 8770 </para> 8771 <para> 8772Other systems will need to set appropriate conventions for the type 8773and contents of WM_COMMAND properties. 8774Window and session managers should not assume that STRING is 8775the type of WM_COMMAND or that they will be able to understand 8776or display its contents. 8777 </para> 8778 </listitem> 8779</itemizedlist> 8780 8781<para> 8782Note that WM_COMMAND strings are null-terminated 8783and differ from the general conventions that STRING properties 8784are null-separated. 8785This inconsistency is necessary for backwards compatibility. 8786</para> 8787<para> 8788A client with multiple top-level windows should ensure 8789that exactly one of them has a WM_COMMAND with nonzero length. 8790Zero-length WM_COMMAND properties can be used to reply to WM_SAVE_YOURSELF 8791messages on other top-level windows but will otherwise be ignored. 8792</para> 8793</sect2> 8794 8795<sect2 id='WM_CLIENT_MACHINE_Property_2'> 8796<title>WM_CLIENT_MACHINE Property</title> 8797<para> 8798This property is described in 8799<xref linkend='WM_CLIENT_MACHINE_Property' xrefstyle='select: title'/>. 8800</para> 8801</sect2> 8802</sect1> 8803 8804<sect1 id='Termination'> 8805<title>Termination</title> 8806<para> 8807Because they communicate by means of unreliable network connections, clients 8808must be prepared for their connection to the server to be terminated at any 8809time without warning. They cannot depend on getting notification that 8810termination is imminent or on being able to use the server to negotiate with 8811the user about their fate. For example, clients cannot depend on being able 8812to put up a dialog box. 8813</para> 8814<para> 8815Similarly, clients may terminate at any time without notice to the session 8816manager. When a client terminates itself rather than being terminated by 8817the session manager, it is viewed as having resigned from the session in 8818question, and it will not be revived if the session is revived. 8819</para> 8820</sect1> 8821 8822<sect1 id='Client_Responses_to_Session_Manager_Actions'> 8823<title>Client Responses to Session Manager Actions</title> 8824<para> 8825Clients may need to respond to session manager actions in two ways: 8826</para> 8827 8828<itemizedlist> 8829 <listitem> 8830 <para> 8831Saving their internal state 8832 </para> 8833 </listitem> 8834 <listitem> 8835 <para> 8836<!-- .bP --> 8837Deleting a window 8838 </para> 8839 </listitem> 8840</itemizedlist> 8841 8842<sect2 id='Saving_Client_State'> 8843<title>Saving Client State</title> 8844<para> 8845Clients that want to be warned when the session manager feels 8846that they should save their internal state (for example, 8847when termination impends) should include the atom WM_SAVE_YOURSELF 8848in the WM_PROTOCOLS property on their top-level windows to participate 8849in the WM_SAVE_YOURSELF protocol. 8850They will receive a 8851<function>ClientMessage</function> 8852event as described in 8853<xref linkend='ClientMessage_Events' xrefstyle='select: title'/> 8854with the atom WM_SAVE_YOURSELF in its data[0] field. 8855</para> 8856 8857<para> 8858Clients that receive WM_SAVE_YOURSELF should place themselves in a state from 8859which they can be restarted and should update WM_COMMAND to 8860be a command that will restart them in this state. 8861The session manager will be waiting for a 8862<function>PropertyNotify</function> 8863event on WM_COMMAND as a confirmation that the client has saved its state. 8864Therefore, WM_COMMAND should be updated (perhaps with a zero-length append) 8865even if its contents are correct. 8866No interactions with the user are permitted during this process. 8867</para> 8868 8869<para> 8870Once it has received this confirmation, 8871the session manager will feel free to terminate the client if that is what 8872the user asked for. 8873Otherwise, 8874if the user asked for the session to be put to sleep, 8875the session manager will ensure that the client does not 8876receive any mouse or keyboard events. 8877</para> 8878 8879<para> 8880After receiving a WM_SAVE_YOURSELF, saving its state, and updating WM_COMMAND, 8881the client should not change its state (in the sense of doing anything 8882that would require a change to WM_COMMAND) until it receives a mouse 8883or keyboard event. 8884Once it does so, 8885it can assume that the danger is over. 8886The session manager will ensure that these events do not reach 8887clients until the danger is over or until the clients have been killed. 8888</para> 8889 8890<para> 8891Irrespective of how they are arranged in window groups, 8892clients with multiple top-level windows should ensure the following: 8893</para> 8894 8895<itemizedlist> 8896 <listitem> 8897 <para> 8898Only one of their top-level windows has a nonzero-length WM_COMMAND 8899property. 8900 </para> 8901 </listitem> 8902 <listitem> 8903 <para> 8904They respond to a WM_SAVE_YOURSELF message by: 8905 </para> 8906 <itemizedlist> 8907 <listitem> 8908 <para> 8909First, updating the nonzero-length WM_COMMAND property, if necessary 8910 </para> 8911 </listitem> 8912 <listitem> 8913 <para> 8914Second, updating the WM_COMMAND property on the window for which they received 8915the WM_SAVE_YOURSELF message if it was not updated in the first step 8916 </para> 8917 </listitem> 8918 </itemizedlist> 8919 </listitem> 8920</itemizedlist> 8921 8922<para> 8923Receiving WM_SAVE_YOURSELF on a window is, conceptually, a command 8924to save the entire client state. 8925<footnote><para> 8926This convention has changed since earlier drafts because of the 8927introduction of the protocol in the next section. 8928In the public review draft, 8929there was ambiguity as to whether WM_SAVE_YOURSELF was a checkpoint 8930or a shutdown facility. 8931It is now unambiguously a checkpoint facility; 8932if a shutdown facility is judged to be necessary, 8933a separate WM_PROTOCOLS protocol will be developed and registered 8934with the X Consortium. 8935</para> 8936</footnote> 8937</para> 8938</sect2> 8939 8940<sect2 id='Window_Deletion_2'> 8941<title>Window Deletion</title> 8942<para> 8943Windows are deleted using the WM_DELETE_WINDOW protocol, which 8944is described in 8945<xref linkend='Window_Deletion' xrefstyle='select: title'/>. 8946</para> 8947</sect2> 8948</sect1> 8949 8950<sect1 id='Summary_of_Session_Manager_Property_Types'> 8951<title>Summary of Session Manager Property Types</title> 8952<para> 8953The session manager properties are listed in the following table: 8954</para> 8955 8956<informaltable frame="topbot"> 8957 <?dbfo keep-together="always" ?> 8958 <tgroup cols='4' align='left' colsep='0' rowsep='0'> 8959 <colspec colname='c1' colwidth='2.0*'/> 8960 <colspec colname='c2' colwidth='1.0*'/> 8961 <colspec colname='c3' colwidth='1.0*'/> 8962 <colspec colname='c4' colwidth='3.0*'/> 8963 <thead> 8964 <row rowsep='1'> 8965 <entry>Name</entry> 8966 <entry>Type</entry> 8967 <entry>Format</entry> 8968 <entry>See Section</entry> 8969 </row> 8970 </thead> 8971 <tbody> 8972 <row> 8973 <entry>WM_CLIENT_MACHINE</entry> 8974 <entry>TEXT</entry> 8975 <entry></entry> 8976 <entry> 8977<xref linkend='WM_CLIENT_MACHINE_Property' xrefstyle='select: title'/> 8978 </entry> 8979 </row> 8980 <row> 8981 <entry>WM_COMMAND</entry> 8982 <entry>TEXT</entry> 8983 <entry></entry> 8984 <entry> 8985<xref linkend='WM_COMMAND_Property' xrefstyle='select: title'/> 8986 </entry> 8987 </row> 8988 <row> 8989 <entry>WM_STATE</entry> 8990 <entry>WM_STATE</entry> 8991 <entry>32</entry> 8992 <entry> 8993<xref linkend='WM_STATE_Property' xrefstyle='select: title'/> 8994 </entry> 8995 </row> 8996 </tbody> 8997 </tgroup> 8998</informaltable> 8999</sect1> 9000</appendix> 9001</book> 9002