<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Inter-Client Communication Conventions Manual</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_9276" /><style xmlns="" type="text/css">/*
* Copyright (c) 2011 Gaetan Nadon
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
/*
* Shared stylesheet for X.Org documentation translated to HTML format
* http://www.sagehill.net/docbookxsl/UsingCSS.html
* http://www.w3schools.com/css/default.asp
* https://addons.mozilla.org/en-US/firefox/addon/web-developer/developers
* https://addons.mozilla.org/en-US/firefox/addon/font-finder/
*/
/*
* The sans-serif fonts are considered more legible on a computer screen
* http://dry.sailingissues.com/linux-equivalents-verdana-arial.html
*
*/
body {
font-family: "Bitstream Vera Sans", "DejaVu Sans", Tahoma, Geneva, Arial, Sans-serif;
/* In support of using "em" font size unit, the w3c recommended method */
font-size: 100%;
}
/*
* Selection: all elements requiring mono spaced fonts.
*
* The family names attempt to match the proportionally spaced font
* family names such that the same font name is used for both.
* We'd like to use Bitstream, for example, in both proportionally and
* mono spaced font text.
*/
.command,
.errorcode,
.errorname,
.errortype,
.filename,
.funcsynopsis,
.function,
.parameter,
.programlisting,
.property,
.screen,
.structname,
.symbol,
.synopsis,
.type
{
font-family: "Bitstream Vera Sans Mono", "DejaVu Sans Mono", Courier, "Liberation Mono", Monospace;
}
/*
* Books have a title page, a preface, some chapters and appendices,
* a glossary, an index and a bibliography, in that order.
*
* An Article has no preface and no chapters. It has sections, appendices,
* a glossary, an index and a bibliography.
*/
/*
* Selection: book main title and subtitle
*/
div.book>div.titlepage h1.title,
div.book>div.titlepage h2.subtitle {
text-align: center;
}
/*
* Selection: article main title and subtitle
*/
div.article>div.titlepage h2.title,
div.article>div.titlepage h3.subtitle,
div.article>div.sect1>div.titlepage h2.title,
div.article>div.section>div.titlepage h2.title {
text-align: center;
}
/*
* Selection: various types of authors and collaborators, individuals or corporate
*
* These authors are not always contained inside an authorgroup.
* They can be contained inside a lot of different parent types where they might
* not be centered.
* Reducing the margin at the bottom makes a visual separation between authors
* We specify here the ones on the title page, others may be added based on merit.
*/
div.titlepage .authorgroup,
div.titlepage .author,
div.titlepage .collab,
div.titlepage .corpauthor,
div.titlepage .corpcredit,
div.titlepage .editor,
div.titlepage .othercredit {
text-align: center;
margin-bottom: 0.25em;
}
/*
* Selection: the affiliation of various types of authors and collaborators,
* individuals or corporate.
*/
div.titlepage .affiliation {
text-align: center;
}
/*
* Selection: product release information (X Version 11, Release 7)
*
* The releaseinfo element can be contained inside a lot of different parent
* types where it might not be centered.
* We specify here the one on the title page, others may be added based on merit.
*/
div.titlepage p.releaseinfo {
font-weight: bold;
text-align: center;
}
/*
* Selection: publishing date
*/
div.titlepage .pubdate {
text-align: center;
}
/*
* The legal notices are displayed in smaller sized fonts
* Justification is only supported in IE and therefore not requested.
*
*/
.legalnotice {
font-size: small;
font-style: italic;
}
/*
* For documentation having multiple licenses, the copyright and legalnotice
* elements sequence cannot instantiated multiple times.
* The copyright notice and license text are therefore coded inside a legalnotice
* element. The role attribute on the paragraph is used to allow styling of the
* copyright notice text which should not be italicized.
*/
p.multiLicensing {
font-style: normal;
font-size: medium;
}
/*
* Selection: book or article main ToC title
* A paragraph is generated for the title rather than a level 2 heading.
* We do not want to select chapters sub table of contents, only the main one
*/
div.book>div.toc>p,
div.article>div.toc>p {
font-size: 1.5em;
text-align: center;
}
/*
* Selection: major sections of a book or an article
*
* Unlike books, articles do not have a titlepage element for appendix.
* Using the selector "div.titlepage h2.title" would be too general.
*/
div.book>div.preface>div.titlepage h2.title,
div.book>div.chapter>div.titlepage h2.title,
div.article>div.sect1>div.titlepage h2.title,
div.article>div.section>div.titlepage h2.title,
div.book>div.appendix>div.titlepage h2.title,
div.article>div.appendix h2.title,
div.glossary>div.titlepage h2.title,
div.index>div.titlepage h2.title,
div.bibliography>div.titlepage h2.title {
/* Add a border top over the major parts, just like printed books */
/* The Gray color is already used for the ruler over the main ToC. */
border-top-style: solid;
border-top-width: 2px;
border-top-color: Gray;
/* Put some space between the border and the title */
padding-top: 0.2em;
text-align: center;
}
/*
* A Screen is a verbatim environment for displaying text that the user might
* see on a computer terminal. It is often used to display the results of a command.
*
* http://www.css3.info/preview/rounded-border/
*/
.screen {
background: #e0ffff;
border-width: 1px;
border-style: solid;
border-color: #B0C4DE;
border-radius: 1.0em;
/* Browser's vendor properties prior to CSS 3 */
-moz-border-radius: 1.0em;
-webkit-border-radius: 1.0em;
-khtml-border-radius: 1.0em;
margin-left: 1.0em;
margin-right: 1.0em;
padding: 0.5em;
}
/*
* Emphasis program listings with a light shade of gray similar to what
* DocBook XSL guide does: http://www.sagehill.net/docbookxsl/ProgramListings.html
* Found many C API docs on the web using like shades of gray.
*/
.programlisting {
background: #F4F4F4;
border-width: 1px;
border-style: solid;
border-color: Gray;
padding: 0.5em;
}
/*
* Emphasis functions synopsis using a darker shade of gray.
* Add a border such that it stands out more.
* Set the padding so the text does not touch the border.
*/
.funcsynopsis, .synopsis {
background: #e6e6fa;
border-width: 1px;
border-style: solid;
border-color: Gray;
clear: both;
margin: 0.5em;
padding: 0.25em;
}
/*
* Selection: paragraphs inside synopsis
*
* Removes the default browser margin, let the container set the padding.
* Paragraphs are not always used in synopsis
*/
.funcsynopsis p,
.synopsis p {
margin: 0;
padding: 0;
}
/*
* Selection: variable lists, informal tables and tables
*
* Note the parameter name "variablelist.as.table" in xorg-xhtml.xsl
* A table with rows and columns is constructed inside div.variablelist
*
* Set the left margin so it is indented to the right
* Display informal tables with single line borders
*/
table {
margin-left: 0.5em;
border-collapse: collapse;
}
/*
* Selection: paragraphs inside tables
*
* Removes the default browser margin, let the container set the padding.
* Paragraphs are not always used in tables
*/
td p {
margin: 0;
padding: 0;
}
/*
* Add some space between the left and right column.
* The vertical alignment helps the reader associate a term
* with a multi-line definition.
*/
td, th {
padding-left: 1.0em;
padding-right: 1.0em;
vertical-align: top;
}
.warning {
border: 1px solid red;
background: #FFFF66;
padding-left: 0.5em;
}
</style></head><body><div class="book"><div class="titlepage"><div><div><h1 class="title"><a id="icccm"></a>Inter-Client Communication Conventions Manual</h1></div><div><h2 class="subtitle">X Consortium Standard</h2></div><div><div class="authorgroup"><div class="author"><h3 class="author"><span class="firstname">David</span> <span class="surname">Rosenthal</span></h3><div class="affiliation"><span class="orgname">Sun Microsystems, Inc.<br /></span></div></div><div class="editor"><h4 class="editedby">Edited by</h4><h3 class="editor"><span class="firstname">Stuart</span> <span class="othername">W.</span> <span class="surname">Marks</span></h3><div class="affiliation"><span class="orgname">SunSoft, Inc.<br /></span></div></div></div></div><div><p class="releaseinfo">X Version 11, Release 7.7</p></div><div><p class="releaseinfo">Version 2.0</p></div><div><p class="copyright">Copyright © 1988, 1991, 1993, 1994 X Consortium</p></div><div><div class="legalnotice"><a id="id2527033"></a><p>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
</p><p>
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
</p><p>
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
</p><p>
Except as contained in this notice, the name of the X Consortium shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from the X Consortium.
</p><p>X Window System is a trademark of The Open Group.</p></div></div><div><div class="legalnotice"><a id="id2554215"></a><p class="multiLicensing">
Copyright © 1987, 1988, 1989, 1993, 1994 Sun Microsystems, Inc
</p><p>
Permission to use, copy, modify, and distribute this documentation
for any purpose and without fee is hereby granted, provided
that the above copyright notice and this permission
notice appear in all copies.
Sun Microsystems makes no representations about the
suitability for any purpose of the information in this document.
This documentation is provided as is without express or implied warranty.
</p></div></div></div><hr /></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="preface"><a href="#id2554237">Preface to Version 2.0</a></span></dt><dt><span class="preface"><a href="#id2554285">Preface to Version 1.1</a></span></dt><dt><span class="chapter"><a href="#Introduction">1. Introduction</a></span></dt><dd><dl><dt><span class="sect1"><a href="#Evolution_of_the_Conventions">Evolution of the Conventions</a></span></dt><dt><span class="sect1"><a href="#Atoms">Atoms</a></span></dt><dd><dl><dt><span class="sect2"><a href="#What_Are_Atoms">What Are Atoms?</a></span></dt><dt><span class="sect2"><a href="#Predefined_Atoms">Predefined Atoms</a></span></dt><dt><span class="sect2"><a href="#Naming_Conventions">Naming Conventions</a></span></dt><dt><span class="sect2"><a href="#Semantics">Semantics</a></span></dt><dt><span class="sect2"><a href="#Name_Spaces">Name Spaces</a></span></dt><dt><span class="sect2"><a href="#Discriminated_Names">Discriminated Names</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#Peer_to_Peer_Communication_by_Means_of_Selections">2. Peer-to-Peer Communication by Means of Selections</a></span></dt><dd><dl><dt><span class="sect1"><a href="#Acquiring_Selection_Ownership">Acquiring Selection Ownership</a></span></dt><dt><span class="sect1"><a href="#Responsibilities_of_the_Selection_Owner">Responsibilities of the Selection Owner</a></span></dt><dt><span class="sect1"><a href="#Giving_Up_Selection_Ownership">Giving Up Selection Ownership</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Voluntarily_Giving_Up_Selection_Ownership">Voluntarily Giving Up Selection Ownership</a></span></dt><dt><span class="sect2"><a href="#Forcibly_Giving_Up_Selection_Ownership">Forcibly Giving Up Selection Ownership</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Requesting_a_Selection">Requesting a Selection</a></span></dt><dt><span class="sect1"><a href="#Large_Data_Transfers">Large Data Transfers</a></span></dt><dt><span class="sect1"><a href="#Use_of_Selection_Atoms">Use of Selection Atoms</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Selection_Atoms">Selection Atoms</a></span></dt><dt><span class="sect2"><a href="#Target_Atoms">Target Atoms</a></span></dt><dt><span class="sect2"><a href="#Selection_Targets_with_Side_Effects">Selection Targets with Side Effects</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Use_of_Selection_Properties">Use of Selection Properties</a></span></dt><dd><dl><dt><span class="sect2"><a href="#TEXT_Properties">TEXT Properties</a></span></dt><dt><span class="sect2"><a href="#INCR_Properties">INCR Properties</a></span></dt><dt><span class="sect2"><a href="#DRAWABLE_Properties">DRAWABLE Properties</a></span></dt><dt><span class="sect2"><a href="#SPAN_Properties">SPAN Properties</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Manager_Selections">Manager Selections</a></span></dt></dl></dd><dt><span class="chapter"><a href="#Peer_to_Peer_Communication_by_Means_of_Cut_Buffers">3. Peer-to-Peer Communication by Means of Cut Buffers</a></span></dt><dt><span class="chapter"><a href="#Client_to_Window_Manager_Communication">4. Client-to-Window-Manager Communication</a></span></dt><dd><dl><dt><span class="sect1"><a href="#Clients_Actions">Client's Actions</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Creating_a_Top_Level_Window">Creating a Top-Level Window</a></span></dt><dt><span class="sect2"><a href="#Client_Properties">Client Properties</a></span></dt><dt><span class="sect2"><a href="#Window_Manager_Properties">Window Manager Properties</a></span></dt><dt><span class="sect2"><a href="#Changing_Window_State">Changing Window State</a></span></dt><dt><span class="sect2"><a href="#Configuring_the_Window">Configuring the Window</a></span></dt><dt><span class="sect2"><a href="#Changing_Window_Attributes">Changing Window Attributes</a></span></dt><dt><span class="sect2"><a href="#Input_Focus">Input Focus</a></span></dt><dt><span class="sect2"><a href="#Colormaps">Colormaps</a></span></dt><dt><span class="sect2"><a href="#Icons">Icons</a></span></dt><dt><span class="sect2"><a href="#Pop_up_Windows">Pop-up Windows</a></span></dt><dt><span class="sect2"><a href="#Window_Groups">Window Groups</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Client_Responses_to_Window_Manager_Actions">Client Responses to Window Manager Actions</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Reparenting">Reparenting</a></span></dt><dt><span class="sect2"><a href="#Redirection_of_Operations">Redirection of Operations</a></span></dt><dt><span class="sect2"><a href="#Window_Move">Window Move</a></span></dt><dt><span class="sect2"><a href="#Window_Resize">Window Resize</a></span></dt><dt><span class="sect2"><a href="#Iconify_and_Deiconify">Iconify and Deiconify</a></span></dt><dt><span class="sect2"><a href="#Colormap_Change">Colormap Change</a></span></dt><dt><span class="sect2"><a href="#Input_Focus_2">Input Focus</a></span></dt><dt><span class="sect2"><a href="#ClientMessage_Events">ClientMessage Events</a></span></dt><dt><span class="sect2"><a href="#Redirecting_Requests">Redirecting Requests</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Communication_with_the_Window_Manager_by_Means_of_Selections">Communication with the Window Manager by Means of Selections</a></span></dt><dt><span class="sect1"><a href="#Summary_of_Window_Manager_Property_Types">Summary of Window Manager Property Types</a></span></dt></dl></dd><dt><span class="chapter"><a href="#Session_Management_and_Additional_Inter_Client_Exchanges">5. Session Management and Additional Inter-Client Exchanges</a></span></dt><dd><dl><dt><span class="sect1"><a href="#Client_Support_for_Session_Management">Client Support for Session Management</a></span></dt><dt><span class="sect1"><a href="#Window_Manager_Support_for_Session_Management">Window Manager Support for Session Management</a></span></dt><dt><span class="sect1"><a href="#Support_for_ICE_Client_Rendezvous">Support for ICE Client Rendezvous</a></span></dt></dl></dd><dt><span class="chapter"><a href="#Manipulation_of_Shared_Resources">6. Manipulation of Shared Resources</a></span></dt><dd><dl><dt><span class="sect1"><a href="#The_Input_Focus">The Input Focus</a></span></dt><dt><span class="sect1"><a href="#The_Pointer">The Pointer</a></span></dt><dt><span class="sect1"><a href="#Grabs">Grabs</a></span></dt><dt><span class="sect1"><a href="#Colormaps_2">Colormaps</a></span></dt><dt><span class="sect1"><a href="#The_Keyboard_Mapping">The Keyboard Mapping</a></span></dt><dt><span class="sect1"><a href="#The_Modifier_Mapping">The Modifier Mapping</a></span></dt></dl></dd><dt><span class="chapter"><a href="#Device_Color_Characterization">7. Device Color Characterization</a></span></dt><dd><dl><dt><span class="sect1"><a href="#XYZ_lt_gt_RGB_Conversion_Matrices">XYZ &lt;-&gt; RGB Conversion Matrices</a></span></dt><dt><span class="sect1"><a href="#Intensity_dA_RGB_Value_Conversion">Intensity (dA RGB Value Conversion</a></span></dt></dl></dd><dt><span class="chapter"><a href="#Conclusion">8. Conclusion</a></span></dt><dd><dl><dt><span class="sect1"><a href="#The_X_Registry">The X Registry</a></span></dt></dl></dd><dt><span class="appendix"><a href="#revision_history">A. Revision History</a></span></dt><dd><dl><dt><span class="sect1"><a href="#The_X11R2_Draft">The X11R2 Draft</a></span></dt><dt><span class="sect1"><a href="#The_July_27_1988_Draft">The July 27, 1988, Draft</a></span></dt><dt><span class="sect1"><a href="#The_Public_Review_Drafts">The Public Review Drafts</a></span></dt><dt><span class="sect1"><a href="#Version_10_July_1989">Version 1.0, July 1989</a></span></dt><dt><span class="sect1"><a href="#Version_11">Version 1.1</a></span></dt><dt><span class="sect1"><a href="#Public_Review_Draft_December_1993">Public Review Draft, December 1993</a></span></dt><dt><span class="sect1"><a href="#Version_20_April_1994">Version 2.0, April 1994</a></span></dt></dl></dd><dt><span class="appendix"><a href="#suggested_protocol_revisions">B. Suggested Protocol Revisions</a></span></dt><dt><span class="appendix"><a href="#obsolete_session_manager_conventions">C. Obsolete Session Manager Conventions</a></span></dt><dd><dl><dt><span class="sect1"><a href="#Properties">Properties</a></span></dt><dd><dl><dt><span class="sect2"><a href="#WM_COMMAND_Property">WM_COMMAND Property</a></span></dt><dt><span class="sect2"><a href="#WM_CLIENT_MACHINE_Property_2">WM_CLIENT_MACHINE Property</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Termination">Termination</a></span></dt><dt><span class="sect1"><a href="#Client_Responses_to_Session_Manager_Actions">Client Responses to Session Manager Actions</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Saving_Client_State">Saving Client State</a></span></dt><dt><span class="sect2"><a href="#Window_Deletion_2">Window Deletion</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Summary_of_Session_Manager_Property_Types">Summary of Session Manager Property Types</a></span></dt></dl></dd></dl></div><div class="preface"><div class="titlepage"><div><div><h2 class="title"><a id="id2554237"></a>Preface to Version 2.0</h2></div></div></div><p>
The goal of the ICCCM Version 2.0 effort was to add new facilities, to fix
problems with earlier drafts, and to improve readability and
understandability, while maintaining compatibility with the earlier
versions. This document is the product of over two years of discussion among
the members of the X Consortium's <code class="function">wmtalk</code> working group.
The following people deserve thanks for their contributions:
</p><pre class="literallayout">
Gabe Beged-Dov Bill Janssen
Chan Benson Vania Joloboff
Jordan Brown Phil Karlton
Larry Cable Kaleb Keithley
Ellis Cohen Mark Manasse
Donna Converse Ralph Mor
Brian Cripe Todd Newman
Susan Dahlberg Bob Scheifler
Peter Daifuku Keith Taylor
Andrew deBlois Jim VanGilder
Clive Feather Mike Wexler
Stephen Gildea Michael Yee
Christian Jacobi
</pre><p>
It has been a privilege for me to work with this fine group of people.
</p><p>
Stuart W. Marks
</p><p>
December 1993
</p></div><div class="preface"><div class="titlepage"><div><div><h2 class="title"><a id="id2554285"></a>Preface to Version 1.1</h2></div></div></div><p>
David Rosenthal had overall architectural responsibility
for the conventions defined in this document;
he wrote most of the text and edited the document,
but its development has been a communal effort.
The details were thrashed out in meetings at the January 1988 MIT X Conference
and at the 1988 Summer Usenix conference,
and through months (and megabytes) of argument
on the
<code class="function">wmtalk</code>
mail alias.
Thanks are due to everyone who contributed,
and especially to the following people.
</p><p>
For the Selection section:
</p><pre class="literallayout">
Jerry Farrell
Phil Karlton
Loretta Guarino Reid
Mark Manasse
Bob Scheifler
</pre><p>
For the Cut-Buffer section:
</p><pre class="literallayout">
Andrew Palay
</pre><p>
For the Window and Session Manager sections:
</p><pre class="literallayout">
Todd Brunhoff Matt Landau
Ellis Cohen Mark Manasse
Jim Fulton Bob Scheifler
Hania Gajewska Ralph Swick
Jordan Hubbard Mike Wexler
Kerry Kimbrough Glenn Widener
Audrey Ishizaki
</pre><p>
For the Device Color Characterization section:
</p><pre class="literallayout">
Keith Packard
</pre><p>
In addition, thanks are due to those who contributed to the public review:
</p><pre class="literallayout">
Gary Combs John Irwin
Errol Crary Vania Joloboff
Nancy Cyprych John Laporta
John Diamant Ken Lee
Clive Feather Stuart Marks
Burns Fisher Alan Mimms
Richard Greco Colas Nahaboo
Tim Greenwood Mark Patrick
Kee Hinckley Steve Pitschke
Brian Holt Brad Reed
John Interrante John Thomas
</pre></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="Introduction"></a>Chapter 1. Introduction</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="sect1"><a href="#Evolution_of_the_Conventions">Evolution of the Conventions</a></span></dt><dt><span class="sect1"><a href="#Atoms">Atoms</a></span></dt><dd><dl><dt><span class="sect2"><a href="#What_Are_Atoms">What Are Atoms?</a></span></dt><dt><span class="sect2"><a href="#Predefined_Atoms">Predefined Atoms</a></span></dt><dt><span class="sect2"><a href="#Naming_Conventions">Naming Conventions</a></span></dt><dt><span class="sect2"><a href="#Semantics">Semantics</a></span></dt><dt><span class="sect2"><a href="#Name_Spaces">Name Spaces</a></span></dt><dt><span class="sect2"><a href="#Discriminated_Names">Discriminated Names</a></span></dt></dl></dd></dl></div><p>
It was an explicit design goal of X Version 11 to specify mechanism,
not policy.
As a result,
a client that converses with the server using the protocol defined
by the <span class="emphasis"><em>X Window System Protocol</em></span>, <span class="emphasis"><em>Version 11</em></span> may operate correctly
in isolation but may not coexist properly with others sharing the same server.
</p><p>
Being a good citizen in the X Version 11 world involves adhering to
conventions that govern inter-client communications in the following areas:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Selection mechanism
</p></li><li class="listitem"><p>
Cut buffers
</p></li><li class="listitem"><p>
Window manager
</p></li><li class="listitem"><p>
Session manager
</p></li><li class="listitem"><p>
Manipulation of shared resources
</p></li><li class="listitem"><p>
Device color characterization
</p></li></ul></div><p>
This document proposes suitable conventions without attempting to enforce
any particular user interface.
To permit clients written in different languages to communicate,
these conventions are expressed solely in terms of protocol operations,
not in terms of their associated Xlib interfaces,
which are probably more familiar.
The binding of these operations to the Xlib interface for C
and to the equivalent interfaces for other languages
is the subject of other documents.
</p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Evolution_of_the_Conventions"></a>Evolution of the Conventions</h2></div></div></div><p>
In the interests of timely acceptance,
the <span class="emphasis"><em>Inter-Client Communication Conventions Manual</em></span> (ICCCM)
covers only a minimal set of required conventions.
These conventions will be added to and updated as appropriate,
based on the experiences of the X Consortium.
</p><p>
As far as possible,
these conventions are upwardly compatible with those in the February 25, 1988,
draft that was distributed with the X Version 11, Release 2, of the software.
In some areas,
semantic problems were discovered with those conventions,
and, thus, complete upward compatibility could not be assured.
These areas are noted in the text and are summarized in Appendix A.
</p><p>
In the course of developing these conventions,
a number of minor changes to the protocol were identified as desirable.
They also are identified in the text, are summarized in Appendix B,
and are offered as input to a future protocol revision process.
If and when a protocol revision incorporating these changes is undertaken,
it is anticipated that the ICCCM will need to be revised.
Because it is difficult to ensure that clients and servers are upgraded
simultaneously,
clients using the revised conventions should examine the minor protocol
revision number and be prepared to use the older conventions
when communicating with an older server.
</p><p>
It is expected that these revisions will ensure that clients using
the conventions appropriate to protocol minor revision <span class="emphasis"><em>n</em></span>
will interoperate correctly with those that use the conventions
appropriate to protocol minor revision
<span class="emphasis"><em>n</em></span> + 1 if the server supports both.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Atoms"></a>Atoms</h2></div></div></div><p>
Many of the conventions use atoms.
To assist the reader,
the following sections attempt to amplify the description of atoms
that is provided in the protocol specification.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="What_Are_Atoms"></a>What Are Atoms?</h3></div></div></div><p>
At the conceptual level,
atoms are unique names that clients can use to communicate information
to each other.
They can be thought of as a bundle of octets,
like a string but without an encoding being specified.
The elements are not necessarily ASCII characters,
and no case folding happens.
<a id="id2526497" href="#ftn.id2526497" class="footnote"><sup>[1]</sup></a>
</p><p>
The protocol designers felt that passing these
sequences of bytes back and forth across the wire would be too costly.
Further, they thought it important that events
as they appear on the wire have a fixed size (in fact, 32 bytes)
and that because some events contain atoms, a fixed-size representation
for them was needed.
</p><p>
To allow a fixed-size representation,
a protocol request
( <code class="function">InternAtom</code> )
was provided to register a byte sequence with the server,
which returns a 32-bit value (with the top three bits zero)
that maps to the byte sequence.
The inverse operator is also available
( <code class="function">GetAtomName</code> ).
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Predefined_Atoms"></a>Predefined Atoms</h3></div></div></div><p>
The protocol specifies a number of atoms as being predefined:
</p><div class="blockquote"><blockquote class="blockquote"><p>
Predefined atoms are not strictly necessary
and may not be useful in all environments,
but they will eliminate many
<code class="function">InternAtom</code>
requests in most applications.
Note that they are predefined only in the sense of having numeric values,
not in the sense of having required semantics.
</p></blockquote></div><p>
Predefined atoms are an implementation trick to avoid the cost of interning
many of the atoms that are expected to be used during the startup phase
of all applications.
The results of the
<code class="function">InternAtom</code>
requests, which require a handshake, can be assumed <span class="emphasis"><em>a priori</em></span>.
</p><p>
Language interfaces should probably cache the atom-name mappings
and get them only when required.
The CLX interface, for instance, makes no distinction between predefined atoms
and other atoms; all atoms are viewed as symbols at the interface.
However, a CLX implementation will typically keep a symbol or atom cache
and will typically initialize this cache with the predefined atoms.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Naming_Conventions"></a>Naming Conventions</h3></div></div></div><p>
The built-in atoms are composed of uppercase ASCII characters with the
logical words separated by an underscore character (_), for example,
WM_ICON_NAME.
The protocol specification recommends that atoms used
for private vendor-specific reasons should begin with an underscore.
To prevent conflicts among organizations,
additional prefixes should be chosen
(for example, _DEC_WM_DECORATION_GEOMETRY).
</p><p>
The names were chosen in this fashion to make it easy to use them in a
natural way within LISP.
Keyword constructors allow the programmer to specify the atoms as LISP atoms.
If the atoms were not all uppercase,
special quoting conventions would have to be used.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Semantics"></a>Semantics</h3></div></div></div><p>
The core protocol imposes no semantics on atoms except as they are used in
FONTPROP structures.
For further information on FONTPROP semantics,
see the <span class="emphasis"><em>X Logical Font Description Conventions</em></span>.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Name_Spaces"></a>Name Spaces</h3></div></div></div><p>
The protocol defines six distinct spaces in which atoms are interpreted.
Any particular atom may or may not have some valid interpretation
with respect to each of these name spaces.
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Space</th><th align="left">Briefly</th><th align="left">Examples</th></tr></thead><tbody><tr><td align="left">Property name</td><td align="left">Name</td><td align="left">WM_HINTS, WM_NAME, RGB_BEST_MAP, ...</td></tr><tr><td align="left">Property type</td><td align="left">Type</td><td align="left">WM_HINTS, CURSOR, RGB_COLOR_MAP, ...</td></tr><tr><td align="left">Selection name</td><td align="left">Selection</td><td align="left">PRIMARY, SECONDARY, CLIPBOARD</td></tr><tr><td align="left">Selection target</td><td align="left">Target</td><td align="left">FILE_NAME, POSTSCRIPT, PIXMAP, ...</td></tr><tr><td align="left">Font property</td><td align="left"> </td><td align="left">QUAD_WIDTH, POINT_SIZE, ...</td></tr><tr><td align="left"><code class="function">ClientMessage</code> type</td><td align="left"> </td><td align="left">WM_SAVE_YOURSELF, _DEC_SAVE_EDITS, &amp;...</td></tr></tbody></table></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Discriminated_Names"></a>Discriminated Names</h3></div></div></div><p>
Sometimes a protocol requires an arbitrary number of similar
objects that need unique names (usually because the objects are created
dynamically, so that names cannot be invented in advance). For example, a
colormap-generating program might use the selection mechanism to offer
colormaps for each screen and so needs a selection name for each screen.
Such names are called "discriminated names" and are discriminated by
some entity. This entity can be:
</p><pre class="literallayout">
A screen
An X resource (a window, a colormap, a visual, etc.)
A client
</pre><p>
If it is only necessary to generate a fixed set of names for each value
of the discriminating entity, then the discriminated names are formed by
suffixing an ordinary name according to the value of the entity.
</p><p>
If <span class="emphasis"><em>name</em></span> is a descriptive portion for the name, <span class="emphasis"><em>d</em></span> is a decimal
number with no leading zeroes, and <span class="emphasis"><em>x</em></span> is a hexadecimal number with
exactly 8 digits, and using uppercase letters, then such discriminated names
shall have the form:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Name Discriminated by</th><th align="left">Form</th><th align="left">Example</th></tr></thead><tbody><tr><td align="left">screen number</td><td align="left"><span class="emphasis"><em>name</em></span>_S<span class="emphasis"><em>d</em></span></td><td align="left">WM_COMMS_S2</td></tr><tr><td align="left">X resource</td><td align="left"><span class="emphasis"><em>name</em></span>_R<span class="emphasis"><em>x</em></span></td><td align="left">GROUP_LEADER_R1234ABCD</td></tr></tbody></table></div><p>
To discriminate a name by client, use an X resource ID created by that
client. This resource can be of any type.
</p><p>
Sometimes it is simply necessary to generate a unique set of names (for
example, for the properties on a window used by a MULTIPLE selection).
These names should have the form:
</p><pre class="literallayout">
U<span class="emphasis"><em>d</em></span> (e.g., U0 U1 U2 U3 ...)
</pre><p>
if the names stand totally alone, and the form:
</p><pre class="literallayout">
<span class="emphasis"><em>name</em></span>_U<span class="emphasis"><em>d</em></span> (e.g., FOO_U0 BAR_U0 FOO_U1 BAR_U1 ...)
</pre><p>
if they come in sets (here there are two sets, named "FOO" and
"BAR"). The stand-alone U<span class="emphasis"><em>d</em></span> form should be used only if it is
clear that the module using it has complete control over the relevant
namespace or has the active cooperation of all other entities that might
also use these names. (Naming properties on a window created specifically
for a particular selection is such a use; naming properties on the root
window is almost certainly not.)
</p><p>
In a particularly difficult case, it might be necessary to combine both
forms of discrimination. If this happens, the U form should come after
the other form, thus:
</p><pre class="literallayout">
FOO_R12345678_U23
</pre><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Rationale</strong></p></div><p>
Existing protocols will not be changed to use these naming conventions,
because doing so will cause too much disruption. However, it is expected
that future protocols -- both standard and private -- will use these
conventions.
</p></blockquote></div></div></div><div class="footnotes"><br /><hr width="100" align="left" /><div class="footnote"><p><a id="ftn.id2526497" href="#id2526497" class="para"><sup>[1] </sup></a>
The comment in the protocol specification for
<code class="function">InternAtom</code>
that ISO Latin-1 encoding should be used is in the nature of a convention;
the server treats the string as a byte sequence.
</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="Peer_to_Peer_Communication_by_Means_of_Selections"></a>Chapter 2. Peer-to-Peer Communication by Means of Selections</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="sect1"><a href="#Acquiring_Selection_Ownership">Acquiring Selection Ownership</a></span></dt><dt><span class="sect1"><a href="#Responsibilities_of_the_Selection_Owner">Responsibilities of the Selection Owner</a></span></dt><dt><span class="sect1"><a href="#Giving_Up_Selection_Ownership">Giving Up Selection Ownership</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Voluntarily_Giving_Up_Selection_Ownership">Voluntarily Giving Up Selection Ownership</a></span></dt><dt><span class="sect2"><a href="#Forcibly_Giving_Up_Selection_Ownership">Forcibly Giving Up Selection Ownership</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Requesting_a_Selection">Requesting a Selection</a></span></dt><dt><span class="sect1"><a href="#Large_Data_Transfers">Large Data Transfers</a></span></dt><dt><span class="sect1"><a href="#Use_of_Selection_Atoms">Use of Selection Atoms</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Selection_Atoms">Selection Atoms</a></span></dt><dt><span class="sect2"><a href="#Target_Atoms">Target Atoms</a></span></dt><dt><span class="sect2"><a href="#Selection_Targets_with_Side_Effects">Selection Targets with Side Effects</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Use_of_Selection_Properties">Use of Selection Properties</a></span></dt><dd><dl><dt><span class="sect2"><a href="#TEXT_Properties">TEXT Properties</a></span></dt><dt><span class="sect2"><a href="#INCR_Properties">INCR Properties</a></span></dt><dt><span class="sect2"><a href="#DRAWABLE_Properties">DRAWABLE Properties</a></span></dt><dt><span class="sect2"><a href="#SPAN_Properties">SPAN Properties</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Manager_Selections">Manager Selections</a></span></dt></dl></div><p>
Selections are the primary mechanism that X Version 11 defines
for the exchange of information between clients,
for example, by cutting and pasting between windows.
Note that there can be an arbitrary number of selections
(each named by an atom) and that they are global to the server.
<a class="xref" href="#Use_of_Selection_Atoms" title="Use of Selection Atoms">Use of Selection Atoms</a>.
discusses the choice of an atom.
Each selection is owned by a client and is attached to a window.
</p><p>
Selections communicate between an owner and a requestor.
The owner has the data representing the value of its selection,
and the requestor receives it.
A requestor wishing to obtain the value of a selection provides the following:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
The name of the selection
</p></li><li class="listitem"><p>
The name of a property
</p></li><li class="listitem"><p>
A window
</p></li><li class="listitem"><p>
The atom representing the data type required
</p></li><li class="listitem"><p>
Optionally, some parameters for the request
</p></li></ul></div><p>
If the selection is currently owned,
the owner receives an event and is expected to do the following:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Convert the contents of the selection to the requested data type
</p></li><li class="listitem"><p>
Place this data in the named property on the named window
</p></li><li class="listitem"><p>
Send the requestor an event to let it know the property is available
</p></li></ul></div><p>
Clients are strongly encouraged to use this mechanism.
In particular,
displaying text in a permanent window without providing the ability
to select and convert it into a string is definitely considered antisocial.
</p><p>
Note that all data transferred between an owner and a requestor must usually
go by means of the server in an X Version 11 environment.
A client cannot assume that another client can open the same files
or even communicate directly.
The other client may be talking to the server by means of
a completely different networking mechanism (for example, one client might
be DECnet and the other TCP/IP).
Thus, passing indirect references to data
(such as, file names, host names, and port numbers)
is permitted only if both clients specifically agree.
</p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Acquiring_Selection_Ownership"></a>Acquiring Selection Ownership</h2></div></div></div><p>
A client wishing to acquire ownership of a particular selection
should call
<code class="function">SetSelectionOwner,</code>
which is defined as follows:
</p><p>
<code class="function">SetSelectionOwner</code>
</p><div class="informaltable"><table border="0"><colgroup><col align="left" class="c1" /></colgroup><tbody><tr><td align="left"><span class="emphasis"><em>selection</em></span>: ATOM</td></tr><tr><td align="left">
<span class="emphasis"><em>owner</em></span>: WINDOW or
<code class="function">None</code>
</td></tr><tr><td align="left">
<span class="emphasis"><em>time</em></span>: TIMESTAMP or
<code class="function">CurrentTime</code>
</td></tr></tbody></table></div><p>
The client should set the specified selection to the atom that represents
the selection,
set the specified owner to some window that the client created,
and set the specified time to some time between the current last-change time
of the selection concerned and the current server time.
This time value usually will be obtained from the timestamp of the event
that triggers the acquisition of the selection.
Clients should not set the time
value to
<code class="function">CurrentTime</code>,
because if they do so, they have no way of finding
when they gained ownership of the selection.
Clients must use a window they created so that requestors
can route events to the owner of the selection.<a id="id2535529" href="#ftn.id2535529" class="footnote"><sup>[2]</sup></a>
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Convention</strong></p></div><p>
Clients attempting to acquire a selection must set the time value of the
<code class="function">SetSelectionOwner</code>
request to the timestamp of the event triggering the acquisition attempt,
not to
<code class="function">CurrentTime</code>.
A zero-length append to a property is a way to obtain a timestamp for
this purpose;
the timestamp is in the corresponding
<code class="function">PropertyNotify</code>
event.
</p></blockquote></div><p>
If the time in the
<code class="function">SetSelectionOwner</code>
request is in the future relative to the server's current time
or is in the past relative to the last time the specified selection
changed hands, the
<code class="function">SetSelectionOwner</code>
request appears to the client to succeed,
but ownership is not actually transferred.
</p><p>
Because clients cannot name other clients directly,
the specified owner window is used to refer to the owning client
in the replies to
<code class="function">GetSelectionOwner</code>, in
<code class="function">SelectionRequest</code> and
<code class="function">SelectionClear</code>
events, and possibly as a place to put properties describing the selection
in question.
To discover the owner of a particular selection,
a client should invoke
<code class="function">GetSelectionOwner</code>,
which is defined as follows:
</p><p>
<code class="function">GetSelectionOwner</code>
</p><div class="informaltable"><table border="0"><colgroup><col align="left" class="c1" /></colgroup><tbody><tr><td align="left"><span class="emphasis"><em>selection</em></span>: ATOM</td></tr><tr><td align="left">-&gt;</td></tr><tr><td align="left">
<span class="emphasis"><em>owner</em></span>: WINDOW or
<code class="function">None</code>
</td></tr></tbody></table></div><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Convention</strong></p></div><p>
Clients are expected to provide some visible confirmation
of selection ownership.
To make this feedback reliable,
a client must perform a sequence like the following:
</p></blockquote></div><pre class="literallayout">
SetSelectionOwner(selection=PRIMARY, owner=Window, time=timestamp)
owner = GetSelectionOwner(selection=PRIMARY)
if (owner != Window) Failure
</pre><p>
If the
<code class="function">SetSelectionOwner</code>
request succeeds (not merely appears to succeed),
the client that issues it is recorded by the server as being the owner
of the selection for the time period starting at the specified time.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Responsibilities_of_the_Selection_Owner"></a>Responsibilities of the Selection Owner</h2></div></div></div><p>
When a requestor wants the value of a selection,
the owner receives a
<code class="function">SelectionRequest</code>
event, which is defined as follows:
</p><p>
<code class="function">SelectionRequest</code>
</p><div class="informaltable"><table border="0"><colgroup><col align="left" class="c1" /></colgroup><tbody><tr><td align="left"><span class="emphasis"><em>owner</em></span>: WINDOW</td></tr><tr><td align="left"><span class="emphasis"><em>selection</em></span>: ATOM</td></tr><tr><td align="left"><span class="emphasis"><em>selection</em></span>: ATOM</td></tr><tr><td align="left"><span class="emphasis"><em>target</em></span>: ATOM</td></tr><tr><td align="left"><span class="emphasis"><em>property</em></span>: ATOM or
<code class="function">None</code></td></tr><tr><td align="left"><span class="emphasis"><em>requestor</em></span>: WINDOW</td></tr><tr><td align="left"><span class="emphasis"><em>time</em></span>: TIMESTAMP or
<code class="function">CurrentTime</code></td></tr></tbody></table></div><p>
The specified owner and selection will be the values that were specified in
the
<code class="function">SetSelectionOwner</code>
request.
The owner should compare the timestamp with the period
it has owned the selection and, if the time is outside,
refuse the
<code class="function">SelectionRequest</code>
by sending the requestor window a
<code class="function">SelectionNotify</code>
event with the property set to
<code class="function">None</code>
(by means of a
<code class="function">SendEvent</code>
request with an empty event mask).
</p><p>
More advanced selection owners are free to maintain a history
of the value of the selection and to respond to requests for the
value of the selection during periods they owned it
even though they do not own it now.
</p><p>
If the specified property is
<code class="function">None</code>,
the requestor is an obsolete client.
Owners are encouraged to support these clients by using the specified target
atom as the property name to be used for the reply.
</p><p>
Otherwise,
the owner should use the target to decide the form into which the selection
should be converted.
Some targets may be defined such that requestors can pass parameters
along with the request. The owner will find these parameters in the
property named in the selection request. The type, format, and
contents of this property are dependent upon the definition of the
target. If the target is not defined to have parameters, the owner
should ignore the property if it is present.
If the selection cannot be converted
into a form based on the target (and parameters, if any),
the owner should refuse the
<code class="function">SelectionRequest</code>
as previously described.
</p><p>
If the specified property is not
<code class="function">None</code>,
the owner should place the data resulting from converting the selection
into the specified property on the requestor window
and should set the property's type to some appropriate value,
which need not be the same as the specified target.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Convention</strong></p></div><p>
All properties used to reply to
<code class="function">SelectionRequest</code>
events must be placed on the requestor window.
</p></blockquote></div><p>
</p><p>
In either case,
if the data comprising the selection cannot be stored on the requestor window
(for example, because the server cannot provide sufficient memory),
the owner must refuse the
<code class="function">SelectionRequest</code>,
as previously described.
See also
<a class="xref" href="#Large_Data_Transfers" title="Large Data Transfers">Large Data Transfers</a>.
</p><p>
If the property is successfully stored,
the owner should acknowledge the successful conversion
by sending the requestor window a
<code class="function">SelectionNotify</code>
event (by means of a
<code class="function">SendEvent</code>
request with an empty mask).
<code class="function">SelectionNotify</code>
is defined as follows:
</p><p>
<code class="function">SelectionNotify</code>
</p><div class="informaltable"><table border="0"><colgroup><col align="left" class="c1" /></colgroup><tbody><tr><td align="left"><span class="emphasis"><em>requestor</em></span>: WINDOW</td></tr><tr><td align="left">
<span class="emphasis"><em>selection</em></span>,
<span class="emphasis"><em>target</em></span>: ATOM
</td></tr><tr><td align="left">
<span class="emphasis"><em>property</em></span>: ATOM or
<code class="function">None</code>
</td></tr><tr><td align="left">
<span class="emphasis"><em>time</em></span>: TIMESTAMP or
<code class="function">CurrentTime</code>
</td></tr></tbody></table></div><p>
The owner should set the specified selection, target, time,
and property arguments to the values received in the
<code class="function">SelectionRequest</code>
event.
(Note that setting the property argument to
<code class="function">None</code>
indicates that the conversion requested could not be made.)
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Convention</strong></p></div><p>
The selection, target, time, and property arguments in the
<code class="function">SelectionNotify</code>
event should be set to the values received in the
<code class="function">SelectionRequest</code>
event.
</p></blockquote></div><p>
If the owner receives more than one
<code class="function">SelectionRequest</code>
event with the same requestor, selection, target, and timestamp it must
respond to them in the same order in which they were received.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Rationale</strong></p></div><p>
It is possible for a requestor to have multiple outstanding requests that
use the same requestor window, selection, target, and timestamp, and that
differ only in the property. If this occurs, and one of the conversion
requests fails, the resulting
<code class="function">SelectionNotify</code>
event will have its property argument set to
<code class="function">None</code>.
This may make it impossible for the requestor to determine which conversion
request had failed, unless the requests are responded to in order.
</p></blockquote></div><p>
The data stored in the property must eventually be deleted.
A convention is needed to assign the responsibility for doing so.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Convention</strong></p></div><p>
Selection requestors are responsible for deleting properties whose
names they receive in
<code class="function">SelectionNotify</code>
events (See
<a class="xref" href="#Requesting_a_Selection" title="Requesting a Selection">Requesting a Selection</a>
) or in properties with type MULTIPLE.
</p></blockquote></div><p>
A selection owner will often need confirmation that the data comprising the
selection has actually been transferred.
(For example,
if the operation has side effects on the owner's internal data structures,
these should not take place until the requestor has indicated
that it has successfully received the data.)
Owners should express interest in
<code class="function">PropertyNotify</code>
events for the specified requestor window
and wait until the property in the
<code class="function">SelectionNotify</code>
event has been deleted before assuming that the selection data has been
transferred. For the MULTIPLE request, if the different conversions require
separate confirmation, the selection owner can also watch for the deletion
of the individual properties named in the property in the
<code class="function">SelectionNotify</code>
event.
</p><p>
When some other client acquires a selection,
the previous owner receives a
<code class="function">SelectionClear</code>
event, which is defined as follows:
</p><p>
<code class="function">SelectionClear</code>
</p><div class="informaltable"><table border="0"><colgroup><col align="left" class="c1" /></colgroup><tbody><tr><td align="left">
<span class="emphasis"><em>owner</em></span>: WINDOW
</td></tr><tr><td align="left">
<span class="emphasis"><em>selection</em></span>: ATOM
</td></tr><tr><td align="left">
<span class="emphasis"><em>time</em></span>: TIMESTAMP
</td></tr></tbody></table></div><p>
The timestamp argument is the time at which the ownership changed hands,
and the owner argument is the window the previous owner specified in its
<code class="function">SetSelectionOwner</code>
request.
</p><p>
If an owner loses ownership while it has a transfer in progress (that is,
before it receives notification that the requestor has received all the data),
it must continue to service the ongoing transfer until it is complete.
</p><p>
If the selection value completely changes, but the owner happens
to be the same client (for example, selecting a totally different
piece of text in the same <code class="function">xterm</code> as before),
then the client should
reacquire the selection ownership as if it were not the owner,
providing a new timestamp. If the selection value is modified, but
can still reasonably be viewed as the same selected object,
<a id="id2588275" href="#ftn.id2588275" class="footnote"><sup>[3]</sup></a>
the owner should take no action.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Giving_Up_Selection_Ownership"></a>Giving Up Selection Ownership</h2></div></div></div><p>
Clients may either give up selection ownership voluntarily
or lose it forcibly as the result of some other client's actions.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Voluntarily_Giving_Up_Selection_Ownership"></a>Voluntarily Giving Up Selection Ownership</h3></div></div></div><p>
To relinquish ownership of a selection voluntarily,
a client should execute a
<code class="function">SetSelectionOwner</code>
request for that selection atom, with owner specified as
<code class="function">None</code>
and the time specified as the timestamp that was used to acquire the selection.
</p><p>
Alternatively,
the client may destroy the window used as the owner value of the
<code class="function">SetSelectionOwner</code>
request, or the client may terminate.
In both cases,
the ownership of the selection involved will revert to
<code class="function">None</code>.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Forcibly_Giving_Up_Selection_Ownership"></a>Forcibly Giving Up Selection Ownership</h3></div></div></div><p>
If a client gives up ownership of a selection
or if some other client executes a
<code class="function">SetSelectionOwner</code>
for it and thus reassigns it forcibly,
the previous owner will receive a
<code class="function">SelectionClear</code>
event. For the definition of a
<code class="function">SelectionClear</code>
event, see
<a class="xref" href="#Responsibilities_of_the_Selection_Owner" title="Responsibilities of the Selection Owner">Responsibilities of the Selection Owner</a>
</p><p>
The timestamp is the time the selection changed hands.
The specified owner is the window that was specified by the current owner
in its
<code class="function">SetSelectionOwner</code>
request.
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Requesting_a_Selection"></a>Requesting a Selection</h2></div></div></div><p>
A client that wishes to obtain the value of a selection in a particular
form (the requestor) issues a
<code class="function">ConvertSelection</code>
request, which is defined as follows:
</p><p>
<code class="function">ConvertSelection</code>
</p><div class="informaltable"><table border="0"><colgroup><col align="left" class="c1" /></colgroup><tbody><tr><td align="left">
<span class="emphasis"><em>selection</em></span>,
<span class="emphasis"><em>target</em></span>: ATOM
</td></tr><tr><td align="left">
<span class="emphasis"><em>property</em></span>: ATOM or
<code class="function">None</code>
</td></tr><tr><td align="left">
<span class="emphasis"><em>requestor</em></span>: WINDOW
</td></tr><tr><td align="left">
<span class="emphasis"><em>time</em></span>: TIMESTAMP or
<code class="function">CurrentTime</code>
</td></tr></tbody></table></div><p>
The selection argument specifies the particular selection involved,
and the target argument specifies the required form of the information.
For information about the choice of suitable atoms to use,
see
<a class="xref" href="#Use_of_Selection_Atoms" title="Use of Selection Atoms">Use of Selection Atoms</a>
The requestor should set the requestor argument to a window that it created;
the owner will place the reply property there.
The requestor should set the time argument to the timestamp on the event
that triggered the request for the selection value.
Note that clients should not specify
<code class="function">CurrentTime</code>.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Convention</strong></p></div><p>
Clients should not use
<code class="function">CurrentTime</code>
for the time argument of a
<code class="function">ConvertSelection</code>
request.
Instead, they should use the timestamp of the event that caused the request
to be made.
</p></blockquote></div><p>
The requestor should set the property argument to the name of a property
that the owner can use to report the value of the selection.
Requestors should ensure that the named property does not exist
on the window before issuing the
<code class="function">ConvertSelection</code>
request.<a id="id2588624" href="#ftn.id2588624" class="footnote"><sup>[4]</sup></a>
The exception to this rule is when the requestor intends to pass
parameters with the request (see below).
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Rationale</strong></p></div><p>
It is necessary for requestors to delete the property before issuing the
request so that the target can later be extended to take parameters without
introducing an incompatibility. Also note that the requestor of a selection
need not know the client that owns the selection nor the window on which
the selection was acquired.
</p></blockquote></div><p>
Some targets may be defined such that requestors can pass parameters
along with the request. If the requestor wishes to provide parameters
to a request, they should be placed in the specified property on the
requestor window before the requestor issues the
<code class="function">ConvertSelection</code>
request, and this property should be named in the request.
</p><p>
Some targets may be defined so that parameters are optional. If no
parameters are to be supplied with the request of such a target, the
requestor must ensure that the property does not exist before issuing
the
<code class="function">ConvertSelection</code>
request.
</p><p>
The protocol allows the property field to be set to
<code class="function">None</code>,
in which case the owner is supposed to choose a property name.
However, it is difficult for the owner to make this choice safely.
</p><p><span class="bold"><strong>Conventions</strong></span></p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Requestors should not use
<code class="function">None</code>
for the property argument of a
<code class="function">ConvertSelection</code>
request.
</p></li><li class="listitem"><p>
Owners receiving
<code class="function">ConvertSelection</code>
requests with a property argument of
<code class="function">None</code>
are talking to an obsolete client.
They should choose the target atom as the property name to be used
for the reply.
</p></li></ul></div><p>
The result of the
<code class="function">ConvertSelection</code>
request is that a
<code class="function">SelectionNotify</code>
event will be received.
For the definition of a
<code class="function">SelectionNotify</code>
event, see
<a class="xref" href="#Responsibilities_of_the_Selection_Owner" title="Responsibilities of the Selection Owner">Responsibilities of the Selection Owner</a>.
</p><p>
The requestor, selection, time, and target arguments will be the same
as those on the
<code class="function">ConvertSelection</code>
request.
</p><p>
If the property argument is
<code class="function">None</code>,
the conversion has been refused.
This can mean either that there is no owner for the selection,
that the owner does not support the conversion implied by the target,
or that the server did not have sufficient space to accommodate the data.
</p><p>
If the property argument is not
<code class="function">None</code>,
then that property will exist on the requestor window.
The value of the selection can be retrieved from this
property by using the
<code class="function">GetProperty</code>
request, which is defined as follows:
</p><p>
<code class="function">GetProperty</code>
</p><div class="informaltable"><table border="0"><colgroup><col align="left" class="c1" /></colgroup><tbody><tr><td align="left">
<span class="emphasis"><em>window</em></span>: WINDOW
</td></tr><tr><td align="left">
<span class="emphasis"><em>property</em></span>: ATOM
</td></tr><tr><td align="left">
<span class="emphasis"><em>type</em></span>: ATOM or
<code class="function">AnyPropertyType</code>
</td></tr><tr><td align="left">
<span class="emphasis"><em>long-offset</em></span>,
<span class="emphasis"><em>long-length</em></span>: CARD32
</td></tr><tr><td align="left">
<span class="emphasis"><em>delete</em></span>: BOOL
</td></tr><tr><td align="left">
-&gt;
</td></tr><tr><td align="left">
type: ATOM or <code class="function">None</code>
</td></tr><tr><td align="left">
format: {0, 8, 16, 32}
</td></tr><tr><td align="left">
bytes-after: CARD32
</td></tr><tr><td align="left">
value: LISTofINT8 or LISTofINT16 or LISTofINT32
</td></tr></tbody></table></div><p>
<code class="function">GetProperty</code>
to retrieve the value of a selection,
the property argument should be set to the corresponding value in the
<code class="function">SelectionNotify</code>
event.
Because the requestor has no way of knowing beforehand what type
the selection owner will use,
the type argument should be set to
<code class="function">AnyPropertyType</code>.
Several
<code class="function">GetProperty</code>
requests may be needed to retrieve all the data in the selection;
each should set the long-offset argument to the amount of data received so far,
and the size argument to some reasonable buffer size (see
<a class="xref" href="#Large_Data_Transfers" title="Large Data Transfers">Large Data Transfers</a>.
).
If the returned value of bytes-after is zero,
the whole property has been transferred.
</p><p>
Once all the data in the selection has been retrieved
(which may require getting the values of several properties --
see
<a class="xref" href="#Use_of_Selection_Properties" title="Use of Selection Properties">Use of Selection Properties</a>.
),
the requestor should delete the property in the
<code class="function">SelectionNotify</code>
request by using a
<code class="function">GetProperty</code>
request with the delete argument set to
<code class="function">True</code>.
As previously discussed,
the owner has no way of knowing when the data has been
transferred to the requestor unless the property is removed.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Convention</strong></p></div><p>
The requestor must delete the property named in the
<code class="function">SelectionNotify</code>
once all the data has been retrieved.
The requestor should invoke either
<code class="function">DeleteProperty</code> or
<code class="function">GetProperty</code>
(delete==True)
after it has successfully retrieved all the data in the selection.
For further information,
see
<a class="xref" href="#Large_Data_Transfers" title="Large Data Transfers">Large Data Transfers</a>.
</p></blockquote></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Large_Data_Transfers"></a>Large Data Transfers</h2></div></div></div><p>
Selections can get large, which poses two problems:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Transferring large amounts of data to the server is expensive.
</p></li><li class="listitem"><p>
All servers will have limits on the amount of data that can be stored
in properties.
Exceeding this limit will result in an
<code class="function">Alloc</code>
error on the
<code class="function">ChangeProperty</code>
request that the selection owner uses to store the data.
</p></li></ul></div><p>
The problem of limited server resources is addressed by the following
conventions:
</p><p>
<span class="bold"><strong>Conventions</strong></span>
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Selection owners should transfer the data describing a large selection
(relative to the maximum-request-size they received
in the connection handshake) using the INCR property mechanism
(see
<a class="xref" href="#INCR_Properties" title="INCR Properties">INCR Properties</a>.
).
</p></li><li class="listitem"><p>
Any client using
<code class="function">SetSelectionOwner</code>
to acquire selection ownership should arrange to process
<code class="function">Alloc</code>
errors in property change requests.
For clients using Xlib,
this involves using the
<a href="/libX11/libX11/libX11.html#XSetErrorHandler" class="olink"><code class="function">XSetErrorHandler</code></a>
function to override the default handler.
</p></li><li class="listitem"><p>
A selection owner must confirm that no
<code class="function">Alloc</code>
error occurred while storing the properties for a selection
before replying with a confirming
<code class="function">SelectionNotify</code>
event.
</p></li><li class="listitem"><p>
When storing large amounts of data (relative to maximum-request-size),
clients should use a sequence of
<code class="function">ChangeProperty (mode==Append)</code>
requests for reasonable quantities of data.
This avoids locking servers up and limits the waste of data an
<code class="function">Alloc</code>
error would cause.
</p></li><li class="listitem"><p>
If an
<code class="function">Alloc</code>
error occurs during the storing of the selection data,
all properties stored for this selection should be deleted
and the
<code class="function">ConvertSelection</code>
request should be refused (see
<a class="xref" href="#Responsibilities_of_the_Selection_Owner" title="Responsibilities of the Selection Owner">Responsibilities of the Selection Owner</a>.
).
</p></li><li class="listitem"><p>
To avoid locking servers up for inordinate lengths of time,
requestors retrieving large quantities of data from a property
should perform a series of
<code class="function">GetProperty</code>
requests, each asking for a reasonable amount of data.
</p></li></ul></div><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Advice to Implementors</strong></p></div><p>
Single-threaded servers should take care to avoid locking up during large
data transfers.
</p></blockquote></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Use_of_Selection_Atoms"></a>Use of Selection Atoms</h2></div></div></div><p>
Defining a new atom consumes resources in the server
that are not released until the server reinitializes.
Thus, reducing the need for newly minted atoms is an important goal
for the use of the selection atoms.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Selection_Atoms"></a>Selection Atoms</h3></div></div></div><p>
There can be an arbitrary number of selections, each named by an atom.
To conform with the inter-client conventions, however,
clients need deal with only these three selections:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
PRIMARY
</p></li><li class="listitem"><p>
SECONDARY
</p></li><li class="listitem"><p>
CLIPBOARD
</p></li></ul></div><p>
Other selections may be used freely for private communication among
related groups of clients.
</p><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="The_PRIMARY_Selection"></a>The PRIMARY Selection</h4></div></div></div><p>
The selection named by the atom PRIMARY is used for all commands
that take only a single argument and is the principal means of communication
between clients that use the selection mechanism.
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="The_SECONDARY_Selection"></a>The SECONDARY Selection</h4></div></div></div><p>
The selection named by the atom SECONDARY is used:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
As the second argument to commands taking two arguments
(for example, "exchange primary and secondary selections")
</p></li><li class="listitem"><p>
As a means of obtaining data when there is a primary selection
and the user does not want to disturb it
</p></li></ul></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="The_CLIPBOARD_Selection"></a>The CLIPBOARD Selection</h4></div></div></div><p>
The selection named by the atom CLIPBOARD is used to hold data
that is being transferred between clients,
that is, data that usually is being cut and then pasted
or copied and then pasted.
Whenever a client wants to transfer data to the clipboard:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
It should assert ownership of the CLIPBOARD.
</p></li><li class="listitem"><p>
If it succeeds in acquiring ownership,
it should be prepared to respond to a request for the contents of the CLIPBOARD
in the usual way (retaining the data to be able to return it).
The request may be generated by the clipboard client described below.
</p></li><li class="listitem"><p>
If it fails to acquire ownership,
a cutting client should not actually perform the cut or provide feedback
that would suggest that it has actually transferred data to the clipboard.
</p></li></ul></div><p>
The owner should repeat this process whenever the data to be transferred
would change.
</p><p>
Clients wanting to paste data from the clipboard should request
the contents of the CLIPBOARD selection in the usual way.
</p><p>
Except while a client is actually deleting or copying data,
the owner of the CLIPBOARD selection may be a single, special client
implemented for the purpose.
This client maintains the content of the clipboard up-to-date
and responds to requests for data from the clipboard as follows:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
It should assert ownership of the CLIPBOARD selection
and reassert it any time the clipboard data changes.
</p></li><li class="listitem"><p>
If it loses the selection (because another client has some new data
for the clipboard),
it should:
</p><div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>
Obtain the contents of the selection from the new owner by using the timestamp
in the
<code class="function">SelectionClear</code>
event.
</p></li><li class="listitem"><p>
Attempt to reassert ownership of the CLIPBOARD selection
by using the same timestamp.
</p></li><li class="listitem"><p>
Restart the process using a newly acquired timestamp if this attempt fails.
This timestamp should be obtained by asking the current owner of the
CLIPBOARD selection to convert it to a TIMESTAMP.
If this conversion is refused or if the same timestamp is received twice,
the clipboard client should acquire a fresh timestamp in the
usual way (for example by a zero-length append to a property).
</p></li></ul></div></li><li class="listitem"><p>
It should respond to requests for the CLIPBOARD contents in the usual way.
</p></li></ul></div><p>
A special CLIPBOARD client is not necessary.
The protocol used by the cutting client and the pasting client
is the same whether the CLIPBOARD client is running or not.
The reasons for running the special client include:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Stability - If the cutting client were to crash or terminate,
the clipboard value would still be available.
</p></li><li class="listitem"><p>
Feedback - The clipboard client can display the contents of the clipboard.
</p></li><li class="listitem"><p>
Simplicity - A client deleting data does not have to retain it for so long,
thus reducing the chance of race conditions causing problems.
</p></li></ul></div><p>
The reasons not to run the clipboard client include:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Performance - Data is transferred only if it is actually required
(that is, when some client actually wants the data).
</p></li><li class="listitem"><p>
Flexibility - The clipboard data may be available as more than one target.
</p></li></ul></div></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Target_Atoms"></a>Target Atoms</h3></div></div></div><p>
The atom that a requestor supplies as the target of a
<code class="function">ConvertSelection</code>
request determines the form of the data supplied.
The set of such atoms is extensible,
but a generally accepted base set of target atoms is needed.
As a starting point for this,
the following table contains those that have been suggested so far.
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Atom</th><th align="left">Type </th><th align="left">Data Received</th></tr></thead><tbody><tr><td align="left">ADOBE_PORTABLE_­DOCUMENT_­FORMAT</td><td align="left">STRING</td><td align="left">[1]</td></tr><tr><td align="left">APPLE_PICT</td><td align="left">APPLE_PICT</td><td align="left">[2]</td></tr><tr><td align="left">BACKGROUND</td><td align="left">PIXEL</td><td align="left">A list of pixel values</td></tr><tr><td align="left">BITMAP</td><td align="left">BITMAP</td><td align="left">A list of bitmap IDs</td></tr><tr><td align="left">CHARACTER_POSITION</td><td align="left">SPAN</td><td align="left">The start and end of the selection in bytes</td></tr><tr><td align="left">CLASS</td><td align="left">TEXT</td><td align="left">(see
<a class="xref" href="#WM_CLASS_Property" title="WM_CLASS Property">WM_CLASS Property</a>.
)</td></tr><tr><td align="left">CLIENT_WINDOW</td><td align="left">WINDOW</td><td align="left">Any top-level window owned by the selection owner</td></tr><tr><td align="left">COLORMAP</td><td align="left">COLORMAP</td><td align="left">A list of colormap IDs</td></tr><tr><td align="left">COLUMN_NUMBER</td><td align="left">SPAN</td><td align="left">The start and end column numbers</td></tr><tr><td align="left">COMPOUND_TEXT</td><td align="left">COMPOUND_TEXT</td><td align="left">Compound Text</td></tr><tr><td align="left">DELETE</td><td align="left">NULL</td><td align="left">(see
<a class="xref" href="#DELETE" title="DELETE">DELETE</a>.
)</td></tr><tr><td align="left">DRAWABLE</td><td align="left">DRAWABLE</td><td align="left">A list of drawable IDs</td></tr><tr><td align="left">ENCAPSULATED_POSTSCRIPT</td><td align="left">STRING</td><td align="left">[3], Appendix H
<a id="id2590014" href="#ftn.id2590014" class="footnote"><sup>[a]</sup></a>
</td></tr><tr><td align="left">ENCAPSULATED_POSTSCRIPT_­INTERCHANGE</td><td align="left">STRING</td><td align="left">[3], Appendix H</td></tr><tr><td align="left">FILE_NAME</td><td align="left">TEXT</td><td align="left">The full path name of a file</td></tr><tr><td align="left">FOREGROUND</td><td align="left">PIXEL</td><td align="left">A list of pixel values</td></tr><tr><td align="left">HOST_NAME</td><td align="left">TEXT</td><td align="left">(see
<a class="xref" href="#WM_CLIENT_MACHINE_Property" title="WM_CLIENT_MACHINE Property">WM_CLIENT_MACHINE Property</a>.
)</td></tr><tr><td align="left">INSERT_PROPERTY</td><td align="left">NULL</td><td align="left">(see
<a class="xref" href="#INSERT_PROPERTY" title="INSERT_PROPERTY">INSERT_PROPERTY</a>.
)</td></tr><tr><td align="left">INSERT_SELECTION</td><td align="left">NULL</td><td align="left">(see
<a class="xref" href="#INSERT_SELECTION" title="INSERT_SELECTION">INSERT_SELECTION</a>.
)</td></tr><tr><td align="left">LENGTH</td><td align="left">INTEGER</td><td align="left">The number of bytes in the selection
<a id="id2590147" href="#ftn.id2590147" class="footnote"><sup>[b]</sup></a>
</td></tr><tr><td align="left">LINE_NUMBER</td><td align="left">SPAN</td><td align="left">The start and end line numbers</td></tr><tr><td align="left">LIST_LENGTH</td><td align="left">INTEGER</td><td align="left">The number of disjoint parts of the selection</td></tr><tr><td align="left">MODULE</td><td align="left">TEXT</td><td align="left">The name of the selected procedure</td></tr><tr><td align="left">MULTIPLE</td><td align="left">ATOM_PAIR</td><td align="left">(see the discussion that follows)</td></tr><tr><td align="left">NAME</td><td align="left">TEXT</td><td align="left">(see
<a class="xref" href="#WM_NAME_Property" title="WM_NAME Property">WM_NAME Property</a>.
)</td></tr><tr><td align="left">ODIF</td><td align="left">TEXT</td><td align="left">ISO Office Document Interchange Format</td></tr><tr><td align="left">OWNER_OS</td><td align="left">TEXT</td><td align="left">The operating system of the owner client</td></tr><tr><td align="left">PIXMAP</td><td align="left">PIXMAP
<a id="id2590282" href="#ftn.id2590282" class="footnote"><sup>[c]</sup></a>
</td><td align="left">A list of pixmap IDs</td></tr><tr><td align="left">POSTSCRIPT</td><td align="left">STRING</td><td align="left">[3]</td></tr><tr><td align="left">PROCEDURE</td><td align="left">TEXT</td><td align="left">The name of the selected procedure</td></tr><tr><td align="left">PROCESS</td><td align="left">INTEGER, TEXT</td><td align="left">The process ID of the owner</td></tr><tr><td align="left">STRING</td><td align="left">STRING</td><td align="left">ISO Latin-1 (+TAB+NEWLINE) text</td></tr><tr><td align="left">TARGETS</td><td align="left">ATOM</td><td align="left">A list of valid target atoms</td></tr><tr><td align="left">TASK</td><td align="left">INTEGER, TEXT</td><td align="left">The task ID of the owner</td></tr><tr><td align="left">TEXT</td><td align="left">TEXT</td><td align="left">The text in the owner's choice of encoding</td></tr><tr><td align="left">TIMESTAMP</td><td align="left">INTEGER</td><td align="left">The timestamp used to acquire the selection</td></tr><tr><td align="left">USER</td><td align="left">TEXT</td><td align="left">The name of the user running the owner</td></tr></tbody><tbody class="footnotes"><tr><td colspan="3"><div class="footnote"><p><a id="ftn.id2590014" href="#id2590014" class="para"><sup>[a] </sup></a>
Earlier versions of this document erroneously specified that conversion of
the PIXMAP target returns a property of type DRAWABLE instead of PIXMAP.
Implementors should be aware of this and may want to support the DRAWABLE
type as well to allow for compatibility with older clients.
</p></div><div class="footnote"><p><a id="ftn.id2590147" href="#id2590147" class="para"><sup>[b] </sup></a>
The targets ENCAPSULATED_POSTSCRIPT and ENCAPSULATED_POSTSCRIPT_INTERCHANGE
are equivalent to the targets _ADOBE_EPS and _ADOBE_EPSI (respectively) that
appear in the selection targets registry. The _ADOBE_ targets are
deprecated, but clients are encouraged to continue to support them for
backward compatibility.
</p></div><div class="footnote"><p><a id="ftn.id2590282" href="#id2590282" class="para"><sup>[c] </sup></a>
This definition is ambiguous, as the selection may be converted into any of
several targets that may return differing amounts of data. The requestor
has no way of knowing which, if any, of these targets corresponds to the
result of LENGTH. Clients are advised that no guarantees can be made about
the result of a conversion to LENGTH; its use is thus deprecated.
</p></div></td></tr></tbody></table></div><p>
References:
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
Adobe Systems, Incorporated.
<span class="emphasis"><em>Portable Document Format Reference Manual.</em></span>
Reading, MA, Addison-Wesley, ISBN 0-201-62628-4.
</p></li><li class="listitem"><p>
Apple Computer, Incorporated.
<span class="emphasis"><em>Inside Macintosh, Volume V.</em></span>
Chapter 4, "Color QuickDraw," Color Picture Format.
ISBN 0-201-17719-6.
</p></li><li class="listitem"><p>
Adobe Systems, Incorporated.
<span class="emphasis"><em>PostScript Language Reference Manual.</em></span>
Reading, MA, Addison-Wesley, ISBN 0-201-18127-4.
</p></li></ol></div><p>
It is expected that this table will grow over time.
</p><p>
Selection owners are required to support the following targets.
All other targets are optional.
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
TARGETS - The owner should return a list of atoms that represent
the targets for which an attempt to convert the current selection
will succeed (barring unforseeable problems such as
<code class="function">Alloc</code>
errors).
This list should include all the required atoms.
</p></li><li class="listitem"><p>
MULTIPLE - The MULTIPLE target atom is valid only when a property
is specified on the
<code class="function">ConvertSelection</code>
request.
If the property argument in the
<code class="function">SelectionRequest</code>
event is
<code class="function">None</code>
and the target is MULTIPLE,
it should be refused.
</p><p>
When a selection owner receives a
<code class="function">SelectionRequest (target==MULTIPLE)</code>
request,
the contents of the property named in the request will be a list of atom pairs:
the first atom naming a target and the second naming a property
<code class="function">( None</code>
is not valid here).
The effect should be as if the owner had received a sequence of
<code class="function">SelectionRequest</code>
events (one for each atom pair) except that:
</p><div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>
The owner should reply with a
<code class="function">SelectionNotify</code>
only when all the requested conversions have been performed.
</p></li><li class="listitem"><p>
If the owner fails to convert the target named by an atom
in the MULTIPLE property,
it should replace that atom in the property with
<code class="function">None</code>.
</p></li></ul></div><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Convention</strong></p></div><p>
The entries in a MULTIPLE property must be processed in the order
they appear in the property.
For further information,
see
<a class="xref" href="#Selection_Targets_with_Side_Effects" title="Selection Targets with Side Effects">Selection Targets with Side Effects</a>.
</p></blockquote></div><p>
The requestor should delete each individual property when it has
copied the data from that conversion, and the property specified in the
MULTIPLE request when it has copied all the data.
</p><p>
The requests are otherwise to be processed independently, and they
should succeed or fail independently. The MULTIPLE target is an
optimization that reduces the amount of protocol traffic between the
owner and the requestor; it is not a transaction mechanism. For
example, a client may issue a MULTIPLE request with two targets: a data
target and the DELETE target. The DELETE target will still be processed
even if the conversion of the data target fails.
</p></li><li class="listitem"><p>
TIMESTAMP - To avoid some race conditions,
it is important that requestors be able to discover the timestamp
the owner used to acquire ownership.
Until and unless the protocol is changed so that a
<code class="function">GetSelectionOwner</code>
request returns the timestamp used to acquire ownership,
selection owners must support conversion to TIMESTAMP,
returning the timestamp they used to obtain the selection.
</p></li></ul></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Selection_Targets_with_Side_Effects"></a>Selection Targets with Side Effects</h3></div></div></div><p>
Some targets (for example, DELETE) have side effects.
To render these targets unambiguous,
the entries in a MULTIPLE property must be processed in the order
that they appear in the property.
</p><p>
In general,
targets with side effects will return no information,
that is, they will return a zero length property of type NULL.
(Type NULL means the result of
<code class="function">InternAtom</code>
on the string "NULL", not the value zero.)
In all cases,
the requested side effect must be performed before the conversion is accepted.
If the requested side effect cannot be performed,
the corresponding conversion request must be refused.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Conventions</strong></p></div><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Targets with side effects should return no information
(that is, they should have a zero-length property of type NULL).
</p></li><li class="listitem"><p>
The side effect of a target must be performed before the conversion is accepted.
</p></li><li class="listitem"><p>
If the side effect of a target cannot be performed,
the corresponding conversion request must be refused.
</p></li></ul></div></blockquote></div><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Problem</strong></p></div><p>
The need to delay responding to the
<code class="function">ConvertSelection</code>
request until a further conversion has succeeded poses problems
for the Intrinsics interface that need to be addressed.
</p></blockquote></div><p>
These side-effect targets are used to implement operations such as
"exchange PRIMARY and SECONDARY selections."
</p><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="DELETE"></a>DELETE</h4></div></div></div><p>
When the owner of a selection receives a request to convert it to DELETE,
it should delete the corresponding selection
(whatever doing so means for its internal data structures)
and return a zero-length property of type NULL if the deletion was successful.
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="INSERT_SELECTION"></a>INSERT_SELECTION</h4></div></div></div><p>
When the owner of a selection receives a request to convert it to
INSERT_SELECTION,
the property named will be of type ATOM_PAIR.
The first atom will name a selection,
and the second will name a target.
The owner should use the selection mechanism to convert the named selection
into the named target and should insert it at the location of the selection
for which it got the INSERT_SELECTION request
(whatever doing so means for its internal data structures).
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="INSERT_PROPERTY"></a>INSERT_PROPERTY</h4></div></div></div><p>
When the owner of a selection receives a request to convert it to
INSERT_PROPERTY,
it should insert the property named in the request at the location
of the selection for which it got the INSERT_SELECTION request
(whatever doing so means for its internal data structures).
</p></div></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Use_of_Selection_Properties"></a>Use of Selection Properties</h2></div></div></div><p>
The names of the properties used in selection data transfer are chosen by
the requestor.
The use of
<code class="function">None</code>
property fields in
<code class="function">ConvertSelection</code>
requests (which request the selection owner to choose a name)
is not permitted by these conventions.
</p><p>
The selection owner always chooses the type of the property
in the selection data transfer.
Some types have special semantics assigned by convention,
and these are reviewed in the following sections.
</p><p>
In all cases,
a request for conversion to a target should return either
a property of one of the types listed in the previous table for that target
or a property of type INCR and then a property of one of the listed types.
</p><p>
Certain selection properties may contain resource IDs. The selection owner
should ensure that the resource is not destroyed and that its contents are
not changed until after the selection transfer is complete. Requestors that
rely on the existence or on the proper contents of a resource must operate
on the resource (for example, by copying the contents of a pixmap) before
deleting the selection property.
</p><p>
The selection owner will return a list of zero or more items
of the type indicated by the property type.
In general,
the number of items in the list will correspond to the number
of disjoint parts of the selection.
Some targets (for example, side-effect targets) will be of length zero
irrespective of the number of disjoint selection parts.
In the case of fixed-size items,
the requestor may determine the number of items by the property size.
Selection property types are listed in the table below.
For variable-length items such as text,
the separators are also listed.
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Type Atom</th><th align="left">Format</th><th align="left">Separator</th></tr></thead><tbody><tr><td align="left">APPLE_PICT</td><td align="left">8</td><td align="left">Self-sizing</td></tr><tr><td align="left">ATOM</td><td align="left">32</td><td align="left">Fixed-size</td></tr><tr><td align="left">ATOM_PAIR</td><td align="left">32</td><td align="left">Fixed-size</td></tr><tr><td align="left">BITMAP</td><td align="left">32</td><td align="left">Fixed-size</td></tr><tr><td align="left">C_STRING</td><td align="left">8</td><td align="left">Zero</td></tr><tr><td align="left">COLORMAP</td><td align="left">32</td><td align="left">Fixed-size</td></tr><tr><td align="left">COMPOUND_TEXT</td><td align="left">8</td><td align="left">Zero</td></tr><tr><td align="left">DRAWABLE</td><td align="left">32</td><td align="left">Fixed-size</td></tr><tr><td align="left">INCR</td><td align="left">32</td><td align="left">Fixed-size</td></tr><tr><td align="left">INTEGER</td><td align="left">32</td><td align="left">Fixed-size</td></tr><tr><td align="left">PIXEL</td><td align="left">32</td><td align="left">Fixed-size</td></tr><tr><td align="left">PIXMAP</td><td align="left">32</td><td align="left">Fixed-size</td></tr><tr><td align="left">SPAN</td><td align="left">32</td><td align="left">Fixed-size</td></tr><tr><td align="left">STRING</td><td align="left">8</td><td align="left">Zero</td></tr><tr><td align="left">WINDOW</td><td align="left">32</td><td align="left">Fixed-size</td></tr></tbody></table></div><p>
It is expected that this table will grow over time.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="TEXT_Properties"></a>TEXT Properties</h3></div></div></div><p>
In general,
the encoding for the characters in a text string property is specified
by its type.
It is highly desirable for there to be a simple, invertible mapping
between string property types and any character set names
embedded within font names in any font naming standard adopted by the
Consortium.
</p><p>
The atom TEXT is a polymorphic target.
Requesting conversion into TEXT will convert into whatever encoding
is convenient for the owner.
The encoding chosen will be indicated by the type of the property returned.
TEXT is not defined as a type;
it will never be the returned type from a selection conversion request.
</p><p>
If the requestor wants the owner to return the contents of the selection
in a specific encoding,
it should request conversion into the name of that encoding.
</p><p>
In the table in
<a class="xref" href="#Target_Atoms" title="Target Atoms">Target Atoms</a>,
the word TEXT (in the Type column) is used to indicate one
of the registered encoding names.
The type would not actually be TEXT;
it would be STRING or some other ATOM naming the encoding chosen by the owner.
</p><p>
STRING as a type or a target specifies the ISO Latin-1 character set plus the
control characters TAB (octal 11) and NEWLINE (octal 12).
The spacing interpretation of TAB is context dependent.
Other ASCII control characters are explicitly not included in STRING
at the present time.
</p><p>
COMPOUND_TEXT as a type or a target specifies the Compound Text interchange
format; see the
<span class="emphasis"><em>Compound Text Encoding</em></span>.
</p><p>
There are some text objects where the source or intended user, as the
case may be, does not have a specific character set for the text, but
instead merely requires a zero-terminated sequence of bytes with no
other restriction; no element of the selection mechanism may assume that
any byte value is forbidden or that any two differing sequences are
equivalent.
<a id="id2591528" href="#ftn.id2591528" class="footnote"><sup>[5]</sup></a>
For these objects, the type C_STRING should be used.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Rationale</strong></p></div><p>
An example of the need for C_STRING is to transmit the names of
files; many operating systems do not interpret filenames as having
a character set. For example, the same character string uses a
different sequence of bytes in ASCII and EBCDIC, and so most
operating systems see these as different filenames and offer no
way to treat them as the same. Thus no character-set based
property type is suitable.
</p></blockquote></div><p>
Type STRING, COMPOUND_TEXT, and C_STRING properties will consist of a list
of elements separated by null characters; other encodings will need to
specify an appropriate list format.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="INCR_Properties"></a>INCR Properties</h3></div></div></div><p>
Requestors may receive a property of type INCR
<a id="id2591579" href="#ftn.id2591579" class="footnote"><sup>[6]</sup></a>
in response to any target that results in selection data.
</p><p>
This indicates that the owner will send the actual data incrementally.
The contents of the INCR property will be an integer,
which represents a lower bound on the number of bytes of data in the selection.
The requestor and the selection owner transfer the data in the selection
in the following manner.
</p><p>
The selection requestor starts the transfer process by deleting
the (type==INCR) property forming the reply to the selection.
</p><p>
The selection owner then:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Appends the data in suitable-size chunks to the
same property on the same window as the selection reply
with a type corresponding to the actual type of the converted selection.
The size should be less than the maximum-request-size in the connection
handshake.
</p></li><li class="listitem"><p>
Waits between each append for a
<code class="function">PropertyNotify</code>
(state==Deleted) event that shows that the requestor has read the data.
The reason for doing this is to limit the consumption of space in the server.
</p></li><li class="listitem"><p>
Waits (after the entire data has been transferred to the server) until a
<code class="function">PropertyNotify</code>
(state==Deleted)
event that shows that the data has been read by the requestor
and then writes zero-length data to the property.
</p></li></ul></div><p>
The selection requestor:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Waits for the
<code class="function">SelectionNotify</code>
event.
</p></li><li class="listitem"><p>
Loops:
</p><div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>
Retrieving data using
<code class="function">GetProperty</code>
with the delete argument
<code class="function">True</code>.
</p></li><li class="listitem"><p>
Waiting for a
<code class="function">PropertyNotify</code>
with the state argument
<code class="function">NewValue</code>.
</p></li></ul></div></li><li class="listitem"><p>
Waits until the property named by the
<code class="function">PropertyNotify</code>
event is zero-length.
</p></li><li class="listitem"><p>
Deletes the zero-length property.
</p></li></ul></div><p>
The type of the converted selection is the type of the first partial property.
The remaining partial properties must have the same type.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="DRAWABLE_Properties"></a>DRAWABLE Properties</h3></div></div></div><p>
Requestors may receive properties of type PIXMAP, BITMAP, DRAWABLE, or WINDOW,
which contain an appropriate ID.
While information about these drawables is available from the server by means of
the
<code class="function">GetGeometry</code> request,
the following items are not:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Foreground pixel
</p></li><li class="listitem"><p>
Background pixel
</p></li><li class="listitem"><p>
Colormap ID
</p></li></ul></div><p>
In general,
requestors converting into targets whose returned type in the table in
<a class="xref" href="#Target_Atoms" title="Target Atoms">Target Atoms</a>
is one of the DRAWABLE types should expect to convert also
into the following targets (using the MULTIPLE mechanism):
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
FOREGROUND returns a PIXEL value.
</p></li><li class="listitem"><p>
BACKGROUND returns a PIXEL value.
</p></li><li class="listitem"><p>
COLORMAP returns a colormap ID.
</p></li></ul></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="SPAN_Properties"></a>SPAN Properties</h3></div></div></div><p>
Properties with type SPAN contain a list of cardinal-pairs
with the length of the cardinals determined by the format.
The first specifies the starting position,
and the second specifies the ending position plus one.
The base is zero.
If they are the same,
the span is zero-length and is before the specified position.
The units are implied by the target atom,
such as LINE_NUMBER or CHARACTER_POSITION.
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Manager_Selections"></a>Manager Selections</h2></div></div></div><p>
Certain clients, often called managers, take on responsibility
for managing shared resources. A client that manages a shared
resource should take ownership of an appropriate selection,
named using the conventions described in
<a class="xref" href="#Naming_Conventions" title="Naming Conventions">Naming Conventions</a>
and
<a class="xref" href="#Discriminated_Names" title="Discriminated Names">Discriminated Names</a>.
A client that manages multiple
shared resources (or groups of resources) should take
ownership of a selection for each one.
</p><p>
The manager may support conversion of various targets
for that selection. Managers are encouraged to use this
technique as the primary means by which clients interact
with the managed resource. Note that the conventions for
interacting with the window manager predate this section;
as a result many interactions with the window manager use
other techniques.
</p><p>
Before a manager takes ownership of a manager selection, it
should use the
<code class="function">GetSelectionOwner</code>
request to check whether the selection is already owned by another client,
and, where appropriate, it should ask the user if the new manager should
replace the old one. If so, it may then take ownership of the selection.
Managers should acquire the selection using a window created expressly for
this purpose. Managers must conform to the rules for selection owners
described in
<a class="xref" href="#Acquiring_Selection_Ownership" title="Acquiring Selection Ownership">Acquiring Selection Ownership</a>
and
<a class="xref" href="#Responsibilities_of_the_Selection_Owner" title="Responsibilities of the Selection Owner">Responsibilities of the Selection Owner</a>
, and they must also support the required
targets listed in
<a class="xref" href="#Use_of_Selection_Atoms" title="Use of Selection Atoms">Use of Selection Atoms</a>.
</p><p>
If a manager loses ownership of a manager selection, this
means that a new manager is taking over its responsibilities.
The old manager must release all resources it has managed
and must then destroy the window that owned the selection.
For example, a window manager losing ownership of WM_S2
must deselect from
<code class="function">SubstructureRedirect</code>
on the root window of screen 2 before destroying the window that owned
WM_S2.
</p><p>
When the new manager notices that the window owning the selection
has been destroyed, it knows that it can successfully proceed to
control the resource it is planning to manage. If the old
manager does not destroy the window within a reasonable time,
the new manager should check with the user before destroying
the window itself or killing the old manager.
</p><p>
If a manager wants to give up, on its own, management of a shared
resource controlled by a selection, it must do so by releasing
the resources it is managing and then by destroying the
window that owns the selection. It should not first disown
the selection, since this introduces a race condition.
</p><p>
Clients who are interested in knowing when the owner of a
manager selection is no longer managing the corresponding shared
resource should select for
<code class="function">StructureNotify</code>
on the window owning the selection so they can be notified when the window
is destroyed. Clients are warned that after doing a
<code class="function">GetSelectionOwner</code>
and selecting for
<code class="function">StructureNotify</code>,
they should do a
<code class="function">GetSelectionOwner</code>
again to ensure that the owner did not change after initially getting the
selection owner and before selecting for
<code class="function">StructureNotify</code>.
</p><p>
Immediately after a manager successfully acquires ownership of a
manager selection, it should announce its arrival by sending a
<code class="function">ClientMessage</code>
event. This event should be sent using the
<code class="function">SendEvent</code>
protocol request with the following arguments:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Argument</th><th align="left">Value</th></tr></thead><tbody><tr><td align="left">destination:</td><td align="left">
the root window of screen 0, or the root
window of the appropriate screen if the
manager is managing a screen-specific resource</td></tr><tr><td align="left">propogate:</td><td align="left">False</td></tr><tr><td align="left">event-mask:</td><td align="left"><code class="function">StructureNotify</code></td></tr><tr><td align="left">event:</td><td align="left"><code class="function">ClientMessage</code></td></tr><tr><td align="left">     type:</td><td align="left">MANAGER</td></tr><tr><td align="left">     format:</td><td align="left">32</td></tr><tr><td align="left">     data[0]
<a id="id2592224" href="#ftn.id2592224" class="footnote"><sup>[a]</sup></a>
</td><td align="left">timestamp</td></tr><tr><td align="left">     data[1]:</td><td align="left">manager selection atom</td></tr><tr><td align="left">     data[2]:</td><td align="left">the window owning the selection</td></tr><tr><td align="left">     data[3]:</td><td align="left">manager-selection-specific data</td></tr><tr><td align="left">     data[4]:</td><td align="left">manager-selection-specific data</td></tr></tbody><tbody class="footnotes"><tr><td colspan="2"><div class="footnote"><p><a id="ftn.id2592224" href="#id2592224" class="para"><sup>[a] </sup></a>
We use the notation data[n] to indicate the n
<sup>th</sup> element
of the LISTofINT8, LISTofINT16, or LISTofINT32 in the data field of the
<code class="function">ClientMessage</code>,
according to the format field.
The list is indexed from zero.
</p></div></td></tr></tbody></table></div><p>
Clients that wish to know when a specific manager has started should
select for
<code class="function">StructureNotify</code>
on the appropriate root window and should watch for the appropriate MANAGER
<code class="function">ClientMessage</code>.
</p></div><div class="footnotes"><br /><hr width="100" align="left" /><div class="footnote"><p><a id="ftn.id2535529" href="#id2535529" class="para"><sup>[2] </sup></a>
At present, no part of the protocol requires requestors
to send events to the owner of a selection.
This restriction is imposed to prepare for possible future extensions.
</p></div><div class="footnote"><p><a id="ftn.id2588275" href="#id2588275" class="para"><sup>[3] </sup></a>
The division between these two cases is a matter of judgment
on the part of the software developer.
</p></div><div class="footnote"><p><a id="ftn.id2588624" href="#id2588624" class="para"><sup>[4] </sup></a>
This requirement is new in version 2.0, and, in general, existing
clients do not conform to this requirement. To prevent these clients
from breaking, no existing targets should be extended to take
parameters until sufficient time has passed for clients to be updated.
Note that the MULTIPLE target was defined to take parameters in version
1.0 and its definition is not changing. There is thus no conformance
problem with MULTIPLE.
</p></div><div class="footnote"><p><a id="ftn.id2591528" href="#id2591528" class="para"><sup>[5] </sup></a>
Note that this is different from STRING, where many byte values are
forbidden, and from COMPOUND_TEXT, where, for example, inserting the
sequence 27,\ 40,\ 66 (designate ASCII into GL) at the start does not alter
the meaning.
</p></div><div class="footnote"><p><a id="ftn.id2591579" href="#id2591579" class="para"><sup>[6] </sup></a>
These properties were called INCREMENTAL in an earlier draft.
The protocol for using them has changed,
and so the name has changed to avoid confusion.
</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="Peer_to_Peer_Communication_by_Means_of_Cut_Buffers"></a>Chapter 3. Peer-to-Peer Communication by Means of Cut Buffers</h2></div></div></div><p>
The cut buffer mechanism is much simpler but much less powerful
than the selection mechanism.
The selection mechanism is active in that it provides a link
between the owner and requestor clients.
The cut buffer mechanism is passive;
an owner places data in a cut buffer from which a requestor retrieves
the data at some later time.
</p><p>
The cut buffers consist of eight properties on the root of screen zero,
named by the predefined atoms CUT_BUFFER0 to CUT_BUFFER7.
These properties must, at present, have type STRING and format 8.
A client that uses the cut buffer mechanism must initially ensure that
all eight properties exist by using
<code class="function">ChangeProperty</code>
requests to append zero-length data to each.
</p><p>
A client that stores data in the cut buffers (an owner) first must rotate the
ring of buffers by plus 1 by using
<code class="function">RotateProperties</code>
requests to rename each buffer;
that is, CUT_BUFFER0 to CUT_BUFFER1, CUT_BUFFER1 to CUT_BUFFER2, ...,
and CUT_BUFFER7 to CUT_BUFFER0.
It then must store the data into CUT_BUFFER0 by using a
<code class="function">ChangeProperty</code>
request in mode
<a href="/libXaw/libXaw.html#Replace" class="olink"><code class="function">Replace</code></a>.
</p><p>
A client that obtains data from the cut buffers should use a
<code class="function">GetProperty</code>
request to retrieve the contents of CUT_BUFFER0.
</p><p>
In response to a specific user request,
a client may rotate the cut buffers by minus 1 by using
<code class="function">RotateProperties</code>
requests to rename each buffer;
that is, CUT_BUFFER7 to CUT_BUFFER6, CUT_BUFFER6 to CUT_BUFFER5, ...,
and CUT_BUFFER0 to CUT_BUFFER7.
</p><p>
Data should be stored to the cut buffers
and the ring rotated only when requested by explicit user action.
Users depend on their mental model of cut buffer operation
and need to be able to identify operations that transfer data to and fro.
</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="Client_to_Window_Manager_Communication"></a>Chapter 4. Client-to-Window-Manager Communication</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="sect1"><a href="#Clients_Actions">Client's Actions</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Creating_a_Top_Level_Window">Creating a Top-Level Window</a></span></dt><dt><span class="sect2"><a href="#Client_Properties">Client Properties</a></span></dt><dt><span class="sect2"><a href="#Window_Manager_Properties">Window Manager Properties</a></span></dt><dt><span class="sect2"><a href="#Changing_Window_State">Changing Window State</a></span></dt><dt><span class="sect2"><a href="#Configuring_the_Window">Configuring the Window</a></span></dt><dt><span class="sect2"><a href="#Changing_Window_Attributes">Changing Window Attributes</a></span></dt><dt><span class="sect2"><a href="#Input_Focus">Input Focus</a></span></dt><dt><span class="sect2"><a href="#Colormaps">Colormaps</a></span></dt><dt><span class="sect2"><a href="#Icons">Icons</a></span></dt><dt><span class="sect2"><a href="#Pop_up_Windows">Pop-up Windows</a></span></dt><dt><span class="sect2"><a href="#Window_Groups">Window Groups</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Client_Responses_to_Window_Manager_Actions">Client Responses to Window Manager Actions</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Reparenting">Reparenting</a></span></dt><dt><span class="sect2"><a href="#Redirection_of_Operations">Redirection of Operations</a></span></dt><dt><span class="sect2"><a href="#Window_Move">Window Move</a></span></dt><dt><span class="sect2"><a href="#Window_Resize">Window Resize</a></span></dt><dt><span class="sect2"><a href="#Iconify_and_Deiconify">Iconify and Deiconify</a></span></dt><dt><span class="sect2"><a href="#Colormap_Change">Colormap Change</a></span></dt><dt><span class="sect2"><a href="#Input_Focus_2">Input Focus</a></span></dt><dt><span class="sect2"><a href="#ClientMessage_Events">ClientMessage Events</a></span></dt><dt><span class="sect2"><a href="#Redirecting_Requests">Redirecting Requests</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Communication_with_the_Window_Manager_by_Means_of_Selections">Communication with the Window Manager by Means of Selections</a></span></dt><dt><span class="sect1"><a href="#Summary_of_Window_Manager_Property_Types">Summary of Window Manager Property Types</a></span></dt></dl></div><p>
To permit window managers to perform their role of mediating the competing
demands for resources such as screen space,
the clients being managed must adhere to certain conventions
and must expect the window managers to do likewise.
These conventions are covered here from the client's point of view.
</p><p>
In general,
these conventions are somewhat complex
and will undoubtedly change as new window management paradigms are developed.
Thus, there is a strong bias toward defining only those conventions
that are essential and that apply generally to all window management paradigms.
Clients designed to run with a particular window manager can easily
define private protocols to add to these conventions,
but they must be aware that their users may decide to run some other
window manager no matter how much the designers of the private protocol
are convinced that they have seen the "one true light" of user interfaces.
</p><p>
It is a principle of these conventions that a general client should
neither know nor care which window manager is running or, indeed,
if one is running at all.
The conventions do not support all client functions
without a window manager running;
for example, the concept of Iconic
is not directly supported by clients.
If no window manager is running,
the concept of Iconic does not apply.
A goal of the conventions is to make it possible to kill and
restart window managers without loss of functionality.
</p><p>
Each window manager will implement a particular window management policy;
the choice of an appropriate window management policy
for the user's circumstances is not one for an individual client to
make but will be made by the user or the user's system administrator.
This does not exclude the possibility of writing clients that
use a private protocol to restrict themselves to operating only
under a specific window manager.
Rather,
it merely ensures that no claim of general utility is made for such programs.
</p><p>
For example,
the claim is often made:
"The client I'm writing is important, and it needs to be on top."
Perhaps it is important when it is being run in earnest,
and it should then be run under the control of a window manager
that recognizes "important" windows through some private protocol
and ensures that they are on top.
However, imagine, for example, that the "important" client is being debugged.
Then, ensuring that it is always on top is no longer
the appropriate window management policy,
and it should be run under a window manager that allows other windows
(for example, the debugger) to appear on top.
</p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Clients_Actions"></a>Client's Actions</h2></div></div></div><p>
In general,
the object of the X Version 11 design is that clients should,
as far as possible, do exactly what they would do in the absence
of a window manager, except for the following:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Hinting to the window manager about the resources they would like
to obtain
</p></li><li class="listitem"><p>
Cooperating with the window manager by accepting the resources they
are allocated even if they are not those requested
</p></li><li class="listitem"><p>
Being prepared for resource allocations to change at any time
</p></li></ul></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Creating_a_Top_Level_Window"></a>Creating a Top-Level Window</h3></div></div></div><p>
A client's
<span class="emphasis"><em>top-level window</em></span> is a window whose
override-redirect attribute is
<code class="function">False</code>.
It must either be a child of a root window, or it must have been a child of
a root window immediately prior to having been reparented by the window
manager. If the client reparents the window away from the root, the window
is no longer a top-level window; but it can become a top-level window again
if the client reparents it back to the root.
</p><p>
A client usually would expect to create its top-level windows
as children of one or more of the root windows by using some
boilerplate like the following:
</p><pre class="literallayout">
win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), xsh.x, xsh.y,
xsh.width, xsh.height, bw, bd, bg);
</pre><p>
If a particular one of the root windows was required, however,
it could use something like the following:
</p><pre class="literallayout">
win = XCreateSimpleWindow(dpy, RootWindow(dpy, screen), xsh.x, xsh.y,
xsh.width, xsh.height, bw, bd, bg);
</pre><p>
Ideally,
it should be possible to override the choice of a root window
and allow clients (including window managers) to treat a nonroot window
as a pseudo-root.
This would allow, for example, the testing of window managers and the
use of application-specific window managers to control the subwindows
owned by the members of a related suite of clients.
Doing so properly requires an extension,
the design of which is under study.
</p><p>
From the client's point of view,
the window manager will regard its top-level window as being in
one of three states:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Normal
</p></li><li class="listitem"><p>
Iconic
</p></li><li class="listitem"><p>
Withdrawn
</p></li></ul></div><p>
Newly created windows start in the Withdrawn state.
Transitions between states happen when the top-level window is mapped
and unmapped and when the window manager receives certain messages.
For further details, see
<a class="xref" href="#WM_HINTS_Property" title="WM_HINTS Property">WM_HINTS Property</a>.
and
<a class="xref" href="#Changing_Window_State" title="Changing Window State">Changing Window State</a>.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Client_Properties"></a>Client Properties</h3></div></div></div><p>
Once the client has one or more top-level windows,
it should place properties on those windows to inform the window manager
of the behavior that the client desires.
Window managers will assume values they find convenient
for any of these properties that are not supplied;
clients that depend on particular values must explicitly supply them.
The window manager will not change properties written by the client.
</p><p>
The window manager will examine the contents of these
properties when the window makes the transition from the Withdrawn state
and will monitor some properties for changes while the window is
in the Iconic or Normal state.
When the client changes one of these properties,
it must use
<a href="/libXaw/libXaw.html#Replace" class="olink"><code class="function">Replace</code></a>
mode to overwrite the entire property with new data;
the window manager will retain no memory of the old value of the property.
All fields of the property must be set to suitable values in a single
<a href="/libXaw/libXaw.html#Replace" class="olink"><code class="function">Replace</code></a>
mode <code class="function">ChangeProperty</code>
request.
This ensures that the full contents of the property will be
available to a new window manager if the existing one crashes,
if it is shut down and restarted,
or if the session needs to be shut down and restarted by the session manager.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Convention</strong></p></div><p>
Clients writing or rewriting window manager properties must
ensure that the entire content of each property remains valid
at all times.
</p></blockquote></div><p>
Some of these properties may contain the IDs of resources, such as
windows or pixmaps. Clients should ensure that these resources exist
for at least as long as the window on which the property resides.
</p><p>
If these properties are longer than expected,
clients should ignore the remainder of the property.
Extending these properties is reserved to the X Consortium;
private extensions to them are forbidden.
Private additional communication between clients and window managers
should take place using separate properties.
The only exception to this rule is the WM_PROTOCOLS property, which may be
of arbitrary length and which may contain atoms representing private
protocols (see
<a class="xref" href="#WM_PROTOCOLS_Property" title="WM_PROTOCOLS Property">WM_PROTOCOLS Property</a>
).
</p><p>
The next sections describe each of the properties the clients
need to set, in turn.
They are summarized in the table in
<a class="xref" href="#Summary_of_Window_Manager_Property_Types" title="Summary of Window Manager Property Types">Summary of Window Manager Property Types</a>
</p><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="WM_NAME_Property"></a>WM_NAME Property</h4></div></div></div><p>
The WM_NAME property is an uninterpreted string
that the client wants the window manager to display
in association with the window (for example, in a window headline bar).
</p><p>
The encoding used for this string
(and all other uninterpreted string properties)
is implied by the type of the property.
The type atoms to be used for this purpose are described in
<a class="xref" href="#TEXT_Properties" title="TEXT Properties">TEXT Properties</a>.
</p><p>
Window managers are expected to make an effort to display this information.
Simply ignoring WM_NAME is not acceptable behavior.
Clients can assume that at least the first part of this string
is visible to the user and that if the information is not visible to the user,
it is because the user has taken an explicit action to make it invisible.
</p><p>
On the other hand,
there is no guarantee that the user can see the WM_NAME string
even if the window manager supports window headlines.
The user may have placed the headline off-screen
or have covered it by other windows.
WM_NAME should not be used for application-critical information
or to announce asynchronous changes of an application's state
that require timely user response.
The expected uses are to permit the user to identify one of a
number of instances of the same client
and to provide the user with noncritical state information.
</p><p>
Even window managers that support headline bars will place some limit
on the length of the WM_NAME string that can be visible;
brevity here will pay dividends.
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="WM_ICON_NAME_Property"></a>WM_ICON_NAME Property</h4></div></div></div><p>
The WM_ICON_NAME property is an uninterpreted string
that the client wants to be displayed in association with the window
when it is iconified (for example, in an icon label).
In other respects,
including the type, it is similar to WM_NAME.
For obvious geometric reasons,
fewer characters will normally be visible in WM_ICON_NAME than WM_NAME.
</p><p>
Clients should not attempt to display this string in their icon pixmaps
or windows; rather, they should rely on the window manager to do so.
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="WM_NORMAL_HINTS_Property"></a>WM_NORMAL_HINTS Property</h4></div></div></div><p>
The type of the WM_NORMAL_HINTS property is WM_SIZE_HINTS.
Its contents are as follows:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Field</th><th align="left">Type</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left">flags</td><td align="left">CARD32</td><td align="left">(see the next table)</td></tr><tr><td align="left">pad</td><td align="left">4*CARD32</td><td align="left">For backwards compatibility</td></tr><tr><td align="left">min_width</td><td align="left">INT32</td><td align="left">If missing, assume base_width</td></tr><tr><td align="left">min_height</td><td align="left">INT32</td><td align="left">If missing, assume base_height</td></tr><tr><td align="left">max_width</td><td align="left">INT32</td><td class="auto-generated"> </td></tr><tr><td align="left">max_height</td><td align="left">INT32</td><td class="auto-generated"> </td></tr><tr><td align="left">width_inc</td><td align="left">INT32</td><td class="auto-generated"> </td></tr><tr><td align="left">height_inc</td><td align="left">INT32</td><td class="auto-generated"> </td></tr><tr><td align="left">min_aspect</td><td align="left">(INT32,INT32)</td><td class="auto-generated"> </td></tr><tr><td align="left">max_aspect</td><td align="left">(INT32,INT32)</td><td class="auto-generated"> </td></tr><tr><td align="left">base_width</td><td align="left">INT32</td><td align="left">If missing, assume min_width</td></tr><tr><td align="left">base_height</td><td align="left">INT32</td><td align="left">If missing, assume min_height</td></tr><tr><td align="left">win_gravity</td><td align="left">INT32</td><td align="left">If missing, assume <code class="function">NorthWest</code></td></tr></tbody></table></div><p>
The WM_SIZE_HINTS.flags bit definitions are as follows:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Name</th><th align="left">Value</th><th align="left">Field</th></tr></thead><tbody><tr><td align="left"><code class="function">USPosition</code></td><td align="left">1</td><td align="left">User-specified x, y</td></tr><tr><td align="left"><code class="function">USSize</code></td><td align="left">2</td><td align="left">User-specified width, height</td></tr><tr><td align="left"><code class="function">PPosition</code></td><td align="left">4</td><td align="left">Program-specified position</td></tr><tr><td align="left"><code class="function">PSize</code></td><td align="left">8</td><td align="left">Program-specified size</td></tr><tr><td align="left"><code class="function">PMinSize</code></td><td align="left">16</td><td align="left">Program-specified minimum size</td></tr><tr><td align="left"><code class="function">PMaxSize</code></td><td align="left">32</td><td align="left">Program-specified maximum size</td></tr><tr><td align="left"><code class="function">PResizeInc</code></td><td align="left">64</td><td align="left">Program-specified resize increments</td></tr><tr><td align="left"><code class="function">PAspect</code></td><td align="left">128</td><td align="left">Program-specified min and max aspect ratios</td></tr><tr><td align="left"><code class="function">PBaseSize</code></td><td align="left">256</td><td align="left">Program-specified base size</td></tr><tr><td align="left"><code class="function">PWinGravity</code></td><td align="left">512</td><td align="left">Program-specified window gravity</td></tr></tbody></table></div><p>
To indicate that the size and position of the window
(when a transition from the Withdrawn state occurs) was specified by the user,
the client should set the
<code class="function">USPosition</code>
and
<code class="function">USSize</code>
flags,
which allow a window manager to know that the user specifically asked where
the window should be placed or how the window should be sized and that
further interaction is superfluous.
To indicate that it was specified by the client without any user involvement,
the client should set
<code class="function">PPosition</code>
and
<code class="function">PSize</code>.
</p><p>
The size specifiers refer to the width and height of the client's
window excluding borders.
</p><p>
The win_gravity may be any of the values specified for WINGRAVITY in
the core protocol except for
<code class="function">Unmap</code>:
<code class="function">NorthWest</code>
(1),
<code class="function">North</code>
(2),
<code class="function">NorthEast</code>
(3),
<code class="function">West</code>
(4),
<code class="function">Center</code>
(5),
<code class="function">East</code>
(6),
<code class="function">SouthWest</code>
(7),
<code class="function">South</code>
(8), and
<code class="function">SouthEast</code>
(9). It specifies how and whether the client window wants to be shifted to
make room for the window manager frame.
</p><p>
If the win_gravity is
<code class="function">Static</code>,
the window manager frame is positioned
so that the inside border of the client window inside the frame is
in the same position on the screen as it was when the client
requested the transition from Withdrawn state. Other values of
win_gravity specify a window reference point. For
<code class="function">NorthWest</code>,
<code class="function">NorthEast</code>,
<code class="function">SouthWest</code>,
and
<code class="function">SouthEast</code>
the reference point is the specified outer corner of the window (on the
outside border edge). For
<code class="function">North</code>,
<code class="function">South</code>,
<code class="function">East</code>
and
<code class="function">West</code>
the reference point is the center of the specified outer edge of the window
border. For
<code class="function">Center</code>
the reference point is the center of the window. The reference point of the
window manager frame is placed at the location on the screen where the
reference point of the client window was when the client requested the
transition from Withdrawn state.
</p><p>
The min_width and min_height elements specify the
minimum size that the window can be for the client to be useful.
The max_width and max_height elements specify the maximum size.
The base_width and base_height elements in conjunction with width_inc
and height_inc define an arithmetic progression of preferred window
widths and heights for non-negative integers
<span class="emphasis"><em>i</em></span> and <span class="emphasis"><em>j</em></span>:
</p><pre class="literallayout">
width = base_width + ( i x width_inc )
height = base_height + ( j x height_inc )
</pre><p>
Window managers are encouraged to use
<span class="emphasis"><em>i</em></span> and <span class="emphasis"><em>j</em></span>
instead of width and height in reporting window sizes to users.
If a base size is not provided,
the minimum size is to be used in its place and vice versa.
</p><p>
The min_aspect and max_aspect fields are fractions with the numerator first
and the denominator second, and they allow a client to specify the range of
aspect ratios it prefers. Window managers that honor aspect ratios should
take into account the base size in determining the preferred window size. If
a base size is provided along with the aspect ratio fields, the base size
should be subtracted from the window size prior to checking that the aspect
ratio falls in range. If a base size is not provided, nothing should be
subtracted from the window size. (The minimum size is not to be used in
place of the base size for this purpose.)
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="WM_HINTS_Property"></a>WM_HINTS Property</h4></div></div></div><p>
The WM_HINTS property (whose type is WM_HINTS)
is used to communicate to the window manager.
It conveys the information the window manager needs
other than the window geometry,
which is available from the window itself;
the constraints on that geometry,
which is available from the WM_NORMAL_HINTS structure;
and various strings,
which need separate properties, such as WM_NAME.
The contents of the properties are as follows:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Field</th><th align="left">Type</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left">flags</td><td align="left">CARD32</td><td align="left">(see the next table)</td></tr><tr><td align="left">input</td><td align="left">CARD32</td><td align="left">The client's input model</td></tr><tr><td align="left">initial_state</td><td align="left">CARD32</td><td align="left">The state when first mapped</td></tr><tr><td align="left">icon_pixmap</td><td align="left">PIXMAP</td><td align="left">The pixmap for the icon image</td></tr><tr><td align="left">icon_window</td><td align="left">WINDOW</td><td align="left">The window for the icon image</td></tr><tr><td align="left">icon_x</td><td align="left">INT32</td><td align="left">The icon location</td></tr><tr><td align="left">icon_y</td><td align="left">INT32</td><td class="auto-generated"> </td></tr><tr><td align="left">icon_mask</td><td align="left">PIXMAP</td><td align="left">The mask for the icon shape</td></tr><tr><td align="left">window_group</td><td align="left">WINDOW</td><td align="left">The ID of the group leader window</td></tr></tbody></table></div><p>
The WM_HINTS.flags bit definitions are as follows:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Name</th><th align="left">Value</th><th align="left">Field</th></tr></thead><tbody><tr><td align="left"><code class="function">InputHint</code></td><td align="left">1</td><td align="left">input</td></tr><tr><td align="left"><code class="function">StateHint</code></td><td align="left">2</td><td align="left">initial_state</td></tr><tr><td align="left"><code class="function">IconPixmapHint</code></td><td align="left">4</td><td align="left">icon_pixmap</td></tr><tr><td align="left"><code class="function">IconWindowHint</code></td><td align="left">8</td><td align="left">icon_window</td></tr><tr><td align="left"><code class="function">IconPositionHint</code></td><td align="left">16</td><td align="left">icon_x &amp; icon_y</td></tr><tr><td align="left"><code class="function">IconMaskHint</code></td><td align="left">32</td><td align="left">icon_mask</td></tr><tr><td align="left"><code class="function">WindowGroupHint</code></td><td align="left">64</td><td align="left">window_group</td></tr><tr><td align="left"><code class="function">MessageHint</code></td><td align="left">128</td><td align="left">(this bit is obsolete)</td></tr><tr><td align="left"><code class="function">UrgencyHint</code></td><td align="left">256</td><td align="left">urgency</td></tr></tbody></table></div><p>
Window managers are free to assume convenient values for all fields of
the WM_HINTS property if a window is mapped without one.
</p><p>
The input field is used to communicate to the window manager the input focus
model used by the client (see
<a class="xref" href="#Input_Focus" title="Input Focus">Input Focus</a>
).
</p><p>
Clients with the Globally Active and No Input models should set the
input flag to
<code class="function">False</code>.
Clients with the Passive and Locally Active models should set the input
flag to
<code class="function">True</code>.
</p><p>
From the client's point of view,
the window manager will regard the client's top-level window as being
in one of three states:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Normal
</p></li><li class="listitem"><p>
Iconic
</p></li><li class="listitem"><p>
Withdrawn
</p></li></ul></div><p>
The semantics of these states are described in
<a class="xref" href="#Changing_Window_State" title="Changing Window State">Changing Window State</a>.
Newly created windows start in the Withdrawn state.
Transitions between states happen when a
top-level window is mapped and unmapped
and when the window manager receives certain messages.
</p><p>
The value of the initial_state field determines the state the client
wishes to be in at the time the top-level window is mapped
from the Withdrawn state, as shown in the following table:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">State</th><th align="left">Value</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left">NormalState</td><td align="left">1</td><td align="left">The window is visible</td></tr><tr><td align="left">IconicState</td><td align="left">3</td><td align="left">The icon is visible</td></tr></tbody></table></div><p>
The icon_pixmap field may specify a pixmap to be used as an icon.
This pixmap should be:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
One of the sizes specified in the WM_ICON_SIZE property
on the root if it exists (see
<a class="xref" href="#WM_ICON_SIZE_Property" title="WM_ICON_SIZE Property">WM_ICON_SIZE Property</a>
).
</p></li><li class="listitem"><p>
1-bit deep.
The window manager will select, through the defaults database,
suitable background (for the 0 bits) and foreground (for the 1 bits) colors.
These defaults can, of course, specify different colors for the icons
of different clients.
</p></li></ul></div><p>
The icon_mask specifies which pixels of the icon_pixmap should be used as the
icon, allowing for icons to appear nonrectangular.
</p><p>
The icon_window field is the ID of a window the client wants used as its icon.
Most, but not all, window managers will support icon windows.
Those that do not are likely to have a user interface in which small
windows that behave like icons are completely inappropriate.
Clients should not attempt to remedy the omission by working around it.
</p><p>
Clients that need more capabilities from the icons than a simple 2-color
bitmap should use icon windows.
Rules for clients that do are set out in
<a class="xref" href="#Icons" title="Icons">Icons</a>.
</p><p>
The (icon_x,icon_y) coordinate is a hint to the window manager
as to where it should position the icon.
The policies of the window manager control the positioning of icons,
so clients should not depend on attention being paid to this hint.
</p><p>
The window_group field lets the client specify that this window belongs
to a group of windows.
An example is a single client manipulating multiple
children of the root window.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Conventions</strong></p></div><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
The window_group field should be set to the ID of the group leader.
The window group leader may be a window that exists only for that purpose;
a placeholder group leader of this kind would never be mapped
either by the client or by the window manager.
</p></li><li class="listitem"><p>
The properties of the window group leader are those for the group as
a whole (for example, the icon to be shown when the entire group is iconified).
</p></li></ul></div></blockquote></div><p>
Window managers may provide facilities for manipulating the group as a whole.
Clients, at present, have no way to operate on the group as a whole.
</p><p>
The messages bit, if set in the flags field, indicates that the
client is using an obsolete window manager communication protocol,
<a id="id2594445" href="#ftn.id2594445" class="footnote"><sup>[7]</sup></a>
rather than the WM_PROTOCOLS mechanism of
<a class="xref" href="#WM_PROTOCOLS_Property" title="WM_PROTOCOLS Property">WM_PROTOCOLS Property</a>
</p><p>
The
<code class="function">UrgencyHint</code>
flag, if set in the flags field, indicates that the client deems the window
contents to be urgent, requiring the timely response of the user. The
window manager must make some effort to draw the user's attention to this
window while this flag is set. The window manager must also monitor the
state of this flag for the entire time the window is in the Normal or Iconic
state and must take appropriate action when the state of the flag changes.
The flag is otherwise independent of the window's state; in particular, the
window manager is not required to deiconify the window if the client sets
the flag on an Iconic window. Clients must provide some means by which the
user can cause the
<code class="function">UrgencyHint</code>
flag to be set to zero or the window to be withdrawn. The user's action can
either mitigate the actual condition that made the window urgent, or it can
merely shut off the alarm.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Rationale</strong></p></div><p>
This mechanism is useful for alarm dialog boxes or reminder windows, in
cases where mapping the window is not enough (e.g., in the presence of
multi-workspace or virtual desktop window managers), and where using an
override-redirect window is too intrusive. For example, the window manager
may attract attention to an urgent window by adding an indicator to its
title bar or its icon. Window managers may also take additional action
for a window that is newly urgent, such as by flashing its icon (if the
window is iconic) or by raising it to the top of the stack.
</p></blockquote></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="WM_CLASS_Property"></a>WM_CLASS Property</h4></div></div></div><p>
The WM_CLASS property (of type STRING without control characters)
contains two consecutive null-terminated strings.
These specify the Instance and Class names to be used by both the client
and the window manager for looking up resources for the application
or as identifying information.
This property must be present when the window leaves the Withdrawn state
and may be changed only while the window is in the Withdrawn state.
Window managers may examine the property only when they start up
and when the window leaves the Withdrawn state,
but there should be no need for a client to change its state dynamically.
</p><p>
The two strings, respectively, are:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
A string that names the particular instance of the application to which
the client that owns this window belongs.
Resources that are specified by instance name override any resources
that are specified by class name.
Instance names can be specified by the user in an operating-system specific
manner.
On POSIX-conformant systems,
the following conventions are used:
</p><div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>
If "-name NAME" is given on the command line,
NAME is used as the instance name.
</p></li><li class="listitem"><p>
Otherwise, if the environment variable RESOURCE_NAME is set,
its value will be used as the instance name.
</p></li><li class="listitem"><p>
Otherwise, the trailing part of the name used to invoke the program
(argv[0] stripped of any directory names) is used as the instance name.
</p></li></ul></div></li><li class="listitem"><p>
A string that names the general class of applications to which the client
that owns this window belongs.
Resources that are specified by class apply to all applications
that have the same class name.
Class names are specified by the application writer.
Examples of commonly used class names include:
"Emacs", "XTerm", "XClock", "XLoad", and so on.
</p></li></ul></div><p>
Note that WM_CLASS strings are null-terminated
and, thus, differ from the general conventions that STRING properties
are null-separated.
This inconsistency is necessary for backwards compatibility.
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="WM_TRANSIENT_FOR_Property"></a>WM_TRANSIENT_FOR Property</h4></div></div></div><p>
The WM_TRANSIENT_FOR property (of type WINDOW)
contains the ID of another top-level window.
The implication is that this window is a pop-up on behalf of the named window,
and window managers may decide not to decorate transient windows
or may treat them differently in other ways.
In particular,
window managers should present newly mapped WM_TRANSIENT_FOR
windows without requiring any user interaction,
even if mapping top-level windows normally does require interaction.
Dialogue boxes, for example, are an example of windows that should have
WM_TRANSIENT_FOR set.
</p><p>
It is important not to confuse WM_TRANSIENT_FOR with override-redirect.
WM_TRANSIENT_FOR should be used in those cases where the pointer
is not grabbed while the window is mapped (in other words,
if other windows are allowed to be active while the transient is up).
If other windows must be prevented from processing input
(for example, when implementing pop-up menus),
use override-redirect and grab the pointer while the window is mapped.
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="WM_PROTOCOLS_Property"></a>WM_PROTOCOLS Property</h4></div></div></div><p>
The WM_PROTOCOLS property (of type ATOM) is a list of atoms.
Each atom identifies a communication protocol between the client
and the window manager in which the client is willing to participate.
Atoms can identify both standard protocols and private protocols
specific to individual window managers.
</p><p>
All the protocols in which a client can volunteer to take part
involve the window manager sending the client a
<code class="function">ClientMessage</code>
event and the client taking appropriate action.
For details of the contents of the event,
see
<a class="xref" href="#ClientMessage_Events" title="ClientMessage Events">ClientMessage Events</a>
In each case,
the protocol transactions are initiated by the window manager.
</p><p>
The WM_PROTOCOLS property is not required.
If it is not present,
the client does not want to participate in any window manager protocols.
</p><p>
The X Consortium will maintain a registry of protocols to avoid collisions
in the name space.
The following table lists the protocols that have been defined to date.
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Protocol</th><th align="left">Section</th><th align="left">Purpose</th></tr></thead><tbody><tr><td align="left">WM_TAKE_FOCUS</td><td align="left">
<a class="xref" href="#Input_Focus" title="Input Focus">Input Focus</a>
</td><td align="left">Assignment of input focus</td></tr><tr><td align="left">WM_SAVE_YOURSELF</td><td align="left">Appendix C</td><td align="left">Save client state request (deprecated)</td></tr><tr><td align="left">WM_DELETE_WINDOW</td><td align="left">
<a class="xref" href="#Window_Deletion" title="Window Deletion">Window Deletion</a>
</td><td align="left">Request to delete top-level window</td></tr></tbody></table></div><p>
It is expected that this table will grow over time.
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="WM_COLORMAP_WINDOWS_Property"></a>WM_COLORMAP_WINDOWS Property</h4></div></div></div><p>
The WM_COLORMAP_WINDOWS property (of type WINDOW) on a top-level window
is a list of the IDs of windows that may need colormaps installed
that differ from the colormap of the top-level window.
The window manager will watch this list of windows for changes in their
colormap attributes.
The top-level window is always (implicitly or explicitly) on the watch list.
For the details of this mechanism,
see
<a class="xref" href="#Colormaps" title="Colormaps">Colormaps</a>
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="WM_CLIENT_MACHINE_Property"></a>WM_CLIENT_MACHINE Property</h4></div></div></div><p>
The client should set the WM_CLIENT_MACHINE property (of one of the TEXT
types) to a string that forms the name of the machine running the client as
seen from the machine running the server.
</p></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Window_Manager_Properties"></a>Window Manager Properties</h3></div></div></div><p>
The properties that were described in the previous section are those
that the client is responsible for maintaining on its top-level windows.
This section describes the properties that the window manager places on
client's top-level windows and on the root.
</p><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="WM_STATE_Property"></a>WM_STATE Property</h4></div></div></div><p>
The window manager will place a WM_STATE property (of type WM_STATE) on each
top-level client window that is not in the Withdrawn state. Top-level
windows in the Withdrawn state may or may not have the WM_STATE property.
Once the top-level window has been withdrawn, the client may re-use it for
another purpose. Clients that do so should remove the WM_STATE property if
it is still present.
</p><p>
Some clients (such as <code class="function">xprop</code>) will ask the user to
click over a window
on which the program is to operate. Typically, the intent is for this to be
a top-level window. To find a top-level window, clients should search the
window hierarchy beneath the selected location for a window with the
WM_STATE property. This search must be recursive in order to cover all
window manager reparenting possibilities. If no window with a WM_STATE
property is found, it is recommended that programs use a mapped
child-of-root window if one is present beneath the selected location.
</p><p>
The contents of the WM_STATE property are defined as follows:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Field</th><th align="left">Type</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left">state</td><td align="left">CARD32</td><td align="left">(see the next table)</td></tr><tr><td align="left">icon</td><td align="left">WINDOW</td><td align="left">ID of icon window</td></tr></tbody></table></div><p>
The following table lists the WM_STATE.state values:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">State</th><th align="left">Value</th></tr></thead><tbody><tr><td align="left">WithdrawnState</td><td align="left">0</td></tr><tr><td align="left">NormalState</td><td align="left">1</td></tr><tr><td align="left">IconicState</td><td align="left">3</td></tr></tbody></table></div><p>
Adding other fields to this property is reserved to the X Consortium.
Values for the state field other than those defined in the above
table are reserved for use by the X Consortium.
</p><p>
The state field describes the window manager's idea of the state
the window is in, which may not match the client's idea as expressed
in the initial_state field of the WM_HINTS property
(for example, if the user has asked the window manager to iconify the window).
If it is
<code class="function">NormalState</code>,
the window manager believes the client should be animating its window.
If it is
<code class="function">IconicState</code>,
the client should animate its icon window.
In either state,
clients should be prepared to handle exposure events from either window.
</p><p>
When the window is withdrawn, the window manager will either change the
state field's value to
<code class="function">WithdrawnState</code>
or it will remove the WM_STATE property entirely.
</p><p>
The icon field should contain the window ID of the window that the
window manager uses as the icon for the window on which this property is
set. If no such window exists, the icon field should be
<code class="function">None</code>.
Note that this window could be but is not necessarily the same window as the
icon window that the client may have specified in its WM_HINTS property.
The WM_STATE icon may be a window that the window manager has supplied and
that contains the client's icon pixmap, or it may be an ancestor of the
client's icon window.
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="WM_ICON_SIZE_Property"></a>WM_ICON_SIZE Property</h4></div></div></div><p>
A window manager that wishes to place constraints on the sizes of icon
pixmaps and/or windows should place a property called WM_ICON_SIZE on the root.
The contents of this property are listed in the following table.
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Field</th><th align="left">Type</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left">min_width</td><td align="left">CARD32</td><td align="left">The data for the icon size series</td></tr><tr><td align="left">min_height</td><td align="left">CARD32</td><td class="auto-generated"> </td></tr><tr><td align="left">max_width</td><td align="left">CARD32</td><td class="auto-generated"> </td></tr><tr><td align="left">max_height</td><td align="left">CARD32</td><td class="auto-generated"> </td></tr><tr><td align="left">width_inc</td><td align="left">CARD32</td><td class="auto-generated"> </td></tr><tr><td align="left">height_inc</td><td align="left">CARD32</td><td class="auto-generated"> </td></tr></tbody></table></div><p>
For more details see section 14.1.12 in
<span class="emphasis"><em>Xlib - C Language X Interface</em></span>.
</p></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Changing_Window_State"></a>Changing Window State</h3></div></div></div><p>
From the client's point of view,
the window manager will regard each of the client's top-level
windows as being in one of three states,
whose semantics are as follows:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
<code class="function">NormalState</code>
- The client's top-level window is viewable.
</p></li><li class="listitem"><p>
<code class="function">IconicState</code>
- The client's top-level window is iconic
(whatever that means for this window manager).
The client can assume that its top-level window is not viewable,
its icon_window (if any) will be viewable
and, failing that,
its icon_pixmap (if any) or its WM_ICON_NAME will be displayed.
</p></li><li class="listitem"><p>
<code class="function">WithdrawnState</code>
- Neither the client's top-level window nor its icon is visible.
</p></li></ul></div><p>
In fact,
the window manager may implement states with semantics
other than those described above.
For example,
a window manager might implement a concept of an "inactive" state
in which an infrequently used client's window would be represented
as a string in a menu.
But this state is invisible to the client,
which would see itself merely as being in the Iconic state.
</p><p>
Newly created top-level windows are in the Withdrawn state.
Once the window has been provided with suitable properties,
the client is free to change its state as follows:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Withdrawn -&gt; Normal - The client should map the window with
WM_HINTS.initial_state being
<code class="function">NormalState</code>.
</p></li><li class="listitem"><p>
Withdrawn -&gt; Iconic - The client should map the window with
WM_HINTS.initial_state being
<code class="function">IconicState</code>.
</p></li><li class="listitem"><p>
Normal -&gt; Iconic - The client should send a
<code class="function">ClientMessage</code>
event as described later in this section.
</p></li><li class="listitem"><p>
Normal -&gt; Withdrawn - The client should unmap the window and follow it
with a synthetic
<code class="function">UnmapNotify</code>
event as described later in this section.
</p></li><li class="listitem"><p>
Iconic -&gt; Normal - The client should map the window.
The contents of WM_HINTS.initial_state are irrelevant in this case.
</p></li><li class="listitem"><p>
Iconic -&gt; Withdrawn - The client should unmap the window
and follow it with a synthetic
<code class="function">UnmapNotify</code>
event as described later in this section.
</p></li></ul></div><p>
Only the client can effect a transition into or out of the Withdrawn
state.
Once a client's window
has left the Withdrawn state,
the window will be mapped if it is in the Normal state and the window will be
unmapped if it is in the Iconic state. Reparenting window managers
must unmap the client's window when it is in the Iconic state, even if an
ancestor window being unmapped renders the client's window unviewable.
Conversely, if a reparenting window manager renders the client's window
unviewable by unmapping an ancestor, the client's window is by definition in
the Iconic state and must also be unmapped.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Advice to Implementors</strong></p></div><p>
Clients can select for
<code class="function">StructureNotify</code>
on their
top-level windows to track transitions between Normal and Iconic states.
Receipt of a
<code class="function">MapNotify</code>
event will indicate a transition to the Normal state, and receipt of an
<code class="function">UnmapNotify</code>
event will indicate a transition to the Iconic state.
</p></blockquote></div><p>
When changing the state of the window to Withdrawn, the client must (in
addition to unmapping the window) send a synthetic
<code class="function">UnmapNotify</code>
event by
using a
<code class="function">SendEvent</code>
request with the following arguments:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Argument</th><th align="left">Value</th></tr></thead><tbody><tr><td align="left">destination</td><td align="left">The root</td></tr><tr><td align="left">propogate</td><td align="left"><span class="bold"><strong>False</strong></span></td></tr><tr><td align="left">event-mask</td><td align="left">(<span class="bold"><strong>SubstructureRedirect|SubstructureNotify</strong></span>)</td></tr><tr><td align="left">event: an <code class="function">UnmapNotify</code> with:</td><td class="auto-generated"> </td></tr><tr><td align="left">     event:</td><td align="left">The root</td></tr><tr><td align="left">     window:</td><td align="left">The window itself</td></tr><tr><td align="left">     from-configure:</td><td align="left"><span class="bold"><strong>False</strong></span></td></tr></tbody></table></div><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Rationale</strong></p></div><p>
The reason for requiring the client to send a synthetic
<code class="function">UnmapNotify</code>
event is to ensure that the window manager
gets some notification of the client's desire to change state,
even though the window may already be unmapped when the desire is expressed.
</p></blockquote></div><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Advice to Implementors</strong></p></div><p>
For compatibility with obsolete clients,
window managers should trigger the transition to the Withdrawn state
on the real
<code class="function">UnmapNotify</code>
rather than waiting for the synthetic one.
They should also trigger the transition if they receive a synthetic
<code class="function">UnmapNotify</code>
on a window for which they have not yet received a real
<code class="function">UnmapNotify</code>.
</p></blockquote></div><p>
When a client withdraws a window,
the window manager will then update or remove the WM_STATE
property as described in
<a class="xref" href="#WM_STATE_Property" title="WM_STATE Property">WM_STATE Property</a>.
Clients that want to re-use a client window (e.g., by mapping it again or
reparenting it elsewhere) after withdrawing it must wait for the
withdrawal to be complete before proceeding. The preferred method for
doing this is for clients to wait for the window manager to update or
remove the WM_STATE property.
<a id="id2595860" href="#ftn.id2595860" class="footnote"><sup>[8]</sup></a>
</p><p>
If the transition is from the Normal to the Iconic state,
the client should send a
<code class="function">ClientMessage</code>
event to the root with:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Window == the window to be iconified
</p></li><li class="listitem"><p>
Type
<a id="id2595905" href="#ftn.id2595905" class="footnote"><sup>[9]</sup></a>
== the atom WM_CHANGE_STATE
</p></li><li class="listitem"><p>
Format == 32
</p></li><li class="listitem"><p>
Data[0] == IconicState
</p></li></ul></div><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Rationale</strong></p></div><p>
The format of this
<code class="function">ClientMessage</code>
event does not match the format of
<code class="function">ClientMessages</code>
in
<a class="xref" href="#ClientMessage_Events" title="ClientMessage Events">ClientMessage Events</a>.
This is because they are sent by the window manager to clients,
and this message is sent by clients to the window manager.
</p></blockquote></div><p>
Other values of data[0] are reserved for future extensions to these
conventions. The parameters of the
<code class="function">SendEvent</code>
request should be those described for the synthetic
<code class="function">UnmapNotify</code>
event.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Advice to Implementors</strong></p></div><p>
Clients can also select for
<code class="function">VisibilityChange</code>
events on their top-level or icon windows.
They will then receive a
<code class="function">VisibilityNotify</code>
(state==FullyObscured)
event when the window concerned becomes completely
obscured even though mapped (and thus, perhaps a waste
of time to update) and a
<code class="function">VisibilityNotify</code>
(state!=FullyObscured)
event when it becomes even partly viewable.
</p></blockquote></div><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Advice to Implementors</strong></p></div><p>
When a window makes a transition from the Normal state to either the Iconic
or the Withdrawn state, clients should be aware that the window manager
may make transients for this window inaccessible. Clients should not rely
on transient windows being available to the user when the transient owner
window is not in the Normal state. When withdrawing a window, clients are
advised to withdraw transients for the window.
</p></blockquote></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Configuring_the_Window"></a>Configuring the Window</h3></div></div></div><p>
Clients can resize and reposition their top-level windows by using the
<code class="function">ConfigureWindow</code>
request.
The attributes of the window that can be altered
with this request are as follows:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
The [x,y] location of the window's upper left-outer corner
</p></li><li class="listitem"><p>
The [width,height] of the inner region of the window (excluding
borders)
</p></li><li class="listitem"><p>
The border width of the window
</p></li><li class="listitem"><p>
The window's position in the stack
</p></li></ul></div><p>
The coordinate system in which the location is expressed is that of the root
(irrespective of any reparenting that may have occurred).
The border width to be used and win_gravity position hint
to be used are those most recently requested by the client.
Client configure requests are interpreted by the window manager
in the same manner as the initial window geometry mapped from
the Withdrawn state, as described in
<a class="xref" href="#WM_NORMAL_HINTS_Property" title="WM_NORMAL_HINTS Property">WM_NORMAL_HINTS Property</a>
Clients must be aware that there is no guarantee that the window manager
will allocate them the requested size or location and must be prepared to
deal with any size and location.
If the window manager decides to respond to a
<code class="function">ConfigureRequest</code>
request by:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Not changing the size, location, border width, or stacking order
of the window at all.
</p><p>
A client will receive a synthetic
<code class="function">ConfigureNotify</code>
event that describes the (unchanged) geometry of the window.
The (x,y) coordinates will be in the root coordinate system,
adjusted for the border width the client requested,
irrespective of any reparenting that has taken place.
The border_width will be the border width the client requested.
The client will not receive a real
<code class="function">ConfigureNotify</code>
event because no change has actually taken place.
</p></li><li class="listitem"><p>
Moving or restacking the window without resizing it or
changing its border width.
</p><p>
A client will receive a synthetic
<code class="function">ConfigureNotify</code>
event following the change that describes the new geometry of the window.
The event's (x,y) coordinates will be in the root coordinate system adjusted
for the border width the client requested.
The border_width will be the border width the client requested.
The client may not receive a real
<code class="function">ConfigureNotify</code>
event that describes this change because the window manager may have reparented
the top-level window.
If the client does receive a real event,
the synthetic event will follow the real one.
</p></li><li class="listitem"><p>
Resizing the window or changing its border width (regardless of whether the
window was also moved or restacked).
</p><p>
A client that has selected for
<code class="function">StructureNotify</code>
events will receive a real
<code class="function">ConfigureNotify</code>
event.
Note that the coordinates in this event are relative to the parent,
which may not be the root if the window has been reparented.
The coordinates will reflect the actual border width of the window
(which the window manager may have changed).
The
<code class="function">TranslateCoordinates</code>
request can be used to convert the coordinates if required.
</p></li></ul></div><p>
The general rule is that coordinates in real
<code class="function">ConfigureNotify</code>
events are in the parent's space;
in synthetic events, they are in the root space.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Advice to Implementors</strong></p></div><p>
Clients cannot distinguish between the case where a top-level window is
resized and moved from the case where the window is resized but not moved,
since a real
<code class="function">ConfigureNotify</code>
event will be received in both cases. Clients that are concerned with
keeping track of the absolute position of a top-level window should keep a
piece of state indicating whether they are certain of its position. Upon
receipt of a real
<code class="function">ConfigureNotify</code>
event on the top-level window, the client should note that the position is
unknown. Upon receipt of a synthetic
<code class="function">ConfigureNotify</code>
event, the client should note the position as known, using the position in
this event. If the client receives a
<code class="function">KeyPress</code>,
<code class="function">KeyRelease</code>,
<code class="function">ButtonPress</code>,
<code class="function">ButtonRelease</code>,
<code class="function">MotionNotify</code>,
<code class="function">EnterNotify</code>
or
<code class="function">LeaveNotify</code>
event on the window (or on any descendant), the client can deduce the
top-level window's position from the difference between the (event-x,
event-y) and (root-x, root-y) coordinates in these events. Only when the
position is unknown does the client need to use the
<code class="function">TranslateCoordinates</code>
request to find the position of a top-level window.
</p></blockquote></div><p>
Clients should be aware that their borders may not be visible.
Window managers are free to use reparenting techniques to
decorate client's top-level windows with borders containing
titles, controls, and other details to maintain a consistent look-and-feel.
If they do,
they are likely to override the client's attempts to set the border width
and set it to zero.
Clients, therefore, should not depend on the top-level window's border
being visible or use it to display any critical information.
Other window managers will allow the top-level windows border to
be visible.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Convention</strong></p></div><p>
Clients should set the desired value of the border-width attribute on all
<code class="function">ConfigureWindow</code>
requests to avoid a race condition.
</p></blockquote></div><p>
Clients that change their position in the stack must be aware
that they may have been reparented,
which means that windows that used to be siblings no longer are.
Using a nonsibling as the sibling parameter on a
<code class="function">ConfigureWindow</code>
request will cause an error.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Convention</strong></p></div><p>
Clients that use a
<code class="function">ConfigureWindow</code>
request to request a change in their position in the stack
should do so using
<code class="function">None</code>
in the sibling field.
</p></blockquote></div><p>
Clients that must position themselves in the stack relative to some
window that was originally a sibling must do the
<code class="function">ConfigureWindow</code>
request (in case they are running under a nonreparenting window manager),
be prepared to deal with a resulting error,
and then follow with a synthetic
<code class="function">ConfigureRequest</code>
event by invoking a
<code class="function">SendEvent</code>
request with the following arguments:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Argument</th><th align="left">Value</th></tr></thead><tbody><tr><td align="left">destination</td><td align="left">The root</td></tr><tr><td align="left">propogate</td><td align="left"><span class="bold"><strong>False</strong></span></td></tr><tr><td align="left">event-mask</td><td align="left">(<span class="bold"><strong>SubstructureRedirect|SubstructureNotify</strong></span>)</td></tr><tr><td align="left">event: an <code class="function">ConfigureRequest</code> with:</td><td class="auto-generated"> </td></tr><tr><td align="left">     event:</td><td align="left">The root</td></tr><tr><td align="left">     window:</td><td align="left">The window itself</td></tr><tr><td align="left">     ...</td><td align="left">Other parameters from the <span class="bold"><strong>ConfigureWindow</strong></span> request</td></tr></tbody></table></div><p>
Window managers are in any case free to position windows in the stack as
they see fit, and so clients should not rely on receiving the stacking
order they have requested. Clients should ignore the above-sibling
field of both real and synthetic
<code class="function">ConfigureNotify</code>
events received on their top-level windows because this field may not
contain useful information.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Changing_Window_Attributes"></a>Changing Window Attributes</h3></div></div></div><p>
The attributes that may be supplied when a window is created may be
changed by using the
<code class="function">ChangeWindowAttributes</code>
request.
The window attributes are listed in the following table:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Attribute</th><th align="left">Private to Client</th></tr></thead><tbody><tr><td align="left">Background pixmap</td><td align="left">Yes</td></tr><tr><td align="left">Background pixel</td><td align="left">Yes</td></tr><tr><td align="left">Border pixmap</td><td align="left">Yes</td></tr><tr><td align="left">Border pixel</td><td align="left">Yes</td></tr><tr><td align="left">Bit gravity</td><td align="left">Yes</td></tr><tr><td align="left">Window gravity</td><td align="left">No</td></tr><tr><td align="left">Backing-store hint</td><td align="left">Yes</td></tr><tr><td align="left">Save-under hint</td><td align="left">No</td></tr><tr><td align="left">Event Mask</td><td align="left">No</td></tr><tr><td align="left">Do-not-propagate mask</td><td align="left">Yes</td></tr><tr><td align="left">Override-redirect flag</td><td align="left">No</td></tr><tr><td align="left">Colormap</td><td align="left">Yes</td></tr><tr><td align="left">Cursor</td><td align="left">Yes</td></tr></tbody></table></div><p>
Most attributes are private to the client and will never be interfered with
by the window manager.
For the attributes that are not private to the client:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
The window manager is free to override the window gravity;
a reparenting window manager may want to set the top-level window's
window gravity for its own purposes.
</p></li><li class="listitem"><p>
Clients are free to set the save-under hint on their top-level windows,
but they must be aware that the hint may be overridden by the window manager.
</p></li><li class="listitem"><p>
Windows, in effect, have per-client event masks,
and so, clients may select for whatever events are convenient irrespective
of any events the window manager is selecting for.
There are some events for which only one client at a time may select,
but the window manager should not select for them on any of the client's
windows.
</p></li><li class="listitem"><p>
Clients can set override-redirect on top-level windows but are
encouraged not to do so except as described in
<a class="xref" href="#Pop_up_Windows" title="Pop-up Windows">Pop-up Windows</a>.
and
<a class="xref" href="#Redirecting_Requests" title="Redirecting Requests">Redirecting Requests</a>.
</p></li></ul></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Input_Focus"></a>Input Focus</h3></div></div></div><p>
There are four models of input handling:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
No Input - The client never expects keyboard input.
An example would be
<code class="function">xload</code>
or another output-only client.
</p></li><li class="listitem"><p>
Passive Input - The client expects keyboard input but never explicitly sets
the input focus.
An example would be a simple client with no subwindows,
which will accept input in
<code class="function">PointerRoot</code>
mode or when the window manager sets the input focus to its top-level window
(in click-to-type mode).
</p></li><li class="listitem"><p>
Locally Active Input - The client expects keyboard input and explicitly sets
the input focus,
but it only does so when one of its windows already has the focus.
An example would be a client with subwindows defining various data
entry fields that uses Next and Prev keys to move the input focus
between the fields.
It does so when its top-level window has acquired the focus in
<code class="function">PointerRoot</code>
mode or when the window manager sets the input focus to its top-level window
(in click-to-type mode).
</p></li><li class="listitem"><p>
Globally Active Input - The client expects keyboard input and explicitly sets
the input focus,
even when it is in windows the client does not own.
An example would be a client with a scroll bar that wants to allow
users to scroll the window without disturbing the input focus even if
it is in some other window.
It wants to acquire the input focus when the user clicks in the scrolled
region but not when the user clicks in the scroll bar itself.
Thus, it wants to prevent the window manager from setting the input focus
to any of its windows.
</p></li></ul></div><p>
The four input models and the corresponding values of the input field
and the presence or absence of the WM_TAKE_FOCUS atom in the
WM_PROTOCOLS property are listed in the following table:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Input Model</th><th align="left">Input Field</th><th align="left">WM_TAKE_FOCUS</th></tr></thead><tbody><tr><td align="left">No Input</td><td align="left"><span class="bold"><strong>False</strong></span></td><td align="left">Absent</td></tr><tr><td align="left">Passive</td><td align="left"><span class="bold"><strong>True</strong></span></td><td align="left">Absent</td></tr><tr><td align="left">Locally Active</td><td align="left"><span class="bold"><strong>True</strong></span></td><td align="left">Present</td></tr><tr><td align="left">Globally Active</td><td align="left"><span class="bold"><strong>False</strong></span></td><td align="left">Present</td></tr></tbody></table></div><p>
Passive and Locally Active clients set the input field of WM_HINTS to
<code class="function">True</code>,
which indicates that they require window manager assistance in acquiring the
input focus.
No Input and Globally Active clients set the input field to
<code class="function">False</code>,
which requests that the window manager not set the input focus
to their top-level window.
</p><p>
Clients that use a
<code class="function">SetInputFocus</code>
request must set the time field to the timestamp of the event
that caused them to make the attempt.
This cannot be a
<code class="function">FocusIn</code>
event because they do not have timestamps.
Clients may also acquire
the focus without a corresponding
<code class="function">EnterNotify</code>.
Note that clients must not use
<code class="function">CurrentTime</code>
in the time field.
</p><p>
Clients using the Globally Active model can only use a
<code class="function">SetInputFocus</code>
request to acquire the input focus when they do not already have it on
receipt of one of the following events:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
<code class="function">ButtonPress</code>
</p></li><li class="listitem"><p>
<code class="function">ButtonRelease</code>
</p></li><li class="listitem"><p>
Passive-grabbed
<code class="function">KeyPress</code>
</p></li><li class="listitem"><p>
Passive-grabbed
<code class="function">KeyRelease</code>
</p></li></ul></div><p>
In general,
clients should avoid using passive-grabbed key events for this purpose,
except when they are unavoidable (as, for example, a selection tool
that establishes a passive grab on the keys that cut, copy, or paste).
</p><p>
The method by which the user commands the window manager to
set the focus to a window is up to the window manager.
For example,
clients cannot determine whether they will see the click
that transfers the focus.
</p><p>
Windows with the atom WM_TAKE_FOCUS in their WM_PROTOCOLS property
may receive a
<code class="function">ClientMessage</code>
event from the window manager (as described in
<a class="xref" href="#ClientMessage_Events" title="ClientMessage Events">ClientMessage Events</a>.
)
with WM_TAKE_FOCUS in its data[0] field and a valid timestamp
(i.e., not
<code class="function">CurrentTime</code>)
in its data[1] field.
If they want the focus,
they should respond with a
<code class="function">SetInputFocus</code>
request with its window field set to the window of theirs
that last had the input focus or to their default input window,
and the time field set to the timestamp in the message.
For further information,
see
<a class="xref" href="#Input_Focus" title="Input Focus">Input Focus</a>
</p><p>
A client could receive WM_TAKE_FOCUS when opening from an icon
or when the user has clicked outside the top-level window in an area that
indicates to the window manager that it should assign the focus
(for example, clicking in the headline bar can be used to assign the focus).
</p><p>
The goal is to support window managers that want to assign the input focus
to a top-level window in such a way that the top-level window either
can assign it to one of its subwindows or can decline the offer of the focus.
For example, a clock or a text editor with no currently open frames
might not want to take focus even though the window manager generally
believes that clients should take the input focus after being deiconified
or raised.
</p><p>
Clients that set the input focus need to decide a value for the
revert-to field of the
<code class="function">SetInputFocus</code>
request.
This determines the behavior of the input focus
if the window the focus has been set to becomes not viewable.
The value can be any of the following:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
<code class="function">Parent</code>
- In general,
clients should use this value when assigning focus to one of their subwindows.
Unmapping the subwindow will cause focus to revert to the parent,
which is probably what you want.
</p></li><li class="listitem"><p>
<code class="function">PointerRoot</code>
- Using
this value with a click-to-type focus management policy
leads to race conditions because the window becoming unviewable may
coincide with the window manager deciding to move the focus elsewhere.
</p></li><li class="listitem"><p>
<code class="function">None</code>
- Using
this value causes problems if the window manager reparents
the window, as most window managers will, and then crashes.
The input focus will be
<code class="function">None</code>,
and there will probably be no way to change it.
</p></li></ul></div><p>
Note that neither
<code class="function">PointerRoot</code>
nor
<code class="function">None</code>
is really safe to use.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Convention</strong></p></div><p>
Clients that invoke a
<code class="function">SetInputFocus</code>
request should set the revert-to argument to
<code class="function">Parent</code>.
</p></blockquote></div><p>
A convention is also required for clients that want to give up the
input focus.
There is no safe value set for them to set the input focus to;
therefore, they should ignore input material.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Convention</strong></p></div><p>
Clients should not give up the input focus of their own volition.
They should ignore input that they receive instead.
</p></blockquote></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Colormaps"></a>Colormaps</h3></div></div></div><p>
The window manager is responsible for installing and uninstalling
colormaps on behalf of clients with top-level windows that
the window manager manages.
</p><p>
Clients provide the window manager with hints as to which colormaps to
install and uninstall. Clients must not install or uninstall colormaps
themselves (except under the circumstances noted below). When a client's
top-level window gets the colormap focus (as a result of whatever colormap
focus policy is implemented by the window manager), the window manager will
ensure that one or more of the client's colormaps are installed.
</p><p>
Clients whose top-level windows and subwindows all use the same colormap
should set its ID in the colormap field of the top-level window's
attributes. They should not set a WM_COLORMAP_WINDOWS property on the
top-level window. If they want to change the colormap, they should change
the top-level window's colormap attribute. The window manager will track
changes to the window's colormap attribute and install colormaps as
appropriate.
</p><p>
Clients that create windows can use the value
<code class="function">CopyFromParent</code>
to inherit their parent's colormap. Window managers will ensure that the
root window's colormap field contains a colormap that is suitable for
clients to inherit. In particular, the colormap will provide
distinguishable colors for
<code class="function">BlackPixel</code>
and
<code class="function">WhitePixel</code>.
</p><p>
Top-level windows that have subwindows or override-redirect pop-up windows
whose colormap requirements differ from the top-level window should have a
WM_COLORMAP_WINDOWS property. This property contains a list of IDs for
windows whose colormaps the window manager should attempt to have installed
when, in the course of its individual colormap focus policy, it assigns the
colormap focus to the top-level window (see
<a class="xref" href="#WM_COLORMAP_WINDOWS_Property" title="WM_COLORMAP_WINDOWS Property">WM_COLORMAP_WINDOWS Property</a>
). The list is
ordered by the importance to the client of having the colormaps installed.
The window manager will track changes to this property and will track
changes to the colormap attribute of the windows in the property.
</p><p>
If the relative importance of colormaps changes, the client should update
the WM_COLORMAP_WINDOWS property to reflect the new ordering. If the
top-level window does not appear in the list, the window manager will assume
it to be of higher priority than any window in the list.
</p><p>
WM_TRANSIENT_FOR windows can either have their own WM_COLORMAP_WINDOWS
property or appear in the property of the window they are transient for,
as appropriate.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Rationale</strong></p></div><p>
An alternative design was considered for how clients should hint to the
window manager about their colormap requirements. This alternative design
specified a list of colormaps instead of a list of windows. The current
design, a list of windows, was chosen for two reasons. First, it allows
window managers to find the visuals of the colormaps, thus permitting
visual-dependent colormap installation policies. Second, it allows window
managers to select for
<code class="function">VisibilityChange</code>
events on the windows concerned and to ensure that colormaps are only
installed if the windows that need them are visible. The alternative design
allows for neither of these policies.
</p></blockquote></div><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Advice to Implementors</strong></p></div><p>
Clients should be aware of the min-installed-maps and max-installed-maps
fields of the connection setup information, and the effect that the minimum
value has on the "required list" defined by the Protocol in the
description of the
<code class="function">InstallColormap</code>
request. Briefly, the min-installed-maps most recently installed maps are
guaranteed to be installed. This value is often one; clients needing
multiple colormaps should beware.
</p></blockquote></div><p>
Whenever possible, clients should use the mechanisms described above and let
the window manager handle colormap installation. However, clients are
permitted to perform colormap installation on their own while they have the
pointer grabbed. A client performing colormap installation must notify the
window manager prior to the first installation. When the client has
finished its colormap installation, it must also notify the window manager.
The client notifies the window manager by issuing a
<code class="function">SendEvent</code>
request with the following arguments:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Argument</th><th align="left">Value</th></tr></thead><tbody><tr><td align="left">destination</td><td align="left">
The root window of the screen on which the colormap is installed
</td></tr><tr><td align="left">propogate</td><td align="left"><span class="bold"><strong>False</strong></span></td></tr><tr><td align="left">event-mask</td><td align="left"><span class="bold"><strong>ColormapChange</strong></span></td></tr><tr><td align="left">event: an <code class="function">ClientMessage</code> with:</td><td align="left"> </td></tr><tr><td align="left">     window:</td><td align="left">The root window, as above</td></tr><tr><td align="left">     type:</td><td align="left">WM_COLORMAP_NOTIFY</td></tr><tr><td align="left">     format</td><td align="left">32</td></tr><tr><td align="left">     data[0]</td><td align="left">
the timestampe of the event that caused the client to start or stop
installing colormaps
</td></tr><tr><td align="left">     data[1]</td><td align="left">
1 if the client is starting colormap installation,
0 if the client is finished with colormap installation
</td></tr><tr><td align="left">     data[2]</td><td align="left">
reserved, must be zero
</td></tr><tr><td align="left">     data[3]</td><td align="left">
reserved, must be zero
</td></tr><tr><td align="left">     data[4]</td><td align="left">
reserved, must be zero
</td></tr></tbody></table></div><p>
This feature was introduced in version 2.0 of this document, and there will
be a significant period of time before all window managers can be expected
to implement this feature. Before using this feature, clients must check
the compliance level of the window manager (using the mechanism described in
<a class="xref" href="#Communication_with_the_Window_Manager_by_Means_of_Selections" title="Communication with the Window Manager by Means of Selections">Communication with the Window Manager by Means of Selections</a>
) to verify that it supports this feature. This is necessary to
prevent colormap installation conflicts between clients and older window
managers.
</p><p>
Window managers should refrain from installing colormaps while a client has
requested control of colormap installation. The window manager should
continue to track the set of installed colormaps so that it can reinstate
its colormap focus policy when the client has finished colormap installation.
</p><p>
This technique has race conditions that may result in the colormaps
continuing to be installed even after a client has issued its notification
message. For example, the window manager may have issued some
<code class="function">InstallColormap</code>
requests that are not executed until after the
client's
<code class="function">SendEvent</code>
and
<code class="function">InstallColormap</code>
requests, thus uninstalling the client's colormaps. If this occurs while
the client still has the pointer grabbed and before the client has issued
the "finished" message, the client may reinstall the desired colormaps.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Advice to Implementors</strong></p></div><p>
Clients are expected to use this mechanism for things such as
pop-up windows and for animations that use override-redirect windows.
</p><p>
If a client fails to issue the "finished" message, the window manager
may be left in a state where its colormap installation policy is suspended.
Window manager implementors may want to implement a feature that resets
colormap installation policy in response to a command from the user.
</p></blockquote></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Icons"></a>Icons</h3></div></div></div><p>
A client can hint to the window manager about the desired appearance
of its icon by setting:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
A string in WM_ICON_NAME.
</p></li><li class="listitem"><p>
All clients should do this
because it provides a fallback for window managers whose ideas
about icons differ widely from those of the client.
</p><p>
A
<code class="function">Pixmap</code>
into the icon_pixmap field of the WM_HINTS property
and possibly another into the icon_mask field.
</p></li><li class="listitem"><p>
The window manager is expected to display the pixmap masked by the mask.
The pixmap should be one of the sizes found in the WM_ICON_SIZE property
on the root.
If this property is not found,
the window manager is unlikely to display icon pixmaps.
Window managers usually will clip or tile pixmaps that do not match
WM_ICON_SIZE.
</p></li><li class="listitem"><p>
A window into the icon_window field of the WM_HINTS property.
</p><p>
The window manager is expected to map that window whenever the client is
in the Iconic state.
In general,
the size of the icon window should be one of those specified in WM_ICON_SIZE
on the root, if it exists.
Window managers are free to resize icon windows.
</p></li></ul></div><p>
In the Iconic state,
the window manager usually will ensure that:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
If the window's WM_HINTS.icon_window is set,
the window it names is visible.
</p></li><li class="listitem"><p>
If the window's WM_HINTS.icon_window is not set
but the window's WM_HINTS.icon_pixmap is set,
the pixmap it names is visible.
</p></li><li class="listitem"><p>
Otherwise,
the window's WM_ICON_NAME string is visible.
</p></li></ul></div><p>
Clients should observe the following conventions about their icon windows:
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Conventions</strong></p></div><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
The icon window should be an
<code class="function">InputOutput</code>
child of the root.
</p></li><li class="listitem"><p>
The icon window should be one of the sizes specified
in the WM_ICON_SIZE property on the root.
</p></li><li class="listitem"><p>
The icon window should use the root visual and default colormap
for the screen in question.
</p></li><li class="listitem"><p>
Clients should not map their icon windows.
</p></li><li class="listitem"><p>
Clients should not unmap their icon windows.
</p></li><li class="listitem"><p>
Clients should not configure their icon windows.
</p></li><li class="listitem"><p>
Clients should not set override-redirect on their icon windows
or select for
<code class="function">ResizeRedirect</code>
events on them.
</p></li><li class="listitem"><p>
Clients must not depend on being able to receive input events
by means of their icon windows.
</p></li><li class="listitem"><p>
Clients must not manipulate the borders of their icon windows.
</p></li><li class="listitem"><p>
Clients must select for
<code class="function">Exposure</code>
events on their icon window and repaint it when requested.
</p></li></ul></div></blockquote></div><p>
Window managers will differ as to whether they support input events
to client's icon windows;
most will allow the client to receive some subset of the keys and buttons.
</p><p>
Window managers will ignore any WM_NAME, WM_ICON_NAME, WM_NORMAL_HINTS,
WM_HINTS, WM_CLASS, WM_TRANSIENT_FOR, WM_PROTOCOLS, WM_COLORMAP_WINDOWS,
WM_COMMAND, or WM_CLIENT_MACHINE
properties they find on icon windows.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Pop_up_Windows"></a>Pop-up Windows</h3></div></div></div><p>
Clients that wish to pop up a window can do one of three things:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
They can create and map another normal top-level window,
which will get decorated and managed as normal by the window manager.
See the discussion of window groups that follows.
</p></li><li class="listitem"><p>
If the window will be visible for a relatively short time
and deserves a somewhat lighter treatment,
they can set the WM_TRANSIENT_FOR property.
They can expect less decoration but can set all the normal
window manager properties on the window.
An example would be a dialog box.
</p></li><li class="listitem"><p>
If the window will be visible for a very short time
and should not be decorated at all,
the client can set override-redirect on the window.
In general,
this should be done only if the pointer is grabbed while the window is mapped.
The window manager will never interfere with these windows,
which should be used with caution.
An example of an appropriate use is a pop-up menu.
</p></li></ul></div><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Advice to Implementors</strong></p></div><p>
The user will not be able to move, resize, restack, or transfer the input
focus to override-redirect windows, since the window manager is not managing
them. If it is necessary for a client to receive keystrokes on an
override-redirect window, either the client must grab the keyboard or the
client must have another top-level window that is not override-redirect and
that has selected the Locally Active or Globally Active focus model. The
client may set the focus to the override-redirect window when the other
window receives a WM_TAKE_FOCUS message or one of the events listed in
<a class="xref" href="#Input_Focus" title="Input Focus">Input Focus</a>
in the description of the Globally Active focus model.
</p></blockquote></div><p>
Window managers are free to decide if WM_TRANSIENT_FOR windows
should be iconified when the window they are transient for is.
Clients displaying WM_TRANSIENT_FOR windows that have
(or request to have) the window they are transient for iconified
do not need to request that the same operation be performed
on the WM_TRANSIENT_FOR window;
the window manager will change its state if that is the policy it wishes
to enforce.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Window_Groups"></a>Window Groups</h3></div></div></div><p>
A set of top-level windows that should be treated from the user's point of view
as related (even though they may belong to a number of clients) should be linked
together using the window_group field of the WM_HINTS structure.
</p><p>
One of the windows (that is, the one the others point to)
will be the group leader and will carry the group as opposed
to the individual properties.
Window managers may treat the group leader differently
from other windows in the group.
For example,
group leaders may have the full set of decorations,
and other group members may have a restricted set.
</p><p>
It is not necessary that the client ever map the group leader;
it may be a window that exists solely as a placeholder.
</p><p>
It is up to the window manager to determine the policy
for treating the windows in a group.
At present,
there is no way for a client to request a group,
as opposed to an individual, operation.
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Client_Responses_to_Window_Manager_Actions"></a>Client Responses to Window Manager Actions</h2></div></div></div><p>
The window manager performs a number of operations on client resources,
primarily on their top-level windows.
Clients must not try to fight this but may elect to receive notification
of the window manager's operations.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Reparenting"></a>Reparenting</h3></div></div></div><p>
Clients must be aware that some window managers will reparent
their top-level windows
so that a window that was created as a child of the root will be displayed
as a child of some window belonging to the window manager.
The effects that this reparenting will have on the client are as follows:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
The parent value returned by a
<code class="function">QueryTree</code>
request will no longer be the value supplied to the
<code class="function">CreateWindow</code>
request that created the reparented window.
There should be no need for the client to be aware of the identity
of the window to which the top-level window has been reparented.
In particular,
a client that wishes to create further top-level windows should continue
to use the root as the parent for these new windows.
</p></li><li class="listitem"><p>
The server will interpret the (x,y) coordinates in a
<code class="function">ConfigureWindow</code>
request in the new parent's coordinate space.
In fact, they usually will not be interpreted by the server
because a reparenting window manager usually will have intercepted
these operations (see
<a class="xref" href="#Redirection_of_Operations" title="Redirection of Operations">Redirection of Operations</a>
).
Clients should use the root coordinate space for these requests
(see
<a class="xref" href="#Configuring_the_Window" title="Configuring the Window">Configuring the Window</a>
).
</p></li><li class="listitem"><p>
<code class="function">ConfigureWindow</code>
requests that name a specific sibling window may fail because the window named,
which used to be a sibling, no longer is after the reparenting operation
(see
<a class="xref" href="#Configuring_the_Window" title="Configuring the Window">Configuring the Window</a>
).
</p></li><li class="listitem"><p>
The (x,y) coordinates returned by a
<code class="function">GetGeometry</code>
request are in the parent's coordinate space
and are thus not directly useful after a reparent operation.
</p></li><li class="listitem"><p>
A background of
<code class="function">ParentRelative</code>
will have unpredictable results.
</p></li><li class="listitem"><p>
A cursor of
<code class="function">None</code>
will have unpredictable results.
</p></li></ul></div><p>
Clients that want to be notified when they are reparented can select for
<code class="function">StructureNotify</code>
events on their top-level window.
They will receive a
<code class="function">ReparentNotify</code>
event if and when reparenting takes place.
When a client withdraws a top-level window, the window manager will
reparent it back to the root window if the window had been reparented
elsewhere.
</p><p>
If the window manager reparents a client's window,
the reparented window will be placed in the save-set
of the parent window.
This means that the reparented window will not be destroyed
if the window manager terminates and will be remapped if it was unmapped.
Note that this applies to all client windows the window manager reparents,
including transient windows and client icon windows.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Redirection_of_Operations"></a>Redirection of Operations</h3></div></div></div><p>
Clients must be aware that some window managers will arrange
for some client requests to be intercepted and redirected.
Redirected requests are not executed;
they result instead in events being sent to the window manager,
which may decide to do nothing, to alter the arguments,
or to perform the request on behalf of the client.
</p><p>
The possibility that a request may be redirected means
that a client cannot assume that any redirectable request is actually
performed when the request is issued or is actually performed at all.
The requests that may be redirected are
<code class="function">MapWindow</code>,
<code class="function">ConfigureWindow</code>,
and
<code class="function">CirculateWindow</code>.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Advice to Implementors</strong></p></div><p>
The following is incorrect because the
<code class="function">MapWindow</code>
request may be intercepted and the
<code class="function">PolyLine</code>
output made to an unmapped window:
</p><pre class="literallayout">
MapWindow A
PolyLine A GC &lt;point&gt; &lt;point&gt; ...
</pre><p>
The client must wait for an
<code class="function">Expose</code>
event before drawing in the window.
<a id="id2598803" href="#ftn.id2598803" class="footnote"><sup>[10]</sup></a>
</p><p>
This next example incorrectly assumes that the
<code class="function">ConfigureWindow</code>
request is actually executed with the arguments supplied:
</p><pre class="literallayout">
ConfigureWindow width=N height=M
&lt;output assuming window is N by M&gt;
</pre><p>
The client should select for
<code class="function">StructureNotify</code>
on its window and monitor the window's size by tracking
<code class="function">ConfigureNotify</code>
events.
</p><p>
Clients must be especially careful when attempting to set the focus to a
window that they have just mapped. This sequence may result in an X
protocol error:
</p><pre class="literallayout">
MapWindow B
SetInputFocus B
</pre><p>
If the
<code class="function">MapWindow</code>
request has been intercepted, the window will still be
unmapped, causing the
<code class="function">SetInputFocus</code>
request to generate the error. The solution to this problem is for clients
to select for
<code class="function">VisibilityChange</code>
on the window and to delay the issuance of the
<code class="function">SetInputFocus</code>
request until they have received a
<code class="function">VisibilityNotify</code>
event indicating that the window is visible.
</p><p>
This technique does not guarantee correct operation. The user may have
iconified the window by the time the
<code class="function">SetInputFocus</code>
request reaches the server, still causing an error. Or the window manager
may decide to map the window into Iconic state, in which case the window
will not be visible. This will delay the generation of the
<code class="function">VisibilityNotify</code>
event indefinitely. Clients must be prepared to handle these cases.
</p></blockquote></div><p>
A window with the override-redirect bit set is immune from redirection,
but the bit should be set on top-level windows only in cases
where other windows should be prevented from processing input
while the override-redirect window is mapped (see
<a class="xref" href="#Pop_up_Windows" title="Pop-up Windows">Pop-up Windows</a>
)
and while responding to
<code class="function">ResizeRequest</code>
events (see
<a class="xref" href="#Redirecting_Requests" title="Redirecting Requests">Redirecting Requests</a>
).
</p><p>
Clients that have no non-Withdrawn top-level windows
and that map an override-redirect top-level window are taking over total
responsibility for the state of the system.
It is their responsibility to:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Prevent any preexisting window manager from interfering with their activities
</p></li><li class="listitem"><p>
Restore the status quo exactly after they unmap the window
so that any preexisting window manager does not get confused
</p></li></ul></div><p>
In effect, clients of this kind are acting as temporary window managers.
Doing so is strongly discouraged because these clients will be unaware
of the user interface policies the window manager is trying to maintain
and because their user interface behavior is likely to conflict with that of
less demanding clients.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Window_Move"></a>Window Move</h3></div></div></div><p>
If the window manager moves a top-level window without changing its size,
the client will receive a synthetic
<code class="function">ConfigureNotify</code>
event following the move that describes the new location
in terms of the root coordinate space.
Clients must not respond to being moved by attempting to move
themselves to a better location.
</p><p>
Any real
<code class="function">ConfigureNotify</code>
event on a top-level window implies that the window's position
on the root may have changed,
even though the event reports that the window's position
in its parent is unchanged because the window may have been reparented.
Note that the coordinates in the event will not, in this case,
be directly useful.
</p><p>
The window manager will send these events by using a
<code class="function">SendEvent</code>
request with the following arguments:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Argument</th><th align="left">Value</th></tr></thead><tbody><tr><td align="left">destination</td><td align="left">The client's window</td></tr><tr><td align="left">propagate</td><td align="left"><span class="bold"><strong>False</strong></span></td></tr><tr><td align="left">event-mask</td><td align="left"><span class="bold"><strong>StructureNotify</strong></span></td></tr></tbody></table></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Window_Resize"></a>Window Resize</h3></div></div></div><p>
The client can elect to receive notification of being resized by selecting for
<code class="function">StructureNotify</code>
events on its top-level windows.
It will receive a
<code class="function">ConfigureNotify</code>
event.
The size information in the event will be correct,
but the location will be in the parent window (which may not be the root).
</p><p>
The response of the client to being resized should be to accept
the size it has been given and to do its best with it.
Clients must not respond to being resized by attempting to resize
themselves to a better size.
If the size is impossible to work with,
clients are free to request to change to the Iconic state.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Iconify_and_Deiconify"></a>Iconify and Deiconify</h3></div></div></div><p>
A top-level window that is not Withdrawn will be
in the Normal state if it is mapped and in the Iconic state if it is unmapped.
This will be true even if the window has been reparented;
the window manager will unmap the window as well as its parent
when switching to the Iconic state.
</p><p>
The client can elect to be notified of these state changes by selecting for
<code class="function">StructureNotify</code>
events on the top-level window.
It will receive a
<code class="function">UnmapNotify</code>
event when it goes Iconic and a
<code class="function">MapNotify</code>
event when it goes Normal.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Colormap_Change"></a>Colormap Change</h3></div></div></div><p>
Clients that wish to be notified of their colormaps being installed
or uninstalled should select for
<code class="function">ColormapNotify</code>
events on their top-level windows and on any windows they have named
in WM_COLORMAP_WINDOWS properties on their top-level windows.
They will receive
<code class="function">ColormapNotify</code>
events with the new field FALSE when the colormap for that window
is installed or uninstalled.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Input_Focus_2"></a>Input Focus</h3></div></div></div><p>
Clients can request notification that they have the input focus by selecting
for
<code class="function">FocusChange</code>
events on their top-level windows;
they will receive
<code class="function">FocusIn</code>
and
<code class="function">FocusOut</code>
events.
Clients that need to set the input focus to one of their
subwindows should not do so unless
they have set WM_TAKE_FOCUS in their WM_PROTOCOLS property
and have done one of the following:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Set the input field of WM_HINTS to
<code class="function">True</code>
and actually have the input focus in one of their top-level windows
</p></li><li class="listitem"><p>
Set the input field of WM_HINTS to
<code class="function">False</code>
and have received a suitable event as described in
<a class="xref" href="#Input_Focus" title="Input Focus">Input Focus</a>.
</p></li><li class="listitem"><p>
Have received a WM_TAKE_FOCUS message as described in
<a class="xref" href="#Input_Focus" title="Input Focus">Input Focus</a>.
</p></li></ul></div><p>
Clients should not warp the pointer in an attempt to transfer the focus;
they should set the focus and leave the pointer alone.
For further information,
see
<a class="xref" href="#The_Pointer" title="The Pointer">The Pointer</a>.
</p><p>
Once a client satisfies these conditions,
it may transfer the focus to another of its windows by using the
<code class="function">SetInputFocus</code>
request, which is defined as follows:
</p><p>
<code class="function">SetInputFocus</code>
</p><div class="informaltable"><table border="0"><colgroup><col align="left" class="c1" /></colgroup><tbody><tr><td align="left">
<span class="emphasis"><em>focus</em></span>: WINDOW or
<span class="bold"><strong>PointerRoot</strong></span> or
<span class="bold"><strong>None</strong></span>
</td></tr><tr><td align="left">
<span class="emphasis"><em>revert-to</em></span>:
{ <span class="bold"><strong>Parent</strong></span>,
<span class="bold"><strong>PointerRoot</strong></span>,
<span class="bold"><strong>None</strong></span> }
</td></tr><tr><td align="left">
<span class="emphasis"><em>time</em></span>: TIMESTAMP or CurrentTime
</td></tr></tbody></table></div><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Conventions</strong></p></div><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Clients that use a
<code class="function">SetInputFocus</code>
request must set the time argument to the timestamp of the event
that caused them to make the attempt.
This cannot be a
<code class="function">FocusIn</code>
event because they do not have timestamps.
Clients may also acquire the focus without a corresponding
<code class="function">EnterNotify</code>
event.
Clients must not use
<code class="function">CurrentTime</code>
for the time argument.
</p></li><li class="listitem"><p>
Clients that use a
<code class="function">SetInputFocus</code>
request to set the focus to one of their windows must set
the revert-to field to
<code class="function">Parent</code>.
</p></li></ul></div></blockquote></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="ClientMessage_Events"></a>ClientMessage Events</h3></div></div></div><p>
There is no way for clients to prevent themselves being sent
<code class="function">ClientMessage</code>
events.
</p><p>
Top-level windows with a WM_PROTOCOLS property may be sent
<code class="function">ClientMessage</code>
events specific to the protocols named by the atoms in the property
(see
<a class="xref" href="#WM_PROTOCOLS_Property" title="WM_PROTOCOLS Property">WM_PROTOCOLS Property</a>
).
For all protocols, the
<code class="function">ClientMessage</code>
events have the following:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
WM_PROTOCOLS as the type field
</p></li><li class="listitem"><p>
Format 32
</p></li><li class="listitem"><p>
The atom that names their protocol in the data[0] field
</p></li><li class="listitem"><p>
A timestamp in their data[1] field
</p></li></ul></div><p>
The remaining fields of the event,
including the window field,
are determined by the protocol.
</p><p>
These events will be sent by using a
<code class="function">SendEvent</code>
request with the following arguments:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Argument</th><th align="left">Value</th></tr></thead><tbody><tr><td align="left">destination</td><td align="left">The client's window</td></tr><tr><td align="left">propagate</td><td align="left"><span class="bold"><strong>False</strong></span></td></tr><tr><td align="left">event-mask</td><td align="left">() empty</td></tr><tr><td align="left">event</td><td align="left">As specified by the protocol</td></tr></tbody></table></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="Window_Deletion"></a>Window Deletion</h4></div></div></div><p>
Clients, usually those with multiple top-level windows, whose server
connection must survive the deletion of some of their top-level windows,
should include the atom WM_DELETE_WINDOW in the WM_PROTOCOLS property on
each such window. They will receive a
<code class="function">ClientMessage</code>
event as described above whose data[0] field is WM_DELETE_WINDOW.
</p><p>
Clients receiving a WM_DELETE_WINDOW message should behave as if the user
selected "delete window" from a hypothetical menu.
They should perform any confirmation dialog with the user
and, if they decide to complete the deletion, should do the following:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Either change the window's state to Withdrawn (as described in
<a class="xref" href="#Changing_Window_State" title="Changing Window State">Changing Window State</a>
)
or destroy the window.
</p></li><li class="listitem"><p>
Destroy any internal state associated with the window.
</p></li></ul></div><p>
If the user aborts the deletion during the confirmation dialog,
the client should ignore the message.
</p><p>
Clients are permitted to interact with the user and ask, for example,
whether a file associated with the window to be deleted should be saved
or the window deletion should be cancelled.
Clients are not required to destroy the window itself;
the resource may be reused,
but all associated state (for example, backing store) should be released.
</p><p>
If the client aborts a destroy and the user then selects DELETE WINDOW again,
the window manager should start the WM_DELETE_WINDOW protocol again.
Window managers should not use
<code class="function">DestroyWindow</code>
requests on a window that has WM_DELETE_WINDOW in its WM_PROTOCOLS property.
</p><p>
Clients that choose not to include WM_DELETE_WINDOW in the WM_PROTOCOLS
property may be disconnected from the server
if the user asks for one of the client's top-level windows to be deleted.
</p></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Redirecting_Requests"></a>Redirecting Requests</h3></div></div></div><p>
Normal clients can use the redirection mechanism just as window managers do
by selecting for
<code class="function">SubstructureRedirect</code>
events on a parent window or
<code class="function">ResizeRedirect</code>
events on a window itself.
However, at most,
one client per window can select for these events,
and a convention is needed to avoid clashes.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Convention</strong></p></div><p>
Clients (including window managers) should select for
<code class="function">SubstructureRedirect</code>
and
<code class="function">ResizeRedirect</code>
events only on windows that they own.
</p></blockquote></div><p>
In particular,
clients that need to take some special action if they are resized can select
for
<code class="function">ResizeRedirect</code>
events on their top-level windows.
They will receive a
<code class="function">ResizeRequest</code>
event if the window manager resizes their window,
and the resize will not actually take place.
Clients are free to make what use they like of the information
that the window manager wants to change their size,
but they must configure the window to the width and height specified
in the event in a timely fashion.
To ensure that the resize will actually happen at this stage
instead of being intercepted and executed by the window manager
(and thus restarting the process),
the client needs temporarily to set override-redirect on the window.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Convention</strong></p></div><p>
Clients receiving
<code class="function">ResizeRequest</code>
events must respond by doing the following:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Setting override-redirect on the window specified in the event
</p></li><li class="listitem"><p>
Configuring the window specified in the event
to the width and height specified in the event as soon as possible
and before making any other geometry requests
</p></li><li class="listitem"><p>
Clearing override-redirect on the window specified in the event
</p></li></ul></div></blockquote></div><p>
If a window manager detects that a client is not obeying this convention,
it is free to take whatever measures it deems appropriate to deal with
the client.
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Communication_with_the_Window_Manager_by_Means_of_Selections"></a>Communication with the Window Manager by Means of Selections</h2></div></div></div><p>
For each screen they manage, window managers will acquire ownership of a
selection named WM_S<span class="emphasis"><em>n</em></span>, where
<span class="emphasis"><em>n</em></span> is the screen number, as
described in
<a class="xref" href="#Discriminated_Names" title="Discriminated Names">Discriminated Names</a>
Window managers should comply with the
conventions for "Manager Selections" described in
<a class="xref" href="#Manager_Selections" title="Manager Selections">Manager Selections</a>.
The
intent is for clients to be able to request a variety of information or
services by issuing conversion requests on this selection. Window managers
should support conversion of the following target on their manager
selection:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Atom</th><th align="left">Type</th><th align="left">Data Received</th></tr></thead><tbody><tr><td align="left">VERSION</td><td align="left">INTEGER</td><td align="left">
Two integers, which are the major and minor release numbers (respectively) of
the ICCCM with which the window manager complies. For this version of the
ICCCM, the numbers are 2 and 0.
<a id="id2600194" href="#ftn.id2600194" class="footnote"><sup>[a]</sup></a>
</td></tr></tbody><tbody class="footnotes"><tr><td colspan="3"><div class="footnote"><p><a id="ftn.id2600194" href="#id2600194" class="para"><sup>[a] </sup></a>
As a special case, clients not wishing to implement a selection
request may simply issue a
<code class="function">GetSelectionOwner</code>
request on the appropriate WM_S<span class="emphasis"><em>n</em></span> selection.
If this selection is owned,
clients may assume that the window manager complies with ICCCM version 2.0
or later.
</p></div></td></tr></tbody></table></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Summary_of_Window_Manager_Property_Types"></a>Summary of Window Manager Property Types</h2></div></div></div><p>
The window manager properties are summarized in the following table
(see also section 14.1 of
<span class="emphasis"><em>Xlib - C Language X Interface</em></span>).
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /></colgroup><thead><tr><th align="left">Name</th><th align="left">Type</th><th align="left">Format</th><th align="left">See Section</th></tr></thead><tbody><tr><td align="left">WM_CLASS</td><td align="left">STRING</td><td align="left">8</td><td align="left">
<a class="xref" href="#WM_CLASS_Property" title="WM_CLASS Property">WM_CLASS Property</a>
</td></tr><tr><td align="left">WM_CLIENT_MACHINE</td><td align="left">TEXT</td><td align="left"> </td><td align="left">
<a class="xref" href="#WM_CLIENT_MACHINE_Property" title="WM_CLIENT_MACHINE Property">WM_CLIENT_MACHINE Property</a>
</td></tr><tr><td align="left">WM_COLORMAP_WINDOWS</td><td align="left">WINDOW</td><td align="left">32</td><td align="left">
<a class="xref" href="#WM_COLORMAP_WINDOWS_Property" title="WM_COLORMAP_WINDOWS Property">WM_COLORMAP_WINDOWS Property</a>
</td></tr><tr><td align="left">WM_HINTS</td><td align="left">WM_HINTS</td><td align="left">32</td><td align="left">
<a class="xref" href="#WM_HINTS_Property" title="WM_HINTS Property">WM_HINTS Property</a>
</td></tr><tr><td align="left">WM_ICON_NAME</td><td align="left">TEXT</td><td align="left"> </td><td align="left">
<a class="xref" href="#WM_ICON_NAME_Property" title="WM_ICON_NAME Property">WM_ICON_NAME Property</a>
</td></tr><tr><td align="left">WM_ICON_SIZE</td><td align="left">WM_ICON_SIZE</td><td align="left">32</td><td align="left">
<a class="xref" href="#WM_ICON_SIZE_Property" title="WM_ICON_SIZE Property">WM_ICON_SIZE Property</a>
</td></tr><tr><td align="left">WM_NAME</td><td align="left">TEXT</td><td align="left"> </td><td align="left">
<a class="xref" href="#WM_NAME_Property" title="WM_NAME Property">WM_NAME Property</a>
</td></tr><tr><td align="left">WM_NORMAL_HINTS</td><td align="left">WM_SIZE_HINTS</td><td align="left">32</td><td align="left">
<a class="xref" href="#WM_NORMAL_HINTS_Property" title="WM_NORMAL_HINTS Property">WM_NORMAL_HINTS Property</a>
</td></tr><tr><td align="left">WM_PROTOCOLS</td><td align="left">ATOM</td><td align="left">32</td><td align="left">
<a class="xref" href="#WM_PROTOCOLS_Property" title="WM_PROTOCOLS Property">WM_PROTOCOLS Property</a>
</td></tr><tr><td align="left">WM_STATE</td><td align="left">WM_STATE</td><td align="left">32</td><td align="left">
<a class="xref" href="#WM_STATE_Property" title="WM_STATE Property">WM_STATE Property</a>
</td></tr><tr><td align="left">WM_TRANSIENT_FOR</td><td align="left">WINDOW</td><td align="left">32</td><td align="left">
<a class="xref" href="#WM_TRANSIENT_FOR_Property" title="WM_TRANSIENT_FOR Property">WM_TRANSIENT_FOR Property</a>
</td></tr></tbody></table></div></div><div class="footnotes"><br /><hr width="100" align="left" /><div class="footnote"><p><a id="ftn.id2594445" href="#id2594445" class="para"><sup>[7] </sup></a>
This obsolete protocol was described in the July 27, 1988,
draft of the ICCCM.
Windows using it can also be detected because their WM_HINTS properties are
4 bytes longer than expected.
Window managers are free to support clients using the obsolete protocol
in a backwards compatibility mode.
</p></div><div class="footnote"><p><a id="ftn.id2595860" href="#id2595860" class="para"><sup>[8] </sup></a>
Earlier versions of these conventions prohibited clients from
reading the WM_STATE property. Clients operating under the earlier
conventions used the technique of tracking
<code class="function">ReparentNotify</code>
events to wait for the top-level window to be reparented back to the root
window. This is still a valid technique; however, it works only for
reparenting window managers, and the WM_STATE technique is to be preferred.
</p></div><div class="footnote"><p><a id="ftn.id2595905" href="#id2595905" class="para"><sup>[9] </sup></a>
The type field of the
<code class="function">ClientMessage</code>
event (called the message_type field by Xlib) should not be confused with
the code field of the event itself,
which will have the value 33
<code class="function">( ClientMessage</code>).
</p></div><div class="footnote"><p><a id="ftn.id2598803" href="#id2598803" class="para"><sup>[10] </sup></a>
This is true even if the client set the backing-store attribute to
<code class="function">Always</code>.
The backing-store attribute is a only a hint,
and the server may stop maintaining backing store contents at any time.
</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="Session_Management_and_Additional_Inter_Client_Exchanges"></a>Chapter 5. Session Management and Additional Inter-Client Exchanges</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="sect1"><a href="#Client_Support_for_Session_Management">Client Support for Session Management</a></span></dt><dt><span class="sect1"><a href="#Window_Manager_Support_for_Session_Management">Window Manager Support for Session Management</a></span></dt><dt><span class="sect1"><a href="#Support_for_ICE_Client_Rendezvous">Support for ICE Client Rendezvous</a></span></dt></dl></div><p>
This section contains some conventions for clients that participate in
session management. See
<span class="emphasis"><em>X Session Management Protocol</em></span>
for further details. Clients that do not support this protocol cannot
expect their window state (e.g., WM_STATE, position, size, and stacking order)
to be preserved across sessions.
</p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Client_Support_for_Session_Management"></a>Client Support for Session Management</h2></div></div></div><p>
Each session participant will obtain a unique client identifier (client-ID)
from the session manager. The client must identify one top-level window as
the "client leader." This window must be created by the client. It may
be in any state, including the Withdrawn state. The client leader window
must have a SM_CLIENT_ID property, which contains the client-ID obtained
from the session management protocol. That property must:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Be of type STRING
</p></li><li class="listitem"><p>
Be of format 8
</p></li><li class="listitem"><p>
Contain the client-ID as a string of XPCS characters encoded using ISO
8859-1
</p></li></ul></div><p>
All top-level, nontransient windows created by a client on the same display
as the client leader must have a WM_CLIENT_LEADER property. This property
contains a window ID that identifies the client leader window. The client
leader window must have a WM_CLIENT_LEADER property containing its own
window ID (i.e., the client leader window is pointing to itself). Transient
windows need not have a WM_CLIENT_LEADER property if the client leader can
be determined using the information in the WM_TRANSIENT_FOR property. The
WM_CLIENT_LEADER property must:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Be of type WINDOW
</p></li><li class="listitem"><p>
Be of format 32
</p></li><li class="listitem"><p>
Contain the window ID of the client leader window
</p></li></ul></div><p>
A client must withdraw all of its top-level windows on the same display
before modifiying either the WM_CLIENT_LEADER or the SM_CLIENT_ID property
of its client leader window.
</p><p>
It is necessary that other clients be able to uniquely identify a window
(across sessions) among all windows related to the same client-ID. For
example, a window manager can require this unique ID to restore geometry
information from a previous session, or a workspace manager could use it to
restore information about which windows are in which workspace. A client
may optionally provide a WM_WINDOW_ROLE property to uniquely identify a
window within the scope specified above. The combination of SM_CLIENT_ID
and WM_WINDOW_ROLE can be used by other clients to uniquely identify a
window across sessions.
</p><p>
If the WM_WINDOW_ROLE property is not specified on a top-level window, a
client that needs to uniquely identify that window will try to use instead
the values of WM_CLASS and WM_NAME. If a client has multiple windows with
identical WM_CLASS and WM_NAME properties, then it should provide a
WM_WINDOW_ROLE property.
</p><p>
The client must set the WM_WINDOW_ROLE property to a string that uniquely
identifies that window among all windows that have the same client leader
window. The property must:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Be of type STRING
</p></li><li class="listitem"><p>
Be of format 8
</p></li><li class="listitem"><p>
Contain a string restricted to the XPCS characters, encoded in ISO 8859-1
</p></li></ul></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Window_Manager_Support_for_Session_Management"></a>Window Manager Support for Session Management</h2></div></div></div><p>
A window manager supporting session management must register with the
session manager and obtain its own client-ID. The window manager should
save and restore information such as the WM_STATE, the layout of windows on
the screen, and their stacking order for every client window that has a
valid SM_CLIENT_ID property (on itself, or on the window named by
WM_CLIENT_LEADER) and that can be uniquely identified.
Clients are allowed to change this state during the first phase of the
session checkpoint process. Therefore, window managers should request a
second checkpoint phase and save clients' state only during that phase.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Support_for_ICE_Client_Rendezvous"></a>Support for ICE Client Rendezvous</h2></div></div></div><p>
The Inter-Client Exchange protocol (ICE) defined as of X11R6
specifies a generic communication framework, independent of the X
server, for data exchange between arbitrary clients. ICE also defines
a protocol for any two ICE clients who also have X connections
to the same X server to locate (rendezvous with) each other.
</p><p>
This protocol, called the "ICE X Rendezvous" protocol, is defined in
the ICE specification, Appendix B,
and uses the property ICE_PROTOCOLS plus
<code class="function">ClientMessage</code>
events. Refer to that specification for complete details.
</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="Manipulation_of_Shared_Resources"></a>Chapter 6. Manipulation of Shared Resources</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="sect1"><a href="#The_Input_Focus">The Input Focus</a></span></dt><dt><span class="sect1"><a href="#The_Pointer">The Pointer</a></span></dt><dt><span class="sect1"><a href="#Grabs">Grabs</a></span></dt><dt><span class="sect1"><a href="#Colormaps_2">Colormaps</a></span></dt><dt><span class="sect1"><a href="#The_Keyboard_Mapping">The Keyboard Mapping</a></span></dt><dt><span class="sect1"><a href="#The_Modifier_Mapping">The Modifier Mapping</a></span></dt></dl></div><p>
X Version 11 permits clients to manipulate a number of shared resources,
for example, the input focus, the pointer, and colormaps.
Conventions are required so that clients share resources in an
orderly fashion.
</p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="The_Input_Focus"></a>The Input Focus</h2></div></div></div><p>
Clients that explicitly set the input focus must observe one of two modes:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Locally active mode
</p></li><li class="listitem"><p>
Globally active mode
</p></li></ul></div><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Conventions</strong></p></div><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Locally active clients should set the input focus to one of their windows
only when it is already in one of their windows
or when they receive a WM_TAKE_FOCUS message.
They should set the input field of the WM_HINTS structure to
<code class="function">True</code>.
</p></li><li class="listitem"><p>
Globally active clients should set the input focus to one of their windows
only when they receive a button event and a passive-grabbed key event,
or when they receive a WM_TAKE_FOCUS message.
They should set the input field of the WM_HINTS structure to
<code class="function">False</code>.
</p></li><li class="listitem"><p>
In addition, clients should use the timestamp of the event
that caused them to attempt to set the input focus as the time field on the
<code class="function">SetInputFocus</code>
request, not
<code class="function">CurrentTime</code>.
</p></li></ul></div></blockquote></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="The_Pointer"></a>The Pointer</h2></div></div></div><p>
In general, clients should not warp the pointer.
Window managers, however, may do so
(for example, to maintain the invariant that the pointer is always
in the window with the input focus).
Other window managers may want to preserve the illusion that the user
is in sole control of the pointer.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Conventions</strong></p></div><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Clients should not warp the pointer.
</p></li><li class="listitem"><p>
Clients that insist on warping the pointer should do so only
with the src-window argument of the
<code class="function">WarpPointer</code>
request set to one of their windows.
</p></li></ul></div></blockquote></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Grabs"></a>Grabs</h2></div></div></div><p>
A client's attempt to establish a button or a key grab on a window
will fail if some other client has already established a conflicting
grab on the same window.
The grabs, therefore, are shared resources,
and their use requires conventions.
</p><p>
In conformance with the principle that clients should behave,
as far as possible,
when a window manager is running as they would when it is not,
a client that has the input focus may assume that it can receive all
the available keys and buttons.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Convention</strong></p></div><p>
Window managers should ensure that they provide some mechanism for
their clients to receive events from all keys and all buttons,
except for events involving keys whose KeySyms are registered as being for
window management functions (for example, a hypothetical WINDOW KeySym).
</p></blockquote></div><p>
In other words,
window managers must provide some mechanism by which a client
can receive events from every key and button (regardless of modifiers)
unless and until the X Consortium registers some KeySyms as being reserved
for window management functions.
Currently, no KeySyms are registered for window management functions.
</p><p>
Even so, clients are advised to allow the key and button combinations
used to elicit program actions to be modified,
because some window managers may choose not to observe this convention
or may not provide a convenient method for the user to transmit events
from some keys.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Convention</strong></p></div><p>
Clients should establish button and key grabs only on windows that
they own.
</p></blockquote></div><p>
In particular, this convention means that a window manager that wishes
to establish a grab over the client's top-level window should either establish
the grab on the root or reparent the window and establish the grab
on a proper ancestor.
In some cases,
a window manager may want to consume the event received,
placing the window in a state where a subsequent such event will go to
the client.
Examples are:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Clicking in a window to set focus with the click not being offered
to the client
</p></li><li class="listitem"><p>
Clicking in a buried window to raise it, again, with the click not offered
to the client
</p></li></ul></div><p>
More typically,
a window manager should add to, rather than replace, the client's semantics
for key+button combinations by allowing the event to be used by the client
after the window manager is done with it.
To ensure this,
the window manager should establish the grab on the parent
by using the following:
</p><pre class="literallayout">
pointer/keyboard-mode == Synchronous
</pre><p>
Then, the window manager should release the grab by using an
<code class="function">AllowEvents</code>
request with the following specified:
</p><pre class="literallayout">
mode == ReplayPointer/Keyboard
</pre><p>
In this way,
the client will receive the events as if they had not been intercepted.
</p><p>
Obviously,
these conventions place some constraints on possible user interface policies.
There is a trade-off here between freedom for window managers to implement
their user interface policies and freedom for clients to implement theirs.
The dilemma is resolved by:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Allowing window managers to decide if and when a client will receive an
event from any given key or button
</p></li><li class="listitem"><p>
Placing a requirement on the window manager to provide some mechanism,
perhaps a "Quote" key,
by which the user can send an event from any key or button to the client
</p></li></ul></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Colormaps_2"></a>Colormaps</h2></div></div></div><p>
<a class="xref" href="#Colormaps" title="Colormaps">Colormaps</a>
prescribes conventions for clients to communicate with the
window manager about their colormap needs. If your clients are
<code class="function">DirectColor</code>
type applications,
you should consult section 14.3 of
<span class="emphasis"><em>Xlib - C Language X Interface</em></span>
for conventions connected with sharing standard colormaps.
They should look for and create the properties described there on
the root window of the appropriate screen.
</p><p>
The contents of the RGB_COLOR_MAP type property are as follows:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Field</th><th align="left">Type</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left">colormap</td><td align="left">COLORMAP</td><td align="left">ID of the colormap described</td></tr><tr><td align="left">red_max</td><td align="left">CARD32</td><td align="left">Values for pixel calculations</td></tr><tr><td align="left">red_mult</td><td align="left">CARD32</td><td align="left"> </td></tr><tr><td align="left">green_max</td><td align="left">CARD32</td><td align="left"> </td></tr><tr><td align="left">green_mult</td><td align="left">CARD32</td><td align="left"> </td></tr><tr><td align="left">blue_max</td><td align="left">CARD32</td><td align="left"> </td></tr><tr><td align="left">blue_mult</td><td align="left">CARD32</td><td align="left"> </td></tr><tr><td align="left">base_pixel</td><td align="left">CARD32</td><td align="left"> </td></tr><tr><td align="left">visual_id</td><td align="left">VISUALID</td><td align="left">Visual to which colormap belongs</td></tr><tr><td align="left">kill_id</td><td align="left">CARD32</td><td align="left">ID for destroying the resources</td></tr></tbody></table></div><p>
When deleting or replacing an RGB_COLOR_MAP,
it is not sufficient to delete the property;
it is important to free the associated colormap resources as well.
If kill_id is greater than one,
the resources should be freed by issuing a
<code class="function">KillClient</code>
request with kill_id as the argument.
If kill_id is one,
the resources should be freed by issuing a
<code class="function">FreeColormap</code>
request with colormap as the colormap
argument.
If kill_id is zero,
no attempt should be made to free the resources.
A client that creates an RGB_COLOR_MAP for which the colormap resource
is created specifically for this purpose should set kill_id to one
(and can create more than one such standard colormap
using a single connection).
A client that creates an RGB_COLOR_MAP for which the colormap resource
is shared in some way (for example, is the default colormap
for the root window) should create an arbitrary resource and use its
resource ID for kill_id (and should create no other standard colormaps
on the connection).
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Convention</strong></p></div><p>
If an RGB_COLOR_MAP property is too short to contain the visual_id field,
it can be assumed that the visual_id is the root visual
of the appropriate screen.
If an RGB_COLOR_MAP property is too short to contain the kill_id field,
a value of zero can be assumed.
</p></blockquote></div><p>
During the connection handshake,
the server informs the client of the default colormap for each screen.
This is a colormap for the root visual,
and clients can use it to improve the extent of colormap sharing
if they use the root visual.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="The_Keyboard_Mapping"></a>The Keyboard Mapping</h2></div></div></div><p>
The X server contains a table (which is read by
<code class="function">GetKeyboardMapping</code>
requests) that describes the set of symbols appearing
on the corresponding key for each keycode generated by the server.
This table does not affect the server's operations in any way;
it is simply a database used by clients that attempt to understand
the keycodes they receive.
Nevertheless, it is a shared resource and requires conventions.
</p><p>
It is possible for clients to modify this table by using a
<code class="function">ChangeKeyboardMapping</code>
request.
In general, clients should not do this.
In particular, this is not the way in which clients should implement
key bindings or key remapping.
The conversion between a sequence of keycodes received from the server
and a string in a particular encoding is a private matter for each client
(as it must be in a world where applications may be using different
encodings to support different languages and fonts).
See the Xlib reference manual for converting keyboard events to text.
</p><p>
The only valid reason for using a
<code class="function">ChangeKeyboardMapping</code>
request is when the symbols written on the keys have changed as, for example,
when a Dvorak key conversion kit or a set of APL keycaps has been installed.
Of course, a client may have to take the change to the keycap on trust.
</p><p>
The following illustrates a permissible interaction between a client
and a user:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
"You just started me on a server without a Pause key.
Please choose a key to be the Pause key and press it now."
</p></li><li class="listitem"><p>
Presses the Scroll Lock key
</p></li><li class="listitem"><p>
"Adding Pause to the symbols on the Scroll Lock key: Confirm or Abort."
</p></li><li class="listitem"><p>
Confirms
</p></li><li class="listitem"><p>
Uses a
<code class="function">ChangeKeyboardMapping</code>
request to add Pause to the keycode that already contains Scroll Lock and
issues this request, "Please paint Pause on the Scroll Lock key."
Clients should not use
<code class="function">ChangeKeyboardMapping</code>
requests.
</p></li></ul></div><p>
If a client succeeds in changing the keyboard mapping table,
all clients will receive
<code class="function">MappingNotify</code>
(request==Keyboard) events.
There is no mechanism to avoid receiving these events.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Convention</strong></p></div><p>
Clients receiving
<code class="function">MappingNotify</code>
(request==Keyboard)
events should update any internal keycode translation tables they are using.
</p></blockquote></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="The_Modifier_Mapping"></a>The Modifier Mapping</h2></div></div></div><p>
X Version 11 supports 8 modifier bits of which 3 are preassigned
to Shift, Lock, and Control.
Each modifier bit is controlled by the state of a set of keys,
and these sets are specified in a table accessed by
<code class="function">GetModifierMapping</code> and
<code class="function">SetModifierMapping</code> requests.
This table is a shared resource and requires conventions.
</p><p>
A client that needs to use one of the preassigned modifiers should assume
that the modifier table has been set up correctly to control these modifiers.
The Lock modifier should be interpreted as Caps Lock or Shift Lock
according as the keycodes in its controlling set include XK_Caps_Lock
or XK_Shift_Lock.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Convention</strong></p></div><p>
Clients should determine the meaning of a modifier bit from the KeySyms
being used to control it.
</p></blockquote></div><p>
A client that needs to use an extra modifier (for example, META) should do
the following:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Scan the existing modifier mappings.
If it finds a modifier that contains a keycode whose set of KeySyms
includes XK_Meta_L or XK_Meta_R,
it should use that modifier bit.
</p></li><li class="listitem"><p>
If there is no existing modifier controlled by XK_Meta_L or XK_Meta_R,
it should select an unused modifier bit (one with an empty controlling set)
and do the following:
</p><div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>
If there is a keycode with XL_Meta_L in its set of KeySyms,
add that keycode to the set for the chosen modifier.
</p></li><li class="listitem"><p>
If there is a keycode with XL_Meta_R in its set of KeySyms,
add that keycode to the set for the chosen modifier.
</p></li><li class="listitem"><p>
If the controlling set is still empty,
interact with the user to select one or more keys to be META.
</p></li></ul></div></li><li class="listitem"><p>
If there are no unused modifier bits,
ask the user to take corrective action.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Conventions</strong></p></div><div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>
Clients needing a modifier not currently in use should assign keycodes
carrying suitable KeySyms to an unused modifier bit.
</p></li><li class="listitem"><p>
Clients assigning their own modifier bits should ask the user politely to
remove his or her hands from the key in question if their
<code class="function">SetModifierMapping</code>
request returns a
<code class="function">Busy</code>
status.
</p></li></ul></div></blockquote></div></li></ul></div><p>
There is no good solution to the problem of reclaiming assignments
to the five nonpreassigned modifiers when they are no longer being used.
</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><strong>Convention</strong></p></div><p>
The user must use
<code class="function">xmodmap</code>
or some other utility to deassign obsolete modifier mappings by hand.
</p></blockquote></div><p>
When a client succeeds in performing a
<code class="function">SetModifierMapping</code>
request,
all clients will receive
<code class="function">MappingNotify</code>
(request==Modifier) events.
There is no mechanism for preventing these events from being received.
A client that uses one of the nonpreassigned modifiers that receives
one of these events should do a
<code class="function">GetModifierMapping</code>
request to discover the new mapping,
and if the modifier it is using has been cleared,
it should reinstall the modifier.
</p><p>
Note that a
<code class="function">GrabServer</code>
request must be used to make the
<code class="function">GetModifierMapping</code>
and
<code class="function">SetModifierMapping</code>
pair in these transactions atomic.
</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="Device_Color_Characterization"></a>Chapter 7. Device Color Characterization</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="sect1"><a href="#XYZ_lt_gt_RGB_Conversion_Matrices">XYZ &lt;-&gt; RGB Conversion Matrices</a></span></dt><dt><span class="sect1"><a href="#Intensity_dA_RGB_Value_Conversion">Intensity (dA RGB Value Conversion</a></span></dt></dl></div><p>
The X protocol provides explicit Red, Green, and Blue (RGB) values,
which are used to directly drive a monitor, and color names. RGB values
provide a mechanism for accessing the full capabilities of the display
device, but at the expense of having the color perceived by the user remain
unknowable through the protocol. Color names were originally designed to
provide access to a device-independent color database by having the server
vendor tune the definitions of the colors in that textual database.
Unfortunately, this still does not provide the client any way of using
an existing device-independent color, nor for the client to get
device-independent color information back about colors that it has selected.
</p><p>
Furthermore, the client must be able to discover which set of colors are
displayable by the device (the device gamut), both to allow colors to be
intelligently modified to fit within the device capabilities (gamut
compression) and to enable the user interface to display a representation of
the reachable color space to the user (gamut display).
</p><p>
Therefore, a system is needed that will provide full access to
device-independent color spaces for X clients. This system should use a
standard mechanism for naming the colors, be able to provide names for
existing colors, and provide means by which unreachable colors can be
modified to fall within the device gamut.
</p><p>
We are fortunate in this area to have a seminal work, the 1931 CIE color
standard, which is nearly universally agreed upon as adequate for describing
colors on CRT devices. This standard uses a tri-stimulus model called CIE
XYZ in which each perceivable color is specified as a triplet of numbers.
Other appropriate device-independent color models do exist, but most of them
are directly traceable back to this original work.
</p><p>
X device color characterization
provides device-independent color spaces to X clients. It does this by
providing the barest possible amount of information to the client that
allows the client to construct a mapping between CIE XYZ and the regular X
RGB color descriptions.
</p><p>
Device color characterization is defined by
the name and contents of two window properties that,
together, permit converting between CIE XYZ space and
linear RGB device space (such as standard CRTs).
Linear RGB devices require just two
pieces of information to completely characterize them:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
A 3 x 3 matrix M and its inverse M<sup>-1</sup>,
which convert between
XYZ and RGB intensity (RGB<sub>intensity</sub>):
</p><div class="blockquote"><blockquote class="blockquote"><p>
RGB<sub>intensity</sub> = M x XYZ
</p><p>
XYZ = M<sup>-1</sup> x RGB<sub>intensity</sub>
</p></blockquote></div><p>
</p></li><li class="listitem"><p>
A way of mapping between RGB intensity and RGB protocol value. XDCCC
supports three mechanisms which will be outlined later.
</p></li></ul></div><p>
If other device types are eventually necessary, additional
properties will be required to describe them.
</p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="XYZ_lt_gt_RGB_Conversion_Matrices"></a>XYZ &lt;-&gt; RGB Conversion Matrices</h2></div></div></div><p>
Because of the limited dynamic range of both XYZ and RGB intensity,
these matrices will be encoded using a fixed-point representation of a
32-bit two's complement number scaled by 2<sup>27</sup>,
giving a range of -16 to 16 - Ε, where
Ε = 2<sup>-27</sup>.
</p><p>
These matrices will be packed into an 18-element list of 32-bit values,
XYZ -&gt; RGB matrix first, in row major order and stored in the
XDCCC_LINEAR_RGB_MATRICES properties (format = 32) on the root window of
each screen, using values appropriate for that screen.
</p><p>
This will be encoded as shown in the following table:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Field</th><th align="left">Type</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left">M<sub>0,0</sub></td><td align="left">INT32</td><td align="left">Interpreted as a fixed-point number -16 ≤ x &lt; 16</td></tr><tr><td align="left">M<sub>0,1</sub></td><td align="left">INT32</td><td align="left"> </td></tr><tr><td align="left">...</td><td align="left">INT32</td><td align="left"> </td></tr><tr><td align="left">M<sub>3,3</sub></td><td align="left">INT32</td><td align="left"> </td></tr><tr><td align="left">M<sup>-1</sup><sub>0,0</sub></td><td align="left">INT32</td><td align="left"> </td></tr><tr><td align="left">M<sup>-1</sup><sub>0,1</sub></td><td align="left">INT32</td><td align="left"> </td></tr><tr><td align="left">...</td><td align="left">INT32</td><td align="left"> </td></tr><tr><td align="left">M<sup>-1</sup><sub>3,3</sub></td><td align="left">INT32</td><td align="left"> </td></tr></tbody></table></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Intensity_dA_RGB_Value_Conversion"></a>Intensity (dA RGB Value Conversion</h2></div></div></div><p>
XDCCC provides two representations for describing the conversion
between RGB intensity and the actual X protocol RGB values:
</p><pre class="literallayout">
0 RGB value/RGB intensity level pairs
1 RGB intensity ramp
</pre><p>
In both cases, the relevant data will be stored in the
XDCCC_LINEAR_RGB_CORRECTION properties on the root window of each screen,
using values appropriate for that screen, in whatever format provides
adequate resolution. Each property can consist of multiple entries
concatenated together, if different visuals for the screen require different
conversion data. An entry with a VisualID of 0 specifies data for all
visuals of the screen that are not otherwise explicitly listed.
</p><p>
The first representation is an array of RGB value/intensity level pairs, with
the RGB values in strictly increasing order. When converting, the client must
linearly interpolate between adjacent entries in the table to compute the
desired value. This allows the server to perform gamma correction
itself and encode that fact in a short two-element correction table. The
intensity will be encoded as an unsigned number to be interpreted as a value
between 0 and 1 (inclusive). The precision of this value will depend on the
format of the property in which it is stored (8, 16, or 32 bits). For 16-bit
and 32-bit formats, the RGB value will simply be the value stored in the
property. When stored in 8-bit format, the RGB value can be computed from
the value in the property by:
</p><p>
RGB sub value ~ = ~ { Property ~ Value ~ times ~ 65535 } over 255
</p><p>
Because the three electron guns in the device may not be exactly alike in
response characteristics, it is necessary to allow for three separate
tables, one each for red, green, and blue. Therefore, each table will be
preceded by the number of entries in that table, and the set of tables will be
preceded by the number of tables.
When three tables are provided, they will be in red, green, blue order.
</p><p>
This will be encoded as shown in the following table:
</p><p>
XDCCC_LINEAR_RGB_CORRECTION Property Contents for Type 0 Correction
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Field</th><th align="left">Type</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left">VisualID0</td><td align="left">CARD</td><td align="left">Most significant portion of VisualID</td></tr><tr><td align="left">VisualID1</td><td align="left">CARD</td><td align="left">Exists if and only if the property format is 8</td></tr><tr><td align="left">VisualID2</td><td align="left">CARD</td><td align="left">Exists if and only if the property format is 8</td></tr><tr><td align="left">VisualID3</td><td align="left">CARD</td><td align="left">
Least significant portion, exists if and only if the property
format is 8 or 16
</td></tr><tr><td align="left">type</td><td align="left">CARD</td><td align="left">0 for this type of correction</td></tr><tr><td align="left">count</td><td align="left">CARD</td><td align="left">Number of tables following (either 1 or 3)</td></tr><tr><td align="left">length</td><td align="left">CARD</td><td align="left">Number of pairs -1 following in this table</td></tr><tr><td align="left">value</td><td align="left">CARD</td><td align="left">X Protocol RBG value</td></tr><tr><td align="left">intensity</td><td align="left">CARD</td><td align="left">
Interpret as number 0 ≤ <span class="emphasis"><em>intensity</em></span> ≤ 1
</td></tr><tr><td align="left">...</td><td align="left">...</td><td align="left">
Total of <span class="emphasis"><em>length+1</em></span> pairs of
value/intensity values
</td></tr><tr><td align="left">lengthg</td><td align="left">CARD</td><td align="left">
Number of pairs -1 following in this table (if and only if
<span class="emphasis"><em>count</em></span> is 3
</td></tr><tr><td align="left">value</td><td align="left">CARD</td><td align="left">X Protocol RBG value</td></tr><tr><td align="left">intensity</td><td align="left">CARD</td><td align="left">
Interpret as a number 0 ≤ <span class="emphasis"><em>intensity</em></span> ≤ 1
</td></tr><tr><td align="left">...</td><td align="left">...</td><td align="left">
Total of <span class="emphasis"><em>length+1</em></span> pairs of
value/intensity values
</td></tr><tr><td align="left">lengthb</td><td align="left">CARD</td><td align="left">
Number of pairs -1 following in this table (if and only if
<span class="emphasis"><em>count</em></span> is 3
</td></tr><tr><td align="left">value</td><td align="left">CARD</td><td align="left">X Protocol RBG value</td></tr><tr><td align="left">intensity</td><td align="left">CARD</td><td align="left">
Interpret as a number 0 ≤ <span class="emphasis"><em>intensity</em></span> ≤ 1
</td></tr><tr><td align="left">...</td><td align="left">...</td><td align="left">
Total of <span class="emphasis"><em>length+1</em></span> pairs of
value/intensity values
</td></tr></tbody></table></div><p>
The VisualID is stored in 4, 2, or 1 pieces, depending on whether
the property format is 8, 16, or 32, respectively. The VisualID is always
stored most significant piece first.
Note that the length fields are stored as one less than the actual length,
so 256 entries can be stored in format 8.
</p><p>
The second representation is a simple array of intensities for a linear subset
of RGB values. The expected size of this table is the bits-per-rgb-value of
the screen, but it can be any length. This is similar to the first mechanism,
except that the RGB value numbers are implicitly defined by the index in the
array (indices start at 0):
</p><div class="blockquote"><blockquote class="blockquote"><p>
RGB sub value ~ = ~ { Array ~ Index ~ times ~ 65535 } over
{ Array ~ Size ~ - ~ 1 }
</p></blockquote></div><p>
When converting, the client may linearly interpolate between entries in this
table. The intensity values will be encoded just as in the first
representation.
</p><p>
This will be encoded as shown in the following table:
</p><p>
XDCCC_LINEAR_RGB_CORRECTION Property Contents for Type 1 Correction
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Field</th><th align="left">Type</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left">VisualID0</td><td align="left">CARD</td><td align="left">Most significant portion of VisualID</td></tr><tr><td align="left">VisualID1</td><td align="left">CARD</td><td align="left">Exists if and only if the property format is 8</td></tr><tr><td align="left">VisualID2</td><td align="left">CARD</td><td align="left">Exists if and only if the property format is 8</td></tr><tr><td align="left">VisualID3</td><td align="left">CARD</td><td align="left">
Least significant portion, exists if and only if the property
format is 8 or 16
</td></tr><tr><td align="left">type</td><td align="left">CARD</td><td align="left">1 for this type of correction</td></tr><tr><td align="left">count</td><td align="left">CARD</td><td align="left">Number of tables following (either 1 or 3)</td></tr><tr><td align="left">length</td><td align="left">CARD</td><td align="left">Number of pairs -1 following in this table</td></tr><tr><td align="left">intensity</td><td align="left">CARD</td><td align="left">
Interpret as number 0 ≤ <span class="emphasis"><em>intensity</em></span> ≤ 1
</td></tr><tr><td align="left">...</td><td align="left">...</td><td align="left">
Total of <span class="emphasis"><em>length+1</em></span> pairs of
value/intensity values
</td></tr><tr><td align="left">lengthg</td><td align="left">CARD</td><td align="left">
Number of pairs -1 following in this table (if and only if
<span class="emphasis"><em>count</em></span> is 3
</td></tr><tr><td align="left">intensity</td><td align="left">CARD</td><td align="left">
Interpret as a number 0 ≤ <span class="emphasis"><em>intensity</em></span> ≤ 1
</td></tr><tr><td align="left">...</td><td align="left">...</td><td align="left">
Total of <span class="emphasis"><em>length+1</em></span> pairs of
value/intensity values
</td></tr><tr><td align="left">lengthb</td><td align="left">CARD</td><td align="left">
Number of pairs -1 following in this table (if and only if
<span class="emphasis"><em>count</em></span> is 3
</td></tr><tr><td align="left">intensity</td><td align="left">CARD</td><td align="left">
Interpret as a number 0 ≤ <span class="emphasis"><em>intensity</em></span> ≤ 1
</td></tr><tr><td align="left">...</td><td align="left">...</td><td align="left">
Total of <span class="emphasis"><em>length+1</em></span> pairs of
value/intensity values
</td></tr></tbody></table></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="Conclusion"></a>Chapter 8. Conclusion</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="sect1"><a href="#The_X_Registry">The X Registry</a></span></dt></dl></div><p>
This document provides the protocol-level specification of the minimal
conventions needed to ensure that X Version 11 clients can interoperate
properly. This document specifies interoperability conventions only for the
X Version 11 protocol. Clients should be aware of other protocols that
should be used for better interoperation in the X environment. The reader
is referred to
<span class="emphasis"><em>X Session Management Protocol</em></span>
for information on session management, and to
<span class="emphasis"><em>Inter-Client Exchange Protocol</em></span>
for information on general-purpose communication among clients.
</p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="The_X_Registry"></a>The X Registry</h2></div></div></div><p>
The X Consortium maintains a registry of certain X-related items, to aid in
avoiding conflicts and in sharing of such items. Readers are
encouraged to use the registry. The classes of items kept in the registry
that are relevant to the ICCCM include property names, property types,
selection names, selection targets, WM_PROTOCOLS protocols,
<code class="function">ClientMessage</code>
types, and application classes. Requests to register items, or questions
about registration, should be addressed to
</p><div class="address"><p><br />
     xregistry@x.org<br />
  </p></div><p>
or to
</p><div class="address"><p><br />
        The X.Org Foundation -- X11 Registry<br />
        c/o Alan Coopersmith<br />
        Oracle Corporation<br />
        M/S SCA17-3824<br />
        4170 Network Circle<br />
        Santa Clara, CA 95054<br />
        USA<br />
  </p></div><p>
</p><p>
Electronic mail will be acknowledged upon receipt. Please allow up to 4
weeks for a formal response to registration and inquiries.
</p><p>
The registry is published as part of the X software distribution from the
X.Org Foundation. All registered items must have the postal address of someone
responsible for the item or a reference to a document describing the item
and the postal address of where to write to obtain the document.
</p></div></div><div class="appendix"><div class="titlepage"><div><div><h2 class="title"><a id="revision_history"></a>Appendix A. Revision History</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="sect1"><a href="#The_X11R2_Draft">The X11R2 Draft</a></span></dt><dt><span class="sect1"><a href="#The_July_27_1988_Draft">The July 27, 1988, Draft</a></span></dt><dt><span class="sect1"><a href="#The_Public_Review_Drafts">The Public Review Drafts</a></span></dt><dt><span class="sect1"><a href="#Version_10_July_1989">Version 1.0, July 1989</a></span></dt><dt><span class="sect1"><a href="#Version_11">Version 1.1</a></span></dt><dt><span class="sect1"><a href="#Public_Review_Draft_December_1993">Public Review Draft, December 1993</a></span></dt><dt><span class="sect1"><a href="#Version_20_April_1994">Version 2.0, April 1994</a></span></dt></dl></div><p>
This appendix describes the revision history of this document and
summarizes the incompatibilities between this and earlier versions.
</p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="The_X11R2_Draft"></a>The X11R2 Draft</h2></div></div></div><p>
The February 25, 1988, draft that was distributed as part of X Version 11,
Release 2, was clearly labeled as such,
and many areas were explicitly labeled as liable to change.
Nevertheless, in the revision work done since then,
we have been very careful not to introduce gratuitous incompatibility.
As far as possible,
we have tried to ensure that clients obeying the conventions
in the X11R2 draft would still work.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="The_July_27_1988_Draft"></a>The July 27, 1988, Draft</h2></div></div></div><p>
The Consortium review was based on a draft dated July 27, 1988. This draft
included several areas in which incompatibilities with the X11R2 draft were
necessary:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
The use of property
<code class="function">None</code>
in
<code class="function">ConvertSelection</code>
requests is no longer allowed.
Owners that receive them are free to use the target atom as the property
to respond with,
which will work in most cases.
</p></li><li class="listitem"><p>
The protocol for INCREMENTAL type properties as selection replies has changed,
and the name has been changed to INCR.
Selection requestors are free to implement the earlier protocol
if they receive properties of type INCREMENTAL.
</p></li><li class="listitem"><p>
The protocol for INDIRECT type properties as selection replies has changed,
and the name has been changed to MULTIPLE.
Selection requestors are free to implement the earlier protocol
if they receive properties of type INDIRECT.
</p></li><li class="listitem"><p>
The protocol for the special CLIPBOARD client has changed.
The earlier protocol is subject to race conditions and should not be used.
</p></li><li class="listitem"><p>
The set of state values in WM_HINTS.initial_state has been reduced,
but the values that are still valid are unchanged.
Window managers should treat the other values sensibly.
</p></li><li class="listitem"><p>
The methods an application uses to change the state of its top-level window
have changed but in such a way that cases that used to work will still work.
</p></li><li class="listitem"><p>
The x, y, width, and height fields have been removed from the WM_NORMAL_HINTS
property and replaced by pad fields.
Values set into these fields will be ignored.
The position and size of the window should be set by setting the appropriate
window attributes.
</p></li><li class="listitem"><p>
A pair of base fields and a win_gravity field have been added
to the WM_NORMAL_HINTS property.
Window managers will assume values for these fields if the client
sets a short property.
</p></li></ul></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="The_Public_Review_Drafts"></a>The Public Review Drafts</h2></div></div></div><p>
The Consortium review resulted in several incompatible changes. These
changes were included in drafts that were distributed for public review
during the first half of 1989.
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
The messages field of the WM_HINTS property was found to be unwieldy
and difficult to evolve.
It has been replaced by the WM_PROTOCOLS property,
but clients that use the earlier mechanism can be detected
because they set the messages bit in the flags field of the WM_HINTS property,
and window managers can provide a backwards compatibility mode.
</p></li><li class="listitem"><p>
The mechanism described in the earlier draft by which clients installed
their own subwindow colormaps could not be made to work reliably
and mandated some features of the look and feel.
It has been replaced by the WM_COLORMAP_WINDOWS property.
Clients that use the earlier mechanism can be detected by the WM_COLORMAPS
property they set on their top-level window,
but providing a reliable backwards compatibility mode is not possible.
</p></li><li class="listitem"><p>
The recommendations for window manager treatment of top-level window borders
have been changed as those in the earlier draft produced problems
with Visibility events.
For nonwindow manager clients,
there is no incompatibility.
</p></li><li class="listitem"><p>
The pseudoroot facility in the earlier draft has been removed.
Although it has been successfully implemented,
it turns out to be inadequate to support the uses envisaged.
An extension will be required to support these uses fully,
and it was felt that the maximum freedom should be left to the designers
of the extension.
In general,
the previous mechanism was invisible to clients and no incompatibility
should result.
</p></li><li class="listitem"><p>
The addition of the WM_DELETE_WINDOW protocol (which prevents the danger
that multi-window clients may be terminated unexpectedly)
has meant some changes in the WM_SAVE_YOURSELF protocol,
to ensure that the two protocols are orthogonal.
Clients using the earlier protocol can be detected (see WM_PROTOCOLS above)
and supported in a backwards compatibility mode.
</p></li><li class="listitem"><p>
The conventions in Section 14.3.1. of
<span class="emphasis"><em>Xlib - C Language X Interface</em></span>
regarding properties of type RGB_COLOR_MAP have been changed,
but clients that use the earlier conventions can be detected
because their properties are 4 bytes shorter.
These clients will work correctly if the server supports only a single Visual
or if they use only the Visual of the root.
These are the only cases in which they would have worked, anyway.
</p></li></ul></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Version_10_July_1989"></a>Version 1.0, July 1989</h2></div></div></div><p>
The public review resulted in a set of mostly editorial changes. The
changes in version 1.0 that introduced some degree of incompatibility with
the earlier drafts are:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
A new section (
<a class="xref" href="#Grabs" title="Grabs">Grabs</a>
) was added covering the window manager's
use of Grabs.
The restrictions it imposes should affect only window managers.
</p></li><li class="listitem"><p>
The TARGETS selection target has been clarified,
and it may be necessary for clients to add some entries to their replies.
</p></li><li class="listitem"><p>
A selection owner using INCR transfer should no longer replace targets in
a MULTIPLE property with the atom INCR.
</p></li><li class="listitem"><p>
The contents of the
<code class="function">ClientMessage</code>
event sent by a client to iconify itself has been clarified,
but there should be no incompatibility because the earlier contents
would not in fact have worked.
</p></li><li class="listitem"><p>
The border-width in synthetic
<code class="function">ConfigureNotify</code>
events is now specified,
but this should not cause any incompatibility.
</p></li><li class="listitem"><p>
Clients are now asked to set a border-width on all
<code class="function">ConfigureWindow</code>
requests.
</p></li><li class="listitem"><p>
Window manager properties on icon windows now will be ignored,
but there should be no incompatibility
because there was no specification that they be obeyed previously.
</p></li><li class="listitem"><p>
The ordering of real and synthetic
<code class="function">ConfigureNotify</code>
events is now specified,
but any incompatibility should affect only window managers.
</p></li><li class="listitem"><p>
The semantics of WM_SAVE_YOURSELF have been clarified and restricted to
be a checkpoint operation only.
Clients that were using it as part of a shutdown sequence may need to
be modified,
especially if they were interacting with the user during the shutdown.
</p></li><li class="listitem"><p>
A kill_id field has been added to RGB_COLOR_MAP properties.
Clients using earlier conventions can be detected by the size of their
RGB_COLOR_MAP properties,
and the cases that would have worked will still work.
</p></li></ul></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Version_11"></a>Version 1.1</h2></div></div></div><p>
Version 1.1 was released with X11R5 in September 1991. In addition to some
minor editorial changes, there were a few semantic changes since Version
1.0:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
The section on Device Color Characterization was added.
</p></li><li class="listitem"><p>
The meaning of the NULL property type was clarified.
</p></li><li class="listitem"><p>
Appropriate references to Compound Text were added.
</p></li></ul></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Public_Review_Draft_December_1993"></a>Public Review Draft, December 1993</h2></div></div></div><p>
The following changes have been made in preparing the public review draft
for Version 2.0.
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
[P01] Addition of advice to clients on how to keep track of a top-level
window's absolute position on the screen.
</p></li><li class="listitem"><p>
[P03] A technique for clients to detect when it is safe to reuse a
top-level window has been added.
</p></li><li class="listitem"><p>
[P06]
<a class="xref" href="#Colormaps" title="Colormaps">Colormaps</a>
, on colormaps, has been rewritten. A new feature that
allows clients to install their own colormaps has also been added.
</p></li><li class="listitem"><p>
[P08] The LENGTH target has been deprecated.
</p></li><li class="listitem"><p>
[P11] The manager selections facility was added.
</p></li><li class="listitem"><p>
[P17] The definition of the aspect ratio fields of the WM_NORMAL_HINTS
property has been changed to include the base size.
</p></li><li class="listitem"><p>
[P19]
<code class="function">StaticGravity</code>
has been added to the list of values allowed for the win_gravity field of
the WM_HINTS property. The meaning of the
<code class="function">CenterGravity</code>
value has been clarified.
</p></li><li class="listitem"><p>
[P20] A means for clients to query the ICCCM compliance level of the window
manager has been added.
</p></li><li class="listitem"><p>
[P22] The definition of the MULTIPLE selection target has been clarified.
</p></li><li class="listitem"><p>
[P25] A definition of "top-level window" has been added. The WM_STATE
property has been defined and exposed to clients.
</p></li><li class="listitem"><p>
[P26] The definition of window states has been clarified and the wording
regarding window state changes has been made more consistent.
</p></li><li class="listitem"><p>
[P27] Clarified the rules governing when window managers are required to send
synthetic
<code class="function">ConfigureNotify</code>
events.
</p></li><li class="listitem"><p>
[P28] Added a recommended technique for setting the input focus to a window
as soon as it is mapped.
</p></li><li class="listitem"><p>
[P29] The required lifetime of resource IDs named in window manager
properties has been specified.
</p></li><li class="listitem"><p>
[P30] Advice for dealing with keystrokes and override-redirect windows has
been added.
</p></li><li class="listitem"><p>
[P31] A statement on the ownership of resources transferred through the
selection mechanism has been added.
</p></li><li class="listitem"><p>
[P32] The definition of the CLIENT_WINDOW target has been clarified.
</p></li><li class="listitem"><p>
[P33] A rule about requiring the selection owner to reacquire the
selection under certain circumstances has been added.
</p></li><li class="listitem"><p>
[P42] Added several new selection targets.
</p></li><li class="listitem"><p>
[P44] Ambiguous wording regarding the withdrawal of top-level windows
has been removed.
</p></li><li class="listitem"><p>
[P45] A facility for requestors to pass parameters during a selection
request has been added.
</p></li><li class="listitem"><p>
[P49] A convention on discrimated names has been added.
</p></li><li class="listitem"><p>
[P57] The C_STRING property type was added.
</p></li><li class="listitem"><p>
[P62] An ordering requirement on processing selection requests was added.
</p></li><li class="listitem"><p>
[P63] The
<code class="function">VisibleHint</code>
flag was added.
</p></li><li class="listitem"><p>
[P64] The session management section has been updated to align with the new
session management protocol. The old session management conventions have
been moved to Appendix C.
</p></li><li class="listitem"><p>
References to the never-forthcoming
<span class="emphasis"><em>Window and Session Manager
Conventions Manual</em></span> have been removed.
</p></li><li class="listitem"><p>
Information on the X Registry and references to the session management and
ICE documents have been added.
</p></li><li class="listitem"><p>
Numerous editorial and typographical improvements have been made.
</p></li></ul></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Version_20_April_1994"></a>Version 2.0, April 1994</h2></div></div></div><p>
The following changes have been made in preparation for releasing
the final edition of Version 2.0 with X11R6.
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
The PIXMAP selection target has been revised to return a property of type
PIXMAP instead of type DRAWABLE.
</p></li><li class="listitem"><p>
The session management section has been revised slightly to correspond with
the changes to the
<span class="emphasis"><em>X Session Management Protocol</em></span>.
</p></li><li class="listitem"><p>
Window managers are now prohibited from placing
<code class="function">CurrentTime</code>
in the timestamp field of WM_TAKE_FOCUS messages.
</p></li><li class="listitem"><p>
In the WM_HINTS property, the
<code class="function">VisibleHint</code>
flag has been renamed to
<code class="function">UrgencyHint</code>.
Its semantics have also been defined more thoroughly.
</p></li><li class="listitem"><p>
Additional editorial and typographical changes have been made.
</p></li></ul></div></div></div><div class="appendix"><div class="titlepage"><div><div><h2 class="title"><a id="suggested_protocol_revisions"></a>Appendix B. Suggested Protocol Revisions</h2></div></div></div><p>
During the development of these conventions,
a number of inadequacies have been discovered in the
core X11 protocol.
They are summarized here as input to an eventual protocol revision
design process:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
There is no way for anyone to find out the last-change time of
a selection.
The
<code class="function">GetSelectionOwner</code>
request should be changed to return the last-change time as well as the owner.
</p></li><li class="listitem"><p>
There is no way for a client to find out which selection atoms are valid.
</p></li><li class="listitem"><p>
There would be no need for WM_TAKE_FOCUS if the
<code class="function">FocusIn</code>
event contained a timestamp and a previous-focus field.
This could avoid the potential race condition.
There is space in the event for this information;
it should be added at the next protocol revision.
</p></li><li class="listitem"><p>
There is a race condition in the
<code class="function">InstallColormap</code>
request.
It does not take a timestamp and may be executed after the top-level colormap
has been uninstalled.
The next protocol revision should provide the timestamp in the
<code class="function">InstallColormap</code>,
<code class="function">UninstallColormap</code>,
<code class="function">ListInstalledColormaps</code>
requests and in the
<code class="function">ColormapNotify</code>
event.
The timestamp should be used in a similar way to the last-focus-change
time for the input focus. The lack of timestamps in these packets is the
reason for restricting colormap installation to the window manager.
</p></li><li class="listitem"><p>
The protocol needs to be changed to provide some way of identifying
the Visual and the Screen of a colormap.
</p></li><li class="listitem"><p>
There should be some way to reclaim assignments to the five nonpreassigned
modifiers when they are no longer needed. The manual method is unpleasantly
low-tech.
</p></li></ul></div></div><div class="appendix"><div class="titlepage"><div><div><h2 class="title"><a id="obsolete_session_manager_conventions"></a>Appendix C. Obsolete Session Manager Conventions</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="sect1"><a href="#Properties">Properties</a></span></dt><dd><dl><dt><span class="sect2"><a href="#WM_COMMAND_Property">WM_COMMAND Property</a></span></dt><dt><span class="sect2"><a href="#WM_CLIENT_MACHINE_Property_2">WM_CLIENT_MACHINE Property</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Termination">Termination</a></span></dt><dt><span class="sect1"><a href="#Client_Responses_to_Session_Manager_Actions">Client Responses to Session Manager Actions</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Saving_Client_State">Saving Client State</a></span></dt><dt><span class="sect2"><a href="#Window_Deletion_2">Window Deletion</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Summary_of_Session_Manager_Property_Types">Summary of Session Manager Property Types</a></span></dt></dl></div><p>
This appendix contains obsolete conventions for session management using X
properties and messages. The conventions described here are deprecated and
are described only for historical interest. For further information on
session management, see
<span class="emphasis"><em>X Session Management Protocol</em></span>.
</p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Properties"></a>Properties</h2></div></div></div><p>
The client communicates with the session manager by placing two properties
(WM_COMMAND and WM_CLIENT_MACHINE) on its top-level window.
If the client has a group of top-level windows,
these properties should be placed on the group leader window.
</p><p>
The window manager is responsible for placing a WM_STATE property
on each top-level client window for use by session managers and other clients
that need to be able to identify top-level client windows and their state.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="WM_COMMAND_Property"></a>WM_COMMAND Property</h3></div></div></div><p>
The WM_COMMAND property represents the command used to start or restart the
client. By updating this property, clients should ensure that it always
reflects a command that will restart them in their current state. The
content and type of the property depend on the operating system of the
machine running the client. On POSIX-conformant systems using ISO Latin-1
characters for their command lines, the property should:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Be of type STRING
</p></li><li class="listitem"><p>
Contain a list of null-terminated strings
</p></li><li class="listitem"><p>
Be initialized from argv
</p><p>
Other systems will need to set appropriate conventions for the type
and contents of WM_COMMAND properties.
Window and session managers should not assume that STRING is
the type of WM_COMMAND or that they will be able to understand
or display its contents.
</p></li></ul></div><p>
Note that WM_COMMAND strings are null-terminated
and differ from the general conventions that STRING properties
are null-separated.
This inconsistency is necessary for backwards compatibility.
</p><p>
A client with multiple top-level windows should ensure
that exactly one of them has a WM_COMMAND with nonzero length.
Zero-length WM_COMMAND properties can be used to reply to WM_SAVE_YOURSELF
messages on other top-level windows but will otherwise be ignored.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="WM_CLIENT_MACHINE_Property_2"></a>WM_CLIENT_MACHINE Property</h3></div></div></div><p>
This property is described in
<a class="xref" href="#WM_CLIENT_MACHINE_Property" title="WM_CLIENT_MACHINE Property">WM_CLIENT_MACHINE Property</a>.
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Termination"></a>Termination</h2></div></div></div><p>
Because they communicate by means of unreliable network connections, clients
must be prepared for their connection to the server to be terminated at any
time without warning. They cannot depend on getting notification that
termination is imminent or on being able to use the server to negotiate with
the user about their fate. For example, clients cannot depend on being able
to put up a dialog box.
</p><p>
Similarly, clients may terminate at any time without notice to the session
manager. When a client terminates itself rather than being terminated by
the session manager, it is viewed as having resigned from the session in
question, and it will not be revived if the session is revived.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Client_Responses_to_Session_Manager_Actions"></a>Client Responses to Session Manager Actions</h2></div></div></div><p>
Clients may need to respond to session manager actions in two ways:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Saving their internal state
</p></li><li class="listitem"><p>
Deleting a window
</p></li></ul></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Saving_Client_State"></a>Saving Client State</h3></div></div></div><p>
Clients that want to be warned when the session manager feels
that they should save their internal state (for example,
when termination impends) should include the atom WM_SAVE_YOURSELF
in the WM_PROTOCOLS property on their top-level windows to participate
in the WM_SAVE_YOURSELF protocol.
They will receive a
<code class="function">ClientMessage</code>
event as described in
<a class="xref" href="#ClientMessage_Events" title="ClientMessage Events">ClientMessage Events</a>
with the atom WM_SAVE_YOURSELF in its data[0] field.
</p><p>
Clients that receive WM_SAVE_YOURSELF should place themselves in a state from
which they can be restarted and should update WM_COMMAND to
be a command that will restart them in this state.
The session manager will be waiting for a
<code class="function">PropertyNotify</code>
event on WM_COMMAND as a confirmation that the client has saved its state.
Therefore, WM_COMMAND should be updated (perhaps with a zero-length append)
even if its contents are correct.
No interactions with the user are permitted during this process.
</p><p>
Once it has received this confirmation,
the session manager will feel free to terminate the client if that is what
the user asked for.
Otherwise,
if the user asked for the session to be put to sleep,
the session manager will ensure that the client does not
receive any mouse or keyboard events.
</p><p>
After receiving a WM_SAVE_YOURSELF, saving its state, and updating WM_COMMAND,
the client should not change its state (in the sense of doing anything
that would require a change to WM_COMMAND) until it receives a mouse
or keyboard event.
Once it does so,
it can assume that the danger is over.
The session manager will ensure that these events do not reach
clients until the danger is over or until the clients have been killed.
</p><p>
Irrespective of how they are arranged in window groups,
clients with multiple top-level windows should ensure the following:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Only one of their top-level windows has a nonzero-length WM_COMMAND
property.
</p></li><li class="listitem"><p>
They respond to a WM_SAVE_YOURSELF message by:
</p><div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>
First, updating the nonzero-length WM_COMMAND property, if necessary
</p></li><li class="listitem"><p>
Second, updating the WM_COMMAND property on the window for which they received
the WM_SAVE_YOURSELF message if it was not updated in the first step
</p></li></ul></div></li></ul></div><p>
Receiving WM_SAVE_YOURSELF on a window is, conceptually, a command
to save the entire client state.
<a id="id2604837" href="#ftn.id2604837" class="footnote"><sup>[11]</sup></a>
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Window_Deletion_2"></a>Window Deletion</h3></div></div></div><p>
Windows are deleted using the WM_DELETE_WINDOW protocol, which
is described in
<a class="xref" href="#Window_Deletion" title="Window Deletion">Window Deletion</a>.
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Summary_of_Session_Manager_Property_Types"></a>Summary of Session Manager Property Types</h2></div></div></div><p>
The session manager properties are listed in the following table:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /></colgroup><thead><tr><th align="left">Name</th><th align="left">Type</th><th align="left">Format</th><th align="left">See Section</th></tr></thead><tbody><tr><td align="left">WM_CLIENT_MACHINE</td><td align="left">TEXT</td><td align="left"> </td><td align="left">
<a class="xref" href="#WM_CLIENT_MACHINE_Property" title="WM_CLIENT_MACHINE Property">WM_CLIENT_MACHINE Property</a>
</td></tr><tr><td align="left">WM_COMMAND</td><td align="left">TEXT</td><td align="left"> </td><td align="left">
<a class="xref" href="#WM_COMMAND_Property" title="WM_COMMAND Property">WM_COMMAND Property</a>
</td></tr><tr><td align="left">WM_STATE</td><td align="left">WM_STATE</td><td align="left">32</td><td align="left">
<a class="xref" href="#WM_STATE_Property" title="WM_STATE Property">WM_STATE Property</a>
</td></tr></tbody></table></div></div><div class="footnotes"><br /><hr width="100" align="left" /><div class="footnote"><p><a id="ftn.id2604837" href="#id2604837" class="para"><sup>[11] </sup></a>
This convention has changed since earlier drafts because of the
introduction of the protocol in the next section.
In the public review draft,
there was ambiguity as to whether WM_SAVE_YOURSELF was a checkpoint
or a shutdown facility.
It is now unambiguously a checkpoint facility;
if a shutdown facility is judged to be necessary,
a separate WM_PROTOCOLS protocol will be developed and registered
with the X Consortium.
</p></div></div></div></div></body></html>