aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libX11/specs/libX11/AppC.xml76
-rw-r--r--libX11/specs/libX11/AppD.xml36
-rw-r--r--libX11/specs/libX11/CH02.xml124
-rw-r--r--libX11/specs/libX11/CH03.xml58
-rw-r--r--libX11/specs/libX11/CH04.xml5020
-rw-r--r--libX11/specs/libX11/CH05.xml16
-rw-r--r--libX11/specs/libX11/CH06.xml134
-rw-r--r--libX11/specs/libX11/CH07.xml58
-rw-r--r--libX11/specs/libX11/CH08.xml88
-rw-r--r--libX11/specs/libX11/CH09.xml52
-rw-r--r--libX11/specs/libX11/CH11.xml54
-rw-r--r--libX11/specs/libX11/CH12.xml64
-rw-r--r--libX11/specs/libX11/CH13.xml132
-rw-r--r--libX11/specs/libX11/CH14.xml90
-rw-r--r--libX11/specs/libX11/CH15.xml56
-rw-r--r--libX11/specs/libX11/CH16.xml96
-rw-r--r--mesalib/src/mesa/main/texgetimage.c120
-rw-r--r--mesalib/src/mesa/state_tracker/st_format.c1456
-rw-r--r--pixman/pixman/pixman-combine.c.template4921
-rw-r--r--xorg-server/xkeyboard-config/keycodes/xfree865
-rw-r--r--xorg-server/xkeyboard-config/symbols/inet4
21 files changed, 6113 insertions, 6547 deletions
diff --git a/libX11/specs/libX11/AppC.xml b/libX11/specs/libX11/AppC.xml
index 16f7dfddb..fee71ec54 100644
--- a/libX11/specs/libX11/AppC.xml
+++ b/libX11/specs/libX11/AppC.xml
@@ -48,7 +48,7 @@ and
</para>
<indexterm significance="preferred"><primary>XQueryExtension</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xqueryextension'>
<funcprototype>
<funcdef>Bool <function>XQueryExtension</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -133,7 +133,7 @@ the strings ``thing'', ``Thing'', and ``thinG''
are all considered different names.
<indexterm significance="preferred"><primary>XListExtensions</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xlistextensions'>
<funcprototype>
<funcdef>char **<function>XListExtensions</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -175,7 +175,7 @@ then the returned strings are in the Host Portable Character Encoding.
Otherwise, the result is implementation-dependent.
<indexterm significance="preferred"><primary>XFreeExtensionList</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xfreeextensionlist'>
<funcprototype>
<funcdef><function>XFreeExtensionList</function></funcdef>
<paramdef>char<parameter> **list</parameter></paramdef>
@@ -258,7 +258,7 @@ typedef struct _XExtCodes { /* public to extension, cannot be changed */
<!-- .eM -->
<indexterm significance="preferred"><primary>XInitExtension</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xinitextension'>
<funcprototype>
<funcdef>XExtCodes *<function>XInitExtension</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -324,7 +324,7 @@ This extension number is unique only to a single connection.
<!-- .LP -->
<indexterm significance="preferred"><primary>XAddExtension</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xaddextension'>
<funcprototype>
<funcdef>XExtCodes *<function>XAddExtension</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -372,7 +372,7 @@ All of these functions return the previous procedure defined for this
extension.
<indexterm significance="preferred"><primary>XESetCloseDisplay</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xesetclosedisplay'>
<funcprototype>
<funcdef>int <function>XESetCloseDisplay</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -442,7 +442,7 @@ with these arguments:
<para>
<indexterm significance="preferred"><primary>XESetCreateGC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xesetcreategc'>
<funcprototype>
<funcdef>int *<function>XESetCreateGC</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -510,7 +510,7 @@ your procedure is called with these arguments:
</para>
<indexterm significance="preferred"><primary>XESetCopyGC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xesetcopygc'>
<funcprototype>
<funcdef>int *<function>XESetCopyGC</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -573,7 +573,7 @@ your procedure is called with these arguments:
</funcprototype>
</funcsynopsis>
</para>
-<funcsynopsis>
+<funcsynopsis id='xesetfreegc'>
<funcprototype>
<funcdef>int *<function>XESetFreeGC</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -645,7 +645,7 @@ your procedure is called with these arguments:
<!-- .eM -->
<indexterm significance="preferred"><primary>XESetCreateFont</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xesetcreatefont'>
<funcprototype>
<funcdef>int *<function>XESetCreateFont</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -726,7 +726,7 @@ your procedure is called with these arguments:
<!-- .eM -->
<indexterm significance="preferred"><primary>XESetFreeFont</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xesetfreefont'>
<funcprototype>
<funcdef>int *<function>XESetFreeFont</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -838,7 +838,7 @@ in the structure will be fully portable between machines.
<!-- .NE -->
<indexterm significance="preferred"><primary>XESetWireToEvent</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xesetwiretoevent'>
<funcprototype>
<funcdef>int *<function>XESetWireToEvent</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -948,7 +948,7 @@ with the event and use the return value.
<!-- .LP -->
<indexterm significance="preferred"><primary>_XSetLastRequestRead</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetlastrequestread'>
<funcprototype>
<funcdef>unsigned long<function>_XSetLastRequestRead</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -992,7 +992,7 @@ serial number in the event.
<!-- .LP -->
<indexterm significance="preferred"><primary>XESetEventToWire</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xeseteventtowire'>
<funcprototype>
<funcdef>Status *<function>XESetEventToWire</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1084,7 +1084,7 @@ All other members then should be copied from the host format to the
structure.
<indexterm significance="preferred"><primary>XESetWireToError</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xesetwiretoerror'>
<funcprototype>
<funcdef>Bool *<function>XESetWireToError</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1179,7 +1179,7 @@ otherwise, it should return
<symbol>True</symbol>.
<indexterm significance="preferred"><primary>XESetError</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xeseterror'>
<funcprototype>
<funcdef>int *<function>XESetError</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1269,7 +1269,7 @@ the error is suppressed, and
returns the value of ret_code.
<indexterm significance="preferred"><primary>XESetErrorString</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xeseterrorstring'>
<funcprototype>
<funcdef>char *<function>XESetErrorString</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1345,7 +1345,7 @@ You should copy nbytes of a null-terminated string containing the
error message into buffer.
<indexterm significance="preferred"><primary>XESetPrintErrorValues</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xesetprinterrorvalues'>
<funcprototype>
<funcdef>void *<function>XESetPrintErrorValues</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1427,7 +1427,7 @@ The underlying type of the fp argument is system dependent;
on a <acronym>POSIX</acronym>-compliant system, fp should be cast to type FILE*.
<indexterm significance="preferred"><primary>XESetFlushGC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xesetflushgc'>
<funcprototype>
<funcdef>int *<function>XESetFlushGC</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1617,7 +1617,7 @@ union { Display *display;
<!-- .eM -->
<indexterm significance="preferred"><primary>XEHeadOfExtensionList</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xeheadofextensionlist'>
<funcprototype>
<funcdef>XExtData **<function>XEHeadOfExtensionList</function></funcdef>
<paramdef>XEDataObject<parameter> object</parameter></paramdef>
@@ -1655,7 +1655,7 @@ of types contained in
<!-- .LP -->
<indexterm significance="preferred"><primary>XAddToExtensionList</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xaddtoextensionlist'>
<funcprototype>
<funcdef><function>XAddToExtensionList</function></funcdef>
<paramdef>XExtData<parameter> **structure</parameter></paramdef>
@@ -1695,7 +1695,7 @@ You must initialize ext_data-&gt;number with the extension number
before calling this function.
<indexterm significance="preferred"><primary>XFindOnExtensionList</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xfindonextensionlist'>
<funcprototype>
<funcdef>XExtData *<function>XFindOnExtensionList</function></funcdef>
<paramdef>struct_XExtData<parameter> **structure</parameter></paramdef>
@@ -1746,7 +1746,7 @@ macro, which allocates and returns a resource ID, is defined in
&lt;X11/Xlib.h&gt;.
<indexterm significance="preferred"><primary>XAllocID</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xallocid'>
<funcprototype>
<funcdef><function>XAllocID</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1781,7 +1781,7 @@ The
macro allocates and returns an array of resource ID.
<indexterm significance="preferred"><primary>XAllocIDs</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xallocids'>
<funcprototype>
<funcdef><function>XAllocIDs</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1858,7 +1858,7 @@ The
macro is defined as follows:
<indexterm significance="preferred"><primary>FlushGC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='flushgc'>
<funcprototype>
<funcdef><function>FlushGC</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1908,7 +1908,7 @@ procedure
is defined as follows:
<indexterm significance="preferred"><primary>_XFlushGCCache</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='_xflushgccache'>
<funcprototype>
<funcdef><function>_XFlushGCCache</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2331,7 +2331,7 @@ architecture.
Two calls, which are generally implemented as macros, have been provided.
<indexterm significance="preferred"><primary>LockDisplay</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='lockdisplay'>
<funcprototype>
<funcdef><function>LockDisplay</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2342,7 +2342,7 @@ Two calls, which are generally implemented as macros, have been provided.
<para>
<!-- .LP -->
<indexterm significance="preferred"><primary>UnlockDisplay</primary></indexterm>
-<funcsynopsis>
+<funcsynopsis id='unlockdisplay'>
<funcprototype>
<funcdef><function>UnlockDisplay</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2526,7 +2526,7 @@ macros take three arguments:
the display, a pointer to the beginning of the data,
and the number of bytes to be sent.
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='data'>
<funcprototype>
<funcdef><function>Data</function></funcdef>
<paramdef><parameter> display</parameter></paramdef>
@@ -2582,7 +2582,7 @@ If any events arrive in the meantime,
places them in the queue for later use.
<indexterm significance="preferred"><primary>_XReply</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='_xreply'>
<funcprototype>
<funcdef>Status <function>_XReply</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2750,7 +2750,7 @@ function to read the variable-length data.
<para>
<!-- .LP -->
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='_xread'>
<funcprototype>
<funcdef><function>_XRead</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2802,7 +2802,7 @@ function reads the specified number of bytes into data_return.
<para>
<!-- .LP -->
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='_xread16'>
<funcprototype>
<funcdef><function>_XRead16</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2856,7 +2856,7 @@ into the specified array as shorts.
<para>
<!-- .LP -->
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='_xread32'>
<funcprototype>
<funcdef><function>_XRead32</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2910,7 +2910,7 @@ into the specified array as longs.
<para>
<!-- .LP -->
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='_xread16pad'>
<funcprototype>
<funcdef><function>_XRead16Pad</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2967,7 +2967,7 @@ reads and discards up to two additional pad bytes.
<para>
<!-- .LP -->
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='_xreadpad'>
<funcprototype>
<funcdef><function>_XReadPad</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3067,7 +3067,7 @@ The following function returns a scratch buffer for use within a
critical section:
<indexterm significance="preferred"><primary>_XAllocScratch</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='_xallocscratch'>
<funcprototype>
<funcdef>char *<function>_XAllocScratch</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3124,7 +3124,7 @@ The following function returns a scratch buffer for use across
critical sections:
<indexterm significance="preferred"><primary>_XAllocTemp</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='_xalloctemp'>
<funcprototype>
<funcdef>char *<function>_XAllocTemp</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3163,7 +3163,7 @@ execute inside Xlib. The storage must be explicitly returned to Xlib.
The following function returns the storage:
<indexterm significance="preferred"><primary>_XFreeTemp</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='_xfreetemp'>
<funcprototype>
<funcdef>void <function>_XFreeTemp</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
diff --git a/libX11/specs/libX11/AppD.xml b/libX11/specs/libX11/AppD.xml
index 0d060069e..c657f0ddd 100644
--- a/libX11/specs/libX11/AppD.xml
+++ b/libX11/specs/libX11/AppD.xml
@@ -55,7 +55,7 @@ and sets all or portions of the
and <property>WM_NORMAL_HINTS</property> properties.
<indexterm significance="preferred"><primary>XSetStandardProperties</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetstandardproperties'>
<funcprototype>
<funcdef><function>XSetStandardProperties</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -204,7 +204,7 @@ This function has been superseded by
<function>XSetWMNormalHints</function>.
<indexterm significance="preferred"><primary>XSetNormalHints</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetnormalhints'>
<funcprototype>
<funcdef><function>XSetNormalHints</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -293,7 +293,7 @@ This function has been superseded by
<function>XGetWMNormalHints</function>.
<indexterm significance="preferred"><primary>XGetNormalHints</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetnormalhints'>
<funcprototype>
<funcdef>Status <function>XGetNormalHints</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -364,7 +364,7 @@ This function is no longer supported by the
<emphasis remap='I'>Inter-Client Communication Conventions Manual</emphasis>.
<indexterm significance="preferred"><primary>XSetZoomHints</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetzoomhints'>
<funcprototype>
<funcdef><function>XSetZoomHints</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -434,7 +434,7 @@ This function is no longer supported by the
<emphasis remap='I'>Inter-Client Communication Conventions Manual</emphasis>.
<indexterm significance="preferred"><primary>XGetZoomHints</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetzoomhints'>
<funcprototype>
<funcdef>Status <function>XGetZoomHints</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -501,7 +501,7 @@ This function has been superseded by
<function>XSetWMSizeHints</function>.
<indexterm significance="preferred"><primary>XSetSizeHints</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetsizehints'>
<funcprototype>
<funcdef><function>XSetSizeHints</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -588,7 +588,7 @@ This function has been superseded by
<function>XGetWMSizeHints</function>.
<indexterm significance="preferred"><primary>XGetSizeHints</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetsizehints'>
<funcprototype>
<funcdef>Status <function>XGetSizeHints</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -681,7 +681,7 @@ This function has been superseded by
<function>XGetRGBColormaps</function>.
<indexterm significance="preferred"><primary>XGetStandardColormap</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetstandardcolormap'>
<funcprototype>
<funcdef>Status <function>XGetStandardColormap</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -773,7 +773,7 @@ This function has been superseded by
<function>XSetRGBColormaps</function>.
<indexterm significance="preferred"><primary>XSetStandardColormap</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetstandardcolormap'>
<funcprototype>
<funcdef><function>XSetStandardColormap</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -856,7 +856,7 @@ This function has been superseded by
<indexterm><primary>Window</primary><secondary>determining location</secondary></indexterm>
<indexterm significance="preferred"><primary>XGeometry</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgeometry'>
<funcprototype>
<funcdef>int <function>XGeometry</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1058,7 +1058,7 @@ It is only useful in very simple applications.
<!-- .sp -->
<indexterm significance="preferred"><primary>XGetDefault</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetdefault'>
<funcprototype>
<funcdef>char *<function>XGetDefault</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1253,7 +1253,7 @@ use
#include &lt;X11/X10.h&gt;
</para>
-<funcsynopsis>
+<funcsynopsis id='xdraw'>
<funcprototype>
<funcdef>Status <function>XDraw</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1460,7 +1460,7 @@ use
<para>#include &lt;X11/X10.h&gt;</para>
-<funcsynopsis>
+<funcsynopsis id='xdrawfilled'>
<funcprototype>
<funcdef>Status <function>XDrawFilled</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1616,7 +1616,7 @@ use
<indexterm significance="preferred"><primary>XCreateAssocTable</primary></indexterm>
<!-- .sM -->
</para>
-<funcsynopsis>
+<funcsynopsis id='xcreateassoctable'>
<funcprototype>
<funcdef>XAssocTable *<function>XCreateAssocTable</function></funcdef>
<paramdef>int<parameter> size</parameter></paramdef>
@@ -1662,7 +1662,7 @@ use
<indexterm significance="preferred"><primary>XMakeAssoc</primary></indexterm>
<!-- .sM -->
</para>
-<funcsynopsis>
+<funcsynopsis id='xmakeassoc'>
<funcprototype>
<funcdef><function>XMakeAssoc</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1736,7 +1736,7 @@ use
<function>XLookUpAssoc</function>.
<indexterm significance="preferred"><primary>XLookUpAssoc</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xlookupassoc'>
<funcprototype>
<funcdef>char *<function>XLookUpAssoc</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1801,7 +1801,7 @@ use
<function>XDeleteAssoc</function>.
<indexterm significance="preferred"><primary>XDeleteAssoc</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdeleteassoc'>
<funcprototype>
<funcdef><function>XDeleteAssoc</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1865,7 +1865,7 @@ use
</para>
<indexterm significance="preferred"><primary>XDestroyAssocTable</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdestroyassoctable'>
<funcprototype>
<funcdef><function>XDestroyAssocTable</function></funcdef>
<paramdef>XAssocTable<parameter> *table</parameter></paramdef>
diff --git a/libX11/specs/libX11/CH02.xml b/libX11/specs/libX11/CH02.xml
index 4912f71ed..009322306 100644
--- a/libX11/specs/libX11/CH02.xml
+++ b/libX11/specs/libX11/CH02.xml
@@ -66,7 +66,7 @@ To open a connection to the X server that controls a display, use
<function>XOpenDisplay</function>.
<indexterm significance="preferred"><primary>XOpenDisplay</primary></indexterm>
</para>
-<funcsynopsis>
+<funcsynopsis id='xopendisplay'>
<funcprototype>
<funcdef>Display *<function>XOpenDisplay</function></funcdef>
<paramdef>char *<parameter>display_name</parameter></paramdef>
@@ -356,7 +356,7 @@ The names are intended to convey the expected relative intensity of the colors.
<para>
BlackPixel(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xblackpixel'>
<funcprototype>
<funcdef>unsigned long <function>XBlackPixel</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -401,7 +401,7 @@ Both return the black pixel value for the specified screen.
<para>
WhitePixel(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xwhitepixel'>
<funcprototype>
<funcdef>unsigned long <function>XWhitePixel</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -446,7 +446,7 @@ Both return the white pixel value for the specified screen.
<para>
ConnectionNumber(<emphasis remap='I'>display</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xconnectionnumber'>
<funcprototype>
<funcdef>int <function>XConnectionNumber</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -483,7 +483,7 @@ this is the file descriptor of the connection.
<para>
DefaultColormap(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xdefaultcolormap'>
<funcprototype>
<funcdef>Colormap <function>XDefaultColormap</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -529,7 +529,7 @@ Most routine allocations of color should be made out of this colormap.
<para>
DefaultDepth(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xdefaultdepth'>
<funcprototype>
<funcdef>int <function>XDefaultDepth</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -580,7 +580,7 @@ To determine the number of depths that are available on a given screen, use
<para>
DefaultGC(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xdefaultgc'>
<funcprototype>
<funcdef>GC <function>XDefaultGC</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -698,7 +698,7 @@ This GC should never be freed.
<para>
DefaultRootWindow(<emphasis remap='I'>display</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xdefaultrootwindow'>
<funcprototype>
<funcdef>Window <function>XDefaultRootWindow</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -732,7 +732,7 @@ Both return the root window for the default screen.
<para>
DefaultScreenOfDisplay(<emphasis remap='I'>display</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xdefaultscreenofdisplay'>
<funcprototype>
<funcdef>Screen *<function>XDefaultScreenOfDisplay</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -766,7 +766,7 @@ Both return a pointer to the default screen.
<para>
ScreenOfDisplay(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xscreenofdisplay'>
<funcprototype>
<funcdef>Screen *<function>XScreenOfDisplay</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -811,7 +811,7 @@ Both return a pointer to the indicated screen.
<para>
DefaultScreen(<emphasis remap='I'>display</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xdefaultscreen'>
<funcprototype>
<funcdef>int <function>XDefaultScreen</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -849,7 +849,7 @@ in applications that will use only a single screen.
<para>
DefaultVisual(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xdefaultvisual'>
<funcprototype>
<funcdef>Visual *<function>XDefaultVisual</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -896,7 +896,7 @@ see section 3.1.
<para>
DisplayCells(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xdisplaycells'>
<funcprototype>
<funcdef>int <function>XDisplayCells</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -941,7 +941,7 @@ Both return the number of entries in the default colormap.
<para>
DisplayPlanes(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xdisplayplanes'>
<funcprototype>
<funcdef>int <function>XDisplayPlanes</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -988,7 +988,7 @@ see the glossary.
<para>
DisplayString(<emphasis remap='I'>display</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xdisplaystring'>
<funcprototype>
<funcdef>char *<function>XDisplayString</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1032,7 +1032,7 @@ child process as well as for printing error messages.
<para>
LastKnownRequestProcessed(<emphasis remap='I'>display</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xlastknownrequestprocessed'>
<funcprototype>
<funcdef>unsigned long <function>XLastKnownRequestProcessed</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1175,7 +1175,7 @@ are received.
<para>
NextRequest(<emphasis remap='I'>display</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xnextrequest'>
<funcprototype>
<funcdef>unsigned long <function>XNextRequest</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1211,7 +1211,7 @@ Serial numbers are maintained separately for each display connection.
<para>
ProtocolVersion(<emphasis remap='I'>display</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xprotocolversion'>
<funcprototype>
<funcdef>int <function>XProtocolVersion</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1246,7 +1246,7 @@ the connected display.
<para>
ProtocolRevision(<emphasis remap='I'>display</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xprotocolrevision'>
<funcprototype>
<funcdef>int <function>XProtocolRevision</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1280,7 +1280,7 @@ Both return the minor protocol revision number of the X server.
<para>
QLength(<emphasis remap='I'>display</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xqlength'>
<funcprototype>
<funcdef>int <function>XQLength</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1317,7 +1317,7 @@ the queue yet (see
<para>
RootWindow(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xrootwindow'>
<funcprototype>
<funcdef>Window <function>XRootWindow</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1366,7 +1366,7 @@ and for creating top-level windows.
<para>
ScreenCount(<emphasis remap='I'>display</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xscreencount'>
<funcprototype>
<funcdef>int <function>XScreenCount</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1400,7 +1400,7 @@ Both return the number of available screens.
<para>
ServerVendor(<emphasis remap='I'>display</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xservervendor'>
<funcprototype>
<funcdef>char *<function>XServerVendor</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1438,7 +1438,7 @@ Otherwise, the contents of the string are implementation-dependent.
<para>
VendorRelease(<emphasis remap='I'>display</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xvendorrelease'>
<funcprototype>
<funcdef>int <function>XVendorRelease</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1511,7 +1511,7 @@ To obtain the pixmap format information for a given display, use
<para>
ImageByteOrder(<emphasis remap='I'>display</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='ximagebyteorder'>
<funcprototype>
<funcdef>int <function>XImageByteOrder</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1614,7 +1614,7 @@ or
<para>
BitmapUnit(<emphasis remap='I'>display</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xbitmapunit'>
<funcprototype>
<funcdef>int <function>XBitmapUnit</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1649,7 +1649,7 @@ The scanline is calculated in multiples of this value.
<para>
BitmapBitOrder(<emphasis remap='I'>display</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xbitmpabitorder'>
<funcprototype>
<funcdef>int <function>XBitmapBitOrder</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1689,7 +1689,7 @@ or
<para>
BitmapPad(<emphasis remap='I'>display</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xbitmappad'>
<funcprototype>
<funcdef>int <function>XBitmapPad</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1724,7 +1724,7 @@ by this macro or function.
<para>
DisplayHeight(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xdisplayheight'>
<funcprototype>
<funcdef>int <function>XDisplayHeight</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1770,7 +1770,7 @@ in pixels.
<para>
DisplayHeightMM(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xdisplayheightmm'>
<funcprototype>
<funcdef>int <function>XDisplayHeightMM</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1815,7 +1815,7 @@ Both return the height of the specified screen in millimeters.
<para>
DisplayWidth(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xdisplaywidth'>
<funcprototype>
<funcdef>int <function>XDisplayWidth</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1860,7 +1860,7 @@ Both return the width of the screen in pixels.
<para>
DisplayWidthMM(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xdisplaywidthmm'>
<funcprototype>
<funcdef>int <function>XDisplayWidthMM</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1919,7 +1919,7 @@ structure.
<para>
BlackPixelOfScreen(<emphasis remap='I'>screen</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xblackpixelofscreen'>
<funcprototype>
<funcdef>unsigned long <function>XBlackPixelOfScreen</function></funcdef>
<paramdef>Screen<parameter> *screen</parameter></paramdef>
@@ -1955,7 +1955,7 @@ Both return the black pixel value of the specified screen.
<para>
WhitePixelOfScreen(<emphasis remap='I'>screen</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xwhitepixelofscreen'>
<funcprototype>
<funcdef>unsigned long <function>XWhitePixelOfScreen</function></funcdef>
<paramdef>Screen<parameter> *screen</parameter></paramdef>
@@ -1991,7 +1991,7 @@ Both return the white pixel value of the specified screen.
<para>
CellsOfScreen(<emphasis remap='I'>screen</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xcellsofscreen'>
<funcprototype>
<funcdef>int <function>XCellsOfScreen</function></funcdef>
<paramdef>Screen<parameter> *screen</parameter></paramdef>
@@ -2028,7 +2028,7 @@ of the specified screen.
<para>
DefaultColormapOfScreen(<emphasis remap='I'>screen</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xdefaultcolormapofscreen'>
<funcprototype>
<funcdef>Colormap <function>XDefaultColormapOfScreen</function></funcdef>
<paramdef>Screen<parameter> *screen</parameter></paramdef>
@@ -2064,7 +2064,7 @@ Both return the default colormap of the specified screen.
<para>
DefaultDepthOfScreen(<emphasis remap='I'>screen</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xdefaultdepthofscreen'>
<funcprototype>
<funcdef>int <function>XDefaultDepthOfScreen</function></funcdef>
<paramdef>Screen<parameter> *screen</parameter></paramdef>
@@ -2100,7 +2100,7 @@ Both return the depth of the root window.
<para>
DefaultGCOfScreen(<emphasis remap='I'>screen</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xdefaultgcofscreen'>
<funcprototype>
<funcdef>GC <function>XDefaultGCOfScreen</function></funcdef>
<paramdef>Screen<parameter> *screen</parameter></paramdef>
@@ -2138,7 +2138,7 @@ The GC must never be freed.
<para>
DefaultVisualOfScreen(<emphasis remap='I'>screen</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xdefaultvisualofscreen'>
<funcprototype>
<funcdef>Visual *<function>XDefaultVisualOfScreen</function></funcdef>
<paramdef>Screen<parameter> *screen</parameter></paramdef>
@@ -2176,7 +2176,7 @@ see section 3.1.
<para>
DoesBackingStore(<emphasis remap='I'>screen</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xdoesbackingstore'>
<funcprototype>
<funcdef>int <function>XDoesBackingStore</function></funcdef>
<paramdef>Screen<parameter> *screen</parameter></paramdef>
@@ -2219,7 +2219,7 @@ or
<para>
DoesSaveUnders(<emphasis remap='I'>screen</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xdoessaveunders'>
<funcprototype>
<funcdef>Bool <function>XDoesSaveUnders</function></funcdef>
<paramdef>Screen<parameter> *screen</parameter></paramdef>
@@ -2262,7 +2262,7 @@ the screen does not support save unders (see section 3.2.5).
<para>
DisplayOfScreen(<emphasis remap='I'>screen</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xdisplayofscreen'>
<funcprototype>
<funcdef>Display *<function>XDisplayOfScreen</function></funcdef>
<paramdef>Screen<parameter> *screen</parameter></paramdef>
@@ -2299,7 +2299,7 @@ Both return the display of the specified screen.
<para>
EventMaskOfScreen(<emphasis remap='I'>screen</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xeventmaskofscreen'>
<funcprototype>
<funcdef>long <function>XEventMaskOfScreen</function></funcdef>
<paramdef>Screen<parameter> *screen</parameter></paramdef>
@@ -2372,7 +2372,7 @@ at connection setup time.
<para>
WidthOfScreen(<emphasis remap='I'>screen</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xwidthofscreen'>
<funcprototype>
<funcdef>int <function>XWidthOfScreen</function></funcdef>
<paramdef>Screen<parameter> *screen</parameter></paramdef>
@@ -2408,7 +2408,7 @@ Both return the width of the specified screen in pixels.
<para>
HeightOfScreen(<emphasis remap='I'>screen</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xheightofscreen'>
<funcprototype>
<funcdef>int <function>XHeightOfScreen</function></funcdef>
<paramdef>Screen<parameter> *screen</parameter></paramdef>
@@ -2444,7 +2444,7 @@ Both return the height of the specified screen in pixels.
<para>
WidthMMOfScreen(<emphasis remap='I'>screen</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xwidthmmofscreen'>
<funcprototype>
<funcdef>int <function>XWidthMMOfScreen</function></funcdef>
<paramdef>Screen<parameter> *screen</parameter></paramdef>
@@ -2480,7 +2480,7 @@ Both return the width of the specified screen in millimeters.
<para>
HeightMMOfScreen(<emphasis remap='I'>screen</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xheightmmofscreen'>
<funcprototype>
<funcdef>int <function>XHeightMMOfScreen</function></funcdef>
<paramdef>Screen<parameter> *screen</parameter></paramdef>
@@ -2516,7 +2516,7 @@ Both return the height of the specified screen in millimeters.
<para>
MaxCmapsOfScreen(<emphasis remap='I'>screen</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xmaxcmapsofscreen'>
<funcprototype>
<funcdef>int <function>XMaxCmapsOfScreen</function></funcdef>
<paramdef>Screen<parameter> *screen</parameter></paramdef>
@@ -2553,7 +2553,7 @@ by the specified screen (see section 9.3).
<para>
MinCmapsOfScreen(<emphasis remap='I'>screen</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xmincmapsofscreen'>
<funcprototype>
<funcdef>int <function>XMinCmapsOfScreen</function></funcdef>
<paramdef>Screen<parameter> *screen</parameter></paramdef>
@@ -2590,7 +2590,7 @@ by the specified screen (see section 9.3).
<para>
PlanesOfScreen(<emphasis remap='I'>screen</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xplanesofscreen'>
<funcprototype>
<funcdef>int <function>XPlanesOfScreen</function></funcdef>
<paramdef>Screen<parameter> *screen</parameter></paramdef>
@@ -2626,7 +2626,7 @@ Both return the depth of the root window.
<para>
RootWindowOfScreen(<emphasis remap='I'>screen</emphasis>)
</para>
-<funcsynopsis>
+<funcsynopsis id='xrootwindowofscreen'>
<funcprototype>
<funcdef>Window <function>XRootWindowOfScreen</function></funcdef>
<paramdef>Screen<parameter> *screen</parameter></paramdef>
@@ -2670,7 +2670,7 @@ protocol request, use
<indexterm significance="preferred"><primary>XNoOp</primary></indexterm>
<!-- .sM -->
</para>
-<funcsynopsis>
+<funcsynopsis id='xnoop'>
<funcprototype>
<funcdef><function>XNoOp</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2708,7 +2708,7 @@ To free in-memory data that was created by an Xlib function, use
<indexterm significance="preferred"><primary>XFree</primary></indexterm>
<!-- .sM -->
</para>
-<funcsynopsis>
+<funcsynopsis id='xfree'>
<funcprototype>
<funcdef>XFree</funcdef>
<paramdef>void<parameter> *data</parameter></paramdef>
@@ -2754,7 +2754,7 @@ To close a display or disconnect from the X server, use
<!-- .LP -->
<!-- .sM -->
</para>
-<funcsynopsis>
+<funcsynopsis id='xclosedisplay'>
<funcprototype>
<funcdef>XCloseDisplay</funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2822,7 +2822,7 @@ To change a client's close-down mode, use
<indexterm significance="preferred"><primary>XSetCloseDownMode</primary></indexterm>
<!-- .sM -->
</para>
-<funcsynopsis>
+<funcsynopsis id='xsetclosedownmode'>
<funcprototype>
<funcdef>XSetCloseDownMode</funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3107,7 +3107,7 @@ To lock a display across several Xlib calls, use
<indexterm significance="preferred"><primary>XLockDisplay</primary></indexterm>
<!-- .sM -->
</para>
-<funcsynopsis>
+<funcsynopsis id='xlockdisplay'>
<funcprototype>
<funcdef>XLockDisplay</funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3152,7 +3152,7 @@ To unlock a display, use
<indexterm significance="preferred"><primary>XUnlockDisplay</primary></indexterm>
<!-- .sM -->
</para>
-<funcsynopsis>
+<funcsynopsis id='xunlockdisplay'>
<funcprototype>
<funcdef>XUnlockDisplay</funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3211,7 +3211,7 @@ facilities.
To track internal connections for a display, use
<function>XAddConnectionWatch</function>.
</para>
-<funcsynopsis>
+<funcsynopsis id='xconnectionwatch'>
<funcprototype>
<funcdef>type void XConnectionWatchProc</funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3222,7 +3222,7 @@ To track internal connections for a display, use
</funcprototype>
</funcsynopsis>
-<funcsynopsis>
+<funcsynopsis id='xaddconnectionwatch'>
<funcprototype>
<funcdef>Status XAddConnectionWatch</funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3313,7 +3313,7 @@ To stop tracking internal connections for a display, use
<para>
()
</para>
-<funcsynopsis>
+<funcsynopsis id='xremoveconnectionwatch'>
<funcprototype>
<funcdef>Status <function>XRemoveConnectionWatch</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3375,7 +3375,7 @@ To process input on an internal connection, use
<para>
()
</para>
-<funcsynopsis>
+<funcsynopsis id='xprocessinternalconnection'>
<funcprototype>
<funcdef>void <function>XProcessInternalConnection</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3430,7 +3430,7 @@ To obtain all of the current internal connections for a display, use
<para>
()
</para>
-<funcsynopsis>
+<funcsynopsis id='xinternalconnectionnumbers'>
<funcprototype>
<funcdef>Status <function>XInternalConnectionNumbers</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
diff --git a/libX11/specs/libX11/CH03.xml b/libX11/specs/libX11/CH03.xml
index 645960797..c66caa497 100644
--- a/libX11/specs/libX11/CH03.xml
+++ b/libX11/specs/libX11/CH03.xml
@@ -176,7 +176,7 @@ use
<function>XVisualIDFromVisual</function>.
<indexterm significance="preferred"><primary>XVisualIDFromVisual</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xvisualidfromvisual'>
<funcprototype>
<funcdef>VisualID <function>XVisualIDFromVisual</function></funcdef>
<paramdef>Visual *<parameter>visual</parameter></paramdef>
@@ -1241,7 +1241,7 @@ To create an unmapped window and set its window attributes, use
<function>XCreateWindow</function>.
<indexterm significance="preferred"><primary>XCreateWindow</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcreatewindow'>
<funcprototype>
<funcdef>Window <function>XCreateWindow</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1506,7 +1506,7 @@ subwindow of a given parent window, use
<function>XCreateSimpleWindow</function>.
<indexterm significance="preferred"><primary>XCreateSimpleWindow</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcreatesimplewindow'>
<funcprototype>
<funcdef>Window <function>XCreateSimpleWindow</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1676,7 +1676,7 @@ To destroy a window and all of its subwindows, use
<function>XDestroyWindow</function>.
<indexterm significance="preferred"><primary>XDestroyWindow</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdestroywindow'>
<funcprototype>
<funcdef><function>XDestroyWindow</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1746,7 +1746,7 @@ To destroy all subwindows of a specified window, use
<function>XDestroySubwindows</function>.
<indexterm significance="preferred"><primary>XDestroySubwindows</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdestroysubwindows'>
<funcprototype>
<funcdef><function>XDestroySubwindows</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1889,7 +1889,7 @@ To map a given window, use
<function>XMapWindow</function>.
<indexterm significance="preferred"><primary>XMapWindow</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xmapwindow'>
<funcprototype>
<funcdef><function>XMapWindow</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2015,7 +2015,7 @@ To map and raise a window, use
<function>XMapRaised</function>.
<indexterm significance="preferred"><primary>XMapRaised</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xmapraised'>
<funcprototype>
<funcdef><function>XMapRaised</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2075,7 +2075,7 @@ To map all subwindows for a specified window, use
<function>XMapSubwindows</function>.
<indexterm significance="preferred"><primary>XMapSubwindows</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xmapsubwindows'>
<funcprototype>
<funcdef><function>XMapSubwindows</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2145,7 +2145,7 @@ To unmap a window, use
<function>XUnmapWindow</function>.
<indexterm significance="preferred"><primary>XUnmapWindow</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xunmapwindow'>
<funcprototype>
<funcdef><function>XUnmapWindow</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2212,7 +2212,7 @@ To unmap all subwindows for a specified window, use
<function>XUnmapSubwindows</function>.
<indexterm significance="preferred"><primary>XUnmapSubwindows</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xunmapsubwindows'>
<funcprototype>
<funcdef><function>XUnmapSubwindows</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2517,7 +2517,7 @@ To configure a window's size, location, stacking, or border, use
<function>XConfigureWindow</function>.
<indexterm significance="preferred"><primary>XConfigureWindow</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xconfigurewindow'>
<funcprototype>
<funcdef><function>XConfigureWindow</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2623,7 +2623,7 @@ To move a window without changing its size, use
<function>XMoveWindow</function>.
<indexterm significance="preferred"><primary>XMoveWindow</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xmovewindow'>
<funcprototype>
<funcdef><function>XMoveWindow</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2725,7 +2725,7 @@ To change a window's size without changing the upper-left coordinate, use
<function>XResizeWindow</function>.
<indexterm significance="preferred"><primary>XResizeWindow</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xresizewindow'>
<funcprototype>
<funcdef><function>XResizeWindow</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2828,7 +2828,7 @@ To change the size and location of a window, use
<function>XMoveResizeWindow</function>.
<indexterm significance="preferred"><primary>XMoveResizeWindow</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xmoveresizewindow'>
<funcprototype>
<funcdef><function>XMoveResizeWindow</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2949,7 +2949,7 @@ To change the border width of a given window, use
<function>XSetWindowBorderWidth</function>.
<indexterm significance="preferred"><primary>XSetWindowBorderWidth</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetwindowborderwidth'>
<funcprototype>
<funcdef><function>XSetWindowBorderWidth</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3026,7 +3026,7 @@ To raise a window so that no sibling window obscures it, use
<function>XRaiseWindow</function>.
<indexterm significance="preferred"><primary>XRaiseWindow</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xraisewindow'>
<funcprototype>
<funcdef><function>XRaiseWindow</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3099,7 +3099,7 @@ To lower a window so that it does not obscure any sibling windows, use
<function>XLowerWindow</function>.
<indexterm significance="preferred"><primary>XLowerWindow</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xlowerwindow'>
<funcprototype>
<funcdef><function>XLowerWindow</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3173,7 +3173,7 @@ To circulate a subwindow up or down, use
<function>XCirculateSubwindows</function>.
<indexterm significance="preferred"><primary>XCirculateSubwindows</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcirculatesubwindows'>
<funcprototype>
<funcdef><function>XCirculateSubwindows</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3265,7 +3265,7 @@ occluded by another child, use
<function>XCirculateSubwindowsUp</function>.
<indexterm significance="preferred"><primary>XCirculateSubwindowsUp</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcirculatesubwindowsup'>
<funcprototype>
<funcdef><function>XCirculateSubwindowsUp</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3327,7 +3327,7 @@ completely occludes another child, use
<function>XCirculateSubwindowsDown</function>.
<indexterm significance="preferred"><primary>XCirculateSubwindowsDown</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcirculatesubwindowsdown'>
<funcprototype>
<funcdef><function>XCirculateSubwindowsDown</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3386,7 +3386,7 @@ To restack a set of windows from top to bottom, use
<function>XRestackWindows</function>.
<indexterm significance="preferred"><primary>XRestackWindows</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrestackwindows'>
<funcprototype>
<funcdef><function>XRestackWindows</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3491,7 +3491,7 @@ To change one or more attributes for a given window, use
<function>XChangeWindowAttributes</function>.
<indexterm significance="preferred"><primary>XChangeWindowAttributes</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xchangewindowattributes'>
<funcprototype>
<funcdef><function>XChangeWindowAttributes</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3649,7 +3649,7 @@ To set the background of a window to a given pixel, use
<function>XSetWindowBackground</function>.
<indexterm significance="preferred"><primary>XSetWindowBackground</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetwindowbackground'>
<funcprototype>
<funcdef><function>XSetWindowBackground</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3726,7 +3726,7 @@ To set the background of a window to a given pixmap, use
<indexterm><primary>Window</primary><secondary>background</secondary></indexterm>
<indexterm significance="preferred"><primary>XSetWindowBackgroundPixmap</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetwindowbackgroundpixmap'>
<funcprototype>
<funcdef><function>XSetWindowBackgroundPixmap</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3818,7 +3818,7 @@ To change and repaint a window's border to a given pixel, use
<function>XSetWindowBorder</function>.
<indexterm significance="preferred"><primary>XSetWindowBorder</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetwindowborder'>
<funcprototype>
<funcdef><function>XSetWindowBorder</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3888,7 +3888,7 @@ To change and repaint the border tile of a given window, use
<function>XSetWindowBorderPixmap</function>.
<indexterm significance="preferred"><primary>XSetWindowBorderPixmap</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetwindowborderpixmap'>
<funcprototype>
<funcdef><function>XSetWindowBorderPixmap</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3967,7 +3967,7 @@ To set the colormap of a given window, use
<function>XSetWindowColormap</function>.
<indexterm significance="preferred"><primary>XSetWindowColormap</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetwindowcolormap'>
<funcprototype>
<funcdef><function>XSetWindowColormap</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -4038,7 +4038,7 @@ To define which cursor will be used in a window, use
<indexterm><primary>Window</primary><secondary>defining the cursor</secondary></indexterm>
<indexterm significance="preferred"><primary>XDefineCursor</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdefinecursor'>
<funcprototype>
<funcdef><function>XDefineCursor</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -4107,7 +4107,7 @@ To undefine the cursor in a given window, use
<indexterm><primary>Window</primary><secondary>undefining the cursor</secondary></indexterm>
<indexterm significance="preferred"><primary>XUndefineCursor</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xundefinecursor'>
<funcprototype>
<funcdef><function>XUndefineCursor</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
diff --git a/libX11/specs/libX11/CH04.xml b/libX11/specs/libX11/CH04.xml
index 8a3e8c535..5428fd22e 100644
--- a/libX11/specs/libX11/CH04.xml
+++ b/libX11/specs/libX11/CH04.xml
@@ -1,2510 +1,2510 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
-<chapter id="window_information_functions">
-<title>Window Information Functions</title>
-
-<para>
-After you connect the display to the X server and create a window, you can use the Xlib window
-information functions to:
-</para>
-<itemizedlist>
- <listitem><para>Obtain information about a window</para></listitem>
- <listitem><para>Translate screen coordinates</para></listitem>
- <listitem><para>Manipulate property lists</para></listitem>
- <listitem><para>Obtain and change window properties</para></listitem>
- <listitem><para>Manipulate selections</para></listitem>
-</itemizedlist>
-
-<sect1 id="Obtaining_Window_Information">
-<title>Obtaining Window Information</title>
-<!-- .XS -->
-<!-- (SN Obtaining Window Information -->
-<!-- .XE -->
-<para>
-<!-- .LP -->
-Xlib provides functions that you can use to obtain information about
-the window tree, the window's current attributes,
-the window's current geometry, or the current pointer coordinates.
-Because they are most frequently used by window managers,
-these functions all return a status to indicate whether the window still
-exists.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-To obtain the parent, a list of children, and number of children for
-a given window, use
-<function>XQueryTree</function>.
-<indexterm><primary>Child Window</primary></indexterm>
-<indexterm><primary>Parent Window</primary></indexterm>
-<indexterm significance="preferred"><primary>XQueryTree</primary></indexterm>
-<!-- .sM -->
-<funcsynopsis>
-<funcprototype>
- <funcdef>Status <function>XQueryTree</function></funcdef>
- <paramdef>Display<parameter> *display</parameter></paramdef>
- <paramdef>Window<parameter> w</parameter></paramdef>
- <paramdef>Window<parameter> *root_return</parameter></paramdef>
- <paramdef>Window<parameter> *parent_return</parameter></paramdef>
- <paramdef>Window<parameter> **children_return</parameter></paramdef>
- <paramdef>unsignedint<parameter> *nchildren_return</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
- <varlistentry>
- <term>
- <emphasis remap='I'>display</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the connection to the X server.
-<!-- .ds Wi whose list of children, root, parent, and number of children \ -->
-you want to obtain
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>w</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the window (Wi.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>root_return</emphasis>
- </term>
- <listitem>
- <para>
-Returns the root window.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>parent_return</emphasis>
- </term>
- <listitem>
- <para>
-Returns the parent window.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>children_return</emphasis>
- </term>
- <listitem>
- <para>
-Returns the list of children.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>nchildren_return</emphasis>
- </term>
- <listitem>
- <para>
-Returns the number of children.
- </para>
- </listitem>
- </varlistentry>
-</variablelist>
-</para>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XQueryTree</function>
-function returns the root ID, the parent window ID,
-a pointer to the list of children windows
-(NULL when there are no children),
-and the number of children in the list for the specified window.
-The children are listed in current stacking order, from bottom-most
-(first) to top-most (last).
-<function>XQueryTree</function>
-returns zero if it fails and nonzero if it succeeds.
-To free a non-NULL children list when it is no longer needed, use
-<function>XFree</function>.
-</para>
-<para>
-<!-- .LP -->
-<function>XQueryTree</function>
-can generate a
-<errorname>BadWindow</errorname>
-error.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-To obtain the current attributes of a given window, use
-<function>XGetWindowAttributes</function>.
-<indexterm significance="preferred"><primary>XGetWindowAttributes</primary></indexterm>
-<!-- .sM -->
-<funcsynopsis>
-<funcprototype>
- <funcdef>Status <function>XGetWindowAttributes</function></funcdef>
- <paramdef>Display<parameter> *display</parameter></paramdef>
- <paramdef>Window<parameter> w</parameter></paramdef>
- <paramdef>XWindowAttributes<parameter> *window_attributes_return</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
- <varlistentry>
- <term>
- <emphasis remap='I'>display</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the connection to the X server.
-<!-- .ds Wi whose current attributes you want to obtain -->
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>w</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the window (Wi.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>window_attributes_return</emphasis>
- </term>
- <listitem>
- <para>
-Returns the specified window's attributes in the
-<structname>XWindowAttributes</structname>
-structure.
- </para>
- </listitem>
- </varlistentry>
-</variablelist>
-</para>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XGetWindowAttributes</function>
-function returns the current attributes for the specified window to an
-<structname>XWindowAttributes</structname>
-structure.
-</para>
-<para>
-<!-- .LP -->
-<indexterm significance="preferred"><primary>XWindowAttributes</primary></indexterm>
-<!-- .sM -->
-<literallayout class="monospaced">
-<!-- .TA .5i 3i -->
-<!-- .ta .5i 3i -->
-typedef struct {
- int x, y; /* location of window */
- int width, height; /* width and height of window */
- int border_width; /* border width of window */
- int depth; /* depth of window */
- Visual *visual; /* the associated visual structure */
- Window root; /* root of screen containing window */
- int class; /* InputOutput, InputOnly*/
- int bit_gravity; /* one of the bit gravity values */
- int win_gravity; /* one of the window gravity values */
- int backing_store; /* NotUseful, WhenMapped, Always */
- unsigned long backing_planes; /* planes to be preserved if possible */
- unsigned long backing_pixel; /* value to be used when restoring planes */
- Bool save_under; /* boolean, should bits under be saved? */
- Colormap colormap; /* color map to be associated with window */
- Bool map_installed; /* boolean, is color map currently installed*/
- int map_state; /* IsUnmapped, IsUnviewable, IsViewable */
- long all_event_masks; /* set of events all people have interest in*/
- long your_event_mask; /* my event mask */
- long do_not_propagate_mask; /* set of events that should not propagate */
- Bool override_redirect; /* boolean value for override-redirect */
- Screen *screen; /* back pointer to correct screen */
-} XWindowAttributes;
-</literallayout>
-</para>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The x and y members are set to the upper-left outer
-corner relative to the parent window's origin.
-The width and height members are set to the inside size of the window,
-not including the border.
-The border_width member is set to the window's border width in pixels.
-The depth member is set to the depth of the window
-(that is, bits per pixel for the object).
-The visual member is a pointer to the screen's associated
-<structname>Visual</structname>
-structure.
-The root member is set to the root window of the screen containing the window.
-The class member is set to the window's class and can be either
-<symbol>InputOutput</symbol>
-or
-<symbol>InputOnly</symbol>.
-</para>
-<para>
-<!-- .LP -->
-The bit_gravity member is set to the window's bit gravity
-and can be one of the following:
- <simplelist type="vert" columns="2">
- <member><symbol>ForgetGravity</symbol></member>
- <member><symbol>NorthWestGravity</symbol></member>
- <member><symbol>NorthGravity</symbol></member>
- <member><symbol>NorthEastGravity</symbol></member>
- <member><symbol>WestGravity</symbol></member>
-
- <member><symbol>EastGravity</symbol></member>
- <member><symbol>SouthWestGravity</symbol></member>
- <member><symbol>SouthGravity</symbol></member>
- <member><symbol>SouthEastGravity</symbol></member>
- <member><symbol>StaticGravity</symbol></member>
- </simplelist>
-</para>
-<para>
-The win_gravity member is set to the window's window gravity
-and can be one of the following:
- <simplelist type="vert" columns="2">
- <member><symbol>UnmapGravity</symbol></member>
- <member><symbol>NorthWestGravity</symbol></member>
- <member><symbol>NorthGravity</symbol></member>
- <member><symbol>NorthEastGravity</symbol></member>
- <member><symbol>WestGravity</symbol></member>
-
- <member><symbol>EastGravity</symbol></member>
- <member><symbol>SouthWestGravity</symbol></member>
- <member><symbol>SouthGravity</symbol></member>
- <member><symbol>SouthEastGravity</symbol></member>
- <member><symbol>StaticGravity</symbol></member>
- <member><symbol>CenterGravity</symbol></member>
- </simplelist>
-</para>
-<para>
-<!-- .LP -->
-For additional information on gravity,
-see section 3.2.3. <!-- xref -->
-</para>
-<para>
-<!-- .LP -->
-The backing_store member is set to indicate how the X server should maintain
-the contents of a window
-and can be
-<symbol>WhenMapped</symbol>,
-<symbol>Always</symbol>,
-or
-<symbol>NotUseful</symbol>.
-The backing_planes member is set to indicate (with bits set to 1) which bit
-planes of the window hold dynamic data that must be preserved in backing_stores
-and during save_unders.
-The backing_pixel member is set to indicate what values to use
-for planes not set in backing_planes.
-</para>
-<para>
-<!-- .LP -->
-The save_under member is set to
-<symbol>True</symbol>
-or
-<symbol>False</symbol>.
-The colormap member is set to the colormap for the specified window and can be
-a colormap ID or
-<symbol>None</symbol>.
-The map_installed member is set to indicate whether the colormap is
-currently installed and can be
-<symbol>True</symbol>
-or
-<symbol>False</symbol>.
-The map_state member is set to indicate the state of the window and can be
-<symbol>IsUnmapped</symbol>,
-<symbol>IsUnviewable</symbol>,
-or
-<symbol>IsViewable</symbol>.
-<symbol>IsUnviewable</symbol>
-is used if the window is mapped but some ancestor is unmapped.
-</para>
-<para>
-<!-- .LP -->
-The all_event_masks member is set to the bitwise inclusive OR of all event
-masks selected on the window by all clients.
-The your_event_mask member is set to the bitwise inclusive OR of all event
-masks selected by the querying client.
-The do_not_propagate_mask member is set to the bitwise inclusive OR of the
-set of events that should not propagate.
-</para>
-<para>
-<!-- .LP -->
-The override_redirect member is set to indicate whether this window overrides
-structure control facilities and can be
-<symbol>True</symbol>
-or
-<symbol>False</symbol>.
-Window manager clients should ignore the window if this member is
-<symbol>True</symbol>.
-</para>
-<para>
-<!-- .LP -->
-The screen member is set to a screen pointer that gives you a back pointer
-to the correct screen.
-This makes it easier to obtain the screen information without
-having to loop over the root window fields to see which field matches.
-</para>
-<para>
-<!-- .LP -->
-<function>XGetWindowAttributes</function>
-can generate
-<errorname>BadDrawable</errorname>
-and
-<errorname>BadWindow</errorname>
-errors.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-To obtain the current geometry of a given drawable, use
-<function>XGetGeometry</function>.
-<indexterm significance="preferred"><primary>XGetGeometry</primary></indexterm>
-<!-- .sM -->
-<funcsynopsis>
-<funcprototype>
- <funcdef>Status <function>XGetGeometry</function></funcdef>
- <paramdef>Display<parameter> *display</parameter></paramdef>
- <paramdef>Drawable<parameter> d</parameter></paramdef>
- <paramdef>Window<parameter> *root_return</parameter></paramdef>
- <paramdef>int*x_return,<parameter> *y_return</parameter></paramdef>
- <paramdef>unsignedint*width_return,<parameter> *height_return</parameter></paramdef>
- <paramdef>unsignedint<parameter> *border_width_return</parameter></paramdef>
- <paramdef>unsignedint<parameter> *depth_return</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
- <varlistentry>
- <term>
- <emphasis remap='I'>display</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the connection to the X server.
-<!-- .ds Dr , which can be a window or a pixmap -->
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>d</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the drawable(Dr.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>root_return</emphasis>
- </term>
- <listitem>
- <para>
-Returns the root window.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>x_return</emphasis>
- </term>
- <listitem>
- <para>
-<!-- .br -->
-<!-- .ns -->
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>y_return</emphasis>
- </term>
- <listitem>
- <para>
-Return the x and y coordinates that define the location of the drawable.
-For a window,
-these coordinates specify the upper-left outer corner relative to
-its parent's origin.
-For pixmaps, these coordinates are always zero.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>width_return</emphasis>
- </term>
- <listitem>
- <para>
-<!-- .br -->
-<!-- .ns -->
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>height_return</emphasis>
- </term>
- <listitem>
- <para>
-Return the drawable's dimensions (width and height).
-For a window,
-these dimensions specify the inside size, not including the border.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>border_width_return</emphasis>
- </term>
- <listitem>
- <para>
-Returns the border width in pixels.
-If the drawable is a pixmap, it returns zero.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>depth_return</emphasis>
- </term>
- <listitem>
- <para>
-Returns the depth of the drawable (bits per pixel for the object).
- </para>
- </listitem>
- </varlistentry>
-</variablelist>
-</para>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XGetGeometry</function>
-function returns the root window and the current geometry of the drawable.
-The geometry of the drawable includes the x and y coordinates, width and height,
-border width, and depth.
-These are described in the argument list.
-It is legal to pass to this function a window whose class is
-<symbol>InputOnly</symbol>.
-</para>
-<para>
-<!-- .LP -->
-<function>XGetGeometry</function>
-can generate a
-<errorname>BadDrawable</errorname>
-error.
-</para>
-</sect1>
-<sect1 id="Translating_Screen_Coordinates">
-<title>Translating Screen Coordinates</title>
-<!-- .XS -->
-<!-- (SN Translating Screen Coordinates -->
-<!-- .XE -->
-<para>
-<!-- .LP -->
-Applications sometimes
-need to perform a coordinate transformation from the coordinate
-space of one window to another window or need to determine which
-window the pointing device is in.
-<function>XTranslateCoordinates</function>
-and
-<function>XQueryPointer</function>
-fulfill these needs (and avoid any race conditions) by
-asking the X server to perform these operations.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-To translate a coordinate in one window to the coordinate
-space of another window, use
-<function>XTranslateCoordinates</function>.
-<indexterm significance="preferred"><primary>XTranslateCoordinates</primary></indexterm>
-<!-- .sM -->
-<funcsynopsis>
-<funcprototype>
- <funcdef>Bool <function>XTranslateCoordinates</function></funcdef>
- <paramdef>Display<parameter> *display</parameter></paramdef>
- <paramdef>Windowsrc_w,<parameter> dest_w</parameter></paramdef>
- <paramdef>intsrc_x,<parameter> src_y</parameter></paramdef>
- <paramdef>int*dest_x_return,<parameter> *dest_y_return</parameter></paramdef>
- <paramdef>Window<parameter> *child_return</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
- <varlistentry>
- <term>
- <emphasis remap='I'>display</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the connection to the X server.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>src_w</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the source window.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>dest_w</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the destination window.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>src_x</emphasis>
- </term>
- <listitem>
- <para>
-<!-- .br -->
-<!-- .ns -->
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>src_y</emphasis>
- </term>
- <listitem>
- <para>
-Specify the x and y coordinates within the source window.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>dest_x_return</emphasis>
- </term>
- <listitem>
- <para>
-<!-- .br -->
-<!-- .ns -->
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>dest_y_return</emphasis>
- </term>
- <listitem>
- <para>
-Return the x and y coordinates within the destination window.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>child_return</emphasis>
- </term>
- <listitem>
- <para>
-Returns the child if the coordinates are contained in a mapped child of the
-destination window.
- </para>
- </listitem>
- </varlistentry>
-</variablelist>
-</para>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-If
-<function>XTranslateCoordinates</function>
-returns
-<symbol>True</symbol>,
-it takes the src_x and src_y coordinates relative
-to the source window's origin and returns these coordinates to
-dest_x_return and dest_y_return
-relative to the destination window's origin.
-If
-<function>XTranslateCoordinates</function>
-returns
-<symbol>False</symbol>,
-src_w and dest_w are on different screens,
-and dest_x_return and dest_y_return are zero.
-If the coordinates are contained in a mapped child of dest_w,
-that child is returned to child_return.
-Otherwise, child_return is set to
-<symbol>None</symbol>.
-</para>
-<para>
-<!-- .LP -->
-<function>XTranslateCoordinates</function>
-can generate a
-<errorname>BadWindow</errorname>
-error.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-To obtain the screen coordinates of the pointer
-or to determine the pointer coordinates relative to a specified window, use
-<function>XQueryPointer</function>.
-<indexterm significance="preferred"><primary>XQueryPointer</primary></indexterm>
-<!-- .sM -->
-<funcsynopsis>
-<funcprototype>
- <funcdef>Bool <function>XQueryPointer</function></funcdef>
- <paramdef>Display<parameter> *display</parameter></paramdef>
- <paramdef>Window<parameter> w</parameter></paramdef>
- <paramdef>Window*root_return,<parameter> *child_return</parameter></paramdef>
- <paramdef>int*root_x_return,<parameter> *root_y_return</parameter></paramdef>
- <paramdef>int*win_x_return,<parameter> *win_y_return</parameter></paramdef>
- <paramdef>unsignedint<parameter> *mask_return</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
- <varlistentry>
- <term>
- <emphasis remap='I'>display</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the connection to the X server.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>w</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the window.
-<!-- .ds Ro that the pointer is in -->
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>root_return</emphasis>
- </term>
- <listitem>
- <para>
-Returns the root window (Ro.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>child_return</emphasis>
- </term>
- <listitem>
- <para>
-Returns the child window that the pointer is located in, if any.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>root_x_return</emphasis>
- </term>
- <listitem>
- <para>
-<!-- .br -->
-<!-- .ns -->
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>root_y_return</emphasis>
- </term>
- <listitem>
- <para>
-Return the pointer coordinates relative to the root window's origin.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>win_x_return</emphasis>
- </term>
- <listitem>
- <para>
-<!-- .br -->
-<!-- .ns -->
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>win_y_return</emphasis>
- </term>
- <listitem>
- <para>
-Return the pointer coordinates relative to the specified window.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>mask_return</emphasis>
- </term>
- <listitem>
- <para>
-Returns the current state of the modifier keys and pointer buttons.
- </para>
- </listitem>
- </varlistentry>
-</variablelist>
-</para>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XQueryPointer</function>
-function returns the root window the pointer is logically on and the pointer
-coordinates relative to the root window's origin.
-If
-<function>XQueryPointer</function>
-returns
-<symbol>False</symbol>,
-the pointer is not on the same screen as the specified window, and
-<function>XQueryPointer</function>
-returns
-<symbol>None</symbol>
-to child_return and zero to win_x_return and win_y_return.
-If
-<function>XQueryPointer</function>
-returns
-<symbol>True</symbol>,
-the pointer coordinates returned to win_x_return and win_y_return
-are relative to the origin of the specified window.
-In this case,
-<function>XQueryPointer</function>
-returns the child that contains the pointer, if any,
-or else
-<symbol>None</symbol>
-to child_return.
-</para>
-<para>
-<!-- .LP -->
-<function>XQueryPointer</function>
-returns the current logical state of the keyboard buttons
-and the modifier keys in mask_return.
-It sets mask_return to the bitwise inclusive OR of one or more
-of the button or modifier key bitmasks to match
-the current state of the mouse buttons and the modifier keys.
-</para>
-<para>
-<!-- .LP -->
-Note that the logical state of a device (as seen through Xlib)
-may lag the physical state if device event processing is frozen
-(see section 12.1). <!-- xref -->
-</para>
-<para>
-<!-- .LP -->
-<function>XQueryPointer</function>
-can generate a
-<errorname>BadWindow</errorname>
-error.
-</para>
-</sect1>
-<sect1 id="Properties_and_Atoms">
-<title>Properties and Atoms</title>
-<!-- .XS -->
-<!-- (SN Properties and Atoms -->
-<!-- .XE -->
-<para>
-<!-- .LP -->
-A property is a collection of named, typed data.
-The window system has a set of predefined properties
-<indexterm><primary>Atom</primary><secondary>predefined</secondary></indexterm>
-(for example, the name of a window, size hints, and so on), and users can
-define any other arbitrary information and associate it with windows.
-Each property has a name,
-which is an ISO Latin-1 string.
-For each named property,
-a unique identifier (atom) is associated with it.
-A property also has a type, for example, string or integer.
-These types are also indicated using atoms, so arbitrary new
-types can be defined.
-Data of only one type may be associated with a single
-property name.
-Clients can store and retrieve properties associated with windows.
-For efficiency reasons,
-an atom is used rather than a character string.
-<function>XInternAtom</function>
-can be used to obtain the atom for property names.
-<indexterm><primary>Atom</primary></indexterm>
-</para>
-<para>
-<!-- .LP -->
-A property is also stored in one of several possible formats.
-The X server can store the information as 8-bit quantities, 16-bit
-quantities, or 32-bit quantities.
-This permits the X server to present the data in the byte order that the
-client expects.
-<!-- .NT Note -->
-If you define further properties of complex type,
-you must encode and decode them yourself.
-These functions must be carefully written if they are to be portable.
-For further information about how to write a library extension,
-see appendix C. <!-- xref -->
-<!-- .NE -->
-The type of a property is defined by an atom, which allows for
-arbitrary extension in this type scheme.
-<indexterm><primary>Atom</primary></indexterm>
-</para>
-<para>
-<!-- .LP -->
-Certain property names are
-predefined in the server for commonly used functions.
-The atoms for these properties are defined in
-<filename class="headerfile">&lt;X11/Xatom.h&gt;</filename>.
-<indexterm type="file"><primary><filename class="headerfile">X11/Xatom.h</filename></primary></indexterm>
-<indexterm><primary>Files</primary><secondary><filename class="headerfile">&lt;X11/Xatom.h&gt;</filename></secondary></indexterm>
-<indexterm><primary>Headers</primary><secondary><filename class="headerfile">&lt;X11/Xatom.h&gt;</filename></secondary></indexterm>
-To avoid name clashes with user symbols, the
-<code>#define</code>
-name for each atom has the XA_ prefix.
-For an explanation of the functions that let you get and set
-much of the information stored in these predefined properties,
-see chapter 14. <!-- xref -->
-</para>
-<para>
-<!-- .LP -->
-The core protocol imposes no semantics on these property names,
-but semantics are specified in other X Consortium standards,
-such as the <emphasis remap='I'>Inter-Client Communication Conventions Manual</emphasis>
-and the <emphasis remap='I'>X Logical Font Description Conventions</emphasis>.
-</para>
-<para>
-<!-- .LP -->
-You can use properties to communicate other information between
-applications.
-The functions described in this section let you define new properties
-and get the unique atom IDs in your applications.
-</para>
-<para>
-<!-- .LP -->
-Although any particular atom can have some client interpretation
-within each of the name spaces,
-atoms occur in five distinct name spaces within the protocol:
-</para>
-<itemizedlist>
- <listitem>
- <para>
-Selections
- </para>
- </listitem>
- <listitem>
- <para>
-Property names
- </para>
- </listitem>
- <listitem>
- <para>
-Property types
- </para>
- </listitem>
- <listitem>
- <para>
-Font properties
- </para>
- </listitem>
- <listitem>
- <para>
-Type of a
-<symbol>ClientMessage</symbol>
-event (none are built into the X server)
- </para>
- </listitem>
-</itemizedlist>
-<para>
-<!-- .LP -->
-</para>
-<para>
-<!-- .LP -->
-The built-in selection property names are:
-<simplelist type="vert" columns="2">
- <member><property>PRIMARY</property></member>
- <member><property>SECONDARY</property></member>
-</simplelist>
-</para>
-<para>
-<!-- .LP -->
-The built-in property names are:
- <simplelist type="vert" columns="2">
- <member><property>CUT_BUFFER0</property></member>
- <member><property>CUT_BUFFER1</property></member>
- <member><property>CUT_BUFFER2</property></member>
- <member><property>CUT_BUFFER3</property></member>
- <member><property>CUT_BUFFER4</property></member>
- <member><property>CUT_BUFFER5</property></member>
- <member><property>CUT_BUFFER6</property></member>
- <member><property>CUT_BUFFER7</property></member>
- <member><property>RGB_BEST_MAP</property></member>
- <member><property>RGB_BLUE_MAP</property></member>
- <member><property>RGB_DEFAULT_MAP</property></member>
- <member><property>RGB_GRAY_MAP</property></member>
- <member><property>RGB_GREEN_MAP</property></member>
- <member><property>RGB_RED_MAP</property></member>
-
- <member><property>RESOURCE_MANAGER</property></member>
- <member><property>WM_CLASS</property></member>
- <member><property>WM_CLIENT_MACHINE</property></member>
- <member><property>WM_COLORMAP_WINDOWS</property></member>
- <member><property>WM_COMMAND</property></member>
- <member><property>WM_HINTS</property></member>
- <member><property>WM_ICON_NAME</property></member>
- <member><property>WM_ICON_SIZE</property></member>
- <member><property>WM_NAME</property></member>
- <member><property>WM_NORMAL_HINTS</property></member>
- <member><property>WM_PROTOCOLS</property></member>
- <member><property>WM_STATE</property></member>
- <member><property>WM_TRANSIENT_FOR</property></member>
- <member><property>WM_ZOOM_HINTS</property></member>
- </simplelist>
-</para>
-<para>
-The built-in property types are:
- <simplelist type="vert" columns="2">
- <member><property>ARC</property></member>
- <member><property>ATOM</property></member>
- <member><property>BITMAP</property></member>
- <member><property>CARDINAL</property></member>
- <member><property>COLORMAP</property></member>
- <member><property>CURSOR</property></member>
- <member><property>DRAWABLE</property></member>
- <member><property>FONT</property></member>
- <member><property>INTEGER</property></member>
- <member><property>PIXMAP</property></member>
- <member><property>POINT</property></member>
- <member><property>RGB_COLOR_MAP</property></member>
- <member><property>RECTANGLE</property></member>
- <member><property>STRING</property></member>
- <member><property>VISUALID</property></member>
- <member><property>WINDOW</property></member>
- <member><property>WM_HINTS</property></member>
- <member><property>WM_SIZE_HINTS</property></member>
- </simplelist>
-</para>
-<para>
-The built-in font property names are:
- <simplelist type="vert" columns="2">
- <member><property>MIN_SPACE</property></member>
- <member><property>NORM_SPACE</property></member>
- <member><property>MAX_SPACE</property></member>
- <member><property>END_SPACE</property></member>
- <member><property>SUPERSCRIPT_X</property></member>
- <member><property>SUPERSCRIPT_Y</property></member>
- <member><property>SUBSCRIPT_X</property></member>
- <member><property>SUBSCRIPT_Y</property></member>
- <member><property>UNDERLINE_POSITION</property></member>
- <member><property>UNDERLINE_THICKNESS</property></member>
- <member><property>FONT_NAME</property></member>
- <member><property>FULL_NAME</property></member>
-
- <member><property>STRIKEOUT_DESCENT</property></member>
- <member><property>STRIKEOUT_ASCENT</property></member>
- <member><property>ITALIC_ANGLE</property></member>
- <member><property>X_HEIGHT</property></member>
- <member><property>QUAD_WIDTH</property></member>
- <member><property>WEIGHT</property></member>
- <member><property>POINT_SIZE</property></member>
- <member><property>RESOLUTION</property></member>
- <member><property>COPYRIGHT</property></member>
- <member><property>NOTICE</property></member>
- <member><property>FAMILY_NAME</property></member>
- <member><property>CAP_HEIGHT</property></member>
- </simplelist>
-</para>
-<para>
-<!-- .LP -->
-For further information about font properties,
-see section 8.5. <!-- xref -->
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-To return an atom for a given name, use
-<function>XInternAtom</function>.
-<indexterm><primary>Atom</primary><secondary>interning</secondary></indexterm>
-<indexterm significance="preferred"><primary>XInternAtom</primary></indexterm>
-<!-- .sM -->
-<funcsynopsis>
-<funcprototype>
- <funcdef>Atom <function>XInternAtom</function></funcdef>
- <paramdef>Display<parameter> *display</parameter></paramdef>
- <paramdef>char<parameter> *atom_name</parameter></paramdef>
- <paramdef>Bool<parameter> only_if_exists</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
- <varlistentry>
- <term>
- <emphasis remap='I'>display</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the connection to the X server.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>atom_name</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the name associated with the atom you want returned.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>only_if_exists</emphasis>
- </term>
- <listitem>
- <para>
-Specifies a Boolean value that indicates whether the atom must be created.
- </para>
- </listitem>
- </varlistentry>
-</variablelist>
-</para>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XInternAtom</function>
-function returns the atom identifier associated with the specified atom_name
-string.
-If only_if_exists is
-<symbol>False</symbol>,
-the atom is created if it does not exist.
-Therefore,
-<function>XInternAtom</function>
-can return
-<symbol>None</symbol>.
-If the atom name is not in the Host Portable Character Encoding,
-the result is implementation-dependent.
-Uppercase and lowercase matter;
-the strings ``thing'', ``Thing'', and ``thinG''
-all designate different atoms.
-The atom will remain defined even after the client's connection closes.
-It will become undefined only when the last connection to
-the X server closes.
-</para>
-<para>
-<!-- .LP -->
-<function>XInternAtom</function>
-can generate
-<errorname>BadAlloc</errorname>
-and
-<errorname>BadValue</errorname>
-errors.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-To return atoms for an array of names, use
-<function>XInternAtoms</function>.
-<indexterm><primary>Atom</primary><secondary>interning</secondary></indexterm>
-<indexterm significance="preferred"><primary>XInternAtoms</primary></indexterm>
-<!-- .sM -->
-<funcsynopsis>
-<funcprototype>
- <funcdef>Status <function>XInternAtoms</function></funcdef>
- <paramdef>Display<parameter> *display</parameter></paramdef>
- <paramdef>char<parameter> **names</parameter></paramdef>
- <paramdef>int<parameter> count</parameter></paramdef>
- <paramdef>Bool<parameter> only_if_exists</parameter></paramdef>
- <paramdef>Atom<parameter> *atoms_return</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
- <varlistentry>
- <term>
- <emphasis remap='I'>display</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the connection to the X server.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>names</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the array of atom names.
-<!-- .ds Cn atom names in the array -->
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>count</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the number of (Cn.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>only_if_exists</emphasis>
- </term>
- <listitem>
- <para>
-Specifies a Boolean value that indicates whether the atom must be created.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>atoms_return</emphasis>
- </term>
- <listitem>
- <para>
-Returns the atoms.
- </para>
- </listitem>
- </varlistentry>
-</variablelist>
-</para>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XInternAtoms</function>
-function returns the atom identifiers associated with the specified names.
-The atoms are stored in the atoms_return array supplied by the caller.
-Calling this function is equivalent to calling
-<function>XInternAtom</function>
-for each of the names in turn with the specified value of only_if_exists,
-but this function minimizes the number of round-trip protocol exchanges
-between the client and the X server.
-</para>
-<para>
-<!-- .LP -->
-This function returns a nonzero status if atoms are returned for
-all of the names;
-otherwise, it returns zero.
-</para>
-<para>
-<!-- .LP -->
-<function>XInternAtoms</function>
-can generate
-<errorname>BadAlloc</errorname>
-and
-<errorname>BadValue</errorname>
-errors.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-To return a name for a given atom identifier, use
-<function>XGetAtomName</function>.
-<indexterm><primary>Atom</primary><secondary>getting name</secondary></indexterm>
-<indexterm significance="preferred"><primary>XGetAtomName</primary></indexterm>
-<!-- .sM -->
-<funcsynopsis>
-<funcprototype>
- <funcdef>char *<function>XGetAtomName</function></funcdef>
- <paramdef>Display<parameter> *display</parameter></paramdef>
- <paramdef>Atom<parameter> atom</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
- <varlistentry>
- <term>
- <emphasis remap='I'>display</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the connection to the X server.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>atom</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the atom for the property name you want returned.
- </para>
- </listitem>
- </varlistentry>
-</variablelist>
-</para>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XGetAtomName</function>
-function returns the name associated with the specified atom.
-If the data returned by the server is in the Latin Portable Character Encoding,
-then the returned string is in the Host Portable Character Encoding.
-Otherwise, the result is implementation-dependent.
-To free the resulting string,
-call
-<function>XFree</function>.
-</para>
-<para>
-<!-- .LP -->
-<function>XGetAtomName</function>
-can generate a
-<errorname>BadAtom</errorname>
-error.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-To return the names for an array of atom identifiers, use
-<function>XGetAtomNames</function>.
-<indexterm><primary>Atom</primary><secondary>getting name</secondary></indexterm>
-<indexterm significance="preferred"><primary>XGetAtomNames</primary></indexterm>
-<!-- .sM -->
-<funcsynopsis>
-<funcprototype>
- <funcdef>Status <function>XGetAtomNames</function></funcdef>
- <paramdef>Display<parameter> *display</parameter></paramdef>
- <paramdef>Atom<parameter> *atoms</parameter></paramdef>
- <paramdef>int<parameter> count</parameter></paramdef>
- <paramdef>char<parameter> **names_return</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
- <varlistentry>
- <term>
- <emphasis remap='I'>display</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the connection to the X server.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>atoms</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the array of atoms.
-<!-- .ds Cn atoms in the array -->
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>count</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the number of (Cn.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>names_return</emphasis>
- </term>
- <listitem>
- <para>
-Returns the atom names.
- </para>
- </listitem>
- </varlistentry>
-</variablelist>
-</para>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XGetAtomNames</function>
-function returns the names associated with the specified atoms.
-The names are stored in the names_return array supplied by the caller.
-Calling this function is equivalent to calling
-<function>XGetAtomName</function>
-for each of the atoms in turn,
-but this function minimizes the number of round-trip protocol exchanges
-between the client and the X server.
-</para>
-<para>
-<!-- .LP -->
-This function returns a nonzero status if names are returned for
-all of the atoms;
-otherwise, it returns zero.
-</para>
-<para>
-<!-- .LP -->
-<function>XGetAtomNames</function>
-can generate a
-<errorname>BadAtom</errorname>
-error.
-</para>
-</sect1>
-<sect1 id="Obtaining_and_Changing_Window_Properties">
-<title>Obtaining and Changing Window Properties</title>
-<!-- .XS -->
-<!-- (SN Obtaining and Changing Window Properties -->
-<!-- .XE -->
-<para>
-<!-- .LP -->
-You can attach a property list to every window.
-Each property has a name, a type, and a value (see section 4.3). <!-- xref -->
-The value is an array of 8-bit, 16-bit, or 32-bit quantities,
-whose interpretation is left to the clients. The type
-<type>char</type>
-is used to represent 8-bit quantities, the type
-<type>short</type>
-is used to represent 16-bit quantities, and the type
-<type>long</type>
-is used to represent 32-bit quantities.
-</para>
-<para>
-<!-- .LP -->
-Xlib provides functions that you can use to obtain,
-change, update, or interchange window properties.
-In addition, Xlib provides other utility functions for inter-client
-communication (see chapter 14). <!-- xref -->
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-To obtain the type, format, and value of a property of a given window, use
-<function>XGetWindowProperty</function>.
-<indexterm><primary>Property</primary><secondary>getting</secondary></indexterm>
-</para>
-<para>
-<!-- .LP -->
-<indexterm significance="preferred"><primary>XGetWindowProperty</primary></indexterm>
-<!-- .sM -->
-<funcsynopsis>
-<funcprototype>
- <funcdef>int <function>XGetWindowProperty</function></funcdef>
- <paramdef><parameter> display</parameter></paramdef>
- <paramdef><parameter> w</parameter></paramdef>
- <paramdef><parameter> property</parameter></paramdef>
- <paramdef><parameter> long_offset</parameter></paramdef>
- <paramdef><parameter> long_length</parameter></paramdef>
- <paramdef><parameter> delete</parameter></paramdef>
- <paramdef><parameter> req_type</parameter></paramdef>
- <paramdef><parameter> actual_type_return</parameter></paramdef>
- <paramdef><parameter> actual_format_return</parameter></paramdef>
- <paramdef><parameter> nitems_return</parameter></paramdef>
- <paramdef><parameter> bytes_after_return</parameter></paramdef>
- <paramdef>.br<parameter> prop_return</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
- <varlistentry>
- <term>
- <emphasis remap='I'>display</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the connection to the X server.
-<!-- .ds Wi whose property you want to obtain -->
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>w</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the window (Wi.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>property</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the property name.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>long_offset</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the offset in the specified property (in 32-bit quantities)
-where the data is to be retrieved.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>long_length</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the length in 32-bit multiples of the data to be retrieved.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>delete</emphasis>
- </term>
- <listitem>
- <para>
-Specifies a Boolean value that determines whether the property is deleted.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>req_type</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the atom identifier associated with the property type or
-<symbol>AnyPropertyType</symbol>.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>actual_type_return</emphasis>
- </term>
- <listitem>
- <para>
-Returns the atom identifier that defines the actual type of the property.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>actual_format_return</emphasis>
- </term>
- <listitem>
- <para>
-Returns the actual format of the property.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>nitems_return</emphasis>
- </term>
- <listitem>
- <para>
-Returns the actual number of 8-bit, 16-bit, or 32-bit items
-stored in the prop_return data.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>bytes_after_return</emphasis>
- </term>
- <listitem>
- <para>
-Returns the number of bytes remaining to be read in the property if
-a partial read was performed.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>prop_return</emphasis>
- </term>
- <listitem>
- <para>
-Returns the data in the specified format.
- </para>
- </listitem>
- </varlistentry>
-</variablelist>
-</para>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XGetWindowProperty</function>
-function returns the actual type of the property; the actual format of the property;
-the number of 8-bit, 16-bit, or 32-bit items transferred; the number of bytes remaining
-to be read in the property; and a pointer to the data actually returned.
-<function>XGetWindowProperty</function>
-sets the return arguments as follows:
-</para>
-<itemizedlist>
- <listitem>
- <para>
-If the specified property does not exist for the specified window,
-<function>XGetWindowProperty</function>
-returns
-<symbol>None</symbol>
-to actual_type_return and the value zero to
-actual_format_return and bytes_after_return.
-The nitems_return argument is empty.
-In this case, the delete argument is ignored.
- </para>
- </listitem>
- <listitem>
- <para>
-If the specified property exists
-but its type does not match the specified type,
-<function>XGetWindowProperty</function>
-returns the actual property type to actual_type_return,
-the actual property format (never zero) to actual_format_return,
-and the property length in bytes
-(even if the actual_format_return is 16 or 32)
-to bytes_after_return.
-It also ignores the delete argument.
-The nitems_return argument is empty.
- </para>
- </listitem>
- <listitem>
- <para>
-If the specified property exists and either you assign
-<symbol>AnyPropertyType</symbol>
-to the req_type argument or the specified type matches the actual property type,
-<function>XGetWindowProperty</function>
-returns the actual property type to actual_type_return and the actual
-property format (never zero) to actual_format_return.
-It also returns a value to bytes_after_return and nitems_return, by
-defining the following
-values:
- </para>
- </listitem>
- <listitem>
- <para>
-<!-- .nf -->
- N = actual length of the stored property in bytes
- (even if the format is 16 or 32)
- I = 4 * long_offset
- T = N - I
- L = MINIMUM(T, 4 * long_length)
- A = N - (I + L)
-<!-- .fi -->
- </para>
- </listitem>
- <listitem>
- <para>
-The returned value starts at byte index I in the property (indexing
-from zero), and its length in bytes is L.
-If the value for long_offset causes L to be negative,
-a
-<errorname>BadValue</errorname>
-error results.
-The value of bytes_after_return is A,
-giving the number of trailing unread bytes in the stored property.
- </para>
- </listitem>
-</itemizedlist>
-<para>
-<!-- .LP -->
-If the returned format is 8, the returned data is represented as a
-<type>char</type>
-array.
-If the returned format is 16, the returned data is represented as a
-<type>short</type>
-array and should be cast to that type to obtain the elements.
-If the returned format is 32, the returned data is represented as a
-<type>long</type>
-array and should be cast to that type to obtain the elements.
-</para>
-<para>
-<!-- .LP -->
-<function>XGetWindowProperty</function>
-always allocates one extra byte in prop_return
-(even if the property is zero length)
-and sets it to zero so that simple properties consisting of characters
-do not have to be copied into yet another string before use.
-</para>
-<para>
-<!-- .LP -->
-If delete is
-<symbol>True</symbol>
-and bytes_after_return is zero,
-<function>XGetWindowProperty</function>
-deletes the property
-from the window and generates a
-<symbol>PropertyNotify</symbol>
-event on the window.
-</para>
-<para>
-<!-- .LP -->
-The function returns
-<symbol>Success</symbol>
-if it executes successfully.
-To free the resulting data,
-use
-<function>XFree</function>.
-</para>
-<para>
-<!-- .LP -->
-<function>XGetWindowProperty</function>
-can generate
-<errorname>BadAtom</errorname>,
-<errorname>BadValue</errorname>,
-and
-<errorname>BadWindow</errorname>
-errors.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-To obtain a given window's property list, use
-<function>XListProperties</function>.
-<indexterm><primary>Property</primary><secondary>listing</secondary></indexterm>
-<indexterm significance="preferred"><primary>XListProperties</primary></indexterm>
-<!-- .sM -->
-<funcsynopsis>
-<funcprototype>
- <funcdef>Atom *<function>XListProperties</function></funcdef>
- <paramdef>Display<parameter> *display</parameter></paramdef>
- <paramdef>Window<parameter> w</parameter></paramdef>
- <paramdef>int<parameter> *num_prop_return</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
- <varlistentry>
- <term>
- <emphasis remap='I'>display</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the connection to the X server.
-<!-- .ds Wi whose property list you want to obtain -->
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>w</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the window (Wi.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>num_prop_return</emphasis>
- </term>
- <listitem>
- <para>
-Returns the length of the properties array.
- </para>
- </listitem>
- </varlistentry>
-</variablelist>
-</para>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XListProperties</function>
-function returns a pointer to an array of atom properties that are defined for
-the specified window or returns NULL if no properties were found.
-To free the memory allocated by this function, use
-<function>XFree</function>.
-</para>
-<para>
-<!-- .LP -->
-<function>XListProperties</function>
-can generate a
-<errorname>BadWindow</errorname>
-error.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-To change a property of a given window, use
-<function>XChangeProperty</function>.
-<indexterm><primary>Property</primary><secondary>changing</secondary></indexterm>
-<indexterm><primary>Property</primary><secondary>appending</secondary></indexterm>
-<indexterm><primary>Property</primary><secondary>prepending</secondary></indexterm>
-<indexterm><primary>Property</primary><secondary>replacing</secondary></indexterm>
-<indexterm><primary>Property</primary><secondary>format</secondary></indexterm>
-<indexterm><primary>Property</primary><secondary>type</secondary></indexterm>
-<indexterm significance="preferred"><primary>XChangeProperty</primary></indexterm>
-<!-- .sM -->
-<funcsynopsis>
-<funcprototype>
- <funcdef><function>XChangeProperty</function></funcdef>
- <paramdef>Display<parameter> *display</parameter></paramdef>
- <paramdef>Window<parameter> w</parameter></paramdef>
- <paramdef>Atomproperty,<parameter> type</parameter></paramdef>
- <paramdef>int<parameter> format</parameter></paramdef>
- <paramdef>int<parameter> mode</parameter></paramdef>
- <paramdef>unsignedchar<parameter> *data</parameter></paramdef>
- <paramdef>int<parameter> nelements</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
- <varlistentry>
- <term>
- <emphasis remap='I'>display</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the connection to the X server.
-<!-- .ds Wi whose property you want to change -->
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>w</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the window (Wi.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>property</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the property name.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>type</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the type of the property.
-The X server does not interpret the type but simply
-passes it back to an application that later calls
-<function>XGetWindowProperty</function>.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>format</emphasis>
- </term>
- <listitem>
- <para>
-Specifies whether the data should be viewed as a list
-of 8-bit, 16-bit, or 32-bit quantities.
-Possible values are 8, 16, and 32.
-This information allows the X server to correctly perform
-byte-swap operations as necessary.
-If the format is 16-bit or 32-bit,
-you must explicitly cast your data pointer to an (unsigned char *) in the call
-to
-<function>XChangeProperty</function>.
-<!-- .\" Changed name of this file to prop_mode.a on 1/13/87 -->
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>mode</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the mode of the operation.
-You can pass
-<symbol>PropModeReplace</symbol>,
-<symbol>PropModePrepend</symbol>,
-or
-<symbol>PropModeAppend</symbol>.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>data</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the property data.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>nelements</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the number of elements of the specified data format.
- </para>
- </listitem>
- </varlistentry>
-</variablelist>
-</para>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XChangeProperty</function>
-function alters the property for the specified window and
-causes the X server to generate a
-<symbol>PropertyNotify</symbol>
-event on that window.
-<function>XChangeProperty</function>
-performs the following:
-</para>
-<itemizedlist>
- <listitem>
- <para>
-If mode is
-<symbol>PropModeReplace</symbol>,
-<function>XChangeProperty</function>
-discards the previous property value and stores the new data.
- </para>
- </listitem>
- <listitem>
- <para>
-If mode is
-<symbol>PropModePrepend</symbol>
-or
-<symbol>PropModeAppend</symbol>,
-<function>XChangeProperty</function>
-inserts the specified data before the beginning of the existing data
-or onto the end of the existing data, respectively.
-The type and format must match the existing property value,
-or a
-<errorname>BadMatch</errorname>
-error results.
-If the property is undefined,
-it is treated as defined with the correct type and
-format with zero-length data.
- </para>
- </listitem>
-</itemizedlist>
-<para>
-<!-- .LP -->
-If the specified format is 8, the property data must be a
-<type>char</type>
-array.
-If the specified format is 16, the property data must be a
-<type>short</type>
-array.
-If the specified format is 32, the property data must be a
-<type>long</type>
-array.
-</para>
-<para>
-<!-- .LP -->
-The lifetime of a property is not tied to the storing client.
-Properties remain until explicitly deleted, until the window is destroyed,
-or until the server resets.
-For a discussion of what happens when the connection to the X server is closed,
-see section 2.6. <!-- xref -->
-The maximum size of a property is server dependent and can vary dynamically
-depending on the amount of memory the server has available.
-(If there is insufficient space, a
-<errorname>BadAlloc</errorname>
-error results.)
-</para>
-<para>
-<!-- .LP -->
-<function>XChangeProperty</function>
-can generate
-<errorname>BadAlloc</errorname>,
-<errorname>BadAtom</errorname>,
-<errorname>BadMatch</errorname>,
-<errorname>BadValue</errorname>,
-and
-<errorname>BadWindow</errorname>
-errors.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-To rotate a window's property list, use
-<function>XRotateWindowProperties</function>.
-</para>
-<para>
-<!-- .LP -->
-<indexterm significance="preferred"><primary>XRotateWindowProperties</primary></indexterm>
-<!-- .sM -->
-<funcsynopsis>
-<funcprototype>
- <funcdef><function>XRotateWindowProperties</function></funcdef>
- <paramdef>Display<parameter> *display</parameter></paramdef>
- <paramdef>Window<parameter> w</parameter></paramdef>
- <paramdef>Atom<parameter> properties[]</parameter></paramdef>
- <paramdef>int<parameter> num_prop</parameter></paramdef>
- <paramdef>int<parameter> npositions</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
- <varlistentry>
- <term>
- <emphasis remap='I'>display</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the connection to the X server.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>w</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the window.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>properties</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the array of properties that are to be rotated.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>num_prop</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the length of the properties array.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>npositions</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the rotation amount.
- </para>
- </listitem>
- </varlistentry>
-</variablelist>
-</para>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XRotateWindowProperties</function>
-function allows you to rotate properties on a window and causes
-the X server to generate
-<symbol>PropertyNotify</symbol>
-events.
-If the property names in the properties array are viewed as being numbered
-starting from zero and if there are num_prop property names in the list,
-then the value associated with property name I becomes the value associated
-with property name (I + npositions) mod N for all I from zero to N &minus; 1.
-The effect is to rotate the states by npositions places around the virtual ring
-of property names (right for positive npositions,
-left for negative npositions).
-If npositions mod N is nonzero,
-the X server generates a
-<symbol>PropertyNotify</symbol>
-event for each property in the order that they are listed in the array.
-If an atom occurs more than once in the list or no property with that
-name is defined for the window,
-a
-<errorname>BadMatch</errorname>
-error results.
-If a
-<errorname>BadAtom</errorname>
-or
-<errorname>BadMatch</errorname>
-error results,
-no properties are changed.
-</para>
-<para>
-<!-- .LP -->
-<function>XRotateWindowProperties</function>
-can generate
-<errorname>BadAtom</errorname>,
-<errorname>BadMatch</errorname>,
-and
-<errorname>BadWindow</errorname>
-errors.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-To delete a property on a given window, use
-<function>XDeleteProperty</function>.
-<indexterm><primary>Property</primary><secondary>deleting</secondary></indexterm>
-<indexterm significance="preferred"><primary>XDeleteProperty</primary></indexterm>
-<!-- .sM -->
-<funcsynopsis>
-<funcprototype>
- <funcdef><function>XDeleteProperty</function></funcdef>
- <paramdef>Display<parameter> *display</parameter></paramdef>
- <paramdef>Window<parameter> w</parameter></paramdef>
- <paramdef>Atom<parameter> property</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
- <varlistentry>
- <term>
- <emphasis remap='I'>display</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the connection to the X server.
-<!-- .ds Wi whose property you want to delete -->
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>w</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the window (Wi.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>property</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the property name.
- </para>
- </listitem>
- </varlistentry>
-</variablelist>
-</para>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XDeleteProperty</function>
-function deletes the specified property only if the
-property was defined on the specified window
-and causes the X server to generate a
-<symbol>PropertyNotify</symbol>
-event on the window unless the property does not exist.
-</para>
-<para>
-<!-- .LP -->
-<function>XDeleteProperty</function>
-can generate
-<errorname>BadAtom</errorname>
-and
-<errorname>BadWindow</errorname>
-errors.
-</para>
-</sect1>
-<sect1 id="Selections">
-<title>Selections</title>
-<!-- .XS -->
-<!-- (SN Selections -->
-<!-- .XE -->
-<para>
-<!-- .LP -->
-<indexterm><primary>Selection</primary></indexterm>
-Selections are one method used by applications to exchange data.
-By using the property mechanism,
-applications can exchange data of arbitrary types and can negotiate
-the type of the data.
-A selection can be thought of as an indirect property with a dynamic type.
-That is, rather than having the property stored in the X server,
-the property is maintained by some client (the owner).
-A selection is global in nature (considered to belong to the user
-but be maintained by clients) rather than being private to a particular
-window subhierarchy or a particular set of clients.
-</para>
-<para>
-<!-- .LP -->
-Xlib provides functions that you can use to set, get, or request conversion
-of selections.
-This allows applications to implement the notion of current selection,
-which requires that notification be sent to applications when they no
-longer own the selection.
-Applications that support selection often highlight the current selection
-and so must be informed when another application has
-acquired the selection so that they can unhighlight the selection.
-</para>
-<para>
-<!-- .LP -->
-When a client asks for the contents of
-a selection, it specifies a selection target type.
-This target type
-can be used to control the transmitted representation of the contents.
-For example, if the selection is ``the last thing the user clicked on''
-and that is currently an image, then the target type might specify
-whether the contents of the image should be sent in XY format or Z format.
-</para>
-<para>
-<!-- .LP -->
-The target type can also be used to control the class of
-contents transmitted, for example,
-asking for the ``looks'' (fonts, line
-spacing, indentation, and so forth) of a paragraph selection, not the
-text of the paragraph.
-The target type can also be used for other
-purposes.
-The protocol does not constrain the semantics.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-To set the selection owner, use
-<function>XSetSelectionOwner</function>.
-<indexterm><primary>Selection</primary><secondary>setting the owner</secondary></indexterm>
-<indexterm significance="preferred"><primary>XSetSelectionOwner</primary></indexterm>
-<!-- .sM -->
-<funcsynopsis>
-<funcprototype>
- <funcdef><function>XSetSelectionOwner</function></funcdef>
- <paramdef>Display<parameter> *display</parameter></paramdef>
- <paramdef>Atom<parameter> selection</parameter></paramdef>
- <paramdef>Window<parameter> owner</parameter></paramdef>
- <paramdef>Time<parameter> time</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
- <varlistentry>
- <term>
- <emphasis remap='I'>display</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the connection to the X server.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>selection</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the selection atom.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>owner</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the owner of the specified selection atom.
-You can pass a window or
-<symbol>None</symbol>.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>time</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the time.
-You can pass either a timestamp or
-<symbol>CurrentTime</symbol>.
- </para>
- </listitem>
- </varlistentry>
-</variablelist>
-</para>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XSetSelectionOwner</function>
-function changes the owner and last-change time for the specified selection
-and has no effect if the specified time is earlier than the current
-last-change time of the specified selection
-or is later than the current X server time.
-Otherwise, the last-change time is set to the specified time,
-with
-<symbol>CurrentTime</symbol>
-replaced by the current server time.
-If the owner window is specified as
-<symbol>None</symbol>,
-then the owner of the selection becomes
-<symbol>None</symbol>
-(that is, no owner).
-Otherwise, the owner of the selection becomes the client executing
-the request.
-</para>
-<para>
-<!-- .LP -->
-If the new owner (whether a client or
-<symbol>None</symbol>)
-is not
-the same as the current owner of the selection and the current
-owner is not
-<symbol>None</symbol>,
-the current owner is sent a
-<symbol>SelectionClear</symbol>
-event.
-If the client that is the owner of a selection is later
-terminated (that is, its connection is closed)
-or if the owner window it has specified in the request is later
-destroyed,
-the owner of the selection automatically
-reverts to
-<symbol>None</symbol>,
-but the last-change time is not affected.
-The selection atom is uninterpreted by the X server.
-<function>XGetSelectionOwner</function>
-returns the owner window, which is reported in
-<symbol>SelectionRequest</symbol>
-and
-<symbol>SelectionClear</symbol>
-events.
-Selections are global to the X server.
-</para>
-<para>
-<!-- .LP -->
-<function>XSetSelectionOwner</function>
-can generate
-<errorname>BadAtom</errorname>
-and
-<errorname>BadWindow</errorname>
-errors.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-To return the selection owner, use
-<function>XGetSelectionOwner</function>.
-<indexterm><primary>Selection</primary><secondary>getting the owner</secondary></indexterm>
-<indexterm significance="preferred"><primary>XGetSelectionOwner</primary></indexterm>
-<!-- .sM -->
-<funcsynopsis>
-<funcprototype>
- <funcdef>Window <function>XGetSelectionOwner</function></funcdef>
- <paramdef>Display<parameter> *display</parameter></paramdef>
- <paramdef>Atom<parameter> selection</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
- <varlistentry>
- <term>
- <emphasis remap='I'>display</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the connection to the X server.
-<!-- .ds Se whose owner you want returned -->
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>selection</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the selection atom (Se.
- </para>
- </listitem>
- </varlistentry>
-</variablelist>
-</para>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XGetSelectionOwner</function>
-function
-returns the window ID associated with the window that currently owns the
-specified selection.
-If no selection was specified, the function returns the constant
-<symbol>None</symbol>.
-If
-<symbol>None</symbol>
-is returned,
-there is no owner for the selection.
-</para>
-<para>
-<!-- .LP -->
-<function>XGetSelectionOwner</function>
-can generate a
-<errorname>BadAtom</errorname>
-error.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-To request conversion of a selection, use
-<function>XConvertSelection</function>.
-<indexterm><primary>Selection</primary><secondary>converting</secondary></indexterm>
-<indexterm significance="preferred"><primary>XConvertSelection</primary></indexterm>
-<!-- .sM -->
-<funcsynopsis>
-<funcprototype>
- <funcdef><function>XConvertSelection</function></funcdef>
- <paramdef>Display<parameter> *display</parameter></paramdef>
- <paramdef>Atomselection,<parameter> target</parameter></paramdef>
- <paramdef>Atom<parameter> property</parameter></paramdef>
- <paramdef>Window<parameter> requestor</parameter></paramdef>
- <paramdef>Time<parameter> time</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
- <varlistentry>
- <term>
- <emphasis remap='I'>display</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the connection to the X server.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>selection</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the selection atom.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>target</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the target atom.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>property</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the property name.
-You also can pass
-<symbol>None</symbol>.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>requestor</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the requestor.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- <emphasis remap='I'>time</emphasis>
- </term>
- <listitem>
- <para>
-Specifies the time.
-You can pass either a timestamp or
-<symbol>CurrentTime</symbol>.
- </para>
- </listitem>
- </varlistentry>
-</variablelist>
-</para>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<function>XConvertSelection</function>
-requests that the specified selection be converted to the specified target
-type:
-</para>
-<itemizedlist>
- <listitem>
- <para>
-If the specified selection has an owner, the X server sends a
-<symbol>SelectionRequest</symbol>
-event to that owner.
- </para>
- </listitem>
- <listitem>
- <para>
-If no owner for the specified
-selection exists, the X server generates a
-<symbol>SelectionNotify</symbol>
-event to the
-requestor with property
-<symbol>None</symbol>.
- </para>
- </listitem>
-</itemizedlist>
-<para>
-<!-- .LP -->
-The arguments are passed on unchanged in either of the events.
-There are two predefined selection atoms: PRIMARY and SECONDARY.
-</para>
-<para>
-<!-- .LP -->
-<function>XConvertSelection</function>
-can generate
-<errorname>BadAtom</errorname>
-and
-<errorname>BadWindow</errorname>
-errors.
-<!-- .bp -->
-
-
-</para>
-</sect1>
-</chapter>
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
+<chapter id="window_information_functions">
+<title>Window Information Functions</title>
+
+<para>
+After you connect the display to the X server and create a window, you can use the Xlib window
+information functions to:
+</para>
+<itemizedlist>
+ <listitem><para>Obtain information about a window</para></listitem>
+ <listitem><para>Translate screen coordinates</para></listitem>
+ <listitem><para>Manipulate property lists</para></listitem>
+ <listitem><para>Obtain and change window properties</para></listitem>
+ <listitem><para>Manipulate selections</para></listitem>
+</itemizedlist>
+
+<sect1 id="Obtaining_Window_Information">
+<title>Obtaining Window Information</title>
+<!-- .XS -->
+<!-- (SN Obtaining Window Information -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+Xlib provides functions that you can use to obtain information about
+the window tree, the window's current attributes,
+the window's current geometry, or the current pointer coordinates.
+Because they are most frequently used by window managers,
+these functions all return a status to indicate whether the window still
+exists.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+To obtain the parent, a list of children, and number of children for
+a given window, use
+<function>XQueryTree</function>.
+<indexterm><primary>Child Window</primary></indexterm>
+<indexterm><primary>Parent Window</primary></indexterm>
+<indexterm significance="preferred"><primary>XQueryTree</primary></indexterm>
+<!-- .sM -->
+<funcsynopsis id='xquerytree'>
+<funcprototype>
+ <funcdef>Status <function>XQueryTree</function></funcdef>
+ <paramdef>Display<parameter> *display</parameter></paramdef>
+ <paramdef>Window<parameter> w</parameter></paramdef>
+ <paramdef>Window<parameter> *root_return</parameter></paramdef>
+ <paramdef>Window<parameter> *parent_return</parameter></paramdef>
+ <paramdef>Window<parameter> **children_return</parameter></paramdef>
+ <paramdef>unsignedint<parameter> *nchildren_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>display</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+<!-- .ds Wi whose list of children, root, parent, and number of children \ -->
+you want to obtain
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>w</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the window (Wi.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>root_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns the root window.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>parent_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns the parent window.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>children_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns the list of children.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>nchildren_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns the number of children.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XQueryTree</function>
+function returns the root ID, the parent window ID,
+a pointer to the list of children windows
+(NULL when there are no children),
+and the number of children in the list for the specified window.
+The children are listed in current stacking order, from bottom-most
+(first) to top-most (last).
+<function>XQueryTree</function>
+returns zero if it fails and nonzero if it succeeds.
+To free a non-NULL children list when it is no longer needed, use
+<function>XFree</function>.
+</para>
+<para>
+<!-- .LP -->
+<function>XQueryTree</function>
+can generate a
+<errorname>BadWindow</errorname>
+error.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+To obtain the current attributes of a given window, use
+<function>XGetWindowAttributes</function>.
+<indexterm significance="preferred"><primary>XGetWindowAttributes</primary></indexterm>
+<!-- .sM -->
+<funcsynopsis id='xgetwindowattributes'>
+<funcprototype>
+ <funcdef>Status <function>XGetWindowAttributes</function></funcdef>
+ <paramdef>Display<parameter> *display</parameter></paramdef>
+ <paramdef>Window<parameter> w</parameter></paramdef>
+ <paramdef>XWindowAttributes<parameter> *window_attributes_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>display</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+<!-- .ds Wi whose current attributes you want to obtain -->
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>w</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the window (Wi.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>window_attributes_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns the specified window's attributes in the
+<structname>XWindowAttributes</structname>
+structure.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XGetWindowAttributes</function>
+function returns the current attributes for the specified window to an
+<structname>XWindowAttributes</structname>
+structure.
+</para>
+<para>
+<!-- .LP -->
+<indexterm significance="preferred"><primary>XWindowAttributes</primary></indexterm>
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i 3i -->
+<!-- .ta .5i 3i -->
+typedef struct {
+ int x, y; /* location of window */
+ int width, height; /* width and height of window */
+ int border_width; /* border width of window */
+ int depth; /* depth of window */
+ Visual *visual; /* the associated visual structure */
+ Window root; /* root of screen containing window */
+ int class; /* InputOutput, InputOnly*/
+ int bit_gravity; /* one of the bit gravity values */
+ int win_gravity; /* one of the window gravity values */
+ int backing_store; /* NotUseful, WhenMapped, Always */
+ unsigned long backing_planes; /* planes to be preserved if possible */
+ unsigned long backing_pixel; /* value to be used when restoring planes */
+ Bool save_under; /* boolean, should bits under be saved? */
+ Colormap colormap; /* color map to be associated with window */
+ Bool map_installed; /* boolean, is color map currently installed*/
+ int map_state; /* IsUnmapped, IsUnviewable, IsViewable */
+ long all_event_masks; /* set of events all people have interest in*/
+ long your_event_mask; /* my event mask */
+ long do_not_propagate_mask; /* set of events that should not propagate */
+ Bool override_redirect; /* boolean value for override-redirect */
+ Screen *screen; /* back pointer to correct screen */
+} XWindowAttributes;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The x and y members are set to the upper-left outer
+corner relative to the parent window's origin.
+The width and height members are set to the inside size of the window,
+not including the border.
+The border_width member is set to the window's border width in pixels.
+The depth member is set to the depth of the window
+(that is, bits per pixel for the object).
+The visual member is a pointer to the screen's associated
+<structname>Visual</structname>
+structure.
+The root member is set to the root window of the screen containing the window.
+The class member is set to the window's class and can be either
+<symbol>InputOutput</symbol>
+or
+<symbol>InputOnly</symbol>.
+</para>
+<para>
+<!-- .LP -->
+The bit_gravity member is set to the window's bit gravity
+and can be one of the following:
+ <simplelist type="vert" columns="2">
+ <member><symbol>ForgetGravity</symbol></member>
+ <member><symbol>NorthWestGravity</symbol></member>
+ <member><symbol>NorthGravity</symbol></member>
+ <member><symbol>NorthEastGravity</symbol></member>
+ <member><symbol>WestGravity</symbol></member>
+
+ <member><symbol>EastGravity</symbol></member>
+ <member><symbol>SouthWestGravity</symbol></member>
+ <member><symbol>SouthGravity</symbol></member>
+ <member><symbol>SouthEastGravity</symbol></member>
+ <member><symbol>StaticGravity</symbol></member>
+ </simplelist>
+</para>
+<para>
+The win_gravity member is set to the window's window gravity
+and can be one of the following:
+ <simplelist type="vert" columns="2">
+ <member><symbol>UnmapGravity</symbol></member>
+ <member><symbol>NorthWestGravity</symbol></member>
+ <member><symbol>NorthGravity</symbol></member>
+ <member><symbol>NorthEastGravity</symbol></member>
+ <member><symbol>WestGravity</symbol></member>
+
+ <member><symbol>EastGravity</symbol></member>
+ <member><symbol>SouthWestGravity</symbol></member>
+ <member><symbol>SouthGravity</symbol></member>
+ <member><symbol>SouthEastGravity</symbol></member>
+ <member><symbol>StaticGravity</symbol></member>
+ <member><symbol>CenterGravity</symbol></member>
+ </simplelist>
+</para>
+<para>
+<!-- .LP -->
+For additional information on gravity,
+see section 3.2.3. <!-- xref -->
+</para>
+<para>
+<!-- .LP -->
+The backing_store member is set to indicate how the X server should maintain
+the contents of a window
+and can be
+<symbol>WhenMapped</symbol>,
+<symbol>Always</symbol>,
+or
+<symbol>NotUseful</symbol>.
+The backing_planes member is set to indicate (with bits set to 1) which bit
+planes of the window hold dynamic data that must be preserved in backing_stores
+and during save_unders.
+The backing_pixel member is set to indicate what values to use
+for planes not set in backing_planes.
+</para>
+<para>
+<!-- .LP -->
+The save_under member is set to
+<symbol>True</symbol>
+or
+<symbol>False</symbol>.
+The colormap member is set to the colormap for the specified window and can be
+a colormap ID or
+<symbol>None</symbol>.
+The map_installed member is set to indicate whether the colormap is
+currently installed and can be
+<symbol>True</symbol>
+or
+<symbol>False</symbol>.
+The map_state member is set to indicate the state of the window and can be
+<symbol>IsUnmapped</symbol>,
+<symbol>IsUnviewable</symbol>,
+or
+<symbol>IsViewable</symbol>.
+<symbol>IsUnviewable</symbol>
+is used if the window is mapped but some ancestor is unmapped.
+</para>
+<para>
+<!-- .LP -->
+The all_event_masks member is set to the bitwise inclusive OR of all event
+masks selected on the window by all clients.
+The your_event_mask member is set to the bitwise inclusive OR of all event
+masks selected by the querying client.
+The do_not_propagate_mask member is set to the bitwise inclusive OR of the
+set of events that should not propagate.
+</para>
+<para>
+<!-- .LP -->
+The override_redirect member is set to indicate whether this window overrides
+structure control facilities and can be
+<symbol>True</symbol>
+or
+<symbol>False</symbol>.
+Window manager clients should ignore the window if this member is
+<symbol>True</symbol>.
+</para>
+<para>
+<!-- .LP -->
+The screen member is set to a screen pointer that gives you a back pointer
+to the correct screen.
+This makes it easier to obtain the screen information without
+having to loop over the root window fields to see which field matches.
+</para>
+<para>
+<!-- .LP -->
+<function>XGetWindowAttributes</function>
+can generate
+<errorname>BadDrawable</errorname>
+and
+<errorname>BadWindow</errorname>
+errors.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+To obtain the current geometry of a given drawable, use
+<function>XGetGeometry</function>.
+<indexterm significance="preferred"><primary>XGetGeometry</primary></indexterm>
+<!-- .sM -->
+<funcsynopsis id='xgetgeometry'>
+<funcprototype>
+ <funcdef>Status <function>XGetGeometry</function></funcdef>
+ <paramdef>Display<parameter> *display</parameter></paramdef>
+ <paramdef>Drawable<parameter> d</parameter></paramdef>
+ <paramdef>Window<parameter> *root_return</parameter></paramdef>
+ <paramdef>int*x_return,<parameter> *y_return</parameter></paramdef>
+ <paramdef>unsignedint*width_return,<parameter> *height_return</parameter></paramdef>
+ <paramdef>unsignedint<parameter> *border_width_return</parameter></paramdef>
+ <paramdef>unsignedint<parameter> *depth_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>display</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+<!-- .ds Dr , which can be a window or a pixmap -->
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>d</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the drawable(Dr.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>root_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns the root window.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>x_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+<!-- .br -->
+<!-- .ns -->
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>y_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Return the x and y coordinates that define the location of the drawable.
+For a window,
+these coordinates specify the upper-left outer corner relative to
+its parent's origin.
+For pixmaps, these coordinates are always zero.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>width_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+<!-- .br -->
+<!-- .ns -->
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>height_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Return the drawable's dimensions (width and height).
+For a window,
+these dimensions specify the inside size, not including the border.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>border_width_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns the border width in pixels.
+If the drawable is a pixmap, it returns zero.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>depth_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns the depth of the drawable (bits per pixel for the object).
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XGetGeometry</function>
+function returns the root window and the current geometry of the drawable.
+The geometry of the drawable includes the x and y coordinates, width and height,
+border width, and depth.
+These are described in the argument list.
+It is legal to pass to this function a window whose class is
+<symbol>InputOnly</symbol>.
+</para>
+<para>
+<!-- .LP -->
+<function>XGetGeometry</function>
+can generate a
+<errorname>BadDrawable</errorname>
+error.
+</para>
+</sect1>
+<sect1 id="Translating_Screen_Coordinates">
+<title>Translating Screen Coordinates</title>
+<!-- .XS -->
+<!-- (SN Translating Screen Coordinates -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+Applications sometimes
+need to perform a coordinate transformation from the coordinate
+space of one window to another window or need to determine which
+window the pointing device is in.
+<function>XTranslateCoordinates</function>
+and
+<function>XQueryPointer</function>
+fulfill these needs (and avoid any race conditions) by
+asking the X server to perform these operations.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+To translate a coordinate in one window to the coordinate
+space of another window, use
+<function>XTranslateCoordinates</function>.
+<indexterm significance="preferred"><primary>XTranslateCoordinates</primary></indexterm>
+<!-- .sM -->
+<funcsynopsis id='xtranslatecoordinates'>
+<funcprototype>
+ <funcdef>Bool <function>XTranslateCoordinates</function></funcdef>
+ <paramdef>Display<parameter> *display</parameter></paramdef>
+ <paramdef>Windowsrc_w,<parameter> dest_w</parameter></paramdef>
+ <paramdef>intsrc_x,<parameter> src_y</parameter></paramdef>
+ <paramdef>int*dest_x_return,<parameter> *dest_y_return</parameter></paramdef>
+ <paramdef>Window<parameter> *child_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>display</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>src_w</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the source window.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>dest_w</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the destination window.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>src_x</emphasis>
+ </term>
+ <listitem>
+ <para>
+<!-- .br -->
+<!-- .ns -->
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>src_y</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specify the x and y coordinates within the source window.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>dest_x_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+<!-- .br -->
+<!-- .ns -->
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>dest_y_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Return the x and y coordinates within the destination window.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>child_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns the child if the coordinates are contained in a mapped child of the
+destination window.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+If
+<function>XTranslateCoordinates</function>
+returns
+<symbol>True</symbol>,
+it takes the src_x and src_y coordinates relative
+to the source window's origin and returns these coordinates to
+dest_x_return and dest_y_return
+relative to the destination window's origin.
+If
+<function>XTranslateCoordinates</function>
+returns
+<symbol>False</symbol>,
+src_w and dest_w are on different screens,
+and dest_x_return and dest_y_return are zero.
+If the coordinates are contained in a mapped child of dest_w,
+that child is returned to child_return.
+Otherwise, child_return is set to
+<symbol>None</symbol>.
+</para>
+<para>
+<!-- .LP -->
+<function>XTranslateCoordinates</function>
+can generate a
+<errorname>BadWindow</errorname>
+error.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+To obtain the screen coordinates of the pointer
+or to determine the pointer coordinates relative to a specified window, use
+<function>XQueryPointer</function>.
+<indexterm significance="preferred"><primary>XQueryPointer</primary></indexterm>
+<!-- .sM -->
+<funcsynopsis id='xquerypointer'>
+<funcprototype>
+ <funcdef>Bool <function>XQueryPointer</function></funcdef>
+ <paramdef>Display<parameter> *display</parameter></paramdef>
+ <paramdef>Window<parameter> w</parameter></paramdef>
+ <paramdef>Window*root_return,<parameter> *child_return</parameter></paramdef>
+ <paramdef>int*root_x_return,<parameter> *root_y_return</parameter></paramdef>
+ <paramdef>int*win_x_return,<parameter> *win_y_return</parameter></paramdef>
+ <paramdef>unsignedint<parameter> *mask_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>display</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>w</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the window.
+<!-- .ds Ro that the pointer is in -->
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>root_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns the root window (Ro.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>child_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns the child window that the pointer is located in, if any.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>root_x_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+<!-- .br -->
+<!-- .ns -->
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>root_y_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Return the pointer coordinates relative to the root window's origin.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>win_x_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+<!-- .br -->
+<!-- .ns -->
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>win_y_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Return the pointer coordinates relative to the specified window.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>mask_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns the current state of the modifier keys and pointer buttons.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XQueryPointer</function>
+function returns the root window the pointer is logically on and the pointer
+coordinates relative to the root window's origin.
+If
+<function>XQueryPointer</function>
+returns
+<symbol>False</symbol>,
+the pointer is not on the same screen as the specified window, and
+<function>XQueryPointer</function>
+returns
+<symbol>None</symbol>
+to child_return and zero to win_x_return and win_y_return.
+If
+<function>XQueryPointer</function>
+returns
+<symbol>True</symbol>,
+the pointer coordinates returned to win_x_return and win_y_return
+are relative to the origin of the specified window.
+In this case,
+<function>XQueryPointer</function>
+returns the child that contains the pointer, if any,
+or else
+<symbol>None</symbol>
+to child_return.
+</para>
+<para>
+<!-- .LP -->
+<function>XQueryPointer</function>
+returns the current logical state of the keyboard buttons
+and the modifier keys in mask_return.
+It sets mask_return to the bitwise inclusive OR of one or more
+of the button or modifier key bitmasks to match
+the current state of the mouse buttons and the modifier keys.
+</para>
+<para>
+<!-- .LP -->
+Note that the logical state of a device (as seen through Xlib)
+may lag the physical state if device event processing is frozen
+(see section 12.1). <!-- xref -->
+</para>
+<para>
+<!-- .LP -->
+<function>XQueryPointer</function>
+can generate a
+<errorname>BadWindow</errorname>
+error.
+</para>
+</sect1>
+<sect1 id="Properties_and_Atoms">
+<title>Properties and Atoms</title>
+<!-- .XS -->
+<!-- (SN Properties and Atoms -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+A property is a collection of named, typed data.
+The window system has a set of predefined properties
+<indexterm><primary>Atom</primary><secondary>predefined</secondary></indexterm>
+(for example, the name of a window, size hints, and so on), and users can
+define any other arbitrary information and associate it with windows.
+Each property has a name,
+which is an ISO Latin-1 string.
+For each named property,
+a unique identifier (atom) is associated with it.
+A property also has a type, for example, string or integer.
+These types are also indicated using atoms, so arbitrary new
+types can be defined.
+Data of only one type may be associated with a single
+property name.
+Clients can store and retrieve properties associated with windows.
+For efficiency reasons,
+an atom is used rather than a character string.
+<function>XInternAtom</function>
+can be used to obtain the atom for property names.
+<indexterm><primary>Atom</primary></indexterm>
+</para>
+<para>
+<!-- .LP -->
+A property is also stored in one of several possible formats.
+The X server can store the information as 8-bit quantities, 16-bit
+quantities, or 32-bit quantities.
+This permits the X server to present the data in the byte order that the
+client expects.
+<!-- .NT Note -->
+If you define further properties of complex type,
+you must encode and decode them yourself.
+These functions must be carefully written if they are to be portable.
+For further information about how to write a library extension,
+see appendix C. <!-- xref -->
+<!-- .NE -->
+The type of a property is defined by an atom, which allows for
+arbitrary extension in this type scheme.
+<indexterm><primary>Atom</primary></indexterm>
+</para>
+<para>
+<!-- .LP -->
+Certain property names are
+predefined in the server for commonly used functions.
+The atoms for these properties are defined in
+<filename class="headerfile">&lt;X11/Xatom.h&gt;</filename>.
+<indexterm type="file"><primary><filename class="headerfile">X11/Xatom.h</filename></primary></indexterm>
+<indexterm><primary>Files</primary><secondary><filename class="headerfile">&lt;X11/Xatom.h&gt;</filename></secondary></indexterm>
+<indexterm><primary>Headers</primary><secondary><filename class="headerfile">&lt;X11/Xatom.h&gt;</filename></secondary></indexterm>
+To avoid name clashes with user symbols, the
+<code>#define</code>
+name for each atom has the XA_ prefix.
+For an explanation of the functions that let you get and set
+much of the information stored in these predefined properties,
+see chapter 14. <!-- xref -->
+</para>
+<para>
+<!-- .LP -->
+The core protocol imposes no semantics on these property names,
+but semantics are specified in other X Consortium standards,
+such as the <emphasis remap='I'>Inter-Client Communication Conventions Manual</emphasis>
+and the <emphasis remap='I'>X Logical Font Description Conventions</emphasis>.
+</para>
+<para>
+<!-- .LP -->
+You can use properties to communicate other information between
+applications.
+The functions described in this section let you define new properties
+and get the unique atom IDs in your applications.
+</para>
+<para>
+<!-- .LP -->
+Although any particular atom can have some client interpretation
+within each of the name spaces,
+atoms occur in five distinct name spaces within the protocol:
+</para>
+<itemizedlist>
+ <listitem>
+ <para>
+Selections
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+Property names
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+Property types
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+Font properties
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+Type of a
+<symbol>ClientMessage</symbol>
+event (none are built into the X server)
+ </para>
+ </listitem>
+</itemizedlist>
+<para>
+<!-- .LP -->
+</para>
+<para>
+<!-- .LP -->
+The built-in selection property names are:
+<simplelist type="vert" columns="2">
+ <member><property>PRIMARY</property></member>
+ <member><property>SECONDARY</property></member>
+</simplelist>
+</para>
+<para>
+<!-- .LP -->
+The built-in property names are:
+ <simplelist type="vert" columns="2">
+ <member><property>CUT_BUFFER0</property></member>
+ <member><property>CUT_BUFFER1</property></member>
+ <member><property>CUT_BUFFER2</property></member>
+ <member><property>CUT_BUFFER3</property></member>
+ <member><property>CUT_BUFFER4</property></member>
+ <member><property>CUT_BUFFER5</property></member>
+ <member><property>CUT_BUFFER6</property></member>
+ <member><property>CUT_BUFFER7</property></member>
+ <member><property>RGB_BEST_MAP</property></member>
+ <member><property>RGB_BLUE_MAP</property></member>
+ <member><property>RGB_DEFAULT_MAP</property></member>
+ <member><property>RGB_GRAY_MAP</property></member>
+ <member><property>RGB_GREEN_MAP</property></member>
+ <member><property>RGB_RED_MAP</property></member>
+
+ <member><property>RESOURCE_MANAGER</property></member>
+ <member><property>WM_CLASS</property></member>
+ <member><property>WM_CLIENT_MACHINE</property></member>
+ <member><property>WM_COLORMAP_WINDOWS</property></member>
+ <member><property>WM_COMMAND</property></member>
+ <member><property>WM_HINTS</property></member>
+ <member><property>WM_ICON_NAME</property></member>
+ <member><property>WM_ICON_SIZE</property></member>
+ <member><property>WM_NAME</property></member>
+ <member><property>WM_NORMAL_HINTS</property></member>
+ <member><property>WM_PROTOCOLS</property></member>
+ <member><property>WM_STATE</property></member>
+ <member><property>WM_TRANSIENT_FOR</property></member>
+ <member><property>WM_ZOOM_HINTS</property></member>
+ </simplelist>
+</para>
+<para>
+The built-in property types are:
+ <simplelist type="vert" columns="2">
+ <member><property>ARC</property></member>
+ <member><property>ATOM</property></member>
+ <member><property>BITMAP</property></member>
+ <member><property>CARDINAL</property></member>
+ <member><property>COLORMAP</property></member>
+ <member><property>CURSOR</property></member>
+ <member><property>DRAWABLE</property></member>
+ <member><property>FONT</property></member>
+ <member><property>INTEGER</property></member>
+ <member><property>PIXMAP</property></member>
+ <member><property>POINT</property></member>
+ <member><property>RGB_COLOR_MAP</property></member>
+ <member><property>RECTANGLE</property></member>
+ <member><property>STRING</property></member>
+ <member><property>VISUALID</property></member>
+ <member><property>WINDOW</property></member>
+ <member><property>WM_HINTS</property></member>
+ <member><property>WM_SIZE_HINTS</property></member>
+ </simplelist>
+</para>
+<para>
+The built-in font property names are:
+ <simplelist type="vert" columns="2">
+ <member><property>MIN_SPACE</property></member>
+ <member><property>NORM_SPACE</property></member>
+ <member><property>MAX_SPACE</property></member>
+ <member><property>END_SPACE</property></member>
+ <member><property>SUPERSCRIPT_X</property></member>
+ <member><property>SUPERSCRIPT_Y</property></member>
+ <member><property>SUBSCRIPT_X</property></member>
+ <member><property>SUBSCRIPT_Y</property></member>
+ <member><property>UNDERLINE_POSITION</property></member>
+ <member><property>UNDERLINE_THICKNESS</property></member>
+ <member><property>FONT_NAME</property></member>
+ <member><property>FULL_NAME</property></member>
+
+ <member><property>STRIKEOUT_DESCENT</property></member>
+ <member><property>STRIKEOUT_ASCENT</property></member>
+ <member><property>ITALIC_ANGLE</property></member>
+ <member><property>X_HEIGHT</property></member>
+ <member><property>QUAD_WIDTH</property></member>
+ <member><property>WEIGHT</property></member>
+ <member><property>POINT_SIZE</property></member>
+ <member><property>RESOLUTION</property></member>
+ <member><property>COPYRIGHT</property></member>
+ <member><property>NOTICE</property></member>
+ <member><property>FAMILY_NAME</property></member>
+ <member><property>CAP_HEIGHT</property></member>
+ </simplelist>
+</para>
+<para>
+<!-- .LP -->
+For further information about font properties,
+see section 8.5. <!-- xref -->
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+To return an atom for a given name, use
+<function>XInternAtom</function>.
+<indexterm><primary>Atom</primary><secondary>interning</secondary></indexterm>
+<indexterm significance="preferred"><primary>XInternAtom</primary></indexterm>
+<!-- .sM -->
+<funcsynopsis id='xinternatom'>
+<funcprototype>
+ <funcdef>Atom <function>XInternAtom</function></funcdef>
+ <paramdef>Display<parameter> *display</parameter></paramdef>
+ <paramdef>char<parameter> *atom_name</parameter></paramdef>
+ <paramdef>Bool<parameter> only_if_exists</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>display</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>atom_name</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the name associated with the atom you want returned.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>only_if_exists</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies a Boolean value that indicates whether the atom must be created.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XInternAtom</function>
+function returns the atom identifier associated with the specified atom_name
+string.
+If only_if_exists is
+<symbol>False</symbol>,
+the atom is created if it does not exist.
+Therefore,
+<function>XInternAtom</function>
+can return
+<symbol>None</symbol>.
+If the atom name is not in the Host Portable Character Encoding,
+the result is implementation-dependent.
+Uppercase and lowercase matter;
+the strings ``thing'', ``Thing'', and ``thinG''
+all designate different atoms.
+The atom will remain defined even after the client's connection closes.
+It will become undefined only when the last connection to
+the X server closes.
+</para>
+<para>
+<!-- .LP -->
+<function>XInternAtom</function>
+can generate
+<errorname>BadAlloc</errorname>
+and
+<errorname>BadValue</errorname>
+errors.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+To return atoms for an array of names, use
+<function>XInternAtoms</function>.
+<indexterm><primary>Atom</primary><secondary>interning</secondary></indexterm>
+<indexterm significance="preferred"><primary>XInternAtoms</primary></indexterm>
+<!-- .sM -->
+<funcsynopsis id='xinternatoms'>
+<funcprototype>
+ <funcdef>Status <function>XInternAtoms</function></funcdef>
+ <paramdef>Display<parameter> *display</parameter></paramdef>
+ <paramdef>char<parameter> **names</parameter></paramdef>
+ <paramdef>int<parameter> count</parameter></paramdef>
+ <paramdef>Bool<parameter> only_if_exists</parameter></paramdef>
+ <paramdef>Atom<parameter> *atoms_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>display</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>names</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the array of atom names.
+<!-- .ds Cn atom names in the array -->
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>count</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the number of (Cn.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>only_if_exists</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies a Boolean value that indicates whether the atom must be created.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>atoms_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns the atoms.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XInternAtoms</function>
+function returns the atom identifiers associated with the specified names.
+The atoms are stored in the atoms_return array supplied by the caller.
+Calling this function is equivalent to calling
+<function>XInternAtom</function>
+for each of the names in turn with the specified value of only_if_exists,
+but this function minimizes the number of round-trip protocol exchanges
+between the client and the X server.
+</para>
+<para>
+<!-- .LP -->
+This function returns a nonzero status if atoms are returned for
+all of the names;
+otherwise, it returns zero.
+</para>
+<para>
+<!-- .LP -->
+<function>XInternAtoms</function>
+can generate
+<errorname>BadAlloc</errorname>
+and
+<errorname>BadValue</errorname>
+errors.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+To return a name for a given atom identifier, use
+<function>XGetAtomName</function>.
+<indexterm><primary>Atom</primary><secondary>getting name</secondary></indexterm>
+<indexterm significance="preferred"><primary>XGetAtomName</primary></indexterm>
+<!-- .sM -->
+<funcsynopsis id='xgetatomname'>
+<funcprototype>
+ <funcdef>char *<function>XGetAtomName</function></funcdef>
+ <paramdef>Display<parameter> *display</parameter></paramdef>
+ <paramdef>Atom<parameter> atom</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>display</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>atom</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the atom for the property name you want returned.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XGetAtomName</function>
+function returns the name associated with the specified atom.
+If the data returned by the server is in the Latin Portable Character Encoding,
+then the returned string is in the Host Portable Character Encoding.
+Otherwise, the result is implementation-dependent.
+To free the resulting string,
+call
+<function>XFree</function>.
+</para>
+<para>
+<!-- .LP -->
+<function>XGetAtomName</function>
+can generate a
+<errorname>BadAtom</errorname>
+error.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+To return the names for an array of atom identifiers, use
+<function>XGetAtomNames</function>.
+<indexterm><primary>Atom</primary><secondary>getting name</secondary></indexterm>
+<indexterm significance="preferred"><primary>XGetAtomNames</primary></indexterm>
+<!-- .sM -->
+<funcsynopsis id='xgetatomnames'>
+<funcprototype>
+ <funcdef>Status <function>XGetAtomNames</function></funcdef>
+ <paramdef>Display<parameter> *display</parameter></paramdef>
+ <paramdef>Atom<parameter> *atoms</parameter></paramdef>
+ <paramdef>int<parameter> count</parameter></paramdef>
+ <paramdef>char<parameter> **names_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>display</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>atoms</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the array of atoms.
+<!-- .ds Cn atoms in the array -->
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>count</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the number of (Cn.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>names_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns the atom names.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XGetAtomNames</function>
+function returns the names associated with the specified atoms.
+The names are stored in the names_return array supplied by the caller.
+Calling this function is equivalent to calling
+<function>XGetAtomName</function>
+for each of the atoms in turn,
+but this function minimizes the number of round-trip protocol exchanges
+between the client and the X server.
+</para>
+<para>
+<!-- .LP -->
+This function returns a nonzero status if names are returned for
+all of the atoms;
+otherwise, it returns zero.
+</para>
+<para>
+<!-- .LP -->
+<function>XGetAtomNames</function>
+can generate a
+<errorname>BadAtom</errorname>
+error.
+</para>
+</sect1>
+<sect1 id="Obtaining_and_Changing_Window_Properties">
+<title>Obtaining and Changing Window Properties</title>
+<!-- .XS -->
+<!-- (SN Obtaining and Changing Window Properties -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+You can attach a property list to every window.
+Each property has a name, a type, and a value (see section 4.3). <!-- xref -->
+The value is an array of 8-bit, 16-bit, or 32-bit quantities,
+whose interpretation is left to the clients. The type
+<type>char</type>
+is used to represent 8-bit quantities, the type
+<type>short</type>
+is used to represent 16-bit quantities, and the type
+<type>long</type>
+is used to represent 32-bit quantities.
+</para>
+<para>
+<!-- .LP -->
+Xlib provides functions that you can use to obtain,
+change, update, or interchange window properties.
+In addition, Xlib provides other utility functions for inter-client
+communication (see chapter 14). <!-- xref -->
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+To obtain the type, format, and value of a property of a given window, use
+<function>XGetWindowProperty</function>.
+<indexterm><primary>Property</primary><secondary>getting</secondary></indexterm>
+</para>
+<para>
+<!-- .LP -->
+<indexterm significance="preferred"><primary>XGetWindowProperty</primary></indexterm>
+<!-- .sM -->
+<funcsynopsis id='xgetwindowproperty'>
+<funcprototype>
+ <funcdef>int <function>XGetWindowProperty</function></funcdef>
+ <paramdef><parameter> display</parameter></paramdef>
+ <paramdef><parameter> w</parameter></paramdef>
+ <paramdef><parameter> property</parameter></paramdef>
+ <paramdef><parameter> long_offset</parameter></paramdef>
+ <paramdef><parameter> long_length</parameter></paramdef>
+ <paramdef><parameter> delete</parameter></paramdef>
+ <paramdef><parameter> req_type</parameter></paramdef>
+ <paramdef><parameter> actual_type_return</parameter></paramdef>
+ <paramdef><parameter> actual_format_return</parameter></paramdef>
+ <paramdef><parameter> nitems_return</parameter></paramdef>
+ <paramdef><parameter> bytes_after_return</parameter></paramdef>
+ <paramdef>.br<parameter> prop_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>display</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+<!-- .ds Wi whose property you want to obtain -->
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>w</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the window (Wi.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>property</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the property name.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>long_offset</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the offset in the specified property (in 32-bit quantities)
+where the data is to be retrieved.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>long_length</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the length in 32-bit multiples of the data to be retrieved.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>delete</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies a Boolean value that determines whether the property is deleted.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>req_type</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the atom identifier associated with the property type or
+<symbol>AnyPropertyType</symbol>.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>actual_type_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns the atom identifier that defines the actual type of the property.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>actual_format_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns the actual format of the property.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>nitems_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns the actual number of 8-bit, 16-bit, or 32-bit items
+stored in the prop_return data.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>bytes_after_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns the number of bytes remaining to be read in the property if
+a partial read was performed.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>prop_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns the data in the specified format.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XGetWindowProperty</function>
+function returns the actual type of the property; the actual format of the property;
+the number of 8-bit, 16-bit, or 32-bit items transferred; the number of bytes remaining
+to be read in the property; and a pointer to the data actually returned.
+<function>XGetWindowProperty</function>
+sets the return arguments as follows:
+</para>
+<itemizedlist>
+ <listitem>
+ <para>
+If the specified property does not exist for the specified window,
+<function>XGetWindowProperty</function>
+returns
+<symbol>None</symbol>
+to actual_type_return and the value zero to
+actual_format_return and bytes_after_return.
+The nitems_return argument is empty.
+In this case, the delete argument is ignored.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+If the specified property exists
+but its type does not match the specified type,
+<function>XGetWindowProperty</function>
+returns the actual property type to actual_type_return,
+the actual property format (never zero) to actual_format_return,
+and the property length in bytes
+(even if the actual_format_return is 16 or 32)
+to bytes_after_return.
+It also ignores the delete argument.
+The nitems_return argument is empty.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+If the specified property exists and either you assign
+<symbol>AnyPropertyType</symbol>
+to the req_type argument or the specified type matches the actual property type,
+<function>XGetWindowProperty</function>
+returns the actual property type to actual_type_return and the actual
+property format (never zero) to actual_format_return.
+It also returns a value to bytes_after_return and nitems_return, by
+defining the following
+values:
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+<!-- .nf -->
+ N = actual length of the stored property in bytes
+ (even if the format is 16 or 32)
+ I = 4 * long_offset
+ T = N - I
+ L = MINIMUM(T, 4 * long_length)
+ A = N - (I + L)
+<!-- .fi -->
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+The returned value starts at byte index I in the property (indexing
+from zero), and its length in bytes is L.
+If the value for long_offset causes L to be negative,
+a
+<errorname>BadValue</errorname>
+error results.
+The value of bytes_after_return is A,
+giving the number of trailing unread bytes in the stored property.
+ </para>
+ </listitem>
+</itemizedlist>
+<para>
+<!-- .LP -->
+If the returned format is 8, the returned data is represented as a
+<type>char</type>
+array.
+If the returned format is 16, the returned data is represented as a
+<type>short</type>
+array and should be cast to that type to obtain the elements.
+If the returned format is 32, the returned data is represented as a
+<type>long</type>
+array and should be cast to that type to obtain the elements.
+</para>
+<para>
+<!-- .LP -->
+<function>XGetWindowProperty</function>
+always allocates one extra byte in prop_return
+(even if the property is zero length)
+and sets it to zero so that simple properties consisting of characters
+do not have to be copied into yet another string before use.
+</para>
+<para>
+<!-- .LP -->
+If delete is
+<symbol>True</symbol>
+and bytes_after_return is zero,
+<function>XGetWindowProperty</function>
+deletes the property
+from the window and generates a
+<symbol>PropertyNotify</symbol>
+event on the window.
+</para>
+<para>
+<!-- .LP -->
+The function returns
+<symbol>Success</symbol>
+if it executes successfully.
+To free the resulting data,
+use
+<function>XFree</function>.
+</para>
+<para>
+<!-- .LP -->
+<function>XGetWindowProperty</function>
+can generate
+<errorname>BadAtom</errorname>,
+<errorname>BadValue</errorname>,
+and
+<errorname>BadWindow</errorname>
+errors.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+To obtain a given window's property list, use
+<function>XListProperties</function>.
+<indexterm><primary>Property</primary><secondary>listing</secondary></indexterm>
+<indexterm significance="preferred"><primary>XListProperties</primary></indexterm>
+<!-- .sM -->
+<funcsynopsis id='xlistproperties'>
+<funcprototype>
+ <funcdef>Atom *<function>XListProperties</function></funcdef>
+ <paramdef>Display<parameter> *display</parameter></paramdef>
+ <paramdef>Window<parameter> w</parameter></paramdef>
+ <paramdef>int<parameter> *num_prop_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>display</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+<!-- .ds Wi whose property list you want to obtain -->
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>w</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the window (Wi.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>num_prop_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns the length of the properties array.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XListProperties</function>
+function returns a pointer to an array of atom properties that are defined for
+the specified window or returns NULL if no properties were found.
+To free the memory allocated by this function, use
+<function>XFree</function>.
+</para>
+<para>
+<!-- .LP -->
+<function>XListProperties</function>
+can generate a
+<errorname>BadWindow</errorname>
+error.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+To change a property of a given window, use
+<function>XChangeProperty</function>.
+<indexterm><primary>Property</primary><secondary>changing</secondary></indexterm>
+<indexterm><primary>Property</primary><secondary>appending</secondary></indexterm>
+<indexterm><primary>Property</primary><secondary>prepending</secondary></indexterm>
+<indexterm><primary>Property</primary><secondary>replacing</secondary></indexterm>
+<indexterm><primary>Property</primary><secondary>format</secondary></indexterm>
+<indexterm><primary>Property</primary><secondary>type</secondary></indexterm>
+<indexterm significance="preferred"><primary>XChangeProperty</primary></indexterm>
+<!-- .sM -->
+<funcsynopsis id='xchangeproperty'>
+<funcprototype>
+ <funcdef><function>XChangeProperty</function></funcdef>
+ <paramdef>Display<parameter> *display</parameter></paramdef>
+ <paramdef>Window<parameter> w</parameter></paramdef>
+ <paramdef>Atomproperty,<parameter> type</parameter></paramdef>
+ <paramdef>int<parameter> format</parameter></paramdef>
+ <paramdef>int<parameter> mode</parameter></paramdef>
+ <paramdef>unsignedchar<parameter> *data</parameter></paramdef>
+ <paramdef>int<parameter> nelements</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>display</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+<!-- .ds Wi whose property you want to change -->
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>w</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the window (Wi.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>property</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the property name.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>type</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the type of the property.
+The X server does not interpret the type but simply
+passes it back to an application that later calls
+<function>XGetWindowProperty</function>.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>format</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies whether the data should be viewed as a list
+of 8-bit, 16-bit, or 32-bit quantities.
+Possible values are 8, 16, and 32.
+This information allows the X server to correctly perform
+byte-swap operations as necessary.
+If the format is 16-bit or 32-bit,
+you must explicitly cast your data pointer to an (unsigned char *) in the call
+to
+<function>XChangeProperty</function>.
+<!-- .\" Changed name of this file to prop_mode.a on 1/13/87 -->
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>mode</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the mode of the operation.
+You can pass
+<symbol>PropModeReplace</symbol>,
+<symbol>PropModePrepend</symbol>,
+or
+<symbol>PropModeAppend</symbol>.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>data</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the property data.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>nelements</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the number of elements of the specified data format.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XChangeProperty</function>
+function alters the property for the specified window and
+causes the X server to generate a
+<symbol>PropertyNotify</symbol>
+event on that window.
+<function>XChangeProperty</function>
+performs the following:
+</para>
+<itemizedlist>
+ <listitem>
+ <para>
+If mode is
+<symbol>PropModeReplace</symbol>,
+<function>XChangeProperty</function>
+discards the previous property value and stores the new data.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+If mode is
+<symbol>PropModePrepend</symbol>
+or
+<symbol>PropModeAppend</symbol>,
+<function>XChangeProperty</function>
+inserts the specified data before the beginning of the existing data
+or onto the end of the existing data, respectively.
+The type and format must match the existing property value,
+or a
+<errorname>BadMatch</errorname>
+error results.
+If the property is undefined,
+it is treated as defined with the correct type and
+format with zero-length data.
+ </para>
+ </listitem>
+</itemizedlist>
+<para>
+<!-- .LP -->
+If the specified format is 8, the property data must be a
+<type>char</type>
+array.
+If the specified format is 16, the property data must be a
+<type>short</type>
+array.
+If the specified format is 32, the property data must be a
+<type>long</type>
+array.
+</para>
+<para>
+<!-- .LP -->
+The lifetime of a property is not tied to the storing client.
+Properties remain until explicitly deleted, until the window is destroyed,
+or until the server resets.
+For a discussion of what happens when the connection to the X server is closed,
+see section 2.6. <!-- xref -->
+The maximum size of a property is server dependent and can vary dynamically
+depending on the amount of memory the server has available.
+(If there is insufficient space, a
+<errorname>BadAlloc</errorname>
+error results.)
+</para>
+<para>
+<!-- .LP -->
+<function>XChangeProperty</function>
+can generate
+<errorname>BadAlloc</errorname>,
+<errorname>BadAtom</errorname>,
+<errorname>BadMatch</errorname>,
+<errorname>BadValue</errorname>,
+and
+<errorname>BadWindow</errorname>
+errors.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+To rotate a window's property list, use
+<function>XRotateWindowProperties</function>.
+</para>
+<para>
+<!-- .LP -->
+<indexterm significance="preferred"><primary>XRotateWindowProperties</primary></indexterm>
+<!-- .sM -->
+<funcsynopsis id='xrotatewindowproperties'>
+<funcprototype>
+ <funcdef><function>XRotateWindowProperties</function></funcdef>
+ <paramdef>Display<parameter> *display</parameter></paramdef>
+ <paramdef>Window<parameter> w</parameter></paramdef>
+ <paramdef>Atom<parameter> properties[]</parameter></paramdef>
+ <paramdef>int<parameter> num_prop</parameter></paramdef>
+ <paramdef>int<parameter> npositions</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>display</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>w</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the window.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>properties</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the array of properties that are to be rotated.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>num_prop</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the length of the properties array.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>npositions</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the rotation amount.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XRotateWindowProperties</function>
+function allows you to rotate properties on a window and causes
+the X server to generate
+<symbol>PropertyNotify</symbol>
+events.
+If the property names in the properties array are viewed as being numbered
+starting from zero and if there are num_prop property names in the list,
+then the value associated with property name I becomes the value associated
+with property name (I + npositions) mod N for all I from zero to N &minus; 1.
+The effect is to rotate the states by npositions places around the virtual ring
+of property names (right for positive npositions,
+left for negative npositions).
+If npositions mod N is nonzero,
+the X server generates a
+<symbol>PropertyNotify</symbol>
+event for each property in the order that they are listed in the array.
+If an atom occurs more than once in the list or no property with that
+name is defined for the window,
+a
+<errorname>BadMatch</errorname>
+error results.
+If a
+<errorname>BadAtom</errorname>
+or
+<errorname>BadMatch</errorname>
+error results,
+no properties are changed.
+</para>
+<para>
+<!-- .LP -->
+<function>XRotateWindowProperties</function>
+can generate
+<errorname>BadAtom</errorname>,
+<errorname>BadMatch</errorname>,
+and
+<errorname>BadWindow</errorname>
+errors.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+To delete a property on a given window, use
+<function>XDeleteProperty</function>.
+<indexterm><primary>Property</primary><secondary>deleting</secondary></indexterm>
+<indexterm significance="preferred"><primary>XDeleteProperty</primary></indexterm>
+<!-- .sM -->
+<funcsynopsis id='xdeleteproperty'>
+<funcprototype>
+ <funcdef><function>XDeleteProperty</function></funcdef>
+ <paramdef>Display<parameter> *display</parameter></paramdef>
+ <paramdef>Window<parameter> w</parameter></paramdef>
+ <paramdef>Atom<parameter> property</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>display</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+<!-- .ds Wi whose property you want to delete -->
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>w</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the window (Wi.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>property</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the property name.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XDeleteProperty</function>
+function deletes the specified property only if the
+property was defined on the specified window
+and causes the X server to generate a
+<symbol>PropertyNotify</symbol>
+event on the window unless the property does not exist.
+</para>
+<para>
+<!-- .LP -->
+<function>XDeleteProperty</function>
+can generate
+<errorname>BadAtom</errorname>
+and
+<errorname>BadWindow</errorname>
+errors.
+</para>
+</sect1>
+<sect1 id="Selections">
+<title>Selections</title>
+<!-- .XS -->
+<!-- (SN Selections -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+<indexterm><primary>Selection</primary></indexterm>
+Selections are one method used by applications to exchange data.
+By using the property mechanism,
+applications can exchange data of arbitrary types and can negotiate
+the type of the data.
+A selection can be thought of as an indirect property with a dynamic type.
+That is, rather than having the property stored in the X server,
+the property is maintained by some client (the owner).
+A selection is global in nature (considered to belong to the user
+but be maintained by clients) rather than being private to a particular
+window subhierarchy or a particular set of clients.
+</para>
+<para>
+<!-- .LP -->
+Xlib provides functions that you can use to set, get, or request conversion
+of selections.
+This allows applications to implement the notion of current selection,
+which requires that notification be sent to applications when they no
+longer own the selection.
+Applications that support selection often highlight the current selection
+and so must be informed when another application has
+acquired the selection so that they can unhighlight the selection.
+</para>
+<para>
+<!-- .LP -->
+When a client asks for the contents of
+a selection, it specifies a selection target type.
+This target type
+can be used to control the transmitted representation of the contents.
+For example, if the selection is ``the last thing the user clicked on''
+and that is currently an image, then the target type might specify
+whether the contents of the image should be sent in XY format or Z format.
+</para>
+<para>
+<!-- .LP -->
+The target type can also be used to control the class of
+contents transmitted, for example,
+asking for the ``looks'' (fonts, line
+spacing, indentation, and so forth) of a paragraph selection, not the
+text of the paragraph.
+The target type can also be used for other
+purposes.
+The protocol does not constrain the semantics.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+To set the selection owner, use
+<function>XSetSelectionOwner</function>.
+<indexterm><primary>Selection</primary><secondary>setting the owner</secondary></indexterm>
+<indexterm significance="preferred"><primary>XSetSelectionOwner</primary></indexterm>
+<!-- .sM -->
+<funcsynopsis id='xsetselectionowner'>
+<funcprototype>
+ <funcdef><function>XSetSelectionOwner</function></funcdef>
+ <paramdef>Display<parameter> *display</parameter></paramdef>
+ <paramdef>Atom<parameter> selection</parameter></paramdef>
+ <paramdef>Window<parameter> owner</parameter></paramdef>
+ <paramdef>Time<parameter> time</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>display</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>selection</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the selection atom.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>owner</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the owner of the specified selection atom.
+You can pass a window or
+<symbol>None</symbol>.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>time</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the time.
+You can pass either a timestamp or
+<symbol>CurrentTime</symbol>.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XSetSelectionOwner</function>
+function changes the owner and last-change time for the specified selection
+and has no effect if the specified time is earlier than the current
+last-change time of the specified selection
+or is later than the current X server time.
+Otherwise, the last-change time is set to the specified time,
+with
+<symbol>CurrentTime</symbol>
+replaced by the current server time.
+If the owner window is specified as
+<symbol>None</symbol>,
+then the owner of the selection becomes
+<symbol>None</symbol>
+(that is, no owner).
+Otherwise, the owner of the selection becomes the client executing
+the request.
+</para>
+<para>
+<!-- .LP -->
+If the new owner (whether a client or
+<symbol>None</symbol>)
+is not
+the same as the current owner of the selection and the current
+owner is not
+<symbol>None</symbol>,
+the current owner is sent a
+<symbol>SelectionClear</symbol>
+event.
+If the client that is the owner of a selection is later
+terminated (that is, its connection is closed)
+or if the owner window it has specified in the request is later
+destroyed,
+the owner of the selection automatically
+reverts to
+<symbol>None</symbol>,
+but the last-change time is not affected.
+The selection atom is uninterpreted by the X server.
+<function>XGetSelectionOwner</function>
+returns the owner window, which is reported in
+<symbol>SelectionRequest</symbol>
+and
+<symbol>SelectionClear</symbol>
+events.
+Selections are global to the X server.
+</para>
+<para>
+<!-- .LP -->
+<function>XSetSelectionOwner</function>
+can generate
+<errorname>BadAtom</errorname>
+and
+<errorname>BadWindow</errorname>
+errors.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+To return the selection owner, use
+<function>XGetSelectionOwner</function>.
+<indexterm><primary>Selection</primary><secondary>getting the owner</secondary></indexterm>
+<indexterm significance="preferred"><primary>XGetSelectionOwner</primary></indexterm>
+<!-- .sM -->
+<funcsynopsis id='xgetselectionowner'>
+<funcprototype>
+ <funcdef>Window <function>XGetSelectionOwner</function></funcdef>
+ <paramdef>Display<parameter> *display</parameter></paramdef>
+ <paramdef>Atom<parameter> selection</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>display</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+<!-- .ds Se whose owner you want returned -->
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>selection</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the selection atom (Se.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XGetSelectionOwner</function>
+function
+returns the window ID associated with the window that currently owns the
+specified selection.
+If no selection was specified, the function returns the constant
+<symbol>None</symbol>.
+If
+<symbol>None</symbol>
+is returned,
+there is no owner for the selection.
+</para>
+<para>
+<!-- .LP -->
+<function>XGetSelectionOwner</function>
+can generate a
+<errorname>BadAtom</errorname>
+error.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+To request conversion of a selection, use
+<function>XConvertSelection</function>.
+<indexterm><primary>Selection</primary><secondary>converting</secondary></indexterm>
+<indexterm significance="preferred"><primary>XConvertSelection</primary></indexterm>
+<!-- .sM -->
+<funcsynopsis id='xconvertselection'>
+<funcprototype>
+ <funcdef><function>XConvertSelection</function></funcdef>
+ <paramdef>Display<parameter> *display</parameter></paramdef>
+ <paramdef>Atomselection,<parameter> target</parameter></paramdef>
+ <paramdef>Atom<parameter> property</parameter></paramdef>
+ <paramdef>Window<parameter> requestor</parameter></paramdef>
+ <paramdef>Time<parameter> time</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>display</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>selection</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the selection atom.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>target</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the target atom.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>property</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the property name.
+You also can pass
+<symbol>None</symbol>.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>requestor</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the requestor.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>time</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the time.
+You can pass either a timestamp or
+<symbol>CurrentTime</symbol>.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XConvertSelection</function>
+requests that the specified selection be converted to the specified target
+type:
+</para>
+<itemizedlist>
+ <listitem>
+ <para>
+If the specified selection has an owner, the X server sends a
+<symbol>SelectionRequest</symbol>
+event to that owner.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+If no owner for the specified
+selection exists, the X server generates a
+<symbol>SelectionNotify</symbol>
+event to the
+requestor with property
+<symbol>None</symbol>.
+ </para>
+ </listitem>
+</itemizedlist>
+<para>
+<!-- .LP -->
+The arguments are passed on unchanged in either of the events.
+There are two predefined selection atoms: PRIMARY and SECONDARY.
+</para>
+<para>
+<!-- .LP -->
+<function>XConvertSelection</function>
+can generate
+<errorname>BadAtom</errorname>
+and
+<errorname>BadWindow</errorname>
+errors.
+<!-- .bp -->
+
+
+</para>
+</sect1>
+</chapter>
diff --git a/libX11/specs/libX11/CH05.xml b/libX11/specs/libX11/CH05.xml
index 08d78d666..5e136c88a 100644
--- a/libX11/specs/libX11/CH05.xml
+++ b/libX11/specs/libX11/CH05.xml
@@ -24,7 +24,7 @@ To create a pixmap of a given size, use
<function>XCreatePixmap</function>.
<indexterm significance="preferred"><primary>XCreatePixmap</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcreatepixmap'>
<funcprototype>
<funcdef>Pixmap <function>XCreatePixmap</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -136,7 +136,7 @@ To free all storage associated with a specified pixmap, use
<function>XFreePixmap</function>.
<indexterm significance="preferred"><primary>XFreePixmap</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xfreepixmap'>
<funcprototype>
<funcdef><function>XFreePixmap</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -228,7 +228,7 @@ To create a cursor from the standard cursor font, use
<indexterm significance="preferred"><primary>XCreateFontCursor</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcreatefontcursor'>
<funcprototype>
<funcdef>Cursor <function>XCreateFontCursor</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -295,7 +295,7 @@ To create a cursor from font glyphs, use
<function>XCreateGlyphCursor</function>.
<indexterm significance="preferred"><primary>XCreateGlyphCursor</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcreateglyphcursor'>
<funcprototype>
<funcdef>Cursor <function>XCreateGlyphCursor</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -434,7 +434,7 @@ use
<function>XCreatePixmapCursor</function>.
<indexterm significance="preferred"><primary>XCreatePixmapCursor</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcreatepixmapcursor'>
<funcprototype>
<funcdef>Cursor <function>XCreatePixmapCursor</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -581,7 +581,7 @@ To determine useful cursor sizes, use
<function>XQueryBestCursor</function>.
<indexterm significance="preferred"><primary>XQueryBestCursor</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xquerybestcursor'>
<funcprototype>
<funcdef>Status <function>XQueryBestCursor</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -686,7 +686,7 @@ To change the color of a given cursor, use
<function>XRecolorCursor</function>.
<indexterm significance="preferred"><primary>XRecolorCursor</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrecolorcursor'>
<funcprototype>
<funcdef><function>XRecolorCursor</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -764,7 +764,7 @@ To free (destroy) a given cursor, use
<function>XFreeCursor</function>.
<indexterm significance="preferred"><primary>XFreeCursor</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xfreecursor'>
<funcprototype>
<funcdef><function>XFreeCursor</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
diff --git a/libX11/specs/libX11/CH06.xml b/libX11/specs/libX11/CH06.xml
index a8224d8fc..8a2f0006a 100644
--- a/libX11/specs/libX11/CH06.xml
+++ b/libX11/specs/libX11/CH06.xml
@@ -814,7 +814,7 @@ To create a colormap for a screen, use
<function>XCreateColormap</function>.</para>
<indexterm significance="preferred"><primary>XCreateColormap</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcreatecolormap'>
<funcprototype>
<funcdef>Colormap <function>XCreateColormap</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -963,7 +963,7 @@ shared colormap has failed because of resource exhaustion, use
<function>XCopyColormapAndFree</function>.
<indexterm significance="preferred"><primary>XCopyColormapAndFree</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcopycolormapandfree'>
<funcprototype>
<funcdef>Colormap <function>XCopyColormapAndFree</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1040,7 +1040,7 @@ To destroy a colormap, use
<indexterm significance="preferred"><primary>XFreeColormap</primary></indexterm>
</para>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xfreecolormap'>
<funcprototype>
<funcdef><function>XFreeColormap</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1119,7 +1119,7 @@ To map a color name to an <acronym>RGB</acronym> value, use
<indexterm significance="preferred"><primary>XLookupColor</primary></indexterm>
<!-- .sM -->
</para>
-<funcsynopsis>
+<funcsynopsis id='xlookupcolor'>
<funcprototype>
<funcdef>Status <function>XLookupColor</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1216,7 +1216,7 @@ To map a color name to the exact <acronym>RGB</acronym> value, use
<indexterm><primary>Color</primary><secondary>naming</secondary></indexterm>
<indexterm significance="preferred"><primary>XParseColor</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xparsecolor'>
<funcprototype>
<funcdef>Status <function>XParseColor</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1306,7 +1306,7 @@ To map a color name to a value in an arbitrary color space, use
<indexterm><primary>Color</primary><secondary>naming</secondary></indexterm>
<indexterm significance="preferred"><primary>XcmsLookupColor</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmslookupcolor'>
<funcprototype>
<funcdef>Status <function>XcmsLookupColor</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1462,7 +1462,7 @@ To allocate a read-only color cell with an <acronym>RGB</acronym> value, use
<indexterm><primary>Color</primary><secondary>allocation</secondary></indexterm>
<indexterm significance="preferred"><primary>XAllocColor</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xalloccolor'>
<funcprototype>
<funcdef>Status <function>XAllocColor</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1552,7 +1552,7 @@ To allocate a read-only color cell with a color in arbitrary format, use
<indexterm><primary>Color</primary><secondary>allocation</secondary></indexterm>
<indexterm significance="preferred"><primary>XcmsAllocColor</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmsalloccolor'>
<funcprototype>
<funcdef>Status <function>XcmsAllocColor</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1657,7 +1657,7 @@ color supported by the hardware in <acronym>RGB</acronym> format, use
<indexterm><primary>Color</primary><secondary>allocation</secondary></indexterm>
<indexterm significance="preferred"><primary>XAllocNamedColor</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xallocnamedcolor'>
<funcprototype>
<funcdef>Status <function>XAllocNamedColor</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1762,7 +1762,7 @@ color supported by the hardware in an arbitrary format, use
<indexterm><primary>Color</primary><secondary>allocation</secondary></indexterm>
<indexterm significance="preferred"><primary>XcmsAllocNamedColor</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmsallocnamedcolor'>
<funcprototype>
<funcdef>Status <function>XcmsAllocNamedColor</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1911,7 +1911,7 @@ model, use
<indexterm><primary>Color</primary><secondary>allocation</secondary></indexterm>
<indexterm significance="preferred"><primary>XAllocColorCells</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xalloccolorcells'>
<funcprototype>
<funcdef>Status <function>XAllocColorCells</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2065,7 +2065,7 @@ model, use
<indexterm><primary>Color</primary><secondary>allocation</secondary></indexterm>
<indexterm significance="preferred"><primary>XAllocColorPlanes</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xalloccolorplanes'>
<funcprototype>
<funcdef>Status <function>XAllocColorPlanes</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2267,7 +2267,7 @@ To free colormap cells, use
<indexterm><primary>Color</primary><secondary>deallocation</secondary></indexterm>
<!-- .sM -->
</para>
-<funcsynopsis>
+<funcsynopsis id='xfreecolors'>
<funcprototype>
<funcdef><function>XFreeColors</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2408,7 +2408,7 @@ To store an <acronym>RGB</acronym> value in a single colormap cell, use
<indexterm><primary>Color</primary><secondary>storing</secondary></indexterm>
<indexterm significance="preferred"><primary>XStoreColor</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xstorecolor'>
<funcprototype>
<funcdef><function>XStoreColor</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2500,7 +2500,7 @@ To store multiple <acronym>RGB</acronym> values in multiple colormap cells, use
<indexterm><primary>Color</primary><secondary>storing</secondary></indexterm>
<indexterm significance="preferred"><primary>XStoreColors</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xstorecolors'>
<funcprototype>
<funcdef><function>XStoreColors</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2606,7 +2606,7 @@ To store a color of arbitrary format in a single colormap cell, use
<indexterm><primary>Color</primary><secondary>storing</secondary></indexterm>
<indexterm significance="preferred"><primary>XcmsStoreColor</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmsstorecolor'>
<funcprototype>
<funcdef>Status <function>XcmsStoreColor</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2717,7 +2717,7 @@ To store multiple colors of arbitrary format in multiple colormap cells, use
<indexterm><primary>Color</primary><secondary>storing</secondary></indexterm>
<indexterm significance="preferred"><primary>XcmsStoreColors</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmsstorecolors'>
<funcprototype>
<funcdef>Status <function>XcmsStoreColors</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2862,7 +2862,7 @@ To store a color specified by name in a single colormap cell, use
<indexterm><primary>Color</primary><secondary>naming</secondary></indexterm>
<indexterm significance="preferred"><primary>XStoreNamedColor</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xstorenamedcolor'>
<funcprototype>
<funcdef><function>XStoreNamedColor</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2992,7 +2992,7 @@ To query the <acronym>RGB</acronym> value of a single colormap cell, use
<indexterm><primary>Color</primary><secondary>querying</secondary></indexterm>
<indexterm significance="preferred"><primary>XQueryColor</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xquerycolor'>
<funcprototype>
<funcdef><function>XQueryColor</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3066,7 +3066,7 @@ To query the <acronym>RGB</acronym> values of multiple colormap cells, use
<indexterm><primary>Color</primary><secondary>querying</secondary></indexterm>
<indexterm significance="preferred"><primary>XQueryColors</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xquerycolors'>
<funcprototype>
<funcdef><function>XQueryColors</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3156,7 +3156,7 @@ To query the color of a single colormap cell in an arbitrary format, use
<indexterm><primary>Color</primary><secondary>querying</secondary></indexterm>
<indexterm significance="preferred"><primary>XcmsQueryColor</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmsquerycolor'>
<funcprototype>
<funcdef>Status <function>XcmsQueryColor</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3245,7 +3245,7 @@ To query the color of multiple colormap cells in an arbitrary format, use
<indexterm><primary>Color</primary><secondary>querying</secondary></indexterm>
<indexterm significance="preferred"><primary>XcmsQueryColors</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmsquerycolors'>
<funcprototype>
<funcdef>Status <function>XcmsQueryColors</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3404,7 +3404,7 @@ To obtain the CCC associated with a colormap, use
<indexterm><primary>CCC</primary><secondary>of colormap</secondary></indexterm>
<indexterm><primary>Color Conversion Context</primary><secondary>of colormap</secondary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmscccofcolormap'>
<funcprototype>
<funcdef>XcmsCCC <function>XcmsCCCOfColormap</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3459,7 +3459,7 @@ To change the CCC associated with a colormap, use
<indexterm><primary>CCC</primary><secondary>of colormap</secondary></indexterm>
<indexterm><primary>Color Conversion Context</primary><secondary>of colormap</secondary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmssetcccofcolormap'>
<funcprototype>
<funcdef>XcmsCCC <function>XcmsSetCCCOfColormap</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3539,7 +3539,7 @@ To obtain the default CCC for a screen, use
<indexterm><primary>Color Conversion Context</primary><secondary>default</secondary></indexterm>
<indexterm><primary>CCC</primary><secondary>default</secondary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmsdefaultccc'>
<funcprototype>
<funcdef>XcmsCCC <function>XcmsDefaultCCC</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3601,14 +3601,14 @@ can return.
<indexterm significance="preferred"><primary>XcmsDisplayOfCCC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='displayofccc'>
<funcprototype>
<funcdef><function>DisplayOfCCC</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
</funcprototype>
</funcsynopsis>
-<funcsynopsis>
+<funcsynopsis id='xcmsdisplayofccc'>
<funcprototype>
<funcdef>Display *<function>XcmsDisplayOfCCC</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -3638,14 +3638,14 @@ Both return the display associated with the specified CCC.
<indexterm significance="preferred"><primary>VisualOfCCC</primary></indexterm>
<indexterm significance="preferred"><primary>XcmsVisualOfCCC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='visualofccc'>
<funcprototype>
<funcdef><function>VisualOfCCC</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
</funcprototype>
</funcsynopsis>
-<funcsynopsis>
+<funcsynopsis id='xcmsvisualofccc'>
<funcprototype>
<funcdef>Visual *<function>XcmsVisualOfCCC</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -3675,14 +3675,14 @@ Both return the visual associated with the specified CCC.
<indexterm significance="preferred"><primary>ScreenNumberOfCCC</primary></indexterm>
<indexterm significance="preferred"><primary>XcmsScreenNumberOfCCC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='screennumberofccc'>
<funcprototype>
<funcdef><function>ScreenNumberOfCCC</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
</funcprototype>
</funcsynopsis>
-<funcsynopsis>
+<funcsynopsis id='xcmsscreennumberofccc'>
<funcprototype>
<funcdef>int <function>XcmsScreenNumberOfCCC</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -3712,13 +3712,13 @@ Both return the number of the screen associated with the specified CCC.
<indexterm significance="preferred"><primary>ScreenWhitePointOfCCC</primary></indexterm>
<indexterm significance="preferred"><primary>XcmsScreenWhitePointOfCCC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='screenwhitepointofccc'>
<funcprototype>
<funcdef><function>ScreenWhitePointOfCCC</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
</funcprototype>
</funcsynopsis>
-<funcsynopsis>
+<funcsynopsis id='xcmsscreenwhitepointofccc'>
<funcprototype>
<funcdef>XcmsColor <function>XcmsScreenWhitePointOfCCC</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -3748,14 +3748,14 @@ Both return the white point of the screen associated with the specified CCC.
<indexterm significance="preferred"><primary>ClientWhitePointOfCCC</primary></indexterm>
<indexterm significance="preferred"><primary>XcmsClientWhitePointOfCCC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='clientwhitepointofccc'>
<funcprototype>
<funcdef> <function>ClientWhitePointOfCCC</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
</funcprototype>
</funcsynopsis>
-<funcsynopsis>
+<funcsynopsis id='xcmsclientwhitepointofccc'>
<funcprototype>
<funcdef>XcmsColor *<function>XcmsClientWhitePointOfCCC</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -3795,7 +3795,7 @@ To set the Client White Point in the CCC, use
<indexterm significance="preferred"><primary>XcmsSetWhitePoint</primary></indexterm>
<indexterm><primary>Client White Point</primary><secondary>of Color Conversion Context</secondary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmssetwhitepoint'>
<funcprototype>
<funcdef>Status <function>XcmsSetWhitePoint</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -3866,7 +3866,7 @@ in a specified CCC, use
<indexterm><primary>Gamut compression</primary><secondary>procedure</secondary></indexterm>
<indexterm><primary>Gamut compression</primary><secondary>client data</secondary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmssetcompressionproc'>
<funcprototype>
<funcdef>XcmsCompressionProc <function>XcmsSetCompressionProc</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -3935,7 +3935,7 @@ in a specified CCC, use
<indexterm><primary>White point adjustment</primary><secondary>setting in Color Conversion Context</secondary></indexterm>
<indexterm><primary>White point adjustment</primary><secondary>procedure</secondary></indexterm>
<indexterm><primary>White point adjustment</primary><secondary>client data</secondary></indexterm>
-<funcsynopsis>
+<funcsynopsis id='xcmssetwhiteadjustproc'>
<funcprototype>
<funcdef>XcmsWhiteAdjustProc <function>XcmsSetWhiteAdjustProc</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -4012,7 +4012,7 @@ To create a CCC, use
<indexterm><primary>Color Conversion Context</primary><secondary>creation</secondary></indexterm>
<indexterm><primary>CCC</primary><secondary>creation</secondary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmscreateccc'>
<funcprototype>
<funcdef>XcmsCCC <function>XcmsCreateCCC</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -4139,7 +4139,7 @@ To free a CCC, use
<indexterm><primary>Color Conversion Context</primary><secondary>freeing</secondary></indexterm>
<indexterm><primary>CCC</primary><secondary>freeing</secondary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmsfreeccc'>
<funcprototype>
<funcdef>void <function>XcmsFreeCCC</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -4186,7 +4186,7 @@ to a single destination format, use
<indexterm><primary>Color</primary><secondary>conversion</secondary></indexterm>
<indexterm significance="preferred"><primary>XcmsConvertColors</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmsconvertcolors'>
<funcprototype>
<funcdef>Status <function>XcmsConvertColors</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -4330,7 +4330,7 @@ following:
</para>
<indexterm significance="preferred"><primary>XcmsCompressionProc</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmscompressionproc'>
<funcprototype>
<funcdef>typedef Status<function>(*XcmsCompressionProc</function>)</funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -4657,7 +4657,7 @@ The white point adjustment procedure interface must adhere to the following:
</para>
<indexterm significance="preferred"><primary>XcmsWhiteAdjustProc</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmswhiteadjustproc'>
<funcprototype>
<funcdef>typedef Status <function>(*XcmsWhiteAdjustProc</function>)</funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -5020,7 +5020,7 @@ To obtain the color specification for black
</para>
<indexterm significance="preferred"><primary>XcmsQueryBlack</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmsqueryblack'>
<funcprototype>
<funcdef>Status <function>XcmsQueryBlack</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -5086,7 +5086,7 @@ To obtain the color specification for blue
</para>
<indexterm significance="preferred"><primary>XcmsQueryBlue</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmsqueryblue'>
<funcprototype>
<funcdef>Status <function>XcmsQueryBlue</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -5152,7 +5152,7 @@ To obtain the color specification for green
</para>
<indexterm significance="preferred"><primary>XcmsQueryGreen</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmsquerygreen'>
<funcprototype>
<funcdef>Status <function>XcmsQueryGreen</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -5218,7 +5218,7 @@ To obtain the color specification for red
</para>
<indexterm significance="preferred"><primary>XcmsQueryRed</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmsqueryred'>
<funcprototype>
<funcdef>Status <function>XcmsQueryRed</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -5284,7 +5284,7 @@ To obtain the color specification for white
</para>
<indexterm significance="preferred"><primary>XcmsQueryWhite</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmsquerywhite'>
<funcprototype>
<funcdef>Status <function>XcmsQueryWhite</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -5372,7 +5372,7 @@ for a given Psychometric Hue Angle and <acronym>CIE</acronym> metric lightness (
</para>
<indexterm significance="preferred"><primary>XcmsCIELabQueryMaxC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmscielabquerymaxc'>
<funcprototype>
<funcdef>Status <function>XcmsCIELabQueryMaxC</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -5456,7 +5456,7 @@ for a given Psychometric Hue Angle and Psychometric Chroma, use
<indexterm><primary><acronym>CIE</acronym> metric lightness</primary><secondary>maximum</secondary></indexterm>
<indexterm significance="preferred"><primary>XcmsCIELabQueryMaxL</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmscielabquerymaxl'>
<funcprototype>
<funcdef>Status <function>XcmsCIELabQueryMaxL</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -5547,7 +5547,7 @@ for a given Psychometric Hue Angle, use
<indexterm><primary><acronym>CIE</acronym> metric lightness</primary><secondary>maximum</secondary></indexterm>
<indexterm significance="preferred"><primary>XcmsCIELabQueryMaxLC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmscielabquerymaxlc'>
<funcprototype>
<funcdef>Status <function>XcmsCIELabQueryMaxLC</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -5619,7 +5619,7 @@ for a given Psychometric Hue Angle and Psychometric Chroma, use
<indexterm><primary><acronym>CIE</acronym> metric lightness</primary><secondary>minimum</secondary></indexterm>
<indexterm significance="preferred"><primary>XcmsCIELabQueryMinL</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmscielabqueryminlc'>
<funcprototype>
<funcdef>Status <function>XcmsCIELabQueryMinL</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -5729,7 +5729,7 @@ for a given Psychometric Hue Angle and <acronym>CIE</acronym> metric lightness (
</para>
<indexterm significance="preferred"><primary>XcmsCIELuvQueryMaxC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmxcieluvquerymaxc'>
<funcprototype>
<funcdef>Status <function>XcmsCIELuvQueryMaxC</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -5813,7 +5813,7 @@ for a given Psychometric Hue Angle and Psychometric Chroma, use
<indexterm><primary><acronym>CIE</acronym> metric lightness</primary><secondary>maximum</secondary></indexterm>
<indexterm significance="preferred"><primary>XcmsCIELuvQueryMaxL</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmscieluvquerymaxl'>
<funcprototype>
<funcdef>Status <function>XcmsCIELuvQueryMaxL</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -5904,7 +5904,7 @@ for a given Psychometric Hue Angle, use
<indexterm><primary><acronym>CIE</acronym> metric lightness</primary><secondary>maximum</secondary></indexterm>
<indexterm significance="preferred"><primary>XcmsCIELuvQueryMaxLC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmscieluvquerymaxlc'>
<funcprototype>
<funcdef>Status <function>XcmsCIELuvQueryMaxLC</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -5976,7 +5976,7 @@ for a given Psychometric Hue Angle and Psychometric Chroma, use
<indexterm><primary><acronym>CIE</acronym> metric lightness</primary><secondary>minimum</secondary></indexterm>
<indexterm significance="preferred"><primary>XcmsCIELuvQueryMinL</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmscieluvqueryminl'>
<funcprototype>
<funcdef>Status <function>XcmsCIELuvQueryMinL</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -6067,7 +6067,7 @@ To obtain the maximum Chroma for a given Hue and Value, use
<indexterm><primary>Chroma</primary><secondary>maximum</secondary></indexterm>
<indexterm significance="preferred"><primary>XcmsTekHVCQueryMaxC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmstekhvcquerymaxc'>
<funcprototype>
<funcdef>Status <function>XcmsTekHVCQueryMaxC</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -6150,7 +6150,7 @@ To obtain the maximum Value for a given Hue and Chroma, use
<indexterm><primary>Value</primary><secondary>maximum</secondary></indexterm>
<indexterm significance="preferred"><primary>XcmsTekHVCQueryMaxV</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmstekhvcquerymaxv'>
<funcprototype>
<funcdef>Status <function>XcmsTekHVCQueryMaxV</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -6237,7 +6237,7 @@ for a specified Hue, use
<indexterm><primary>Value</primary><secondary>maximum</secondary></indexterm>
<indexterm significance="preferred"><primary>XcmsTekHVCQueryMaxVC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmstekhvcquerymaxvc'>
<funcprototype>
<funcdef>Status <function>XcmsTekHVCQueryMaxVC</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -6315,7 +6315,7 @@ Chroma at which the maximum Values are reached, use
<indexterm><primary>Value</primary><secondary>maximum</secondary></indexterm>
<indexterm significance="preferred"><primary>XcmsTekHVCQueryMaxVSamples</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmstekhvcquerymaxvsamples'>
<funcprototype>
<funcdef>Status <function>XcmsTekHVCQueryMaxVSamples</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -6396,7 +6396,7 @@ To obtain the minimum Value for a given Hue and Chroma, use
<indexterm><primary>Value</primary><secondary>minimum</secondary></indexterm>
<indexterm significance="preferred"><primary>XcmsTekHVCQueryMinV</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmstekhvcqueryminv'>
<funcprototype>
<funcdef>Status <function>XcmsTekHVCQueryMinV</function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -6554,7 +6554,7 @@ To add a device-independent color space, use
</para>
<indexterm significance="preferred"><primary>XcmsAddColorSpace</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmsaddcolorspace'>
<funcprototype>
<funcdef>Status <function>XcmsAddColorSpace</function></funcdef>
<paramdef>XcmsColorSpace<parameter> *color_space</parameter></paramdef>
@@ -6622,7 +6622,7 @@ associated with a specified color string prefix, use
</para>
<indexterm significance="preferred"><primary>XcmsFormatOfPrefix</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmsformatofprefix'>
<funcprototype>
<funcdef>XcmsColorFormat <function>XcmsFormatOfPrefix</function></funcdef>
<paramdef>char<parameter> *prefix</parameter></paramdef>
@@ -6664,7 +6664,7 @@ specified by a color format, use
</para>
<indexterm significance="preferred"><primary>XcmsPrefixOfFormat</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmsprefixofformat'>
<funcprototype>
<funcdef>char *<function>XcmsPrefixOfFormat</function></funcdef>
<paramdef>XcmsColorFormat<parameter> format</parameter></paramdef>
@@ -6808,7 +6808,7 @@ adhere to the following software interface specification:
</para>
<indexterm significance="preferred"><primary>XcmsParseStringProc</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmsparsestringproc'>
<funcprototype>
<funcdef>Status <function>XcmsParseStringProc</function></funcdef>
<paramdef>char<parameter> *color_string</parameter></paramdef>
@@ -6858,7 +6858,7 @@ spaces must adhere to the
following software interface specification:
</para>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='conversionproc'>
<funcprototype>
<funcdef>Status <function><replaceable>ConversionProc</replaceable></function></funcdef>
<paramdef>XcmsCCC<parameter> ccc</parameter></paramdef>
@@ -7130,7 +7130,7 @@ To add a function set, use
</para>
<indexterm significance="preferred"><primary>XcmsAddFunctionSet</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcmsaddfunctionset'>
<funcprototype>
<funcdef>Status <function>XcmsAddFunctionSet</function></funcdef>
<paramdef>XcmsFunctionSet<parameter> *function_set</parameter></paramdef>
diff --git a/libX11/specs/libX11/CH07.xml b/libX11/specs/libX11/CH07.xml
index 505a565a2..5773ca432 100644
--- a/libX11/specs/libX11/CH07.xml
+++ b/libX11/specs/libX11/CH07.xml
@@ -965,7 +965,7 @@ depth of drawable, use
<indexterm><primary>Graphics context</primary><secondary>initializing</secondary></indexterm>
<indexterm significance="preferred"><primary>XCreateGC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcreategc'>
<funcprototype>
<funcdef>GC <function>XCreateGC</function></funcdef>
<paramdef>Display <parameter> *display</parameter></paramdef>
@@ -1053,7 +1053,7 @@ To copy components from a source GC to a destination GC, use
<function>XCopyGC</function>.
<indexterm significance="preferred"><primary>XCopyGC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcopygc'>
<funcprototype>
<funcdef><function>XCopyGC</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1139,7 +1139,7 @@ To change the components in a given GC, use
<function>XChangeGC</function>.
<indexterm significance="preferred"><primary>XChangeGC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xchangegc'>
<funcprototype>
<funcdef><function>XChangeGC</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1235,7 +1235,7 @@ To obtain components of a given GC, use
<function>XGetGCValues</function>.
<indexterm significance="preferred"><primary>XGetGCValues</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetgcvalues'>
<funcprototype>
<funcdef>Status <function>XGetGCValues</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1347,7 +1347,7 @@ To free a given GC, use
<function>XFreeGC</function>.
<indexterm significance="preferred"><primary>XFreeGC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xfreegc'>
<funcprototype>
<funcdef><function>XFreeGC</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1401,7 +1401,7 @@ resource ID for a given GC, use
<function>XGContextFromGC</function>.
<indexterm significance="preferred"><primary>XGContextFromGC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgcontextfromgc'>
<funcprototype>
<funcdef>GContext <function>XGContextFromGC</function></funcdef>
<paramdef>GC<parameter> gc</parameter></paramdef>
@@ -1437,7 +1437,7 @@ To force sending GC component changes, use
<function>XFlushGC</function>.
<indexterm significance="preferred"><primary>XFlushGC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xflushgc'>
<funcprototype>
<funcdef>void <function>XFlushGC</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1531,7 +1531,7 @@ for a given GC, use
<function>XSetState</function>.
<indexterm significance="preferred"><primary>XSetState</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetstate'>
<funcprototype>
<funcdef><function>XSetState</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1624,7 +1624,7 @@ To set the foreground of a given GC, use
<function>XSetForeground</function>.
<indexterm significance="preferred"><primary>XSetForeground</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetforeground'>
<funcprototype>
<funcdef><function>XSetForeground</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1683,7 +1683,7 @@ To set the background of a given GC, use
<function>XSetBackground</function>.
<indexterm significance="preferred"><primary>XSetBackground</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetbackground'>
<funcprototype>
<funcdef><function>XSetBackground</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1742,7 +1742,7 @@ To set the display function in a given GC, use
<function>XSetFunction</function>.
<indexterm significance="preferred"><primary>XSetFunction</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetfunction'>
<funcprototype>
<funcdef><function>XSetFunction</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1802,7 +1802,7 @@ To set the plane mask of a given GC, use
<function>XSetPlaneMask</function>.
<indexterm significance="preferred"><primary>XSetPlaneMask</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetplanemask'>
<funcprototype>
<funcdef><function>XSetPlaneMask</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1867,7 +1867,7 @@ To set the line drawing components of a given GC, use
<function>XSetLineAttributes</function>.
<indexterm significance="preferred"><primary>XSetLineAttributes</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetlineattributes'>
<funcprototype>
<funcdef><function>XSetLineAttributes</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1976,7 +1976,7 @@ To set the dash-offset and dash-list for dashed line styles of a given GC, use
<function>XSetDashes</function>.
<indexterm significance="preferred"><primary>XSetDashes</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetdashes'>
<funcprototype>
<funcdef><function>XSetDashes</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2105,7 +2105,7 @@ To set the fill-style of a given GC, use
<function>XSetFillStyle</function>.
<indexterm significance="preferred"><primary>XSetFillStyle</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetfillstyle'>
<funcprototype>
<funcdef><function>XSetFillStyle</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2171,7 +2171,7 @@ To set the fill-rule of a given GC, use
<function>XSetFillRule</function>.
<indexterm significance="preferred"><primary>XSetFillRule</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetfillrule'>
<funcprototype>
<funcdef><function>XSetFillRule</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2251,7 +2251,7 @@ To obtain the best size of a tile, stipple, or cursor, use
<function>XQueryBestSize</function>.
<indexterm significance="preferred"><primary>XQueryBestSize</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xquerybestsize'>
<funcprototype>
<funcdef>Status <function>XQueryBestSize</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2394,7 +2394,7 @@ To obtain the best fill tile shape, use
<function>XQueryBestTile</function>.
<indexterm significance="preferred"><primary>XQueryBestTile</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xquerybesttile'>
<funcprototype>
<funcdef>Status <function>XQueryBestTile</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2500,7 +2500,7 @@ To obtain the best stipple shape, use
<function>XQueryBestStipple</function>.
<indexterm significance="preferred"><primary>XQueryBestStipple</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xquerybeststipple'>
<funcprototype>
<funcdef>Status <function>XQueryBestStipple</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2606,7 +2606,7 @@ To set the fill tile of a given GC, use
<function>XSetTile</function>.
<indexterm significance="preferred"><primary>XSetTile</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsettile'>
<funcprototype>
<funcdef><function>XSetTile</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2674,7 +2674,7 @@ To set the stipple of a given GC, use
<function>XSetStipple</function>.
<indexterm significance="preferred"><primary>XSetStipple</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetstipple'>
<funcprototype>
<funcdef><function>XSetStipple</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2742,7 +2742,7 @@ To set the tile or stipple origin of a given GC, use
<function>XSetTSOrigin</function>.
<indexterm significance="preferred"><primary>XSetTSOrigin</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsettsorigin'>
<funcprototype>
<funcdef><function>XSetTSOrigin</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2823,7 +2823,7 @@ To set the current font of a given GC, use
<function>XSetFont</function>.
<indexterm significance="preferred"><primary>XSetFont</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetfont'>
<funcprototype>
<funcdef><function>XSetFont</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2894,7 +2894,7 @@ To set the clip-origin of a given GC, use
<function>XSetClipOrigin</function>.
<indexterm significance="preferred"><primary>XSetClipOrigin</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetcliporigin'>
<funcprototype>
<funcdef><function>XSetClipOrigin</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2969,7 +2969,7 @@ To set the clip-mask of a given GC to the specified pixmap, use
<function>XSetClipMask</function>.
<indexterm significance="preferred"><primary>XSetClipMask</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetclipmask'>
<funcprototype>
<funcdef><function>XSetClipMask</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3037,7 +3037,7 @@ To set the clip-mask of a given GC to the specified list of rectangles, use
<function>XSetClipRectangles</function>.
<indexterm significance="preferred"><primary>XSetClipRectangles</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetcliprectangles'>
<funcprototype>
<funcdef><function>XSetClipRectangles</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3211,7 +3211,7 @@ To set the arc mode of a given GC, use
<function>XSetArcMode</function>.
<indexterm significance="preferred"><primary>XSetArcMode</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetarcmode'>
<funcprototype>
<funcdef><function>XSetArcMode</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3275,7 +3275,7 @@ To set the subwindow mode of a given GC, use
<function>XSetSubwindowMode</function>.
<indexterm significance="preferred"><primary>XSetSubwindowMode</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetsubwindowmode'>
<funcprototype>
<funcdef><function>XSetSubwindowMode</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3339,7 +3339,7 @@ To set the graphics-exposures flag of a given GC, use
<function>XSetGraphicsExposures</function>.
<indexterm significance="preferred"><primary>XSetGraphicsExposures</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetgraphicsexposures'>
<funcprototype>
<funcdef><function>XSetGraphicsExposures</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
diff --git a/libX11/specs/libX11/CH08.xml b/libX11/specs/libX11/CH08.xml
index 6cd6679f2..1f1202505 100644
--- a/libX11/specs/libX11/CH08.xml
+++ b/libX11/specs/libX11/CH08.xml
@@ -43,7 +43,7 @@ To clear a rectangular area of a given window, use
<indexterm><primary>Clearing</primary><secondary>areas</secondary></indexterm>
<indexterm significance="preferred"><primary>XClearArea</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcleararea'>
<funcprototype>
<funcdef><function>XClearArea</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -185,7 +185,7 @@ To clear the entire area in a given window, use
<indexterm><primary>Clearing</primary><secondary>windows</secondary></indexterm>
<indexterm significance="preferred"><primary>XClearWindow</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xclearwindow'>
<funcprototype>
<funcdef><function>XClearWindow</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -269,7 +269,7 @@ root and depth, use
<indexterm><primary>Copying</primary><secondary>areas</secondary></indexterm>
<indexterm significance="preferred"><primary>XCopyArea</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcopyarea'>
<funcprototype>
<funcdef><function>XCopyArea</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -464,7 +464,7 @@ To copy a single bit plane of a given drawable, use
<indexterm><primary>Copying</primary><secondary>planes</secondary></indexterm>
<indexterm significance="preferred"><primary>XCopyPlane</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcopyplane'>
<funcprototype>
<funcdef><function>XCopyPlane</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -768,7 +768,7 @@ To draw a single point in a given drawable, use
<function>XDrawPoint</function>.
<indexterm significance="preferred"><primary>XDrawPoint</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdrawpoint'>
<funcprototype>
<funcdef><function>XDrawPoint</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -840,7 +840,7 @@ To draw multiple points in a given drawable, use
<function>XDrawPoints</function>.
<indexterm significance="preferred"><primary>XDrawPoints</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdrawpoints'>
<funcprototype>
<funcdef><function>XDrawPoints</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -981,7 +981,7 @@ To draw a single line between two points in a given drawable, use
<function>XDrawLine</function>.
<indexterm significance="preferred"><primary>XDrawLine</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdrawline'>
<funcprototype>
<funcdef><function>XDrawLine</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1075,7 +1075,7 @@ To draw multiple lines in a given drawable, use
<function>XDrawLines</function>.
<indexterm significance="preferred"><primary>XDrawLines</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdrawlines'>
<funcprototype>
<funcdef><function>XDrawLines</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1163,7 +1163,7 @@ use
<function>XDrawSegments</function>.
<indexterm significance="preferred"><primary>XDrawSegments</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdrawsegments'>
<funcprototype>
<funcdef><function>XDrawSegments</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1333,7 +1333,7 @@ To draw the outline of a single rectangle in a given drawable, use
<function>XDrawRectangle</function>.
<indexterm significance="preferred"><primary>XDrawRectangle</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdrawrectangle'>
<funcprototype>
<funcdef><function>XDrawRectangle</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1430,7 +1430,7 @@ in a given drawable, use
<function>XDrawRectangles</function>.
<indexterm significance="preferred"><primary>XDrawRectangles</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdrawrectangles'>
<funcprototype>
<funcdef><function>XDrawRectangles</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1564,7 +1564,7 @@ To draw a single arc in a given drawable, use
<function>XDrawArc</function>.
<indexterm significance="preferred"><primary>XDrawArc</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdrawarc'>
<funcprototype>
<funcdef><function>XDrawArc</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1684,7 +1684,7 @@ To draw multiple arcs in a given drawable, use
<function>XDrawArcs</function>.
<indexterm significance="preferred"><primary>XDrawArcs</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdrawarcs'>
<funcprototype>
<funcdef><function>XDrawArcs</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1922,7 +1922,7 @@ To fill a single rectangular area in a given drawable, use
<function>XFillRectangle</function>.
<indexterm significance="preferred"><primary>XFillRectangle</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xfillrectangle'>
<funcprototype>
<funcdef><function>XFillRectangle</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2019,7 +2019,7 @@ To fill multiple rectangular areas in a given drawable, use
<function>XFillRectangles</function>.
<indexterm significance="preferred"><primary>XFillRectangles</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xfillrectangles'>
<funcprototype>
<funcdef><function>XFillRectangles</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2154,7 +2154,7 @@ To fill a polygon area in a given drawable, use
<indexterm><primary>Filling</primary><secondary>polygon</secondary></indexterm>
<indexterm significance="preferred"><primary>XFillPolygon</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xfillpolygon'>
<funcprototype>
<funcdef><function>XFillPolygon</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2353,7 +2353,7 @@ To fill a single arc in a given drawable, use
<function>XFillArc</function>.
<indexterm significance="preferred"><primary>XFillArc</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xfillarc'>
<funcprototype>
<funcdef><function>XFillArc</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2473,7 +2473,7 @@ To fill multiple arcs in a given drawable, use
<function>XFillArcs</function>.
<indexterm significance="preferred"><primary>XFillArcs</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xfillarcs'>
<funcprototype>
<funcdef><function>XFillArcs</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3020,7 +3020,7 @@ To load a given font, use
<function>XLoadFont</function>.
<indexterm significance="preferred"><primary>XLoadFont</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xloadfont'>
<funcprototype>
<funcdef>Font <function>XLoadFont</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3096,7 +3096,7 @@ To return information about an available font, use
<function>XQueryFont</function>.
<indexterm significance="preferred"><primary>XQueryFont</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xqueryfont'>
<funcprototype>
<funcdef>XFontStruct *<function>XQueryFont</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3162,7 +3162,7 @@ in a single operation, use
<function>XLoadQueryFont</function>.
<indexterm significance="preferred"><primary>XLoadQueryFont</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xloadqueryfont'>
<funcprototype>
<funcdef>XFontStruct *<function>XLoadQueryFont</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3230,7 +3230,7 @@ use
<function>XFreeFont</function>.
<indexterm significance="preferred"><primary>XFreeFont</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xfreefont'>
<funcprototype>
<funcdef><function>XFreeFont</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3287,7 +3287,7 @@ To return a given font property, use
<function>XGetFontProperty</function>.
<indexterm significance="preferred"><primary>XGetFontProperty</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetfontproperty'>
<funcprototype>
<funcdef>Bool <function>XGetFontProperty</function></funcdef>
<paramdef>XFontStruct<parameter> *font_struct</parameter></paramdef>
@@ -3362,7 +3362,7 @@ use
<function>XUnloadFont</function>.
<indexterm significance="preferred"><primary>XUnloadFont</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xunloadfont'>
<funcprototype>
<funcdef><function>XUnloadFont</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3427,7 +3427,7 @@ To return a list of the available font names, use
<function>XListFonts</function>.
<indexterm significance="preferred"><primary>XListFonts</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xlistfonts'>
<funcprototype>
<funcdef>char **<function>XListFonts</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3514,7 +3514,7 @@ To free a font name array, use
<function>XFreeFontNames</function>.
<indexterm significance="preferred"><primary>XFreeFontNames</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xfreefontnames'>
<funcprototype>
<funcdef><function>XFreeFontNames</function></funcdef>
<paramdef>char<parameter> *list[]</parameter></paramdef>
@@ -3551,7 +3551,7 @@ To obtain the names and information about available fonts, use
<function>XListFontsWithInfo</function>.
<indexterm significance="preferred"><primary>XListFontsWithInfo</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xlistfontswithinfo'>
<funcprototype>
<funcdef>char **<function>XListFontsWithInfo</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3658,7 +3658,7 @@ To free font structures and font names, use
<function>XFreeFontInfo</function>.
<indexterm significance="preferred"><primary>XFreeFontInfo</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xfreefontinfo'>
<funcprototype>
<funcdef><function>XFreeFontInfo</function></funcdef>
<paramdef>char<parameter> **names</parameter></paramdef>
@@ -3742,7 +3742,7 @@ To determine the width of an 8-bit character string, use
<function>XTextWidth</function>.
<indexterm significance="preferred"><primary>XTextWidth</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xtextwidth'>
<funcprototype>
<funcdef>int <function>XTextWidth</function></funcdef>
<paramdef>XFontStruct<parameter> *font_struct</parameter></paramdef>
@@ -3792,7 +3792,7 @@ To determine the width of a 2-byte character string, use
<function>XTextWidth16</function>.
<indexterm significance="preferred"><primary>XTextWidth16</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xtextwidth16'>
<funcprototype>
<funcdef>int <function>XTextWidth16</function></funcdef>
<paramdef>XFontStruct<parameter> *font_struct</parameter></paramdef>
@@ -3850,7 +3850,7 @@ To compute the bounding box of an 8-bit character string in a given font, use
<function>XTextExtents</function>.
<indexterm significance="preferred"><primary>XTextExtents</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xtextextents'>
<funcprototype>
<funcdef><function>XTextExtents</function></funcdef>
<paramdef>XFontStruct<parameter> *font_struct</parameter></paramdef>
@@ -3950,7 +3950,7 @@ To compute the bounding box of a 2-byte character string in a given font, use
<function>XTextExtents16</function>.
<indexterm significance="preferred"><primary>XTextExtents16</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xtextextents16'>
<funcprototype>
<funcdef><function>XTextExtents16</function></funcdef>
<paramdef>XFontStruct<parameter> *font_struct</parameter></paramdef>
@@ -4097,7 +4097,7 @@ given font, use
<function>XQueryTextExtents</function>.
<indexterm significance="preferred"><primary>XQueryTextExtents</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xquerytextextents'>
<funcprototype>
<funcdef><function>XQueryTextExtents</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -4209,7 +4209,7 @@ in a given font, use
<function>XQueryTextExtents16</function>.
<indexterm significance="preferred"><primary>XQueryTextExtents16</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xquerytextextents16'>
<funcprototype>
<funcdef><function>XQueryTextExtents16</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -4482,7 +4482,7 @@ To draw 8-bit characters in a given drawable, use
<function>XDrawText</function>.
<indexterm significance="preferred"><primary>XDrawText</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdrawtext'>
<funcprototype>
<funcdef><function>XDrawText</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -4578,7 +4578,7 @@ To draw 2-byte characters in a given drawable, use
<function>XDrawText16</function>.
<indexterm significance="preferred"><primary>XDrawText16</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdrawtext16'>
<funcprototype>
<funcdef><function>XDrawText16</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -4738,7 +4738,7 @@ To draw 8-bit characters in a given drawable, use
<function>XDrawString</function>.
<indexterm significance="preferred"><primary>XDrawString</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdrawstring'>
<funcprototype>
<funcdef><function>XDrawString</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -4834,7 +4834,7 @@ To draw 2-byte characters in a given drawable, use
<function>XDrawString16</function>.
<indexterm significance="preferred"><primary>XDrawString16</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdrawstring16'>
<funcprototype>
<funcdef><function>XDrawString16</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -4978,7 +4978,7 @@ To draw 8-bit image text characters in a given drawable, use
<function>XDrawImageString</function>.
<indexterm significance="preferred"><primary>XDrawImageString</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdrawimagestring'>
<funcprototype>
<funcdef><function>XDrawImageString</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -5074,7 +5074,7 @@ To draw 2-byte image text characters in a given drawable, use
<function>XDrawImageString16</function>.
<indexterm significance="preferred"><primary>XDrawImageString16</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdrawimagestring16'>
<funcprototype>
<funcdef><function>XDrawImageString16</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -5319,7 +5319,7 @@ To initialize the image manipulation routines of an image structure, use
<function>XInitImage</function>.
<indexterm significance="preferred"><primary>XInitImage</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xinitimage'>
<funcprototype>
<funcdef>Status <function>XInitImage</function></funcdef>
<paramdef>XImage<parameter> *image</parameter></paramdef>
@@ -5377,7 +5377,7 @@ use
<function>XPutImage</function>.
<indexterm significance="preferred"><primary>XPutImage</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xputimage'>
<funcprototype>
<funcdef><function>XPutImage</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -5566,7 +5566,7 @@ use
This function specifically supports rudimentary screen dumps.
<indexterm significance="preferred"><primary>XGetImage</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetimage'>
<funcprototype>
<funcdef>XImage *<function>XGetImage</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -5753,7 +5753,7 @@ to a location within a preexisting image structure, use
<function>XGetSubImage</function>.
<indexterm significance="preferred"><primary>XGetSubImage</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetsubimage'>
<funcprototype>
<funcdef>XImage *<function>XGetSubImage</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
diff --git a/libX11/specs/libX11/CH09.xml b/libX11/specs/libX11/CH09.xml
index 7d0f779f1..409be1d31 100644
--- a/libX11/specs/libX11/CH09.xml
+++ b/libX11/specs/libX11/CH09.xml
@@ -35,7 +35,7 @@ To change a window's parent to another window on the same screen, use
There is no way to move a window between screens.
<indexterm significance="preferred"><primary>XReparentWindow</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xreparentwindow'>
<funcprototype>
<funcdef><function>XReparentWindow</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -219,7 +219,7 @@ To add or remove a window from the client's save-set, use
<function>XChangeSaveSet</function>.
<indexterm significance="preferred"><primary>XChangeSaveSet</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xchangesaveset'>
<funcprototype>
<funcdef><function>XChangeSaveSet</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -294,7 +294,7 @@ To add a window to the client's save-set, use
<function>XAddToSaveSet</function>.
<indexterm significance="preferred"><primary>XAddToSaveSet</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xaddtosaveset'>
<funcprototype>
<funcdef><function>XAddToSaveSet</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -353,7 +353,7 @@ To remove a window from the client's save-set, use
<function>XRemoveFromSaveSet</function>.
<indexterm significance="preferred"><primary>XRemoveFromSaveSet</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xremovefromsaveset'>
<funcprototype>
<funcdef><function>XRemoveFromSaveSet</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -450,7 +450,7 @@ To install a colormap, use
<function>XInstallColormap</function>.
<indexterm significance="preferred"><primary>XInstallColormap</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xinstallcolormap'>
<funcprototype>
<funcdef><function>XInstallColormap</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -523,7 +523,7 @@ To uninstall a colormap, use
<function>XUninstallColormap</function>.
<indexterm significance="preferred"><primary>XUninstallColormap</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xuninstallcolormap'>
<funcprototype>
<funcdef><function>XUninstallColormap</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -594,7 +594,7 @@ To obtain a list of the currently installed colormaps for a given screen, use
<function>XListInstalledColormaps</function>.
<indexterm significance="preferred"><primary>XListInstalledColormaps</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xlistinstalledcolormaps'>
<funcprototype>
<funcdef>Colormap *<function>XListInstalledColormaps</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -676,7 +676,7 @@ To set the font search path, use
<function>XSetFontPath</function>.
<indexterm significance="preferred"><primary>XSetFontPath</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetfontpath'>
<funcprototype>
<funcdef><function>XSetFontPath</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -754,7 +754,7 @@ To get the current font search path, use
<function>XGetFontPath</function>.
<indexterm significance="preferred"><primary>XGetFontPath</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetfontpath'>
<funcprototype>
<funcdef>char **<function>XGetFontPath</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -806,7 +806,7 @@ use
<function>XFreeFontPath</function>.
<indexterm significance="preferred"><primary>XFreeFontPath</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xfreefontpath'>
<funcprototype>
<funcdef><function>XFreeFontPath</function></funcdef>
<paramdef>char<parameter> **list</parameter></paramdef>
@@ -862,7 +862,7 @@ To grab the server, use
<indexterm><primary>Grabbing</primary><secondary>server</secondary></indexterm>
<indexterm significance="preferred"><primary>XGrabServer</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgrabserver'>
<funcprototype>
<funcdef><function>XGrabServer</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -898,7 +898,7 @@ To ungrab the server, use
<function>XUngrabServer</function>.
<indexterm significance="preferred"><primary>XUngrabServer</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xungrabserver'>
<funcprototype>
<funcdef><function>XUngrabServer</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -940,7 +940,7 @@ To destroy a client, use
<function>XKillClient</function>.
<indexterm significance="preferred"><primary>XKillClient</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xkillclient'>
<funcprototype>
<funcdef><function>XKillClient</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1027,7 +1027,7 @@ To set the screen saver mode, use
<function>XSetScreenSaver</function>.
<indexterm significance="preferred"><primary>XSetScreenSaver</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetscreensaver'>
<funcprototype>
<funcdef><function>XSetScreenSaver</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1162,7 +1162,7 @@ To force the screen saver on or off, use
<function>XForceScreenSaver</function>.
<indexterm significance="preferred"><primary>XForceScreenSaver</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xforcescreensaver'>
<funcprototype>
<funcdef><function>XForceScreenSaver</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1228,7 +1228,7 @@ To activate the screen saver, use
<function>XActivateScreenSaver</function>.
<indexterm significance="preferred"><primary>XActivateScreenSaver</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xactivatescreensaver'>
<funcprototype>
<funcdef><function>XActivateScreenSaver</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1256,7 +1256,7 @@ To reset the screen saver, use
<function>XResetScreenSaver</function>.
<indexterm significance="preferred"><primary>XResetScreenSaver</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xresetscreensaver'>
<funcprototype>
<funcdef><function>XResetScreenSaver</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1284,7 +1284,7 @@ To get the current screen saver values, use
<function>XGetScreenSaver</function>.
<indexterm significance="preferred"><primary>XGetScreenSaver</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetscreensaver'>
<funcprototype>
<funcdef><function>XGetScreenSaver</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1531,7 +1531,7 @@ To add a single host, use
<function>XAddHost</function>.
<indexterm significance="preferred"><primary>XAddHost</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xaddhost'>
<funcprototype>
<funcdef><function>XAddHost</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1589,7 +1589,7 @@ To add multiple hosts at one time, use
<function>XAddHosts</function>.
<indexterm significance="preferred"><primary>XAddHosts</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xaddhosts'>
<funcprototype>
<funcdef><function>XAddHosts</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1658,7 +1658,7 @@ To obtain a host list, use
<function>XListHosts</function>.
<indexterm significance="preferred"><primary>XListHosts</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xlisthosts'>
<funcprototype>
<funcdef>XHostAddress *<function>XListHosts</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1722,7 +1722,7 @@ To remove a single host, use
<function>XRemoveHost</function>.
<indexterm significance="preferred"><primary>XRemoveHost</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xremovehost'>
<funcprototype>
<funcdef><function>XRemoveHost</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1784,7 +1784,7 @@ To remove multiple hosts at one time, use
<function>XRemoveHosts</function>.
<indexterm significance="preferred"><primary>XRemoveHosts</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xremovehosts'>
<funcprototype>
<funcdef><function>XRemoveHosts</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1875,7 +1875,7 @@ To change access control, use
<function>XSetAccessControl</function>.
<indexterm significance="preferred"><primary>XSetAccessControl</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetaccesscontrol'>
<funcprototype>
<funcdef><function>XSetAccessControl</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1934,7 +1934,7 @@ To enable access control, use
<function>XEnableAccessControl</function>.
<indexterm significance="preferred"><primary>XEnableAccessControl</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xenableaccesscontrol'>
<funcprototype>
<funcdef><function>XEnableAccessControl</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1975,7 +1975,7 @@ To disable access control, use
<function>XDisableAccessControl</function>.
<indexterm significance="preferred"><primary>XDisableAccessControl</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdisableaccesscontrol'>
<funcprototype>
<funcdef><function>XDisableAccessControl</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
diff --git a/libX11/specs/libX11/CH11.xml b/libX11/specs/libX11/CH11.xml
index c8031649a..13be59284 100644
--- a/libX11/specs/libX11/CH11.xml
+++ b/libX11/specs/libX11/CH11.xml
@@ -45,7 +45,7 @@ Another way is to use
<function>XSelectInput</function>.
<indexterm significance="preferred"><primary>XSelectInput</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xselectinput'>
<funcprototype>
<funcdef><function>XSelectInput</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -183,7 +183,7 @@ To flush the output buffer, use
<function>XFlush</function>.
<indexterm significance="preferred"><primary>XFlush</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xflush'>
<funcprototype>
<funcdef><function>XFlush</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -229,7 +229,7 @@ use
<function>XSync</function>.
<indexterm significance="preferred"><primary>XSync</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsync'>
<funcprototype>
<funcdef><function>XSync</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -312,7 +312,7 @@ To check the number of events in the event queue, use
<function>XEventsQueued</function>.
<indexterm significance="preferred"><primary>XEventsQueued</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xeventsqueued'>
<funcprototype>
<funcdef>int <function>XEventsQueued</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -398,7 +398,7 @@ To return the number of events that are pending, use
<function>XPending</function>.
<indexterm significance="preferred"><primary>XPending</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xpending'>
<funcprototype>
<funcdef>int <function>XPending</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -472,7 +472,7 @@ To get the next event and remove it from the queue, use
<function>XNextEvent</function>.
<indexterm significance="preferred"><primary>XNextEvent</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xnextevent'>
<funcprototype>
<funcdef><function>XNextEvent</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -522,7 +522,7 @@ To peek at the event queue, use
<function>XPeekEvent</function>.
<indexterm significance="preferred"><primary>XPeekEvent</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xpeekevent'>
<funcprototype>
<funcdef><function>XPeekEvent</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -659,7 +659,7 @@ and, if found, remove the event from the queue, use
<function>XIfEvent</function>.
<indexterm significance="preferred"><primary>XIfEvent</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xifevent'>
<funcprototype>
<funcdef><function>XIfEvent</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -738,7 +738,7 @@ To check the event queue for a matching event without blocking, use
<function>XCheckIfEvent</function>.
<indexterm significance="preferred"><primary>XCheckIfEvent</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcheckifevent'>
<funcprototype>
<funcdef>Bool <function>XCheckIfEvent</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -817,7 +817,7 @@ without removing the event from the queue, use
<function>XPeekIfEvent</function>.
<indexterm significance="preferred"><primary>XPeekIfEvent</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xpeekifevent'>
<funcprototype>
<funcdef><function>XPeekIfEvent</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -906,7 +906,7 @@ To remove the next event that matches both a window and an event mask, use
<function>XWindowEvent</function>.
<indexterm significance="preferred"><primary>XWindowEvent</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xwindowevent'>
<funcprototype>
<funcdef><function>XWindowEvent</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -991,7 +991,7 @@ except that it never blocks and it returns a
indicating if the event was returned.
<indexterm significance="preferred"><primary>XCheckWindowEvent</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcheckwindowevent'>
<funcprototype>
<funcdef>Bool <function>XCheckWindowEvent</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1073,7 +1073,7 @@ To remove the next event that matches an event mask, use
<function>XMaskEvent</function>.
<indexterm significance="preferred"><primary>XMaskEvent</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xmaskevent'>
<funcprototype>
<funcdef><function>XMaskEvent</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1144,7 +1144,7 @@ except that it never blocks and it returns a
indicating if the event was returned.
<indexterm significance="preferred"><primary>XCheckMaskEvent</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcheckmaskevent'>
<funcprototype>
<funcdef>Bool <function>XCheckMaskEvent</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1213,7 +1213,7 @@ To return and remove the next event in the queue that matches an event type, use
<function>XCheckTypedEvent</function>.
<indexterm significance="preferred"><primary>XCheckTypedEvent</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xchecktypedevent'>
<funcprototype>
<funcdef>Bool <function>XCheckTypedEvent</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1284,7 +1284,7 @@ and a window, use
<function>XCheckTypedWindowEvent</function>.
<indexterm significance="preferred"><primary>XCheckTypedWindowEvent</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xchecktypedwindowevent'>
<funcprototype>
<funcdef>Bool <function>XCheckTypedWindowEvent</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1372,7 +1372,7 @@ To push an event back into the event queue, use
<function>XPutBackEvent</function>.
<indexterm significance="preferred"><primary>XPutBackEvent</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xputbackevent'>
<funcprototype>
<funcdef><function>XPutBackEvent</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1435,7 +1435,7 @@ event to a requestor when a selection has been converted
and stored as a property.
<indexterm significance="preferred"><primary>XSendEvent</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsendevent'>
<funcprototype>
<funcdef>Status <function>XSendEvent</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1633,7 +1633,7 @@ use
<function>XDisplayMotionBufferSize</function>.
<indexterm significance="preferred"><primary>XDisplayMotionBufferSize</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdisplaymotionbuffersize'>
<funcprototype>
<funcdef>unsigned <type>long</type></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1671,7 +1671,7 @@ To get the motion history for a specified window and time, use
<function>XGetMotionEvents</function>.
<indexterm significance="preferred"><primary>XGetMotionEvents</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetmotionevents'>
<funcprototype>
<funcdef>XTimeCoord *<function>XGetMotionEvents</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1827,7 +1827,7 @@ an after function.
sets which function is to be called.
<indexterm significance="preferred"><primary>XSetAfterFunction</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetafterfunction'>
<funcprototype>
<funcdef><type>int</type></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1872,7 +1872,7 @@ To enable or disable synchronization, use
<indexterm><primary>Debugging</primary><secondary>synchronous mode</secondary></indexterm>
<indexterm significance="preferred"><primary>XSynchronize</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsynchronize'>
<funcprototype>
<funcdef><type>int</type></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1948,7 +1948,7 @@ To set the error handler, use
<function>XSetErrorHandler</function>.
<indexterm significance="preferred"><primary>XSetErrorHandler</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xseterrorhandler'>
<funcprototype>
<funcdef>int *<function>XSetErrorHandler</function></funcdef>
<paramdef>int <parameter> *handler</parameter></paramdef>
@@ -2238,7 +2238,7 @@ To obtain textual descriptions of the specified error code, use
<indexterm significance="preferred"><primary>XGetErrorText</primary></indexterm>
<indexterm><primary>Debugging</primary><secondary>error message strings</secondary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgeterrortext'>
<funcprototype>
<funcdef><function>XGetErrorText</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2310,7 +2310,7 @@ To obtain error messages from the error database, use
<function>XGetErrorDatabaseText</function>.
<indexterm significance="preferred"><primary>XGetErrorDatabaseText</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgeterrordatabasetext'>
<funcprototype>
<funcdef><function>XGetErrorDatabaseText</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2455,7 +2455,7 @@ To report an error to the user when the requested display does not exist, use
<function>XDisplayName</function>.
<indexterm significance="preferred"><primary>XDisplayName</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdisplayname'>
<funcprototype>
<funcdef>char *<function>XDisplayName</function></funcdef>
<paramdef>char<parameter> *string</parameter></paramdef>
@@ -2498,7 +2498,7 @@ To handle fatal I/O errors, use
<function>XSetIOErrorHandler</function>.
<indexterm significance="preferred"><primary>XSetIOErrorHandler</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetioerrorhandler'>
<funcprototype>
<funcdef><type>int</type></funcdef>
<paramdef>int(*handler)(Display<parameter> *)</parameter></paramdef>
diff --git a/libX11/specs/libX11/CH12.xml b/libX11/specs/libX11/CH12.xml
index bfde8d927..01549f659 100644
--- a/libX11/specs/libX11/CH12.xml
+++ b/libX11/specs/libX11/CH12.xml
@@ -159,7 +159,7 @@ To grab the pointer, use
<indexterm><primary>Pointer</primary><secondary>grabbing</secondary></indexterm>
<indexterm significance="preferred"><primary>XGrabPointer</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgrabpointer'>
<funcprototype>
<funcdef>int <function>XGrabPointer</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -425,7 +425,7 @@ To ungrab the pointer, use
<indexterm><primary>Pointer</primary><secondary>ungrabbing</secondary></indexterm>
<indexterm significance="preferred"><primary>XUngrabPointer</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xungrabpointer'>
<funcprototype>
<funcdef><function>XUngrabPointer</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -493,7 +493,7 @@ To change an active pointer grab, use
<indexterm ><primary>Changing</primary><secondary>pointer grab</secondary></indexterm>
<indexterm significance="preferred"><primary>XChangeActivePointerGrab</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xchangeactivepointergrab'>
<funcprototype>
<funcdef><function>XChangeActivePointerGrab</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -581,7 +581,7 @@ To grab a pointer button, use
<indexterm><primary>Button</primary><secondary>grabbing</secondary></indexterm>
<indexterm significance="preferred"><primary>XGrabButton</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgrabbutton'>
<funcprototype>
<funcdef><function>XGrabButton</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -825,7 +825,7 @@ To ungrab a pointer button, use
<indexterm><primary>Button</primary><secondary>ungrabbing</secondary></indexterm>
<indexterm significance="preferred"><primary>XUngrabButton</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xungrabbutton'>
<funcprototype>
<funcdef><function>XUngrabButton</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -946,7 +946,7 @@ To grab the keyboard, use
<indexterm><primary>Grabbing</primary><secondary>keyboard</secondary></indexterm>
<indexterm significance="preferred"><primary>XGrabKeyboard</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgrabkeyboard'>
<funcprototype>
<funcdef>int <function>XGrabKeyboard</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1134,7 +1134,7 @@ To ungrab the keyboard, use
<indexterm><primary>Ungrabbing</primary><secondary>keyboard</secondary></indexterm>
<indexterm significance="preferred"><primary>XUngrabKeyboard</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xungrabkeyboard'>
<funcprototype>
<funcdef><function>XUngrabKeyboard</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1201,7 +1201,7 @@ To passively grab a single key of the keyboard, use
<indexterm><primary>Grabbing</primary><secondary>keys</secondary></indexterm>
<indexterm significance="preferred"><primary>XGrabKey</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgrabkey'>
<funcprototype>
<funcdef><function>XGrabKey</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1405,7 +1405,7 @@ To ungrab a key, use
<indexterm><primary>Ungrabbing</primary><secondary>keys</secondary></indexterm>
<indexterm significance="preferred"><primary>XUngrabKey</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xungrabkey'>
<funcprototype>
<funcdef><function>XUngrabKey</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1506,7 +1506,7 @@ To allow further events to be processed when the device has been frozen, use
<function>XAllowEvents</function>.
<indexterm significance="preferred"><primary>XAllowEvents</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xallowevents'>
<funcprototype>
<funcdef><function>XAllowEvents</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1761,7 +1761,7 @@ To move the pointer to an arbitrary point in a window, use
<function>XWarpPointer</function>.
<indexterm significance="preferred"><primary>XWarpPointer</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xwarppointer'>
<funcprototype>
<funcdef><function>XWarpPointer</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1935,7 +1935,7 @@ To set the input focus, use
<function>XSetInputFocus</function>.
<indexterm significance="preferred"><primary>XSetInputFocus</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetinputfocus'>
<funcprototype>
<funcdef><function>XSetInputFocus</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2109,7 +2109,7 @@ To obtain the current input focus, use
<function>XGetInputFocus</function>.
<indexterm significance="preferred"><primary>XGetInputFocus</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetinputfocus'>
<funcprototype>
<funcdef><function>XGetInputFocus</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2324,7 +2324,7 @@ If an error is generated, a subset of the controls may have been altered.
<!-- .sp -->
<indexterm significance="preferred"><primary>XChangeKeyboardControl</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xchangekeyboardcontrol'>
<funcprototype>
<funcdef><function>XChangeKeyboardControl</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2393,7 +2393,7 @@ To obtain the current control values for the keyboard, use
<function>XGetKeyboardControl</function>.
<indexterm significance="preferred"><primary>XGetKeyboardControl</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetkeyboardcontrol'>
<funcprototype>
<funcdef><function>XGetKeyboardControl</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2477,7 +2477,7 @@ To turn on keyboard auto-repeat, use
<function>XAutoRepeatOn</function>.
<indexterm significance="preferred"><primary>XAutoRepeatOn</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xautorepeaton'>
<funcprototype>
<funcdef><function>XAutoRepeatOn</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2511,7 +2511,7 @@ To turn off keyboard auto-repeat, use
<function>XAutoRepeatOff</function>.
<indexterm significance="preferred"><primary>XAutoRepeatOff</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xautorepeatoff'>
<funcprototype>
<funcdef><function>XAutoRepeatOff</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2545,7 +2545,7 @@ To ring the bell, use
<function>XBell</function>.
<indexterm significance="preferred"><primary>XBell</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xbell'>
<funcprototype>
<funcdef><function>XBell</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2629,7 +2629,7 @@ To obtain a bit vector that describes the state of the keyboard, use
<function>XQueryKeymap</function>.
<indexterm significance="preferred"><primary>XQueryKeymap</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xquerykeymap'>
<funcprototype>
<funcdef><function>XQueryKeymap</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2685,7 +2685,7 @@ To set the mapping of the pointer buttons, use
<function>XSetPointerMapping</function>.
<indexterm significance="preferred"><primary>XSetPointerMapping</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetpointermapping'>
<funcprototype>
<funcdef>int <function>XSetPointerMapping</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2773,7 +2773,7 @@ To get the pointer mapping, use
<function>XGetPointerMapping</function>.
<indexterm significance="preferred"><primary>XGetPointerMapping</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetpointermapping'>
<funcprototype>
<funcdef>int <function>XGetPointerMapping</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2836,7 +2836,7 @@ To control the pointer's interactive feel, use
<function>XChangePointerControl</function>.
<indexterm significance="preferred"><primary>XChangePointerControl</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xchangepointercontrol'>
<funcprototype>
<funcdef><function>XChangePointerControl</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2949,7 +2949,7 @@ To get the current pointer parameters, use
<function>XGetPointerControl</function>.
<indexterm significance="preferred"><primary>XGetPointerControl</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetpointercontrol'>
<funcprototype>
<funcdef><function>XGetPointerControl</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3224,7 +3224,7 @@ To obtain the legal KeyCodes for a display, use
<function>XDisplayKeycodes</function>.
<indexterm significance="preferred"><primary>XDisplayKeycodes</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdisplaykeycodes'>
<funcprototype>
<funcdef><function>XDisplayKeycodes</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3283,7 +3283,7 @@ To obtain the symbols for the specified KeyCodes, use
<function>XGetKeyboardMapping</function>.
<indexterm significance="preferred"><primary>XGetKeyboardMapping</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetkeyboardmapping'>
<funcprototype>
<funcdef>KeySym *<function>XGetKeyboardMapping</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3408,7 +3408,7 @@ To change the keyboard mapping, use
<function>XChangeKeyboardMapping</function>.
<indexterm significance="preferred"><primary>XChangeKeyboardMapping</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xchangekeyboardmapping'>
<funcprototype>
<funcdef><function>XChangeKeyboardMapping</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3580,7 +3580,7 @@ structure, use
<function>XNewModifiermap</function>.
<indexterm significance="preferred"><primary>XNewModifiermap</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xnewmodifiermap'>
<funcprototype>
<funcdef>XModifierKeymap *<function>XNewModifiermap</function></funcdef>
<paramdef>int<parameter> max_keys_per_mod</parameter></paramdef>
@@ -3619,7 +3619,7 @@ structure, use
<function>XInsertModifiermapEntry</function>.
<indexterm significance="preferred"><primary>XInsertModifiermapEntry</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xinsertmodifiermapentry'>
<funcprototype>
<funcdef>XModifierKeymap *<function>XInsertModifiermapEntry</function></funcdef>
<paramdef>XModifierKeymap<parameter> *modmap</parameter></paramdef>
@@ -3682,7 +3682,7 @@ structure, use
<function>XDeleteModifiermapEntry</function>.
<indexterm significance="preferred"><primary>XDeleteModifiermapEntry</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdeletemodifiermapentry'>
<funcprototype>
<funcdef>XModifierKeymap *<function>XDeleteModifiermapEntry</function></funcdef>
<paramdef>XModifierKeymap<parameter> *modmap</parameter></paramdef>
@@ -3745,7 +3745,7 @@ structure, use
<function>XFreeModifiermap</function>.
<indexterm significance="preferred"><primary>XFreeModifiermap</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xfreemodifiermap'>
<funcprototype>
<funcdef><function>XFreeModifiermap</function></funcdef>
<paramdef>XModifierKeymap<parameter> *modmap</parameter></paramdef>
@@ -3783,7 +3783,7 @@ To set the KeyCodes to be used as modifiers, use
<function>XSetModifierMapping</function>.
<indexterm significance="preferred"><primary>XSetModifierMapping</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetmodifiermapping'>
<funcprototype>
<funcdef>int <function>XSetModifierMapping</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3897,7 +3897,7 @@ To obtain the KeyCodes used as modifiers, use
<function>XGetModifierMapping</function>.
<indexterm significance="preferred"><primary>XGetModifierMapping</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetmodifiermapping'>
<funcprototype>
<funcdef>XModifierKeymap *<function>XGetModifierMapping</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
diff --git a/libX11/specs/libX11/CH13.xml b/libX11/specs/libX11/CH13.xml
index e28b1b0f3..9f61ff554 100644
--- a/libX11/specs/libX11/CH13.xml
+++ b/libX11/specs/libX11/CH13.xml
@@ -145,7 +145,7 @@ To configure Xlib locale modifiers for the current locale, use
<function>XSetLocaleModifiers</function>.
<indexterm significance="preferred"><primary>XSetLocaleModifiers</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetlocalemodifiers'>
<funcprototype>
<funcdef>char *<function>XSetLocaleModifiers</function></funcdef>
<paramdef>char<parameter> *modifier_list</parameter></paramdef>
@@ -544,7 +544,7 @@ To allocate a nested variable argument list dynamically, use
<function>XVaCreateNestedList</function>.
<indexterm significance="preferred"><primary>XVaCreateNestedList</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xvacreatenestedlist'>
<funcprototype>
<funcdef>XVaNestedList <function>XVaCreateNestedList</function></funcdef>
<paramdef>int<parameter> dummy</parameter></paramdef>
@@ -731,7 +731,7 @@ To open an output method, use
<function>XOpenOM</function>.
<indexterm significance="preferred"><primary>XOpenOM</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xopenom'>
<funcprototype>
<funcdef>XOM <function>XOpenOM</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -849,7 +849,7 @@ To close an output method, use
<function>XCloseOM</function>.
<indexterm significance="preferred"><primary>XCloseOM</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcloseom'>
<funcprototype>
<funcdef>Status <function>XCloseOM</function></funcdef>
<paramdef>XOM<parameter> om</parameter></paramdef>
@@ -883,7 +883,7 @@ To set output method attributes, use
<function>XSetOMValues</function>.
<indexterm significance="preferred"><primary>XSetOMValues</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetomvalues'>
<funcprototype>
<funcdef>char *<function>XSetOMValues</function></funcdef>
<paramdef>XOM<parameter> om</parameter></paramdef>
@@ -936,7 +936,7 @@ To query an output method, use
<function>XGetOMValues</function>.
<indexterm significance="preferred"><primary>XGetOMValues</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetomvalues'>
<funcprototype>
<funcdef>char *<function>XGetOMValues</function></funcdef>
<paramdef>XOM<parameter> om</parameter></paramdef>
@@ -984,7 +984,7 @@ To obtain the display associated with an output method, use
<function>XDisplayOfOM</function>.
<indexterm significance="preferred"><primary>XDisplayOfOM</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdisplayofom'>
<funcprototype>
<funcdef>Display *<function>XDisplayOfOM</function></funcdef>
<paramdef>XOM<parameter> om</parameter></paramdef>
@@ -1018,7 +1018,7 @@ To get the locale associated with an output method, use
<function>XLocaleOfOM</function>.
<indexterm significance="preferred"><primary>XLocaleOfOM</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xlocaleofom'>
<funcprototype>
<funcdef>char *<function>XLocaleOfOM</function></funcdef>
<paramdef>XOM<parameter> om</parameter></paramdef>
@@ -1354,7 +1354,7 @@ To create an output context, use
<function>XCreateOC</function>.
<indexterm significance="preferred"><primary>XCreateOC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcreateoc'>
<funcprototype>
<funcdef>XOC <function>XCreateOC</function></funcdef>
<paramdef>XOM<parameter> om</parameter></paramdef>
@@ -1440,7 +1440,7 @@ To destroy an output context, use
<function>XDestroyOC</function>.
<indexterm significance="preferred"><primary>XDestroyOC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdestroyoc'>
<funcprototype>
<funcdef>void <function>XDestroyOC</function></funcdef>
<paramdef>XOC<parameter> oc</parameter></paramdef>
@@ -1474,7 +1474,7 @@ To get the output method associated with an output context, use
<function>XOMOfOC</function>.
<indexterm significance="preferred"><primary>XOMOfOC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xomofoc'>
<funcprototype>
<funcdef>XOM <function>XOMOfOC</function></funcdef>
<paramdef>XOC<parameter> oc</parameter></paramdef>
@@ -1521,7 +1521,7 @@ To set <acronym>XOC</acronym> values, use
<function>XSetOCValues</function>.
<indexterm significance="preferred"><primary>XSetOCValues</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetocvalues'>
<funcprototype>
<funcdef>char *<function>XSetOCValues</function></funcdef>
<paramdef>XOC<parameter> oc</parameter></paramdef>
@@ -1598,7 +1598,7 @@ To obtain <acronym>XOC</acronym> values, use
<function>XGetOCValues</function>.
<indexterm significance="preferred"><primary>XGetOCValues</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetocvalues'>
<funcprototype>
<funcdef>char *<function>XGetOCValues</function></funcdef>
<paramdef>XOC<parameter> oc</parameter></paramdef>
@@ -2146,7 +2146,7 @@ or
<function>XCreateFontSet</function>.
<indexterm significance="preferred"><primary>XCreateFontSet</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcreatefontset'>
<funcprototype>
<funcdef>XFontSet <function>XCreateFontSet</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2476,7 +2476,7 @@ use
<function>XFontsOfFontSet</function>.
<indexterm significance="preferred"><primary>XFontsOfFontSet</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xfontsoffontset'>
<funcprototype>
<funcdef>int <function>XFontsOfFontSet</function></funcdef>
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
@@ -2585,7 +2585,7 @@ use
<function>XBaseFontNameListOfFontSet</function>.
<indexterm significance="preferred"><primary>XBaseFontNameListOfFontSet</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xbasefontnamelistoffontset'>
<funcprototype>
<funcdef>char *<function>XBaseFontNameListOfFontSet</function></funcdef>
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
@@ -2647,7 +2647,7 @@ use
<function>XLocaleOfFontSet</function>.
<indexterm significance="preferred"><primary>XLocaleOfFontSet</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xlocaleoffontset'>
<funcprototype>
<funcdef>char *<function>XLocaleOfFontSet</function></funcdef>
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
@@ -2700,7 +2700,7 @@ if the output context was created by
<function>XCreateFontSet</function>.
<indexterm significance="preferred"><primary>XFreeFontSet</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xfreefontset'>
<funcprototype>
<funcdef>void <function>XFreeFontSet</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2804,7 +2804,7 @@ To find out about direction-dependent rendering, use
<function>XDirectionalDependentDrawing</function>.
<indexterm significance="preferred"><primary>XDirectionalDependentDrawing</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdirectionaldependentdrawing'>
<funcprototype>
<funcdef>Bool <function>XDirectionalDependentDrawing</function></funcdef>
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
@@ -2842,7 +2842,7 @@ To find out about context-dependent rendering, use
<function>XContextualDrawing</function>.
<indexterm significance="preferred"><primary>XContextualDrawing</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcontextualdrawing'>
<funcprototype>
<funcdef>Bool <function>XContextualDrawing</function></funcdef>
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
@@ -2880,7 +2880,7 @@ To find out about context-dependent or direction-dependent rendering, use
<function>XContextDependentDrawing</function>.
<indexterm significance="preferred"><primary>XContextDependentDrawing</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcontextdependentdrawing'>
<funcprototype>
<funcdef>Bool <function>XContextDependentDrawing</function></funcdef>
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
@@ -2994,7 +2994,7 @@ use
<function>XExtentsOfFontSet</function>.
<indexterm significance="preferred"><primary>XExtentsOfFontSet</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xextentsoffontset'>
<funcprototype>
<funcdef>XFontSetExtents *<function>XExtentsOfFontSet</function></funcdef>
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
@@ -3047,7 +3047,7 @@ or
<indexterm significance="preferred"><primary>XmbTextEscapement</primary></indexterm>
<indexterm significance="preferred"><primary>XwcTextEscapement</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xmbtextescapement'>
<funcprototype>
<funcdef>int <function>XmbTextEscapement</function></funcdef>
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
@@ -3056,7 +3056,7 @@ or
</funcprototype>
</funcsynopsis>
<!-- .FN -->
-<funcsynopsis>
+<funcsynopsis id='xwctextescapement'>
<funcprototype>
<funcdef>int <function>XwcTextEscapement</function></funcdef>
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
@@ -3139,7 +3139,7 @@ use
<indexterm significance="preferred"><primary>XmbTextExtents</primary></indexterm>
<indexterm significance="preferred"><primary>XwcTextExtents</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xmbtextextents'>
<funcprototype>
<funcdef>int <function>XmbTextExtents</function></funcdef>
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
@@ -3151,7 +3151,7 @@ use
</funcsynopsis>
<!-- .FN -->
<funcsynopsis>
-<funcprototype>
+<funcprototype id='xwctextextents'>
<funcdef>int <function>XwcTextExtents</function></funcdef>
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
<paramdef>wchar_t<parameter> *string</parameter></paramdef>
@@ -3299,7 +3299,7 @@ or
<indexterm significance="preferred"><primary>XmbTextPerCharExtents</primary></indexterm>
<indexterm significance="preferred"><primary>XwcTextPerCharExtents</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xmbtextpercharextents'>
<funcprototype>
<funcdef>Status <function>XmbTextPerCharExtents</function></funcdef>
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
@@ -3314,7 +3314,7 @@ or
</funcprototype>
</funcsynopsis>
<!-- .FN -->
-<funcsynopsis>
+<funcsynopsis id='xwctextpercharextents'>
<funcprototype>
<funcdef>Status <function>XwcTextPerCharExtents</function></funcdef>
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
@@ -3581,7 +3581,7 @@ or
<indexterm significance="preferred"><primary>XmbDrawText</primary></indexterm>
<indexterm significance="preferred"><primary>XwcDrawText</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xmbdrawtext'>
<funcprototype>
<funcdef>void <function>XmbDrawText</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3593,7 +3593,7 @@ or
</funcprototype>
</funcsynopsis>
<!-- .FN -->
-<funcsynopsis>
+<funcsynopsis id='xwcdrawtext'>
<funcprototype>
<funcdef>void <function>XwcDrawText</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3732,7 +3732,7 @@ or
<indexterm significance="preferred"><primary>XmbDrawString</primary></indexterm>
<indexterm significance="preferred"><primary>XwcDrawString</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xmbdrawstring'>
<funcprototype>
<funcdef>void <function>XmbDrawString</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3745,7 +3745,7 @@ or
</funcprototype>
</funcsynopsis>
<!-- .FN -->
-<funcsynopsis>
+<funcsynopsis id='xwcdrawstring'>
<funcprototype>
<funcdef>void <function>XwcDrawString</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3878,7 +3878,7 @@ or
<indexterm significance="preferred"><primary>XmbDrawImageString</primary></indexterm>
<indexterm significance="preferred"><primary>XwcDrawImageString</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xmbdrawimagestring'>
<funcprototype>
<funcdef>void <function>XmbDrawImageString</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3891,7 +3891,7 @@ or
</funcprototype>
</funcsynopsis>
<!-- .FN -->
-<funcsynopsis>
+<funcsynopsis id='xwcdrawimagestring'>
<funcprototype>
<funcdef>void <function>XwcDrawImageString</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -5184,7 +5184,7 @@ To open a connection, use
<function>XOpenIM</function>.
<indexterm significance="preferred"><primary>XOpenIM</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xopenim'>
<funcprototype>
<funcdef>XIM <function>XOpenIM</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -5305,7 +5305,7 @@ To close a connection, use
<function>XCloseIM</function>.
<indexterm significance="preferred"><primary>XCloseIM</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcloseim'>
<funcprototype>
<funcdef>Status <function>XCloseIM</function></funcdef>
<paramdef>XIM<parameter> im</parameter></paramdef>
@@ -5339,7 +5339,7 @@ To set input method attributes, use
<function>XSetIMValues</function>.
<indexterm significance="preferred"><primary>XSetIMValues</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetimvalues'>
<funcprototype>
<funcdef>char *<function>XSetIMValues</function></funcdef>
<paramdef>XIM<parameter> im</parameter></paramdef>
@@ -5392,7 +5392,7 @@ To query an input method, use
<function>XGetIMValues</function>.
<indexterm significance="preferred"><primary>XGetIMValues</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetimvalues'>
<funcprototype>
<funcdef>char *<function>XGetIMValues</function></funcdef>
<paramdef>XIM<parameter> im</parameter></paramdef>
@@ -5455,7 +5455,7 @@ To obtain the display associated with an input method, use
<function>XDisplayOfIM</function>.
<indexterm significance="preferred"><primary>XDisplayOfIM</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdisplayofim'>
<funcprototype>
<funcdef>Display *<function>XDisplayOfIM</function></funcdef>
<paramdef>XIM<parameter> im</parameter></paramdef>
@@ -5489,7 +5489,7 @@ To get the locale associated with an input method, use
<function>XLocaleOfIM</function>.
<indexterm significance="preferred"><primary>XLocaleOfIM</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xlocaleofim'>
<funcprototype>
<funcdef>char *<function>XLocaleOfIM</function></funcdef>
<paramdef>XIM<parameter> im</parameter></paramdef>
@@ -5523,7 +5523,7 @@ To register an input method instantiate callback, use
<function>XRegisterIMInstantiateCallback</function>.
<indexterm significance="preferred"><primary>XRegisterIMInstantiateCallback</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xregisteriminstantiatecallback'>
<funcprototype>
<funcdef>Bool <function>XRegisterIMInstantiateCallback</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -5619,7 +5619,7 @@ The function returns
The generic prototype is as follows:
<indexterm significance="preferred"><primary>IMInstantiateCallback</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='iminstantiatecallback'>
<funcprototype>
<funcdef>void <function><replaceable>IMInstantiateCallback</replaceable></function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -5668,7 +5668,7 @@ To unregister an input method instantiation callback, use
<function>XUnregisterIMInstantiateCallback</function>.
<indexterm significance="preferred"><primary>XUnregisterIMInstantiateCallback</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xunregisteriminstantiatecallback'>
<funcprototype>
<funcdef>Bool <function>XUnregisterIMInstantiateCallback</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -6108,7 +6108,7 @@ or
The generic prototype of this callback function is as follows:
<indexterm significance="preferred"><primary>DestroyCallback</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='destroycallback'>
<funcprototype>
<funcdef>void <function><replaceable>DestroyCallback</replaceable></function></funcdef>
<paramdef>XIM<parameter> im</parameter></paramdef>
@@ -6344,7 +6344,7 @@ To create an input context, use
<function>XCreateIC</function>.
<indexterm significance="preferred"><primary>XCreateIC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcreateic'>
<funcprototype>
<funcdef>XIC <function>XCreateIC</function></funcdef>
<paramdef>XIM<parameter> im</parameter></paramdef>
@@ -6437,7 +6437,7 @@ To destroy an input context, use
<function>XDestroyIC</function>.
<indexterm significance="preferred"><primary>XDestroyIC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdestroyic'>
<funcprototype>
<funcdef>void <function>XDestroyIC</function></funcdef>
<paramdef>XIC<parameter> ic</parameter></paramdef>
@@ -6474,7 +6474,7 @@ and
<function>XUnsetICFocus</function>.
<indexterm significance="preferred"><primary>XSetICFocus</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xseticfocus'>
<funcprototype>
<funcdef>void <function>XSetICFocus</function></funcdef>
<paramdef>XIC<parameter> ic</parameter></paramdef>
@@ -6515,7 +6515,7 @@ does not affect the focus window value.
<!-- .sp -->
<indexterm significance="preferred"><primary>XUnsetICFocus</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xunseticfocus'>
<funcprototype>
<funcdef>void <function>XUnsetICFocus</function></funcdef>
<paramdef>XIC<parameter> ic</parameter></paramdef>
@@ -6564,14 +6564,14 @@ or
<indexterm significance="preferred"><primary>XmbResetIC</primary></indexterm>
<indexterm significance="preferred"><primary>XwcResetIC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xmbresetic'>
<funcprototype>
<funcdef>char *<function>XmbResetIC</function></funcdef>
<paramdef>XIC<parameter> ic</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<!-- .FN -->
-<funcsynopsis>
+<funcsynopsis id='xwcresetic'>
<funcprototype>
<funcdef>wchar_t *<function>XwcResetIC</function></funcdef>
<paramdef>XIC<parameter> ic</parameter></paramdef>
@@ -6639,7 +6639,7 @@ To get the input method associated with an input context, use
<function>XIMOfIC</function>.
<indexterm significance="preferred"><primary>XIMOfIC</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='ximofic'>
<funcprototype>
<funcdef>XIM <function>XIMOfIC</function></funcdef>
<paramdef>XIC<parameter> ic</parameter></paramdef>
@@ -6684,7 +6684,7 @@ To set <acronym>XIC</acronym> values, use
<function>XSetICValues</function>.
<indexterm significance="preferred"><primary>XSetICValues</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xseticvalues'>
<funcprototype>
<funcdef>char *<function>XSetICValues</function></funcdef>
<paramdef>XIC<parameter> ic</parameter></paramdef>
@@ -6767,7 +6767,7 @@ To obtain <acronym>XIC</acronym> values, use
<function>XGetICValues</function>.
<indexterm significance="preferred"><primary>XGetICValues</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgeticvalues'>
<funcprototype>
<funcdef>char *<function>XGetICValues</function></funcdef>
<paramdef>XIC<parameter> ic</parameter></paramdef>
@@ -8320,7 +8320,7 @@ argument is a pointer to a structure of type
The generic prototype is as follows:
<indexterm significance="preferred"><primary>PreeditStateNotifyCallback</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='preeditstatenotifycallback'>
<funcprototype>
<funcdef>void <function><replaceable>PreeditStateNotifyCallback</replaceable></function></funcdef>
<paramdef>XIC<parameter> ic</parameter></paramdef>
@@ -8671,7 +8671,7 @@ After the callback is invoked, the input context will be freed by Xlib.
The generic prototype is as follows:
<indexterm significance="preferred"><primary>DestroyCallback</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='destroycallback_xic'>
<funcprototype>
<funcdef>void <function><replaceable>DestroyCallback</replaceable></function></funcdef>
<paramdef>XIC<parameter> ic</parameter></paramdef>
@@ -8733,7 +8733,7 @@ with an encoding matching the locale bound to the input context.
The callback prototype is as follows:
<indexterm significance="preferred"><primary>StringConversionCallback</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='stringconversioncallback'>
<funcprototype>
<funcdef>void <function><replaceable>StringConversionCallback</replaceable></function></funcdef>
<paramdef>XIC<parameter> ic</parameter></paramdef>
@@ -8894,7 +8894,7 @@ callback is triggered to let the toolkit do the setup
or the cleanup for the preedit region.
<indexterm significance="preferred"><primary>PreeditStartCallback</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='preeditstartcallback'>
<funcprototype>
<funcdef>int <function><replaceable>PreeditStartCallback</replaceable></function></funcdef>
<paramdef>XIC<parameter> ic</parameter></paramdef>
@@ -8948,7 +8948,7 @@ in the preedit string,
and a value of -1 indicates there is no limit.
<indexterm significance="preferred"><primary>PreeditDoneCallback</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='preeditdonecallback'>
<funcprototype>
<funcdef>void <function><replaceable>PreeditDoneCallback</replaceable></function></funcdef>
<paramdef>XIC<parameter> ic</parameter></paramdef>
@@ -9029,7 +9029,7 @@ The callback prototype
is as follows:
<indexterm significance="preferred"><primary>PreeditDrawCallback</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='preeditdrawcallback'>
<funcprototype>
<funcdef>void <function><replaceable>PreeditDrawCallback</replaceable></function></funcdef>
<paramdef>XIC<parameter> ic</parameter></paramdef>
@@ -9416,7 +9416,7 @@ should move the text insertion point.
It then calls the PreeditCaretCallback.
<indexterm significance="preferred"><primary>PreeditCaretCallback</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='preeditcaretcallback'>
<funcprototype>
<funcdef>void <function><replaceable>PreeditCaretCallback</replaceable></function></funcdef>
<paramdef>XIC<parameter> ic</parameter></paramdef>
@@ -9632,7 +9632,7 @@ When the input context is created or gains focus,
the input method calls the StatusStartCallback callback.
<indexterm significance="preferred"><primary>StatusStartCallback</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='statusstartcallback'>
<funcprototype>
<funcdef>void <function><replaceable>StatusStartCallback</replaceable></function></funcdef>
<paramdef>XIC<parameter> ic</parameter></paramdef>
@@ -9689,7 +9689,7 @@ When an input context
is destroyed or when it loses focus, the input method calls StatusDoneCallback.
<indexterm significance="preferred"><primary>StatusDoneCallback</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='statusdonecallback'>
<funcprototype>
<funcdef>void <function><replaceable>StatusDoneCallback</replaceable></function></funcdef>
<paramdef>XIC<parameter> ic</parameter></paramdef>
@@ -9744,7 +9744,7 @@ When an input context status has to be updated, the input method calls
StatusDrawCallback.
<indexterm significance="preferred"><primary>StatusDrawCallback</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='statusdrawcallback'>
<funcprototype>
<funcdef>void <function><replaceable>StatusDrawCallback</replaceable></function></funcdef>
<paramdef>XIC<parameter> ic</parameter></paramdef>
@@ -9882,7 +9882,7 @@ To filter an event, use
<function>XFilterEvent</function>.
<indexterm significance="preferred"><primary>XFilterEvent</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xfilterevent'>
<funcprototype>
<funcdef>Bool <function>XFilterEvent</function></funcdef>
<paramdef>XEvent<parameter> *event</parameter></paramdef>
@@ -9966,7 +9966,7 @@ or
<indexterm significance="preferred"><primary>XmbLookupString</primary></indexterm>
<indexterm significance="preferred"><primary>XwcLookupString</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xmblookupstring'>
<funcprototype>
<funcdef>int <function>XmbLookupString</function></funcdef>
<paramdef>XIC<parameter> ic</parameter></paramdef>
@@ -9978,7 +9978,7 @@ or
</funcprototype>
</funcsynopsis>
<!-- .FN -->
-<funcsynopsis>
+<funcsynopsis id='xwclookupstring'>
<funcprototype>
<funcdef>int <function>XwcLookupString</function></funcdef>
<paramdef>XIC<parameter> ic</parameter></paramdef>
diff --git a/libX11/specs/libX11/CH14.xml b/libX11/specs/libX11/CH14.xml
index 2baf6d5bf..17802910d 100644
--- a/libX11/specs/libX11/CH14.xml
+++ b/libX11/specs/libX11/CH14.xml
@@ -257,7 +257,7 @@ To request that a top-level window be iconified, use
<function>XIconifyWindow</function>.
<indexterm significance="preferred"><primary>XIconifyWindow</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xiconifywindow'>
<funcprototype>
<funcdef>Status <function>XIconifyWindow</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -331,7 +331,7 @@ To request that a top-level window be withdrawn, use
<function>XWithdrawWindow</function>.
<indexterm significance="preferred"><primary>XWithdrawWindow</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xwithdrawwindow'>
<funcprototype>
<funcdef>Status <function>XWithdrawWindow</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -405,7 +405,7 @@ To request that a top-level window be reconfigured, use
<function>XReconfigureWMWindow</function>.
<indexterm significance="preferred"><primary>XReconfigureWMWindow</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xreconfigurewmwindow'>
<funcprototype>
<funcdef>Status <function>XReconfigureWMWindow</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -579,7 +579,7 @@ or
<indexterm significance="preferred"><primary>XmbTextListToTextProperty</primary></indexterm>
<indexterm significance="preferred"><primary>XwcTextListToTextProperty</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xmbtextlisttotextproperty'>
<funcprototype>
<funcdef>int <function>XmbTextListToTextProperty</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -590,7 +590,7 @@ or
</funcprototype>
</funcsynopsis>
<!-- .FN -->
-<funcsynopsis>
+<funcsynopsis id='xwctextlisttotextproperty'>
<funcprototype>
<funcdef>int <function>XwcTextListToTextProperty</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -741,7 +741,7 @@ or
<indexterm significance="preferred"><primary>XmbTextPropertyToTextList</primary></indexterm>
<indexterm significance="preferred"><primary>XwcTextPropertyToTextList</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xmbtextpropertytotextlist'>
<funcprototype>
<funcdef>int <function>XmbTextPropertyToTextList</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -751,7 +751,7 @@ or
</funcprototype>
</funcsynopsis>
<!-- .FN -->
-<funcsynopsis>
+<funcsynopsis id='xwctextpropertytotextlist'>
<funcprototype>
<funcdef>int <function>XwcTextPropertyToTextList</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -899,7 +899,7 @@ wide character string list, use
<function>XwcFreeStringList</function>.
<indexterm significance="preferred"><primary>XwcFreeStringList</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xwcfreestringlist'>
<funcprototype>
<funcdef>void <function>XwcFreeStringList</function></funcdef>
<paramdef>wchar_t<parameter> **list</parameter></paramdef>
@@ -983,7 +983,7 @@ structure, use
<function>XStringListToTextProperty</function>.
<indexterm significance="preferred"><primary>XStringListToTextProperty</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xstringlisttotextproperty'>
<funcprototype>
<funcdef>Status <function>XStringListToTextProperty</function></funcdef>
<paramdef>char<parameter> **list</parameter></paramdef>
@@ -1058,7 +1058,7 @@ structure in the STRING encoding, use
<function>XTextPropertyToStringList</function>.
<indexterm significance="preferred"><primary>XTextPropertyToStringList</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xtextpropertytostringlist'>
<funcprototype>
<funcdef>Status <function>XTextPropertyToStringList</function></funcdef>
<paramdef>XTextProperty<parameter> *text_prop</parameter></paramdef>
@@ -1131,7 +1131,7 @@ To free the in-memory data associated with the specified string list, use
<function>XFreeStringList</function>.
<indexterm significance="preferred"><primary>XFreeStringList</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xfreestringlist'>
<funcprototype>
<funcdef>void <function>XFreeStringList</function></funcdef>
<paramdef>char<parameter> **list</parameter></paramdef>
@@ -1188,7 +1188,7 @@ To set one of a window's text properties, use
<function>XSetTextProperty</function>.
<indexterm significance="preferred"><primary>XSetTextProperty</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsettextproperty'>
<funcprototype>
<funcdef>void <function>XSetTextProperty</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1276,7 +1276,7 @@ To read one of a window's text properties, use
<function>XGetTextProperty</function>.
<indexterm significance="preferred"><primary>XGetTextProperty</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgettextproperty'>
<funcprototype>
<funcdef>Status <function>XGetTextProperty</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1392,7 +1392,7 @@ To set a window's <property>WM_NAME</property> property with the supplied conven
<function>XSetWMName</function>.
<indexterm significance="preferred"><primary>XSetWMName</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetwmname'>
<funcprototype>
<funcdef>void <function>XSetWMName</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1452,7 +1452,7 @@ To read a window's <property>WM_NAME</property> property with the supplied conve
<function>XGetWMName</function>.
<indexterm significance="preferred"><primary>XGetWMName</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetwmname'>
<funcprototype>
<funcdef>Status <function>XGetWMName</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1525,7 +1525,7 @@ To assign a name to a window, use
<indexterm><primary>Window</primary><secondary>name</secondary></indexterm>
<indexterm significance="preferred"><primary>XStoreName</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xstorename'>
<funcprototype>
<funcdef><function>XStoreName</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1598,7 +1598,7 @@ To get the name of a window, use
<function>XFetchName</function>.
<indexterm significance="preferred"><primary>XFetchName</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xfetchname'>
<funcprototype>
<funcdef>Status <function>XFetchName</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1686,7 +1686,7 @@ use
<function>XSetWMIconName</function>.
<indexterm significance="preferred"><primary>XSetWMIconName</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetwmiconname'>
<funcprototype>
<funcdef>void <function>XSetWMIconName</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1747,7 +1747,7 @@ use
<function>XGetWMIconName</function>.
<indexterm significance="preferred"><primary>XGetWMIconName</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetwmiconname'>
<funcprototype>
<funcdef>Status <function>XGetWMIconName</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1821,7 +1821,7 @@ To set the name to be displayed in a window's icon, use
<indexterm><primary>Window</primary><secondary>icon name</secondary></indexterm>
<indexterm significance="preferred"><primary>XSetIconName</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xseticonname'>
<funcprototype>
<funcdef><function>XSetIconName</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1883,7 +1883,7 @@ To get the name a window wants displayed in its icon, use
<function>XGetIconName</function>.
<indexterm significance="preferred"><primary>XGetIconName</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgeticonname'>
<funcprototype>
<funcdef>Status <function>XGetIconName</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2121,7 +2121,7 @@ To set a window's <property>WM_HINTS</property> property, use
<function>XSetWMHints</function>.
<indexterm significance="preferred"><primary>XSetWMHints</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetwmhints'>
<funcprototype>
<funcdef><function>XSetWMHints</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2190,7 +2190,7 @@ To read a window's <property>WM_HINTS</property> property, use
<function>XGetWMHints</function>.
<indexterm significance="preferred"><primary>XGetWMHints</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetwmhints'>
<funcprototype>
<funcdef>XWMHints *<function>XGetWMHints</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2387,7 +2387,7 @@ To set a window's <property>WM_NORMAL_HINTS</property> property, use
<function>XSetWMNormalHints</function>.
<indexterm significance="preferred"><primary>XSetWMNormalHints</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetwmnormalhints'>
<funcprototype>
<funcdef>void <function>XSetWMNormalHints</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2457,7 +2457,7 @@ To read a window's <property>WM_NORMAL_HINTS</property> property, use
<function>XGetWMNormalHints</function>.
<indexterm significance="preferred"><primary>XGetWMNormalHints</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetwmnormalhints'>
<funcprototype>
<funcdef>Status <function>XGetWMNormalHints</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2568,7 +2568,7 @@ To set a window's <property>WM_SIZE_HINTS</property> property, use
<function>XSetWMSizeHints</function>.
<indexterm significance="preferred"><primary>XSetWMSizeHints</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetwmsizehints'>
<funcprototype>
<funcdef>void <function>XSetWMSizeHints</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2657,7 +2657,7 @@ To read a window's <property>WM_SIZE_HINTS</property> property, use
<function>XGetWMSizeHints</function>.
<indexterm significance="preferred"><primary>XGetWMSizeHints</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetwmsizehints'>
<funcprototype>
<funcdef>Status <function>XGetWMSizeHints</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2873,7 +2873,7 @@ To set a window's <property>WM_CLASS</property> property, use
<function>XSetClassHint</function>.
<indexterm significance="preferred"><primary>XSetClassHint</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetclasshint'>
<funcprototype>
<funcdef><function>XSetClassHint</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2942,7 +2942,7 @@ To read a window's <property>WM_CLASS</property> property, use
<function>XGetClassHint</function>.
<indexterm significance="preferred"><primary>XGetClassHint</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetclasshint'>
<funcprototype>
<funcdef>Status <function>XGetClassHint</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3028,7 +3028,7 @@ To set a window's <property>WM_TRANSIENT_FOR</property> property, use
<function>XSetTransientForHint</function>.
<indexterm significance="preferred"><primary>XSetTransientForHint</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsettransientforhint'>
<funcprototype>
<funcdef><function>XSetTransientForHint</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3094,7 +3094,7 @@ To read a window's <property>WM_TRANSIENT_FOR</property> property, use
<function>XGetTransientForHint</function>.
<indexterm significance="preferred"><primary>XGetTransientForHint</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgettransientforhint'>
<funcprototype>
<funcdef>Status <function>XGetTransientForHint</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3170,7 +3170,7 @@ To set a window's <property>WM_PROTOCOLS</property> property, use
<function>XSetWMProtocols</function>.
<indexterm significance="preferred"><primary>XSetWMProtocols</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetwmprotocols'>
<funcprototype>
<funcdef>Status <function>XSetWMProtocols</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3257,7 +3257,7 @@ To read a window's <property>WM_PROTOCOLS</property> property, use
<function>XGetWMProtocols</function>.
<indexterm significance="preferred"><primary>XGetWMProtocols</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetwmprotocols'>
<funcprototype>
<funcdef>Status <function>XGetWMProtocols</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3356,7 +3356,7 @@ To set a window's <property>WM_COLORMAP_WINDOWS</property> property, use
<function>XSetWMColormapWindows</function>.
<indexterm significance="preferred"><primary>XSetWMColormapWindows</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetwmcolormapwindows'>
<funcprototype>
<funcdef>Status <function>XSetWMColormapWindows</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3443,7 +3443,7 @@ To read a window's <property>WM_COLORMAP_WINDOWS</property> property, use
<function>XGetWMColormapWindows</function>.
<indexterm significance="preferred"><primary>XGetWMColormapWindows</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetwmcolormapwindows'>
<funcprototype>
<funcdef>Status <function>XGetWMColormapWindows</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3608,7 +3608,7 @@ To set a window's <property>WM_ICON_SIZE</property> property, use
<function>XSetIconSizes</function>.
<indexterm significance="preferred"><primary>XSetIconSizes</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xseticonsizes'>
<funcprototype>
<funcdef><function>XSetIconSizes</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3684,7 +3684,7 @@ To read a window's <property>WM_ICON_SIZE</property> property, use
<function>XGetIconSizes</function>.
<indexterm significance="preferred"><primary>XGetIconSizes</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgeticonsizes'>
<funcprototype>
<funcdef>Status <function>XGetIconSizes</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3781,7 +3781,7 @@ The standard window manager properties for a given window are
<property>WM_COMMAND</property>, <property>WM_CLIENT_MACHINE</property>, and <property>WM_LOCALE_NAME</property>.
<indexterm significance="preferred"><primary>XmbSetWMProperties</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xmbsetwmproperties'>
<funcprototype>
<funcdef>void <function>XmbSetWMProperties</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3999,7 +3999,7 @@ The standard window manager properties for a given window are
<property>WM_COMMAND</property>, and <property>WM_CLIENT_MACHINE</property>.
<indexterm significance="preferred"><primary>XSetWMProperties</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetwmproperties'>
<funcprototype>
<funcdef>void <function>XSetWMProperties</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -4225,7 +4225,7 @@ To set a window's <property>WM_COMMAND</property> property, use
<function>XSetCommand</function>.
<indexterm significance="preferred"><primary>XSetCommand</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetcommand'>
<funcprototype>
<funcdef><function>XSetCommand</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -4305,7 +4305,7 @@ To read a window's <property>WM_COMMAND</property> property, use
<function>XGetCommand</function>.
<indexterm significance="preferred"><primary>XGetCommand</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetcommand'>
<funcprototype>
<funcdef>Status <function>XGetCommand</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -4396,7 +4396,7 @@ To set a window's <property>WM_CLIENT_MACHINE</property> property, use
<function>XSetWMClientMachine</function>.
<indexterm significance="preferred"><primary>XSetWMClientMachine</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetwmclientmachine'>
<funcprototype>
<funcdef>void <function>XSetWMClientMachine</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -4456,7 +4456,7 @@ To read a window's <property>WM_CLIENT_MACHINE</property> property, use
<function>XGetWMClientMachine</function>.
<indexterm significance="preferred"><primary>XGetWMClientMachine</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetwmclientmachine'>
<funcprototype>
<funcdef>Status <function>XGetWMClientMachine</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -4918,7 +4918,7 @@ structure, use
<function>XSetRGBColormaps</function>.
<indexterm significance="preferred"><primary>XSetRGBColormaps</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetrgbcolormaps'>
<funcprototype>
<funcdef>void <function>XSetRGBColormaps</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -5098,7 +5098,7 @@ structure associated with the specified property, use
<function>XGetRGBColormaps</function>.
<indexterm significance="preferred"><primary>XGetRGBColormaps</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetrgbcolormaps'>
<funcprototype>
<funcdef>Status <function>XGetRGBColormaps</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
diff --git a/libX11/specs/libX11/CH15.xml b/libX11/specs/libX11/CH15.xml
index 753dff177..a91aa6993 100644
--- a/libX11/specs/libX11/CH15.xml
+++ b/libX11/specs/libX11/CH15.xml
@@ -419,7 +419,7 @@ or
<indexterm significance="preferred"><primary>XrmStringToQuark</primary></indexterm>
<indexterm significance="preferred"><primary>XrmPermStringToQuark</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrmstringtoquark'>
<funcprototype>
<funcdef>XrmQuark <function>XrmStringToQuark</function></funcdef>
<paramdef>char<parameter> *string</parameter></paramdef>
@@ -477,7 +477,7 @@ To convert a quark to a string, use
</literallayout>
<indexterm significance="preferred"><primary>XrmQuarkToString</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrmquarktostring'>
<funcprototype>
<funcdef>char *<function>XrmQuarkToString</function></funcdef>
<paramdef>XrmQuark<parameter> quark</parameter></paramdef>
@@ -524,7 +524,7 @@ To convert a string with one or more components to a quark list, use
<indexterm significance="preferred"><primary>XrmStringToQuarkList</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrmstringtoquarklist'>
<funcprototype>
<funcdef>void <function>XrmStringToQuarkList</function></funcdef>
<paramdef>char<parameter> *string</parameter></paramdef>
@@ -598,7 +598,7 @@ and a quark list, use
<function>XrmStringToBindingQuarkList</function>.
<indexterm significance="preferred"><primary>XrmStringToBindingQuarkList</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrmstringtobindingquarklist'>
<funcprototype>
<funcdef><function>XrmStringToBindingQuarkList</function></funcdef>
<paramdef>char<parameter> *string</parameter></paramdef>
@@ -708,7 +708,7 @@ To initialize the resource manager, use
<function>XrmInitialize</function>.
<indexterm significance="preferred"><primary>XrmInitialize</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrminitialize'>
<funcprototype>
<funcdef>void <function>XrmInitialize</function></funcdef>
<paramdef>void<parameter> XrmInitialize(\|)</parameter></paramdef>
@@ -723,7 +723,7 @@ To retrieve a database from disk, use
<function>XrmGetFileDatabase</function>.
<indexterm significance="preferred"><primary>XrmGetFileDatabase</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrmgetfiledatabase'>
<funcprototype>
<funcdef>XrmDatabase <function>XrmGetFileDatabase</function></funcdef>
<paramdef>char<parameter> *filename</parameter></paramdef>
@@ -767,7 +767,7 @@ To store a copy of a database to disk, use
<function>XrmPutFileDatabase</function>.
<indexterm significance="preferred"><primary>XrmPutFileDatabase</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrmputfiledatabase'>
<funcprototype>
<funcdef>void <function>XrmPutFileDatabase</function></funcdef>
<paramdef>XrmDatabase<parameter> database</parameter></paramdef>
@@ -820,7 +820,7 @@ To obtain a pointer to the screen-independent resources of a display, use
<function>XResourceManagerString</function>.
<indexterm significance="preferred"><primary>XResourceManagerString</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xresourcemanagerstring'>
<funcprototype>
<funcdef>char *<function>XResourceManagerString</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -864,7 +864,7 @@ To obtain a pointer to the screen-specific resources of a screen, use
<function>XScreenResourceString</function>.
<indexterm significance="preferred"><primary>XScreenResourceString</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xscreenresourcestring'>
<funcprototype>
<funcdef>char *<function>XScreenResourceString</function></funcdef>
<paramdef>Screen<parameter> *screen</parameter></paramdef>
@@ -908,7 +908,7 @@ To create a database from a string, use
<function>XrmGetStringDatabase</function>.
<indexterm significance="preferred"><primary>XrmGetStringDatabase</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrmgetstringdatabase'>
<funcprototype>
<funcdef>XrmDatabase <function>XrmGetStringDatabase</function></funcdef>
<paramdef>char<parameter> *data</parameter></paramdef>
@@ -953,7 +953,7 @@ To obtain the locale name of a database, use
<function>XrmLocaleOfDatabase</function>.
<indexterm significance="preferred"><primary>XrmLocaleOfDatabase</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrmlocaleofdatabase'>
<funcprototype>
<funcdef>char *<function>XrmLocaleOfDatabase</function></funcdef>
<paramdef>XrmDatabase<parameter> database</parameter></paramdef>
@@ -993,7 +993,7 @@ To destroy a resource database and free its allocated memory, use
<function>XrmDestroyDatabase</function>.
<indexterm significance="preferred"><primary>XrmDestroyDatabase</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrmdestroydatabase'>
<funcprototype>
<funcdef>void <function>XrmDestroyDatabase</function></funcdef>
<paramdef>XrmDatabase<parameter> database</parameter></paramdef>
@@ -1027,7 +1027,7 @@ To associate a resource database with a display, use
<function>XrmSetDatabase</function>.
<indexterm significance="preferred"><primary>XrmSetDatabase</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrmsetdatabase'>
<funcprototype>
<funcdef>void <function>XrmSetDatabase</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1076,7 +1076,7 @@ To get the resource database associated with a display, use
<function>XrmGetDatabase</function>.
<indexterm significance="preferred"><primary>XrmGetDatabase</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrmgetdatabase'>
<funcprototype>
<funcdef>XrmDatabase <function>XrmGetDatabase</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1116,7 +1116,7 @@ To merge the contents of a resource file into a database, use
<function>XrmCombineFileDatabase</function>.
<indexterm significance="preferred"><primary>XrmCombineFileDatabase</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrmcombinefiledatabase'>
<funcprototype>
<funcdef>Status <function>XrmCombineFileDatabase</function></funcdef>
<paramdef>char<parameter> *filename</parameter></paramdef>
@@ -1190,7 +1190,7 @@ To merge the contents of one database into another database, use
<function>XrmCombineDatabase</function>.
<indexterm significance="preferred"><primary>XrmCombineDatabase</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrmcombinedatabase'>
<funcprototype>
<funcdef>void <function>XrmCombineDatabase</function></funcdef>
<paramdef>XrmDatabasesource_db,<parameter> *target_db</parameter></paramdef>
@@ -1260,7 +1260,7 @@ semantics, use
<function>XrmMergeDatabases</function>.
<indexterm significance="preferred"><primary>XrmMergeDatabases</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrmmergedatabases'>
<funcprototype>
<funcdef>void <function>XrmMergeDatabases</function></funcdef>
<paramdef>XrmDatabasesource_db,<parameter> *target_db</parameter></paramdef>
@@ -1320,7 +1320,7 @@ or
<!-- .sp -->
<indexterm significance="preferred"><primary>XrmGetResource</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrmgetresource'>
<funcprototype>
<funcdef>Bool <function>XrmGetResource</function></funcdef>
<paramdef>XrmDatabase<parameter> database</parameter></paramdef>
@@ -1390,7 +1390,7 @@ Returns the value in the database.
<!-- .sp -->
<indexterm significance="preferred"><primary>XrmQGetResource</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrmqgetresource'>
<funcprototype>
<funcdef>Bool <function>XrmQGetResource</function></funcdef>
<paramdef>XrmDatabase<parameter> database</parameter></paramdef>
@@ -1510,7 +1510,7 @@ To obtain a list of database levels, use
<function>XrmQGetSearchList</function>.
<indexterm significance="preferred"><primary>XrmQGetSearchList</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrmqgetsearchlist'>
<funcprototype>
<funcdef>Bool <function>XrmQGetSearchResource</function></funcdef>
<paramdef>XrmDatabase<parameter> database</parameter></paramdef>
@@ -1619,7 +1619,7 @@ To search resource database levels for a given resource, use
<function>XrmQGetSearchResource</function>.
<indexterm significance="preferred"><primary>XrmQGetSearchResource</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrmqgetsearchresource'>
<funcprototype>
<funcdef>Bool <function>XrmQGetSearchResource</function></funcdef>
<paramdef>XrmSearchList<parameter> list</parameter></paramdef>
@@ -1733,7 +1733,7 @@ This value is copied into the specified database.
<!-- .sp -->
<indexterm significance="preferred"><primary>XrmPutResource</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrmputresource'>
<funcprototype>
<funcdef>void <function>XrmPutResource</function></funcdef>
<paramdef>XrmDatabase<parameter> *database</parameter></paramdef>
@@ -1811,7 +1811,7 @@ The value is stored in the database without modification.
<!-- .sp -->
<indexterm significance="preferred"><primary>XrmQPutResource</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrmqputresource'>
<funcprototype>
<funcdef>void <function>XrmQPutResource</function></funcdef>
<paramdef>XrmDatabase<parameter> *database</parameter></paramdef>
@@ -1893,7 +1893,7 @@ To add a resource that is specified as a string, use
<function>XrmPutStringResource</function>.
<indexterm significance="preferred"><primary>XrmPutStringResource</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrmputstringresource'>
<funcprototype>
<funcdef>void <function>XrmPutStringResource</function></funcdef>
<paramdef>XrmDatabase<parameter> *database</parameter></paramdef>
@@ -1960,7 +1960,7 @@ To add a string resource using quarks as a specification, use
<function>XrmQPutStringResource</function>.
<indexterm significance="preferred"><primary>XrmQPutStringResource</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrmqputstringresource'>
<funcprototype>
<funcdef>void <function>XrmQPutStringResource</function></funcdef>
<paramdef>XrmDatabase<parameter> *database</parameter></paramdef>
@@ -2038,7 +2038,7 @@ both a name and a value, use
<function>XrmPutLineResource</function>.
<indexterm significance="preferred"><primary>XrmPutLineResource</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrmputlineresource'>
<funcprototype>
<funcdef>void <function>XrmPutLineResource</function></funcdef>
<paramdef>XrmDatabase<parameter> *database</parameter></paramdef>
@@ -2107,7 +2107,7 @@ To enumerate the entries of a database, use
#define XrmEnumOneLevel 0
</literallayout>
-<funcsynopsis>
+<funcsynopsis id='xrmenumeratedatabase'>
<funcprototype>
<funcdef>Bool <function>XrmEnumerateDatabase</function></funcdef>
<paramdef>XrmDatabase<parameter> database</parameter></paramdef>
@@ -2311,7 +2311,7 @@ To load a resource database from a C command line, use
<function>XrmParseCommand</function>.
<indexterm significance="preferred"><primary>XrmParseCommand</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrmparsecommand'>
<funcprototype>
<funcdef>void <function>XrmParseCommand</function></funcdef>
<paramdef>XrmDatabase<parameter> *database</parameter></paramdef>
diff --git a/libX11/specs/libX11/CH16.xml b/libX11/specs/libX11/CH16.xml
index 9c7bf8c01..31dc2fc5d 100644
--- a/libX11/specs/libX11/CH16.xml
+++ b/libX11/specs/libX11/CH16.xml
@@ -100,7 +100,7 @@ To obtain a KeySym for the KeyCode of an event, use
<function>XLookupKeysym</function>.
<indexterm significance="preferred"><primary>XLookupKeysym</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xlookupkeysym'>
<funcprototype>
<funcdef>KeySym <function>XLookupKeysym</function></funcdef>
<paramdef>XKeyEvent<parameter> *key_event</parameter></paramdef>
@@ -158,7 +158,7 @@ To obtain a KeySym for a specific KeyCode, use
<function>XKeycodeToKeysym</function>.
<indexterm significance="preferred"><primary>XKeycodeToKeysym</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xkeycodetokeysym'>
<funcprototype>
<funcdef>KeySym <function>XKeycodeToKeysym</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -220,7 +220,7 @@ To obtain a KeyCode for a key having a specific KeySym, use
<function>XKeysymToKeycode</function>.
<indexterm significance="preferred"><primary>XKeysymToKeycode</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xkeysymtokeycode'>
<funcprototype>
<funcdef>KeyCode <function>XKeysymToKeycode</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -268,7 +268,7 @@ To refresh the stored modifier and keymap information, use
<function>XRefreshKeyboardMapping</function>.
<indexterm significance="preferred"><primary>XRefreshKeyboardMapping</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrefreshkeyboardmapping'>
<funcprototype>
<funcdef><function>XRefreshKeyboardMapping</function></funcdef>
<paramdef>XMappingEvent<parameter> *event_map</parameter></paramdef>
@@ -310,7 +310,7 @@ To obtain the uppercase and lowercase forms of a KeySym, use
<function>XConvertCase</function>.
<indexterm significance="preferred"><primary>XConvertCase</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xconvertcase'>
<funcprototype>
<funcdef>void <function>XConvertCase</function></funcdef>
<paramdef>KeySym<parameter> keysym</parameter></paramdef>
@@ -373,7 +373,7 @@ To convert the name of the KeySym to the KeySym code, use
<function>XStringToKeysym</function>.
<indexterm significance="preferred"><primary>XStringToKeysym</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xstringtokeysym'>
<funcprototype>
<funcdef>KeySym <function>XStringToKeysym</function></funcdef>
<paramdef>char<parameter> *string</parameter></paramdef>
@@ -423,7 +423,7 @@ To convert a KeySym code to the name of the KeySym, use
<function>XKeysymToString</function>.
<indexterm significance="preferred"><primary>XKeysymToString</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xkeysymtostring'>
<funcprototype>
<funcdef>char *<function>XKeysymToString</function></funcdef>
<paramdef>KeySym<parameter> keysym</parameter></paramdef>
@@ -671,7 +671,7 @@ To map a key event to an ISO Latin-1 string, use
<function>XLookupString</function>.
<indexterm significance="preferred"><primary>XLookupString</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xlookupstring'>
<funcprototype>
<funcdef>int <function>XLookupString</function></funcdef>
<paramdef>XKeyEvent<parameter> *event_struct</parameter></paramdef>
@@ -793,7 +793,7 @@ use
<function>XRebindKeysym</function>.
<indexterm significance="preferred"><primary>XRebindKeysym</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrebindkeysym'>
<funcprototype>
<funcdef><function>XRebindKeysym</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -898,7 +898,7 @@ To allocate some memory you will never give back, use
<function>Xpermalloc</function>.
<indexterm significance="preferred"><primary>Xpermalloc</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xpermalloc'>
<funcprototype>
<funcdef>char *<function>Xpermalloc</function></funcdef>
<paramdef>unsignedint<parameter> size</parameter></paramdef>
@@ -932,7 +932,7 @@ To parse standard window geometry strings, use
<para>
<!-- .LP -->
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xparsegeometry'>
<funcprototype>
<funcdef>int <function>XParseGeometry</function></funcdef>
<paramdef>char<parameter> *parsestring</parameter></paramdef>
@@ -1066,7 +1066,7 @@ To construct a window's geometry information, use
<function>XWMGeometry</function>.
<indexterm significance="preferred"><primary>XWMGeometry</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xwmgeometry'>
<funcprototype>
<funcdef>int <function>XWMGeometry</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1305,7 +1305,7 @@ To generate a region from a polygon, use
</para>
<indexterm significance="preferred"><primary>XPolygonRegion</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xpolygonregion'>
<funcprototype>
<funcdef>Region <function>XPolygonRegion</function></funcdef>
<paramdef>XPoint<parameter> points[]</parameter></paramdef>
@@ -1368,7 +1368,7 @@ To set the clip-mask of a GC to a region, use
<function>XSetRegion</function>.
<indexterm significance="preferred"><primary>XSetRegion</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsetregion'>
<funcprototype>
<funcdef><function>XSetRegion</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -1428,7 +1428,7 @@ To deallocate the storage associated with a specified region, use
<function>XDestroyRegion</function>.
<indexterm significance="preferred"><primary>XDestroyRegion</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdestroyregion'>
<funcprototype>
<funcdef><function>XDestroyRegion</function></funcdef>
<paramdef>Region<parameter> r</parameter></paramdef>
@@ -1464,7 +1464,7 @@ To move a region by a specified amount, use
<function>XOffsetRegion</function>.
<indexterm significance="preferred"><primary>XOffsetRegion</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xoffsetregion'>
<funcprototype>
<funcdef><function>XOffsetRegion</function></funcdef>
<paramdef>Region<parameter> r</parameter></paramdef>
@@ -1516,7 +1516,7 @@ To reduce a region by a specified amount, use
<function>XShrinkRegion</function>.
<indexterm significance="preferred"><primary>XShrinkRegion</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xshrinkregion'>
<funcprototype>
<funcdef><function>XShrinkRegion</function></funcdef>
<paramdef>Region<parameter> r</parameter></paramdef>
@@ -1579,7 +1579,7 @@ To generate the smallest rectangle enclosing a region, use
<function>XClipBox</function>.
<indexterm significance="preferred"><primary>XClipBox</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xclipbox'>
<funcprototype>
<funcdef><function>XClipBox</function></funcdef>
<paramdef>Region<parameter> r</parameter></paramdef>
@@ -1624,7 +1624,7 @@ To compute the intersection of two regions, use
<function>XIntersectRegion</function>.
<indexterm significance="preferred"><primary>XIntersectRegion</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xintersectregion'>
<funcprototype>
<funcdef><function>XIntersectRegion</function></funcdef>
<paramdef>Regionsra,srb,<parameter> dr_return</parameter></paramdef>
@@ -1673,7 +1673,7 @@ To compute the union of two regions, use
<function>XUnionRegion</function>.
<indexterm significance="preferred"><primary>XUnionRegion</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xunionregion'>
<funcprototype>
<funcdef><function>XUnionRegion</function></funcdef>
<paramdef>Regionsra,srb,<parameter> dr_return</parameter></paramdef>
@@ -1722,7 +1722,7 @@ To create a union of a source region and a rectangle, use
<function>XUnionRectWithRegion</function>.
<indexterm significance="preferred"><primary>XUnionRectWithRegion</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xunionrectwithregion'>
<funcprototype>
<funcdef><function>XUnionRectWithRegion</function></funcdef>
<paramdef>XRectangle<parameter> *rectangle</parameter></paramdef>
@@ -1779,7 +1779,7 @@ To subtract two regions, use
<function>XSubtractRegion</function>.
<indexterm significance="preferred"><primary>XSubtractRegion</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsubtractregion'>
<funcprototype>
<funcdef><function>XSubtractRegion</function></funcdef>
<paramdef>Regionsra,srb,<parameter> dr_return</parameter></paramdef>
@@ -1835,7 +1835,7 @@ of two regions, use
<function>XXorRegion</function>.
<indexterm significance="preferred"><primary>XXorRegion</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xxorregion'>
<funcprototype>
<funcdef><function>XXorRegion</function></funcdef>
<paramdef>Regionsra,srb,<parameter> dr_return</parameter></paramdef>
@@ -1892,7 +1892,7 @@ To determine if the specified region is empty, use
<function>XEmptyRegion</function>.
<indexterm significance="preferred"><primary>XEmptyRegion</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xemptyregion'>
<funcprototype>
<funcdef>Bool <function>XEmptyRegion</function></funcdef>
<paramdef>Region<parameter> r</parameter></paramdef>
@@ -1928,7 +1928,7 @@ To determine if two regions have the same offset, size, and shape, use
<function>XEqualRegion</function>.
<indexterm significance="preferred"><primary>XEqualRegion</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xequalregion'>
<funcprototype>
<funcdef>Bool <function>XEqualRegion</function></funcdef>
<paramdef>Regionr1,<parameter> r2</parameter></paramdef>
@@ -1980,7 +1980,7 @@ To determine if a specified point resides in a specified region, use
<function>XPointInRegion</function>.
<indexterm significance="preferred"><primary>XPointInRegion</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xpointinregion'>
<funcprototype>
<funcdef>Bool <function>XPointInRegion</function></funcdef>
<paramdef>Region<parameter> r</parameter></paramdef>
@@ -2039,7 +2039,7 @@ To determine if a specified rectangle is inside a region, use
<function>XRectInRegion</function>.
<indexterm significance="preferred"><primary>XRectInRegion</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrectinregion'>
<funcprototype>
<funcdef>int <function>XRectInRegion</function></funcdef>
<paramdef>Region<parameter> r</parameter></paramdef>
@@ -2151,7 +2151,7 @@ To store data in cut buffer 0, use
<function>XStoreBytes</function>.
<indexterm significance="preferred"><primary>XStoreBytes</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xstorebytes'>
<funcprototype>
<funcdef><function>XStoreBytes</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2216,7 +2216,7 @@ To store data in a specified cut buffer, use
<function>XStoreBuffer</function>.
<indexterm significance="preferred"><primary>XStoreBuffer</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xstorebuffer'>
<funcprototype>
<funcdef><function>XStoreBuffer</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2291,7 +2291,7 @@ To return data from cut buffer 0, use
<function>XFetchBytes</function>.
<indexterm significance="preferred"><primary>XFetchBytes</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xfetchbytes'>
<funcprototype>
<funcdef>char *<function>XFetchBytes</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2343,7 +2343,7 @@ To return data from a specified cut buffer, use
<function>XFetchBuffer</function>.
<indexterm significance="preferred"><primary>XFetchBuffer</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xfetchbuffer'>
<funcprototype>
<funcdef>char *<function>XFetchBuffer</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2402,7 +2402,7 @@ To rotate the cut buffers, use
<function>XRotateBuffers</function>.
<indexterm significance="preferred"><primary>XRotateBuffers</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xrotatebuffers'>
<funcprototype>
<funcdef><function>XRotateBuffers</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2522,7 +2522,7 @@ template, use
<function>XGetVisualInfo</function>.
<indexterm significance="preferred"><primary>XGetVisualInfo</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetvisualinfo'>
<funcprototype>
<funcdef>XVisualInfo *<function>XGetVisualInfo</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2597,7 +2597,7 @@ class of the screen, use
<function>XMatchVisualInfo</function>.
<indexterm significance="preferred"><primary>XMatchVisualInfo</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xmatchvisualinfo'>
<funcprototype>
<funcdef>Status <function>XMatchVisualInfo</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2747,7 +2747,7 @@ structure and initialize it with image format values from a display, use
<function>XCreateImage</function>.
<indexterm significance="preferred"><primary>XCreateImage</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcreateimage'>
<funcprototype>
<funcdef>XImage *<function>XCreateImage</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -2930,7 +2930,7 @@ To obtain a pixel value in an image, use
<function>XGetPixel</function>.
<indexterm significance="preferred"><primary>XGetPixel</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xgetpixel'>
<funcprototype>
<funcdef>unsigned long <function>XGetPixel</function></funcdef>
<paramdef>XImage<parameter> *ximage</parameter></paramdef>
@@ -2991,7 +2991,7 @@ To set a pixel value in an image, use
<function>XPutPixel</function>.
<indexterm significance="preferred"><primary>XPutPixel</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xputpixel'>
<funcprototype>
<funcdef><function>XPutPixel</function></funcdef>
<paramdef>XImage<parameter> *ximage</parameter></paramdef>
@@ -3063,7 +3063,7 @@ To create a subimage, use
<function>XSubImage</function>.
<indexterm significance="preferred"><primary>XSubImage</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsubimage'>
<funcprototype>
<funcdef>XImage *<function>XSubImage</function></funcdef>
<paramdef>XImage<parameter> *ximage</parameter></paramdef>
@@ -3149,7 +3149,7 @@ To increment each pixel in an image by a constant value, use
<function>XAddPixel</function>.
<indexterm significance="preferred"><primary>XAddPixel</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xaddpixel'>
<funcprototype>
<funcdef><function>XAddPixel</function></funcdef>
<paramdef>XImage<parameter> *ximage</parameter></paramdef>
@@ -3198,7 +3198,7 @@ use
<function>XDestroyImage</function>.
<indexterm significance="preferred"><primary>XDestroyImage</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdestroyimage'>
<funcprototype>
<funcdef><function>XDestroyImage</function></funcdef>
<paramdef>XImage *<parameter>ximage</parameter></paramdef>
@@ -3285,7 +3285,7 @@ To read a bitmap from a file and store it in a pixmap, use
<function>XReadBitmapFile</function>.
<indexterm significance="preferred"><primary>XReadBitmapFile</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xreadbitmapfile'>
<funcprototype>
<funcdef>int <function>XReadBitmapFile</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3440,7 +3440,7 @@ To read a bitmap from a file and return it as data, use
<function>XReadBitmapFileData</function>.
<indexterm significance="preferred"><primary>XReadBitmapFileData</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xreadbitmapfiledata'>
<funcprototype>
<funcdef>int <function>XReadBitmapFileData</function></funcdef>
<paramdef>char<parameter> *filename</parameter></paramdef>
@@ -3537,7 +3537,7 @@ To write out a bitmap from a pixmap to a file, use
<function>XWriteBitmapFile</function>.
<indexterm significance="preferred"><primary>XWriteBitmapFile</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xwritebitmapfile'>
<funcprototype>
<funcdef>int <function>XWriteBitmapFile</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3664,7 +3664,7 @@ To create a pixmap and then store bitmap-format data into it, use
<function>XCreatePixmapFromBitmapData</function>.
<indexterm significance="preferred"><primary>XCreatePixmapFromBitmapData</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcreatepixmapfrombitmapdata'>
<funcprototype>
<funcdef>Pixmap <function>XCreatePixmapFromBitmapData</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3796,7 +3796,7 @@ in a program directly, as opposed to reading it in every time at run time, use
<function>XCreateBitmapFromData</function>.
<indexterm significance="preferred"><primary>XCreateBitmapFromData</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xcreatebitmapfromdata'>
<funcprototype>
<funcdef>Pixmap <function>XCreateBitmapFromData</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -3942,7 +3942,7 @@ To save a data value that corresponds to a resource ID and context type, use
<function>XSaveContext</function>.
<indexterm significance="preferred"><primary>XSaveContext</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xsavecontext'>
<funcprototype>
<funcdef>int <function>XSaveContext</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -4016,7 +4016,7 @@ To get the data associated with a resource ID and type, use
<function>XFindContext</function>.
<indexterm significance="preferred"><primary>XFindContext</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xfindcontext'>
<funcprototype>
<funcdef>int <function>XFindContext</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
@@ -4089,7 +4089,7 @@ To delete an entry for a given resource ID and type, use
<function>XDeleteContext</function>.
<indexterm significance="preferred"><primary>XDeleteContext</primary></indexterm>
<!-- .sM -->
-<funcsynopsis>
+<funcsynopsis id='xdeletecontext'>
<funcprototype>
<funcdef>int <function>XDeleteContext</function></funcdef>
<paramdef>Display<parameter> *display</parameter></paramdef>
diff --git a/mesalib/src/mesa/main/texgetimage.c b/mesalib/src/mesa/main/texgetimage.c
index 6060e5b3d..915bcf913 100644
--- a/mesalib/src/mesa/main/texgetimage.c
+++ b/mesalib/src/mesa/main/texgetimage.c
@@ -40,6 +40,7 @@
#include "pack.h"
#include "pbo.h"
#include "texgetimage.h"
+#include "texfetch.h"
#include "teximage.h"
@@ -220,110 +221,14 @@ get_tex_ycbcr(struct gl_context *ctx, GLuint dimensions,
}
-#if FEATURE_EXT_texture_sRGB
-
-
-/**
- * Convert a float value from linear space to a
- * non-linear sRGB value in [0, 255].
- * Not terribly efficient.
- */
-static INLINE GLfloat
-linear_to_nonlinear(GLfloat cl)
-{
- /* can't have values outside [0, 1] */
- GLfloat cs;
- if (cl < 0.0031308f) {
- cs = 12.92f * cl;
- }
- else {
- cs = (GLfloat)(1.055 * pow(cl, 0.41666) - 0.055);
- }
- return cs;
-}
-
-
-/**
- * glGetTexImagefor sRGB pixels;
- */
-static void
-get_tex_srgb(struct gl_context *ctx, GLuint dimensions,
- GLenum format, GLenum type, GLvoid *pixels,
- const struct gl_texture_image *texImage)
-{
- const GLint width = texImage->Width;
- const GLint height = texImage->Height;
- const GLint depth = texImage->Depth;
- const GLbitfield transferOps = 0x0;
- GLint img, row;
- GLfloat (*rgba)[4] = (GLfloat (*)[4]) malloc(4 * width * sizeof(GLfloat));
-
- if (!rgba) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage");
- return;
- }
-
- for (img = 0; img < depth; img++) {
- for (row = 0; row < height; row++) {
- void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
- width, height, format, type,
- img, row, 0);
-
- GLint col;
-
- /* convert row to RGBA format */
- for (col = 0; col < width; col++) {
- texImage->FetchTexelf(texImage, col, row, img, rgba[col]);
- if (texImage->_BaseFormat == GL_LUMINANCE) {
- rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]);
- rgba[col][GCOMP] = 0.0;
- rgba[col][BCOMP] = 0.0;
- }
- else if (texImage->_BaseFormat == GL_LUMINANCE_ALPHA) {
- rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]);
- rgba[col][GCOMP] = 0.0;
- rgba[col][BCOMP] = 0.0;
- }
- else if (texImage->_BaseFormat == GL_RGB ||
- texImage->_BaseFormat == GL_RGBA) {
- rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]);
- rgba[col][GCOMP] = linear_to_nonlinear(rgba[col][GCOMP]);
- rgba[col][BCOMP] = linear_to_nonlinear(rgba[col][BCOMP]);
- }
- }
- _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba,
- format, type, dest,
- &ctx->Pack, transferOps);
- }
- }
-
- free(rgba);
-}
-
-
-#else /* FEATURE_EXT_texture_sRGB */
-
-
-static INLINE void
-get_tex_srgb(struct gl_context *ctx, GLuint dimensions,
- GLenum format, GLenum type, GLvoid *pixels,
- const struct gl_texture_image *texImage)
-{
- ASSERT_NO_FEATURE();
-}
-
-
-#endif /* FEATURE_EXT_texture_sRGB */
-
-
/**
- * glGetTexImagefor RGBA, Luminance, etc. pixels.
+ * glGetTexImage for (s)RGBA, Luminance, etc. pixels.
* This is the slow way since we use texture sampling.
*/
static void
get_tex_rgba(struct gl_context *ctx, GLuint dimensions,
GLenum format, GLenum type, GLvoid *pixels,
- const struct gl_texture_image *texImage)
+ struct gl_texture_image *texImage)
{
const GLint width = texImage->Width;
const GLint height = texImage->Height;
@@ -334,12 +239,23 @@ get_tex_rgba(struct gl_context *ctx, GLuint dimensions,
GLbitfield transferOps = 0x0;
GLint img, row;
GLfloat (*rgba)[4] = (GLfloat (*)[4]) malloc(4 * width * sizeof(GLfloat));
+ const GLboolean is_sampler_srgb_decode =
+ _mesa_get_format_color_encoding(texImage->TexFormat) == GL_SRGB &&
+ texImage->TexObject->Sampler.sRGBDecode == GL_DECODE_EXT;
if (!rgba) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage");
return;
}
+ /* glGetTexImage always returns sRGB data for sRGB textures. Make sure the
+ * fetch functions return sRGB data without linearizing it.
+ */
+ if (is_sampler_srgb_decode) {
+ texImage->TexObject->Sampler.sRGBDecode = GL_SKIP_DECODE_EXT;
+ _mesa_set_fetch_functions(texImage, dimensions);
+ }
+
for (img = 0; img < depth; img++) {
for (row = 0; row < height; row++) {
void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
@@ -389,6 +305,11 @@ get_tex_rgba(struct gl_context *ctx, GLuint dimensions,
}
}
+ if (is_sampler_srgb_decode) {
+ texImage->TexObject->Sampler.sRGBDecode = GL_DECODE_EXT;
+ _mesa_set_fetch_functions(texImage, dimensions);
+ }
+
free(rgba);
}
@@ -548,9 +469,6 @@ _mesa_get_teximage(struct gl_context *ctx, GLenum target, GLint level,
else if (format == GL_YCBCR_MESA) {
get_tex_ycbcr(ctx, dimensions, format, type, pixels, texImage);
}
- else if (_mesa_get_format_color_encoding(texImage->TexFormat) == GL_SRGB) {
- get_tex_srgb(ctx, dimensions, format, type, pixels, texImage);
- }
else {
get_tex_rgba(ctx, dimensions, format, type, pixels, texImage);
}
diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c
index 8568c68e1..ca508493b 100644
--- a/mesalib/src/mesa/state_tracker/st_format.c
+++ b/mesalib/src/mesa/state_tracker/st_format.c
@@ -563,18 +563,547 @@ st_pipe_format_to_mesa_format(enum pipe_format format)
/**
+ * Map GL texture formats to Gallium pipe formats.
+ */
+struct format_mapping
+{
+ GLenum glFormats[18]; /**< list of GLenum formats, 0-terminated */
+ enum pipe_format pipeFormats[10]; /**< list of pipe formats, 0-terminated */
+};
+
+
+#define DEFAULT_RGBA_FORMATS \
+ PIPE_FORMAT_B8G8R8A8_UNORM, \
+ PIPE_FORMAT_A8R8G8B8_UNORM, \
+ PIPE_FORMAT_A8B8G8R8_UNORM, \
+ PIPE_FORMAT_B5G6R5_UNORM, \
+ 0
+
+#define DEFAULT_RGB_FORMATS \
+ PIPE_FORMAT_B8G8R8X8_UNORM, \
+ PIPE_FORMAT_X8R8G8B8_UNORM, \
+ PIPE_FORMAT_X8B8G8R8_UNORM, \
+ PIPE_FORMAT_B8G8R8A8_UNORM, \
+ PIPE_FORMAT_A8R8G8B8_UNORM, \
+ PIPE_FORMAT_A8B8G8R8_UNORM, \
+ PIPE_FORMAT_B5G6R5_UNORM, \
+ 0
+
+#define DEFAULT_SRGBA_FORMATS \
+ PIPE_FORMAT_B8G8R8A8_SRGB, \
+ PIPE_FORMAT_A8R8G8B8_SRGB, \
+ PIPE_FORMAT_A8B8G8R8_SRGB, \
+ 0
+
+/**
+ * This table maps OpenGL texture format enums to Gallium pipe_format enums.
+ * Multiple GL enums might map to multiple pipe_formats.
+ * The first pipe format in the list that's supported is the one that's chosen.
+ */
+static struct format_mapping format_map[] = {
+ /* Basic RGB, RGBA formats */
+ {
+ { GL_RGB10, GL_RGB10_A2, 0 },
+ { PIPE_FORMAT_B10G10R10A2_UNORM, 0 }
+ },
+ {
+ { 4, GL_RGBA, GL_RGBA8, 0 },
+ { DEFAULT_RGBA_FORMATS, 0 }
+ },
+ {
+ { GL_BGRA, 0 },
+ { PIPE_FORMAT_B8G8R8A8_UNORM, DEFAULT_RGB_FORMATS, 0 }
+ },
+ {
+ { 3, GL_RGB, GL_RGB8, 0 },
+ { DEFAULT_RGB_FORMATS, 0 }
+ },
+ {
+ { GL_RGB12, GL_RGB16, GL_RGBA12, GL_RGBA16, 0 },
+ { PIPE_FORMAT_R16G16B16A16_UNORM, DEFAULT_RGB_FORMATS, 0 }
+ },
+ {
+ { GL_RGBA4, GL_RGBA2, 0 },
+ { PIPE_FORMAT_B4G4R4A4_UNORM, DEFAULT_RGBA_FORMATS }
+ },
+ {
+ { GL_RGB5_A1, 0 },
+ { PIPE_FORMAT_B5G5R5A1_UNORM, DEFAULT_RGBA_FORMATS, 0 }
+ },
+ {
+ { GL_R3_G3_B2, 0 },
+ { PIPE_FORMAT_B2G3R3_UNORM, PIPE_FORMAT_B5G6R5_UNORM,
+ PIPE_FORMAT_B5G5R5A1_UNORM, DEFAULT_RGBA_FORMATS }
+ },
+ {
+ { GL_RGB5, GL_RGB4 },
+ { PIPE_FORMAT_B5G6R5_UNORM, PIPE_FORMAT_B5G5R5A1_UNORM,
+ DEFAULT_RGBA_FORMATS }
+ },
+
+ /* basic Alpha formats */
+ {
+ { GL_ALPHA12, GL_ALPHA16, 0 },
+ { PIPE_FORMAT_A16_UNORM, PIPE_FORMAT_A8_UNORM,
+ DEFAULT_RGBA_FORMATS }
+ },
+ {
+ { GL_ALPHA, GL_ALPHA4, GL_ALPHA8, GL_COMPRESSED_ALPHA, 0 },
+ { PIPE_FORMAT_A8_UNORM, DEFAULT_RGBA_FORMATS }
+ },
+
+ /* basic Luminance formats */
+ {
+ { GL_LUMINANCE12, GL_LUMINANCE16, 0 },
+ { PIPE_FORMAT_L16_UNORM, PIPE_FORMAT_L8_UNORM, DEFAULT_RGBA_FORMATS, 0 }
+ },
+ {
+ { 1, GL_LUMINANCE, GL_LUMINANCE4, GL_LUMINANCE8, 0 },
+ { PIPE_FORMAT_L8_UNORM, DEFAULT_RGBA_FORMATS }
+ },
+
+ /* basic Luminance/Alpha formats */
+ {
+ { GL_LUMINANCE12_ALPHA4, GL_LUMINANCE12_ALPHA12,
+ GL_LUMINANCE16_ALPHA16, 0},
+ { PIPE_FORMAT_L16A16_UNORM, PIPE_FORMAT_L8A8_UNORM,
+ PIPE_FORMAT_L8A8_UNORM, DEFAULT_RGBA_FORMATS }
+ },
+ {
+ { 2, GL_LUMINANCE_ALPHA, GL_LUMINANCE6_ALPHA2, GL_LUMINANCE8_ALPHA8, 0 },
+ { PIPE_FORMAT_L8A8_UNORM, DEFAULT_RGBA_FORMATS }
+ },
+ {
+ { GL_LUMINANCE4_ALPHA4, 0 },
+ { PIPE_FORMAT_L4A4_UNORM, PIPE_FORMAT_L4A4_UNORM,
+ DEFAULT_RGBA_FORMATS }
+ },
+
+ /* basic Intensity formats */
+ {
+ { GL_INTENSITY12, GL_INTENSITY16, 0 },
+ { PIPE_FORMAT_I16_UNORM, PIPE_FORMAT_I8_UNORM, DEFAULT_RGBA_FORMATS }
+ },
+ {
+ { GL_INTENSITY, GL_INTENSITY4, GL_INTENSITY8,
+ GL_COMPRESSED_INTENSITY, 0 },
+ { PIPE_FORMAT_I8_UNORM, DEFAULT_RGBA_FORMATS }
+ },
+
+ /* YCbCr */
+ {
+ { GL_YCBCR_MESA, 0 },
+ { PIPE_FORMAT_UYVY, PIPE_FORMAT_YUYV, 0 }
+ },
+
+ /* compressed formats */ /* XXX PIPE_BIND_SAMPLER_VIEW only */
+ {
+ { GL_COMPRESSED_RGB, 0 },
+ { PIPE_FORMAT_DXT1_RGB, 0 }
+ },
+ {
+ { GL_COMPRESSED_RGBA, 0 },
+ { PIPE_FORMAT_DXT5_RGBA, 0 }
+ },
+ {
+ { GL_RGB_S3TC, GL_RGB4_S3TC, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 0 },
+ { PIPE_FORMAT_DXT1_RGB, 0 }
+ },
+ {
+ { GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, 0 },
+ { PIPE_FORMAT_DXT1_RGBA, 0 }
+ },
+ {
+ { GL_RGBA_S3TC, GL_RGBA4_S3TC, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, 0 },
+ { PIPE_FORMAT_DXT3_RGBA, 0 }
+ },
+ {
+ { GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, 0 },
+ { PIPE_FORMAT_DXT5_RGBA, 0 }
+ },
+
+#if 0
+ {
+ { GL_COMPRESSED_RGB_FXT1_3DFX, 0 },
+ { PIPE_FORMAT_RGB_FXT1, 0 }
+ },
+ {
+ { GL_COMPRESSED_RGBA_FXT1_3DFX, 0 },
+ { PIPE_FORMAT_RGB_FXT1, 0 }
+ },
+#endif
+
+ /* Depth formats */
+ {
+ { GL_DEPTH_COMPONENT16, 0 },
+ { PIPE_FORMAT_Z16_UNORM, PIPE_FORMAT_Z24_UNORM_S8_USCALED,
+ PIPE_FORMAT_S8_USCALED_Z24_UNORM, PIPE_FORMAT_Z32_UNORM, 0 }
+ },
+ {
+ { GL_DEPTH_COMPONENT24, 0 },
+ { PIPE_FORMAT_Z24X8_UNORM, PIPE_FORMAT_X8Z24_UNORM,
+ PIPE_FORMAT_Z24_UNORM_S8_USCALED, PIPE_FORMAT_S8_USCALED_Z24_UNORM,
+ PIPE_FORMAT_Z32_UNORM, 0 }
+ },
+ {
+ { GL_DEPTH_COMPONENT32, 0 },
+ { PIPE_FORMAT_Z32_UNORM, 0 }
+ },
+ {
+ { GL_DEPTH_COMPONENT, 0 },
+ { PIPE_FORMAT_Z24X8_UNORM, PIPE_FORMAT_X8Z24_UNORM,
+ PIPE_FORMAT_Z32_UNORM, PIPE_FORMAT_Z16_UNORM,
+ PIPE_FORMAT_Z24_UNORM_S8_USCALED, PIPE_FORMAT_S8_USCALED_Z24_UNORM, 0 }
+ },
+
+ /* stencil formats */
+ {
+ { GL_STENCIL_INDEX, GL_STENCIL_INDEX1_EXT, GL_STENCIL_INDEX4_EXT,
+ GL_STENCIL_INDEX8_EXT, GL_STENCIL_INDEX16_EXT, 0 },
+ {
+ PIPE_FORMAT_S8_USCALED, PIPE_FORMAT_Z24_UNORM_S8_USCALED,
+ PIPE_FORMAT_S8_USCALED_Z24_UNORM, 0
+ }
+ },
+
+ /* Depth / Stencil formats */
+ {
+ { GL_DEPTH_STENCIL_EXT, GL_DEPTH24_STENCIL8_EXT, 0 },
+ { PIPE_FORMAT_Z24_UNORM_S8_USCALED, PIPE_FORMAT_S8_USCALED_Z24_UNORM, 0 }
+ },
+
+ /* sRGB formats */
+ {
+ { GL_SRGB_EXT, GL_SRGB8_EXT, GL_SRGB_ALPHA_EXT, GL_SRGB8_ALPHA8_EXT, 0 },
+ { DEFAULT_SRGBA_FORMATS }
+ },
+ {
+ { GL_COMPRESSED_SRGB_EXT, GL_COMPRESSED_SRGB_S3TC_DXT1_EXT, 0 },
+ { PIPE_FORMAT_DXT1_SRGB, DEFAULT_SRGBA_FORMATS }
+ },
+ {
+ { GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 0 },
+ { PIPE_FORMAT_DXT1_SRGBA, 0 }
+ },
+ {
+ { GL_COMPRESSED_SRGB_ALPHA_EXT,
+ GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, 0 },
+ { PIPE_FORMAT_DXT3_SRGBA, DEFAULT_SRGBA_FORMATS }
+ },
+ {
+ { GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, 0 },
+ { PIPE_FORMAT_DXT5_SRGBA, 0 }
+ },
+ {
+ { GL_SLUMINANCE_ALPHA_EXT, GL_SLUMINANCE8_ALPHA8_EXT,
+ GL_COMPRESSED_SLUMINANCE_EXT, GL_COMPRESSED_SLUMINANCE_ALPHA_EXT, 0 },
+ { PIPE_FORMAT_L8A8_SRGB, DEFAULT_SRGBA_FORMATS }
+ },
+ {
+ { GL_SLUMINANCE_EXT, GL_SLUMINANCE8_EXT, 0 },
+ { PIPE_FORMAT_L8_SRGB, DEFAULT_SRGBA_FORMATS }
+ },
+
+ /* 16-bit float formats */
+ {
+ { GL_RGBA16F_ARB, 0 },
+ { PIPE_FORMAT_R16G16B16A16_FLOAT, PIPE_FORMAT_R32G32B32A32_FLOAT, 0 }
+ },
+ {
+ { GL_RGB16F_ARB, 0 },
+ { PIPE_FORMAT_R16G16B16_FLOAT, PIPE_FORMAT_R16G16B16A16_FLOAT,
+ PIPE_FORMAT_R32G32B32_FLOAT, PIPE_FORMAT_R32G32B32A32_FLOAT, 0 }
+ },
+ {
+ { GL_LUMINANCE_ALPHA16F_ARB, 0 },
+ { PIPE_FORMAT_L16A16_FLOAT, PIPE_FORMAT_R16G16B16A16_FLOAT,
+ PIPE_FORMAT_L32A32_FLOAT, PIPE_FORMAT_R32G32B32A32_FLOAT, 0 }
+ },
+ {
+ { GL_ALPHA16F_ARB, 0 },
+ { PIPE_FORMAT_A16_FLOAT, PIPE_FORMAT_L16A16_FLOAT,
+ PIPE_FORMAT_A32_FLOAT, PIPE_FORMAT_R16G16B16A16_FLOAT,
+ PIPE_FORMAT_L32A32_FLOAT, PIPE_FORMAT_R32G32B32A32_FLOAT, 0 }
+ },
+ {
+ { GL_INTENSITY16F_ARB, 0 },
+ { PIPE_FORMAT_I16_FLOAT, PIPE_FORMAT_L16A16_FLOAT,
+ PIPE_FORMAT_I32_FLOAT, PIPE_FORMAT_R16G16B16A16_FLOAT,
+ PIPE_FORMAT_L32A32_FLOAT, PIPE_FORMAT_R32G32B32A32_FLOAT, 0 }
+ },
+ {
+ { GL_LUMINANCE16F_ARB, 0 },
+ { PIPE_FORMAT_L16_FLOAT, PIPE_FORMAT_L16A16_FLOAT,
+ PIPE_FORMAT_L32_FLOAT, PIPE_FORMAT_R16G16B16A16_FLOAT,
+ PIPE_FORMAT_L32A32_FLOAT, PIPE_FORMAT_R32G32B32A32_FLOAT, 0 }
+ },
+ {
+ { GL_R16F, 0 },
+ { PIPE_FORMAT_R16_FLOAT, PIPE_FORMAT_R16G16_FLOAT,
+ PIPE_FORMAT_R32_FLOAT, PIPE_FORMAT_R16G16B16A16_FLOAT,
+ PIPE_FORMAT_R32G32_FLOAT, PIPE_FORMAT_R32G32B32A32_FLOAT, 0 }
+ },
+ {
+ { GL_RG16F, 0 },
+ { PIPE_FORMAT_R16G16_FLOAT, PIPE_FORMAT_R16G16B16A16_FLOAT,
+ PIPE_FORMAT_R32G32_FLOAT, PIPE_FORMAT_R32G32B32A32_FLOAT, 0 }
+ },
+
+ /* 32-bit float formats */
+ {
+ { GL_RGBA32F_ARB, 0 },
+ { PIPE_FORMAT_R32G32B32A32_FLOAT, PIPE_FORMAT_R16G16B16A16_FLOAT, 0 }
+ },
+ {
+ { GL_RGB32F_ARB, 0 },
+ { PIPE_FORMAT_R32G32B32_FLOAT, PIPE_FORMAT_R32G32B32A32_FLOAT,
+ PIPE_FORMAT_R16G16B16A16_FLOAT, 0 }
+ },
+ {
+ { GL_LUMINANCE_ALPHA32F_ARB, 0 },
+ { PIPE_FORMAT_L32A32_FLOAT, PIPE_FORMAT_R32G32B32A32_FLOAT,
+ PIPE_FORMAT_L16A16_FLOAT, PIPE_FORMAT_R16G16B16A16_FLOAT, 0 }
+ },
+ {
+ { GL_ALPHA32F_ARB, 0 },
+ { PIPE_FORMAT_A32_FLOAT, PIPE_FORMAT_L32A32_FLOAT,
+ PIPE_FORMAT_R32G32B32A32_FLOAT, PIPE_FORMAT_A16_FLOAT,
+ PIPE_FORMAT_L16A16_FLOAT, PIPE_FORMAT_R16G16B16A16_FLOAT, 0 }
+ },
+ {
+ { GL_INTENSITY32F_ARB, 0 },
+ { PIPE_FORMAT_I32_FLOAT, PIPE_FORMAT_L32A32_FLOAT,
+ PIPE_FORMAT_R32G32B32A32_FLOAT, PIPE_FORMAT_I16_FLOAT,
+ PIPE_FORMAT_L16A16_FLOAT, PIPE_FORMAT_R16G16B16A16_FLOAT, 0 }
+ },
+ {
+ { GL_LUMINANCE32F_ARB, 0 },
+ { PIPE_FORMAT_L32_FLOAT, PIPE_FORMAT_L32A32_FLOAT,
+ PIPE_FORMAT_R32G32B32A32_FLOAT, PIPE_FORMAT_L16_FLOAT,
+ PIPE_FORMAT_L16A16_FLOAT, PIPE_FORMAT_R16G16B16A16_FLOAT, 0 }
+ },
+ {
+ { GL_R32F, 0 },
+ { PIPE_FORMAT_R32_FLOAT, PIPE_FORMAT_R32G32_FLOAT,
+ PIPE_FORMAT_R32G32B32A32_FLOAT, PIPE_FORMAT_R16_FLOAT,
+ PIPE_FORMAT_R16G16_FLOAT, PIPE_FORMAT_R16G16B16A16_FLOAT, 0 }
+ },
+ {
+ { GL_RG32F, 0 },
+ { PIPE_FORMAT_R32G32_FLOAT, PIPE_FORMAT_R32G32B32A32_FLOAT,
+ PIPE_FORMAT_R16G16_FLOAT, PIPE_FORMAT_R16G16B16A16_FLOAT, 0 }
+ },
+
+ /* R, RG formats */
+ {
+ { GL_RED, GL_R8, 0 },
+ { PIPE_FORMAT_R8_UNORM, 0 }
+ },
+ {
+ { GL_RG, GL_RG8, 0 },
+ { PIPE_FORMAT_R8G8_UNORM, 0 }
+ },
+ {
+ { GL_R16, 0 },
+ { PIPE_FORMAT_R16_UNORM, 0 }
+ },
+ {
+ { GL_RG16, 0 },
+ { PIPE_FORMAT_R16G16_UNORM, 0 }
+ },
+
+ /* compressed R, RG formats */
+ {
+ { GL_COMPRESSED_RED, GL_COMPRESSED_RED_RGTC1, 0 },
+ { PIPE_FORMAT_RGTC1_UNORM, PIPE_FORMAT_R8_UNORM, 0 }
+ },
+ {
+ { GL_COMPRESSED_SIGNED_RED_RGTC1, 0 },
+ { PIPE_FORMAT_RGTC1_SNORM, 0 }
+ },
+ {
+ { GL_COMPRESSED_RG, GL_COMPRESSED_RG_RGTC2, 0 },
+ { PIPE_FORMAT_RGTC2_UNORM, PIPE_FORMAT_R8G8_UNORM, 0 }
+ },
+ {
+ { GL_COMPRESSED_SIGNED_RG_RGTC2, 0 },
+ { PIPE_FORMAT_RGTC2_SNORM, 0 }
+ },
+ {
+ { GL_COMPRESSED_LUMINANCE, GL_COMPRESSED_LUMINANCE_LATC1_EXT, 0 },
+ { PIPE_FORMAT_LATC1_UNORM, PIPE_FORMAT_L8_UNORM, 0 }
+ },
+ {
+ { GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT, 0 },
+ { PIPE_FORMAT_LATC1_SNORM, 0 }
+ },
+ {
+ { GL_COMPRESSED_LUMINANCE_ALPHA, GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT,
+ GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI, 0 },
+ { PIPE_FORMAT_LATC2_UNORM, PIPE_FORMAT_L8A8_UNORM, 0 }
+ },
+ {
+ { GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT, 0 },
+ { PIPE_FORMAT_LATC2_SNORM, 0 }
+ },
+
+ /* signed/unsigned integer formats.
+ * XXX Mesa only has formats for RGBA signed/unsigned integer formats.
+ * If/when new formats are added this code should be updated.
+ */
+ {
+ { GL_RED_INTEGER_EXT,
+ GL_GREEN_INTEGER_EXT,
+ GL_BLUE_INTEGER_EXT,
+ GL_ALPHA_INTEGER_EXT,
+ GL_RGB_INTEGER_EXT,
+ GL_RGBA_INTEGER_EXT,
+ GL_BGR_INTEGER_EXT,
+ GL_BGRA_INTEGER_EXT,
+ GL_LUMINANCE_INTEGER_EXT,
+ GL_LUMINANCE_ALPHA_INTEGER_EXT,
+ GL_RGBA8I_EXT,
+ GL_RGB8I_EXT,
+ GL_ALPHA8I_EXT,
+ GL_INTENSITY8I_EXT,
+ GL_LUMINANCE8I_EXT,
+ GL_LUMINANCE_ALPHA8I_EXT, 0 },
+ { PIPE_FORMAT_R8G8B8A8_SSCALED, 0 }
+ },
+ {
+ {
+ GL_RGBA16I_EXT,
+ GL_RGB16I_EXT,
+ GL_ALPHA16I_EXT,
+ GL_INTENSITY16I_EXT,
+ GL_LUMINANCE16I_EXT,
+ GL_LUMINANCE_ALPHA16I_EXT, 0 },
+ { PIPE_FORMAT_R16G16B16A16_SSCALED, 0 },
+ },
+ {
+ {
+ GL_RGBA32I_EXT,
+ GL_RGB32I_EXT,
+ GL_ALPHA32I_EXT,
+ GL_INTENSITY32I_EXT,
+ GL_LUMINANCE32I_EXT,
+ GL_LUMINANCE_ALPHA32I_EXT, 0 },
+ { PIPE_FORMAT_R32G32B32A32_SSCALED, 0 }
+ },
+ {
+ {
+ GL_RGBA8UI_EXT,
+ GL_RGB8UI_EXT,
+ GL_ALPHA8UI_EXT,
+ GL_INTENSITY8UI_EXT,
+ GL_LUMINANCE8UI_EXT,
+ GL_LUMINANCE_ALPHA8UI_EXT, 0 },
+ { PIPE_FORMAT_R8G8B8A8_USCALED, 0 }
+ },
+ {
+ {
+ GL_RGBA16UI_EXT,
+ GL_RGB16UI_EXT,
+ GL_ALPHA16UI_EXT,
+ GL_INTENSITY16UI_EXT,
+ GL_LUMINANCE16UI_EXT,
+ GL_LUMINANCE_ALPHA16UI_EXT, 0 },
+ { PIPE_FORMAT_R16G16B16A16_USCALED, 0 }
+ },
+ {
+ {
+ GL_RGBA32UI_EXT,
+ GL_RGB32UI_EXT,
+ GL_ALPHA32UI_EXT,
+ GL_INTENSITY32UI_EXT,
+ GL_LUMINANCE32UI_EXT,
+ GL_LUMINANCE_ALPHA32UI_EXT, 0 },
+ { PIPE_FORMAT_R32G32B32A32_USCALED, 0 }
+ },
+
+ /* signed normalized formats */
+ {
+ { GL_RED_SNORM, GL_R8_SNORM, 0 },
+ { PIPE_FORMAT_R8_SNORM, PIPE_FORMAT_R8G8_SNORM,
+ PIPE_FORMAT_R8G8B8A8_SNORM, 0 }
+ },
+ {
+ { GL_R16_SNORM, 0 },
+ { PIPE_FORMAT_R16_SNORM,
+ PIPE_FORMAT_R16G16_SNORM,
+ PIPE_FORMAT_R16G16B16A16_SNORM,
+ PIPE_FORMAT_R8_SNORM,
+ PIPE_FORMAT_R8G8_SNORM,
+ PIPE_FORMAT_R8G8B8A8_SNORM, 0 }
+ },
+ {
+ { GL_RG_SNORM, GL_RG8_SNORM, 0 },
+ { PIPE_FORMAT_R8G8_SNORM, PIPE_FORMAT_R8G8B8A8_SNORM, 0 }
+ },
+ {
+ { GL_RG16_SNORM, 0 },
+ { PIPE_FORMAT_R16G16_SNORM, PIPE_FORMAT_R16G16B16A16_SNORM,
+ PIPE_FORMAT_R8G8_SNORM, PIPE_FORMAT_R8G8B8A8_SNORM, 0 }
+ },
+ {
+ { GL_RGB_SNORM, GL_RGB8_SNORM, GL_RGBA_SNORM, GL_RGBA8_SNORM, 0 },
+ { PIPE_FORMAT_R8G8B8A8_SNORM, 0 }
+ },
+ {
+ { GL_RGB16_SNORM, GL_RGBA16_SNORM, 0 },
+ { PIPE_FORMAT_R16G16B16A16_SNORM, PIPE_FORMAT_R8G8B8A8_SNORM, 0 }
+ },
+ {
+ { GL_ALPHA_SNORM, GL_ALPHA8_SNORM, 0 },
+ { PIPE_FORMAT_A8_SNORM, PIPE_FORMAT_R8G8B8A8_SNORM, 0 }
+ },
+ {
+ { GL_ALPHA16_SNORM, 0 },
+ { PIPE_FORMAT_A16_SNORM, PIPE_FORMAT_R16G16B16A16_SNORM,
+ PIPE_FORMAT_A8_SNORM, PIPE_FORMAT_R8G8B8A8_SNORM, 0 }
+ },
+ {
+ { GL_LUMINANCE_SNORM, GL_LUMINANCE8_SNORM, 0 },
+ { PIPE_FORMAT_L8_SNORM, PIPE_FORMAT_R8G8B8A8_SNORM, 0 }
+ },
+ {
+ { GL_LUMINANCE16_SNORM, 0 },
+ { PIPE_FORMAT_L16_SNORM, PIPE_FORMAT_R16G16B16A16_SNORM,
+ PIPE_FORMAT_L8_SNORM, PIPE_FORMAT_R8G8B8A8_SNORM, 0 }
+ },
+ {
+ { GL_LUMINANCE_ALPHA_SNORM, GL_LUMINANCE8_ALPHA8_SNORM, 0 },
+ { PIPE_FORMAT_L8A8_SNORM, PIPE_FORMAT_R8G8B8A8_SNORM, 0 }
+ },
+ {
+ { GL_LUMINANCE16_ALPHA16_SNORM, 0 },
+ { PIPE_FORMAT_L16A16_SNORM, PIPE_FORMAT_R16G16B16A16_SNORM,
+ PIPE_FORMAT_L8A8_SNORM, PIPE_FORMAT_R8G8B8A8_SNORM, 0 }
+ },
+ {
+ { GL_INTENSITY_SNORM, GL_INTENSITY8_SNORM, 0 },
+ { PIPE_FORMAT_I8_SNORM, PIPE_FORMAT_R8G8B8A8_SNORM, 0 }
+ },
+ {
+ { GL_INTENSITY16_SNORM, 0 },
+ { PIPE_FORMAT_I16_SNORM, PIPE_FORMAT_R16G16B16A16_SNORM,
+ PIPE_FORMAT_I8_SNORM, PIPE_FORMAT_R8G8B8A8_SNORM, 0 }
+ }
+};
+
+
+/**
* Return first supported format from the given list.
*/
static enum pipe_format
find_supported_format(struct pipe_screen *screen,
const enum pipe_format formats[],
- uint num_formats,
enum pipe_texture_target target,
unsigned sample_count,
unsigned tex_usage)
{
uint i;
- for (i = 0; i < num_formats; i++) {
+ for (i = 0; formats[i]; i++) {
if (screen->is_format_supported(screen, formats[i], target,
sample_count, tex_usage)) {
return formats[i];
@@ -585,67 +1114,6 @@ find_supported_format(struct pipe_screen *screen,
/**
- * Find an RGBA format supported by the context/winsys.
- */
-static enum pipe_format
-default_rgba_format(struct pipe_screen *screen,
- enum pipe_texture_target target,
- unsigned sample_count,
- unsigned tex_usage)
-{
- static const enum pipe_format colorFormats[] = {
- PIPE_FORMAT_B8G8R8A8_UNORM,
- PIPE_FORMAT_A8R8G8B8_UNORM,
- PIPE_FORMAT_A8B8G8R8_UNORM,
- PIPE_FORMAT_B5G6R5_UNORM
- };
- return find_supported_format(screen, colorFormats, Elements(colorFormats),
- target, sample_count, tex_usage);
-}
-
-
-/**
- * Find an RGB format supported by the context/winsys.
- */
-static enum pipe_format
-default_rgb_format(struct pipe_screen *screen,
- enum pipe_texture_target target,
- unsigned sample_count,
- unsigned tex_usage)
-{
- static const enum pipe_format colorFormats[] = {
- PIPE_FORMAT_B8G8R8X8_UNORM,
- PIPE_FORMAT_X8R8G8B8_UNORM,
- PIPE_FORMAT_X8B8G8R8_UNORM,
- PIPE_FORMAT_B8G8R8A8_UNORM,
- PIPE_FORMAT_A8R8G8B8_UNORM,
- PIPE_FORMAT_A8B8G8R8_UNORM,
- PIPE_FORMAT_B5G6R5_UNORM
- };
- return find_supported_format(screen, colorFormats, Elements(colorFormats),
- target, sample_count, tex_usage);
-}
-
-/**
- * Find an sRGBA format supported by the context/winsys.
- */
-static enum pipe_format
-default_srgba_format(struct pipe_screen *screen,
- enum pipe_texture_target target,
- unsigned sample_count,
- unsigned tex_usage)
-{
- static const enum pipe_format colorFormats[] = {
- PIPE_FORMAT_B8G8R8A8_SRGB,
- PIPE_FORMAT_A8R8G8B8_SRGB,
- PIPE_FORMAT_A8B8G8R8_SRGB,
- };
- return find_supported_format(screen, colorFormats, Elements(colorFormats),
- target, sample_count, tex_usage);
-}
-
-
-/**
* Given an OpenGL internalFormat value for a texture or surface, return
* the best matching PIPE_FORMAT_x, or PIPE_FORMAT_NONE if there's no match.
* This is called during glTexImage2D, for example.
@@ -663,853 +1131,31 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
enum pipe_texture_target target, unsigned sample_count,
unsigned bindings)
{
+ GET_CURRENT_CONTEXT(ctx); /* XXX this should be a function parameter */
+ int i, j;
- switch (internalFormat) {
- case GL_RGB10:
- case GL_RGB10_A2:
- if (screen->is_format_supported( screen, PIPE_FORMAT_B10G10R10A2_UNORM,
- target, sample_count, bindings))
- return PIPE_FORMAT_B10G10R10A2_UNORM;
- /* Pass through. */
- case 4:
- case GL_RGBA:
- case GL_RGBA8:
- return default_rgba_format( screen, target, sample_count, bindings);
-
- case GL_BGRA:
- if (screen->is_format_supported( screen, PIPE_FORMAT_B8G8R8A8_UNORM,
- target, sample_count, bindings))
- return PIPE_FORMAT_B8G8R8A8_UNORM;
- return default_rgba_format( screen, target, sample_count, bindings);
-
- case 3:
- case GL_RGB:
- case GL_RGB8:
- return default_rgb_format( screen, target, sample_count, bindings);
-
- case GL_RGB12:
- case GL_RGB16:
- case GL_RGBA12:
- case GL_RGBA16:
- if (screen->is_format_supported( screen, PIPE_FORMAT_R16G16B16A16_UNORM,
- target, sample_count, bindings))
- return PIPE_FORMAT_R16G16B16A16_UNORM;
- return default_rgba_format( screen, target, sample_count, bindings);
-
- case GL_RGBA4:
- case GL_RGBA2:
- if (screen->is_format_supported( screen, PIPE_FORMAT_B4G4R4A4_UNORM,
- target, sample_count, bindings))
- return PIPE_FORMAT_B4G4R4A4_UNORM;
- return default_rgba_format( screen, target, sample_count, bindings);
-
- case GL_RGB5_A1:
- if (screen->is_format_supported( screen, PIPE_FORMAT_B5G5R5A1_UNORM,
- target, sample_count, bindings))
- return PIPE_FORMAT_B5G5R5A1_UNORM;
- return default_rgba_format( screen, target, sample_count, bindings);
-
- case GL_R3_G3_B2:
- if (screen->is_format_supported( screen, PIPE_FORMAT_B2G3R3_UNORM,
- target, sample_count, bindings))
- return PIPE_FORMAT_B2G3R3_UNORM;
- /* Pass through. */
- case GL_RGB5:
- case GL_RGB4:
- if (screen->is_format_supported( screen, PIPE_FORMAT_B5G6R5_UNORM,
- target, sample_count, bindings))
- return PIPE_FORMAT_B5G6R5_UNORM;
- if (screen->is_format_supported( screen, PIPE_FORMAT_B5G5R5A1_UNORM,
- target, sample_count, bindings))
- return PIPE_FORMAT_B5G5R5A1_UNORM;
- return default_rgba_format( screen, target, sample_count, bindings);
-
- case GL_ALPHA12:
- case GL_ALPHA16:
- if (screen->is_format_supported( screen, PIPE_FORMAT_A16_UNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_A16_UNORM;
- /* Pass through. */
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_COMPRESSED_ALPHA:
- if (screen->is_format_supported( screen, PIPE_FORMAT_A8_UNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_A8_UNORM;
- return default_rgba_format( screen, target, sample_count, bindings);
-
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- if (screen->is_format_supported( screen, PIPE_FORMAT_L16_UNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_L16_UNORM;
- /* Pass through. */
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- if (screen->is_format_supported( screen, PIPE_FORMAT_L8_UNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_L8_UNORM;
- return default_rgba_format( screen, target, sample_count, bindings);
-
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- if (screen->is_format_supported( screen, PIPE_FORMAT_L16A16_UNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_L16A16_UNORM;
- /* Pass through. */
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- if (screen->is_format_supported( screen, PIPE_FORMAT_L8A8_UNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_L8A8_UNORM;
- return default_rgba_format( screen, target, sample_count, bindings);
-
- case GL_LUMINANCE4_ALPHA4:
- if (screen->is_format_supported( screen, PIPE_FORMAT_L4A4_UNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_L4A4_UNORM;
- if (screen->is_format_supported( screen, PIPE_FORMAT_L8A8_UNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_L8A8_UNORM;
- return default_rgba_format( screen, target, sample_count, bindings);
-
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- if (screen->is_format_supported( screen, PIPE_FORMAT_I16_UNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_I16_UNORM;
- /* Pass through. */
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_COMPRESSED_INTENSITY:
- if (screen->is_format_supported( screen, PIPE_FORMAT_I8_UNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_I8_UNORM;
- return default_rgba_format( screen, target, sample_count, bindings);
-
- case GL_YCBCR_MESA:
- if (screen->is_format_supported(screen, PIPE_FORMAT_UYVY, target,
- sample_count, bindings)) {
- return PIPE_FORMAT_UYVY;
- }
- if (screen->is_format_supported(screen, PIPE_FORMAT_YUYV, target,
- sample_count, bindings)) {
- return PIPE_FORMAT_YUYV;
- }
- return PIPE_FORMAT_NONE;
-
- case GL_COMPRESSED_RGB:
- /* can only sample from compressed formats */
- if (bindings & ~PIPE_BIND_SAMPLER_VIEW)
- return PIPE_FORMAT_NONE;
- else if (screen->is_format_supported(screen, PIPE_FORMAT_DXT1_RGB,
- target, sample_count, bindings))
- return PIPE_FORMAT_DXT1_RGB;
- else
- return default_rgb_format(screen, target, sample_count, bindings);
-
- case GL_COMPRESSED_RGBA:
- /* can only sample from compressed formats */
- if (bindings & ~PIPE_BIND_SAMPLER_VIEW)
- return PIPE_FORMAT_NONE;
- else if (screen->is_format_supported(screen, PIPE_FORMAT_DXT3_RGBA,
- target, sample_count, bindings))
- return PIPE_FORMAT_DXT3_RGBA;
- else
- return default_rgba_format(screen, target, sample_count, bindings);
-
- case GL_RGB_S3TC:
- case GL_RGB4_S3TC:
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- if (screen->is_format_supported(screen, PIPE_FORMAT_DXT1_RGB,
- target, sample_count, bindings))
- return PIPE_FORMAT_DXT1_RGB;
- else
- return PIPE_FORMAT_NONE;
-
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- if (screen->is_format_supported(screen, PIPE_FORMAT_DXT1_RGBA,
- target, sample_count, bindings))
- return PIPE_FORMAT_DXT1_RGBA;
- else
- return PIPE_FORMAT_NONE;
-
- case GL_RGBA_S3TC:
- case GL_RGBA4_S3TC:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- if (screen->is_format_supported(screen, PIPE_FORMAT_DXT3_RGBA,
- target, sample_count, bindings))
- return PIPE_FORMAT_DXT3_RGBA;
- else
- return PIPE_FORMAT_NONE;
-
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- if (screen->is_format_supported(screen, PIPE_FORMAT_DXT5_RGBA,
- target, sample_count, bindings))
- return PIPE_FORMAT_DXT5_RGBA;
- else
- return PIPE_FORMAT_NONE;
-
-#if 0
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- return PIPE_FORMAT_RGB_FXT1;
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
- return PIPE_FORMAT_RGB_FXT1;
-#endif
-
- case GL_DEPTH_COMPONENT16:
- if (screen->is_format_supported(screen, PIPE_FORMAT_Z16_UNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_Z16_UNORM;
- /* fall-through */
- case GL_DEPTH_COMPONENT24:
- if (screen->is_format_supported(screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED,
- target, sample_count, bindings))
- return PIPE_FORMAT_Z24_UNORM_S8_USCALED;
- if (screen->is_format_supported(screen, PIPE_FORMAT_S8_USCALED_Z24_UNORM,
- target, sample_count, bindings))
- return PIPE_FORMAT_S8_USCALED_Z24_UNORM;
- /* fall-through */
- case GL_DEPTH_COMPONENT32:
- if (screen->is_format_supported(screen, PIPE_FORMAT_Z32_UNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_Z32_UNORM;
- /* fall-through */
- case GL_DEPTH_COMPONENT:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_Z32_UNORM,
- PIPE_FORMAT_Z24_UNORM_S8_USCALED,
- PIPE_FORMAT_S8_USCALED_Z24_UNORM,
- PIPE_FORMAT_Z16_UNORM
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
-
- case GL_STENCIL_INDEX:
- case GL_STENCIL_INDEX1_EXT:
- case GL_STENCIL_INDEX4_EXT:
- case GL_STENCIL_INDEX8_EXT:
- case GL_STENCIL_INDEX16_EXT:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_S8_USCALED,
- PIPE_FORMAT_Z24_UNORM_S8_USCALED,
- PIPE_FORMAT_S8_USCALED_Z24_UNORM
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
-
- case GL_DEPTH_STENCIL_EXT:
- case GL_DEPTH24_STENCIL8_EXT:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_Z24_UNORM_S8_USCALED,
- PIPE_FORMAT_S8_USCALED_Z24_UNORM
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
-
- case GL_SRGB_EXT:
- case GL_SRGB8_EXT:
- case GL_SRGB_ALPHA_EXT:
- case GL_SRGB8_ALPHA8_EXT:
- return default_srgba_format( screen, target, sample_count, bindings);
-
- case GL_COMPRESSED_SRGB_EXT:
- case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
- if (screen->is_format_supported(screen, PIPE_FORMAT_DXT1_SRGB, target,
- sample_count, bindings))
- return PIPE_FORMAT_DXT1_SRGB;
- return default_srgba_format( screen, target, sample_count, bindings);
-
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
- return PIPE_FORMAT_DXT1_SRGBA;
-
- case GL_COMPRESSED_SRGB_ALPHA_EXT:
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
- if (screen->is_format_supported(screen, PIPE_FORMAT_DXT3_SRGBA, target,
- sample_count, bindings))
- return PIPE_FORMAT_DXT3_SRGBA;
- return default_srgba_format( screen, target, sample_count, bindings);
-
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
- return PIPE_FORMAT_DXT5_SRGBA;
-
- case GL_SLUMINANCE_ALPHA_EXT:
- case GL_SLUMINANCE8_ALPHA8_EXT:
- case GL_COMPRESSED_SLUMINANCE_EXT:
- case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT:
- if (screen->is_format_supported(screen, PIPE_FORMAT_L8A8_SRGB, target,
- sample_count, bindings))
- return PIPE_FORMAT_L8A8_SRGB;
- return default_srgba_format( screen, target, sample_count, bindings);
-
- case GL_SLUMINANCE_EXT:
- case GL_SLUMINANCE8_EXT:
- if (screen->is_format_supported(screen, PIPE_FORMAT_L8_SRGB, target,
- sample_count, bindings))
- return PIPE_FORMAT_L8_SRGB;
- return default_srgba_format( screen, target, sample_count, bindings);
-
- /* prefer formats in order of data size, choosing 16-bit ones if equal sized */
- case GL_RGBA16F_ARB:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_R16G16B16A16_FLOAT,
- PIPE_FORMAT_R32G32B32A32_FLOAT
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
- case GL_RGB16F_ARB:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_R16G16B16_FLOAT,
- PIPE_FORMAT_R16G16B16A16_FLOAT,
- PIPE_FORMAT_R32G32B32_FLOAT,
- PIPE_FORMAT_R32G32B32A32_FLOAT
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
- case GL_LUMINANCE_ALPHA16F_ARB:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_L16A16_FLOAT,
- PIPE_FORMAT_R16G16B16A16_FLOAT,
- PIPE_FORMAT_L32A32_FLOAT,
- PIPE_FORMAT_R32G32B32A32_FLOAT
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
- case GL_ALPHA16F_ARB:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_A16_FLOAT,
- PIPE_FORMAT_L16A16_FLOAT,
- PIPE_FORMAT_A32_FLOAT,
- PIPE_FORMAT_R16G16B16A16_FLOAT,
- PIPE_FORMAT_L32A32_FLOAT,
- PIPE_FORMAT_R32G32B32A32_FLOAT
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
- case GL_INTENSITY16F_ARB:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_I16_FLOAT,
- PIPE_FORMAT_L16A16_FLOAT,
- PIPE_FORMAT_I32_FLOAT,
- PIPE_FORMAT_R16G16B16A16_FLOAT,
- PIPE_FORMAT_L32A32_FLOAT,
- PIPE_FORMAT_R32G32B32A32_FLOAT
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
- case GL_LUMINANCE16F_ARB:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_L16_FLOAT,
- PIPE_FORMAT_L16A16_FLOAT,
- PIPE_FORMAT_L32_FLOAT,
- PIPE_FORMAT_R16G16B16A16_FLOAT,
- PIPE_FORMAT_L32A32_FLOAT,
- PIPE_FORMAT_R32G32B32A32_FLOAT
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
- case GL_R16F:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_R16_FLOAT,
- PIPE_FORMAT_R16G16_FLOAT,
- PIPE_FORMAT_R32_FLOAT,
- PIPE_FORMAT_R16G16B16A16_FLOAT,
- PIPE_FORMAT_R32G32_FLOAT,
- PIPE_FORMAT_R32G32B32A32_FLOAT
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
- case GL_RG16F:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_R16G16_FLOAT,
- PIPE_FORMAT_R16G16B16A16_FLOAT,
- PIPE_FORMAT_R32G32_FLOAT,
- PIPE_FORMAT_R32G32B32A32_FLOAT
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
-
- /* try a 32-bit format if available, otherwise fallback to a 16-bit one */
- case GL_RGBA32F_ARB:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_R32G32B32A32_FLOAT,
- PIPE_FORMAT_R16G16B16A16_FLOAT
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
- case GL_RGB32F_ARB:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_R32G32B32_FLOAT,
- PIPE_FORMAT_R32G32B32A32_FLOAT,
- PIPE_FORMAT_R16G16B16A16_FLOAT
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
- case GL_LUMINANCE_ALPHA32F_ARB:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_L32A32_FLOAT,
- PIPE_FORMAT_R32G32B32A32_FLOAT,
- PIPE_FORMAT_L16A16_FLOAT,
- PIPE_FORMAT_R16G16B16A16_FLOAT
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
- case GL_ALPHA32F_ARB:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_A32_FLOAT,
- PIPE_FORMAT_L32A32_FLOAT,
- PIPE_FORMAT_R32G32B32A32_FLOAT,
- PIPE_FORMAT_A16_FLOAT,
- PIPE_FORMAT_L16A16_FLOAT,
- PIPE_FORMAT_R16G16B16A16_FLOAT
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
- case GL_INTENSITY32F_ARB:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_I32_FLOAT,
- PIPE_FORMAT_L32A32_FLOAT,
- PIPE_FORMAT_R32G32B32A32_FLOAT,
- PIPE_FORMAT_I16_FLOAT,
- PIPE_FORMAT_L16A16_FLOAT,
- PIPE_FORMAT_R16G16B16A16_FLOAT
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
- case GL_LUMINANCE32F_ARB:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_L32_FLOAT,
- PIPE_FORMAT_L32A32_FLOAT,
- PIPE_FORMAT_R32G32B32A32_FLOAT,
- PIPE_FORMAT_L16_FLOAT,
- PIPE_FORMAT_L16A16_FLOAT,
- PIPE_FORMAT_R16G16B16A16_FLOAT
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
- case GL_R32F:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_R32_FLOAT,
- PIPE_FORMAT_R32G32_FLOAT,
- PIPE_FORMAT_R32G32B32A32_FLOAT,
- PIPE_FORMAT_R16_FLOAT,
- PIPE_FORMAT_R16G16_FLOAT,
- PIPE_FORMAT_R16G16B16A16_FLOAT
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
- case GL_RG32F:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_R32G32_FLOAT,
- PIPE_FORMAT_R32G32B32A32_FLOAT,
- PIPE_FORMAT_R16G16_FLOAT,
- PIPE_FORMAT_R16G16B16A16_FLOAT
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
-
- case GL_RED:
- case GL_R8:
- if (screen->is_format_supported(screen, PIPE_FORMAT_R8_UNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_R8_UNORM;
- return PIPE_FORMAT_NONE;
- case GL_RG:
- case GL_RG8:
- if (screen->is_format_supported(screen, PIPE_FORMAT_R8G8_UNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_R8G8_UNORM;
- return PIPE_FORMAT_NONE;
-
- case GL_R16:
- if (screen->is_format_supported(screen, PIPE_FORMAT_R16_UNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_R16_UNORM;
- return PIPE_FORMAT_NONE;
-
- case GL_RG16:
- if (screen->is_format_supported(screen, PIPE_FORMAT_R16G16_UNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_R16G16_UNORM;
- return PIPE_FORMAT_NONE;
-
- case GL_COMPRESSED_RED:
- case GL_COMPRESSED_RED_RGTC1:
- if (screen->is_format_supported(screen, PIPE_FORMAT_RGTC1_UNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_RGTC1_UNORM;
- if (screen->is_format_supported(screen, PIPE_FORMAT_R8_UNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_R8_UNORM;
- return PIPE_FORMAT_NONE;
-
- case GL_COMPRESSED_SIGNED_RED_RGTC1:
- if (screen->is_format_supported(screen, PIPE_FORMAT_RGTC1_SNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_RGTC1_SNORM;
- return PIPE_FORMAT_NONE;
-
- case GL_COMPRESSED_RG:
- case GL_COMPRESSED_RG_RGTC2:
- if (screen->is_format_supported(screen, PIPE_FORMAT_RGTC2_UNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_RGTC2_UNORM;
- if (screen->is_format_supported(screen, PIPE_FORMAT_R8G8_UNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_R8G8_UNORM;
- return PIPE_FORMAT_NONE;
-
- case GL_COMPRESSED_SIGNED_RG_RGTC2:
- if (screen->is_format_supported(screen, PIPE_FORMAT_RGTC2_SNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_RGTC2_SNORM;
- return PIPE_FORMAT_NONE;
-
- case GL_COMPRESSED_LUMINANCE:
- case GL_COMPRESSED_LUMINANCE_LATC1_EXT:
- if (screen->is_format_supported(screen, PIPE_FORMAT_LATC1_UNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_LATC1_UNORM;
- if (screen->is_format_supported(screen, PIPE_FORMAT_L8_UNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_L8_UNORM;
- return PIPE_FORMAT_NONE;
-
- case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT:
- if (screen->is_format_supported(screen, PIPE_FORMAT_LATC1_SNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_LATC1_SNORM;
- return PIPE_FORMAT_NONE;
-
- case GL_COMPRESSED_LUMINANCE_ALPHA:
- case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
- case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI:
- if (screen->is_format_supported(screen, PIPE_FORMAT_LATC2_UNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_LATC2_UNORM;
- if (screen->is_format_supported(screen, PIPE_FORMAT_L8A8_UNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_L8A8_UNORM;
- return PIPE_FORMAT_NONE;
-
- case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT:
- if (screen->is_format_supported(screen, PIPE_FORMAT_LATC2_SNORM, target,
- sample_count, bindings))
- return PIPE_FORMAT_LATC2_SNORM;
- return PIPE_FORMAT_NONE;
-
- /* signed/unsigned integer formats.
- * XXX Mesa only has formats for RGBA signed/unsigned integer formats.
- * If/when new formats are added this code should be updated.
- */
- case GL_RED_INTEGER_EXT:
- case GL_GREEN_INTEGER_EXT:
- case GL_BLUE_INTEGER_EXT:
- case GL_ALPHA_INTEGER_EXT:
- case GL_RGB_INTEGER_EXT:
- case GL_RGBA_INTEGER_EXT:
- case GL_BGR_INTEGER_EXT:
- case GL_BGRA_INTEGER_EXT:
- case GL_LUMINANCE_INTEGER_EXT:
- case GL_LUMINANCE_ALPHA_INTEGER_EXT:
- /* fall-through */
- case GL_RGBA8I_EXT:
- case GL_RGB8I_EXT:
- case GL_ALPHA8I_EXT:
- case GL_INTENSITY8I_EXT:
- case GL_LUMINANCE8I_EXT:
- case GL_LUMINANCE_ALPHA8I_EXT:
- if (screen->is_format_supported(screen, PIPE_FORMAT_R8G8B8A8_SSCALED,
- target,
- sample_count, bindings))
- return PIPE_FORMAT_R8G8B8A8_SSCALED;
- return PIPE_FORMAT_NONE;
- case GL_RGBA16I_EXT:
- case GL_RGB16I_EXT:
- case GL_ALPHA16I_EXT:
- case GL_INTENSITY16I_EXT:
- case GL_LUMINANCE16I_EXT:
- case GL_LUMINANCE_ALPHA16I_EXT:
- if (screen->is_format_supported(screen, PIPE_FORMAT_R16G16B16A16_SSCALED,
- target,
- sample_count, bindings))
- return PIPE_FORMAT_R16G16B16A16_SSCALED;
- return PIPE_FORMAT_NONE;
- case GL_RGBA32I_EXT:
- case GL_RGB32I_EXT:
- case GL_ALPHA32I_EXT:
- case GL_INTENSITY32I_EXT:
- case GL_LUMINANCE32I_EXT:
- case GL_LUMINANCE_ALPHA32I_EXT:
- /* xxx */
- if (screen->is_format_supported(screen, PIPE_FORMAT_R32G32B32A32_SSCALED,
- target,
- sample_count, bindings))
- return PIPE_FORMAT_R32G32B32A32_SSCALED;
- return PIPE_FORMAT_NONE;
-
- case GL_RGBA8UI_EXT:
- case GL_RGB8UI_EXT:
- case GL_ALPHA8UI_EXT:
- case GL_INTENSITY8UI_EXT:
- case GL_LUMINANCE8UI_EXT:
- case GL_LUMINANCE_ALPHA8UI_EXT:
- if (screen->is_format_supported(screen, PIPE_FORMAT_R8G8B8A8_USCALED,
- target,
- sample_count, bindings))
- return PIPE_FORMAT_R8G8B8A8_USCALED;
- return PIPE_FORMAT_NONE;
-
- case GL_RGBA16UI_EXT:
- case GL_RGB16UI_EXT:
- case GL_ALPHA16UI_EXT:
- case GL_INTENSITY16UI_EXT:
- case GL_LUMINANCE16UI_EXT:
- case GL_LUMINANCE_ALPHA16UI_EXT:
- if (screen->is_format_supported(screen, PIPE_FORMAT_R16G16B16A16_USCALED,
- target,
- sample_count, bindings))
- return PIPE_FORMAT_R16G16B16A16_USCALED;
- return PIPE_FORMAT_NONE;
-
- case GL_RGBA32UI_EXT:
- case GL_RGB32UI_EXT:
- case GL_ALPHA32UI_EXT:
- case GL_INTENSITY32UI_EXT:
- case GL_LUMINANCE32UI_EXT:
- case GL_LUMINANCE_ALPHA32UI_EXT:
- if (screen->is_format_supported(screen, PIPE_FORMAT_R32G32B32A32_USCALED,
- target,
- sample_count, bindings))
- return PIPE_FORMAT_R32G32B32A32_USCALED;
- return PIPE_FORMAT_NONE;
-
- /* signed normalized formats */
- case GL_RED_SNORM:
- case GL_R8_SNORM:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_R8_SNORM,
- PIPE_FORMAT_R8G8_SNORM,
- PIPE_FORMAT_R8G8B8A8_SNORM,
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
-
- case GL_R16_SNORM:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_R16_SNORM,
- PIPE_FORMAT_R16G16_SNORM,
- PIPE_FORMAT_R16G16B16A16_SNORM,
- PIPE_FORMAT_R8_SNORM,
- PIPE_FORMAT_R8G8_SNORM,
- PIPE_FORMAT_R8G8B8A8_SNORM,
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
-
- case GL_RG_SNORM:
- case GL_RG8_SNORM:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_R8G8_SNORM,
- PIPE_FORMAT_R8G8B8A8_SNORM,
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
-
- case GL_RG16_SNORM:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_R16G16_SNORM,
- PIPE_FORMAT_R16G16B16A16_SNORM,
- PIPE_FORMAT_R8G8_SNORM,
- PIPE_FORMAT_R8G8B8A8_SNORM,
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
-
- case GL_RGB_SNORM:
- case GL_RGB8_SNORM:
- case GL_RGBA_SNORM:
- case GL_RGBA8_SNORM:
- if (screen->is_format_supported(screen, PIPE_FORMAT_R8G8B8A8_SNORM,
- target,
- sample_count, bindings))
- return PIPE_FORMAT_R8G8B8A8_SNORM;
- return PIPE_FORMAT_NONE;
-
- case GL_RGB16_SNORM:
- case GL_RGBA16_SNORM:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_R16G16B16A16_SNORM,
- PIPE_FORMAT_R8G8B8A8_SNORM,
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
-
-
- case GL_ALPHA_SNORM:
- case GL_ALPHA8_SNORM:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_A8_SNORM,
- PIPE_FORMAT_R8G8B8A8_SNORM,
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
-
- case GL_ALPHA16_SNORM:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_A16_SNORM,
- PIPE_FORMAT_R16G16B16A16_SNORM,
- PIPE_FORMAT_A8_SNORM,
- PIPE_FORMAT_R8G8B8A8_SNORM,
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
-
- case GL_LUMINANCE_SNORM:
- case GL_LUMINANCE8_SNORM:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_L8_SNORM,
- PIPE_FORMAT_R8G8B8A8_SNORM,
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
-
- case GL_LUMINANCE16_SNORM:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_L16_SNORM,
- PIPE_FORMAT_R16G16B16A16_SNORM,
- PIPE_FORMAT_L8_SNORM,
- PIPE_FORMAT_R8G8B8A8_SNORM,
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
-
- case GL_LUMINANCE_ALPHA_SNORM:
- case GL_LUMINANCE8_ALPHA8_SNORM:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_L8A8_SNORM,
- PIPE_FORMAT_R8G8B8A8_SNORM,
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
-
- case GL_LUMINANCE16_ALPHA16_SNORM:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_L16A16_SNORM,
- PIPE_FORMAT_R16G16B16A16_SNORM,
- PIPE_FORMAT_L8A8_SNORM,
- PIPE_FORMAT_R8G8B8A8_SNORM,
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
-
- case GL_INTENSITY_SNORM:
- case GL_INTENSITY8_SNORM:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_I8_SNORM,
- PIPE_FORMAT_R8G8B8A8_SNORM,
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
-
- case GL_INTENSITY16_SNORM:
- {
- static const enum pipe_format formats[] = {
- PIPE_FORMAT_I16_SNORM,
- PIPE_FORMAT_R16G16B16A16_SNORM,
- PIPE_FORMAT_I8_SNORM,
- PIPE_FORMAT_R8G8B8A8_SNORM,
- };
- return find_supported_format(screen, formats, Elements(formats),
- target, sample_count, bindings);
- }
-
- case GL_RGB9_E5:
- if (screen->is_format_supported(screen, PIPE_FORMAT_R9G9B9E5_FLOAT, target,
- sample_count, bindings)) {
- return PIPE_FORMAT_R9G9B9E5_FLOAT;
- }
+ /* can't render to compressed formats at this time */
+ if (_mesa_is_compressed_format(ctx, internalFormat)
+ && (bindings & ~PIPE_BIND_SAMPLER_VIEW)) {
return PIPE_FORMAT_NONE;
+ }
- case GL_R11F_G11F_B10F:
- if (screen->is_format_supported(screen, PIPE_FORMAT_R11G11B10_FLOAT, target,
- sample_count, bindings)) {
- return PIPE_FORMAT_R11G11B10_FLOAT;
+ /* search table for internalFormat */
+ for (i = 0; i < Elements(format_map); i++) {
+ const struct format_mapping *mapping = &format_map[i];
+ for (j = 0; mapping->glFormats[j]; j++) {
+ if (mapping->glFormats[j] == internalFormat) {
+ /* Found the desired internal format. Find first pipe format
+ * which is supported by the driver.
+ */
+ return find_supported_format(screen, mapping->pipeFormats,
+ target, sample_count, bindings);
+ }
}
- return PIPE_FORMAT_NONE;
-
- default:
- return PIPE_FORMAT_NONE;
}
+
+ _mesa_problem(NULL, "unhandled format!\n");
+ return PIPE_FORMAT_NONE;
}
diff --git a/pixman/pixman/pixman-combine.c.template b/pixman/pixman/pixman-combine.c.template
index f5dd8e120..8c1dd647d 100644
--- a/pixman/pixman/pixman-combine.c.template
+++ b/pixman/pixman/pixman-combine.c.template
@@ -1,2461 +1,2460 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <math.h>
-#include <string.h>
-
-#include "pixman-private.h"
-
-#include "pixman-combine.h"
-
-/*** per channel helper functions ***/
-
-static void
-combine_mask_ca (comp4_t *src, comp4_t *mask)
-{
- comp4_t a = *mask;
-
- comp4_t x;
- comp2_t xa;
-
- if (!a)
- {
- *(src) = 0;
- return;
- }
-
- x = *(src);
- if (a == ~0)
- {
- x = x >> A_SHIFT;
- x |= x << G_SHIFT;
- x |= x << R_SHIFT;
- *(mask) = x;
- return;
- }
-
- xa = x >> A_SHIFT;
- UNcx4_MUL_UNcx4 (x, a);
- *(src) = x;
-
- UNcx4_MUL_UNc (a, xa);
- *(mask) = a;
-}
-
-static void
-combine_mask_value_ca (comp4_t *src, const comp4_t *mask)
-{
- comp4_t a = *mask;
- comp4_t x;
-
- if (!a)
- {
- *(src) = 0;
- return;
- }
-
- if (a == ~0)
- return;
-
- x = *(src);
- UNcx4_MUL_UNcx4 (x, a);
- *(src) = x;
-}
-
-static void
-combine_mask_alpha_ca (const comp4_t *src, comp4_t *mask)
-{
- comp4_t a = *(mask);
- comp4_t x;
-
- if (!a)
- return;
-
- x = *(src) >> A_SHIFT;
- if (x == MASK)
- return;
-
- if (a == ~0)
- {
- x |= x << G_SHIFT;
- x |= x << R_SHIFT;
- *(mask) = x;
- return;
- }
-
- UNcx4_MUL_UNc (a, x);
- *(mask) = a;
-}
-
-/*
- * There are two ways of handling alpha -- either as a single unified value or
- * a separate value for each component, hence each macro must have two
- * versions. The unified alpha version has a 'U' at the end of the name,
- * the component version has a 'C'. Similarly, functions which deal with
- * this difference will have two versions using the same convention.
- */
-
-/*
- * All of the composing functions
- */
-
-static force_inline comp4_t
-combine_mask (const comp4_t *src, const comp4_t *mask, int i)
-{
- comp4_t s, m;
-
- if (mask)
- {
- m = *(mask + i) >> A_SHIFT;
-
- if (!m)
- return 0;
- }
-
- s = *(src + i);
-
- if (mask)
- UNcx4_MUL_UNc (s, m);
-
- return s;
-}
-
-static void
-combine_clear (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- memset (dest, 0, width * sizeof(comp4_t));
-}
-
-static void
-combine_dst (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- return;
-}
-
-static void
-combine_src_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- int i;
-
- if (!mask)
- memcpy (dest, src, width * sizeof (comp4_t));
- else
- {
- for (i = 0; i < width; ++i)
- {
- comp4_t s = combine_mask (src, mask, i);
-
- *(dest + i) = s;
- }
- }
-}
-
-/* if the Src is opaque, call combine_src_u */
-static void
-combine_over_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t s = combine_mask (src, mask, i);
- comp4_t d = *(dest + i);
- comp4_t ia = ALPHA_c (~s);
-
- UNcx4_MUL_UNc_ADD_UNcx4 (d, ia, s);
- *(dest + i) = d;
- }
-}
-
-/* if the Dst is opaque, this is a noop */
-static void
-combine_over_reverse_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t s = combine_mask (src, mask, i);
- comp4_t d = *(dest + i);
- comp4_t ia = ALPHA_c (~*(dest + i));
- UNcx4_MUL_UNc_ADD_UNcx4 (s, ia, d);
- *(dest + i) = s;
- }
-}
-
-/* if the Dst is opaque, call combine_src_u */
-static void
-combine_in_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t s = combine_mask (src, mask, i);
- comp4_t a = ALPHA_c (*(dest + i));
- UNcx4_MUL_UNc (s, a);
- *(dest + i) = s;
- }
-}
-
-/* if the Src is opaque, this is a noop */
-static void
-combine_in_reverse_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t s = combine_mask (src, mask, i);
- comp4_t d = *(dest + i);
- comp4_t a = ALPHA_c (s);
- UNcx4_MUL_UNc (d, a);
- *(dest + i) = d;
- }
-}
-
-/* if the Dst is opaque, call combine_clear */
-static void
-combine_out_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t s = combine_mask (src, mask, i);
- comp4_t a = ALPHA_c (~*(dest + i));
- UNcx4_MUL_UNc (s, a);
- *(dest + i) = s;
- }
-}
-
-/* if the Src is opaque, call combine_clear */
-static void
-combine_out_reverse_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t s = combine_mask (src, mask, i);
- comp4_t d = *(dest + i);
- comp4_t a = ALPHA_c (~s);
- UNcx4_MUL_UNc (d, a);
- *(dest + i) = d;
- }
-}
-
-/* if the Src is opaque, call combine_in_u */
-/* if the Dst is opaque, call combine_over_u */
-/* if both the Src and Dst are opaque, call combine_src_u */
-static void
-combine_atop_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t s = combine_mask (src, mask, i);
- comp4_t d = *(dest + i);
- comp4_t dest_a = ALPHA_c (d);
- comp4_t src_ia = ALPHA_c (~s);
-
- UNcx4_MUL_UNc_ADD_UNcx4_MUL_UNc (s, dest_a, d, src_ia);
- *(dest + i) = s;
- }
-}
-
-/* if the Src is opaque, call combine_over_reverse_u */
-/* if the Dst is opaque, call combine_in_reverse_u */
-/* if both the Src and Dst are opaque, call combine_dst_u */
-static void
-combine_atop_reverse_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t s = combine_mask (src, mask, i);
- comp4_t d = *(dest + i);
- comp4_t src_a = ALPHA_c (s);
- comp4_t dest_ia = ALPHA_c (~d);
-
- UNcx4_MUL_UNc_ADD_UNcx4_MUL_UNc (s, dest_ia, d, src_a);
- *(dest + i) = s;
- }
-}
-
-/* if the Src is opaque, call combine_over_u */
-/* if the Dst is opaque, call combine_over_reverse_u */
-/* if both the Src and Dst are opaque, call combine_clear */
-static void
-combine_xor_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t s = combine_mask (src, mask, i);
- comp4_t d = *(dest + i);
- comp4_t src_ia = ALPHA_c (~s);
- comp4_t dest_ia = ALPHA_c (~d);
-
- UNcx4_MUL_UNc_ADD_UNcx4_MUL_UNc (s, dest_ia, d, src_ia);
- *(dest + i) = s;
- }
-}
-
-static void
-combine_add_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t s = combine_mask (src, mask, i);
- comp4_t d = *(dest + i);
- UNcx4_ADD_UNcx4 (d, s);
- *(dest + i) = d;
- }
-}
-
-/* if the Src is opaque, call combine_add_u */
-/* if the Dst is opaque, call combine_add_u */
-/* if both the Src and Dst are opaque, call combine_add_u */
-static void
-combine_saturate_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t s = combine_mask (src, mask, i);
- comp4_t d = *(dest + i);
- comp2_t sa, da;
-
- sa = s >> A_SHIFT;
- da = ~d >> A_SHIFT;
- if (sa > da)
- {
- sa = DIV_UNc (da, sa);
- UNcx4_MUL_UNc (s, sa);
- }
- ;
- UNcx4_ADD_UNcx4 (d, s);
- *(dest + i) = d;
- }
-}
-
-/*
- * PDF blend modes:
- * The following blend modes have been taken from the PDF ISO 32000
- * specification, which at this point in time is available from
- * http://www.adobe.com/devnet/acrobat/pdfs/PDF32000_2008.pdf
- * The relevant chapters are 11.3.5 and 11.3.6.
- * The formula for computing the final pixel color given in 11.3.6 is:
- * αr × Cr = (1 – αs) × αb × Cb + (1 – αb) × αs × Cs + αb × αs × B(Cb, Cs)
- * with B() being the blend function.
- * Note that OVER is a special case of this operation, using B(Cb, Cs) = Cs
- *
- * These blend modes should match the SVG filter draft specification, as
- * it has been designed to mirror ISO 32000. Note that at the current point
- * no released draft exists that shows this, as the formulas have not been
- * updated yet after the release of ISO 32000.
- *
- * The default implementation here uses the PDF_SEPARABLE_BLEND_MODE and
- * PDF_NON_SEPARABLE_BLEND_MODE macros, which take the blend function as an
- * argument. Note that this implementation operates on premultiplied colors,
- * while the PDF specification does not. Therefore the code uses the formula
- * ar.Cra = (1 – as) . Dca + (1 – ad) . Sca + B(Dca, ad, Sca, as)
- */
-
-/*
- * Multiply
- * B(Dca, ad, Sca, as) = Dca.Sca
- */
-
-static void
-combine_multiply_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t s = combine_mask (src, mask, i);
- comp4_t d = *(dest + i);
- comp4_t ss = s;
- comp4_t src_ia = ALPHA_c (~s);
- comp4_t dest_ia = ALPHA_c (~d);
-
- UNcx4_MUL_UNc_ADD_UNcx4_MUL_UNc (ss, dest_ia, d, src_ia);
- UNcx4_MUL_UNcx4 (d, s);
- UNcx4_ADD_UNcx4 (d, ss);
-
- *(dest + i) = d;
- }
-}
-
-static void
-combine_multiply_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t m = *(mask + i);
- comp4_t s = *(src + i);
- comp4_t d = *(dest + i);
- comp4_t r = d;
- comp4_t dest_ia = ALPHA_c (~d);
-
- combine_mask_value_ca (&s, &m);
-
- UNcx4_MUL_UNcx4_ADD_UNcx4_MUL_UNc (r, ~m, s, dest_ia);
- UNcx4_MUL_UNcx4 (d, s);
- UNcx4_ADD_UNcx4 (r, d);
-
- *(dest + i) = r;
- }
-}
-
-#define PDF_SEPARABLE_BLEND_MODE(name) \
- static void \
- combine_ ## name ## _u (pixman_implementation_t *imp, \
- pixman_op_t op, \
- comp4_t * dest, \
- const comp4_t * src, \
- const comp4_t * mask, \
- int width) \
- { \
- int i; \
- for (i = 0; i < width; ++i) { \
- comp4_t s = combine_mask (src, mask, i); \
- comp4_t d = *(dest + i); \
- comp1_t sa = ALPHA_c (s); \
- comp1_t isa = ~sa; \
- comp1_t da = ALPHA_c (d); \
- comp1_t ida = ~da; \
- comp4_t result; \
- \
- result = d; \
- UNcx4_MUL_UNc_ADD_UNcx4_MUL_UNc (result, isa, s, ida); \
- \
- *(dest + i) = result + \
- (DIV_ONE_UNc (sa * da) << A_SHIFT) + \
- (blend_ ## name (RED_c (d), da, RED_c (s), sa) << R_SHIFT) + \
- (blend_ ## name (GREEN_c (d), da, GREEN_c (s), sa) << G_SHIFT) + \
- (blend_ ## name (BLUE_c (d), da, BLUE_c (s), sa)); \
- } \
- } \
- \
- static void \
- combine_ ## name ## _ca (pixman_implementation_t *imp, \
- pixman_op_t op, \
- comp4_t * dest, \
- const comp4_t * src, \
- const comp4_t * mask, \
- int width) \
- { \
- int i; \
- for (i = 0; i < width; ++i) { \
- comp4_t m = *(mask + i); \
- comp4_t s = *(src + i); \
- comp4_t d = *(dest + i); \
- comp1_t da = ALPHA_c (d); \
- comp1_t ida = ~da; \
- comp4_t result; \
- \
- combine_mask_value_ca (&s, &m); \
- \
- result = d; \
- UNcx4_MUL_UNcx4_ADD_UNcx4_MUL_UNc (result, ~m, s, ida); \
- \
- result += \
- (DIV_ONE_UNc (ALPHA_c (m) * da) << A_SHIFT) + \
- (blend_ ## name (RED_c (d), da, RED_c (s), RED_c (m)) << R_SHIFT) + \
- (blend_ ## name (GREEN_c (d), da, GREEN_c (s), GREEN_c (m)) << G_SHIFT) + \
- (blend_ ## name (BLUE_c (d), da, BLUE_c (s), BLUE_c (m))); \
- \
- *(dest + i) = result; \
- } \
- }
-
-/*
- * Screen
- * B(Dca, ad, Sca, as) = Dca.sa + Sca.da - Dca.Sca
- */
-static inline comp4_t
-blend_screen (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
-{
- return DIV_ONE_UNc (sca * da + dca * sa - sca * dca);
-}
-
-PDF_SEPARABLE_BLEND_MODE (screen)
-
-/*
- * Overlay
- * B(Dca, Da, Sca, Sa) =
- * if 2.Dca < Da
- * 2.Sca.Dca
- * otherwise
- * Sa.Da - 2.(Da - Dca).(Sa - Sca)
- */
-static inline comp4_t
-blend_overlay (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
-{
- comp4_t rca;
-
- if (2 * dca < da)
- rca = 2 * sca * dca;
- else
- rca = sa * da - 2 * (da - dca) * (sa - sca);
- return DIV_ONE_UNc (rca);
-}
-
-PDF_SEPARABLE_BLEND_MODE (overlay)
-
-/*
- * Darken
- * B(Dca, Da, Sca, Sa) = min (Sca.Da, Dca.Sa)
- */
-static inline comp4_t
-blend_darken (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
-{
- comp4_t s, d;
-
- s = sca * da;
- d = dca * sa;
- return DIV_ONE_UNc (s > d ? d : s);
-}
-
-PDF_SEPARABLE_BLEND_MODE (darken)
-
-/*
- * Lighten
- * B(Dca, Da, Sca, Sa) = max (Sca.Da, Dca.Sa)
- */
-static inline comp4_t
-blend_lighten (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
-{
- comp4_t s, d;
-
- s = sca * da;
- d = dca * sa;
- return DIV_ONE_UNc (s > d ? s : d);
-}
-
-PDF_SEPARABLE_BLEND_MODE (lighten)
-
-/*
- * Color dodge
- * B(Dca, Da, Sca, Sa) =
- * if Dca == 0
- * 0
- * if Sca == Sa
- * Sa.Da
- * otherwise
- * Sa.Da. min (1, Dca / Da / (1 - Sca/Sa))
- */
-static inline comp4_t
-blend_color_dodge (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
-{
- if (sca >= sa)
- {
- return dca == 0 ? 0 : DIV_ONE_UNc (sa * da);
- }
- else
- {
- comp4_t rca = dca * sa / (sa - sca);
- return DIV_ONE_UNc (sa * MIN (rca, da));
- }
-}
-
-PDF_SEPARABLE_BLEND_MODE (color_dodge)
-
-/*
- * Color burn
- * B(Dca, Da, Sca, Sa) =
- * if Dca == Da
- * Sa.Da
- * if Sca == 0
- * 0
- * otherwise
- * Sa.Da.(1 - min (1, (1 - Dca/Da).Sa / Sca))
- */
-static inline comp4_t
-blend_color_burn (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
-{
- if (sca == 0)
- {
- return dca < da ? 0 : DIV_ONE_UNc (sa * da);
- }
- else
- {
- comp4_t rca = (da - dca) * sa / sca;
- return DIV_ONE_UNc (sa * (MAX (rca, da) - rca));
- }
-}
-
-PDF_SEPARABLE_BLEND_MODE (color_burn)
-
-/*
- * Hard light
- * B(Dca, Da, Sca, Sa) =
- * if 2.Sca < Sa
- * 2.Sca.Dca
- * otherwise
- * Sa.Da - 2.(Da - Dca).(Sa - Sca)
- */
-static inline comp4_t
-blend_hard_light (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
-{
- if (2 * sca < sa)
- return DIV_ONE_UNc (2 * sca * dca);
- else
- return DIV_ONE_UNc (sa * da - 2 * (da - dca) * (sa - sca));
-}
-
-PDF_SEPARABLE_BLEND_MODE (hard_light)
-
-/*
- * Soft light
- * B(Dca, Da, Sca, Sa) =
- * if (2.Sca <= Sa)
- * Dca.(Sa - (1 - Dca/Da).(2.Sca - Sa))
- * otherwise if Dca.4 <= Da
- * Dca.(Sa + (2.Sca - Sa).((16.Dca/Da - 12).Dca/Da + 3)
- * otherwise
- * (Dca.Sa + (SQRT (Dca/Da).Da - Dca).(2.Sca - Sa))
- */
-static inline comp4_t
-blend_soft_light (comp4_t dca_org,
- comp4_t da_org,
- comp4_t sca_org,
- comp4_t sa_org)
-{
- double dca = dca_org * (1.0 / MASK);
- double da = da_org * (1.0 / MASK);
- double sca = sca_org * (1.0 / MASK);
- double sa = sa_org * (1.0 / MASK);
- double rca;
-
- if (2 * sca < sa)
- {
- if (da == 0)
- rca = dca * sa;
- else
- rca = dca * sa - dca * (da - dca) * (sa - 2 * sca) / da;
- }
- else if (da == 0)
- {
- rca = 0;
- }
- else if (4 * dca <= da)
- {
- rca = dca * sa +
- (2 * sca - sa) * dca * ((16 * dca / da - 12) * dca / da + 3);
- }
- else
- {
- rca = dca * sa + (sqrt (dca * da) - dca) * (2 * sca - sa);
- }
- return rca * MASK + 0.5;
-}
-
-PDF_SEPARABLE_BLEND_MODE (soft_light)
-
-/*
- * Difference
- * B(Dca, Da, Sca, Sa) = abs (Dca.Sa - Sca.Da)
- */
-static inline comp4_t
-blend_difference (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
-{
- comp4_t dcasa = dca * sa;
- comp4_t scada = sca * da;
-
- if (scada < dcasa)
- return DIV_ONE_UNc (dcasa - scada);
- else
- return DIV_ONE_UNc (scada - dcasa);
-}
-
-PDF_SEPARABLE_BLEND_MODE (difference)
-
-/*
- * Exclusion
- * B(Dca, Da, Sca, Sa) = (Sca.Da + Dca.Sa - 2.Sca.Dca)
- */
-
-/* This can be made faster by writing it directly and not using
- * PDF_SEPARABLE_BLEND_MODE, but that's a performance optimization */
-
-static inline comp4_t
-blend_exclusion (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
-{
- return DIV_ONE_UNc (sca * da + dca * sa - 2 * dca * sca);
-}
-
-PDF_SEPARABLE_BLEND_MODE (exclusion)
-
-#undef PDF_SEPARABLE_BLEND_MODE
-
-/*
- * PDF nonseperable blend modes are implemented using the following functions
- * to operate in Hsl space, with Cmax, Cmid, Cmin referring to the max, mid
- * and min value of the red, green and blue components.
- *
- * LUM (C) = 0.3 × Cred + 0.59 × Cgreen + 0.11 × Cblue
- *
- * clip_color (C):
- * l = LUM (C)
- * min = Cmin
- * max = Cmax
- * if n < 0.0
- * C = l + ( ( ( C – l ) × l ) ⁄ ( l – min ) )
- * if x > 1.0
- * C = l + ( ( ( C – l ) × ( 1 – l ) ) ⁄ ( max – l ) )
- * return C
- *
- * set_lum (C, l):
- * d = l – LUM (C)
- * C += d
- * return clip_color (C)
- *
- * SAT (C) = CH_MAX (C) - CH_MIN (C)
- *
- * set_sat (C, s):
- * if Cmax > Cmin
- * Cmid = ( ( ( Cmid – Cmin ) × s ) ⁄ ( Cmax – Cmin ) )
- * Cmax = s
- * else
- * Cmid = Cmax = 0.0
- * Cmin = 0.0
- * return C
- */
-
-/* For premultiplied colors, we need to know what happens when C is
- * multiplied by a real number. LUM and SAT are linear:
- *
- * LUM (r × C) = r × LUM (C) SAT (r * C) = r * SAT (C)
- *
- * If we extend clip_color with an extra argument a and change
- *
- * if x >= 1.0
- *
- * into
- *
- * if x >= a
- *
- * then clip_color is also linear:
- *
- * r * clip_color (C, a) = clip_color (r_c, ra);
- *
- * for positive r.
- *
- * Similarly, we can extend set_lum with an extra argument that is just passed
- * on to clip_color:
- *
- * r * set_lum ( C, l, a)
- *
- * = r × clip_color ( C + l - LUM (C), a)
- *
- * = clip_color ( r * C + r × l - r * LUM (C), r * a)
- *
- * = set_lum ( r * C, r * l, r * a)
- *
- * Finally, set_sat:
- *
- * r * set_sat (C, s) = set_sat (x * C, r * s)
- *
- * The above holds for all non-zero x, because they x'es in the fraction for
- * C_mid cancel out. Specifically, it holds for x = r:
- *
- * r * set_sat (C, s) = set_sat (r_c, rs)
- *
- */
-
-/* So, for the non-separable PDF blend modes, we have (using s, d for
- * non-premultiplied colors, and S, D for premultiplied:
- *
- * Color:
- *
- * a_s * a_d * B(s, d)
- * = a_s * a_d * set_lum (S/a_s, LUM (D/a_d), 1)
- * = set_lum (S * a_d, a_s * LUM (D), a_s * a_d)
- *
- *
- * Luminosity:
- *
- * a_s * a_d * B(s, d)
- * = a_s * a_d * set_lum (D/a_d, LUM(S/a_s), 1)
- * = set_lum (a_s * D, a_d * LUM(S), a_s * a_d)
- *
- *
- * Saturation:
- *
- * a_s * a_d * B(s, d)
- * = a_s * a_d * set_lum (set_sat (D/a_d, SAT (S/a_s)), LUM (D/a_d), 1)
- * = set_lum (a_s * a_d * set_sat (D/a_d, SAT (S/a_s)),
- * a_s * LUM (D), a_s * a_d)
- * = set_lum (set_sat (a_s * D, a_d * SAT (S), a_s * LUM (D), a_s * a_d))
- *
- * Hue:
- *
- * a_s * a_d * B(s, d)
- * = a_s * a_d * set_lum (set_sat (S/a_s, SAT (D/a_d)), LUM (D/a_d), 1)
- * = a_s * a_d * set_lum (set_sat (a_d * S, a_s * SAT (D)),
- * a_s * LUM (D), a_s * a_d)
- *
- */
-
-#define CH_MIN(c) (c[0] < c[1] ? (c[0] < c[2] ? c[0] : c[2]) : (c[1] < c[2] ? c[1] : c[2]))
-#define CH_MAX(c) (c[0] > c[1] ? (c[0] > c[2] ? c[0] : c[2]) : (c[1] > c[2] ? c[1] : c[2]))
-#define LUM(c) ((c[0] * 30 + c[1] * 59 + c[2] * 11) / 100)
-#define SAT(c) (CH_MAX (c) - CH_MIN (c))
-
-#define PDF_NON_SEPARABLE_BLEND_MODE(name) \
- static void \
- combine_ ## name ## _u (pixman_implementation_t *imp, \
- pixman_op_t op, \
- comp4_t *dest, \
- const comp4_t *src, \
- const comp4_t *mask, \
- int width) \
- { \
- int i; \
- for (i = 0; i < width; ++i) \
- { \
- comp4_t s = combine_mask (src, mask, i); \
- comp4_t d = *(dest + i); \
- comp1_t sa = ALPHA_c (s); \
- comp1_t isa = ~sa; \
- comp1_t da = ALPHA_c (d); \
- comp1_t ida = ~da; \
- comp4_t result; \
- comp4_t sc[3], dc[3], c[3]; \
- \
- result = d; \
- UNcx4_MUL_UNc_ADD_UNcx4_MUL_UNc (result, isa, s, ida); \
- dc[0] = RED_c (d); \
- sc[0] = RED_c (s); \
- dc[1] = GREEN_c (d); \
- sc[1] = GREEN_c (s); \
- dc[2] = BLUE_c (d); \
- sc[2] = BLUE_c (s); \
- blend_ ## name (c, dc, da, sc, sa); \
- \
- *(dest + i) = result + \
- (DIV_ONE_UNc (sa * da) << A_SHIFT) + \
- (DIV_ONE_UNc (c[0]) << R_SHIFT) + \
- (DIV_ONE_UNc (c[1]) << G_SHIFT) + \
- (DIV_ONE_UNc (c[2])); \
- } \
- }
-
-static void
-set_lum (comp4_t dest[3], comp4_t src[3], comp4_t sa, comp4_t lum)
-{
- double a, l, min, max;
- double tmp[3];
-
- a = sa * (1.0 / MASK);
-
- l = lum * (1.0 / MASK);
- tmp[0] = src[0] * (1.0 / MASK);
- tmp[1] = src[1] * (1.0 / MASK);
- tmp[2] = src[2] * (1.0 / MASK);
-
- l = l - LUM (tmp);
- tmp[0] += l;
- tmp[1] += l;
- tmp[2] += l;
-
- /* clip_color */
- l = LUM (tmp);
- min = CH_MIN (tmp);
- max = CH_MAX (tmp);
-
- if (min < 0)
- {
- if (l - min == 0.0)
- {
- tmp[0] = 0;
- tmp[1] = 0;
- tmp[2] = 0;
- }
- else
- {
- tmp[0] = l + (tmp[0] - l) * l / (l - min);
- tmp[1] = l + (tmp[1] - l) * l / (l - min);
- tmp[2] = l + (tmp[2] - l) * l / (l - min);
- }
- }
- if (max > a)
- {
- if (max - l == 0.0)
- {
- tmp[0] = a;
- tmp[1] = a;
- tmp[2] = a;
- }
- else
- {
- tmp[0] = l + (tmp[0] - l) * (a - l) / (max - l);
- tmp[1] = l + (tmp[1] - l) * (a - l) / (max - l);
- tmp[2] = l + (tmp[2] - l) * (a - l) / (max - l);
- }
- }
-
- dest[0] = tmp[0] * MASK + 0.5;
- dest[1] = tmp[1] * MASK + 0.5;
- dest[2] = tmp[2] * MASK + 0.5;
-}
-
-static void
-set_sat (comp4_t dest[3], comp4_t src[3], comp4_t sat)
-{
- int id[3];
- comp4_t min, max;
-
- if (src[0] > src[1])
- {
- if (src[0] > src[2])
- {
- id[0] = 0;
- if (src[1] > src[2])
- {
- id[1] = 1;
- id[2] = 2;
- }
- else
- {
- id[1] = 2;
- id[2] = 1;
- }
- }
- else
- {
- id[0] = 2;
- id[1] = 0;
- id[2] = 1;
- }
- }
- else
- {
- if (src[0] > src[2])
- {
- id[0] = 1;
- id[1] = 0;
- id[2] = 2;
- }
- else
- {
- id[2] = 0;
- if (src[1] > src[2])
- {
- id[0] = 1;
- id[1] = 2;
- }
- else
- {
- id[0] = 2;
- id[1] = 1;
- }
- }
- }
-
- max = dest[id[0]];
- min = dest[id[2]];
- if (max > min)
- {
- dest[id[1]] = (dest[id[1]] - min) * sat / (max - min);
- dest[id[0]] = sat;
- dest[id[2]] = 0;
- }
- else
- {
- dest[0] = dest[1] = dest[2] = 0;
- }
-}
-
-/*
- * Hue:
- * B(Cb, Cs) = set_lum (set_sat (Cs, SAT (Cb)), LUM (Cb))
- */
-static inline void
-blend_hsl_hue (comp4_t c[3],
- comp4_t dc[3],
- comp4_t da,
- comp4_t sc[3],
- comp4_t sa)
-{
- c[0] = sc[0] * da;
- c[1] = sc[1] * da;
- c[2] = sc[2] * da;
- set_sat (c, c, SAT (dc) * sa);
- set_lum (c, c, sa * da, LUM (dc) * sa);
-}
-
-PDF_NON_SEPARABLE_BLEND_MODE (hsl_hue)
-
-/*
- * Saturation:
- * B(Cb, Cs) = set_lum (set_sat (Cb, SAT (Cs)), LUM (Cb))
- */
-static inline void
-blend_hsl_saturation (comp4_t c[3],
- comp4_t dc[3],
- comp4_t da,
- comp4_t sc[3],
- comp4_t sa)
-{
- c[0] = dc[0] * sa;
- c[1] = dc[1] * sa;
- c[2] = dc[2] * sa;
- set_sat (c, c, SAT (sc) * da);
- set_lum (c, c, sa * da, LUM (dc) * sa);
-}
-
-PDF_NON_SEPARABLE_BLEND_MODE (hsl_saturation)
-
-/*
- * Color:
- * B(Cb, Cs) = set_lum (Cs, LUM (Cb))
- */
-static inline void
-blend_hsl_color (comp4_t c[3],
- comp4_t dc[3],
- comp4_t da,
- comp4_t sc[3],
- comp4_t sa)
-{
- c[0] = sc[0] * da;
- c[1] = sc[1] * da;
- c[2] = sc[2] * da;
- set_lum (c, c, sa * da, LUM (dc) * sa);
-}
-
-PDF_NON_SEPARABLE_BLEND_MODE (hsl_color)
-
-/*
- * Luminosity:
- * B(Cb, Cs) = set_lum (Cb, LUM (Cs))
- */
-static inline void
-blend_hsl_luminosity (comp4_t c[3],
- comp4_t dc[3],
- comp4_t da,
- comp4_t sc[3],
- comp4_t sa)
-{
- c[0] = dc[0] * sa;
- c[1] = dc[1] * sa;
- c[2] = dc[2] * sa;
- set_lum (c, c, sa * da, LUM (sc) * da);
-}
-
-PDF_NON_SEPARABLE_BLEND_MODE (hsl_luminosity)
-
-#undef SAT
-#undef LUM
-#undef CH_MAX
-#undef CH_MIN
-#undef PDF_NON_SEPARABLE_BLEND_MODE
-
-/* Overlay
- *
- * All of the disjoint composing functions
- *
- * The four entries in the first column indicate what source contributions
- * come from each of the four areas of the picture -- areas covered by neither
- * A nor B, areas covered only by A, areas covered only by B and finally
- * areas covered by both A and B.
- *
- * Disjoint Conjoint
- * Fa Fb Fa Fb
- * (0,0,0,0) 0 0 0 0
- * (0,A,0,A) 1 0 1 0
- * (0,0,B,B) 0 1 0 1
- * (0,A,B,A) 1 min((1-a)/b,1) 1 max(1-a/b,0)
- * (0,A,B,B) min((1-b)/a,1) 1 max(1-b/a,0) 1
- * (0,0,0,A) max(1-(1-b)/a,0) 0 min(1,b/a) 0
- * (0,0,0,B) 0 max(1-(1-a)/b,0) 0 min(a/b,1)
- * (0,A,0,0) min(1,(1-b)/a) 0 max(1-b/a,0) 0
- * (0,0,B,0) 0 min(1,(1-a)/b) 0 max(1-a/b,0)
- * (0,0,B,A) max(1-(1-b)/a,0) min(1,(1-a)/b) min(1,b/a) max(1-a/b,0)
- * (0,A,0,B) min(1,(1-b)/a) max(1-(1-a)/b,0) max(1-b/a,0) min(1,a/b)
- * (0,A,B,0) min(1,(1-b)/a) min(1,(1-a)/b) max(1-b/a,0) max(1-a/b,0)
- */
-
-#define COMBINE_A_OUT 1
-#define COMBINE_A_IN 2
-#define COMBINE_B_OUT 4
-#define COMBINE_B_IN 8
-
-#define COMBINE_CLEAR 0
-#define COMBINE_A (COMBINE_A_OUT | COMBINE_A_IN)
-#define COMBINE_B (COMBINE_B_OUT | COMBINE_B_IN)
-#define COMBINE_A_OVER (COMBINE_A_OUT | COMBINE_B_OUT | COMBINE_A_IN)
-#define COMBINE_B_OVER (COMBINE_A_OUT | COMBINE_B_OUT | COMBINE_B_IN)
-#define COMBINE_A_ATOP (COMBINE_B_OUT | COMBINE_A_IN)
-#define COMBINE_B_ATOP (COMBINE_A_OUT | COMBINE_B_IN)
-#define COMBINE_XOR (COMBINE_A_OUT | COMBINE_B_OUT)
-
-/* portion covered by a but not b */
-static comp1_t
-combine_disjoint_out_part (comp1_t a, comp1_t b)
-{
- /* min (1, (1-b) / a) */
-
- b = ~b; /* 1 - b */
- if (b >= a) /* 1 - b >= a -> (1-b)/a >= 1 */
- return MASK; /* 1 */
- return DIV_UNc (b, a); /* (1-b) / a */
-}
-
-/* portion covered by both a and b */
-static comp1_t
-combine_disjoint_in_part (comp1_t a, comp1_t b)
-{
- /* max (1-(1-b)/a,0) */
- /* = - min ((1-b)/a - 1, 0) */
- /* = 1 - min (1, (1-b)/a) */
-
- b = ~b; /* 1 - b */
- if (b >= a) /* 1 - b >= a -> (1-b)/a >= 1 */
- return 0; /* 1 - 1 */
- return ~DIV_UNc(b, a); /* 1 - (1-b) / a */
-}
-
-/* portion covered by a but not b */
-static comp1_t
-combine_conjoint_out_part (comp1_t a, comp1_t b)
-{
- /* max (1-b/a,0) */
- /* = 1-min(b/a,1) */
-
- /* min (1, (1-b) / a) */
-
- if (b >= a) /* b >= a -> b/a >= 1 */
- return 0x00; /* 0 */
- return ~DIV_UNc(b, a); /* 1 - b/a */
-}
-
-/* portion covered by both a and b */
-static comp1_t
-combine_conjoint_in_part (comp1_t a, comp1_t b)
-{
- /* min (1,b/a) */
-
- if (b >= a) /* b >= a -> b/a >= 1 */
- return MASK; /* 1 */
- return DIV_UNc (b, a); /* b/a */
-}
-
-#define GET_COMP(v, i) ((comp2_t) (comp1_t) ((v) >> i))
-
-#define ADD(x, y, i, t) \
- ((t) = GET_COMP (x, i) + GET_COMP (y, i), \
- (comp4_t) ((comp1_t) ((t) | (0 - ((t) >> G_SHIFT)))) << (i))
-
-#define GENERIC(x, y, i, ax, ay, t, u, v) \
- ((t) = (MUL_UNc (GET_COMP (y, i), ay, (u)) + \
- MUL_UNc (GET_COMP (x, i), ax, (v))), \
- (comp4_t) ((comp1_t) ((t) | \
- (0 - ((t) >> G_SHIFT)))) << (i))
-
-static void
-combine_disjoint_general_u (comp4_t * dest,
- const comp4_t *src,
- const comp4_t *mask,
- int width,
- comp1_t combine)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t s = combine_mask (src, mask, i);
- comp4_t d = *(dest + i);
- comp4_t m, n, o, p;
- comp2_t Fa, Fb, t, u, v;
- comp1_t sa = s >> A_SHIFT;
- comp1_t da = d >> A_SHIFT;
-
- switch (combine & COMBINE_A)
- {
- default:
- Fa = 0;
- break;
-
- case COMBINE_A_OUT:
- Fa = combine_disjoint_out_part (sa, da);
- break;
-
- case COMBINE_A_IN:
- Fa = combine_disjoint_in_part (sa, da);
- break;
-
- case COMBINE_A:
- Fa = MASK;
- break;
- }
-
- switch (combine & COMBINE_B)
- {
- default:
- Fb = 0;
- break;
-
- case COMBINE_B_OUT:
- Fb = combine_disjoint_out_part (da, sa);
- break;
-
- case COMBINE_B_IN:
- Fb = combine_disjoint_in_part (da, sa);
- break;
-
- case COMBINE_B:
- Fb = MASK;
- break;
- }
- m = GENERIC (s, d, 0, Fa, Fb, t, u, v);
- n = GENERIC (s, d, G_SHIFT, Fa, Fb, t, u, v);
- o = GENERIC (s, d, R_SHIFT, Fa, Fb, t, u, v);
- p = GENERIC (s, d, A_SHIFT, Fa, Fb, t, u, v);
- s = m | n | o | p;
- *(dest + i) = s;
- }
-}
-
-static void
-combine_disjoint_over_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t s = combine_mask (src, mask, i);
- comp2_t a = s >> A_SHIFT;
-
- if (s != 0x00)
- {
- comp4_t d = *(dest + i);
- a = combine_disjoint_out_part (d >> A_SHIFT, a);
- UNcx4_MUL_UNc_ADD_UNcx4 (d, a, s);
-
- *(dest + i) = d;
- }
- }
-}
-
-static void
-combine_disjoint_in_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_disjoint_general_u (dest, src, mask, width, COMBINE_A_IN);
-}
-
-static void
-combine_disjoint_in_reverse_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_disjoint_general_u (dest, src, mask, width, COMBINE_B_IN);
-}
-
-static void
-combine_disjoint_out_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_disjoint_general_u (dest, src, mask, width, COMBINE_A_OUT);
-}
-
-static void
-combine_disjoint_out_reverse_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_disjoint_general_u (dest, src, mask, width, COMBINE_B_OUT);
-}
-
-static void
-combine_disjoint_atop_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_disjoint_general_u (dest, src, mask, width, COMBINE_A_ATOP);
-}
-
-static void
-combine_disjoint_atop_reverse_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_disjoint_general_u (dest, src, mask, width, COMBINE_B_ATOP);
-}
-
-static void
-combine_disjoint_xor_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_disjoint_general_u (dest, src, mask, width, COMBINE_XOR);
-}
-
-static void
-combine_conjoint_general_u (comp4_t * dest,
- const comp4_t *src,
- const comp4_t *mask,
- int width,
- comp1_t combine)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t s = combine_mask (src, mask, i);
- comp4_t d = *(dest + i);
- comp4_t m, n, o, p;
- comp2_t Fa, Fb, t, u, v;
- comp1_t sa = s >> A_SHIFT;
- comp1_t da = d >> A_SHIFT;
-
- switch (combine & COMBINE_A)
- {
- default:
- Fa = 0;
- break;
-
- case COMBINE_A_OUT:
- Fa = combine_conjoint_out_part (sa, da);
- break;
-
- case COMBINE_A_IN:
- Fa = combine_conjoint_in_part (sa, da);
- break;
-
- case COMBINE_A:
- Fa = MASK;
- break;
- }
-
- switch (combine & COMBINE_B)
- {
- default:
- Fb = 0;
- break;
-
- case COMBINE_B_OUT:
- Fb = combine_conjoint_out_part (da, sa);
- break;
-
- case COMBINE_B_IN:
- Fb = combine_conjoint_in_part (da, sa);
- break;
-
- case COMBINE_B:
- Fb = MASK;
- break;
- }
-
- m = GENERIC (s, d, 0, Fa, Fb, t, u, v);
- n = GENERIC (s, d, G_SHIFT, Fa, Fb, t, u, v);
- o = GENERIC (s, d, R_SHIFT, Fa, Fb, t, u, v);
- p = GENERIC (s, d, A_SHIFT, Fa, Fb, t, u, v);
-
- s = m | n | o | p;
-
- *(dest + i) = s;
- }
-}
-
-static void
-combine_conjoint_over_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_conjoint_general_u (dest, src, mask, width, COMBINE_A_OVER);
-}
-
-static void
-combine_conjoint_over_reverse_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_conjoint_general_u (dest, src, mask, width, COMBINE_B_OVER);
-}
-
-static void
-combine_conjoint_in_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_conjoint_general_u (dest, src, mask, width, COMBINE_A_IN);
-}
-
-static void
-combine_conjoint_in_reverse_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_conjoint_general_u (dest, src, mask, width, COMBINE_B_IN);
-}
-
-static void
-combine_conjoint_out_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_conjoint_general_u (dest, src, mask, width, COMBINE_A_OUT);
-}
-
-static void
-combine_conjoint_out_reverse_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_conjoint_general_u (dest, src, mask, width, COMBINE_B_OUT);
-}
-
-static void
-combine_conjoint_atop_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_conjoint_general_u (dest, src, mask, width, COMBINE_A_ATOP);
-}
-
-static void
-combine_conjoint_atop_reverse_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_conjoint_general_u (dest, src, mask, width, COMBINE_B_ATOP);
-}
-
-static void
-combine_conjoint_xor_u (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_conjoint_general_u (dest, src, mask, width, COMBINE_XOR);
-}
-
-/************************************************************************/
-/*********************** Per Channel functions **************************/
-/************************************************************************/
-
-static void
-combine_clear_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- memset (dest, 0, width * sizeof(comp4_t));
-}
-
-static void
-combine_src_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t s = *(src + i);
- comp4_t m = *(mask + i);
-
- combine_mask_value_ca (&s, &m);
-
- *(dest + i) = s;
- }
-}
-
-static void
-combine_over_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t s = *(src + i);
- comp4_t m = *(mask + i);
- comp4_t a;
-
- combine_mask_ca (&s, &m);
-
- a = ~m;
- if (a)
- {
- comp4_t d = *(dest + i);
- UNcx4_MUL_UNcx4_ADD_UNcx4 (d, a, s);
- s = d;
- }
-
- *(dest + i) = s;
- }
-}
-
-static void
-combine_over_reverse_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t d = *(dest + i);
- comp4_t a = ~d >> A_SHIFT;
-
- if (a)
- {
- comp4_t s = *(src + i);
- comp4_t m = *(mask + i);
-
- UNcx4_MUL_UNcx4 (s, m);
- UNcx4_MUL_UNc_ADD_UNcx4 (s, a, d);
-
- *(dest + i) = s;
- }
- }
-}
-
-static void
-combine_in_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t d = *(dest + i);
- comp2_t a = d >> A_SHIFT;
- comp4_t s = 0;
-
- if (a)
- {
- comp4_t m = *(mask + i);
-
- s = *(src + i);
- combine_mask_value_ca (&s, &m);
-
- if (a != MASK)
- UNcx4_MUL_UNc (s, a);
- }
-
- *(dest + i) = s;
- }
-}
-
-static void
-combine_in_reverse_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t s = *(src + i);
- comp4_t m = *(mask + i);
- comp4_t a;
-
- combine_mask_alpha_ca (&s, &m);
-
- a = m;
- if (a != ~0)
- {
- comp4_t d = 0;
-
- if (a)
- {
- d = *(dest + i);
- UNcx4_MUL_UNcx4 (d, a);
- }
-
- *(dest + i) = d;
- }
- }
-}
-
-static void
-combine_out_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t d = *(dest + i);
- comp2_t a = ~d >> A_SHIFT;
- comp4_t s = 0;
-
- if (a)
- {
- comp4_t m = *(mask + i);
-
- s = *(src + i);
- combine_mask_value_ca (&s, &m);
-
- if (a != MASK)
- UNcx4_MUL_UNc (s, a);
- }
-
- *(dest + i) = s;
- }
-}
-
-static void
-combine_out_reverse_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t s = *(src + i);
- comp4_t m = *(mask + i);
- comp4_t a;
-
- combine_mask_alpha_ca (&s, &m);
-
- a = ~m;
- if (a != ~0)
- {
- comp4_t d = 0;
-
- if (a)
- {
- d = *(dest + i);
- UNcx4_MUL_UNcx4 (d, a);
- }
-
- *(dest + i) = d;
- }
- }
-}
-
-static void
-combine_atop_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t d = *(dest + i);
- comp4_t s = *(src + i);
- comp4_t m = *(mask + i);
- comp4_t ad;
- comp2_t as = d >> A_SHIFT;
-
- combine_mask_ca (&s, &m);
-
- ad = ~m;
-
- UNcx4_MUL_UNcx4_ADD_UNcx4_MUL_UNc (d, ad, s, as);
-
- *(dest + i) = d;
- }
-}
-
-static void
-combine_atop_reverse_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t d = *(dest + i);
- comp4_t s = *(src + i);
- comp4_t m = *(mask + i);
- comp4_t ad;
- comp2_t as = ~d >> A_SHIFT;
-
- combine_mask_ca (&s, &m);
-
- ad = m;
-
- UNcx4_MUL_UNcx4_ADD_UNcx4_MUL_UNc (d, ad, s, as);
-
- *(dest + i) = d;
- }
-}
-
-static void
-combine_xor_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t d = *(dest + i);
- comp4_t s = *(src + i);
- comp4_t m = *(mask + i);
- comp4_t ad;
- comp2_t as = ~d >> A_SHIFT;
-
- combine_mask_ca (&s, &m);
-
- ad = ~m;
-
- UNcx4_MUL_UNcx4_ADD_UNcx4_MUL_UNc (d, ad, s, as);
-
- *(dest + i) = d;
- }
-}
-
-static void
-combine_add_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t s = *(src + i);
- comp4_t m = *(mask + i);
- comp4_t d = *(dest + i);
-
- combine_mask_value_ca (&s, &m);
-
- UNcx4_ADD_UNcx4 (d, s);
-
- *(dest + i) = d;
- }
-}
-
-static void
-combine_saturate_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t s, d;
- comp2_t sa, sr, sg, sb, da;
- comp2_t t, u, v;
- comp4_t m, n, o, p;
-
- d = *(dest + i);
- s = *(src + i);
- m = *(mask + i);
-
- combine_mask_ca (&s, &m);
-
- sa = (m >> A_SHIFT);
- sr = (m >> R_SHIFT) & MASK;
- sg = (m >> G_SHIFT) & MASK;
- sb = m & MASK;
- da = ~d >> A_SHIFT;
-
- if (sb <= da)
- m = ADD (s, d, 0, t);
- else
- m = GENERIC (s, d, 0, (da << G_SHIFT) / sb, MASK, t, u, v);
-
- if (sg <= da)
- n = ADD (s, d, G_SHIFT, t);
- else
- n = GENERIC (s, d, G_SHIFT, (da << G_SHIFT) / sg, MASK, t, u, v);
-
- if (sr <= da)
- o = ADD (s, d, R_SHIFT, t);
- else
- o = GENERIC (s, d, R_SHIFT, (da << G_SHIFT) / sr, MASK, t, u, v);
-
- if (sa <= da)
- p = ADD (s, d, A_SHIFT, t);
- else
- p = GENERIC (s, d, A_SHIFT, (da << G_SHIFT) / sa, MASK, t, u, v);
-
- *(dest + i) = m | n | o | p;
- }
-}
-
-static void
-combine_disjoint_general_ca (comp4_t * dest,
- const comp4_t *src,
- const comp4_t *mask,
- int width,
- comp1_t combine)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t s, d;
- comp4_t m, n, o, p;
- comp4_t Fa, Fb;
- comp2_t t, u, v;
- comp4_t sa;
- comp1_t da;
-
- s = *(src + i);
- m = *(mask + i);
- d = *(dest + i);
- da = d >> A_SHIFT;
-
- combine_mask_ca (&s, &m);
-
- sa = m;
-
- switch (combine & COMBINE_A)
- {
- default:
- Fa = 0;
- break;
-
- case COMBINE_A_OUT:
- m = (comp4_t)combine_disjoint_out_part ((comp1_t) (sa >> 0), da);
- n = (comp4_t)combine_disjoint_out_part ((comp1_t) (sa >> G_SHIFT), da) << G_SHIFT;
- o = (comp4_t)combine_disjoint_out_part ((comp1_t) (sa >> R_SHIFT), da) << R_SHIFT;
- p = (comp4_t)combine_disjoint_out_part ((comp1_t) (sa >> A_SHIFT), da) << A_SHIFT;
- Fa = m | n | o | p;
- break;
-
- case COMBINE_A_IN:
- m = (comp4_t)combine_disjoint_in_part ((comp1_t) (sa >> 0), da);
- n = (comp4_t)combine_disjoint_in_part ((comp1_t) (sa >> G_SHIFT), da) << G_SHIFT;
- o = (comp4_t)combine_disjoint_in_part ((comp1_t) (sa >> R_SHIFT), da) << R_SHIFT;
- p = (comp4_t)combine_disjoint_in_part ((comp1_t) (sa >> A_SHIFT), da) << A_SHIFT;
- Fa = m | n | o | p;
- break;
-
- case COMBINE_A:
- Fa = ~0;
- break;
- }
-
- switch (combine & COMBINE_B)
- {
- default:
- Fb = 0;
- break;
-
- case COMBINE_B_OUT:
- m = (comp4_t)combine_disjoint_out_part (da, (comp1_t) (sa >> 0));
- n = (comp4_t)combine_disjoint_out_part (da, (comp1_t) (sa >> G_SHIFT)) << G_SHIFT;
- o = (comp4_t)combine_disjoint_out_part (da, (comp1_t) (sa >> R_SHIFT)) << R_SHIFT;
- p = (comp4_t)combine_disjoint_out_part (da, (comp1_t) (sa >> A_SHIFT)) << A_SHIFT;
- Fb = m | n | o | p;
- break;
-
- case COMBINE_B_IN:
- m = (comp4_t)combine_disjoint_in_part (da, (comp1_t) (sa >> 0));
- n = (comp4_t)combine_disjoint_in_part (da, (comp1_t) (sa >> G_SHIFT)) << G_SHIFT;
- o = (comp4_t)combine_disjoint_in_part (da, (comp1_t) (sa >> R_SHIFT)) << R_SHIFT;
- p = (comp4_t)combine_disjoint_in_part (da, (comp1_t) (sa >> A_SHIFT)) << A_SHIFT;
- Fb = m | n | o | p;
- break;
-
- case COMBINE_B:
- Fb = ~0;
- break;
- }
- m = GENERIC (s, d, 0, GET_COMP (Fa, 0), GET_COMP (Fb, 0), t, u, v);
- n = GENERIC (s, d, G_SHIFT, GET_COMP (Fa, G_SHIFT), GET_COMP (Fb, G_SHIFT), t, u, v);
- o = GENERIC (s, d, R_SHIFT, GET_COMP (Fa, R_SHIFT), GET_COMP (Fb, R_SHIFT), t, u, v);
- p = GENERIC (s, d, A_SHIFT, GET_COMP (Fa, A_SHIFT), GET_COMP (Fb, A_SHIFT), t, u, v);
-
- s = m | n | o | p;
-
- *(dest + i) = s;
- }
-}
-
-static void
-combine_disjoint_over_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_disjoint_general_ca (dest, src, mask, width, COMBINE_A_OVER);
-}
-
-static void
-combine_disjoint_in_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_disjoint_general_ca (dest, src, mask, width, COMBINE_A_IN);
-}
-
-static void
-combine_disjoint_in_reverse_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_disjoint_general_ca (dest, src, mask, width, COMBINE_B_IN);
-}
-
-static void
-combine_disjoint_out_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_disjoint_general_ca (dest, src, mask, width, COMBINE_A_OUT);
-}
-
-static void
-combine_disjoint_out_reverse_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_disjoint_general_ca (dest, src, mask, width, COMBINE_B_OUT);
-}
-
-static void
-combine_disjoint_atop_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_disjoint_general_ca (dest, src, mask, width, COMBINE_A_ATOP);
-}
-
-static void
-combine_disjoint_atop_reverse_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_disjoint_general_ca (dest, src, mask, width, COMBINE_B_ATOP);
-}
-
-static void
-combine_disjoint_xor_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_disjoint_general_ca (dest, src, mask, width, COMBINE_XOR);
-}
-
-static void
-combine_conjoint_general_ca (comp4_t * dest,
- const comp4_t *src,
- const comp4_t *mask,
- int width,
- comp1_t combine)
-{
- int i;
-
- for (i = 0; i < width; ++i)
- {
- comp4_t s, d;
- comp4_t m, n, o, p;
- comp4_t Fa, Fb;
- comp2_t t, u, v;
- comp4_t sa;
- comp1_t da;
-
- s = *(src + i);
- m = *(mask + i);
- d = *(dest + i);
- da = d >> A_SHIFT;
-
- combine_mask_ca (&s, &m);
-
- sa = m;
-
- switch (combine & COMBINE_A)
- {
- default:
- Fa = 0;
- break;
-
- case COMBINE_A_OUT:
- m = (comp4_t)combine_conjoint_out_part ((comp1_t) (sa >> 0), da);
- n = (comp4_t)combine_conjoint_out_part ((comp1_t) (sa >> G_SHIFT), da) << G_SHIFT;
- o = (comp4_t)combine_conjoint_out_part ((comp1_t) (sa >> R_SHIFT), da) << R_SHIFT;
- p = (comp4_t)combine_conjoint_out_part ((comp1_t) (sa >> A_SHIFT), da) << A_SHIFT;
- Fa = m | n | o | p;
- break;
-
- case COMBINE_A_IN:
- m = (comp4_t)combine_conjoint_in_part ((comp1_t) (sa >> 0), da);
- n = (comp4_t)combine_conjoint_in_part ((comp1_t) (sa >> G_SHIFT), da) << G_SHIFT;
- o = (comp4_t)combine_conjoint_in_part ((comp1_t) (sa >> R_SHIFT), da) << R_SHIFT;
- p = (comp4_t)combine_conjoint_in_part ((comp1_t) (sa >> A_SHIFT), da) << A_SHIFT;
- Fa = m | n | o | p;
- break;
-
- case COMBINE_A:
- Fa = ~0;
- break;
- }
-
- switch (combine & COMBINE_B)
- {
- default:
- Fb = 0;
- break;
-
- case COMBINE_B_OUT:
- m = (comp4_t)combine_conjoint_out_part (da, (comp1_t) (sa >> 0));
- n = (comp4_t)combine_conjoint_out_part (da, (comp1_t) (sa >> G_SHIFT)) << G_SHIFT;
- o = (comp4_t)combine_conjoint_out_part (da, (comp1_t) (sa >> R_SHIFT)) << R_SHIFT;
- p = (comp4_t)combine_conjoint_out_part (da, (comp1_t) (sa >> A_SHIFT)) << A_SHIFT;
- Fb = m | n | o | p;
- break;
-
- case COMBINE_B_IN:
- m = (comp4_t)combine_conjoint_in_part (da, (comp1_t) (sa >> 0));
- n = (comp4_t)combine_conjoint_in_part (da, (comp1_t) (sa >> G_SHIFT)) << G_SHIFT;
- o = (comp4_t)combine_conjoint_in_part (da, (comp1_t) (sa >> R_SHIFT)) << R_SHIFT;
- p = (comp4_t)combine_conjoint_in_part (da, (comp1_t) (sa >> A_SHIFT)) << A_SHIFT;
- Fb = m | n | o | p;
- break;
-
- case COMBINE_B:
- Fb = ~0;
- break;
- }
- m = GENERIC (s, d, 0, GET_COMP (Fa, 0), GET_COMP (Fb, 0), t, u, v);
- n = GENERIC (s, d, G_SHIFT, GET_COMP (Fa, G_SHIFT), GET_COMP (Fb, G_SHIFT), t, u, v);
- o = GENERIC (s, d, R_SHIFT, GET_COMP (Fa, R_SHIFT), GET_COMP (Fb, R_SHIFT), t, u, v);
- p = GENERIC (s, d, A_SHIFT, GET_COMP (Fa, A_SHIFT), GET_COMP (Fb, A_SHIFT), t, u, v);
-
- s = m | n | o | p;
-
- *(dest + i) = s;
- }
-}
-
-static void
-combine_conjoint_over_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_conjoint_general_ca (dest, src, mask, width, COMBINE_A_OVER);
-}
-
-static void
-combine_conjoint_over_reverse_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_conjoint_general_ca (dest, src, mask, width, COMBINE_B_OVER);
-}
-
-static void
-combine_conjoint_in_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_conjoint_general_ca (dest, src, mask, width, COMBINE_A_IN);
-}
-
-static void
-combine_conjoint_in_reverse_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_conjoint_general_ca (dest, src, mask, width, COMBINE_B_IN);
-}
-
-static void
-combine_conjoint_out_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_conjoint_general_ca (dest, src, mask, width, COMBINE_A_OUT);
-}
-
-static void
-combine_conjoint_out_reverse_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_conjoint_general_ca (dest, src, mask, width, COMBINE_B_OUT);
-}
-
-static void
-combine_conjoint_atop_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_conjoint_general_ca (dest, src, mask, width, COMBINE_A_ATOP);
-}
-
-static void
-combine_conjoint_atop_reverse_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_conjoint_general_ca (dest, src, mask, width, COMBINE_B_ATOP);
-}
-
-static void
-combine_conjoint_xor_ca (pixman_implementation_t *imp,
- pixman_op_t op,
- comp4_t * dest,
- const comp4_t * src,
- const comp4_t * mask,
- int width)
-{
- combine_conjoint_general_ca (dest, src, mask, width, COMBINE_XOR);
-}
-
-void
-_pixman_setup_combiner_functions_width (pixman_implementation_t *imp)
-{
- /* Unified alpha */
- imp->combine_width[PIXMAN_OP_CLEAR] = combine_clear;
- imp->combine_width[PIXMAN_OP_SRC] = combine_src_u;
- imp->combine_width[PIXMAN_OP_DST] = combine_dst;
- imp->combine_width[PIXMAN_OP_OVER] = combine_over_u;
- imp->combine_width[PIXMAN_OP_OVER_REVERSE] = combine_over_reverse_u;
- imp->combine_width[PIXMAN_OP_IN] = combine_in_u;
- imp->combine_width[PIXMAN_OP_IN_REVERSE] = combine_in_reverse_u;
- imp->combine_width[PIXMAN_OP_OUT] = combine_out_u;
- imp->combine_width[PIXMAN_OP_OUT_REVERSE] = combine_out_reverse_u;
- imp->combine_width[PIXMAN_OP_ATOP] = combine_atop_u;
- imp->combine_width[PIXMAN_OP_ATOP_REVERSE] = combine_atop_reverse_u;
- imp->combine_width[PIXMAN_OP_XOR] = combine_xor_u;
- imp->combine_width[PIXMAN_OP_ADD] = combine_add_u;
- imp->combine_width[PIXMAN_OP_SATURATE] = combine_saturate_u;
-
- /* Disjoint, unified */
- imp->combine_width[PIXMAN_OP_DISJOINT_CLEAR] = combine_clear;
- imp->combine_width[PIXMAN_OP_DISJOINT_SRC] = combine_src_u;
- imp->combine_width[PIXMAN_OP_DISJOINT_DST] = combine_dst;
- imp->combine_width[PIXMAN_OP_DISJOINT_OVER] = combine_disjoint_over_u;
- imp->combine_width[PIXMAN_OP_DISJOINT_OVER_REVERSE] = combine_saturate_u;
- imp->combine_width[PIXMAN_OP_DISJOINT_IN] = combine_disjoint_in_u;
- imp->combine_width[PIXMAN_OP_DISJOINT_IN_REVERSE] = combine_disjoint_in_reverse_u;
- imp->combine_width[PIXMAN_OP_DISJOINT_OUT] = combine_disjoint_out_u;
- imp->combine_width[PIXMAN_OP_DISJOINT_OUT_REVERSE] = combine_disjoint_out_reverse_u;
- imp->combine_width[PIXMAN_OP_DISJOINT_ATOP] = combine_disjoint_atop_u;
- imp->combine_width[PIXMAN_OP_DISJOINT_ATOP_REVERSE] = combine_disjoint_atop_reverse_u;
- imp->combine_width[PIXMAN_OP_DISJOINT_XOR] = combine_disjoint_xor_u;
-
- /* Conjoint, unified */
- imp->combine_width[PIXMAN_OP_CONJOINT_CLEAR] = combine_clear;
- imp->combine_width[PIXMAN_OP_CONJOINT_SRC] = combine_src_u;
- imp->combine_width[PIXMAN_OP_CONJOINT_DST] = combine_dst;
- imp->combine_width[PIXMAN_OP_CONJOINT_OVER] = combine_conjoint_over_u;
- imp->combine_width[PIXMAN_OP_CONJOINT_OVER_REVERSE] = combine_conjoint_over_reverse_u;
- imp->combine_width[PIXMAN_OP_CONJOINT_IN] = combine_conjoint_in_u;
- imp->combine_width[PIXMAN_OP_CONJOINT_IN_REVERSE] = combine_conjoint_in_reverse_u;
- imp->combine_width[PIXMAN_OP_CONJOINT_OUT] = combine_conjoint_out_u;
- imp->combine_width[PIXMAN_OP_CONJOINT_OUT_REVERSE] = combine_conjoint_out_reverse_u;
- imp->combine_width[PIXMAN_OP_CONJOINT_ATOP] = combine_conjoint_atop_u;
- imp->combine_width[PIXMAN_OP_CONJOINT_ATOP_REVERSE] = combine_conjoint_atop_reverse_u;
- imp->combine_width[PIXMAN_OP_CONJOINT_XOR] = combine_conjoint_xor_u;
-
- imp->combine_width[PIXMAN_OP_MULTIPLY] = combine_multiply_u;
- imp->combine_width[PIXMAN_OP_SCREEN] = combine_screen_u;
- imp->combine_width[PIXMAN_OP_OVERLAY] = combine_overlay_u;
- imp->combine_width[PIXMAN_OP_DARKEN] = combine_darken_u;
- imp->combine_width[PIXMAN_OP_LIGHTEN] = combine_lighten_u;
- imp->combine_width[PIXMAN_OP_COLOR_DODGE] = combine_color_dodge_u;
- imp->combine_width[PIXMAN_OP_COLOR_BURN] = combine_color_burn_u;
- imp->combine_width[PIXMAN_OP_HARD_LIGHT] = combine_hard_light_u;
- imp->combine_width[PIXMAN_OP_SOFT_LIGHT] = combine_soft_light_u;
- imp->combine_width[PIXMAN_OP_DIFFERENCE] = combine_difference_u;
- imp->combine_width[PIXMAN_OP_EXCLUSION] = combine_exclusion_u;
- imp->combine_width[PIXMAN_OP_HSL_HUE] = combine_hsl_hue_u;
- imp->combine_width[PIXMAN_OP_HSL_SATURATION] = combine_hsl_saturation_u;
- imp->combine_width[PIXMAN_OP_HSL_COLOR] = combine_hsl_color_u;
- imp->combine_width[PIXMAN_OP_HSL_LUMINOSITY] = combine_hsl_luminosity_u;
-
- /* Component alpha combiners */
- imp->combine_width_ca[PIXMAN_OP_CLEAR] = combine_clear_ca;
- imp->combine_width_ca[PIXMAN_OP_SRC] = combine_src_ca;
- /* dest */
- imp->combine_width_ca[PIXMAN_OP_OVER] = combine_over_ca;
- imp->combine_width_ca[PIXMAN_OP_OVER_REVERSE] = combine_over_reverse_ca;
- imp->combine_width_ca[PIXMAN_OP_IN] = combine_in_ca;
- imp->combine_width_ca[PIXMAN_OP_IN_REVERSE] = combine_in_reverse_ca;
- imp->combine_width_ca[PIXMAN_OP_OUT] = combine_out_ca;
- imp->combine_width_ca[PIXMAN_OP_OUT_REVERSE] = combine_out_reverse_ca;
- imp->combine_width_ca[PIXMAN_OP_ATOP] = combine_atop_ca;
- imp->combine_width_ca[PIXMAN_OP_ATOP_REVERSE] = combine_atop_reverse_ca;
- imp->combine_width_ca[PIXMAN_OP_XOR] = combine_xor_ca;
- imp->combine_width_ca[PIXMAN_OP_ADD] = combine_add_ca;
- imp->combine_width_ca[PIXMAN_OP_SATURATE] = combine_saturate_ca;
-
- /* Disjoint CA */
- imp->combine_width_ca[PIXMAN_OP_DISJOINT_CLEAR] = combine_clear_ca;
- imp->combine_width_ca[PIXMAN_OP_DISJOINT_SRC] = combine_src_ca;
- imp->combine_width_ca[PIXMAN_OP_DISJOINT_DST] = combine_dst;
- imp->combine_width_ca[PIXMAN_OP_DISJOINT_OVER] = combine_disjoint_over_ca;
- imp->combine_width_ca[PIXMAN_OP_DISJOINT_OVER_REVERSE] = combine_saturate_ca;
- imp->combine_width_ca[PIXMAN_OP_DISJOINT_IN] = combine_disjoint_in_ca;
- imp->combine_width_ca[PIXMAN_OP_DISJOINT_IN_REVERSE] = combine_disjoint_in_reverse_ca;
- imp->combine_width_ca[PIXMAN_OP_DISJOINT_OUT] = combine_disjoint_out_ca;
- imp->combine_width_ca[PIXMAN_OP_DISJOINT_OUT_REVERSE] = combine_disjoint_out_reverse_ca;
- imp->combine_width_ca[PIXMAN_OP_DISJOINT_ATOP] = combine_disjoint_atop_ca;
- imp->combine_width_ca[PIXMAN_OP_DISJOINT_ATOP_REVERSE] = combine_disjoint_atop_reverse_ca;
- imp->combine_width_ca[PIXMAN_OP_DISJOINT_XOR] = combine_disjoint_xor_ca;
-
- /* Conjoint CA */
- imp->combine_width_ca[PIXMAN_OP_CONJOINT_CLEAR] = combine_clear_ca;
- imp->combine_width_ca[PIXMAN_OP_CONJOINT_SRC] = combine_src_ca;
- imp->combine_width_ca[PIXMAN_OP_CONJOINT_DST] = combine_dst;
- imp->combine_width_ca[PIXMAN_OP_CONJOINT_OVER] = combine_conjoint_over_ca;
- imp->combine_width_ca[PIXMAN_OP_CONJOINT_OVER_REVERSE] = combine_conjoint_over_reverse_ca;
- imp->combine_width_ca[PIXMAN_OP_CONJOINT_IN] = combine_conjoint_in_ca;
- imp->combine_width_ca[PIXMAN_OP_CONJOINT_IN_REVERSE] = combine_conjoint_in_reverse_ca;
- imp->combine_width_ca[PIXMAN_OP_CONJOINT_OUT] = combine_conjoint_out_ca;
- imp->combine_width_ca[PIXMAN_OP_CONJOINT_OUT_REVERSE] = combine_conjoint_out_reverse_ca;
- imp->combine_width_ca[PIXMAN_OP_CONJOINT_ATOP] = combine_conjoint_atop_ca;
- imp->combine_width_ca[PIXMAN_OP_CONJOINT_ATOP_REVERSE] = combine_conjoint_atop_reverse_ca;
- imp->combine_width_ca[PIXMAN_OP_CONJOINT_XOR] = combine_conjoint_xor_ca;
-
- imp->combine_width_ca[PIXMAN_OP_MULTIPLY] = combine_multiply_ca;
- imp->combine_width_ca[PIXMAN_OP_SCREEN] = combine_screen_ca;
- imp->combine_width_ca[PIXMAN_OP_OVERLAY] = combine_overlay_ca;
- imp->combine_width_ca[PIXMAN_OP_DARKEN] = combine_darken_ca;
- imp->combine_width_ca[PIXMAN_OP_LIGHTEN] = combine_lighten_ca;
- imp->combine_width_ca[PIXMAN_OP_COLOR_DODGE] = combine_color_dodge_ca;
- imp->combine_width_ca[PIXMAN_OP_COLOR_BURN] = combine_color_burn_ca;
- imp->combine_width_ca[PIXMAN_OP_HARD_LIGHT] = combine_hard_light_ca;
- imp->combine_width_ca[PIXMAN_OP_SOFT_LIGHT] = combine_soft_light_ca;
- imp->combine_width_ca[PIXMAN_OP_DIFFERENCE] = combine_difference_ca;
- imp->combine_width_ca[PIXMAN_OP_EXCLUSION] = combine_exclusion_ca;
-
- /* It is not clear that these make sense, so make them noops for now */
- imp->combine_width_ca[PIXMAN_OP_HSL_HUE] = combine_dst;
- imp->combine_width_ca[PIXMAN_OP_HSL_SATURATION] = combine_dst;
- imp->combine_width_ca[PIXMAN_OP_HSL_COLOR] = combine_dst;
- imp->combine_width_ca[PIXMAN_OP_HSL_LUMINOSITY] = combine_dst;
-}
-
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <math.h>
+#include <string.h>
+
+#include "pixman-private.h"
+
+#include "pixman-combine.h"
+
+/*** per channel helper functions ***/
+
+static void
+combine_mask_ca (comp4_t *src, comp4_t *mask)
+{
+ comp4_t a = *mask;
+
+ comp4_t x;
+ comp2_t xa;
+
+ if (!a)
+ {
+ *(src) = 0;
+ return;
+ }
+
+ x = *(src);
+ if (a == ~0)
+ {
+ x = x >> A_SHIFT;
+ x |= x << G_SHIFT;
+ x |= x << R_SHIFT;
+ *(mask) = x;
+ return;
+ }
+
+ xa = x >> A_SHIFT;
+ UNcx4_MUL_UNcx4 (x, a);
+ *(src) = x;
+
+ UNcx4_MUL_UNc (a, xa);
+ *(mask) = a;
+}
+
+static void
+combine_mask_value_ca (comp4_t *src, const comp4_t *mask)
+{
+ comp4_t a = *mask;
+ comp4_t x;
+
+ if (!a)
+ {
+ *(src) = 0;
+ return;
+ }
+
+ if (a == ~0)
+ return;
+
+ x = *(src);
+ UNcx4_MUL_UNcx4 (x, a);
+ *(src) = x;
+}
+
+static void
+combine_mask_alpha_ca (const comp4_t *src, comp4_t *mask)
+{
+ comp4_t a = *(mask);
+ comp4_t x;
+
+ if (!a)
+ return;
+
+ x = *(src) >> A_SHIFT;
+ if (x == MASK)
+ return;
+
+ if (a == ~0)
+ {
+ x |= x << G_SHIFT;
+ x |= x << R_SHIFT;
+ *(mask) = x;
+ return;
+ }
+
+ UNcx4_MUL_UNc (a, x);
+ *(mask) = a;
+}
+
+/*
+ * There are two ways of handling alpha -- either as a single unified value or
+ * a separate value for each component, hence each macro must have two
+ * versions. The unified alpha version has a 'U' at the end of the name,
+ * the component version has a 'C'. Similarly, functions which deal with
+ * this difference will have two versions using the same convention.
+ */
+
+/*
+ * All of the composing functions
+ */
+
+static force_inline comp4_t
+combine_mask (const comp4_t *src, const comp4_t *mask, int i)
+{
+ comp4_t s, m;
+
+ if (mask)
+ {
+ m = *(mask + i) >> A_SHIFT;
+
+ if (!m)
+ return 0;
+ }
+
+ s = *(src + i);
+
+ if (mask)
+ UNcx4_MUL_UNc (s, m);
+
+ return s;
+}
+
+static void
+combine_clear (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ memset (dest, 0, width * sizeof(comp4_t));
+}
+
+static void
+combine_dst (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ return;
+}
+
+static void
+combine_src_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ int i;
+
+ if (!mask)
+ memcpy (dest, src, width * sizeof (comp4_t));
+ else
+ {
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t s = combine_mask (src, mask, i);
+
+ *(dest + i) = s;
+ }
+ }
+}
+
+/* if the Src is opaque, call combine_src_u */
+static void
+combine_over_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t s = combine_mask (src, mask, i);
+ comp4_t d = *(dest + i);
+ comp4_t ia = ALPHA_c (~s);
+
+ UNcx4_MUL_UNc_ADD_UNcx4 (d, ia, s);
+ *(dest + i) = d;
+ }
+}
+
+/* if the Dst is opaque, this is a noop */
+static void
+combine_over_reverse_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t s = combine_mask (src, mask, i);
+ comp4_t d = *(dest + i);
+ comp4_t ia = ALPHA_c (~*(dest + i));
+ UNcx4_MUL_UNc_ADD_UNcx4 (s, ia, d);
+ *(dest + i) = s;
+ }
+}
+
+/* if the Dst is opaque, call combine_src_u */
+static void
+combine_in_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t s = combine_mask (src, mask, i);
+ comp4_t a = ALPHA_c (*(dest + i));
+ UNcx4_MUL_UNc (s, a);
+ *(dest + i) = s;
+ }
+}
+
+/* if the Src is opaque, this is a noop */
+static void
+combine_in_reverse_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t s = combine_mask (src, mask, i);
+ comp4_t d = *(dest + i);
+ comp4_t a = ALPHA_c (s);
+ UNcx4_MUL_UNc (d, a);
+ *(dest + i) = d;
+ }
+}
+
+/* if the Dst is opaque, call combine_clear */
+static void
+combine_out_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t s = combine_mask (src, mask, i);
+ comp4_t a = ALPHA_c (~*(dest + i));
+ UNcx4_MUL_UNc (s, a);
+ *(dest + i) = s;
+ }
+}
+
+/* if the Src is opaque, call combine_clear */
+static void
+combine_out_reverse_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t s = combine_mask (src, mask, i);
+ comp4_t d = *(dest + i);
+ comp4_t a = ALPHA_c (~s);
+ UNcx4_MUL_UNc (d, a);
+ *(dest + i) = d;
+ }
+}
+
+/* if the Src is opaque, call combine_in_u */
+/* if the Dst is opaque, call combine_over_u */
+/* if both the Src and Dst are opaque, call combine_src_u */
+static void
+combine_atop_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t s = combine_mask (src, mask, i);
+ comp4_t d = *(dest + i);
+ comp4_t dest_a = ALPHA_c (d);
+ comp4_t src_ia = ALPHA_c (~s);
+
+ UNcx4_MUL_UNc_ADD_UNcx4_MUL_UNc (s, dest_a, d, src_ia);
+ *(dest + i) = s;
+ }
+}
+
+/* if the Src is opaque, call combine_over_reverse_u */
+/* if the Dst is opaque, call combine_in_reverse_u */
+/* if both the Src and Dst are opaque, call combine_dst_u */
+static void
+combine_atop_reverse_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t s = combine_mask (src, mask, i);
+ comp4_t d = *(dest + i);
+ comp4_t src_a = ALPHA_c (s);
+ comp4_t dest_ia = ALPHA_c (~d);
+
+ UNcx4_MUL_UNc_ADD_UNcx4_MUL_UNc (s, dest_ia, d, src_a);
+ *(dest + i) = s;
+ }
+}
+
+/* if the Src is opaque, call combine_over_u */
+/* if the Dst is opaque, call combine_over_reverse_u */
+/* if both the Src and Dst are opaque, call combine_clear */
+static void
+combine_xor_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t s = combine_mask (src, mask, i);
+ comp4_t d = *(dest + i);
+ comp4_t src_ia = ALPHA_c (~s);
+ comp4_t dest_ia = ALPHA_c (~d);
+
+ UNcx4_MUL_UNc_ADD_UNcx4_MUL_UNc (s, dest_ia, d, src_ia);
+ *(dest + i) = s;
+ }
+}
+
+static void
+combine_add_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t s = combine_mask (src, mask, i);
+ comp4_t d = *(dest + i);
+ UNcx4_ADD_UNcx4 (d, s);
+ *(dest + i) = d;
+ }
+}
+
+/* if the Src is opaque, call combine_add_u */
+/* if the Dst is opaque, call combine_add_u */
+/* if both the Src and Dst are opaque, call combine_add_u */
+static void
+combine_saturate_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t s = combine_mask (src, mask, i);
+ comp4_t d = *(dest + i);
+ comp2_t sa, da;
+
+ sa = s >> A_SHIFT;
+ da = ~d >> A_SHIFT;
+ if (sa > da)
+ {
+ sa = DIV_UNc (da, sa);
+ UNcx4_MUL_UNc (s, sa);
+ }
+ ;
+ UNcx4_ADD_UNcx4 (d, s);
+ *(dest + i) = d;
+ }
+}
+
+/*
+ * PDF blend modes:
+ * The following blend modes have been taken from the PDF ISO 32000
+ * specification, which at this point in time is available from
+ * http://www.adobe.com/devnet/acrobat/pdfs/PDF32000_2008.pdf
+ * The relevant chapters are 11.3.5 and 11.3.6.
+ * The formula for computing the final pixel color given in 11.3.6 is:
+ * αr × Cr = (1 – αs) × αb × Cb + (1 – αb) × αs × Cs + αb × αs × B(Cb, Cs)
+ * with B() being the blend function.
+ * Note that OVER is a special case of this operation, using B(Cb, Cs) = Cs
+ *
+ * These blend modes should match the SVG filter draft specification, as
+ * it has been designed to mirror ISO 32000. Note that at the current point
+ * no released draft exists that shows this, as the formulas have not been
+ * updated yet after the release of ISO 32000.
+ *
+ * The default implementation here uses the PDF_SEPARABLE_BLEND_MODE and
+ * PDF_NON_SEPARABLE_BLEND_MODE macros, which take the blend function as an
+ * argument. Note that this implementation operates on premultiplied colors,
+ * while the PDF specification does not. Therefore the code uses the formula
+ * Cra = (1 – as) . Dca + (1 – ad) . Sca + B(Dca, ad, Sca, as)
+ */
+
+/*
+ * Multiply
+ * B(Dca, ad, Sca, as) = Dca.Sca
+ */
+
+static void
+combine_multiply_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t s = combine_mask (src, mask, i);
+ comp4_t d = *(dest + i);
+ comp4_t ss = s;
+ comp4_t src_ia = ALPHA_c (~s);
+ comp4_t dest_ia = ALPHA_c (~d);
+
+ UNcx4_MUL_UNc_ADD_UNcx4_MUL_UNc (ss, dest_ia, d, src_ia);
+ UNcx4_MUL_UNcx4 (d, s);
+ UNcx4_ADD_UNcx4 (d, ss);
+
+ *(dest + i) = d;
+ }
+}
+
+static void
+combine_multiply_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t m = *(mask + i);
+ comp4_t s = *(src + i);
+ comp4_t d = *(dest + i);
+ comp4_t r = d;
+ comp4_t dest_ia = ALPHA_c (~d);
+
+ combine_mask_value_ca (&s, &m);
+
+ UNcx4_MUL_UNcx4_ADD_UNcx4_MUL_UNc (r, ~m, s, dest_ia);
+ UNcx4_MUL_UNcx4 (d, s);
+ UNcx4_ADD_UNcx4 (r, d);
+
+ *(dest + i) = r;
+ }
+}
+
+#define PDF_SEPARABLE_BLEND_MODE(name) \
+ static void \
+ combine_ ## name ## _u (pixman_implementation_t *imp, \
+ pixman_op_t op, \
+ comp4_t * dest, \
+ const comp4_t * src, \
+ const comp4_t * mask, \
+ int width) \
+ { \
+ int i; \
+ for (i = 0; i < width; ++i) { \
+ comp4_t s = combine_mask (src, mask, i); \
+ comp4_t d = *(dest + i); \
+ comp1_t sa = ALPHA_c (s); \
+ comp1_t isa = ~sa; \
+ comp1_t da = ALPHA_c (d); \
+ comp1_t ida = ~da; \
+ comp4_t result; \
+ \
+ result = d; \
+ UNcx4_MUL_UNc_ADD_UNcx4_MUL_UNc (result, isa, s, ida); \
+ \
+ *(dest + i) = result + \
+ (DIV_ONE_UNc (sa * da) << A_SHIFT) + \
+ (blend_ ## name (RED_c (d), da, RED_c (s), sa) << R_SHIFT) + \
+ (blend_ ## name (GREEN_c (d), da, GREEN_c (s), sa) << G_SHIFT) + \
+ (blend_ ## name (BLUE_c (d), da, BLUE_c (s), sa)); \
+ } \
+ } \
+ \
+ static void \
+ combine_ ## name ## _ca (pixman_implementation_t *imp, \
+ pixman_op_t op, \
+ comp4_t * dest, \
+ const comp4_t * src, \
+ const comp4_t * mask, \
+ int width) \
+ { \
+ int i; \
+ for (i = 0; i < width; ++i) { \
+ comp4_t m = *(mask + i); \
+ comp4_t s = *(src + i); \
+ comp4_t d = *(dest + i); \
+ comp1_t da = ALPHA_c (d); \
+ comp1_t ida = ~da; \
+ comp4_t result; \
+ \
+ combine_mask_value_ca (&s, &m); \
+ \
+ result = d; \
+ UNcx4_MUL_UNcx4_ADD_UNcx4_MUL_UNc (result, ~m, s, ida); \
+ \
+ result += \
+ (DIV_ONE_UNc (ALPHA_c (m) * da) << A_SHIFT) + \
+ (blend_ ## name (RED_c (d), da, RED_c (s), RED_c (m)) << R_SHIFT) + \
+ (blend_ ## name (GREEN_c (d), da, GREEN_c (s), GREEN_c (m)) << G_SHIFT) + \
+ (blend_ ## name (BLUE_c (d), da, BLUE_c (s), BLUE_c (m))); \
+ \
+ *(dest + i) = result; \
+ } \
+ }
+
+/*
+ * Screen
+ * B(Dca, ad, Sca, as) = Dca.sa + Sca.da - Dca.Sca
+ */
+static inline comp4_t
+blend_screen (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
+{
+ return DIV_ONE_UNc (sca * da + dca * sa - sca * dca);
+}
+
+PDF_SEPARABLE_BLEND_MODE (screen)
+
+/*
+ * Overlay
+ * B(Dca, Da, Sca, Sa) =
+ * if 2.Dca < Da
+ * 2.Sca.Dca
+ * otherwise
+ * Sa.Da - 2.(Da - Dca).(Sa - Sca)
+ */
+static inline comp4_t
+blend_overlay (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
+{
+ comp4_t rca;
+
+ if (2 * dca < da)
+ rca = 2 * sca * dca;
+ else
+ rca = sa * da - 2 * (da - dca) * (sa - sca);
+ return DIV_ONE_UNc (rca);
+}
+
+PDF_SEPARABLE_BLEND_MODE (overlay)
+
+/*
+ * Darken
+ * B(Dca, Da, Sca, Sa) = min (Sca.Da, Dca.Sa)
+ */
+static inline comp4_t
+blend_darken (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
+{
+ comp4_t s, d;
+
+ s = sca * da;
+ d = dca * sa;
+ return DIV_ONE_UNc (s > d ? d : s);
+}
+
+PDF_SEPARABLE_BLEND_MODE (darken)
+
+/*
+ * Lighten
+ * B(Dca, Da, Sca, Sa) = max (Sca.Da, Dca.Sa)
+ */
+static inline comp4_t
+blend_lighten (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
+{
+ comp4_t s, d;
+
+ s = sca * da;
+ d = dca * sa;
+ return DIV_ONE_UNc (s > d ? s : d);
+}
+
+PDF_SEPARABLE_BLEND_MODE (lighten)
+
+/*
+ * Color dodge
+ * B(Dca, Da, Sca, Sa) =
+ * if Dca == 0
+ * 0
+ * if Sca == Sa
+ * Sa.Da
+ * otherwise
+ * Sa.Da. min (1, Dca / Da / (1 - Sca/Sa))
+ */
+static inline comp4_t
+blend_color_dodge (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
+{
+ if (sca >= sa)
+ {
+ return dca == 0 ? 0 : DIV_ONE_UNc (sa * da);
+ }
+ else
+ {
+ comp4_t rca = dca * sa / (sa - sca);
+ return DIV_ONE_UNc (sa * MIN (rca, da));
+ }
+}
+
+PDF_SEPARABLE_BLEND_MODE (color_dodge)
+
+/*
+ * Color burn
+ * B(Dca, Da, Sca, Sa) =
+ * if Dca == Da
+ * Sa.Da
+ * if Sca == 0
+ * 0
+ * otherwise
+ * Sa.Da.(1 - min (1, (1 - Dca/Da).Sa / Sca))
+ */
+static inline comp4_t
+blend_color_burn (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
+{
+ if (sca == 0)
+ {
+ return dca < da ? 0 : DIV_ONE_UNc (sa * da);
+ }
+ else
+ {
+ comp4_t rca = (da - dca) * sa / sca;
+ return DIV_ONE_UNc (sa * (MAX (rca, da) - rca));
+ }
+}
+
+PDF_SEPARABLE_BLEND_MODE (color_burn)
+
+/*
+ * Hard light
+ * B(Dca, Da, Sca, Sa) =
+ * if 2.Sca < Sa
+ * 2.Sca.Dca
+ * otherwise
+ * Sa.Da - 2.(Da - Dca).(Sa - Sca)
+ */
+static inline comp4_t
+blend_hard_light (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
+{
+ if (2 * sca < sa)
+ return DIV_ONE_UNc (2 * sca * dca);
+ else
+ return DIV_ONE_UNc (sa * da - 2 * (da - dca) * (sa - sca));
+}
+
+PDF_SEPARABLE_BLEND_MODE (hard_light)
+
+/*
+ * Soft light
+ * B(Dca, Da, Sca, Sa) =
+ * if (2.Sca <= Sa)
+ * Dca.(Sa - (1 - Dca/Da).(2.Sca - Sa))
+ * otherwise if Dca.4 <= Da
+ * Dca.(Sa + (2.Sca - Sa).((16.Dca/Da - 12).Dca/Da + 3)
+ * otherwise
+ * (Dca.Sa + (SQRT (Dca/Da).Da - Dca).(2.Sca - Sa))
+ */
+static inline comp4_t
+blend_soft_light (comp4_t dca_org,
+ comp4_t da_org,
+ comp4_t sca_org,
+ comp4_t sa_org)
+{
+ double dca = dca_org * (1.0 / MASK);
+ double da = da_org * (1.0 / MASK);
+ double sca = sca_org * (1.0 / MASK);
+ double sa = sa_org * (1.0 / MASK);
+ double rca;
+
+ if (2 * sca < sa)
+ {
+ if (da == 0)
+ rca = dca * sa;
+ else
+ rca = dca * sa - dca * (da - dca) * (sa - 2 * sca) / da;
+ }
+ else if (da == 0)
+ {
+ rca = 0;
+ }
+ else if (4 * dca <= da)
+ {
+ rca = dca * sa +
+ (2 * sca - sa) * dca * ((16 * dca / da - 12) * dca / da + 3);
+ }
+ else
+ {
+ rca = dca * sa + (sqrt (dca * da) - dca) * (2 * sca - sa);
+ }
+ return rca * MASK + 0.5;
+}
+
+PDF_SEPARABLE_BLEND_MODE (soft_light)
+
+/*
+ * Difference
+ * B(Dca, Da, Sca, Sa) = abs (Dca.Sa - Sca.Da)
+ */
+static inline comp4_t
+blend_difference (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
+{
+ comp4_t dcasa = dca * sa;
+ comp4_t scada = sca * da;
+
+ if (scada < dcasa)
+ return DIV_ONE_UNc (dcasa - scada);
+ else
+ return DIV_ONE_UNc (scada - dcasa);
+}
+
+PDF_SEPARABLE_BLEND_MODE (difference)
+
+/*
+ * Exclusion
+ * B(Dca, Da, Sca, Sa) = (Sca.Da + Dca.Sa - 2.Sca.Dca)
+ */
+
+/* This can be made faster by writing it directly and not using
+ * PDF_SEPARABLE_BLEND_MODE, but that's a performance optimization */
+
+static inline comp4_t
+blend_exclusion (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
+{
+ return DIV_ONE_UNc (sca * da + dca * sa - 2 * dca * sca);
+}
+
+PDF_SEPARABLE_BLEND_MODE (exclusion)
+
+#undef PDF_SEPARABLE_BLEND_MODE
+
+/*
+ * PDF nonseperable blend modes are implemented using the following functions
+ * to operate in Hsl space, with Cmax, Cmid, Cmin referring to the max, mid
+ * and min value of the red, green and blue components.
+ *
+ * LUM (C) = 0.3 × Cred + 0.59 × Cgreen + 0.11 × Cblue
+ *
+ * clip_color (C):
+ * l = LUM (C)
+ * min = Cmin
+ * max = Cmax
+ * if n < 0.0
+ * C = l + ( ( ( C – l ) × l ) ⁄ ( l – min ) )
+ * if x > 1.0
+ * C = l + ( ( ( C – l ) × ( 1 – l ) ) ⁄ ( max – l ) )
+ * return C
+ *
+ * set_lum (C, l):
+ * d = l – LUM (C)
+ * C += d
+ * return clip_color (C)
+ *
+ * SAT (C) = CH_MAX (C) - CH_MIN (C)
+ *
+ * set_sat (C, s):
+ * if Cmax > Cmin
+ * Cmid = ( ( ( Cmid – Cmin ) × s ) ⁄ ( Cmax – Cmin ) )
+ * Cmax = s
+ * else
+ * Cmid = Cmax = 0.0
+ * Cmin = 0.0
+ * return C
+ */
+
+/* For premultiplied colors, we need to know what happens when C is
+ * multiplied by a real number. LUM and SAT are linear:
+ *
+ * LUM (r × C) = r × LUM (C) SAT (r * C) = r * SAT (C)
+ *
+ * If we extend clip_color with an extra argument a and change
+ *
+ * if x >= 1.0
+ *
+ * into
+ *
+ * if x >= a
+ *
+ * then clip_color is also linear:
+ *
+ * r * clip_color (C, a) = clip_color (r_c, ra);
+ *
+ * for positive r.
+ *
+ * Similarly, we can extend set_lum with an extra argument that is just passed
+ * on to clip_color:
+ *
+ * r * set_lum ( C, l, a)
+ *
+ * = r × clip_color ( C + l - LUM (C), a)
+ *
+ * = clip_color ( r * C + r × l - r * LUM (C), r * a)
+ *
+ * = set_lum ( r * C, r * l, r * a)
+ *
+ * Finally, set_sat:
+ *
+ * r * set_sat (C, s) = set_sat (x * C, r * s)
+ *
+ * The above holds for all non-zero x, because the x'es in the fraction for
+ * C_mid cancel out. Specifically, it holds for x = r:
+ *
+ * r * set_sat (C, s) = set_sat (r_c, rs)
+ *
+ */
+
+/* So, for the non-separable PDF blend modes, we have (using s, d for
+ * non-premultiplied colors, and S, D for premultiplied:
+ *
+ * Color:
+ *
+ * a_s * a_d * B(s, d)
+ * = a_s * a_d * set_lum (S/a_s, LUM (D/a_d), 1)
+ * = set_lum (S * a_d, a_s * LUM (D), a_s * a_d)
+ *
+ *
+ * Luminosity:
+ *
+ * a_s * a_d * B(s, d)
+ * = a_s * a_d * set_lum (D/a_d, LUM(S/a_s), 1)
+ * = set_lum (a_s * D, a_d * LUM(S), a_s * a_d)
+ *
+ *
+ * Saturation:
+ *
+ * a_s * a_d * B(s, d)
+ * = a_s * a_d * set_lum (set_sat (D/a_d, SAT (S/a_s)), LUM (D/a_d), 1)
+ * = set_lum (a_s * a_d * set_sat (D/a_d, SAT (S/a_s)),
+ * a_s * LUM (D), a_s * a_d)
+ * = set_lum (set_sat (a_s * D, a_d * SAT (S), a_s * LUM (D), a_s * a_d))
+ *
+ * Hue:
+ *
+ * a_s * a_d * B(s, d)
+ * = a_s * a_d * set_lum (set_sat (S/a_s, SAT (D/a_d)), LUM (D/a_d), 1)
+ * = set_lum (set_sat (a_d * S, a_s * SAT (D)), a_s * LUM (D), a_s * a_d)
+ *
+ */
+
+#define CH_MIN(c) (c[0] < c[1] ? (c[0] < c[2] ? c[0] : c[2]) : (c[1] < c[2] ? c[1] : c[2]))
+#define CH_MAX(c) (c[0] > c[1] ? (c[0] > c[2] ? c[0] : c[2]) : (c[1] > c[2] ? c[1] : c[2]))
+#define LUM(c) ((c[0] * 30 + c[1] * 59 + c[2] * 11) / 100)
+#define SAT(c) (CH_MAX (c) - CH_MIN (c))
+
+#define PDF_NON_SEPARABLE_BLEND_MODE(name) \
+ static void \
+ combine_ ## name ## _u (pixman_implementation_t *imp, \
+ pixman_op_t op, \
+ comp4_t *dest, \
+ const comp4_t *src, \
+ const comp4_t *mask, \
+ int width) \
+ { \
+ int i; \
+ for (i = 0; i < width; ++i) \
+ { \
+ comp4_t s = combine_mask (src, mask, i); \
+ comp4_t d = *(dest + i); \
+ comp1_t sa = ALPHA_c (s); \
+ comp1_t isa = ~sa; \
+ comp1_t da = ALPHA_c (d); \
+ comp1_t ida = ~da; \
+ comp4_t result; \
+ comp4_t sc[3], dc[3], c[3]; \
+ \
+ result = d; \
+ UNcx4_MUL_UNc_ADD_UNcx4_MUL_UNc (result, isa, s, ida); \
+ dc[0] = RED_c (d); \
+ sc[0] = RED_c (s); \
+ dc[1] = GREEN_c (d); \
+ sc[1] = GREEN_c (s); \
+ dc[2] = BLUE_c (d); \
+ sc[2] = BLUE_c (s); \
+ blend_ ## name (c, dc, da, sc, sa); \
+ \
+ *(dest + i) = result + \
+ (DIV_ONE_UNc (sa * da) << A_SHIFT) + \
+ (DIV_ONE_UNc (c[0]) << R_SHIFT) + \
+ (DIV_ONE_UNc (c[1]) << G_SHIFT) + \
+ (DIV_ONE_UNc (c[2])); \
+ } \
+ }
+
+static void
+set_lum (comp4_t dest[3], comp4_t src[3], comp4_t sa, comp4_t lum)
+{
+ double a, l, min, max;
+ double tmp[3];
+
+ a = sa * (1.0 / MASK);
+
+ l = lum * (1.0 / MASK);
+ tmp[0] = src[0] * (1.0 / MASK);
+ tmp[1] = src[1] * (1.0 / MASK);
+ tmp[2] = src[2] * (1.0 / MASK);
+
+ l = l - LUM (tmp);
+ tmp[0] += l;
+ tmp[1] += l;
+ tmp[2] += l;
+
+ /* clip_color */
+ l = LUM (tmp);
+ min = CH_MIN (tmp);
+ max = CH_MAX (tmp);
+
+ if (min < 0)
+ {
+ if (l - min == 0.0)
+ {
+ tmp[0] = 0;
+ tmp[1] = 0;
+ tmp[2] = 0;
+ }
+ else
+ {
+ tmp[0] = l + (tmp[0] - l) * l / (l - min);
+ tmp[1] = l + (tmp[1] - l) * l / (l - min);
+ tmp[2] = l + (tmp[2] - l) * l / (l - min);
+ }
+ }
+ if (max > a)
+ {
+ if (max - l == 0.0)
+ {
+ tmp[0] = a;
+ tmp[1] = a;
+ tmp[2] = a;
+ }
+ else
+ {
+ tmp[0] = l + (tmp[0] - l) * (a - l) / (max - l);
+ tmp[1] = l + (tmp[1] - l) * (a - l) / (max - l);
+ tmp[2] = l + (tmp[2] - l) * (a - l) / (max - l);
+ }
+ }
+
+ dest[0] = tmp[0] * MASK + 0.5;
+ dest[1] = tmp[1] * MASK + 0.5;
+ dest[2] = tmp[2] * MASK + 0.5;
+}
+
+static void
+set_sat (comp4_t dest[3], comp4_t src[3], comp4_t sat)
+{
+ int id[3];
+ comp4_t min, max;
+
+ if (src[0] > src[1])
+ {
+ if (src[0] > src[2])
+ {
+ id[0] = 0;
+ if (src[1] > src[2])
+ {
+ id[1] = 1;
+ id[2] = 2;
+ }
+ else
+ {
+ id[1] = 2;
+ id[2] = 1;
+ }
+ }
+ else
+ {
+ id[0] = 2;
+ id[1] = 0;
+ id[2] = 1;
+ }
+ }
+ else
+ {
+ if (src[0] > src[2])
+ {
+ id[0] = 1;
+ id[1] = 0;
+ id[2] = 2;
+ }
+ else
+ {
+ id[2] = 0;
+ if (src[1] > src[2])
+ {
+ id[0] = 1;
+ id[1] = 2;
+ }
+ else
+ {
+ id[0] = 2;
+ id[1] = 1;
+ }
+ }
+ }
+
+ max = dest[id[0]];
+ min = dest[id[2]];
+ if (max > min)
+ {
+ dest[id[1]] = (dest[id[1]] - min) * sat / (max - min);
+ dest[id[0]] = sat;
+ dest[id[2]] = 0;
+ }
+ else
+ {
+ dest[0] = dest[1] = dest[2] = 0;
+ }
+}
+
+/*
+ * Hue:
+ * B(Cb, Cs) = set_lum (set_sat (Cs, SAT (Cb)), LUM (Cb))
+ */
+static inline void
+blend_hsl_hue (comp4_t c[3],
+ comp4_t dc[3],
+ comp4_t da,
+ comp4_t sc[3],
+ comp4_t sa)
+{
+ c[0] = sc[0] * da;
+ c[1] = sc[1] * da;
+ c[2] = sc[2] * da;
+ set_sat (c, c, SAT (dc) * sa);
+ set_lum (c, c, sa * da, LUM (dc) * sa);
+}
+
+PDF_NON_SEPARABLE_BLEND_MODE (hsl_hue)
+
+/*
+ * Saturation:
+ * B(Cb, Cs) = set_lum (set_sat (Cb, SAT (Cs)), LUM (Cb))
+ */
+static inline void
+blend_hsl_saturation (comp4_t c[3],
+ comp4_t dc[3],
+ comp4_t da,
+ comp4_t sc[3],
+ comp4_t sa)
+{
+ c[0] = dc[0] * sa;
+ c[1] = dc[1] * sa;
+ c[2] = dc[2] * sa;
+ set_sat (c, c, SAT (sc) * da);
+ set_lum (c, c, sa * da, LUM (dc) * sa);
+}
+
+PDF_NON_SEPARABLE_BLEND_MODE (hsl_saturation)
+
+/*
+ * Color:
+ * B(Cb, Cs) = set_lum (Cs, LUM (Cb))
+ */
+static inline void
+blend_hsl_color (comp4_t c[3],
+ comp4_t dc[3],
+ comp4_t da,
+ comp4_t sc[3],
+ comp4_t sa)
+{
+ c[0] = sc[0] * da;
+ c[1] = sc[1] * da;
+ c[2] = sc[2] * da;
+ set_lum (c, c, sa * da, LUM (dc) * sa);
+}
+
+PDF_NON_SEPARABLE_BLEND_MODE (hsl_color)
+
+/*
+ * Luminosity:
+ * B(Cb, Cs) = set_lum (Cb, LUM (Cs))
+ */
+static inline void
+blend_hsl_luminosity (comp4_t c[3],
+ comp4_t dc[3],
+ comp4_t da,
+ comp4_t sc[3],
+ comp4_t sa)
+{
+ c[0] = dc[0] * sa;
+ c[1] = dc[1] * sa;
+ c[2] = dc[2] * sa;
+ set_lum (c, c, sa * da, LUM (sc) * da);
+}
+
+PDF_NON_SEPARABLE_BLEND_MODE (hsl_luminosity)
+
+#undef SAT
+#undef LUM
+#undef CH_MAX
+#undef CH_MIN
+#undef PDF_NON_SEPARABLE_BLEND_MODE
+
+/* Overlay
+ *
+ * All of the disjoint composing functions
+ *
+ * The four entries in the first column indicate what source contributions
+ * come from each of the four areas of the picture -- areas covered by neither
+ * A nor B, areas covered only by A, areas covered only by B and finally
+ * areas covered by both A and B.
+ *
+ * Disjoint Conjoint
+ * Fa Fb Fa Fb
+ * (0,0,0,0) 0 0 0 0
+ * (0,A,0,A) 1 0 1 0
+ * (0,0,B,B) 0 1 0 1
+ * (0,A,B,A) 1 min((1-a)/b,1) 1 max(1-a/b,0)
+ * (0,A,B,B) min((1-b)/a,1) 1 max(1-b/a,0) 1
+ * (0,0,0,A) max(1-(1-b)/a,0) 0 min(1,b/a) 0
+ * (0,0,0,B) 0 max(1-(1-a)/b,0) 0 min(a/b,1)
+ * (0,A,0,0) min(1,(1-b)/a) 0 max(1-b/a,0) 0
+ * (0,0,B,0) 0 min(1,(1-a)/b) 0 max(1-a/b,0)
+ * (0,0,B,A) max(1-(1-b)/a,0) min(1,(1-a)/b) min(1,b/a) max(1-a/b,0)
+ * (0,A,0,B) min(1,(1-b)/a) max(1-(1-a)/b,0) max(1-b/a,0) min(1,a/b)
+ * (0,A,B,0) min(1,(1-b)/a) min(1,(1-a)/b) max(1-b/a,0) max(1-a/b,0)
+ */
+
+#define COMBINE_A_OUT 1
+#define COMBINE_A_IN 2
+#define COMBINE_B_OUT 4
+#define COMBINE_B_IN 8
+
+#define COMBINE_CLEAR 0
+#define COMBINE_A (COMBINE_A_OUT | COMBINE_A_IN)
+#define COMBINE_B (COMBINE_B_OUT | COMBINE_B_IN)
+#define COMBINE_A_OVER (COMBINE_A_OUT | COMBINE_B_OUT | COMBINE_A_IN)
+#define COMBINE_B_OVER (COMBINE_A_OUT | COMBINE_B_OUT | COMBINE_B_IN)
+#define COMBINE_A_ATOP (COMBINE_B_OUT | COMBINE_A_IN)
+#define COMBINE_B_ATOP (COMBINE_A_OUT | COMBINE_B_IN)
+#define COMBINE_XOR (COMBINE_A_OUT | COMBINE_B_OUT)
+
+/* portion covered by a but not b */
+static comp1_t
+combine_disjoint_out_part (comp1_t a, comp1_t b)
+{
+ /* min (1, (1-b) / a) */
+
+ b = ~b; /* 1 - b */
+ if (b >= a) /* 1 - b >= a -> (1-b)/a >= 1 */
+ return MASK; /* 1 */
+ return DIV_UNc (b, a); /* (1-b) / a */
+}
+
+/* portion covered by both a and b */
+static comp1_t
+combine_disjoint_in_part (comp1_t a, comp1_t b)
+{
+ /* max (1-(1-b)/a,0) */
+ /* = - min ((1-b)/a - 1, 0) */
+ /* = 1 - min (1, (1-b)/a) */
+
+ b = ~b; /* 1 - b */
+ if (b >= a) /* 1 - b >= a -> (1-b)/a >= 1 */
+ return 0; /* 1 - 1 */
+ return ~DIV_UNc(b, a); /* 1 - (1-b) / a */
+}
+
+/* portion covered by a but not b */
+static comp1_t
+combine_conjoint_out_part (comp1_t a, comp1_t b)
+{
+ /* max (1-b/a,0) */
+ /* = 1-min(b/a,1) */
+
+ /* min (1, (1-b) / a) */
+
+ if (b >= a) /* b >= a -> b/a >= 1 */
+ return 0x00; /* 0 */
+ return ~DIV_UNc(b, a); /* 1 - b/a */
+}
+
+/* portion covered by both a and b */
+static comp1_t
+combine_conjoint_in_part (comp1_t a, comp1_t b)
+{
+ /* min (1,b/a) */
+
+ if (b >= a) /* b >= a -> b/a >= 1 */
+ return MASK; /* 1 */
+ return DIV_UNc (b, a); /* b/a */
+}
+
+#define GET_COMP(v, i) ((comp2_t) (comp1_t) ((v) >> i))
+
+#define ADD(x, y, i, t) \
+ ((t) = GET_COMP (x, i) + GET_COMP (y, i), \
+ (comp4_t) ((comp1_t) ((t) | (0 - ((t) >> G_SHIFT)))) << (i))
+
+#define GENERIC(x, y, i, ax, ay, t, u, v) \
+ ((t) = (MUL_UNc (GET_COMP (y, i), ay, (u)) + \
+ MUL_UNc (GET_COMP (x, i), ax, (v))), \
+ (comp4_t) ((comp1_t) ((t) | \
+ (0 - ((t) >> G_SHIFT)))) << (i))
+
+static void
+combine_disjoint_general_u (comp4_t * dest,
+ const comp4_t *src,
+ const comp4_t *mask,
+ int width,
+ comp1_t combine)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t s = combine_mask (src, mask, i);
+ comp4_t d = *(dest + i);
+ comp4_t m, n, o, p;
+ comp2_t Fa, Fb, t, u, v;
+ comp1_t sa = s >> A_SHIFT;
+ comp1_t da = d >> A_SHIFT;
+
+ switch (combine & COMBINE_A)
+ {
+ default:
+ Fa = 0;
+ break;
+
+ case COMBINE_A_OUT:
+ Fa = combine_disjoint_out_part (sa, da);
+ break;
+
+ case COMBINE_A_IN:
+ Fa = combine_disjoint_in_part (sa, da);
+ break;
+
+ case COMBINE_A:
+ Fa = MASK;
+ break;
+ }
+
+ switch (combine & COMBINE_B)
+ {
+ default:
+ Fb = 0;
+ break;
+
+ case COMBINE_B_OUT:
+ Fb = combine_disjoint_out_part (da, sa);
+ break;
+
+ case COMBINE_B_IN:
+ Fb = combine_disjoint_in_part (da, sa);
+ break;
+
+ case COMBINE_B:
+ Fb = MASK;
+ break;
+ }
+ m = GENERIC (s, d, 0, Fa, Fb, t, u, v);
+ n = GENERIC (s, d, G_SHIFT, Fa, Fb, t, u, v);
+ o = GENERIC (s, d, R_SHIFT, Fa, Fb, t, u, v);
+ p = GENERIC (s, d, A_SHIFT, Fa, Fb, t, u, v);
+ s = m | n | o | p;
+ *(dest + i) = s;
+ }
+}
+
+static void
+combine_disjoint_over_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t s = combine_mask (src, mask, i);
+ comp2_t a = s >> A_SHIFT;
+
+ if (s != 0x00)
+ {
+ comp4_t d = *(dest + i);
+ a = combine_disjoint_out_part (d >> A_SHIFT, a);
+ UNcx4_MUL_UNc_ADD_UNcx4 (d, a, s);
+
+ *(dest + i) = d;
+ }
+ }
+}
+
+static void
+combine_disjoint_in_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_disjoint_general_u (dest, src, mask, width, COMBINE_A_IN);
+}
+
+static void
+combine_disjoint_in_reverse_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_disjoint_general_u (dest, src, mask, width, COMBINE_B_IN);
+}
+
+static void
+combine_disjoint_out_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_disjoint_general_u (dest, src, mask, width, COMBINE_A_OUT);
+}
+
+static void
+combine_disjoint_out_reverse_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_disjoint_general_u (dest, src, mask, width, COMBINE_B_OUT);
+}
+
+static void
+combine_disjoint_atop_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_disjoint_general_u (dest, src, mask, width, COMBINE_A_ATOP);
+}
+
+static void
+combine_disjoint_atop_reverse_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_disjoint_general_u (dest, src, mask, width, COMBINE_B_ATOP);
+}
+
+static void
+combine_disjoint_xor_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_disjoint_general_u (dest, src, mask, width, COMBINE_XOR);
+}
+
+static void
+combine_conjoint_general_u (comp4_t * dest,
+ const comp4_t *src,
+ const comp4_t *mask,
+ int width,
+ comp1_t combine)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t s = combine_mask (src, mask, i);
+ comp4_t d = *(dest + i);
+ comp4_t m, n, o, p;
+ comp2_t Fa, Fb, t, u, v;
+ comp1_t sa = s >> A_SHIFT;
+ comp1_t da = d >> A_SHIFT;
+
+ switch (combine & COMBINE_A)
+ {
+ default:
+ Fa = 0;
+ break;
+
+ case COMBINE_A_OUT:
+ Fa = combine_conjoint_out_part (sa, da);
+ break;
+
+ case COMBINE_A_IN:
+ Fa = combine_conjoint_in_part (sa, da);
+ break;
+
+ case COMBINE_A:
+ Fa = MASK;
+ break;
+ }
+
+ switch (combine & COMBINE_B)
+ {
+ default:
+ Fb = 0;
+ break;
+
+ case COMBINE_B_OUT:
+ Fb = combine_conjoint_out_part (da, sa);
+ break;
+
+ case COMBINE_B_IN:
+ Fb = combine_conjoint_in_part (da, sa);
+ break;
+
+ case COMBINE_B:
+ Fb = MASK;
+ break;
+ }
+
+ m = GENERIC (s, d, 0, Fa, Fb, t, u, v);
+ n = GENERIC (s, d, G_SHIFT, Fa, Fb, t, u, v);
+ o = GENERIC (s, d, R_SHIFT, Fa, Fb, t, u, v);
+ p = GENERIC (s, d, A_SHIFT, Fa, Fb, t, u, v);
+
+ s = m | n | o | p;
+
+ *(dest + i) = s;
+ }
+}
+
+static void
+combine_conjoint_over_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_conjoint_general_u (dest, src, mask, width, COMBINE_A_OVER);
+}
+
+static void
+combine_conjoint_over_reverse_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_conjoint_general_u (dest, src, mask, width, COMBINE_B_OVER);
+}
+
+static void
+combine_conjoint_in_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_conjoint_general_u (dest, src, mask, width, COMBINE_A_IN);
+}
+
+static void
+combine_conjoint_in_reverse_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_conjoint_general_u (dest, src, mask, width, COMBINE_B_IN);
+}
+
+static void
+combine_conjoint_out_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_conjoint_general_u (dest, src, mask, width, COMBINE_A_OUT);
+}
+
+static void
+combine_conjoint_out_reverse_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_conjoint_general_u (dest, src, mask, width, COMBINE_B_OUT);
+}
+
+static void
+combine_conjoint_atop_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_conjoint_general_u (dest, src, mask, width, COMBINE_A_ATOP);
+}
+
+static void
+combine_conjoint_atop_reverse_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_conjoint_general_u (dest, src, mask, width, COMBINE_B_ATOP);
+}
+
+static void
+combine_conjoint_xor_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_conjoint_general_u (dest, src, mask, width, COMBINE_XOR);
+}
+
+/************************************************************************/
+/*********************** Per Channel functions **************************/
+/************************************************************************/
+
+static void
+combine_clear_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ memset (dest, 0, width * sizeof(comp4_t));
+}
+
+static void
+combine_src_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t s = *(src + i);
+ comp4_t m = *(mask + i);
+
+ combine_mask_value_ca (&s, &m);
+
+ *(dest + i) = s;
+ }
+}
+
+static void
+combine_over_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t s = *(src + i);
+ comp4_t m = *(mask + i);
+ comp4_t a;
+
+ combine_mask_ca (&s, &m);
+
+ a = ~m;
+ if (a)
+ {
+ comp4_t d = *(dest + i);
+ UNcx4_MUL_UNcx4_ADD_UNcx4 (d, a, s);
+ s = d;
+ }
+
+ *(dest + i) = s;
+ }
+}
+
+static void
+combine_over_reverse_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t d = *(dest + i);
+ comp4_t a = ~d >> A_SHIFT;
+
+ if (a)
+ {
+ comp4_t s = *(src + i);
+ comp4_t m = *(mask + i);
+
+ UNcx4_MUL_UNcx4 (s, m);
+ UNcx4_MUL_UNc_ADD_UNcx4 (s, a, d);
+
+ *(dest + i) = s;
+ }
+ }
+}
+
+static void
+combine_in_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t d = *(dest + i);
+ comp2_t a = d >> A_SHIFT;
+ comp4_t s = 0;
+
+ if (a)
+ {
+ comp4_t m = *(mask + i);
+
+ s = *(src + i);
+ combine_mask_value_ca (&s, &m);
+
+ if (a != MASK)
+ UNcx4_MUL_UNc (s, a);
+ }
+
+ *(dest + i) = s;
+ }
+}
+
+static void
+combine_in_reverse_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t s = *(src + i);
+ comp4_t m = *(mask + i);
+ comp4_t a;
+
+ combine_mask_alpha_ca (&s, &m);
+
+ a = m;
+ if (a != ~0)
+ {
+ comp4_t d = 0;
+
+ if (a)
+ {
+ d = *(dest + i);
+ UNcx4_MUL_UNcx4 (d, a);
+ }
+
+ *(dest + i) = d;
+ }
+ }
+}
+
+static void
+combine_out_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t d = *(dest + i);
+ comp2_t a = ~d >> A_SHIFT;
+ comp4_t s = 0;
+
+ if (a)
+ {
+ comp4_t m = *(mask + i);
+
+ s = *(src + i);
+ combine_mask_value_ca (&s, &m);
+
+ if (a != MASK)
+ UNcx4_MUL_UNc (s, a);
+ }
+
+ *(dest + i) = s;
+ }
+}
+
+static void
+combine_out_reverse_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t s = *(src + i);
+ comp4_t m = *(mask + i);
+ comp4_t a;
+
+ combine_mask_alpha_ca (&s, &m);
+
+ a = ~m;
+ if (a != ~0)
+ {
+ comp4_t d = 0;
+
+ if (a)
+ {
+ d = *(dest + i);
+ UNcx4_MUL_UNcx4 (d, a);
+ }
+
+ *(dest + i) = d;
+ }
+ }
+}
+
+static void
+combine_atop_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t d = *(dest + i);
+ comp4_t s = *(src + i);
+ comp4_t m = *(mask + i);
+ comp4_t ad;
+ comp2_t as = d >> A_SHIFT;
+
+ combine_mask_ca (&s, &m);
+
+ ad = ~m;
+
+ UNcx4_MUL_UNcx4_ADD_UNcx4_MUL_UNc (d, ad, s, as);
+
+ *(dest + i) = d;
+ }
+}
+
+static void
+combine_atop_reverse_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t d = *(dest + i);
+ comp4_t s = *(src + i);
+ comp4_t m = *(mask + i);
+ comp4_t ad;
+ comp2_t as = ~d >> A_SHIFT;
+
+ combine_mask_ca (&s, &m);
+
+ ad = m;
+
+ UNcx4_MUL_UNcx4_ADD_UNcx4_MUL_UNc (d, ad, s, as);
+
+ *(dest + i) = d;
+ }
+}
+
+static void
+combine_xor_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t d = *(dest + i);
+ comp4_t s = *(src + i);
+ comp4_t m = *(mask + i);
+ comp4_t ad;
+ comp2_t as = ~d >> A_SHIFT;
+
+ combine_mask_ca (&s, &m);
+
+ ad = ~m;
+
+ UNcx4_MUL_UNcx4_ADD_UNcx4_MUL_UNc (d, ad, s, as);
+
+ *(dest + i) = d;
+ }
+}
+
+static void
+combine_add_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t s = *(src + i);
+ comp4_t m = *(mask + i);
+ comp4_t d = *(dest + i);
+
+ combine_mask_value_ca (&s, &m);
+
+ UNcx4_ADD_UNcx4 (d, s);
+
+ *(dest + i) = d;
+ }
+}
+
+static void
+combine_saturate_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t s, d;
+ comp2_t sa, sr, sg, sb, da;
+ comp2_t t, u, v;
+ comp4_t m, n, o, p;
+
+ d = *(dest + i);
+ s = *(src + i);
+ m = *(mask + i);
+
+ combine_mask_ca (&s, &m);
+
+ sa = (m >> A_SHIFT);
+ sr = (m >> R_SHIFT) & MASK;
+ sg = (m >> G_SHIFT) & MASK;
+ sb = m & MASK;
+ da = ~d >> A_SHIFT;
+
+ if (sb <= da)
+ m = ADD (s, d, 0, t);
+ else
+ m = GENERIC (s, d, 0, (da << G_SHIFT) / sb, MASK, t, u, v);
+
+ if (sg <= da)
+ n = ADD (s, d, G_SHIFT, t);
+ else
+ n = GENERIC (s, d, G_SHIFT, (da << G_SHIFT) / sg, MASK, t, u, v);
+
+ if (sr <= da)
+ o = ADD (s, d, R_SHIFT, t);
+ else
+ o = GENERIC (s, d, R_SHIFT, (da << G_SHIFT) / sr, MASK, t, u, v);
+
+ if (sa <= da)
+ p = ADD (s, d, A_SHIFT, t);
+ else
+ p = GENERIC (s, d, A_SHIFT, (da << G_SHIFT) / sa, MASK, t, u, v);
+
+ *(dest + i) = m | n | o | p;
+ }
+}
+
+static void
+combine_disjoint_general_ca (comp4_t * dest,
+ const comp4_t *src,
+ const comp4_t *mask,
+ int width,
+ comp1_t combine)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t s, d;
+ comp4_t m, n, o, p;
+ comp4_t Fa, Fb;
+ comp2_t t, u, v;
+ comp4_t sa;
+ comp1_t da;
+
+ s = *(src + i);
+ m = *(mask + i);
+ d = *(dest + i);
+ da = d >> A_SHIFT;
+
+ combine_mask_ca (&s, &m);
+
+ sa = m;
+
+ switch (combine & COMBINE_A)
+ {
+ default:
+ Fa = 0;
+ break;
+
+ case COMBINE_A_OUT:
+ m = (comp4_t)combine_disjoint_out_part ((comp1_t) (sa >> 0), da);
+ n = (comp4_t)combine_disjoint_out_part ((comp1_t) (sa >> G_SHIFT), da) << G_SHIFT;
+ o = (comp4_t)combine_disjoint_out_part ((comp1_t) (sa >> R_SHIFT), da) << R_SHIFT;
+ p = (comp4_t)combine_disjoint_out_part ((comp1_t) (sa >> A_SHIFT), da) << A_SHIFT;
+ Fa = m | n | o | p;
+ break;
+
+ case COMBINE_A_IN:
+ m = (comp4_t)combine_disjoint_in_part ((comp1_t) (sa >> 0), da);
+ n = (comp4_t)combine_disjoint_in_part ((comp1_t) (sa >> G_SHIFT), da) << G_SHIFT;
+ o = (comp4_t)combine_disjoint_in_part ((comp1_t) (sa >> R_SHIFT), da) << R_SHIFT;
+ p = (comp4_t)combine_disjoint_in_part ((comp1_t) (sa >> A_SHIFT), da) << A_SHIFT;
+ Fa = m | n | o | p;
+ break;
+
+ case COMBINE_A:
+ Fa = ~0;
+ break;
+ }
+
+ switch (combine & COMBINE_B)
+ {
+ default:
+ Fb = 0;
+ break;
+
+ case COMBINE_B_OUT:
+ m = (comp4_t)combine_disjoint_out_part (da, (comp1_t) (sa >> 0));
+ n = (comp4_t)combine_disjoint_out_part (da, (comp1_t) (sa >> G_SHIFT)) << G_SHIFT;
+ o = (comp4_t)combine_disjoint_out_part (da, (comp1_t) (sa >> R_SHIFT)) << R_SHIFT;
+ p = (comp4_t)combine_disjoint_out_part (da, (comp1_t) (sa >> A_SHIFT)) << A_SHIFT;
+ Fb = m | n | o | p;
+ break;
+
+ case COMBINE_B_IN:
+ m = (comp4_t)combine_disjoint_in_part (da, (comp1_t) (sa >> 0));
+ n = (comp4_t)combine_disjoint_in_part (da, (comp1_t) (sa >> G_SHIFT)) << G_SHIFT;
+ o = (comp4_t)combine_disjoint_in_part (da, (comp1_t) (sa >> R_SHIFT)) << R_SHIFT;
+ p = (comp4_t)combine_disjoint_in_part (da, (comp1_t) (sa >> A_SHIFT)) << A_SHIFT;
+ Fb = m | n | o | p;
+ break;
+
+ case COMBINE_B:
+ Fb = ~0;
+ break;
+ }
+ m = GENERIC (s, d, 0, GET_COMP (Fa, 0), GET_COMP (Fb, 0), t, u, v);
+ n = GENERIC (s, d, G_SHIFT, GET_COMP (Fa, G_SHIFT), GET_COMP (Fb, G_SHIFT), t, u, v);
+ o = GENERIC (s, d, R_SHIFT, GET_COMP (Fa, R_SHIFT), GET_COMP (Fb, R_SHIFT), t, u, v);
+ p = GENERIC (s, d, A_SHIFT, GET_COMP (Fa, A_SHIFT), GET_COMP (Fb, A_SHIFT), t, u, v);
+
+ s = m | n | o | p;
+
+ *(dest + i) = s;
+ }
+}
+
+static void
+combine_disjoint_over_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_disjoint_general_ca (dest, src, mask, width, COMBINE_A_OVER);
+}
+
+static void
+combine_disjoint_in_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_disjoint_general_ca (dest, src, mask, width, COMBINE_A_IN);
+}
+
+static void
+combine_disjoint_in_reverse_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_disjoint_general_ca (dest, src, mask, width, COMBINE_B_IN);
+}
+
+static void
+combine_disjoint_out_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_disjoint_general_ca (dest, src, mask, width, COMBINE_A_OUT);
+}
+
+static void
+combine_disjoint_out_reverse_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_disjoint_general_ca (dest, src, mask, width, COMBINE_B_OUT);
+}
+
+static void
+combine_disjoint_atop_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_disjoint_general_ca (dest, src, mask, width, COMBINE_A_ATOP);
+}
+
+static void
+combine_disjoint_atop_reverse_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_disjoint_general_ca (dest, src, mask, width, COMBINE_B_ATOP);
+}
+
+static void
+combine_disjoint_xor_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_disjoint_general_ca (dest, src, mask, width, COMBINE_XOR);
+}
+
+static void
+combine_conjoint_general_ca (comp4_t * dest,
+ const comp4_t *src,
+ const comp4_t *mask,
+ int width,
+ comp1_t combine)
+{
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ comp4_t s, d;
+ comp4_t m, n, o, p;
+ comp4_t Fa, Fb;
+ comp2_t t, u, v;
+ comp4_t sa;
+ comp1_t da;
+
+ s = *(src + i);
+ m = *(mask + i);
+ d = *(dest + i);
+ da = d >> A_SHIFT;
+
+ combine_mask_ca (&s, &m);
+
+ sa = m;
+
+ switch (combine & COMBINE_A)
+ {
+ default:
+ Fa = 0;
+ break;
+
+ case COMBINE_A_OUT:
+ m = (comp4_t)combine_conjoint_out_part ((comp1_t) (sa >> 0), da);
+ n = (comp4_t)combine_conjoint_out_part ((comp1_t) (sa >> G_SHIFT), da) << G_SHIFT;
+ o = (comp4_t)combine_conjoint_out_part ((comp1_t) (sa >> R_SHIFT), da) << R_SHIFT;
+ p = (comp4_t)combine_conjoint_out_part ((comp1_t) (sa >> A_SHIFT), da) << A_SHIFT;
+ Fa = m | n | o | p;
+ break;
+
+ case COMBINE_A_IN:
+ m = (comp4_t)combine_conjoint_in_part ((comp1_t) (sa >> 0), da);
+ n = (comp4_t)combine_conjoint_in_part ((comp1_t) (sa >> G_SHIFT), da) << G_SHIFT;
+ o = (comp4_t)combine_conjoint_in_part ((comp1_t) (sa >> R_SHIFT), da) << R_SHIFT;
+ p = (comp4_t)combine_conjoint_in_part ((comp1_t) (sa >> A_SHIFT), da) << A_SHIFT;
+ Fa = m | n | o | p;
+ break;
+
+ case COMBINE_A:
+ Fa = ~0;
+ break;
+ }
+
+ switch (combine & COMBINE_B)
+ {
+ default:
+ Fb = 0;
+ break;
+
+ case COMBINE_B_OUT:
+ m = (comp4_t)combine_conjoint_out_part (da, (comp1_t) (sa >> 0));
+ n = (comp4_t)combine_conjoint_out_part (da, (comp1_t) (sa >> G_SHIFT)) << G_SHIFT;
+ o = (comp4_t)combine_conjoint_out_part (da, (comp1_t) (sa >> R_SHIFT)) << R_SHIFT;
+ p = (comp4_t)combine_conjoint_out_part (da, (comp1_t) (sa >> A_SHIFT)) << A_SHIFT;
+ Fb = m | n | o | p;
+ break;
+
+ case COMBINE_B_IN:
+ m = (comp4_t)combine_conjoint_in_part (da, (comp1_t) (sa >> 0));
+ n = (comp4_t)combine_conjoint_in_part (da, (comp1_t) (sa >> G_SHIFT)) << G_SHIFT;
+ o = (comp4_t)combine_conjoint_in_part (da, (comp1_t) (sa >> R_SHIFT)) << R_SHIFT;
+ p = (comp4_t)combine_conjoint_in_part (da, (comp1_t) (sa >> A_SHIFT)) << A_SHIFT;
+ Fb = m | n | o | p;
+ break;
+
+ case COMBINE_B:
+ Fb = ~0;
+ break;
+ }
+ m = GENERIC (s, d, 0, GET_COMP (Fa, 0), GET_COMP (Fb, 0), t, u, v);
+ n = GENERIC (s, d, G_SHIFT, GET_COMP (Fa, G_SHIFT), GET_COMP (Fb, G_SHIFT), t, u, v);
+ o = GENERIC (s, d, R_SHIFT, GET_COMP (Fa, R_SHIFT), GET_COMP (Fb, R_SHIFT), t, u, v);
+ p = GENERIC (s, d, A_SHIFT, GET_COMP (Fa, A_SHIFT), GET_COMP (Fb, A_SHIFT), t, u, v);
+
+ s = m | n | o | p;
+
+ *(dest + i) = s;
+ }
+}
+
+static void
+combine_conjoint_over_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_conjoint_general_ca (dest, src, mask, width, COMBINE_A_OVER);
+}
+
+static void
+combine_conjoint_over_reverse_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_conjoint_general_ca (dest, src, mask, width, COMBINE_B_OVER);
+}
+
+static void
+combine_conjoint_in_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_conjoint_general_ca (dest, src, mask, width, COMBINE_A_IN);
+}
+
+static void
+combine_conjoint_in_reverse_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_conjoint_general_ca (dest, src, mask, width, COMBINE_B_IN);
+}
+
+static void
+combine_conjoint_out_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_conjoint_general_ca (dest, src, mask, width, COMBINE_A_OUT);
+}
+
+static void
+combine_conjoint_out_reverse_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_conjoint_general_ca (dest, src, mask, width, COMBINE_B_OUT);
+}
+
+static void
+combine_conjoint_atop_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_conjoint_general_ca (dest, src, mask, width, COMBINE_A_ATOP);
+}
+
+static void
+combine_conjoint_atop_reverse_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_conjoint_general_ca (dest, src, mask, width, COMBINE_B_ATOP);
+}
+
+static void
+combine_conjoint_xor_ca (pixman_implementation_t *imp,
+ pixman_op_t op,
+ comp4_t * dest,
+ const comp4_t * src,
+ const comp4_t * mask,
+ int width)
+{
+ combine_conjoint_general_ca (dest, src, mask, width, COMBINE_XOR);
+}
+
+void
+_pixman_setup_combiner_functions_width (pixman_implementation_t *imp)
+{
+ /* Unified alpha */
+ imp->combine_width[PIXMAN_OP_CLEAR] = combine_clear;
+ imp->combine_width[PIXMAN_OP_SRC] = combine_src_u;
+ imp->combine_width[PIXMAN_OP_DST] = combine_dst;
+ imp->combine_width[PIXMAN_OP_OVER] = combine_over_u;
+ imp->combine_width[PIXMAN_OP_OVER_REVERSE] = combine_over_reverse_u;
+ imp->combine_width[PIXMAN_OP_IN] = combine_in_u;
+ imp->combine_width[PIXMAN_OP_IN_REVERSE] = combine_in_reverse_u;
+ imp->combine_width[PIXMAN_OP_OUT] = combine_out_u;
+ imp->combine_width[PIXMAN_OP_OUT_REVERSE] = combine_out_reverse_u;
+ imp->combine_width[PIXMAN_OP_ATOP] = combine_atop_u;
+ imp->combine_width[PIXMAN_OP_ATOP_REVERSE] = combine_atop_reverse_u;
+ imp->combine_width[PIXMAN_OP_XOR] = combine_xor_u;
+ imp->combine_width[PIXMAN_OP_ADD] = combine_add_u;
+ imp->combine_width[PIXMAN_OP_SATURATE] = combine_saturate_u;
+
+ /* Disjoint, unified */
+ imp->combine_width[PIXMAN_OP_DISJOINT_CLEAR] = combine_clear;
+ imp->combine_width[PIXMAN_OP_DISJOINT_SRC] = combine_src_u;
+ imp->combine_width[PIXMAN_OP_DISJOINT_DST] = combine_dst;
+ imp->combine_width[PIXMAN_OP_DISJOINT_OVER] = combine_disjoint_over_u;
+ imp->combine_width[PIXMAN_OP_DISJOINT_OVER_REVERSE] = combine_saturate_u;
+ imp->combine_width[PIXMAN_OP_DISJOINT_IN] = combine_disjoint_in_u;
+ imp->combine_width[PIXMAN_OP_DISJOINT_IN_REVERSE] = combine_disjoint_in_reverse_u;
+ imp->combine_width[PIXMAN_OP_DISJOINT_OUT] = combine_disjoint_out_u;
+ imp->combine_width[PIXMAN_OP_DISJOINT_OUT_REVERSE] = combine_disjoint_out_reverse_u;
+ imp->combine_width[PIXMAN_OP_DISJOINT_ATOP] = combine_disjoint_atop_u;
+ imp->combine_width[PIXMAN_OP_DISJOINT_ATOP_REVERSE] = combine_disjoint_atop_reverse_u;
+ imp->combine_width[PIXMAN_OP_DISJOINT_XOR] = combine_disjoint_xor_u;
+
+ /* Conjoint, unified */
+ imp->combine_width[PIXMAN_OP_CONJOINT_CLEAR] = combine_clear;
+ imp->combine_width[PIXMAN_OP_CONJOINT_SRC] = combine_src_u;
+ imp->combine_width[PIXMAN_OP_CONJOINT_DST] = combine_dst;
+ imp->combine_width[PIXMAN_OP_CONJOINT_OVER] = combine_conjoint_over_u;
+ imp->combine_width[PIXMAN_OP_CONJOINT_OVER_REVERSE] = combine_conjoint_over_reverse_u;
+ imp->combine_width[PIXMAN_OP_CONJOINT_IN] = combine_conjoint_in_u;
+ imp->combine_width[PIXMAN_OP_CONJOINT_IN_REVERSE] = combine_conjoint_in_reverse_u;
+ imp->combine_width[PIXMAN_OP_CONJOINT_OUT] = combine_conjoint_out_u;
+ imp->combine_width[PIXMAN_OP_CONJOINT_OUT_REVERSE] = combine_conjoint_out_reverse_u;
+ imp->combine_width[PIXMAN_OP_CONJOINT_ATOP] = combine_conjoint_atop_u;
+ imp->combine_width[PIXMAN_OP_CONJOINT_ATOP_REVERSE] = combine_conjoint_atop_reverse_u;
+ imp->combine_width[PIXMAN_OP_CONJOINT_XOR] = combine_conjoint_xor_u;
+
+ imp->combine_width[PIXMAN_OP_MULTIPLY] = combine_multiply_u;
+ imp->combine_width[PIXMAN_OP_SCREEN] = combine_screen_u;
+ imp->combine_width[PIXMAN_OP_OVERLAY] = combine_overlay_u;
+ imp->combine_width[PIXMAN_OP_DARKEN] = combine_darken_u;
+ imp->combine_width[PIXMAN_OP_LIGHTEN] = combine_lighten_u;
+ imp->combine_width[PIXMAN_OP_COLOR_DODGE] = combine_color_dodge_u;
+ imp->combine_width[PIXMAN_OP_COLOR_BURN] = combine_color_burn_u;
+ imp->combine_width[PIXMAN_OP_HARD_LIGHT] = combine_hard_light_u;
+ imp->combine_width[PIXMAN_OP_SOFT_LIGHT] = combine_soft_light_u;
+ imp->combine_width[PIXMAN_OP_DIFFERENCE] = combine_difference_u;
+ imp->combine_width[PIXMAN_OP_EXCLUSION] = combine_exclusion_u;
+ imp->combine_width[PIXMAN_OP_HSL_HUE] = combine_hsl_hue_u;
+ imp->combine_width[PIXMAN_OP_HSL_SATURATION] = combine_hsl_saturation_u;
+ imp->combine_width[PIXMAN_OP_HSL_COLOR] = combine_hsl_color_u;
+ imp->combine_width[PIXMAN_OP_HSL_LUMINOSITY] = combine_hsl_luminosity_u;
+
+ /* Component alpha combiners */
+ imp->combine_width_ca[PIXMAN_OP_CLEAR] = combine_clear_ca;
+ imp->combine_width_ca[PIXMAN_OP_SRC] = combine_src_ca;
+ /* dest */
+ imp->combine_width_ca[PIXMAN_OP_OVER] = combine_over_ca;
+ imp->combine_width_ca[PIXMAN_OP_OVER_REVERSE] = combine_over_reverse_ca;
+ imp->combine_width_ca[PIXMAN_OP_IN] = combine_in_ca;
+ imp->combine_width_ca[PIXMAN_OP_IN_REVERSE] = combine_in_reverse_ca;
+ imp->combine_width_ca[PIXMAN_OP_OUT] = combine_out_ca;
+ imp->combine_width_ca[PIXMAN_OP_OUT_REVERSE] = combine_out_reverse_ca;
+ imp->combine_width_ca[PIXMAN_OP_ATOP] = combine_atop_ca;
+ imp->combine_width_ca[PIXMAN_OP_ATOP_REVERSE] = combine_atop_reverse_ca;
+ imp->combine_width_ca[PIXMAN_OP_XOR] = combine_xor_ca;
+ imp->combine_width_ca[PIXMAN_OP_ADD] = combine_add_ca;
+ imp->combine_width_ca[PIXMAN_OP_SATURATE] = combine_saturate_ca;
+
+ /* Disjoint CA */
+ imp->combine_width_ca[PIXMAN_OP_DISJOINT_CLEAR] = combine_clear_ca;
+ imp->combine_width_ca[PIXMAN_OP_DISJOINT_SRC] = combine_src_ca;
+ imp->combine_width_ca[PIXMAN_OP_DISJOINT_DST] = combine_dst;
+ imp->combine_width_ca[PIXMAN_OP_DISJOINT_OVER] = combine_disjoint_over_ca;
+ imp->combine_width_ca[PIXMAN_OP_DISJOINT_OVER_REVERSE] = combine_saturate_ca;
+ imp->combine_width_ca[PIXMAN_OP_DISJOINT_IN] = combine_disjoint_in_ca;
+ imp->combine_width_ca[PIXMAN_OP_DISJOINT_IN_REVERSE] = combine_disjoint_in_reverse_ca;
+ imp->combine_width_ca[PIXMAN_OP_DISJOINT_OUT] = combine_disjoint_out_ca;
+ imp->combine_width_ca[PIXMAN_OP_DISJOINT_OUT_REVERSE] = combine_disjoint_out_reverse_ca;
+ imp->combine_width_ca[PIXMAN_OP_DISJOINT_ATOP] = combine_disjoint_atop_ca;
+ imp->combine_width_ca[PIXMAN_OP_DISJOINT_ATOP_REVERSE] = combine_disjoint_atop_reverse_ca;
+ imp->combine_width_ca[PIXMAN_OP_DISJOINT_XOR] = combine_disjoint_xor_ca;
+
+ /* Conjoint CA */
+ imp->combine_width_ca[PIXMAN_OP_CONJOINT_CLEAR] = combine_clear_ca;
+ imp->combine_width_ca[PIXMAN_OP_CONJOINT_SRC] = combine_src_ca;
+ imp->combine_width_ca[PIXMAN_OP_CONJOINT_DST] = combine_dst;
+ imp->combine_width_ca[PIXMAN_OP_CONJOINT_OVER] = combine_conjoint_over_ca;
+ imp->combine_width_ca[PIXMAN_OP_CONJOINT_OVER_REVERSE] = combine_conjoint_over_reverse_ca;
+ imp->combine_width_ca[PIXMAN_OP_CONJOINT_IN] = combine_conjoint_in_ca;
+ imp->combine_width_ca[PIXMAN_OP_CONJOINT_IN_REVERSE] = combine_conjoint_in_reverse_ca;
+ imp->combine_width_ca[PIXMAN_OP_CONJOINT_OUT] = combine_conjoint_out_ca;
+ imp->combine_width_ca[PIXMAN_OP_CONJOINT_OUT_REVERSE] = combine_conjoint_out_reverse_ca;
+ imp->combine_width_ca[PIXMAN_OP_CONJOINT_ATOP] = combine_conjoint_atop_ca;
+ imp->combine_width_ca[PIXMAN_OP_CONJOINT_ATOP_REVERSE] = combine_conjoint_atop_reverse_ca;
+ imp->combine_width_ca[PIXMAN_OP_CONJOINT_XOR] = combine_conjoint_xor_ca;
+
+ imp->combine_width_ca[PIXMAN_OP_MULTIPLY] = combine_multiply_ca;
+ imp->combine_width_ca[PIXMAN_OP_SCREEN] = combine_screen_ca;
+ imp->combine_width_ca[PIXMAN_OP_OVERLAY] = combine_overlay_ca;
+ imp->combine_width_ca[PIXMAN_OP_DARKEN] = combine_darken_ca;
+ imp->combine_width_ca[PIXMAN_OP_LIGHTEN] = combine_lighten_ca;
+ imp->combine_width_ca[PIXMAN_OP_COLOR_DODGE] = combine_color_dodge_ca;
+ imp->combine_width_ca[PIXMAN_OP_COLOR_BURN] = combine_color_burn_ca;
+ imp->combine_width_ca[PIXMAN_OP_HARD_LIGHT] = combine_hard_light_ca;
+ imp->combine_width_ca[PIXMAN_OP_SOFT_LIGHT] = combine_soft_light_ca;
+ imp->combine_width_ca[PIXMAN_OP_DIFFERENCE] = combine_difference_ca;
+ imp->combine_width_ca[PIXMAN_OP_EXCLUSION] = combine_exclusion_ca;
+
+ /* It is not clear that these make sense, so make them noops for now */
+ imp->combine_width_ca[PIXMAN_OP_HSL_HUE] = combine_dst;
+ imp->combine_width_ca[PIXMAN_OP_HSL_SATURATION] = combine_dst;
+ imp->combine_width_ca[PIXMAN_OP_HSL_COLOR] = combine_dst;
+ imp->combine_width_ca[PIXMAN_OP_HSL_LUMINOSITY] = combine_dst;
+}
+
diff --git a/xorg-server/xkeyboard-config/keycodes/xfree86 b/xorg-server/xkeyboard-config/keycodes/xfree86
index 7d4813e89..b2d3d394f 100644
--- a/xorg-server/xkeyboard-config/keycodes/xfree86
+++ b/xorg-server/xkeyboard-config/keycodes/xfree86
@@ -294,6 +294,9 @@ xkb_keycodes "basic" {
// MacBooks generate 0x65 for the lower brightness key
<II65> = 101;
+ // Required for apple/logitech_g15 keyboard
+ <II5D> = 93;
+
// Codes generated for scancodes 0x59-0x5f, 0x62-0x76
<K59> = 157; // <I1D>
<K5A> = 170; // <I2A>
@@ -352,7 +355,7 @@ xkb_keycodes "basic" {
// Other codes never generated. The XFree86 ddx never generates
// these codes.
// Thus we can use them as fake keys
- <MDSW> = 93; // <U5D>
+ <MDSW> = 8;
<LVL3> = 124; // <U7C>
<ALT> = 125; // <U7D>
<META> = 156; // <I1C>
diff --git a/xorg-server/xkeyboard-config/symbols/inet b/xorg-server/xkeyboard-config/symbols/inet
index c3366b1d8..00617a261 100644
--- a/xorg-server/xkeyboard-config/symbols/inet
+++ b/xorg-server/xkeyboard-config/symbols/inet
@@ -1217,7 +1217,7 @@ xkb_symbols "logitech_g15" {
key <K72> { [ XF86LaunchC ] };
key <K74> { [ XF86WWW ] };
key <K75> { [ XF86LaunchE ] };
- key <MDSW> { [ XF86Launch1 ] };
+ key <II5D> { [ XF86Launch1 ] };
key <NFER> { [ XF86Launch2 ] };
key <XFER> { [ XF86Launch8 ] };
};
@@ -1728,7 +1728,7 @@ xkb_symbols "apple" {
key <K5E> { [ F14 ] };
key <K5F> { [ F15 ] };
key <K6C> { [ XF86Eject ] };
- key <MDSW> { [ F16 ] };
+ key <II5D> { [ F16 ] };
key <KPEQ> { [ KP_Equal ] };
};