aboutsummaryrefslogtreecommitdiff
path: root/libxcb
diff options
context:
space:
mode:
Diffstat (limited to 'libxcb')
-rw-r--r--libxcb/configure.ac7
-rw-r--r--libxcb/doc/tutorial/index.html4
-rw-r--r--libxcb/src/Makefile.am72
-rw-r--r--libxcb/src/c-client.xsl1551
-rw-r--r--libxcb/src/c_client.py12
-rw-r--r--libxcb/src/makefile1
-rw-r--r--libxcb/src/xcb.h16
-rw-r--r--libxcb/src/xcb_conn.c4
-rw-r--r--libxcb/src/xcb_in.c110
-rw-r--r--libxcb/src/xcb_util.c27
-rw-r--r--libxcb/xcb-proto/autogen.sh12
-rw-r--r--libxcb/xcb-proto/doc/xml-xcb.txt30
-rw-r--r--libxcb/xcb-proto/src/Makefile.am1
-rw-r--r--libxcb/xcb-proto/src/ge.xml42
-rw-r--r--libxcb/xcb-proto/src/import.py66
-rw-r--r--libxcb/xcb-proto/src/size.py76
-rw-r--r--libxcb/xcb-proto/src/type.py74
-rw-r--r--libxcb/xcb-proto/src/xcb.xsd86
-rw-r--r--libxcb/xcb-proto/src/xf86vidmode.xml478
-rw-r--r--libxcb/xcb-proto/src/xkb.xml2759
20 files changed, 5340 insertions, 88 deletions
diff --git a/libxcb/configure.ac b/libxcb/configure.ac
index 5fb5c492c..c5f454bee 100644
--- a/libxcb/configure.ac
+++ b/libxcb/configure.ac
@@ -32,7 +32,7 @@ fi
AC_SUBST(HTML_CHECK_RESULT)
# Checks for pkg-config packages
-PKG_CHECK_MODULES(XCBPROTO, xcb-proto >= 1.5)
+PKG_CHECK_MODULES(XCBPROTO, xcb-proto >= 1.6)
NEEDED="pthread-stubs xau >= 0.99.2"
PKG_CHECK_MODULES(NEEDED, $NEEDED)
@@ -121,9 +121,8 @@ AC_PREREQ([2.59c], [], [AC_SUBST([htmldir], [m4_ifset([AC_PACKAGE_TARNAME],
XCB_CHECK_DOXYGEN()
case $host_os in
- # darwin has poll() but can't be used to poll character devices
- # darwin10 (SnowLeopard) should be tested as well once released
- darwin7*) ;; darwin8*) ;; darwin9*) ;;
+ # darwin has poll() but can't be used to poll character devices (atleast through SnowLeopard)
+ darwin*) ;;
*)
AC_CHECK_FUNC(poll, [AC_DEFINE(USE_POLL, 1, [poll() function is available])], )
;;
diff --git a/libxcb/doc/tutorial/index.html b/libxcb/doc/tutorial/index.html
index 58248079f..aa3ae1706 100644
--- a/libxcb/doc/tutorial/index.html
+++ b/libxcb/doc/tutorial/index.html
@@ -471,8 +471,6 @@ main ()
diff = end - start;
/* free var */
- for (i = 0; i < count; ++i)
- free (names[i]);
free (atoms);
free (cs);
@@ -494,6 +492,8 @@ main ()
printf ("ratio : %f\n", diff_x / diff);
free (atoms_x);
+ for (i = 0; i < count; ++i)
+ free (names[i]);
free (names);
XCloseDisplay (disp);
diff --git a/libxcb/src/Makefile.am b/libxcb/src/Makefile.am
index 8bec61387..f0bdeaa46 100644
--- a/libxcb/src/Makefile.am
+++ b/libxcb/src/Makefile.am
@@ -1,14 +1,8 @@
lib_LTLIBRARIES = libxcb.la
-EXTHEADERS = xproto.h \
- bigreq.h \
- xc_misc.h
EXTSOURCES = xproto.c \
bigreq.c \
xc_misc.c
-EXTENSION_XML = xproto.xml \
- bigreq.xml \
- xc_misc.xml
AM_CFLAGS = $(CWARNFLAGS) $(NEEDED_CFLAGS) $(XDMCP_CFLAGS)
libxcb_la_LIBADD = $(NEEDED_LIBS) $(XDMCP_LIBS)
@@ -30,9 +24,7 @@ XCB_LIBS = libxcb.la
# FIXME: find a way to autogenerate this from the XML files.
-EXTHEADERS += composite.h
EXTSOURCES += composite.c
-EXTENSION_XML += composite.xml
if BUILD_COMPOSITE
lib_LTLIBRARIES += libxcb-composite.la
libxcb_composite_la_LDFLAGS = -version-info 0:0:0 -no-undefined
@@ -40,9 +32,7 @@ libxcb_composite_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_composite_la_SOURCES = composite.c composite.h
endif
-EXTHEADERS += damage.h
EXTSOURCES += damage.c
-EXTENSION_XML += damage.xml
if BUILD_DAMAGE
lib_LTLIBRARIES += libxcb-damage.la
libxcb_damage_la_LDFLAGS = -version-info 0:0:0 -no-undefined
@@ -50,9 +40,7 @@ libxcb_damage_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_damage_la_SOURCES = damage.c damage.h
endif
-EXTHEADERS += dpms.h
EXTSOURCES += dpms.c
-EXTENSION_XML += dpms.xml
if BUILD_DPMS
lib_LTLIBRARIES += libxcb-dpms.la
libxcb_dpms_la_LDFLAGS = -version-info 0:0:0 -no-undefined
@@ -60,9 +48,7 @@ libxcb_dpms_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_dpms_la_SOURCES = dpms.c dpms.h
endif
-EXTHEADERS += dri2.h
EXTSOURCES += dri2.c
-EXTENSION_XML += dri2.xml
if BUILD_DRI2
lib_LTLIBRARIES += libxcb-dri2.la
libxcb_dri2_la_LDFLAGS = -version-info 0:0:0 -no-undefined
@@ -70,9 +56,7 @@ libxcb_dri2_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_dri2_la_SOURCES = dri2.c dri2.h
endif
-EXTHEADERS += glx.h
EXTSOURCES += glx.c
-EXTENSION_XML += glx.xml
if BUILD_GLX
lib_LTLIBRARIES += libxcb-glx.la
libxcb_glx_la_LDFLAGS = -version-info 0:0:0 -no-undefined
@@ -80,9 +64,7 @@ libxcb_glx_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_glx_la_SOURCES = glx.c glx.h
endif
-EXTHEADERS += randr.h
EXTSOURCES += randr.c
-EXTENSION_XML += randr.xml
if BUILD_RANDR
lib_LTLIBRARIES += libxcb-randr.la
libxcb_randr_la_LDFLAGS = -version-info 1:0:1 -no-undefined
@@ -90,9 +72,7 @@ libxcb_randr_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_randr_la_SOURCES = randr.c randr.h
endif
-EXTHEADERS += record.h
EXTSOURCES += record.c
-EXTENSION_XML += record.xml
if BUILD_RECORD
lib_LTLIBRARIES += libxcb-record.la
libxcb_record_la_LDFLAGS = -version-info 0:0:0 -no-undefined
@@ -100,9 +80,7 @@ libxcb_record_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_record_la_SOURCES = record.c record.h
endif
-EXTHEADERS += render.h
EXTSOURCES += render.c
-EXTENSION_XML += render.xml
if BUILD_RENDER
lib_LTLIBRARIES += libxcb-render.la
libxcb_render_la_LDFLAGS = -version-info 0:0:0 -no-undefined
@@ -110,9 +88,7 @@ libxcb_render_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_render_la_SOURCES = render.c render.h
endif
-EXTHEADERS += res.h
EXTSOURCES += res.c
-EXTENSION_XML += res.xml
if BUILD_RESOURCE
lib_LTLIBRARIES += libxcb-res.la
libxcb_res_la_LDFLAGS = -version-info 0:0:0 -no-undefined
@@ -120,9 +96,7 @@ libxcb_res_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_res_la_SOURCES = res.c res.h
endif
-EXTHEADERS += screensaver.h
EXTSOURCES += screensaver.c
-EXTENSION_XML += screensaver.xml
if BUILD_SCREENSAVER
lib_LTLIBRARIES += libxcb-screensaver.la
libxcb_screensaver_la_LDFLAGS = -version-info 0:0:0 -no-undefined
@@ -130,9 +104,7 @@ libxcb_screensaver_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_screensaver_la_SOURCES = screensaver.c screensaver.h
endif
-EXTHEADERS += shape.h
EXTSOURCES += shape.c
-EXTENSION_XML += shape.xml
if BUILD_SHAPE
lib_LTLIBRARIES += libxcb-shape.la
libxcb_shape_la_LDFLAGS = -version-info 0:0:0 -no-undefined
@@ -140,9 +112,7 @@ libxcb_shape_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_shape_la_SOURCES = shape.c shape.h
endif
-EXTHEADERS += shm.h
EXTSOURCES += shm.c
-EXTENSION_XML += shm.xml
if BUILD_SHM
lib_LTLIBRARIES += libxcb-shm.la
libxcb_shm_la_LDFLAGS = -version-info 0:0:0 -no-undefined
@@ -150,9 +120,7 @@ libxcb_shm_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_shm_la_SOURCES = shm.c shm.h
endif
-EXTHEADERS += sync.h
EXTSOURCES += sync.c
-EXTENSION_XML += sync.xml
if BUILD_SYNC
lib_LTLIBRARIES += libxcb-sync.la
libxcb_sync_la_LDFLAGS = -version-info 0:0:0 -no-undefined
@@ -160,9 +128,7 @@ libxcb_sync_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_sync_la_SOURCES = sync.c sync.h
endif
-EXTHEADERS += xevie.h
EXTSOURCES += xevie.c
-EXTENSION_XML += xevie.xml
if BUILD_XEVIE
lib_LTLIBRARIES += libxcb-xevie.la
libxcb_xevie_la_LDFLAGS = -version-info 0:0:0 -no-undefined
@@ -170,9 +136,7 @@ libxcb_xevie_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_xevie_la_SOURCES = xevie.c xevie.h
endif
-EXTHEADERS += xf86dri.h
EXTSOURCES += xf86dri.c
-EXTENSION_XML += xf86dri.xml
if BUILD_XFREE86_DRI
lib_LTLIBRARIES += libxcb-xf86dri.la
libxcb_xf86dri_la_LDFLAGS = -version-info 0:0:0 -no-undefined
@@ -180,9 +144,7 @@ libxcb_xf86dri_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_xf86dri_la_SOURCES = xf86dri.c xf86dri.h
endif
-EXTHEADERS += xfixes.h
EXTSOURCES += xfixes.c
-EXTENSION_XML += xfixes.xml
if BUILD_XFIXES
lib_LTLIBRARIES += libxcb-xfixes.la
libxcb_xfixes_la_LDFLAGS = -version-info 0:0:0 -no-undefined
@@ -190,9 +152,7 @@ libxcb_xfixes_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_xfixes_la_SOURCES = xfixes.c xfixes.h
endif
-EXTHEADERS += xinerama.h
EXTSOURCES += xinerama.c
-EXTENSION_XML += xinerama.xml
if BUILD_XINERAMA
lib_LTLIBRARIES += libxcb-xinerama.la
libxcb_xinerama_la_LDFLAGS = -version-info 0:0:0 -no-undefined
@@ -200,9 +160,7 @@ libxcb_xinerama_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_xinerama_la_SOURCES = xinerama.c xinerama.h
endif
-EXTHEADERS += xinput.h
EXTSOURCES += xinput.c
-EXTENSION_XML += xinput.xml
if BUILD_XINPUT
lib_LTLIBRARIES += libxcb-xinput.la
libxcb_xinput_la_LDFLAGS = -version-info 0:0:0 -no-undefined
@@ -210,9 +168,7 @@ libxcb_xinput_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_xinput_la_SOURCES = xinput.c xinput.h
endif
-EXTHEADERS += xprint.h
EXTSOURCES += xprint.c
-EXTENSION_XML += xprint.xml
if BUILD_XPRINT
lib_LTLIBRARIES += libxcb-xprint.la
libxcb_xprint_la_LDFLAGS = -version-info 0:0:0 -no-undefined
@@ -220,9 +176,7 @@ libxcb_xprint_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_xprint_la_SOURCES = xprint.c xprint.h
endif
-EXTHEADERS += xselinux.h
EXTSOURCES += xselinux.c
-EXTENSION_XML += xselinux.xml
if BUILD_SELINUX
lib_LTLIBRARIES += libxcb-xselinux.la
libxcb_xselinux_la_LDFLAGS = -version-info 0:0:0 -no-undefined
@@ -230,9 +184,7 @@ libxcb_xselinux_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_xselinux_la_SOURCES = xselinux.c xselinux.h
endif
-EXTHEADERS += xtest.h
EXTSOURCES += xtest.c
-EXTENSION_XML += xtest.xml
if BUILD_XTEST
lib_LTLIBRARIES += libxcb-xtest.la
libxcb_xtest_la_LDFLAGS = -version-info 0:0:0 -no-undefined
@@ -240,9 +192,7 @@ libxcb_xtest_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_xtest_la_SOURCES = xtest.c xtest.h
endif
-EXTHEADERS += xv.h
EXTSOURCES += xv.c
-EXTENSION_XML += xv.xml
if BUILD_XV
lib_LTLIBRARIES += libxcb-xv.la
libxcb_xv_la_LDFLAGS = -version-info 0:0:0 -no-undefined
@@ -250,9 +200,7 @@ libxcb_xv_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_xv_la_SOURCES = xv.c xv.h
endif
-EXTHEADERS += xvmc.h
EXTSOURCES += xvmc.c
-EXTENSION_XML += xvmc.xml
if BUILD_XVMC
lib_LTLIBRARIES += libxcb-xvmc.la
libxcb_xvmc_la_LDFLAGS = -version-info 0:0:0 -no-undefined
@@ -261,23 +209,13 @@ nodist_libxcb_xvmc_la_SOURCES = xvmc.c xvmc.h
endif
-
+EXTHEADERS=$(EXTSOURCES:.c=.h)
xcbinclude_HEADERS = xcb.h xcbext.h
nodist_xcbinclude_HEADERS = $(EXTHEADERS)
noinst_HEADERS = xcbint.h
-BUILT_SOURCES = $(EXTSOURCES) $(EXTHEADERS)
-CLEANFILES = $(EXTSOURCES) $(EXTHEADERS) $(EXTENSION_XML)
-
-$(EXTHEADERS) $(EXTSOURCES): c_client.py
-
-SUFFIXES = .xml
-
-.xml.h:
- $(PYTHON) $(srcdir)/c_client.py -p $(XCBPROTO_XCBPYTHONDIR) $(XCBPROTO_XCBINCLUDEDIR)/$<
-
-.xml.c:
- $(PYTHON) $(srcdir)/c_client.py -p $(XCBPROTO_XCBPYTHONDIR) $(XCBPROTO_XCBINCLUDEDIR)/$<
+BUILT_SOURCES = $(EXTSOURCES)
+CLEANFILES = $(EXTSOURCES) $(EXTHEADERS)
-$(EXTENSION_XML):
- $(LN_S) -f $(XCBPROTO_XCBINCLUDEDIR)/$@ $@
+$(EXTSOURCES): c_client.py
+ $(PYTHON) $(srcdir)/c_client.py -p $(XCBPROTO_XCBPYTHONDIR) $(XCBPROTO_XCBINCLUDEDIR)/$(@:.c=.xml)
diff --git a/libxcb/src/c-client.xsl b/libxcb/src/c-client.xsl
new file mode 100644
index 000000000..a15d824a1
--- /dev/null
+++ b/libxcb/src/c-client.xsl
@@ -0,0 +1,1551 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (C) 2004 Josh Triplett. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the authors or their
+institutions shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization from the authors.
+-->
+<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0"
+ xmlns:e="http://exslt.org/common"
+ xmlns:func="http://exslt.org/functions"
+ xmlns:str="http://exslt.org/strings"
+ xmlns:xcb="http://xcb.freedesktop.org"
+ extension-element-prefixes="func str xcb">
+
+ <xsl:output method="text" />
+
+ <xsl:strip-space elements="*" />
+
+ <!-- "header" or "source" -->
+ <xsl:param name="mode" />
+
+ <!-- Path to the core protocol descriptions. -->
+ <xsl:param name="base-path" />
+
+ <!-- Path to the extension protocol descriptions. -->
+ <xsl:param name="extension-path" select="$base-path" />
+
+ <xsl:variable name="h" select="$mode = 'header'" />
+ <xsl:variable name="c" select="$mode = 'source'" />
+
+ <xsl:variable name="need-string-h" select="//request/pad[@bytes != 1]" />
+
+ <!-- String used to indent lines of code. -->
+ <xsl:variable name="indent-string" select="' '" />
+
+ <xsl:variable name="ucase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
+ <xsl:variable name="lcase" select="'abcdefghijklmnopqrstuvwxyz'" />
+ <xsl:variable name="letters" select="concat($ucase, $lcase)" />
+ <xsl:variable name="digits" select="'0123456789'" />
+
+ <xsl:variable name="header" select="/xcb/@header" />
+ <xsl:variable name="ucase-header"
+ select="translate($header,$lcase,$ucase)" />
+
+ <xsl:variable name="ext" select="/xcb/@extension-name" />
+
+ <!-- Other protocol descriptions to search for types in, after checking the
+ current protocol description. -->
+ <xsl:variable name="search-path-rtf">
+ <xsl:for-each select="/xcb/import">
+ <path><xsl:value-of select="concat($extension-path, ., '.xml')" /></path>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="search-path" select="e:node-set($search-path-rtf)/path"/>
+
+ <xsl:variable name="root" select="/" />
+
+ <!-- First pass: Store everything in a variable. -->
+ <xsl:variable name="pass1-rtf">
+ <xsl:apply-templates select="/" mode="pass1" />
+ </xsl:variable>
+ <xsl:variable name="pass1" select="e:node-set($pass1-rtf)" />
+
+ <xsl:template match="xcb" mode="pass1">
+ <xcb>
+ <xsl:copy-of select="@*" />
+ <xsl:if test="$ext">
+ <constant type="xcb_extension_t" name="{xcb:xcb-prefix()}_id">
+ <xsl:attribute name="value">{ "<xsl:value-of select="@extension-xname" />" }</xsl:attribute>
+ </constant>
+ </xsl:if>
+ <xsl:apply-templates mode="pass1" />
+ </xcb>
+ </xsl:template>
+
+ <func:function name="xcb:xcb-prefix">
+ <xsl:param name="name" />
+ <func:result>
+ <xsl:text>xcb</xsl:text>
+ <xsl:if test="/xcb/@extension-name">
+ <xsl:text>_</xsl:text>
+ <xsl:choose>
+ <xsl:when test="/xcb/@extension-multiword = 'true' or /xcb/@extension-multiword = '1'">
+ <xsl:call-template name="camelcase-to-underscore">
+ <xsl:with-param name="camelcase" select="/xcb/@extension-name" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate(/xcb/@extension-name, $ucase, $lcase)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$name">
+ <xsl:text>_</xsl:text>
+ <xsl:call-template name="camelcase-to-underscore">
+ <xsl:with-param name="camelcase" select="$name" />
+ </xsl:call-template>
+ </xsl:if>
+ </func:result>
+ </func:function>
+
+ <func:function name="xcb:lowercase">
+ <xsl:param name="name" />
+ <func:result>
+ <xsl:call-template name="camelcase-to-underscore">
+ <xsl:with-param name="camelcase" select="$name" />
+ </xsl:call-template>
+ </func:result>
+ </func:function>
+
+ <func:function name="xcb:get-char-void">
+ <xsl:param name="name" />
+ <xsl:variable name="ctype" select="substring-before($name, '_t')" />
+ <func:result>
+ <xsl:choose>
+ <xsl:when test="$ctype = 'char' or $ctype = 'void' or $ctype = 'float' or $ctype = 'double'">
+ <xsl:value-of select="$ctype" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$name" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </func:result>
+ </func:function>
+
+ <func:function name="xcb:remove-void">
+ <xsl:param name="name" />
+ <xsl:variable name="ctype" select="substring-before($name, '_t')" />
+ <func:result>
+ <xsl:choose>
+ <xsl:when test="$ctype = 'char' or $ctype = 'void' or $ctype = 'float' or $ctype = 'double'">
+ <xsl:choose>
+ <xsl:when test="$ctype = 'void'">
+ <xsl:text>char</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$ctype" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$name" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </func:result>
+ </func:function>
+
+ <!-- split camel case into words and insert underscore -->
+ <xsl:template name="camelcase-to-underscore">
+ <xsl:param name="camelcase"/>
+ <xsl:choose>
+ <xsl:when test="$camelcase='CHAR2B' or $camelcase='INT64'
+ or $camelcase='FLOAT32' or $camelcase='FLOAT64'
+ or $camelcase='BOOL32' or $camelcase='STRING8'
+ or $camelcase='Family_DECnet'">
+ <xsl:value-of select="translate($camelcase, $ucase, $lcase)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="str:split($camelcase, '')">
+ <xsl:variable name="a" select="."/>
+ <xsl:variable name="b" select="following::*[1]"/>
+ <xsl:variable name="c" select="following::*[2]"/>
+ <xsl:value-of select="translate(., $ucase, $lcase)"/>
+ <xsl:if test="($b and contains($lcase, $a) and contains($ucase, $b))
+ or ($b and contains($digits, $a)
+ and contains($letters, $b))
+ or ($b and contains($letters, $a)
+ and contains($digits, $b))
+ or ($c and contains($ucase, $a)
+ and contains($ucase, $b)
+ and contains($lcase, $c))">
+ <xsl:text>_</xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Modify names that conflict with C++ keywords by prefixing them with an
+ underscore. If the name parameter is not specified, it defaults to the
+ value of the name attribute on the context node. -->
+ <xsl:template name="canonical-var-name">
+ <xsl:param name="name" select="@name" />
+ <xsl:if test="$name='new' or $name='delete'
+ or $name='class' or $name='operator'">
+ <xsl:text>_</xsl:text>
+ </xsl:if>
+ <xsl:value-of select="$name" />
+ </xsl:template>
+
+ <!-- List of core types, for use in canonical-type-name. -->
+ <xsl:variable name="core-types-rtf">
+ <type name="BOOL" newname="uint8" />
+ <type name="BYTE" newname="uint8" />
+ <type name="CARD8" newname="uint8" />
+ <type name="CARD16" newname="uint16" />
+ <type name="CARD32" newname="uint32" />
+ <type name="INT8" newname="int8" />
+ <type name="INT16" newname="int16" />
+ <type name="INT32" newname="int32" />
+
+ <type name="char" newname="char" />
+ <type name="void" newname="void" />
+ <type name="float" newname="float" />
+ <type name="double" newname="double" />
+ </xsl:variable>
+ <xsl:variable name="core-types" select="e:node-set($core-types-rtf)" />
+
+ <!--
+ Output the canonical name for a type. This will be
+ xcb_{extension-containing-type-if-any}_type, wherever the type is found in
+ the search path, or just type if not found. If the type parameter is not
+ specified, it defaults to the value of the type attribute on the context
+ node.
+ -->
+ <xsl:template name="canonical-type-name">
+ <xsl:param name="type" select="string(@type)" />
+
+ <xsl:variable name="is-unqualified" select="not(contains($type, ':'))"/>
+ <xsl:variable name="namespace" select="substring-before($type, ':')" />
+ <xsl:variable name="unqualified-type">
+ <xsl:choose>
+ <xsl:when test="$is-unqualified">
+ <xsl:value-of select="$type" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after($type, ':')" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="$is-unqualified and $core-types/type[@name=$type]">
+ <xsl:value-of select="$core-types/type[@name=$type]/@newname" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="type-definitions"
+ select="(/xcb|document($search-path)/xcb
+ )[$is-unqualified or @header=$namespace]
+ /*[((self::struct or self::union or self::enum
+ or self::xidtype or self::xidunion
+ or self::event or self::eventcopy
+ or self::error or self::errorcopy)
+ and @name=$unqualified-type)
+ or (self::typedef
+ and @newname=$unqualified-type)]" />
+ <xsl:choose>
+ <xsl:when test="count($type-definitions) = 1">
+ <xsl:for-each select="$type-definitions">
+ <xsl:value-of select="xcb:xcb-prefix($unqualified-type)" />
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="count($type-definitions) > 1">
+ <xsl:message terminate="yes">
+ <xsl:text>Multiple definitions of type "</xsl:text>
+ <xsl:value-of select="$type" />
+ <xsl:text>" found.</xsl:text>
+ <xsl:if test="$is-unqualified">
+ <xsl:for-each select="$type-definitions">
+ <xsl:text>
+ </xsl:text>
+ <xsl:value-of select="concat(/xcb/@header, ':', $type)" />
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:message>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">
+ <xsl:text>No definitions of type "</xsl:text>
+ <xsl:value-of select="$type" />
+ <xsl:text>" found</xsl:text>
+ <xsl:if test="$is-unqualified">
+ <xsl:text>, and it is not a known core type</xsl:text>
+ </xsl:if>
+ <xsl:text>.</xsl:text>
+ </xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Helper template for requests, that outputs the cookie type. The
+ parameter "request" must be the request node, which defaults to the
+ context node. -->
+ <xsl:template name="cookie-type">
+ <xsl:param name="request" select="." />
+ <xsl:choose>
+ <xsl:when test="$request/reply">
+ <xsl:value-of select="xcb:xcb-prefix($request/@name)" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>xcb_void</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>_cookie_t</xsl:text>
+ </xsl:template>
+
+ <xsl:template name="request-function">
+ <xsl:param name="checked" />
+ <xsl:param name="req" />
+ <function>
+ <xsl:attribute name="name">
+ <xsl:value-of select="xcb:xcb-prefix($req/@name)" />
+ <xsl:if test="$checked='true' and not($req/reply)">_checked</xsl:if>
+ <xsl:if test="$checked='false' and $req/reply">_unchecked</xsl:if>
+ </xsl:attribute>
+ <xsl:attribute name="type">
+ <xsl:call-template name="cookie-type">
+ <xsl:with-param name="request" select="$req" />
+ </xsl:call-template>
+ </xsl:attribute>
+ <doc>/**</doc>
+ <doc> * Delivers a request to the X server</doc>
+ <doc> * @param c The connection</doc>
+ <doc> * @return A cookie</doc>
+ <doc> *</doc>
+ <doc> * Delivers a request to the X server.</doc>
+ <doc> * </doc>
+ <xsl:if test="$checked='true' and not($req/reply)">
+ <doc> * This form can be used only if the request will not cause</doc>
+ <doc> * a reply to be generated. Any returned error will be</doc>
+ <doc> * saved for handling by xcb_request_check().</doc>
+ </xsl:if>
+ <xsl:if test="$checked='false' and $req/reply">
+ <doc> * This form can be used only if the request will cause</doc>
+ <doc> * a reply to be generated. Any returned error will be</doc>
+ <doc> * placed in the event queue.</doc>
+ </xsl:if>
+ <doc> */</doc>
+ <field type="xcb_connection_t *" name="c" />
+ <xsl:apply-templates select="$req/*[not(self::reply)]" mode="param" />
+ <do-request ref="{xcb:xcb-prefix($req/@name)}_request_t" opcode="{translate(xcb:xcb-prefix($req/@name), $lcase, $ucase)}"
+ checked="{$checked}">
+ <xsl:if test="$req/reply">
+ <xsl:attribute name="has-reply">true</xsl:attribute>
+ </xsl:if>
+ </do-request>
+ </function>
+ </xsl:template>
+
+ <xsl:template match="request" mode="pass1">
+ <xsl:variable name="req" select="." />
+ <xsl:if test="reply">
+ <struct name="{xcb:xcb-prefix(@name)}_cookie_t">
+ <field type="unsigned int" name="sequence" />
+ </struct>
+ </xsl:if>
+ <constant type="number" name="{xcb:xcb-prefix($req/@name)}" value="{$req/@opcode}" />
+ <struct name="{xcb:xcb-prefix(@name)}_request_t">
+ <field type="uint8_t" name="major_opcode" no-assign="true" />
+ <xsl:if test="$ext">
+ <field type="uint8_t" name="minor_opcode" no-assign="true" />
+ </xsl:if>
+ <xsl:apply-templates select="*[not(self::reply)]" mode="field" />
+ <middle>
+ <field type="uint16_t" name="length" no-assign="true" />
+ </middle>
+ </struct>
+ <xsl:call-template name="request-function">
+ <xsl:with-param name="checked" select="'true'" />
+ <xsl:with-param name="req" select="$req" />
+ </xsl:call-template>
+ <xsl:call-template name="request-function">
+ <xsl:with-param name="checked" select="'false'" />
+ <xsl:with-param name="req" select="$req" />
+ </xsl:call-template>
+ <xsl:if test="reply">
+ <struct name="{xcb:xcb-prefix(@name)}_reply_t">
+ <field type="uint8_t" name="response_type" />
+ <xsl:apply-templates select="reply/*" mode="field" />
+ <middle>
+ <field type="uint16_t" name="sequence" />
+ <field type="uint32_t" name="length" />
+ </middle>
+ </struct>
+ <iterator-functions ref="{xcb:xcb-prefix(@name)}" kind="_reply" />
+ <function type="{xcb:xcb-prefix(@name)}_reply_t *" name="{xcb:xcb-prefix(@name)}_reply">
+ <doc>/**</doc>
+ <doc> * Return the reply</doc>
+ <doc> * @param c The connection</doc>
+ <doc> * @param cookie The cookie</doc>
+ <doc> * @param e The xcb_generic_error_t supplied</doc>
+ <doc> *</doc>
+ <doc> * Returns the reply of the request asked by</doc>
+ <doc> * </doc>
+ <doc> * The parameter @p e supplied to this function must be NULL if</doc>
+ <doc> * <xsl:value-of select="xcb:xcb-prefix(@name)" />_unchecked(). is used.</doc>
+ <doc> * Otherwise, it stores the error if any.</doc>
+ <doc> *</doc>
+ <doc> * The returned value must be freed by the caller using free().</doc>
+ <doc> */</doc>
+ <field type="xcb_connection_t *" name="c" />
+ <field name="cookie">
+ <xsl:attribute name="type">
+ <xsl:call-template name="cookie-type" />
+ </xsl:attribute>
+ </field>
+ <field type="xcb_generic_error_t **" name="e" />
+ <l>return (<xsl:value-of select="xcb:xcb-prefix(@name)" />_reply_t *)<!--
+ --> xcb_wait_for_reply(c, cookie.sequence, e);</l>
+ </function>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="xidtype|xidunion" mode="pass1">
+ <typedef oldname="uint32_t" newname="{xcb:xcb-prefix(@name)}_t" />
+ <iterator ref="{xcb:xcb-prefix(@name)}" />
+ <iterator-functions ref="{xcb:xcb-prefix(@name)}" />
+ </xsl:template>
+
+ <xsl:template match="struct|union" mode="pass1">
+ <struct name="{xcb:xcb-prefix(@name)}_t">
+ <xsl:if test="self::union">
+ <xsl:attribute name="kind">union</xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="*" mode="field" />
+ </struct>
+ <iterator ref="{xcb:xcb-prefix(@name)}" />
+ <iterator-functions ref="{xcb:xcb-prefix(@name)}" />
+ </xsl:template>
+
+ <xsl:template match="event|eventcopy|error|errorcopy" mode="pass1">
+ <xsl:variable name="suffix">
+ <xsl:choose>
+ <xsl:when test="self::event|self::eventcopy">
+ <xsl:text>_event_t</xsl:text>
+ </xsl:when>
+ <xsl:when test="self::error|self::errorcopy">
+ <xsl:text>_error_t</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <constant type="number" name="{xcb:xcb-prefix(@name)}" value="{@number}" />
+ <xsl:choose>
+ <xsl:when test="self::event|self::error">
+ <struct name="{xcb:xcb-prefix(@name)}{$suffix}">
+ <field type="uint8_t" name="response_type" />
+ <xsl:if test="self::error">
+ <field type="uint8_t" name="error_code" />
+ </xsl:if>
+ <xsl:apply-templates select="*" mode="field" />
+ <xsl:if test="not(self::event and boolean(@no-sequence-number))">
+ <middle>
+ <field type="uint16_t" name="sequence" />
+ </middle>
+ </xsl:if>
+ </struct>
+ </xsl:when>
+ <xsl:when test="self::eventcopy|self::errorcopy">
+ <typedef newname="{xcb:xcb-prefix(@name)}{$suffix}">
+ <xsl:attribute name="oldname">
+ <xsl:call-template name="canonical-type-name">
+ <xsl:with-param name="type" select="@ref" />
+ </xsl:call-template>
+ <xsl:value-of select="$suffix" />
+ </xsl:attribute>
+ </typedef>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="typedef" mode="pass1">
+ <typedef>
+ <xsl:attribute name="oldname">
+ <xsl:call-template name="canonical-type-name">
+ <xsl:with-param name="type" select="@oldname" />
+ </xsl:call-template>
+ <xsl:text>_t</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="newname">
+ <xsl:call-template name="canonical-type-name">
+ <xsl:with-param name="type" select="@newname" />
+ </xsl:call-template>
+ <xsl:text>_t</xsl:text>
+ </xsl:attribute>
+ </typedef>
+ <iterator ref="{xcb:xcb-prefix(@newname)}" />
+ <iterator-functions ref="{xcb:xcb-prefix(@newname)}" />
+ </xsl:template>
+
+ <xsl:template match="enum" mode="pass1">
+ <enum name="{xcb:xcb-prefix(@name)}_t">
+ <xsl:for-each select="item">
+ <item name="{translate(xcb:xcb-prefix(concat(../@name, concat('_', @name))), $lcase, $ucase)}">
+ <xsl:copy-of select="*" />
+ </item>
+ </xsl:for-each>
+ </enum>
+ </xsl:template>
+
+ <!--
+ Templates for processing fields.
+ -->
+
+ <xsl:template match="pad" mode="field">
+ <xsl:copy-of select="." />
+ </xsl:template>
+
+ <xsl:template match="field|exprfield" mode="field">
+ <xsl:copy>
+ <xsl:attribute name="type">
+ <xsl:call-template name="canonical-type-name" />
+ <xsl:text>_t</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="name">
+ <xsl:call-template name="canonical-var-name" />
+ </xsl:attribute>
+ <xsl:copy-of select="*" />
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="list" mode="field">
+ <xsl:variable name="type"><!--
+ --><xsl:call-template name="canonical-type-name" />
+ <xsl:text>_t</xsl:text><!--
+ --></xsl:variable>
+ <list type="{$type}">
+ <xsl:attribute name="name">
+ <xsl:call-template name="canonical-var-name" />
+ </xsl:attribute>
+ <xsl:if test="not(parent::request) and node()
+ and not(.//*[not(self::value or self::op)])">
+ <xsl:attribute name="fixed">true</xsl:attribute>
+ </xsl:if>
+ <!-- Handle lists with no length expressions. -->
+ <xsl:if test="not(node())">
+ <xsl:choose>
+ <!-- In a request, refer to an implicit localparam for length. -->
+ <xsl:when test="parent::request">
+ <fieldref>
+ <xsl:value-of select="concat(@name, '_len')" />
+ </fieldref>
+ </xsl:when>
+ <!-- In a reply, use the length of the reply to determine the length
+ of the list. -->
+ <xsl:when test="parent::reply">
+ <op op="/">
+ <op op="&lt;&lt;">
+ <fieldref>length</fieldref>
+ <value>2</value>
+ </op>
+ <function-call name="sizeof">
+ <param><xsl:value-of select="$type" /></param>
+ </function-call>
+ </op>
+ </xsl:when>
+ <!-- Other cases generate an error. -->
+ <xsl:otherwise>
+ <xsl:message terminate="yes"><!--
+ -->Encountered a list with no length expresssion outside a<!--
+ --> request or reply.<!--
+ --></xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:copy-of select="*" />
+ </list>
+ </xsl:template>
+
+ <xsl:template match="valueparam" mode="field">
+ <field>
+ <xsl:attribute name="type">
+ <xsl:call-template name="canonical-type-name">
+ <xsl:with-param name="type" select="@value-mask-type" />
+ </xsl:call-template>
+ <xsl:text>_t</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="name">
+ <xsl:call-template name="canonical-var-name">
+ <xsl:with-param name="name" select="@value-mask-name" />
+ </xsl:call-template>
+ </xsl:attribute>
+ </field>
+ <list type="uint32_t">
+ <xsl:attribute name="name">
+ <xsl:call-template name="canonical-var-name">
+ <xsl:with-param name="name" select="@value-list-name" />
+ </xsl:call-template>
+ </xsl:attribute>
+ <function-call name="xcb_popcount">
+ <param>
+ <fieldref>
+ <xsl:call-template name="canonical-var-name">
+ <xsl:with-param name="name" select="@value-mask-name" />
+ </xsl:call-template>
+ </fieldref>
+ </param>
+ </function-call>
+ </list>
+ </xsl:template>
+
+ <xsl:template match="field" mode="param">
+ <field>
+ <xsl:attribute name="type">
+ <xsl:call-template name="canonical-type-name" />
+ <xsl:text>_t</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="name">
+ <xsl:call-template name="canonical-var-name" />
+ </xsl:attribute>
+ </field>
+ </xsl:template>
+
+ <xsl:template match="list" mode="param">
+ <!-- If no length expression is provided, use a CARD32 localfield. -->
+ <xsl:if test="not(node())">
+ <field type="uint32_t" name="{@name}_len" />
+ </xsl:if>
+ <field>
+ <xsl:variable name="ctype">
+ <xsl:call-template name="canonical-type-name" />
+ </xsl:variable>
+ <xsl:attribute name="type">
+ <xsl:text>const </xsl:text>
+ <xsl:call-template name="canonical-type-name" />
+ <xsl:if test="not($ctype='char') and not($ctype='void')">
+ <xsl:text>_t</xsl:text>
+ </xsl:if>
+ <xsl:text> *</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="name">
+ <xsl:call-template name="canonical-var-name" />
+ </xsl:attribute>
+ </field>
+ </xsl:template>
+
+ <xsl:template match="valueparam" mode="param">
+ <field>
+ <xsl:attribute name="type">
+ <xsl:call-template name="canonical-type-name">
+ <xsl:with-param name="type" select="@value-mask-type" />
+ </xsl:call-template>
+ <xsl:text>_t</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="name">
+ <xsl:call-template name="canonical-var-name">
+ <xsl:with-param name="name" select="@value-mask-name" />
+ </xsl:call-template>
+ </xsl:attribute>
+ </field>
+ <field type="const uint32_t *">
+ <xsl:attribute name="name">
+ <xsl:call-template name="canonical-var-name">
+ <xsl:with-param name="name" select="@value-list-name" />
+ </xsl:call-template>
+ </xsl:attribute>
+ </field>
+ </xsl:template>
+
+ <!-- Second pass: Process the variable. -->
+ <xsl:variable name="result-rtf">
+ <xsl:apply-templates select="$pass1/*" mode="pass2" />
+ </xsl:variable>
+ <xsl:variable name="result" select="e:node-set($result-rtf)" />
+
+ <xsl:template match="xcb" mode="pass2">
+ <xcb>
+ <xsl:copy-of select="@*" />
+ <xsl:apply-templates mode="pass2"
+ select="constant|enum|struct|typedef|iterator" />
+ <xsl:apply-templates mode="pass2"
+ select="function|iterator-functions" />
+ </xcb>
+ </xsl:template>
+
+ <!-- Generic rules for nodes that don't need further processing: copy node
+ with attributes, and recursively process the child nodes. -->
+ <xsl:template match="*" mode="pass2">
+ <xsl:copy>
+ <xsl:copy-of select="@*" />
+ <xsl:apply-templates mode="pass2" />
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="struct" mode="pass2">
+ <xsl:if test="@kind='union' and list[not(@fixed)]">
+ <xsl:message terminate="yes">Unions must be fixed length.</xsl:message>
+ </xsl:if>
+ <struct name="{@name}">
+ <xsl:if test="@kind">
+ <xsl:attribute name="kind">
+ <xsl:value-of select="@kind" />
+ </xsl:attribute>
+ </xsl:if>
+ <!-- FIXME: This should go by size, not number of fields. -->
+ <xsl:copy-of select="node()[not(self::middle)
+ and position() &lt; 3]" />
+ <xsl:if test="middle and (count(*[not(self::middle)]) &lt; 2)">
+ <pad bytes="{2 - count(*[not(self::middle)])}" />
+ </xsl:if>
+ <xsl:copy-of select="middle/*" />
+ <xsl:copy-of select="node()[not(self::middle) and (position() > 2)]" />
+ </struct>
+ </xsl:template>
+
+ <xsl:template match="do-request" mode="pass2">
+ <xsl:variable name="struct"
+ select="$pass1/xcb/struct[@name=current()/@ref]" />
+
+ <xsl:variable name="num-parts" select="(1+count($struct/list))*2" />
+
+ <l>static const xcb_protocol_request_t xcb_req = {</l>
+ <indent>
+ <l>/* count */ <xsl:value-of select="$num-parts" />,</l>
+ <l>/* ext */ <xsl:choose>
+ <xsl:when test="$ext">
+ <xsl:text>&amp;</xsl:text>
+ <xsl:value-of select="xcb:xcb-prefix()" />
+ <xsl:text>_id</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>,</l>
+ <l>/* opcode */ <xsl:value-of select="@opcode" />,</l>
+ <l>/* isvoid */ <xsl:value-of select="1-boolean(@has-reply)" /></l>
+ </indent>
+ <l>};</l>
+
+ <l />
+ <l>struct iovec xcb_parts[<xsl:value-of select="$num-parts+2" />];</l>
+ <l><xsl:value-of select="../@type" /> xcb_ret;</l>
+ <l><xsl:value-of select="@ref" /> xcb_out;</l>
+
+ <l />
+ <xsl:if test="not ($ext) and not($struct//*[(self::field or self::exprfield or self::pad)
+ and not(boolean(@no-assign))])">
+ <l>xcb_out.pad0 = 0;</l>
+ </xsl:if>
+ <xsl:apply-templates select="$struct//*[(self::field or self::exprfield or self::pad)
+ and not(boolean(@no-assign))]"
+ mode="assign" />
+
+ <l />
+ <l>xcb_parts[2].iov_base = (char *) &amp;xcb_out;</l>
+ <l>xcb_parts[2].iov_len = sizeof(xcb_out);</l>
+ <l>xcb_parts[3].iov_base = 0;</l>
+ <l>xcb_parts[3].iov_len = -xcb_parts[2].iov_len &amp; 3;</l>
+
+ <xsl:for-each select="$struct/list">
+ <l>xcb_parts[<xsl:value-of select="2 + position() * 2"/>].iov_base = (char *) <!--
+ --><xsl:value-of select="@name" />;</l>
+ <l>xcb_parts[<xsl:value-of select="2 + position() * 2"/>].iov_len = <!--
+ --><xsl:apply-templates mode="output-expression" />
+ <xsl:if test="not(@type = 'void_t')">
+ <xsl:text> * sizeof(</xsl:text>
+ <xsl:choose>
+ <xsl:when test="@type='char_t'">
+ <xsl:text>char</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@type" />
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>)</xsl:text>
+ </xsl:if>;</l>
+ <l>xcb_parts[<xsl:value-of select="3 + position() * 2"/>].iov_base = 0;</l>
+ <l>xcb_parts[<xsl:value-of select="3 + position() * 2"/>].iov_len = -xcb_parts[<xsl:value-of select="2 + position() * 2"/>].iov_len &amp; 3;</l>
+ </xsl:for-each>
+
+ <l>xcb_ret.sequence = xcb_send_request(c, <!--
+ --><xsl:choose>
+ <xsl:when test="@checked='true'">XCB_REQUEST_CHECKED</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>, xcb_parts + 2, &amp;xcb_req);</l>
+ <l>return xcb_ret;</l>
+ </xsl:template>
+
+ <xsl:template match="field" mode="assign">
+ <l>
+ <xsl:text>xcb_out.</xsl:text>
+ <xsl:value-of select="@name" />
+ <xsl:text> = </xsl:text>
+ <xsl:value-of select="@name" />
+ <xsl:text>;</xsl:text>
+ </l>
+ </xsl:template>
+
+ <xsl:template match="exprfield" mode="assign">
+ <l>
+ <xsl:text>xcb_out.</xsl:text>
+ <xsl:value-of select="@name" />
+ <xsl:text> = </xsl:text>
+ <xsl:apply-templates mode="output-expression" />
+ <xsl:text>;</xsl:text>
+ </l>
+ </xsl:template>
+
+ <xsl:template match="pad" mode="assign">
+ <xsl:variable name="padnum"><xsl:number /></xsl:variable>
+ <l><xsl:choose>
+ <xsl:when test="@bytes = 1">xcb_out.pad<xsl:value-of select="$padnum - 1" /> = 0;</xsl:when>
+ <xsl:otherwise>memset(xcb_out.pad<xsl:value-of select="$padnum - 1" />, 0, <xsl:value-of select="@bytes" />);</xsl:otherwise>
+ </xsl:choose></l>
+ </xsl:template>
+
+ <xsl:template match="iterator" mode="pass2">
+ <struct name="{@ref}_iterator_t">
+ <field type="{@ref}_t *" name="data" />
+ <field type="int" name="rem" />
+ <field type="int" name="index" />
+ </struct>
+ </xsl:template>
+
+ <xsl:template match="iterator-functions" mode="pass2">
+ <xsl:variable name="ref" select="@ref" />
+ <xsl:variable name="kind" select="@kind" />
+ <xsl:variable name="struct"
+ select="$pass1/xcb/struct[@name=concat($ref, $kind, '_t')]" />
+ <xsl:variable name="nextfields-rtf">
+ <nextfield>R + 1</nextfield>
+ <xsl:for-each select="$struct/list[not(@fixed)]">
+ <xsl:choose>
+ <xsl:when test="substring(@type, 1, 3) = 'xcb'">
+ <nextfield><xsl:value-of select="substring(@type, 1, string-length(@type)-2)" />_end(<!--
+ --><xsl:value-of select="$ref" />_<!--
+ --><xsl:value-of select="string(@name)" />_iterator(R))</nextfield>
+ </xsl:when>
+ <xsl:otherwise>
+ <nextfield><xsl:value-of select="$ref" />_<!--
+ --><xsl:value-of select="string(@name)" />_end(R)</nextfield>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="nextfields" select="e:node-set($nextfields-rtf)" />
+ <xsl:for-each select="$struct/list[not(@fixed)]">
+ <xsl:variable name="number"
+ select="1+count(preceding-sibling::list[not(@fixed)])" />
+ <xsl:variable name="nextfield" select="$nextfields/nextfield[$number]" />
+ <xsl:variable name="is-first"
+ select="not(preceding-sibling::list[not(@fixed)])" />
+ <xsl:variable name="field-name" select="@name" />
+ <xsl:variable name="is-variable"
+ select="$pass1/xcb/struct[@name=current()/@type]/list
+ or document($search-path)/xcb
+ /struct[concat(xcb:xcb-prefix(@name), '_t')
+ = current()/@type]
+ /*[self::valueparam
+ or self::list[.//*[not(self::value
+ or self::op)]]]" />
+ <xsl:if test="not($is-variable)">
+ <function type="{xcb:get-char-void(@type)} *" name="{$ref}_{xcb:lowercase($field-name)}">
+ <field type="const {$ref}{$kind}_t *" name="R" />
+ <xsl:choose>
+ <xsl:when test="$is-first">
+ <l>return (<xsl:value-of select="xcb:get-char-void(@type)" /> *) <!--
+ -->(<xsl:value-of select="$nextfield" />);</l>
+ </xsl:when>
+ <xsl:otherwise>
+ <l>xcb_generic_iterator_t prev = <!--
+ --><xsl:value-of select="$nextfield" />;</l>
+ <l>return (<xsl:value-of select="xcb:get-char-void(@type)" /> *) <!--
+ -->((char *) prev.data + XCB_TYPE_PAD(<!--
+ --><xsl:value-of select="xcb:get-char-void(@type)" />, prev.index));</l>
+ </xsl:otherwise>
+ </xsl:choose>
+ </function>
+ </xsl:if>
+ <function type="int" name="{$ref}_{xcb:lowercase($field-name)}_length">
+ <field type="const {$ref}{$kind}_t *" name="R" />
+ <l>return <xsl:apply-templates mode="output-expression">
+ <xsl:with-param name="field-prefix" select="'R->'" />
+ </xsl:apply-templates>;</l>
+ </function>
+ <xsl:choose>
+ <xsl:when test="substring(@type, 1, 3) = 'xcb'">
+ <function type="{substring(@type, 1, string-length(@type)-2)}_iterator_t" name="{$ref}_{xcb:lowercase($field-name)}_iterator">
+ <field type="const {$ref}{$kind}_t *" name="R" />
+ <l><xsl:value-of select="substring(@type, 1, string-length(@type)-2)" />_iterator_t i;</l>
+ <xsl:choose>
+ <xsl:when test="$is-first">
+ <l>i.data = (<xsl:value-of select="@type" /> *) <!--
+ -->(<xsl:value-of select="$nextfield" />);</l>
+ </xsl:when>
+ <xsl:otherwise>
+ <l>xcb_generic_iterator_t prev = <!--
+ --><xsl:value-of select="$nextfield" />;</l>
+ <l>i.data = (<xsl:value-of select="@type" /> *) <!--
+ -->((char *) prev.data + XCB_TYPE_PAD(<!--
+ --><xsl:value-of select="@type" />, prev.index));</l>
+ </xsl:otherwise>
+ </xsl:choose>
+ <l>i.rem = <xsl:apply-templates mode="output-expression">
+ <xsl:with-param name="field-prefix" select="'R->'" />
+ </xsl:apply-templates>;</l>
+ <l>i.index = (char *) i.data - (char *) R;</l>
+ <l>return i;</l>
+ </function>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="cast">
+ <xsl:choose>
+ <xsl:when test="@type='void'">char</xsl:when>
+ <xsl:otherwise><xsl:value-of select="@type" /></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <function type="xcb_generic_iterator_t" name="{$ref}_{xcb:lowercase($field-name)}_end">
+ <field type="const {$ref}{$kind}_t *" name="R" />
+ <l>xcb_generic_iterator_t i;</l>
+ <xsl:choose>
+ <xsl:when test="$is-first">
+ <l>i.data = ((<xsl:value-of select="xcb:remove-void($cast)" /> *) <!--
+ -->(<xsl:value-of select="$nextfield" />)) + (<!--
+ --><xsl:apply-templates mode="output-expression">
+ <xsl:with-param name="field-prefix" select="'R->'" />
+ </xsl:apply-templates>);</l>
+ </xsl:when>
+ <xsl:otherwise>
+ <l>xcb_generic_iterator_t child = <!--
+ --><xsl:value-of select="$nextfield" />;</l>
+ <l>i.data = ((<xsl:value-of select="xcb:get-char-void($cast)" /> *) <!--
+ -->child.data) + (<!--
+ --><xsl:apply-templates mode="output-expression">
+ <xsl:with-param name="field-prefix" select="'R->'" />
+ </xsl:apply-templates>);</l>
+ </xsl:otherwise>
+ </xsl:choose>
+ <l>i.rem = 0;</l>
+ <l>i.index = (char *) i.data - (char *) R;</l>
+ <l>return i;</l>
+ </function>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ <xsl:if test="not($kind)">
+ <function type="void" name="{$ref}_next">
+ <doc>/**</doc>
+ <doc> * Get the next element of the iterator</doc>
+ <doc> * @param i Pointer to a <xsl:value-of select="$ref" />_iterator_t</doc>
+ <doc> *</doc>
+ <doc> * Get the next element in the iterator. The member rem is</doc>
+ <doc> * decreased by one. The member data points to the next</doc>
+ <doc> * element. The member index is increased by sizeof(<xsl:value-of select="$ref" />_t)</doc>
+ <doc> */</doc>
+ <field type="{$ref}_iterator_t *" name="i" />
+ <xsl:choose>
+ <xsl:when test="$struct/list[not(@fixed)]">
+ <l><xsl:value-of select="$ref" />_t *R = i->data;</l>
+ <l>xcb_generic_iterator_t child = <!--
+ --><xsl:value-of select="$nextfields/nextfield[last()]" />;</l>
+ <l>--i->rem;</l>
+ <l>i->data = (<xsl:value-of select="$ref" />_t *) child.data;</l>
+ <l>i->index = child.index;</l>
+ </xsl:when>
+ <xsl:otherwise>
+ <l>--i->rem;</l>
+ <l>++i->data;</l>
+ <l>i->index += sizeof(<xsl:value-of select="$ref" />_t);</l>
+ </xsl:otherwise>
+ </xsl:choose>
+ </function>
+ <function type="xcb_generic_iterator_t" name="{$ref}_end">
+ <doc>/**</doc>
+ <doc> * Return the iterator pointing to the last element</doc>
+ <doc> * @param i An <xsl:value-of select="$ref" />_iterator_t</doc>
+ <doc> * @return The iterator pointing to the last element</doc>
+ <doc> *</doc>
+ <doc> * Set the current element in the iterator to the last element.</doc>
+ <doc> * The member rem is set to 0. The member data points to the</doc>
+ <doc> * last element.</doc>
+ <doc> */</doc>
+ <field type="{$ref}_iterator_t" name="i" />
+ <l>xcb_generic_iterator_t ret;</l>
+ <xsl:choose>
+ <xsl:when test="$struct/list[not(@fixed)]">
+ <l>while(i.rem > 0)</l>
+ <indent>
+ <l><xsl:value-of select="$ref" />_next(&amp;i);</l>
+ </indent>
+ <l>ret.data = i.data;</l>
+ <l>ret.rem = i.rem;</l>
+ <l>ret.index = i.index;</l>
+ </xsl:when>
+ <xsl:otherwise>
+ <l>ret.data = i.data + i.rem;</l>
+ <l>ret.index = i.index + ((char *) ret.data - (char *) i.data);</l>
+ <l>ret.rem = 0;</l>
+ </xsl:otherwise>
+ </xsl:choose>
+ <l>return ret;</l>
+ </function>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Output the results. -->
+ <xsl:template match="/">
+ <xsl:if test="not(function-available('e:node-set'))">
+ <xsl:message terminate="yes"><!--
+ -->Error: This stylesheet requires the EXSL node-set extension.<!--
+ --></xsl:message>
+ </xsl:if>
+
+ <xsl:if test="not($h) and not($c)">
+ <xsl:message terminate="yes"><!--
+ -->Error: Parameter "mode" must be "header" or "source".<!--
+ --></xsl:message>
+ </xsl:if>
+
+ <xsl:apply-templates select="$result/*" mode="output" />
+ </xsl:template>
+
+ <xsl:template match="xcb" mode="output">
+ <xsl:variable name="guard"><!--
+ -->__<xsl:value-of select="$ucase-header" />_H<!--
+ --></xsl:variable>
+
+<xsl:text>/*
+ * This file generated automatically from </xsl:text>
+<xsl:value-of select="$header" /><xsl:text>.xml by c-client.xsl using XSLT.
+ * Edit at your peril.
+ */
+</xsl:text>
+<xsl:if test="$h"><xsl:text>
+/**
+ * @defgroup XCB_</xsl:text><xsl:value-of select="$ext" /><xsl:text>_API XCB </xsl:text><xsl:value-of select="$ext" /><xsl:text> API
+ * @brief </xsl:text><xsl:value-of select="$ext" /><xsl:text> XCB Protocol Implementation.</xsl:text>
+<xsl:text>
+ * @{
+ **/
+</xsl:text>
+
+<xsl:text>
+#ifndef </xsl:text><xsl:value-of select="$guard" /><xsl:text>
+#define </xsl:text><xsl:value-of select="$guard" /><xsl:text>
+</xsl:text>
+#include "xcb.h"
+<xsl:for-each select="$root/xcb/import">
+<xsl:text>#include "</xsl:text><xsl:value-of select="." /><xsl:text>.h"
+</xsl:text>
+</xsl:for-each>
+<xsl:text>
+</xsl:text>
+</xsl:if>
+<xsl:if test="$h">
+ <xsl:choose>
+ <xsl:when test="string($ext)">
+ <xsl:text>#define XCB_</xsl:text><xsl:value-of select="translate($ext, $lcase, $ucase)"/><xsl:text>_MAJOR_VERSION </xsl:text><xsl:value-of select="/xcb/@major-version" /><xsl:text>
+</xsl:text>
+ <xsl:text>#define XCB_</xsl:text><xsl:value-of select="translate($ext, $lcase, $ucase)"/><xsl:text>_MINOR_VERSION </xsl:text><xsl:value-of select="/xcb/@minor-version" />
+ <xsl:text>
+
+</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+</xsl:if>
+
+<xsl:if test="$c">
+<xsl:if test="$need-string-h">
+#include &lt;string.h&gt;</xsl:if>
+<xsl:text>
+#include &lt;assert.h&gt;
+#include "xcbext.h"
+#include "</xsl:text><xsl:value-of select="$header" /><xsl:text>.h"
+
+</xsl:text></xsl:if>
+
+ <xsl:apply-templates mode="output" />
+
+<xsl:if test="$h">
+<xsl:text>
+#endif
+
+/**
+ * @}
+ */
+</xsl:text>
+</xsl:if>
+ </xsl:template>
+
+ <xsl:template match="constant" mode="output">
+ <xsl:choose>
+ <xsl:when test="@type = 'number'">
+ <xsl:if test="$h">
+ <xsl:text>/** Opcode for </xsl:text><xsl:value-of select="@name"/><xsl:text>. */
+</xsl:text>
+ <xsl:text>#define </xsl:text>
+ <xsl:value-of select="translate(@name, $lcase, $ucase)" />
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="@value" />
+ <xsl:text>
+
+</xsl:text>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="@type = 'string'">
+ <xsl:if test="$h">
+ <xsl:text>extern </xsl:text>
+ </xsl:if>
+ <xsl:text>const char </xsl:text>
+ <xsl:value-of select="@name" />
+ <xsl:text>[]</xsl:text>
+ <xsl:if test="$c">
+ <xsl:text> = "</xsl:text>
+ <xsl:value-of select="@value" />
+ <xsl:text>"</xsl:text>
+ </xsl:if>
+ <xsl:text>;
+
+</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$h">
+ <xsl:text>extern </xsl:text>
+ </xsl:if>
+ <xsl:call-template name="type-and-name" />
+ <xsl:if test="$c">
+ <xsl:text> = </xsl:text>
+ <xsl:value-of select="@value" />
+ </xsl:if>
+ <xsl:text>;
+
+</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="typedef" mode="output">
+ <xsl:if test="$h">
+ <xsl:text>typedef </xsl:text>
+ <xsl:value-of select="xcb:get-char-void(@oldname)" />
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="@newname" />
+ <xsl:text>;
+
+</xsl:text>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="struct" mode="output">
+ <xsl:if test="$h">
+ <xsl:variable name="type-lengths">
+ <xsl:call-template name="type-lengths">
+ <xsl:with-param name="items" select="field/@type" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:text>/**
+ * @brief </xsl:text><xsl:value-of select="@name" /><xsl:text>
+ **/
+</xsl:text>
+ <xsl:text>typedef </xsl:text>
+ <xsl:if test="not(@kind)">struct</xsl:if><xsl:value-of select="@kind" />
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="@name" />
+ <xsl:text> {
+</xsl:text>
+ <xsl:for-each select="exprfield|field|list[@fixed]|pad">
+ <xsl:text> </xsl:text>
+ <xsl:apply-templates select=".">
+ <xsl:with-param name="type-lengths" select="$type-lengths" />
+ </xsl:apply-templates>
+ <xsl:text>; /**&lt; </xsl:text><xsl:text> */
+</xsl:text>
+ </xsl:for-each>
+ <xsl:text>} </xsl:text>
+ <xsl:value-of select="@name" />
+ <xsl:text>;
+
+</xsl:text>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="enum" mode="output">
+ <xsl:if test="$h">
+ <xsl:text>typedef enum </xsl:text>
+ <xsl:value-of select="@name" />
+ <xsl:text> {
+ </xsl:text>
+ <xsl:call-template name="list">
+ <xsl:with-param name="separator"><xsl:text>,
+ </xsl:text></xsl:with-param>
+ <xsl:with-param name="items">
+ <xsl:for-each select="item">
+ <item>
+ <xsl:value-of select="@name" />
+ <xsl:if test="node()"> <!-- If there is an expression -->
+ <xsl:text> = </xsl:text>
+ <xsl:apply-templates mode="output-expression" />
+ </xsl:if>
+ </item>
+ </xsl:for-each>
+ </xsl:with-param>
+ </xsl:call-template>
+ <xsl:text>
+} </xsl:text><xsl:value-of select="@name" /><xsl:text>;
+
+</xsl:text>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="function" mode="output">
+ <xsl:variable name="decl-open" select="concat(@name, ' (')" />
+ <xsl:variable name="type-lengths">
+ <xsl:call-template name="type-lengths">
+ <xsl:with-param name="items" select="field/@type" />
+ </xsl:call-template>
+ </xsl:variable>
+ <!-- Doxygen for functions in header. -->
+ <xsl:if test="$h">
+ <xsl:apply-templates select="doc" mode="function-doc">
+ </xsl:apply-templates>
+ </xsl:if>
+/*****************************************************************************
+ **
+ ** <xsl:value-of select="@type" />
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="@name" />
+ ** <xsl:call-template name="list">
+ <xsl:with-param name="items">
+ <xsl:for-each select="field">
+ <item>
+ <xsl:text>
+ ** @param </xsl:text>
+ <xsl:apply-templates select=".">
+ <xsl:with-param name="type-lengths" select="$type-lengths" />
+ </xsl:apply-templates>
+ </item>
+ </xsl:for-each>
+ </xsl:with-param>
+ </xsl:call-template>
+ ** @returns <xsl:value-of select="@type" />
+ **
+ *****************************************************************************/
+
+<xsl:value-of select="@type" />
+ <xsl:text>
+</xsl:text>
+ <xsl:value-of select="$decl-open" />
+ <xsl:call-template name="list">
+ <xsl:with-param name="separator">
+ <xsl:text>,
+</xsl:text>
+ <xsl:call-template name="repeat">
+ <xsl:with-param name="count" select="string-length($decl-open)" />
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="items">
+ <xsl:for-each select="field">
+ <item>
+ <xsl:apply-templates select=".">
+ <xsl:with-param name="type-lengths" select="$type-lengths" />
+ </xsl:apply-templates>
+ <xsl:text> /**&lt; */</xsl:text>
+ </item>
+ </xsl:for-each>
+ </xsl:with-param>
+ </xsl:call-template>
+ <xsl:text>)</xsl:text>
+
+ <xsl:if test="$h"><xsl:text>;
+
+</xsl:text></xsl:if>
+
+ <xsl:if test="$c">
+ <xsl:text>
+{
+</xsl:text>
+ <xsl:apply-templates select="l|indent" mode="function-body">
+ <xsl:with-param name="indent" select="$indent-string" />
+ </xsl:apply-templates>
+ <xsl:text>}
+
+</xsl:text>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="doc" mode="function-doc">
+ <xsl:value-of select="." /><xsl:text>
+</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="l" mode="function-body">
+ <xsl:param name="indent" />
+ <xsl:value-of select="concat($indent, .)" /><xsl:text>
+</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="indent" mode="function-body">
+ <xsl:param name="indent" />
+ <xsl:apply-templates select="l|indent" mode="function-body">
+ <xsl:with-param name="indent" select="concat($indent, $indent-string)" />
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template match="value" mode="output-expression">
+ <xsl:value-of select="." />
+ </xsl:template>
+
+ <xsl:template match="fieldref" mode="output-expression">
+ <xsl:param name="field-prefix" />
+ <xsl:value-of select="concat($field-prefix, .)" />
+ </xsl:template>
+
+ <xsl:template match="op" mode="output-expression">
+ <xsl:param name="field-prefix" />
+ <xsl:text>(</xsl:text>
+ <xsl:apply-templates select="node()[1]" mode="output-expression">
+ <xsl:with-param name="field-prefix" select="$field-prefix" />
+ </xsl:apply-templates>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="@op" />
+ <xsl:text> </xsl:text>
+ <xsl:apply-templates select="node()[2]" mode="output-expression">
+ <xsl:with-param name="field-prefix" select="$field-prefix" />
+ </xsl:apply-templates>
+ <xsl:text>)</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="bit" mode="output-expression">
+ <xsl:text>(1 &lt;&lt; </xsl:text>
+ <xsl:value-of select="." />
+ <xsl:text>)</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="function-call" mode="output-expression">
+ <xsl:param name="field-prefix" />
+ <xsl:value-of select="@name" />
+ <xsl:text>(</xsl:text>
+ <xsl:call-template name="list">
+ <xsl:with-param name="separator" select="', '" />
+ <xsl:with-param name="items">
+ <xsl:for-each select="param">
+ <item><xsl:apply-templates mode="output-expression">
+ <xsl:with-param name="field-prefix" select="$field-prefix" />
+ </xsl:apply-templates></item>
+ </xsl:for-each>
+ </xsl:with-param>
+ </xsl:call-template>
+ <xsl:text>)</xsl:text>
+ </xsl:template>
+
+ <!-- Catch invalid elements in expressions. -->
+ <xsl:template match="*" mode="output-expression">
+ <xsl:message terminate="yes">
+ <xsl:text>Invalid element in expression: </xsl:text>
+ <xsl:value-of select="name()" />
+ </xsl:message>
+ </xsl:template>
+
+ <xsl:template match="field|exprfield">
+ <xsl:param name="type-lengths" select="0" />
+ <xsl:call-template name="type-and-name">
+ <xsl:with-param name="type-lengths" select="$type-lengths" />
+ </xsl:call-template>
+ </xsl:template>
+
+ <xsl:template match="list[@fixed]">
+ <xsl:param name="type-lengths" select="0" />
+ <xsl:call-template name="type-and-name">
+ <xsl:with-param name="type-lengths" select="$type-lengths" />
+ </xsl:call-template>
+ <xsl:text>[</xsl:text>
+ <xsl:apply-templates mode="output-expression" />
+ <xsl:text>]</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="pad">
+ <xsl:param name="type-lengths" select="0" />
+
+ <xsl:variable name="padnum"><xsl:number /></xsl:variable>
+
+ <xsl:call-template name="type-and-name">
+ <xsl:with-param name="type" select="'uint8_t'" />
+ <xsl:with-param name="name">
+ <xsl:text>pad</xsl:text>
+ <xsl:value-of select="$padnum - 1" />
+ </xsl:with-param>
+ <xsl:with-param name="type-lengths" select="$type-lengths" />
+ </xsl:call-template>
+ <xsl:if test="@bytes > 1">
+ <xsl:text>[</xsl:text>
+ <xsl:value-of select="@bytes" />
+ <xsl:text>]</xsl:text>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Output the given type and name (defaulting to the corresponding
+ attributes of the context node), with the appropriate spacing. The
+ type must consist of a base type (which may contain spaces), then
+ optionally a single space and a suffix of one or more '*' characters.
+ If the type-lengths parameter is provided, use it to line up the base
+ types and suffixs of the type declarations. -->
+ <xsl:template name="type-and-name">
+ <xsl:param name="type" select="@type" />
+ <xsl:param name="name" select="@name" />
+ <xsl:param name="type-lengths">
+ <max-type-length>0</max-type-length>
+ <max-suffix-length>0</max-suffix-length>
+ </xsl:param>
+
+ <xsl:variable name="type-lengths-ns" select="e:node-set($type-lengths)" />
+ <xsl:variable name="min-type-length"
+ select="$type-lengths-ns/max-type-length" />
+ <xsl:variable name="min-suffix-length"
+ select="$type-lengths-ns/max-suffix-length" />
+
+ <xsl:variable name="base-type">
+ <xsl:choose>
+ <xsl:when test="contains($type, ' *')">
+ <xsl:value-of select="substring-before($type, ' *')" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$type" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="suffix">
+ <xsl:if test="contains($type, ' *')">
+ <xsl:text>*</xsl:text>
+ <xsl:value-of select="substring-after($type, ' *')" />
+ </xsl:if>
+ </xsl:variable>
+
+ <xsl:value-of select="$base-type" />
+ <xsl:if test="string-length($base-type) &lt; $min-type-length">
+ <xsl:call-template name="repeat">
+ <xsl:with-param name="count" select="$min-type-length
+ - string-length($base-type)" />
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:text> </xsl:text>
+ <xsl:if test="string-length($suffix) &lt; $min-suffix-length">
+ <xsl:call-template name="repeat">
+ <xsl:with-param name="count" select="$min-suffix-length
+ - string-length($suffix)" />
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:value-of select="$suffix" />
+ <xsl:value-of select="$name" />
+ </xsl:template>
+
+ <!-- Output a list with a given separator. Empty items are skipped. -->
+ <xsl:template name="list">
+ <xsl:param name="separator" />
+ <xsl:param name="items" />
+
+ <xsl:for-each select="e:node-set($items)/*">
+ <xsl:value-of select="." />
+ <xsl:if test="not(position() = last())">
+ <xsl:value-of select="$separator" />
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+
+ <!-- Repeat a string (space by default) a given number of times. -->
+ <xsl:template name="repeat">
+ <xsl:param name="str" select="' '" />
+ <xsl:param name="count" />
+
+ <xsl:if test="$count &gt; 0">
+ <xsl:value-of select="$str" />
+ <xsl:call-template name="repeat">
+ <xsl:with-param name="str" select="$str" />
+ <xsl:with-param name="count" select="$count - 1" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Record the maximum type lengths of a set of types for use as the
+ max-type-lengths parameter of type-and-name. -->
+ <xsl:template name="type-lengths">
+ <xsl:param name="items" />
+ <xsl:variable name="type-lengths-rtf">
+ <xsl:for-each select="$items">
+ <item>
+ <xsl:choose>
+ <xsl:when test="contains(., ' *')">
+ <xsl:value-of select="string-length(
+ substring-before(., ' *'))" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="string-length(.)" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </item>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="suffix-lengths-rtf">
+ <xsl:for-each select="$items">
+ <item>
+ <xsl:choose>
+ <xsl:when test="contains(., ' *')">
+ <xsl:value-of select="string-length(substring-after(., ' *'))
+ + 1" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>0</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </item>
+ </xsl:for-each>
+ </xsl:variable>
+ <max-type-length>
+ <xsl:call-template name="max">
+ <xsl:with-param name="items"
+ select="e:node-set($type-lengths-rtf)/*" />
+ </xsl:call-template>
+ </max-type-length>
+ <max-suffix-length>
+ <xsl:call-template name="max">
+ <xsl:with-param name="items"
+ select="e:node-set($suffix-lengths-rtf)/*" />
+ </xsl:call-template>
+ </max-suffix-length>
+ </xsl:template>
+
+ <!-- Return the maximum number in a set of numbers. -->
+ <xsl:template name="max">
+ <xsl:param name="items" />
+ <xsl:choose>
+ <xsl:when test="count($items) = 0">
+ <xsl:text>0</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="head" select="number($items[1])" />
+ <xsl:variable name="tail-max">
+ <xsl:call-template name="max">
+ <xsl:with-param name="items" select="$items[position() > 1]" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$head > number($tail-max)">
+ <xsl:value-of select="$head" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$tail-max" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:transform>
diff --git a/libxcb/src/c_client.py b/libxcb/src/c_client.py
index ad7a6ccd2..6241239e6 100644
--- a/libxcb/src/c_client.py
+++ b/libxcb/src/c_client.py
@@ -479,7 +479,8 @@ def _c_accessors_field(self, field):
_c('%s (const %s *R /**< */)', field.c_accessor_name, self.c_type)
_c('{')
_c(' xcb_generic_iterator_t prev = %s;', _c_iterator_get_end(field.prev_varsized_field, 'R'))
- _c(' return * (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index) + %d);', field.c_field_type, field.first_field_after_varsized.type.c_type, field.prev_varsized_offset)
+ sizeoftype='char' if field.first_field_after_varsized.type.c_type == 'void' else field.first_field_after_varsized.type.c_type
+ _c(' return * (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index) + %d);', field.c_field_type, sizeoftype, field.prev_varsized_offset)
_c('}')
else:
_hc('')
@@ -498,7 +499,8 @@ def _c_accessors_field(self, field):
_c('%s (const %s *R /**< */)', field.c_accessor_name, self.c_type)
_c('{')
_c(' xcb_generic_iterator_t prev = %s;', _c_iterator_get_end(field.prev_varsized_field, 'R'))
- _c(' return (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index) + %d);', field.c_field_type, field.first_field_after_varsized.type.c_type, field.prev_varsized_offset)
+ sizeoftype='char' if field.first_field_after_varsized.type.c_type == 'void' else field.first_field_after_varsized.type.c_type
+ _c(' return (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index) + %d);', field.c_field_type, sizeoftype, field.prev_varsized_offset)
_c('}')
def _c_accessors_list(self, field):
@@ -532,7 +534,8 @@ def _c_accessors_list(self, field):
_c(' return (%s *) (R + 1);', field.c_field_type)
else:
_c(' xcb_generic_iterator_t prev = %s;', _c_iterator_get_end(field.prev_varsized_field, 'R'))
- _c(' return (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index) + %d);', field.c_field_type, field.first_field_after_varsized.type.c_type, field.prev_varsized_offset)
+ sizeoftype='char' if field.first_field_after_varsized.type.c_type == 'void' else field.first_field_after_varsized.type.c_type
+ _c(' return (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index) + %d);', field.c_field_type, sizeoftype, field.prev_varsized_offset)
_c('}')
@@ -605,7 +608,8 @@ def _c_accessors_list(self, field):
_c(' i.data = (%s *) (R + 1);', field.c_field_type)
else:
_c(' xcb_generic_iterator_t prev = %s;', _c_iterator_get_end(field.prev_varsized_field, 'R'))
- _c(' i.data = (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index));', field.c_field_type, field.c_field_type)
+ sizeoftype='char' if field.c_field_type == 'void' else field.c_field_type
+ _c(' i.data = (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index));', field.c_field_type, sizeoftype)
_c(' i.rem = %s;', _c_accessor_get_expr(field.type.expr, 'R'))
_c(' i.index = (char *) i.data - (char *) R;')
diff --git a/libxcb/src/makefile b/libxcb/src/makefile
index dfca38a6e..97705cc24 100644
--- a/libxcb/src/makefile
+++ b/libxcb/src/makefile
@@ -10,6 +10,7 @@ DEFINES += PTW32_STATIC_LIB
XCBPROTO_XCBINCLUDEDIR = ..\xcb-proto\src
XMLFILES := $(notdir $(wildcard $(XCBPROTO_XCBINCLUDEDIR)\*.xml))
+XMLFILES := $(filter-out xkb.xml, $(XMLFILES))
EXTSOURCES := $(XMLFILES:%.xml=%.c)
CSRCS += $(EXTSOURCES)
diff --git a/libxcb/src/xcb.h b/libxcb/src/xcb.h
index 70a44a59d..ad32051b2 100644
--- a/libxcb/src/xcb.h
+++ b/libxcb/src/xcb.h
@@ -295,6 +295,22 @@ xcb_generic_event_t *xcb_poll_for_event(xcb_connection_t *c);
*/
xcb_generic_error_t *xcb_request_check(xcb_connection_t *c, xcb_void_cookie_t cookie);
+/**
+ * @brief Discards the reply for a request.
+ * @param c: The connection to the X server.
+ * @param sequence: The request sequence number from a cookie.
+ *
+ * Discards the reply for a request. Additionally, any error generated
+ * by the request is also discarded (unless it was an _unchecked request
+ * and the error has already arrived).
+ *
+ * This function will not block even if the reply is not yet available.
+ *
+ * Note that the sequence really does have to come from an xcb cookie;
+ * this function is not designed to operate on socket-handoff replies.
+ */
+void xcb_discard_reply(xcb_connection_t *c, unsigned int sequence);
+
/* xcb_ext.c */
diff --git a/libxcb/src/xcb_conn.c b/libxcb/src/xcb_conn.c
index ffd9519fb..1e58060ba 100644
--- a/libxcb/src/xcb_conn.c
+++ b/libxcb/src/xcb_conn.c
@@ -258,8 +258,10 @@ xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info)
xcb_connection_t* c;
c = calloc(1, sizeof(xcb_connection_t));
- if(!c)
+ if(!c) {
+ close(fd);
return (xcb_connection_t *) &error_connection;
+ }
c->fd = fd;
diff --git a/libxcb/src/xcb_in.c b/libxcb/src/xcb_in.c
index 7ab880952..b186a6e4a 100644
--- a/libxcb/src/xcb_in.c
+++ b/libxcb/src/xcb_in.c
@@ -432,6 +432,116 @@ void *xcb_wait_for_reply(xcb_connection_t *c, unsigned int request, xcb_generic_
return ret;
}
+static void insert_pending_discard(xcb_connection_t *c, pending_reply **prev_next, uint64_t seq)
+{
+ pending_reply *pend;
+ pend = malloc(sizeof(*pend));
+ if(!pend)
+ {
+ _xcb_conn_shutdown(c);
+ return;
+ }
+
+ pend->first_request = seq;
+ pend->last_request = seq;
+ pend->workaround = 0;
+ pend->flags = XCB_REQUEST_DISCARD_REPLY;
+ pend->next = *prev_next;
+ *prev_next = pend;
+
+ if(!pend->next)
+ c->in.pending_replies_tail = &pend->next;
+}
+
+static void discard_reply(xcb_connection_t *c, unsigned int request)
+{
+ pending_reply *pend = 0;
+ pending_reply **prev_pend;
+ uint64_t widened_request;
+
+ /* We've read requests past the one we want, so if it has replies we have
+ * them all and they're in the replies map. */
+ if(XCB_SEQUENCE_COMPARE_32(request, <, c->in.request_read))
+ {
+ struct reply_list *head;
+ head = _xcb_map_remove(c->in.replies, request);
+ while (head)
+ {
+ struct reply_list *next = head->next;
+ free(head->reply);
+ free(head);
+ head = next;
+ }
+ return;
+ }
+
+ /* We're currently processing the responses to the request we want, and we
+ * have a reply ready to return. Free it, and mark the pend to free any further
+ * replies. */
+ if(XCB_SEQUENCE_COMPARE_32(request, ==, c->in.request_read) && c->in.current_reply)
+ {
+ struct reply_list *head;
+ head = c->in.current_reply;
+ c->in.current_reply = NULL;
+ c->in.current_reply_tail = &c->in.current_reply;
+ while (head)
+ {
+ struct reply_list *next = head->next;
+ free(head->reply);
+ free(head);
+ head = next;
+ }
+
+ pend = c->in.pending_replies;
+ if(pend &&
+ !(XCB_SEQUENCE_COMPARE(pend->first_request, <=, c->in.request_read) &&
+ (pend->workaround == WORKAROUND_EXTERNAL_SOCKET_OWNER ||
+ XCB_SEQUENCE_COMPARE(c->in.request_read, <=, pend->last_request))))
+ pend = 0;
+ if(pend)
+ pend->flags |= XCB_REQUEST_DISCARD_REPLY;
+ else
+ insert_pending_discard(c, &c->in.pending_replies, c->in.request_read);
+
+ return;
+ }
+
+ /* Walk the list of pending requests. Mark the first match for deletion. */
+ for(prev_pend = &c->in.pending_replies; *prev_pend; prev_pend = &(*prev_pend)->next)
+ {
+ if(XCB_SEQUENCE_COMPARE_32((*prev_pend)->first_request, >, request))
+ break;
+
+ if(XCB_SEQUENCE_COMPARE_32((*prev_pend)->first_request, ==, request))
+ {
+ /* Pending reply found. Mark for discard: */
+ (*prev_pend)->flags |= XCB_REQUEST_DISCARD_REPLY;
+ return;
+ }
+ }
+
+ /* Pending reply not found (likely due to _unchecked request). Create one: */
+ widened_request = (c->out.request & UINT64_C(0xffffffff00000000)) | request;
+ if(widened_request > c->out.request)
+ widened_request -= UINT64_C(1) << 32;
+
+ insert_pending_discard(c, prev_pend, widened_request);
+}
+
+void xcb_discard_reply(xcb_connection_t *c, unsigned int sequence)
+{
+ if(c->has_error)
+ return;
+
+ /* If an error occurred when issuing the request, fail immediately. */
+ if(!sequence)
+ return;
+
+ pthread_mutex_lock(&c->iolock);
+ discard_reply(c, sequence);
+ pthread_mutex_unlock(&c->iolock);
+}
+
int xcb_poll_for_reply(xcb_connection_t *c, unsigned int request, void **reply, xcb_generic_error_t **error)
{
int ret;
diff --git a/libxcb/src/xcb_util.c b/libxcb/src/xcb_util.c
index cd41b98f9..a3658ec80 100644
--- a/libxcb/src/xcb_util.c
+++ b/libxcb/src/xcb_util.c
@@ -42,6 +42,7 @@
#include <stdlib.h>
#include <stddef.h>
#include <unistd.h>
+#include <fcntl.h>
#include <string.h>
#include "xcb.h"
@@ -216,6 +217,24 @@ static int _xcb_open(const char *host, char *protocol, const int display)
return fd;
}
+static int _xcb_socket(int family, int type, int proto)
+{
+ int fd;
+
+#ifdef SOCK_CLOEXEC
+ fd = socket(family, type | SOCK_CLOEXEC, proto);
+ if (fd == -1 && errno == EINVAL)
+#endif
+ {
+ fd = socket(family, type, proto);
+#ifndef _MSC_VER
+ if (fd >= 0)
+ fcntl(fd, F_SETFD, FD_CLOEXEC);
+#endif
+ }
+ return fd;
+}
+
#ifdef DNETCONN
static int _xcb_open_decnet(const char *host, const char *protocol, const unsigned short port)
{
@@ -238,7 +257,7 @@ static int _xcb_open_decnet(const char *host, const char *protocol, const unsign
return -1;
addr.sdn_objnum = 0;
- fd = socket(PF_DECnet, SOCK_STREAM, 0);
+ fd = _xcb_socket(PF_DECnet, SOCK_STREAM, 0);
if(fd == -1)
return -1;
@@ -324,7 +343,7 @@ static int _xcb_open_tcp(const char *host, char *protocol, const unsigned short
for(addr = results; addr; addr = addr->ai_next)
{
- fd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
+ fd = _xcb_socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
if(fd >= 0) {
char on = 1;
setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on));
@@ -353,7 +372,7 @@ static int _xcb_open_unix(char *protocol, const char *file)
#ifdef HAVE_SOCKADDR_SUN_LEN
addr.sun_len = SUN_LEN(&addr);
#endif
- fd = socket(AF_UNIX, SOCK_STREAM, 0);
+ fd = _xcb_socket(AF_UNIX, SOCK_STREAM, 0);
if(fd == -1)
return -1;
if(connect(fd, (struct sockaddr *) &addr, sizeof(addr)) == -1) {
@@ -379,7 +398,7 @@ static int _xcb_open_abstract(char *protocol, const char *file, size_t filelen)
#ifdef HAVE_SOCKADDR_SUN_LEN
addr.sun_len = 1 + filelen;
#endif
- fd = socket(AF_UNIX, SOCK_STREAM, 0);
+ fd = _xcb_socket(AF_UNIX, SOCK_STREAM, 0);
if (fd == -1)
return -1;
if (connect(fd, (struct sockaddr *) &addr, namelen) == -1) {
diff --git a/libxcb/xcb-proto/autogen.sh b/libxcb/xcb-proto/autogen.sh
new file mode 100644
index 000000000..904cd6746
--- /dev/null
+++ b/libxcb/xcb-proto/autogen.sh
@@ -0,0 +1,12 @@
+#! /bin/sh
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+ORIGDIR=`pwd`
+cd $srcdir
+
+autoreconf -v --install || exit 1
+cd $ORIGDIR || exit $?
+
+$srcdir/configure --enable-maintainer-mode "$@"
diff --git a/libxcb/xcb-proto/doc/xml-xcb.txt b/libxcb/xcb-proto/doc/xml-xcb.txt
index feb99844f..3c6a15519 100644
--- a/libxcb/xcb-proto/doc/xml-xcb.txt
+++ b/libxcb/xcb-proto/doc/xml-xcb.txt
@@ -225,8 +225,17 @@ enum; the value is restricted to one of the constants named in the enum.
defining the set of values included, and a list containing these values.
value-mask-type gives the type of the bitmask; this must be CARD16 or
CARD32. value-mask-name gives the field name of the bitmask, and
- value-list-name gives the field name of the list of values.
+ value-list-name gives the field name of the list of values. Please use
+ <switch> instead for new protocol definitions.
+<switch name="identifier"> switch expression
+ <bitcase> bitcase expression, fields </bitcase> </switch>
+
+ This element represents conditional inclusion of fields. It can be viewed
+ as sequence of multiple ifs: if ( switch expression & bitcase expression )
+ is equal to bitcase expression, bitcase fields are included in structure.
+ It can be used only as the last field of structure. New protocol definitions
+ should prefer to use this instead of <valueparam>.
Expressions
-----------
@@ -256,3 +265,22 @@ Expressions
The bit element represents a literal bitmask value in an expression.
The integer must be in the range 0..31, expanding to (1<<n) in C.
+
+<enumref ref="identifier">enum item identifier</enumref>
+
+ This element represents a reference to item of enum.
+
+<unop op="operator">expression</unop>
+
+ This element represents a unary operator, with the op attribute specifying
+ which operator. The only supported operation so far is ~, and its semantic
+ is identical to the corresponding operator in C.
+
+<sumof ref="identifier" />
+
+ This element represents a sumation of the elements of the referenced list.
+
+<popcount>expression</popcount>
+
+ This element represents the number of bits set in the expression.
+
diff --git a/libxcb/xcb-proto/src/Makefile.am b/libxcb/xcb-proto/src/Makefile.am
index 0f0dfbcda..e1e2743be 100644
--- a/libxcb/xcb-proto/src/Makefile.am
+++ b/libxcb/xcb-proto/src/Makefile.am
@@ -21,6 +21,7 @@ xcbinclude_HEADERS = \
xfixes.xml \
xinerama.xml \
xinput.xml \
+ xkb.xml \
xprint.xml \
xselinux.xml \
xtest.xml \
diff --git a/libxcb/xcb-proto/src/ge.xml b/libxcb/xcb-proto/src/ge.xml
new file mode 100644
index 000000000..3a6210d97
--- /dev/null
+++ b/libxcb/xcb-proto/src/ge.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (C) 2009 Open Text Corporation. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the authors or their
+institutions shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization from the authors.
+-->
+<xcb header="ge" extension-xname="Generic Event Extension" extension-name="GenericEvent"
+ major-version="1" minor-version="0">
+
+ <!-- Version 1 -->
+ <request name="QueryVersion" opcode="0">
+ <field type="CARD16" name="client_major_version" />
+ <field type="CARD16" name="client_minor_version" />
+ <reply>
+ <pad bytes="1" />
+ <field type="CARD16" name="major_version" />
+ <field type="CARD16" name="minor_version" />
+ <pad bytes="20" />
+ </reply>
+ </request>
+
+</xcb>
diff --git a/libxcb/xcb-proto/src/import.py b/libxcb/xcb-proto/src/import.py
new file mode 100644
index 000000000..eb58f5561
--- /dev/null
+++ b/libxcb/xcb-proto/src/import.py
@@ -0,0 +1,66 @@
+#!/usr/bin/python
+
+from xml.sax.saxutils import XMLFilterBase, XMLGenerator
+from xml.sax import make_parser
+import sys, os
+
+path = [os.path.curdir, 'extensions']
+def find_file_on_path(name):
+ for d in path:
+ test = os.path.join(d, name)
+ if os.path.isfile(test):
+ return test
+ raise OSError(errno.ENOENT, os.strerror(errno.ENOENT), name)
+
+seen = {}
+
+class ProcessImports(XMLFilterBase):
+ def setContentHandler(self, handler):
+ self.handler = handler
+ XMLFilterBase.setContentHandler(self, handler)
+
+ def ensure(self, name):
+ if not seen.has_key(name):
+ child = ProcessImports(make_parser())
+ child.setContentHandler(self.handler)
+ child.parse(find_file_on_path(name + '.xml'))
+
+ def startDocument(self):
+ pass
+ def endDocument(self):
+ pass
+
+ inimport = None
+
+ def startElement(self, name, attrs):
+ assert self.inimport is None
+ if name == 'import':
+ self.inimport = ""
+ return
+ XMLFilterBase.startElement(self, name, attrs)
+ if name == 'xcb':
+ seen[attrs['header']] = True
+ self.ensure('xproto')
+
+ def characters(self, content):
+ if self.inimport is not None:
+ self.inimport += content
+ else:
+ XMLFilterBase.characters(self, content)
+
+ def endElement(self, name):
+ if name == 'import':
+ self.ensure(self.inimport)
+ self.inimport = None
+ return
+ XMLFilterBase.endElement(self, name)
+
+out = XMLGenerator()
+importer = ProcessImports(make_parser())
+importer.setContentHandler(out)
+out.startDocument()
+if len(sys.argv) > 1:
+ importer.parse(sys.argv[1])
+else:
+ importer.parse(sys.stdin)
+out.endDocument()
diff --git a/libxcb/xcb-proto/src/size.py b/libxcb/xcb-proto/src/size.py
new file mode 100644
index 000000000..5ead8b238
--- /dev/null
+++ b/libxcb/xcb-proto/src/size.py
@@ -0,0 +1,76 @@
+#!/usr/bin/python
+
+from xml.sax.saxutils import XMLFilterBase, XMLGenerator
+from xml.sax.xmlreader import AttributesImpl
+from xml.sax import make_parser
+import sys
+
+def AttributesUnion(base, **values):
+ baseitems = dict(base)
+ baseitems.update(values)
+ return AttributesImpl(baseitems)
+
+class AnnotateSize(XMLFilterBase):
+ types = {
+ 'BYTE': 1, 'BOOL': 1,
+ 'CARD8': 1, 'CARD16': 2, 'CARD32': 4,
+ 'INT8': 1, 'INT16': 2, 'INT32': 4,
+ 'char': 1, 'void': 1,
+ 'float': 4, 'double': 8,
+ 'XID': 4,
+ }
+ header = []
+ def setTypeSize(self, name, size):
+ assert not self.types.has_key(name), "size of " + name + " declared as both " + str(size) + " and " + str(self.types[name])
+ self.types[name] = size
+
+ struct = None
+ union = None
+ def startElement(self, name, attrs):
+ if name == 'xcb':
+ self.header.insert(0, attrs['header'])
+ elif name == 'field':
+ size = self.types.get(attrs['type'], 0)
+ if self.struct is not None:
+ self.totalsize += size
+ elif self.union is not None:
+ self.totalsize = max(self.totalsize, size)
+ attrs = AttributesUnion(attrs, bytes=str(size))
+ elif name == 'pad':
+ assert self.union is None
+ if self.struct is not None:
+ self.totalsize += int(attrs['bytes'])
+ elif name == 'xidtype':
+ self.setTypeSize(attrs['name'], 4)
+ elif name == 'typedef':
+ self.setTypeSize(attrs['newname'], self.types[attrs['oldname']])
+ elif name == 'struct' or name == 'union':
+ assert self.struct is None and self.union is None
+ setattr(self, name, attrs['name'])
+ self.totalsize = 0
+
+ if len(self.header) == 1 or name == 'xcb':
+ XMLFilterBase.startElement(self, name, attrs)
+
+ def characters(self, content):
+ if len(self.header) == 1:
+ XMLFilterBase.characters(self, content)
+
+ def endElement(self, name):
+ if len(self.header) == 1 or name == 'xcb':
+ XMLFilterBase.endElement(self, name)
+
+ if name == 'xcb':
+ self.header.pop(0)
+ elif name == 'struct' or name == 'union':
+ assert getattr(self, name) is not None
+ self.setTypeSize(getattr(self, name), self.totalsize)
+ setattr(self, name, None)
+ del self.totalsize
+
+annotator = AnnotateSize(make_parser())
+annotator.setContentHandler(XMLGenerator())
+if len(sys.argv) > 1:
+ annotator.parse(sys.argv[1])
+else:
+ annotator.parse(sys.stdin)
diff --git a/libxcb/xcb-proto/src/type.py b/libxcb/xcb-proto/src/type.py
new file mode 100644
index 000000000..83382325d
--- /dev/null
+++ b/libxcb/xcb-proto/src/type.py
@@ -0,0 +1,74 @@
+#!/usr/bin/python
+
+from xml.sax.saxutils import XMLFilterBase, XMLGenerator
+from xml.sax.xmlreader import AttributesImpl
+from xml.sax import make_parser
+import sys
+
+def AttributesUnion(base, **values):
+ baseitems = dict(base)
+ baseitems.update(values)
+ return AttributesImpl(baseitems)
+
+class AnnotateType(XMLFilterBase):
+ scopes = []
+ map = dict([(name, [name]) for name in [
+ 'BOOL', 'BYTE',
+ 'CARD8', 'CARD16', 'CARD32',
+ 'INT8', 'INT16', 'INT32',
+ 'char', 'void',
+ 'float', 'double',
+ 'XID',
+ ]])
+ def startScope(self, name):
+ self.scopes.insert(0, name)
+ def declareType(self, name):
+ assert ':' not in name
+ qname = self.scopes[0] + ':' + name
+ self.map.setdefault(name, []).insert(0, qname)
+ def getQualifiedType(self, name):
+ if ':' in name:
+ return name
+ names = self.map.get(name, [])
+ return names[0]
+ def endScope(self):
+ self.scopes.pop(0)
+
+ def startElement(self, name, attrs):
+ attnames = []
+ if name == 'xcb':
+ self.startScope(attrs['header'])
+ elif name in ['struct', 'union', 'xidtype', 'enum', 'event', 'eventcopy', 'error', 'errorcopy']:
+ self.declareType(attrs['name'])
+ attnames = ['name']
+ if name.endswith('copy'):
+ attnames.append('ref')
+ elif name == 'typedef':
+ self.declareType(attrs['newname'])
+ attnames = ['oldname', 'newname']
+ elif name == 'valueparam':
+ attnames = ['value-mask-type']
+ elif attrs.has_key('type'):
+ attnames = ['type']
+ newattrs = {}
+ for attname in attnames:
+ newattrs[attname] = self.getQualifiedType(attrs[attname])
+ if newattrs:
+ attrs = AttributesUnion(attrs, **newattrs)
+ XMLFilterBase.startElement(self, name, attrs)
+
+ def endElement(self, name):
+ XMLFilterBase.endElement(self, name)
+ if name == 'xcb':
+ self.endScope()
+
+annotator = AnnotateType(make_parser())
+annotator.setContentHandler(XMLGenerator())
+if len(sys.argv) > 1:
+ annotator.parse(sys.argv[1])
+else:
+ annotator.parse(sys.stdin)
+
+for name,names in annotator.map.iteritems():
+ if len(names) != 1:
+ print "<!-- warning:", name, "has the following definitions:", names, "-->"
diff --git a/libxcb/xcb-proto/src/xcb.xsd b/libxcb/xcb-proto/src/xcb.xsd
index f3fcb6fe2..5169b4809 100644
--- a/libxcb/xcb-proto/src/xcb.xsd
+++ b/libxcb/xcb-proto/src/xcb.xsd
@@ -55,6 +55,36 @@ authorization from the authors.
<xsd:attribute name="mask" type="xsd:string" use="optional" />
</xsd:complexType>
+ <!-- case expression -->
+ <xsd:complexType name="caseexpr">
+ <xsd:sequence>
+ <!-- case expression: -->
+ <xsd:group ref="expression" minOccurs="1" maxOccurs="1" />
+ <!-- match -->
+ <xsd:group ref="fields" minOccurs="1" maxOccurs="unbounded" />
+ <xsd:choice>
+ <xsd:element ref="switch" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:choice>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <!-- switch expression -->
+ <xsd:complexType name="switchexpr">
+ <xsd:sequence>
+ <!-- switch(expression) -->
+ <xsd:group ref="expression" minOccurs="1" maxOccurs="1" />
+ <xsd:choice>
+ <!-- bitcase expression - bit test -->
+ <xsd:element name="bitcase" type="caseexpr" minOccurs="1" maxOccurs="unbounded" />
+ </xsd:choice>
+ <!-- default: -->
+ <xsd:group ref="fields" minOccurs="0" maxOccurs="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+
+ <xsd:element name="switch" type="switchexpr" />
+
<!-- field replaces FIELD, PARAM, and REPLY. -->
<xsd:element name="field" type="var" />
@@ -89,7 +119,40 @@ authorization from the authors.
</xsd:attribute>
</xsd:complexType>
</xsd:element>
+ <xsd:element name="unop">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:group ref="expression" />
+ </xsd:sequence>
+ <xsd:attribute name="op" use="required">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:pattern value="~" />
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:complexType>
+ </xsd:element>
<xsd:element name="fieldref" type="xsd:string" />
+ <xsd:element name="enumref">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="ref" use="required" type="xsd:string" />
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="popcount">
+ <xsd:complexType>
+ <xsd:group ref="expression" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="sumof">
+ <xsd:complexType>
+ <xsd:attribute name="ref" use="required" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
<xsd:element name="value" type="dec-or-hex-integer" />
<xsd:element name="bit" type="xsd:integer" />
</xsd:choice>
@@ -126,7 +189,12 @@ authorization from the authors.
<!-- Type for a structure -->
<xsd:complexType name="struct">
- <xsd:group ref="fields" minOccurs="1" maxOccurs="unbounded" />
+ <xsd:sequence>
+ <xsd:group ref="fields" minOccurs="1" maxOccurs="unbounded" />
+ <xsd:choice minOccurs="0" maxOccurs="1">
+ <xsd:element ref="switch" />
+ </xsd:choice>
+ </xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
@@ -166,12 +234,20 @@ authorization from the authors.
<xsd:element ref="exprfield" />
<xsd:element ref="valueparam" />
</xsd:choice>
+ <xsd:choice minOccurs="0" maxOccurs="1">
+ <xsd:element ref="switch" />
+ </xsd:choice>
<xsd:element name="reply" minOccurs="0" maxOccurs="1">
<xsd:complexType>
- <xsd:choice minOccurs="1" maxOccurs="unbounded">
- <xsd:group ref="fields" />
- <xsd:element ref="valueparam" />
- </xsd:choice>
+ <xsd:sequence>
+ <xsd:choice minOccurs="1" maxOccurs="unbounded">
+ <xsd:group ref="fields" />
+ <xsd:element ref="valueparam" />
+ </xsd:choice>
+ <xsd:choice minOccurs="0" maxOccurs="1">
+ <xsd:element ref="switch" />
+ </xsd:choice>
+ </xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
diff --git a/libxcb/xcb-proto/src/xf86vidmode.xml b/libxcb/xcb-proto/src/xf86vidmode.xml
new file mode 100644
index 000000000..4a193f58d
--- /dev/null
+++ b/libxcb/xcb-proto/src/xf86vidmode.xml
@@ -0,0 +1,478 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (C) 2009 Open Text Corporation. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the authors or their
+institutions shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization from the authors.
+-->
+
+<xcb header="xf86vidmode" extension-xname="XFree86-VidModeExtension" extension-name="XF86VidMode"
+ major-version="2" minor-version="2">
+
+ <!-- In places where there are multiple versions of the protocol, this
+ describes version 2.2. If you do not call xcb_xf86vidmode_set_client_version()
+ then some requests may fail and some replies may not be what you expect. -->
+
+ <typedef oldname="CARD32" newname="SYNCRANGE" /> <!-- Min and Max fixed-decimal-point values -->
+ <typedef oldname="CARD32" newname="DOTCLOCK" /> <!-- A single fixed-decimal-point value -->
+
+ <enum name="ModeFlag">
+ <item name="Positive_HSync"> <bit>0</bit></item>
+ <item name="Negative_HSync"> <bit>1</bit></item>
+ <item name="Positive_VSync"> <bit>2</bit></item>
+ <item name="Negative_VSync"> <bit>3</bit></item>
+ <item name="Interlace"> <bit>4</bit></item>
+ <item name="Composite_Sync"> <bit>5</bit></item>
+ <item name="Positive_CSync"> <bit>6</bit></item>
+ <item name="Negative_CSync"> <bit>7</bit></item>
+ <item name="HSkew"> <bit>8</bit></item>
+ <item name="Broadcast"> <bit>9</bit></item>
+ <item name="Pixmux"> <bit>10</bit></item>
+ <item name="Double_Clock"> <bit>11</bit></item>
+ <item name="Half_Clock"> <bit>12</bit></item>
+ </enum>
+
+ <enum name="ClockFlag">
+ <item name="Programable"> <bit>0</bit></item>
+ </enum>
+
+ <enum name="Permission">
+ <item name="Read"> <bit>0</bit></item>
+ <item name="Write"> <bit>1</bit></item>
+ </enum>
+
+ <struct name="ModeInfo">
+ <field type="DOTCLOCK" name="dotclock" />
+ <field type="CARD16" name= "hdisplay" />
+ <field type="CARD16" name= "hsyncstart" />
+ <field type="CARD16" name= "hsyncend" />
+ <field type="CARD16" name= "htotal" />
+ <field type="CARD32" name= "hskew" />
+ <field type="CARD16" name= "vdisplay" />
+ <field type="CARD16" name= "vsyncstart" />
+ <field type="CARD16" name= "vsyncend" />
+ <field type="CARD16" name= "vtotal" />
+ <pad bytes="4" />
+ <field type="CARD32" name="flags" mask="ModeFlag" />
+ <pad bytes="12" />
+ <field type="CARD32" name="privsize" />
+ </struct>
+
+ <request name="QueryVersion" opcode="0">
+ <reply>
+ <pad bytes="1" />
+ <field type="CARD16" name="major_version" />
+ <field type="CARD16" name="minor_version" />
+ </reply>
+ </request>
+
+ <request name="GetModeLine" opcode="1">
+ <field type="CARD16" name="screen" />
+ <pad bytes="2" />
+ <reply>
+ <pad bytes="1" />
+ <field type="DOTCLOCK" name="dotclock" />
+ <field type="CARD16" name= "hdisplay" />
+ <field type="CARD16" name= "hsyncstart" />
+ <field type="CARD16" name= "hsyncend" />
+ <field type="CARD16" name= "htotal" />
+ <field type="CARD16" name= "hskew" />
+ <field type="CARD16" name= "vdisplay" />
+ <field type="CARD16" name= "vsyncstart" />
+ <field type="CARD16" name= "vsyncend" />
+ <field type="CARD16" name= "vtotal" />
+ <pad bytes="2" />
+ <field type="CARD32" name="flags" mask="ModeFlag" />
+ <pad bytes="12" />
+ <field type="CARD32" name="privsize" />
+ <list type="CARD8" name="private">
+ <fieldref>privsize</fieldref>
+ </list>
+ </reply>
+ </request>
+
+ <request name="ModModeLine" opcode="2">
+ <field type="CARD32" name="screen" />
+ <field type="CARD16" name= "hdisplay" />
+ <field type="CARD16" name= "hsyncstart" />
+ <field type="CARD16" name= "hsyncend" />
+ <field type="CARD16" name= "htotal" />
+ <field type="CARD16" name= "hskew" />
+ <field type="CARD16" name= "vdisplay" />
+ <field type="CARD16" name= "vsyncstart" />
+ <field type="CARD16" name= "vsyncend" />
+ <field type="CARD16" name= "vtotal" />
+ <pad bytes="2" />
+ <field type="CARD32" name="flags" mask="ModeFlag" />
+ <pad bytes="12" />
+ <field type="CARD32" name="privsize" />
+ <list type="CARD8" name="private">
+ <fieldref>privsize</fieldref>
+ </list>
+ </request>
+
+ <request name="SwitchMode" opcode="3">
+ <field type="CARD16" name="screen" />
+ <field type="CARD16" name="zoom" />
+ </request>
+
+ <request name="GetMonitor" opcode="4">
+ <field type="CARD16" name="screen" />
+ <pad bytes="2" />
+ <reply>
+ <pad bytes="1" />
+ <field type="CARD8" name="vendor_length" />
+ <field type="CARD8" name="model_length" />
+ <field type="CARD8" name="num_hsync" />
+ <field type="CARD8" name="num_vsync" />
+ <pad bytes="20" />
+ <list type="SYNCRANGE" name="hsync">
+ <fieldref>num_hsync</fieldref>
+ </list>
+ <list type="SYNCRANGE" name="vsync">
+ <fieldref>num_vsync</fieldref>
+ </list>
+ <list type="char" name="vendor">
+ <fieldref>vendor_length</fieldref>
+ </list>
+ <list type="void" name="alignment_pad">
+ <op op="-">
+ <op op="&amp;">
+ <op op="+">
+ <fieldref>vendor_length</fieldref>
+ <value> 3 </value>
+ </op>
+ <unop op="~">
+ <value>3</value>
+ </unop>
+ </op>
+ <fieldref>vendor_length</fieldref>
+ </op>
+ </list>
+ <list type="char" name="model">
+ <fieldref>model_length</fieldref>
+ </list>
+ </reply>
+ </request>
+
+ <request name="LockModeSwitch" opcode="5">
+ <field type="CARD16" name="screen" />
+ <field type="CARD16" name="lock" />
+ </request>
+
+ <request name="GetAllModeLines" opcode="6">
+ <field type="CARD16" name="screen" />
+ <pad bytes="2" />
+ <reply>
+ <pad bytes="1" />
+ <field type="CARD32" name="modecount" />
+ <pad bytes="20" />
+ <list type="ModeInfo" name="modeinfo">
+ <fieldref>modecount</fieldref>
+ </list>
+ </reply>
+ </request>
+
+ <request name="AddModeLine" opcode="7">
+ <field type="CARD32" name="screen" />
+ <field type="DOTCLOCK" name="dotclock" />
+ <field type="CARD16" name= "hdisplay" />
+ <field type="CARD16" name= "hsyncstart" />
+ <field type="CARD16" name= "hsyncend" />
+ <field type="CARD16" name= "htotal" />
+ <field type="CARD16" name= "hskew" />
+ <field type="CARD16" name= "vdisplay" />
+ <field type="CARD16" name= "vsyncstart" />
+ <field type="CARD16" name= "vsyncend" />
+ <field type="CARD16" name= "vtotal" />
+ <pad bytes="2" />
+ <field type="CARD32" name="flags" mask="ModeFlag" />
+ <pad bytes="12" />
+ <field type="CARD32" name="privsize" />
+ <field type="DOTCLOCK" name="after_dotclock" />
+ <field type="CARD16" name= "after_hdisplay" />
+ <field type="CARD16" name= "after_hsyncstart" />
+ <field type="CARD16" name= "after_hsyncend" />
+ <field type="CARD16" name= "after_htotal" />
+ <field type="CARD16" name= "after_hskew" />
+ <field type="CARD16" name= "after_vdisplay" />
+ <field type="CARD16" name= "after_vsyncstart" />
+ <field type="CARD16" name= "after_vsyncend" />
+ <field type="CARD16" name= "after_vtotal" />
+ <pad bytes="2" />
+ <field type="CARD32" name="after_flags" mask="ModeFlag" />
+ <pad bytes="12" />
+ <list type="CARD8" name="private">
+ <fieldref>privsize</fieldref>
+ </list>
+ </request>
+
+ <request name="DeleteModeLine" opcode="8">
+ <field type="CARD32" name="screen" />
+ <field type="DOTCLOCK" name="dotclock" />
+ <field type="CARD16" name= "hdisplay" />
+ <field type="CARD16" name= "hsyncstart" />
+ <field type="CARD16" name= "hsyncend" />
+ <field type="CARD16" name= "htotal" />
+ <field type="CARD16" name= "hskew" />
+ <field type="CARD16" name= "vdisplay" />
+ <field type="CARD16" name= "vsyncstart" />
+ <field type="CARD16" name= "vsyncend" />
+ <field type="CARD16" name= "vtotal" />
+ <pad bytes="2" />
+ <field type="CARD32" name="flags" mask="ModeFlag" />
+ <pad bytes="12" />
+ <field type="CARD32" name="privsize" />
+ <list type="CARD8" name="private">
+ <fieldref>privsize</fieldref>
+ </list>
+ </request>
+
+ <request name="ValidateModeLine" opcode="9">
+ <field type="CARD32" name="screen" />
+ <field type="DOTCLOCK" name="dotclock" />
+ <field type="CARD16" name= "hdisplay" />
+ <field type="CARD16" name= "hsyncstart" />
+ <field type="CARD16" name= "hsyncend" />
+ <field type="CARD16" name= "htotal" />
+ <field type="CARD16" name= "hskew" />
+ <field type="CARD16" name= "vdisplay" />
+ <field type="CARD16" name= "vsyncstart" />
+ <field type="CARD16" name= "vsyncend" />
+ <field type="CARD16" name= "vtotal" />
+ <pad bytes="2" />
+ <field type="CARD32" name="flags" mask="ModeFlag" />
+ <pad bytes="12" />
+ <field type="CARD32" name="privsize" />
+ <list type="CARD8" name="private">
+ <fieldref>privsize</fieldref>
+ </list>
+ <reply>
+ <pad bytes="1" />
+ <field type="CARD32" name="status" />
+ <pad bytes="20" />
+ </reply>
+ </request>
+
+ <request name="SwitchToMode" opcode="10">
+ <field type="CARD32" name="screen" />
+ <field type="DOTCLOCK" name="dotclock" />
+ <field type="CARD16" name= "hdisplay" />
+ <field type="CARD16" name= "hsyncstart" />
+ <field type="CARD16" name= "hsyncend" />
+ <field type="CARD16" name= "htotal" />
+ <field type="CARD16" name= "hskew" />
+ <field type="CARD16" name= "vdisplay" />
+ <field type="CARD16" name= "vsyncstart" />
+ <field type="CARD16" name= "vsyncend" />
+ <field type="CARD16" name= "vtotal" />
+ <pad bytes="2" />
+ <field type="CARD32" name="flags" mask="ModeFlag" />
+ <pad bytes="12" />
+ <field type="CARD32" name="privsize" />
+ <list type="CARD8" name="private">
+ <fieldref>privsize</fieldref>
+ </list>
+ </request>
+
+ <request name="GetViewPort" opcode="11">
+ <field type="CARD16" name="screen" />
+ <pad bytes="2" />
+ <reply>
+ <pad bytes="1" />
+ <field type="CARD32" name="x" />
+ <field type="CARD32" name="y" />
+ <pad bytes="16" />
+ </reply>
+ </request>
+
+ <request name="SetViewPort" opcode="12">
+ <field type="CARD16" name="screen" />
+ <pad bytes="2" />
+ <field type="CARD32" name="x" />
+ <field type="CARD32" name="y" />
+ </request>
+
+ <!-- new for version 2.x -->
+ <request name="GetDotClocks" opcode="13">
+ <field type="CARD16" name="screen" />
+ <pad bytes="2" />
+ <reply>
+ <pad bytes="1" />
+ <field type="CARD32" name="flags" mask="ClockFlag" />
+ <field type="CARD32" name="clocks" />
+ <field type="CARD32" name="maxclocks" />
+ <pad bytes="12" />
+ <list type="CARD32" name="clock">
+ <!-- Only if flags does not include Programable:
+ (1 - (flags & 1)) * clocks
+ -->
+ <op op="*">
+ <op op = "-">
+ <value>1</value>
+ <op op="&amp;">
+ <fieldref>flags</fieldref>
+ <value>1</value>
+ </op>
+ </op>
+ <fieldref>clocks</fieldref>
+ </op>
+ </list>
+ </reply>
+ </request>
+
+ <request name="SetClientVersion" opcode="14">
+ <field type="CARD16" name="major" />
+ <field type="CARD16" name="minor" />
+ </request>
+
+ <request name="SetGamma" opcode="15">
+ <field type="CARD16" name="screen" />
+ <pad bytes="2" />
+ <field type="CARD32" name="red" />
+ <field type="CARD32" name="green" />
+ <field type="CARD32" name="blue" />
+ <pad bytes="12" />
+ </request>
+
+ <request name="GetGamma" opcode="16">
+ <field type="CARD16" name="screen" />
+ <pad bytes="26" />
+ <reply>
+ <pad bytes="1" />
+ <field type="CARD32" name="red" />
+ <field type="CARD32" name="green" />
+ <field type="CARD32" name="blue" />
+ <pad bytes="12" />
+ </reply>
+ </request>
+
+ <request name="GetGammaRamp" opcode="17">
+ <field type="CARD16" name="screen" />
+ <field type="CARD16" name="size" />
+ <reply>
+ <pad bytes="1" />
+ <field type="CARD16" name="size" />
+ <pad bytes="22" />
+ <list type="CARD16" name="red">
+ <op op="&amp;">
+ <op op = "+">
+ <fieldref>size</fieldref>
+ <value>1</value>
+ </op>
+ <unop op="~">
+ <value>1</value>
+ </unop>
+ </op>
+ </list>
+ <list type="CARD16" name="green">
+ <op op="&amp;">
+ <op op = "+">
+ <fieldref>size</fieldref>
+ <value>1</value>
+ </op>
+ <unop op="~">
+ <value>1</value>
+ </unop>
+ </op>
+ </list>
+ <list type="CARD16" name="blue">
+ <op op="&amp;">
+ <op op = "+">
+ <fieldref>size</fieldref>
+ <value>1</value>
+ </op>
+ <unop op="~">
+ <value>1</value>
+ </unop>
+ </op>
+ </list>
+ </reply>
+ </request>
+
+ <request name="SetGammaRamp" opcode="18">
+ <field type="CARD16" name="screen" />
+ <field type="CARD16" name="size" />
+ <list type="CARD16" name="red">
+ <op op="&amp;">
+ <op op = "+">
+ <fieldref>size</fieldref>
+ <value>1</value>
+ </op>
+ <unop op="~">
+ <value>1</value>
+ </unop>
+ </op>
+ </list>
+ <list type="CARD16" name="green">
+ <op op="&amp;">
+ <op op = "+">
+ <fieldref>size</fieldref>
+ <value>1</value>
+ </op>
+ <unop op="~">
+ <value>1</value>
+ </unop>
+ </op>
+ </list>
+ <list type="CARD16" name="blue">
+ <op op="&amp;">
+ <op op = "+">
+ <fieldref>size</fieldref>
+ <value>1</value>
+ </op>
+ <unop op="~">
+ <value>1</value>
+ </unop>
+ </op>
+ </list>
+ </request>
+
+ <request name="GetGammaRampSize" opcode="19">
+ <field type="CARD16" name="screen" />
+ <pad bytes="2" />
+ <reply>
+ <pad bytes="1" />
+ <field type="CARD16" name="size" />
+ <pad bytes="22" />
+ </reply>
+ </request>
+
+ <request name="GetPermissions" opcode="20">
+ <field type="CARD16" name="screen" />
+ <pad bytes="2" />
+ <reply>
+ <pad bytes="1" />
+ <field type="CARD32" name="permissions" mask="Permission" />
+ <pad bytes="20" />
+ </reply>
+ </request>
+
+ <error name="BadClock" number="0" />
+ <error name="BadHTimings" number="1" />
+ <error name="BadVTimings" number="2" />
+ <error name="ModeUnsuitable" number="3" />
+ <error name="ExtensionDisabled" number="4" />
+ <error name="ClientNotLocal" number="5" />
+ <error name="ZoomLocked" number="6" />
+
+</xcb>
diff --git a/libxcb/xcb-proto/src/xkb.xml b/libxcb/xcb-proto/src/xkb.xml
new file mode 100644
index 000000000..33d3ea354
--- /dev/null
+++ b/libxcb/xcb-proto/src/xkb.xml
@@ -0,0 +1,2759 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+Copyright (C) 2009 Open Text Corporation. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the authors or their
+institutions shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization from the authors.
+-->
+<xcb header="xkb" extension-xname="XKEYBOARD" extension-name="xkb"
+ major-version="1" minor-version="0">
+
+ <import>xproto</import>
+
+ <!-- Common Types -->
+ <enum name="Const">
+ <item name="MaxLegalKeyCode"> <value>255</value> </item>
+ <item name="PerKeyBitArraySize">
+ <value>32</value>
+ </item>
+ <item name="KeyNameLength">
+ <value>4</value>
+ </item>
+ </enum>
+
+ <enum name="EventType">
+ <item name="NewKeyboardNotify"> <bit>0</bit> </item>
+ <item name="MapNotify"> <bit>1</bit> </item>
+ <item name="StateNotify"> <bit>2</bit> </item>
+ <item name="ControlsNotify"> <bit>3</bit> </item>
+ <item name="IndicatorStateNotify"> <bit>4</bit> </item>
+ <item name="IndicatorMapNotify"> <bit>5</bit> </item>
+ <item name="NamesNotify"> <bit>6</bit> </item>
+ <item name="CompatMapNotify"> <bit>7</bit> </item>
+ <item name="BellNotify"> <bit>8</bit> </item>
+ <item name="ActionMessage"> <bit>9</bit> </item>
+ <item name="AccessXNotify"> <bit>10</bit> </item>
+ <item name="ExtensionDeviceNotify"> <bit>11</bit> </item>
+ </enum>
+
+ <enum name="NKNDetail">
+ <item name="Keycodes"> <bit>0</bit> </item>
+ <item name="Geometry"> <bit>1</bit> </item>
+ <item name="DeviceID"> <bit>2</bit> </item>
+ </enum>
+
+ <enum name="AXNDetail">
+ <item name="SKPress"> <bit>0</bit> </item>
+ <item name="SKAccept"> <bit>1</bit> </item>
+ <item name="SKReject"> <bit>2</bit> </item>
+ <item name="SKRelease"> <bit>3</bit> </item>
+ <item name="BKAccept"> <bit>4</bit> </item>
+ <item name="BKReject"> <bit>5</bit> </item>
+ <item name="AXKWarning"> <bit>6</bit> </item>
+ </enum>
+
+ <enum name="MapPart">
+ <item name="KeyTypes"> <bit>0</bit> </item>
+ <item name="KeySyms"> <bit>1</bit> </item>
+ <item name="ModifierMap"> <bit>2</bit> </item>
+ <item name="ExplicitComponents"> <bit>3</bit> </item>
+ <item name="KeyActions"> <bit>4</bit> </item>
+ <item name="KeyBehaviors"> <bit>5</bit> </item>
+ <item name="VirtualMods"> <bit>6</bit> </item>
+ <item name="VirtualModMap"> <bit>7</bit> </item>
+ </enum>
+
+ <enum name="SetMapFlags">
+ <item name="ResizeTypes"> <bit>0</bit> </item>
+ <item name="RecomputeActions"> <bit>1</bit> </item>
+ </enum>
+
+ <enum name="StatePart">
+ <item name="ModifierState"> <bit>0</bit> </item>
+ <item name="ModifierBase"> <bit>1</bit> </item>
+ <item name="ModifierLatch"> <bit>2</bit> </item>
+ <item name="ModifierLock"> <bit>3</bit> </item>
+ <item name="GroupState"> <bit>4</bit> </item>
+ <item name="GroupBase"> <bit>5</bit> </item>
+ <item name="GroupLatch"> <bit>6</bit> </item>
+ <item name="GroupLock"> <bit>7</bit> </item>
+ <item name="CompatState"> <bit>8</bit> </item>
+ <item name="GrabMods"> <bit>9</bit> </item>
+ <item name="CompatGrabMods"> <bit>10</bit> </item>
+ <item name="LookupMods"> <bit>11</bit> </item>
+ <item name="CompatLookupMods"> <bit>12</bit> </item>
+ <item name="PointerButtons"> <bit>13</bit> </item>
+ </enum>
+
+ <enum name="BoolCtrl">
+ <item name="RepeatKeys"> <bit>0</bit> </item>
+ <item name="SlowKeys"> <bit>1</bit> </item>
+ <item name="BounceKeys"> <bit>2</bit> </item>
+ <item name="StickyKeys"> <bit>3</bit> </item>
+ <item name="MouseKeys"> <bit>4</bit> </item>
+ <item name="MouseKeysAccel"> <bit>5</bit> </item>
+ <item name="AccessXKeys"> <bit>6</bit> </item>
+ <item name="AccessXTimeoutMask"> <bit>7</bit> </item>
+ <item name="AccessXFeedbackMask"> <bit>8</bit> </item>
+ <item name="AudibleBellMask"> <bit>9</bit> </item>
+ <item name="Overlay1Mask"> <bit>10</bit> </item>
+ <item name="Overlay2Mask"> <bit>11</bit> </item>
+ <item name="IgnoreGroupLockMask"> <bit>12</bit> </item>
+ </enum>
+
+ <!-- XXX: one zero less than XKB specification says,
+ uses the same values as libX11 -->
+ <enum name="Control" >
+ <item name="GroupsWrap"> <bit>27</bit> </item>
+ <item name="InternalMods"> <bit>28</bit> </item>
+ <item name="IgnoreLockMods"> <bit>29</bit> </item>
+ <item name="PerKeyRepeat"> <bit>30</bit> </item>
+ <item name="ControlsEnabled"> <bit>31</bit> </item>
+ </enum>
+
+ <enum name="AXFBOpt">
+ <item name="SKPressFB"> <bit>0</bit> </item>
+ <item name="SKAcceptFB"> <bit>1</bit> </item>
+ <item name="FeatureFB"> <bit>2</bit> </item>
+ <item name="SlowWarnFB"> <bit>3</bit> </item>
+ <item name="IndicatorFB"> <bit>4</bit> </item>
+ <item name="StickyKeysFB"> <bit>5</bit> </item>
+ <item name="SKReleaseFB"> <bit>6</bit> </item>
+ <item name="SKRejectFB"> <bit>7</bit> </item>
+ <item name="BKRejectFB"> <bit>8</bit> </item>
+ <item name="DumbBell"> <bit>9</bit> </item>
+ </enum>
+
+ <enum name="AXSKOpt">
+ <item name="TwoKeys"> <bit>6</bit> </item>
+ <item name="LatchToLock"> <bit>7</bit> </item>
+ </enum>
+
+ <union name="AXOption">
+ <field name="fbopt" type="CARD16" enum="AXFBOpt" />
+ <field name="skopt" type="CARD16" enum="AXSKOpt" />
+ </union>
+
+ <typedef oldname="CARD16" newname="DeviceSpec" />
+
+ <enum name="LedClassResult">
+ <item name="KbdFeedbackClass"> <value>0</value> </item>
+ <item name="LedFeedbackClass"> <value>4</value> </item>
+ </enum>
+
+ <enum name="LedClass">
+ <item name="DfltXIClass"> <value>768</value> </item> <!--0x300-->
+ <item name="AllXIClasses"> <value>1280</value> </item> <!--0x500-->
+ </enum>
+ <typedef oldname="CARD16" newname="LedClassSpec" />
+
+ <enum name="BellClassResult">
+ <item name="KbdFeedbackClass"> <value>0</value> </item>
+ <item name="BellFeedbackClass"> <value>5</value> </item>
+ </enum>
+
+ <enum name="BellClass">
+ <item name="DfltXIClass"> <value>768</value> </item> <!--0x300-->
+ </enum>
+ <typedef oldname="CARD16" newname="BellClassSpec" />
+
+ <enum name="ID">
+ <item name="UseCoreKbd"> <value>256</value> </item> <!-- 0x100 -->
+ <item name="UseCorePtr"> <value>512</value> </item> <!-- 0x200 -->
+ <item name="DfltXIClass"> <value>768</value> </item> <!-- 0x300 -->
+ <item name="DfltXIId"> <value>1024</value> </item> <!-- 0x400 -->
+ <item name="AllXIClass"> <value>1280</value> </item> <!-- 0x500 -->
+ <item name="AllXIId"> <value>1536</value> </item> <!-- 0x600 -->
+ <item name="XINone"> <value>65280</value> </item> <!--0xff00-->
+ </enum>
+ <typedef oldname="CARD16" newname="IDSpec" />
+
+ <enum name="Group">
+ <item name="1"> <value>0</value> </item>
+ <item name="2"> <value>1</value> </item>
+ <item name="3"> <value>2</value> </item>
+ <item name="4"> <value>3</value> </item>
+ </enum>
+
+ <enum name="Groups">
+ <item name="Any"> <value>254</value> </item>
+ <item name="All"> <value>255</value> </item>
+ </enum>
+
+ <enum name="SetOfGroup">
+ <item name="Group1"> <bit>0</bit> </item>
+ <item name="Group2"> <bit>1</bit> </item>
+ <item name="Group3"> <bit>2</bit> </item>
+ <item name="Group4"> <bit>3</bit> </item>
+ </enum>
+
+ <enum name="SetOfGroups">
+ <item name="Any"> <bit>7</bit> </item>
+ </enum>
+
+ <enum name="GroupsWrap">
+ <item name="WrapIntoRange"> <value>0</value> </item>
+ <item name="ClampIntoRange"> <bit>6</bit> </item>
+ <item name="RedirectIntoRange"> <bit>7</bit> </item>
+ </enum>
+
+ <enum name="VModsHigh">
+ <item name="15"> <bit>7</bit> </item>
+ <item name="14"> <bit>6</bit> </item>
+ <item name="13"> <bit>5</bit> </item>
+ <item name="12"> <bit>4</bit> </item>
+ <item name="11"> <bit>3</bit> </item>
+ <item name="10"> <bit>2</bit> </item>
+ <item name="9"> <bit>1</bit> </item>
+ <item name="8"> <bit>0</bit> </item>
+ </enum>
+
+ <enum name="VModsLow">
+ <item name="7"> <bit>7</bit> </item>
+ <item name="6"> <bit>6</bit> </item>
+ <item name="5"> <bit>5</bit> </item>
+ <item name="4"> <bit>4</bit> </item>
+ <item name="3"> <bit>3</bit> </item>
+ <item name="2"> <bit>2</bit> </item>
+ <item name="1"> <bit>1</bit> </item>
+ <item name="0"> <bit>0</bit> </item>
+ </enum>
+
+ <enum name="VMod">
+ <item name="15"> <bit>15</bit> </item>
+ <item name="14"> <bit>14</bit> </item>
+ <item name="13"> <bit>13</bit> </item>
+ <item name="12"> <bit>12</bit> </item>
+ <item name="11"> <bit>11</bit> </item>
+ <item name="10"> <bit>10</bit> </item>
+ <item name="9"> <bit>9</bit> </item>
+ <item name="8"> <bit>8</bit> </item>
+ <item name="7"> <bit>7</bit> </item>
+ <item name="6"> <bit>6</bit> </item>
+ <item name="5"> <bit>5</bit> </item>
+ <item name="4"> <bit>4</bit> </item>
+ <item name="3"> <bit>3</bit> </item>
+ <item name="2"> <bit>2</bit> </item>
+ <item name="1"> <bit>1</bit> </item>
+ <item name="0"> <bit>0</bit> </item>
+ </enum>
+
+ <enum name="Explicit">
+ <item name="VModMap"> <bit>7</bit> </item>
+ <item name="Behavior"> <bit>6</bit> </item>
+ <item name="AutoRepeat"> <bit>5</bit> </item>
+ <item name="Interpret"> <bit>4</bit> </item>
+ <item name="KeyType4"> <bit>3</bit> </item>
+ <item name="KeyType3"> <bit>2</bit> </item>
+ <item name="KeyType2"> <bit>1</bit> </item>
+ <item name="KeyType1"> <bit>0</bit> </item>
+ </enum>
+
+ <enum name="SymInterpret">
+ <item name="NoneOf"> <value>0</value> </item>
+ <item name="AnyOfOrNone"> <value>1</value> </item>
+ <item name="AnyOf"> <value>2</value> </item>
+ <item name="AllOf"> <value>3</value> </item>
+ <item name="Exactly"> <value>4</value> </item>
+ </enum>
+
+ <enum name="SymInterpMatch">
+ <item name="LevelOneOnly"> <bit>7</bit> </item>
+ <item name="OpMask"> <value>127</value> </item> <!--0x7f-->
+ </enum>
+
+ <enum name="IMFlag">
+ <item name="NoExplicit"> <bit>7</bit> </item>
+ <item name="NoAutomatic"> <bit>6</bit> </item>
+ <item name="LEDDrivesKB"> <bit>5</bit> </item>
+ </enum>
+
+ <enum name="IMModsWhich">
+ <item name="UseCompat"> <bit>4</bit> </item>
+ <item name="UseEffective"> <bit>3</bit> </item>
+ <item name="UseLocked"> <bit>2</bit> </item>
+ <item name="UseLatched"> <bit>1</bit> </item>
+ <item name="UseBase"> <bit>0</bit> </item>
+ </enum>
+
+ <enum name="IMGroupsWhich">
+ <item name="UseCompat"> <bit>4</bit> </item>
+ <item name="UseEffective"> <bit>3</bit> </item>
+ <item name="UseLocked"> <bit>2</bit> </item>
+ <item name="UseLatched"> <bit>1</bit> </item>
+ <item name="UseBase"> <bit>0</bit> </item>
+ </enum>
+
+ <struct name="IndicatorMap">
+ <field name="flags" type="CARD8" enum="IMFlag" />
+ <field name="whichGroups" type="CARD8" enum="IMGroupsWhich" />
+ <field name="groups" type="CARD8" enum="SetOfGroup" />
+ <field name="whichMods" type="CARD8" enum="IMModsWhich" />
+ <field name="mods" type="CARD8" mask="ModMask" />
+ <field name="realMods" type="CARD8" mask="ModMask" />
+ <field name="vmods" type="CARD16" mask="VMod" />
+ <field name="ctrls" type="CARD32" enum="BoolCtrl" />
+ </struct>
+
+ <enum name="CMDetail">
+ <item name="SymInterp"> <bit>0</bit> </item>
+ <item name="GroupCompat"> <bit>1</bit> </item>
+ </enum>
+
+ <enum name="NameDetail">
+ <item name="Keycodes"> <bit>0</bit> </item>
+ <item name="Geometry"> <bit>1</bit> </item>
+ <item name="Symbols"> <bit>2</bit> </item>
+ <item name="PhysSymbols"> <bit>3</bit> </item>
+ <item name="Types"> <bit>4</bit> </item>
+ <item name="Compat"> <bit>5</bit> </item>
+ <item name="KeyTypeNames"> <bit>6</bit> </item>
+ <item name="KTLevelNames"> <bit>7</bit> </item>
+ <item name="IndicatorNames"> <bit>8</bit> </item>
+ <item name="KeyNames"> <bit>9</bit> </item>
+ <item name="KeyAliases"> <bit>10</bit> </item>
+ <item name="VirtualModNames"> <bit>11</bit> </item>
+ <item name="GroupNames"> <bit>12</bit> </item>
+ <item name="RGNames"> <bit>13</bit> </item>
+ </enum>
+
+ <enum name="GBNDetail">
+ <item name="Types"> <bit>0</bit> </item>
+ <item name="CompatMap"> <bit>1</bit> </item>
+ <item name="ClientSymbols"> <bit>2</bit> </item>
+ <item name="ServerSymbols"> <bit>3</bit> </item>
+ <item name="IndicatorMaps"> <bit>4</bit> </item>
+ <item name="KeyNames"> <bit>5</bit> </item>
+ <item name="Geometry"> <bit>6</bit> </item>
+ <item name="OtherNames"> <bit>7</bit> </item>
+ </enum>
+
+ <enum name="XIFeature">
+ <item name="Keyboards"> <bit>0</bit> </item>
+ <item name="ButtonActions"> <bit>1</bit> </item>
+ <item name="IndicatorNames"> <bit>2</bit> </item>
+ <item name="IndicatorMaps"> <bit>3</bit> </item>
+ <item name="IndicatorState"> <bit>4</bit> </item>
+ </enum>
+
+ <enum name="PerClientFlag">
+ <item name="DetectableAutoRepeat"> <bit>0</bit> </item>
+ <item name="GrabsUseXKBState"> <bit>1</bit> </item>
+ <item name="AutoResetControls"> <bit>2</bit> </item>
+ <item name="LookupStateWhenGrabbed"> <bit>3</bit> </item>
+ <item name="SendEventUsesXKBState"> <bit>4</bit> </item>
+ </enum>
+
+ <struct name="ModDef">
+ <field name="mask" type="CARD8" mask="ModMask" />
+ <field name="realMods" type="CARD8" mask="ModMask" />
+ <field name="vmods" type="CARD16" mask="VMod" />
+ </struct>
+
+ <struct name="KeyName">
+ <list name="name" type="CARD8">
+ <value>4</value>
+ </list>
+ </struct>
+
+ <struct name="KeyAlias">
+ <list name="real" type="CARD8">
+ <value>4</value>
+ </list>
+ <list name="alias" type="CARD8">
+ <value>4</value>
+ </list>
+ </struct>
+
+ <struct name="CountedString8">
+ <field name="length" type="CARD8" />
+ <list name="string" type="CARD8">
+ <fieldref>length</fieldref>
+ </list>
+ </struct>
+
+ <struct name="CountedString16">
+ <field name="length" type="CARD16" />
+ <list name="string" type="CARD8">
+ <fieldref>length</fieldref>
+ </list>
+ <pad bytes="1" />
+ </struct>
+
+ <struct name="KTMapEntry">
+ <field name="active" type="BOOL" />
+ <field name="mods_mask" type="CARD8" mask="ModMask" />
+ <field name="level" type="CARD8" />
+ <field name="mods_mods" type="CARD8" mask="ModMask" />
+ <field name="mods_vmods" type="CARD16" mask="VMod" />
+ <pad bytes="2" />
+ </struct>
+
+ <struct name="KeyType">
+ <field name="mods_mask" type="CARD8" mask="ModMask" />
+ <field name="mods_mods" type="CARD8" mask="ModMask" />
+ <field name="mods_vmods" type="CARD16" mask="VMod" />
+ <field name="numLevels" type="CARD8" />
+ <field name="nMapEntries" type="CARD8" />
+ <field name="hasPreserve" type="BOOL" />
+ <pad bytes="1" />
+ <list name="map" type="KTMapEntry">
+ <fieldref>nMapEntries</fieldref>
+ </list>
+ <list name="preserve" type="ModDef">
+ <op op="*">
+ <fieldref>hasPreserve</fieldref>
+ <fieldref>nMapEntries</fieldref>
+ </op>
+ </list>
+ </struct>
+
+ <struct name="KeySymMap">
+ <list name="kt_index" type="CARD8">
+ <value>4</value>
+ </list>
+ <field name="groupInfo" type="CARD8" />
+ <field name="width" type="CARD8" />
+ <field name="nSyms" type="CARD16" />
+ <list name="syms" type="KEYSYM">
+ <fieldref>nSyms</fieldref>
+ </list>
+ </struct>
+
+ <!-- Key Behaviors -->
+
+ <struct name="CommonBehavior">
+ <field name="type" type="CARD8" />
+ <field name="data" type="CARD8" />
+ </struct>
+
+ <struct name="DefaultBehavior">
+ <field name="type" type="CARD8" />
+ <pad bytes="1" />
+ </struct>
+
+ <typedef oldname="DefaultBehavior" newname="LockBehavior" />
+
+ <struct name="RadioGroupBehavior">
+ <field name="type" type="CARD8" />
+ <field name="group" type="CARD8" />
+ </struct>
+
+ <struct name="Overlay1Behavior">
+ <field name="type" type="CARD8" />
+ <field name="key" type="KEYCODE" />
+ </struct>
+
+ <struct name="Overlay2Behavior">
+ <field name="type" type="CARD8" />
+ <field name="key" type="CARD8" />
+ </struct>
+
+ <typedef oldname="LockBehavior" newname="PermamentLockBehavior" />
+ <typedef oldname="RadioGroupBehavior" newname="PermamentRadioGroupBehavior" />
+ <typedef oldname="Overlay1Behavior" newname="PermamentOverlay1Behavior" />
+ <typedef oldname="Overlay2Behavior" newname="PermamentOverlay2Behavior" />
+
+ <union name="Behavior">
+ <field name="common" type="CommonBehavior" />
+ <field name="default" type="DefaultBehavior" />
+ <field name="lock" type="LockBehavior" />
+ <field name="radioGroup" type="RadioGroupBehavior" />
+ <field name="overlay1" type="Overlay1Behavior" />
+ <field name="overlay2" type="Overlay2Behavior" />
+ <field name="permamentLock" type="PermamentLockBehavior" />
+ <field name="permamentRadioGroup" type="PermamentRadioGroupBehavior" />
+ <field name="permamentOverlay1" type="PermamentOverlay1Behavior" />
+ <field name="permamentOverlay2" type="PermamentOverlay2Behavior" />
+ <field name="type" type="CARD8" />
+ </union>
+
+ <enum name="BehaviorType">
+ <item name="Default"> <value>0</value> </item> <!--0x00-->
+ <item name="Lock"> <value>1</value> </item> <!--0x01-->
+ <item name="RadioGroup"> <value>2</value> </item> <!--0x02-->
+ <item name="Overlay1"> <value>3</value> </item> <!--0x03-->
+ <item name="Overlay2"> <value>4</value> </item> <!--0x04-->
+ <item name="PermamentLock"> <value>129</value> </item> <!--0x81-->
+ <item name="PermamentRadioGroup"> <value>130</value> </item> <!--0x82-->
+ <item name="PermamentOverlay1"> <value>131</value> </item> <!--0x83-->
+ <item name="PermamentOverlay2"> <value>132</value> </item> <!--0x84-->
+ </enum>
+
+ <struct name="SetBehavior">
+ <field name="keycode" type="KEYCODE" />
+ <field name="behavior" type="Behavior" />
+ <pad bytes="1" />
+ </struct>
+
+ <struct name="SetExplicit">
+ <field name="keycode" type="KEYCODE" />
+ <field name="explicit" type="CARD8" mask="Explicit" />
+ </struct>
+
+ <struct name="KeyModMap">
+ <field name="keycode" type="KEYCODE" />
+ <field name="mods" type="CARD8" mask="ModMask" />
+ </struct>
+
+ <struct name="KeyVModMap">
+ <field name="keycode" type="KEYCODE" />
+ <pad bytes="1" />
+ <field name="vmods" type="CARD16" mask="VMod" />
+ </struct>
+
+ <struct name="KTSetMapEntry">
+ <field name="level" type="CARD8" />
+ <field name="realMods" type="CARD8" mask="ModMask" />
+ <field name="virtualMods" type="CARD16" mask="VMod" />
+ </struct>
+
+ <struct name="SetKeyType">
+ <field name="mask" type="CARD8" mask="ModMask" />
+ <field name="realMods" type="CARD8" mask="ModMask" />
+ <field name="virtualMods" type="CARD16" mask="VMod" />
+ <field name="numLevels" type="CARD8" />
+ <field name="nMapEntries" type="CARD8" />
+ <field name="preserve" type="BOOL" />
+ <pad bytes="1" />
+ <list name="entries" type="KTSetMapEntry">
+ <fieldref>nMapEntries</fieldref>
+ </list>
+ <list name="preserve_entries" type="KTSetMapEntry">
+ <op op = "*">
+ <fieldref>preserve</fieldref>
+ <fieldref>nMapEntries</fieldref>
+ </op>
+ </list>
+ </struct>
+
+ <typedef oldname="char" newname="STRING8" />
+
+ <struct name="Property">
+ <field name="nameLength" type="CARD16" />
+ <list name="name" type="STRING8">
+ <fieldref>nameLength</fieldref>
+ </list>
+ <field name="valueLength" type="CARD16" />
+ <list name="value" type="STRING8">
+ <fieldref>valueLength</fieldref>
+ </list>
+ </struct>
+
+ <struct name="Outline">
+ <field name="nPoints" type="CARD8" />
+ <field name="cornerRadius" type="CARD8" />
+ <pad bytes="2" />
+ <list name="points" type="POINT">
+ <fieldref>nPoints</fieldref>
+ </list>
+ </struct>
+
+ <struct name="Shape">
+ <field name="name" type="ATOM" />
+ <field name="nOutlines" type="CARD8" />
+ <field name="primaryNdx" type="CARD8" />
+ <field name="approxNdx" type="CARD8" />
+ <pad bytes="1" />
+ <list name="outlines" type="Outline">
+ <fieldref>nOutlines</fieldref>
+ </list>
+ </struct>
+
+ <struct name="Key">
+ <list name="name" type="STRING8">
+ <value>4</value>
+ </list>
+ <field name="gap" type="INT16" />
+ <field name="shapeNdx" type="CARD8" />
+ <field name="colorNdx" type="CARD8" />
+ </struct>
+
+ <struct name="OverlayKey">
+ <list name="over" type="STRING8">
+ <value>4</value>
+ </list>
+ <list name="under" type="STRING8">
+ <value>4</value>
+ </list>
+ </struct>
+
+ <struct name="OverlayRow">
+ <field name="rowUnder" type="CARD8" />
+ <field name="nKeys" type="CARD8" />
+ <pad bytes="2" />
+ <list name="keys" type="OverlayKey">
+ <fieldref>nKeys</fieldref>
+ </list>
+ </struct>
+
+ <struct name="Overlay">
+ <field name="name" type="ATOM" />
+ <field name="nRows" type="CARD8" />
+ <pad bytes="3" />
+ <list name="rows" type="OverlayRow">
+ <fieldref>nRows</fieldref>
+ </list>
+ </struct>
+
+ <struct name="Row">
+ <field name="top" type="INT16" />
+ <field name="left" type="INT16" />
+ <field name="nKeys" type="CARD8" />
+ <field name="vertical" type="BOOL" />
+ <pad bytes="2" />
+ <list name="keys" type="Key">
+ <fieldref>nKeys</fieldref>
+ </list>
+ </struct>
+
+ <enum name="DoodadType">
+ <item name="Outline"> <value>1</value> </item>
+ <item name="Solid"> <value>2</value> </item>
+ <item name="Text"> <value>3</value> </item>
+ <item name="Indicator"> <value>4</value> </item>
+ <item name="Logo"> <value>5</value> </item>
+ </enum>
+
+ <struct name="CommonDoodad">
+ <field name="name" type="ATOM" />
+ <field name="type" type="CARD8" enum="DoodadType" />
+ <field name="priority" type="CARD8" />
+ <field name="top" type="INT16" />
+ <field name="left" type="INT16" />
+ <field name="angle" type="INT16" />
+ </struct>
+
+ <struct name="ShapeDoodad">
+ <field name="name" type="ATOM" />
+ <field name="type" type="CARD8" enum="DoodadType" />
+ <field name="priority" type="CARD8" />
+ <field name="top" type="INT16" />
+ <field name="left" type="INT16" />
+ <field name="angle" type="INT16" />
+ <field name="colorNdx" type="CARD8" />
+ <field name="shapeNdx" type="CARD8" />
+ <pad bytes="6" />
+ </struct>
+
+ <struct name="TextDoodad">
+ <field name="name" type="ATOM" />
+ <field name="type" type="CARD8" enum="DoodadType" />
+ <field name="priority" type="CARD8" />
+ <field name="top" type="INT16" />
+ <field name="left" type="INT16" />
+ <field name="angle" type="INT16" />
+ <field name="width" type="CARD16" />
+ <field name="height" type="CARD16" />
+ <field name="colorNdx" type="CARD8" />
+ <pad bytes="3" />
+ <field name="text" type="CountedString16" />
+ <field name="font" type="CountedString16" />
+ </struct>
+
+ <struct name="IndicatorDoodad">
+ <field name="name" type="ATOM" />
+ <field name="type" type="CARD8" enum="DoodadType" />
+ <field name="priority" type="CARD8" />
+ <field name="top" type="INT16" />
+ <field name="left" type="INT16" />
+ <field name="angle" type="INT16" />
+ <field name="shapeNdx" type="CARD8" />
+ <field name="onColorNdx" type="CARD8" />
+ <field name="offColorNdx" type="CARD8" />
+ <pad bytes="5" />
+ </struct>
+
+ <struct name="LogoDoodad">
+ <field name="name" type="ATOM" />
+ <field name="type" type="CARD8" enum="DoodadType" />
+ <field name="priority" type="CARD8" />
+ <field name="top" type="INT16" />
+ <field name="left" type="INT16" />
+ <field name="angle" type="INT16" />
+ <field name="colorNdx" type="CARD8" />
+ <field name="shapeNdx" type="CARD8" />
+ <pad bytes="6" />
+ <field name="logoName" type="CountedString16" />
+ </struct>
+
+ <union name="Doodad">
+ <field name="common" type="CommonDoodad" />
+ <field name="shape" type="ShapeDoodad" />
+ <field name="text" type="TextDoodad" />
+ <field name="indicator" type="IndicatorDoodad" />
+ <field name="logo" type="LogoDoodad" />
+ </union>
+
+ <struct name="Section">
+ <field name="name" type="ATOM" />
+ <field name="top" type="INT16" />
+ <field name="left" type="INT16" />
+ <field name="width" type="CARD16" />
+ <field name="height" type="CARD16" />
+ <field name="angle" type="INT16" />
+ <field name="priority" type="CARD8" />
+ <field name="nRows" type="CARD8" />
+ <field name="nDoodads" type="CARD8" />
+ <field name="nOverlays" type="CARD8" />
+ <pad bytes="2" />
+ <list name="rows" type="Row">
+ <fieldref>nRows</fieldref>
+ </list>
+ <list name="doodads" type="Doodad">
+ <fieldref>nDoodads</fieldref>
+ </list>
+ <list name="overlays" type="Overlay">
+ <fieldref>nOverlays</fieldref>
+ </list>
+ </struct>
+
+ <struct name="Listing">
+ <field name="flags" type="CARD16" />
+ <field name="length" type="CARD16" />
+ <list name="string" type="STRING8">
+ <fieldref>length</fieldref>
+ </list>
+ </struct>
+
+ <struct name="DeviceLedInfo">
+ <field name="ledClass" type="LedClassSpec" enum="LedClass" />
+ <field name="ledID" type="IDSpec" altenum="ID" />
+ <field name="namesPresent" type="CARD32" />
+ <field name="mapsPresent" type="CARD32" />
+ <field name="physIndicators" type="CARD32" />
+ <field name="state" type="CARD32" />
+ <list name="names" type="ATOM">
+ <popcount>
+ <fieldref>namesPresent</fieldref>
+ </popcount>
+ </list>
+ <list name="maps" type="IndicatorMap">
+ <popcount>
+ <fieldref>mapsPresent</fieldref>
+ </popcount>
+ </list>
+ </struct>
+
+ <!-- Errors -->
+
+ <enum name="Error">
+ <item name="BadDevice"> <value>255</value> </item> <!--0xff-->
+ <item name="BadClass"> <value>254</value> </item> <!--0xfe-->
+ <item name="BadId"> <value>253</value> </item> <!--0xfd-->
+ </enum>
+
+ <error name="Keyboard" number="0">
+ <field name="value" type="CARD32" />
+ <field name="minorOpcode" type="CARD16" />
+ <field name="majorOpcode" type="CARD8" />
+ <pad bytes="21" />
+ </error>
+
+ <!-- Key Actions -->
+
+ <enum name="SA">
+ <item name="ClearLocks"> <bit>0</bit> </item>
+ <item name="LatchToLock"> <bit>1</bit> </item>
+ <item name="UseModMapMods"> <bit>2</bit> </item>
+ <item name="GroupAbsolute"> <bit>2</bit> </item>
+ </enum>
+
+ <enum name="SAType">
+ <item name="NoAction"> <value>0</value> </item>
+ <item name="SetMods"> <value>1</value> </item>
+ <item name="LatchMods"> <value>2</value> </item>
+ <item name="LockMods"> <value>3</value> </item>
+ <item name="SetGroup"> <value>4</value> </item>
+ <item name="LatchGroup"> <value>5</value> </item>
+ <item name="LockGroup"> <value>6</value> </item>
+ <item name="MovePtr"> <value>7</value> </item>
+ <item name="PtrBtn"> <value>8</value> </item>
+ <item name="LockPtrBtn"> <value>9</value> </item>
+ <item name="SetPtrDflt"> <value>10</value> </item>
+ <item name="ISOLock"> <value>11</value> </item>
+ <item name="Terminate"> <value>12</value> </item>
+ <item name="SwitchScreen"> <value>13</value> </item>
+ <item name="SetControls"> <value>14</value> </item>
+ <item name="LockControls"> <value>15</value> </item>
+ <item name="ActionMessage"> <value>16</value> </item>
+ <item name="RedirectKey"> <value>17</value> </item>
+ <item name="DeviceBtn"> <value>18</value> </item>
+ <item name="LockDeviceBtn"> <value>19</value> </item>
+ <item name="DeviceValuator"> <value>20</value> </item>
+ </enum>
+
+ <struct name="SANoAction">
+ <field name="type" type="CARD8" enum="SAType" />
+ <pad bytes="7" />
+ </struct>
+
+ <struct name="SASetMods">
+ <field name="type" type="CARD8" enum="SAType" />
+ <field name="flags" type="CARD8" mask="SA" />
+ <field name="mask" type="CARD8" mask="ModMask" />
+ <field name="realMods" type="CARD8" mask="ModMask" />
+ <field name="vmodsHigh" type="CARD8" mask="VModsHigh" />
+ <field name="vmodsLow" type="CARD8" mask="VModsLow" />
+ <pad bytes="2" />
+ </struct>
+
+ <typedef oldname="SASetMods" newname="SALatchMods" />
+
+ <typedef oldname="SASetMods" newname="SALockMods" />
+
+ <struct name="SASetGroup">
+ <field name="type" type="CARD8" enum="SAType" />
+ <field name="flags" type="CARD8" mask="SA" />
+ <field name="group" type="INT8" />
+ <pad bytes="5" />
+ </struct>
+
+ <typedef oldname="SASetGroup" newname="SALatchGroup" />
+
+ <typedef oldname="SASetGroup" newname="SALockGroup" />
+
+ <enum name="SAMovePtrFlag">
+ <item name="NoAcceleration"> <bit>0</bit> </item>
+ <item name="MoveAbsoluteX"> <bit>1</bit> </item>
+ <item name="MoveAbsoluteY"> <bit>2</bit> </item>
+ </enum>
+
+ <struct name="SAMovePtr">
+ <field name="type" type="CARD8" enum="SAType" />
+ <field name="flags" type="CARD8" mask="SAMovePtrFlag" />
+ <field name="xHigh" type="INT8" />
+ <field name="xLow" type="CARD8" />
+ <field name="yHigh" type="INT8" />
+ <field name="yLow" type="CARD8" />
+ <pad bytes="2" />
+ </struct>
+
+ <struct name="SAPtrBtn">
+ <field name="type" type="CARD8" enum="SAType" />
+ <field name="flags" type="CARD8" />
+ <field name="count" type="CARD8" />
+ <field name="button" type="CARD8" />
+ <pad bytes="4" />
+ </struct>
+
+ <struct name="SALockPtrBtn">
+ <field name="type" type="CARD8" enum="SAType" />
+ <field name="flags" type="CARD8" />
+ <pad bytes="1" />
+ <field name="button" type="CARD8" />
+ <pad bytes="4" />
+ </struct>
+
+ <enum name="SASetPtrDfltFlag">
+ <item name="DfltBtnAbsolute"> <bit>1</bit> </item>
+ <item name="AffectDfltButton"> <bit>0</bit> </item>
+ </enum>
+
+ <struct name="SASetPtrDflt">
+ <field name="type" type="CARD8" enum="SAType" />
+ <field name="flags" type="CARD8" mask="SASetPtrDfltFlag" />
+ <field name="affect" type="CARD8" mask="SASetPtrDfltFlag" />
+ <field name="value" type="INT8" />
+ <pad bytes="4" />
+ </struct>
+
+ <enum name="SAIsoLockFlag">
+ <item name="NoLock"> <bit>0</bit> </item>
+ <item name="NoUnlock"> <bit>1</bit> </item>
+ <item name="UseModMapMods"> <bit>2</bit> </item>
+ <item name="GroupAbsolute"> <bit>2</bit> </item>
+ <item name="ISODfltIsGroup"> <bit>3</bit> </item>
+ </enum>
+
+ <enum name="SAIsoLockNoAffect">
+ <item name="Ctrls"> <bit>3</bit> </item>
+ <item name="Ptr"> <bit>4</bit> </item>
+ <item name="Group"> <bit>5</bit> </item>
+ <item name="Mods"> <bit>6</bit> </item>
+ </enum>
+
+ <struct name="SAIsoLock">
+ <field name="type" type="CARD8" enum="SAType" />
+ <field name="flags" type="CARD8" mask="SAIsoLockFlag" />
+ <field name="mask" type="CARD8" mask="ModMask" />
+ <field name="realMods" type="CARD8" mask="ModMask" />
+ <field name="group" type="INT8" />
+ <field name="affect" type="CARD8" mask="SAIsoLockNoAffect" />
+ <field name="vmodsHigh" type="CARD8" mask="VModsHigh" />
+ <field name="vmodsLow" type="CARD8" mask="VModsLow" />
+ </struct>
+
+ <struct name="SATerminate">
+ <field name="type" type="CARD8" enum="SAType" />
+ <pad bytes="7" />
+ </struct>
+
+ <enum name="SwitchScreenFlag">
+ <item name="Application"> <bit>0</bit> </item>
+ <item name="Absolute" > <bit>2</bit> </item>
+ </enum>
+
+ <struct name="SASwitchScreen">
+ <field name="type" type="CARD8" enum="SAType" />
+ <field name="flags" type="CARD8" />
+ <field name="newScreen" type="INT8" />
+ <pad bytes="5" />
+ </struct>
+
+ <enum name="BoolCtrlsHigh">
+ <item name="AccessXFeedback"> <bit>0</bit> </item>
+ <item name="AudibleBell"> <bit>1</bit> </item>
+ <item name="Overlay1"> <bit>2</bit> </item>
+ <item name="Overlay2"> <bit>3</bit> </item>
+ <item name="IgnoreGroupLock"> <bit>4</bit> </item>
+ </enum>
+
+ <enum name="BoolCtrlsLow">
+ <item name="RepeatKeys"> <bit>0</bit> </item>
+ <item name="SlowKeys"> <bit>1</bit> </item>
+ <item name="BounceKeys"> <bit>2</bit> </item>
+ <item name="StickyKeys"> <bit>3</bit> </item>
+ <item name="MouseKeys"> <bit>4</bit> </item>
+ <item name="MouseKeysAccel"> <bit>5</bit> </item>
+ <item name="AccessXKeys"> <bit>6</bit> </item>
+ <item name="AccessXTimeout"> <bit>7</bit> </item>
+ </enum>
+
+ <struct name="SASetControls">
+ <field name="type" type="CARD8" enum="SAType" />
+ <pad bytes="3" />
+ <field name="boolCtrlsHigh" type="CARD8" mask="BoolCtrlsHigh" />
+ <field name="boolCtrlsLow" type="CARD8" mask="BoolCtrlsLow" />
+ <pad bytes="2" />
+ </struct>
+
+ <typedef oldname="SASetControls" newname="SALockControls" />
+
+ <enum name="ActionMessageFlag">
+ <item name="OnPress"> <bit>0</bit> </item>
+ <item name="OnRelease"> <bit>1</bit> </item>
+ <item name="GenKeyEvent"> <bit>2</bit> </item>
+ </enum>
+
+ <struct name="SAActionMessage">
+ <field name="type" type="CARD8" enum="SAType" />
+ <field name="flags" type="CARD8" mask="ActionMessageFlag" />
+ <list name="message" type="CARD8">
+ <value>6</value>
+ </list>
+ </struct>
+
+ <struct name="SARedirectKey">
+ <field name="type" type="CARD8" enum="SAType" />
+ <field name="newkey" type="KEYCODE" />
+ <field name="mask" type="CARD8" mask="ModMask" />
+ <field name="realModifiers" type="CARD8" mask="ModMask" />
+ <field name="vmodsMaskHigh" type="CARD8" mask="VModsHigh"/>
+ <field name="vmodsMaskLow" type="CARD8" mask="VModsLow"/>
+ <field name="vmodsHigh" type="CARD8" mask="VModsHigh"/>
+ <field name="vmodsLow" type="CARD8" mask="VModsLow"/>
+ </struct>
+
+ <struct name="SADeviceBtn">
+ <field name="type" type="CARD8" enum="SAType" />
+ <field name="flags" type="CARD8" />
+ <field name="count" type="CARD8" />
+ <field name="button" type="CARD8" />
+ <field name="device" type="CARD8" />
+ <pad bytes="3" />
+ </struct>
+
+ <enum name="LockDeviceFlags">
+ <item name="NoLock"> <bit>0</bit> </item>
+ <item name="NoUnlock"> <bit>1</bit> </item>
+ </enum>
+
+ <struct name="SALockDeviceBtn">
+ <field name="type" type="CARD8" enum="SAType" />
+ <field name="flags" type="CARD8" mask="LockDeviceFlags" />
+ <pad bytes="1" />
+ <field name="button" type="CARD8" />
+ <field name="device" type="CARD8" />
+ </struct>
+
+ <enum name="SAValWhat">
+ <item name="IgnoreVal"> <value>0</value> </item>
+ <item name="SetValMin"> <value>1</value> </item>
+ <item name="SetValCenter"> <value>2</value> </item>
+ <item name="SetValMax"> <value>3</value> </item>
+ <item name="SetValRelative"> <value>4</value> </item>
+ <item name="SetValAbsolute"> <value>5</value> </item>
+ </enum>
+
+ <struct name="SADeviceValuator">
+ <field name="type" type="CARD8" enum="SAType" />
+ <field name="device" type="CARD8" />
+ <field name="val1what" type="CARD8" enum="SAValWhat" />
+ <field name="val1index" type="CARD8" />
+ <field name="val1value" type="CARD8" />
+ <field name="val2what" type="CARD8" enum="SAValWhat" />
+ <field name="val2index" type="CARD8" />
+ <field name="val2value" type="CARD8" />
+ </struct>
+
+ <union name="Action">
+ <field name="noaction" type="SANoAction" />
+ <field name="setmods" type="SASetMods" />
+ <field name="latchmods" type="SALatchMods" />
+ <field name="lockmods" type="SALockMods" />
+ <field name="setgroup" type="SASetGroup" />
+ <field name="latchgroup" type="SALatchGroup" />
+ <field name="lockgroup" type="SALockGroup" />
+ <field name="moveptr" type="SAMovePtr" />
+ <field name="ptrbtn" type="SAPtrBtn" />
+ <field name="lockptrbtn" type="SALockPtrBtn" />
+ <field name="setptrdflt" type="SASetPtrDflt" />
+ <field name="isolock" type="SAIsoLock" />
+ <field name="terminate" type="SATerminate" />
+ <field name="switchscreen" type="SASwitchScreen" />
+ <field name="setcontrols" type="SASetControls" />
+ <field name="lockcontrols" type="SALockControls" />
+ <field name="message" type="SAActionMessage" />
+ <field name="redirect" type="SARedirectKey" />
+ <field name="devbtn" type="SADeviceBtn" />
+ <field name="lockdevbtn" type="SALockDeviceBtn" />
+ <field name="devval" type="SADeviceValuator" />
+ <field name="type" type="CARD8" enum="SAType" />
+ </union>
+
+ <!-- Requests -->
+
+ <request name="UseExtension" opcode="0">
+ <field name="wantedMajor" type="CARD16" />
+ <field name="wantedMinor" type="CARD16" />
+ <reply>
+ <field name="supported" type="BOOL" />
+ <field name="serverMajor" type="CARD16" />
+ <field name="serverMinor" type="CARD16" />
+ <pad bytes="20" />
+ </reply>
+ </request>
+
+ <request name="SelectEvents" opcode="1">
+ <field name="deviceSpec" type="DeviceSpec" />
+ <field name="affectWhich" type="CARD16" enum="EventType" />
+ <field name="clear" type="CARD16" enum="EventType" />
+ <field name="selectAll" type="CARD16" enum="EventType" />
+ <field name="affectMap" type="CARD16" enum="MapPart" />
+ <field name="map" type="CARD16" enum="MapPart" />
+ <switch name="details">
+ <op op="&amp;">
+ <fieldref>affectWhich</fieldref>
+ <op op="&amp;">
+ <unop op="~"><fieldref>clear</fieldref></unop>
+ <unop op="~"><fieldref>selectAll</fieldref></unop>
+ </op>
+ </op>
+ <bitcase>
+ <enumref ref="EventType">NewKeyboardNotify</enumref>
+ <field name="affectNewKeyboard" type="CARD16" mask="NKNDetail" />
+ <field name="newKeyboardDetails" type="CARD16" mask="NKNDetail" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="EventType">StateNotify</enumref>
+ <field name="affectState" type="CARD16" mask="StatePart" />
+ <field name="stateDetails" type="CARD16" mask="StatePart" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="EventType">ControlsNotify</enumref>
+ <field name="affectCtrls" type="CARD32" mask="Control" />
+ <field name="ctrlDetails" type="CARD32" mask="Control" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="EventType">IndicatorStateNotify</enumref>
+ <field name="affectIndicatorState" type="CARD32" />
+ <field name="indicatorStateDetails" type="CARD32" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="EventType">IndicatorMapNotify</enumref>
+ <field name="affectIndicatorMap" type="CARD32" />
+ <field name="indicatorMapDetails" type="CARD32" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="EventType">NamesNotify</enumref>
+ <field name="affectNames" type="CARD16" mask="NameDetail" />
+ <field name="namesDetails" type="CARD16" mask="NameDetail" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="EventType">CompatMapNotify</enumref>
+ <field name="affectCompat" type="CARD8" mask="CMDetail" />
+ <field name="compatDetails" type="CARD8" mask="CMDetail" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="EventType">BellNotify</enumref>
+ <field name="affectBell" type="CARD8" />
+ <field name="bellDetails" type="CARD8" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="EventType">ActionMessage</enumref>
+ <field name="affectMsgDetails" type="CARD8" />
+ <field name="msgDetails" type="CARD8" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="EventType">AccessXNotify</enumref>
+ <field name="affectAccessX" type="CARD16" mask="AXNDetail" />
+ <field name="accessXDetails" type="CARD16" mask="AXNDetail" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="EventType">ExtensionDeviceNotify</enumref>
+ <field name="affectExtDev" type="CARD16" mask="XIFeature" />
+ <field name="extdevDetails" type="CARD16" mask="XIFeature" />
+ </bitcase>
+ </switch>
+ </request>
+
+ <request name="Bell" opcode="3">
+ <field name="deviceSpec" type="DeviceSpec" />
+ <field name="bellClass" type="BellClassSpec" />
+ <field name="bellID" type="IDSpec" />
+ <field name="percent" type="INT8" />
+ <field name="forceSound" type="BOOL" />
+ <field name="eventOnly" type="BOOL" />
+ <pad bytes="1" />
+ <field name="pitch" type="INT16" />
+ <field name="duration" type="INT16" />
+ <pad bytes="2" />
+ <field name="name" type="ATOM" />
+ <field name="window" type="WINDOW" />
+ </request>
+
+ <request name="GetState" opcode="4">
+ <field name="deviceSpec" type="DeviceSpec" />
+ <pad bytes="2" />
+ <reply>
+ <field name="deviceID" type="CARD8" />
+ <field name="mods" type="CARD8" mask="ModMask" />
+ <field name="baseMods" type="CARD8" mask="ModMask" />
+ <field name="latchedMods" type="CARD8" mask="ModMask" />
+ <field name="lockedMods" type="CARD8" mask="ModMask" />
+ <field name="group" type="CARD8" enum="Group" />
+ <field name="lockedGroup" type="CARD8" enum="Group" />
+ <field name="baseGroup" type="INT16" />
+ <field name="latchedGroup" type="INT16" />
+ <field name="compatState" type="CARD8" mask="ModMask" />
+ <field name="grabMods" type="CARD8" mask="ModMask" />
+ <field name="compatGrabMods" type="CARD8" mask="ModMask" />
+ <field name="compatLookupMods" type="CARD8" mask="ModMask" />
+ <pad bytes="1" />
+ <field name="ptrBtnState" type="CARD16" mask="KeyButMask" />
+ <pad bytes="6" />
+ </reply>
+ </request>
+
+ <request name="LatchLockState" opcode="5">
+ <field name="deviceSpec" type="DeviceSpec" />
+ <field name="affectModLocks" type="CARD8" mask="ModMask" />
+ <field name="modLocks" type="CARD8" mask="ModMask" />
+ <field name="lockGroup" type="BOOL" />
+ <field name="groupLock" type="CARD8" enum="Group" />
+ <field name="affectModLatches" type="CARD8" mask="ModMask" />
+ <pad bytes="1" />
+ <field name="latchGroup" type="BOOL" />
+ <field name="groupLatch" type="CARD16" />
+ </request>
+
+ <request name="GetControls" opcode="6">
+ <field name="deviceSpec" type="DeviceSpec" />
+ <pad bytes="2" />
+ <reply>
+ <field name="deviceID" type="CARD8" />
+ <field name="mouseKeysDfltBtn" type="CARD8" />
+ <field name="numGroups" type="CARD8" />
+ <field name="groupsWrap" type="CARD8" />
+ <field name="internalModsMask" type="CARD8" mask="ModMask" />
+ <field name="ignoreLockModsMask" type="CARD8" mask="ModMask" />
+ <field name="internalModsRealMods" type="CARD8" mask="ModMask" />
+ <field name="ignoreLockModsRealMods" type="CARD8" mask="ModMask" />
+ <pad bytes="1" />
+ <field name="internalModsVmods" type="CARD16" mask="VMod" />
+ <field name="ignoreLockModsVmods" type="CARD16" mask="VMod" />
+ <field name="repeatDelay" type="CARD16" />
+ <field name="repeatInterval" type="CARD16" />
+ <field name="slowKeysDelay" type="CARD16" />
+ <field name="debounceDelay" type="CARD16" />
+ <field name="mouseKeysDelay" type="CARD16" />
+ <field name="mouseKeysInterval" type="CARD16" />
+ <field name="mouseKeysTimeToMax" type="CARD16" />
+ <field name="mouseKeysMaxSpeed" type="CARD16" />
+ <field name="mouseKeysCurve" type="INT16" />
+ <field name="accessXOption" type="AXOption" />
+ <field name="accessXTimeout" type="CARD16" />
+ <field name="accessXTimeoutOptionsMask" type="AXOption" />
+ <field name="accessXTimeoutOptionsValues" type="AXOption" />
+ <pad bytes="2" />
+ <field name="accessXTimeoutMask" type="CARD32" enum="BoolCtrl" />
+ <field name="accessXTimeoutValues" type="CARD32" enum="BoolCtrl" />
+ <field name="enabledControls" type="CARD32" enum="BoolCtrl" />
+ <list name="perKeyRepeat" type="CARD8">
+ <value>32</value>
+ </list>
+ </reply>
+ </request>
+
+ <request name="SetControls" opcode="7">
+ <field name="deviceSpec" type="DeviceSpec" />
+ <field name="affectInternalRealMods" type="CARD8" mask="ModMask" />
+ <field name="interanlRealMods" type="CARD8" mask="ModMask" />
+ <field name="affectIgnoreLockRealMods" type="CARD8" mask="ModMask" />
+ <field name="ignoreLockRealMods" type="CARD8" mask="ModMask" />
+ <field name="affectInternalVirtualMods" type="CARD16" mask="VMod" />
+ <field name="internalVirtualMods" type="CARD16" mask="VMod" />
+ <field name="affectInternalLockVirtualMods" type="CARD16" mask="VMod" />
+ <field name="internalLockVirtualMods" type="CARD16" mask="VMod" />
+ <field name="mouseKeysDfltBtn" type="CARD8" />
+ <field name="groupsWrap" type="CARD8" />
+ <field name="accessXOptions" type="AXOption" />
+ <pad bytes="2" />
+ <field name="affectEnabledControls" type="CARD32" enum="BoolCtrl" />
+ <field name="enabledControls" type="CARD32" enum="BoolCtrl" />
+ <field name="changeControls" type="CARD32" mask="Control" />
+ <field name="repeatDelay" type="CARD16" />
+ <field name="repeatInterval" type="CARD16" />
+ <field name="slowKeysDelay" type="CARD16" />
+ <field name="debounceDelay" type="CARD16" />
+ <field name="mouseKeysDelay" type="CARD16" />
+ <field name="mouseKeysInterval" type="CARD16" />
+ <field name="mouseKeysTimeToMax" type="CARD16" />
+ <field name="mouseKeysMaxSpeed" type="CARD16" />
+ <field name="mouseKeysCurve" type="INT16" />
+ <field name="accessXTimeout" type="CARD16" />
+ <field name="accessXTimeoutMask" type="CARD32" enum="BoolCtrl" />
+ <field name="accessXTimeoutValues" type="CARD32" enum="BoolCtrl" />
+ <field name="accessXTimeoutOptionsMask" type="AXOption" />
+ <field name="accessXTimeoutOptionsValues" type="AXOption" />
+ <list name="perKeyRepeat" type="CARD8">
+ <value>32</value>
+ </list>
+ </request>
+
+ <request name="GetMap" opcode="8">
+ <field name="deviceSpec" type="DeviceSpec" />
+ <field name="full" type="CARD16" enum="MapPart" />
+ <field name="partial" type="CARD16" enum="MapPart" />
+ <field name="firstType" type="CARD8" />
+ <field name="nTypes" type="CARD8" />
+ <field name="firstKeySym" type="KEYCODE" />
+ <field name="nKeySyms" type="CARD8" />
+ <field name="firstKeyAction" type="KEYCODE" />
+ <field name="nKeyActions" type="CARD8" />
+ <field name="firstKeyBehavior" type="KEYCODE" />
+ <field name="nKeyBehaviors" type="CARD8" />
+ <field name="virtualMods" type="CARD16" mask="VMod" />
+ <field name="firstKeyExplicit" type="KEYCODE" />
+ <field name="nKeyExplicit" type="CARD8" />
+ <field name="firstModMapKey" type="KEYCODE" />
+ <field name="nModMapKeys" type="CARD8" />
+ <field name="firstVModMapKey" type="KEYCODE" />
+ <field name="nVModMapKeys" type="CARD8" />
+ <pad bytes="2" />
+ <reply>
+ <field name="deviceID" type="CARD8" />
+ <pad bytes="2" />
+ <field name="minKeyCode" type="KEYCODE" />
+ <field name="maxKeyCode" type="KEYCODE" />
+ <field name="present" type="CARD16" enum="MapPart" />
+ <field name="firstType" type="CARD8" />
+ <field name="nTypes" type="CARD8" />
+ <field name="totalTypes" type="CARD8" />
+ <field name="firstKeySym" type="KEYCODE" />
+ <field name="totalSyms" type="CARD16" />
+ <field name="nKeySyms" type="CARD8" />
+ <field name="firstKeyAction" type="KEYCODE" />
+ <field name="totalActions" type="CARD16" />
+ <field name="nKeyActions" type="CARD8" />
+ <field name="firstKeyBehavior" type="KEYCODE" />
+ <field name="nKeyBehaviors" type="CARD8" />
+ <field name="totalKeyBehaviors" type="CARD8" />
+ <field name="firstKeyExplicit" type="KEYCODE" />
+ <field name="nKeyExplicit" type="CARD8" />
+ <field name="totalKeyExplicit" type="CARD8" />
+ <field name="firstModMapKey" type="KEYCODE" />
+ <field name="nModMapKeys" type="CARD8" />
+ <field name="totalModMapKeys" type="CARD8" />
+ <field name="firstVModMapKey" type="KEYCODE" />
+ <field name="nVModMapKeys" type="CARD8" />
+ <field name="totalVModMapKeys" type="CARD8" />
+ <pad bytes="1" />
+ <field name="virtualMods" type="CARD16" mask="VMod" />
+ <switch name="map">
+ <fieldref>present</fieldref>
+ <bitcase>
+ <enumref ref="MapPart">KeyTypes</enumref>
+ <list name="types_rtrn" type="KeyType">
+ <fieldref>nTypes</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">KeySyms</enumref>
+ <list name="syms_rtrn" type="KeySymMap">
+ <fieldref>nKeySyms</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">KeyActions</enumref>
+ <list name="acts_rtrn_count" type="CARD8">
+ <fieldref>nKeyActions</fieldref>
+ </list>
+ <list name="acts_rtrn_acts" type="Action">
+ <fieldref>totalActions</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">KeyBehaviors</enumref>
+ <list name="behaviors_rtrn" type="SetBehavior">
+ <fieldref>totalKeyBehaviors</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">VirtualMods</enumref>
+ <list name="vmods_rtrn" type="CARD8" mask="ModMask">
+ <fieldref>nVModMapKeys</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">ExplicitComponents</enumref>
+ <list name="explicit_rtrn" type="SetExplicit">
+ <fieldref>totalKeyExplicit</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">ModifierMap</enumref>
+ <list name="modmap_rtrn" type="KeyModMap">
+ <fieldref>totalModMapKeys</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">VirtualModMap</enumref>
+ <list name="vmodmap_rtrn" type="KeyVModMap">
+ <fieldref>totalVModMapKeys</fieldref>
+ </list>
+ </bitcase>
+ </switch>
+ </reply>
+ </request>
+
+ <request name="SetMap" opcode="9">
+ <field name="deviceSpec" type="DeviceSpec" />
+ <field name="present" type="CARD16" enum="MapPart" />
+ <field name="flags" type="CARD16" mask="SetMapFlags" />
+ <field name="minKeyCode" type="KEYCODE" />
+ <field name="maxKeyCode" type="KEYCODE" />
+ <field name="firstType" type="CARD8" />
+ <field name="nTypes" type="CARD8" />
+ <field name="firstKeySym" type="KEYCODE" />
+ <field name="nKeySyms" type="CARD8" />
+ <field name="totalSyms" type="CARD16" />
+ <field name="firstKeyAction" type="KEYCODE" />
+ <field name="nKeyActions" type="CARD8" />
+ <field name="totalActions" type="CARD16" />
+ <field name="firstKeyBehavior" type="KEYCODE" />
+ <field name="nKeyBehaviors" type="CARD8" />
+ <field name="totalKeyBehaviors" type="CARD8" />
+ <field name="firstKeyExplicit" type="KEYCODE" />
+ <field name="nKeyExplicit" type="CARD8" />
+ <field name="totalKeyExplicit" type="CARD8" />
+ <field name="firstModMapKey" type="KEYCODE" />
+ <field name="nModMapKeys" type="CARD8" />
+ <field name="totalModMapKeys" type="CARD8" />
+ <field name="firstVModMapKey" type="KEYCODE" />
+ <field name="nVModMapKeys" type="CARD8" />
+ <field name="totalVModMapKeys" type="CARD8" />
+ <field name="virtualMods" type="CARD16" mask="VMod" />
+ <switch name="values">
+ <fieldref>present</fieldref>
+ <bitcase>
+ <enumref ref="MapPart">KeyTypes</enumref>
+ <list name="types" type="SetKeyType">
+ <fieldref>nTypes</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">KeySyms</enumref>
+ <list name="syms" type="KeySymMap">
+ <fieldref>nKeySyms</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">KeyActions</enumref>
+ <list name="actionsCount" type="CARD8">
+ <fieldref>nKeyActions</fieldref>
+ </list>
+ <list name="actions" type="Action">
+ <fieldref>totalActions</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">KeyBehaviors</enumref>
+ <list name="behaviors" type="SetBehavior">
+ <fieldref>totalKeyBehaviors</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">VirtualMods</enumref>
+ <list name="vmods" type="CARD8">
+ <fieldref>nVModMapKeys</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">ExplicitComponents</enumref>
+ <list name="explicit" type="SetExplicit">
+ <fieldref>totalKeyExplicit</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">ModifierMap</enumref>
+ <list name="modmap" type="KeyModMap">
+ <fieldref>totalModMapKeys</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">VirtualModMap</enumref>
+ <list name="vmodmap" type="KeyVModMap">
+ <fieldref>totalVModMapKeys</fieldref>
+ </list>
+ </bitcase>
+ </switch>
+ </request>
+
+ <request name="GetCompatMap" opcode="10">
+ <field name="deviceSpec" type="DeviceSpec" />
+ <field name="groups" type="CARD8" mask="SetOfGroup" />
+ <field name="getAllSI" type="BOOL" />
+ <field name="firstSI" type="CARD16" />
+ <field name="nSI" type="CARD16" />
+ <reply>
+ <field name="deviceID" type="CARD8" />
+ <field name="groupsRtrn" type="CARD8" mask="SetOfGroup" />
+ <pad bytes="1" />
+ <field name="firstSIRtrn" type="CARD16" />
+ <field name="nSIRtrn" type="CARD16" />
+ <field name="nTotalSI" type="CARD16" />
+ <pad bytes="16" />
+ <list name="si_rtrn" type="CARD8" mask="SymInterpret">
+ <op op="*">
+ <value>16</value>
+ <fieldref>nSIRtrn</fieldref>
+ </op>
+ </list>
+ <list name="group_rtrn" type="ModDef">
+ <popcount>
+ <fieldref>groupsRtrn</fieldref>
+ </popcount>
+ </list>
+ </reply>
+ </request>
+
+ <request name="SetCompatMap" opcode="11">
+ <field name="deviceSpec" type="DeviceSpec" />
+ <pad bytes="1" />
+ <field name="recomputeActions" type="BOOL" />
+ <field name="truncateSI" type="BOOL" />
+ <field name="groups" type="CARD8" mask="SetOfGroup" />
+ <field name="firstSI" type="CARD16" />
+ <field name="nSI" type="CARD16" />
+ <pad bytes="2"/>
+ <list name="si" type="CARD8" mask="SymInterpret">
+ <op op="*">
+ <value>16</value>
+ <fieldref>nSI</fieldref>
+ </op>
+ </list>
+ <list name="groupMaps" type="ModDef">
+ <popcount>
+ <fieldref>groups</fieldref>
+ </popcount>
+ </list>
+ </request>
+
+ <request name="GetIndicatorState" opcode="12">
+ <field name="deviceSpec" type="DeviceSpec" />
+ <pad bytes="2" />
+ <reply>
+ <field name="deviceID" type="CARD8" />
+ <field name="state" type="CARD32" />
+ <pad bytes="20" />
+ </reply>
+ </request>
+
+ <request name="GetIndicatorMap" opcode="13">
+ <field name="deviceSpec" type="DeviceSpec" />
+ <pad bytes="2" />
+ <field name="which" type="CARD32" />
+ <reply>
+ <field name="deviceID" type="CARD8" />
+ <field name="which" type="CARD32" />
+ <field name="realIndicators" type="CARD32" />
+ <field name="nIndicators" type="CARD8" />
+ <pad bytes="15" />
+ <list name="maps" type="IndicatorMap">
+ <fieldref>nIndicators</fieldref>
+ </list>
+ </reply>
+ </request>
+
+ <request name="SetIndicatorMap" opcode="14">
+ <field name="deviceSpec" type="DeviceSpec" />
+ <pad bytes="2" />
+ <field name="which" type="CARD32" />
+ <list name="maps" type="IndicatorMap">
+ <popcount>
+ <fieldref>which</fieldref>
+ </popcount>
+ </list>
+ </request>
+
+ <request name="GetNamedIndicator" opcode="15">
+ <field name="deviceSpec" type="DeviceSpec" />
+ <field name="ledClass" type="LedClassSpec" enum="LedClass" />
+ <field name="ledID" type="IDSpec" altenum="ID" />
+ <pad bytes="2" />
+ <field name="indicator" type="ATOM" />
+ <reply>
+ <field name="deviceID" type="CARD8" />
+ <field name="indicator" type="ATOM" />
+ <field name="found" type="BOOL" />
+ <field name="on" type="BOOL" />
+ <field name="realIndicator" type="BOOL" />
+ <field name="ndx" type="CARD8" />
+ <field name="map_flags" type="CARD8" mask="IMFlag" />
+ <field name="map_whichGroups" type="CARD8" mask="IMGroupsWhich" />
+ <field name="map_groups" type="CARD8" mask="SetOfGroups" />
+ <field name="map_whichMods" type="CARD8" mask="IMModsWhich" />
+ <field name="map_mods" type="CARD8" mask="ModMask" />
+ <field name="map_realMods" type="CARD8" mask="ModMask" />
+ <field name="map_vmod" type="CARD16" mask="VMod" />
+ <field name="map_ctrls" type="CARD32" mask="BoolCtrl" />
+ <pad bytes="3" />
+ </reply>
+ </request>
+
+ <request name="SetNamedIndicator" opcode="16" >
+ <field name="deviceSpec" type="DeviceSpec" />
+ <field name="ledClass" type="LedClassSpec" enum="LedClass" />
+ <field name="ledID" type="IDSpec" altenum="ID" />
+ <pad bytes="2" />
+ <field name="indicator" type="ATOM" />
+ <field name="setState" type="BOOL" />
+ <field name="on" type="BOOL" />
+ <field name="setMap" type="BOOL" />
+ <field name="createMap" type="BOOL" />
+ <pad bytes="1" />
+ <field name="map_flags" type="CARD8" mask="IMFlag" />
+ <field name="map_whichGroups" type="CARD8" mask="IMGroupsWhich" />
+ <field name="map_groups" type="CARD8" mask="SetOfGroups" />
+ <field name="map_whichMods" type="CARD8" mask="IMModsWhich" />
+ <field name="map_realMods" type="CARD8" mask="ModMask" />
+ <field name="map_vmods" type="CARD16" mask="VMod" />
+ <field name="map_ctrls" type="CARD32" mask="BoolCtrl" />
+ </request>
+
+ <request name="GetNames" opcode="17">
+ <field name="deviceSpec" type="DeviceSpec" />
+ <pad bytes="2" />
+ <field name="which" type="CARD32" mask="NameDetail" />
+ <reply>
+ <field name="deviceID" type="CARD8" />
+ <field name="which" type="CARD32" mask="NameDetail" />
+ <field name="minKeyCode" type="KEYCODE" />
+ <field name="maxKeyCode" type="KEYCODE" />
+ <field name="nTypes" type="CARD8" />
+ <field name="groupNames" type="CARD8" mask="SetOfGroup" />
+ <field name="virtualMods" type="CARD16" mask="VMod" />
+ <field name="firstKey" type="KEYCODE" />
+ <field name="nKeys" type="CARD8" />
+ <field name="indicators" type="CARD32" />
+ <field name="nRadioGroups" type="CARD8" />
+ <field name="nKeyAliases" type="CARD8" />
+ <field name="nKTLevels" type="CARD16" />
+ <pad bytes="4" />
+ <switch name="valueList">
+ <fieldref>which</fieldref>
+ <bitcase>
+ <enumref ref="NameDetail">Keycodes</enumref>
+ <field name="keycodesName" type="ATOM" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">Geometry</enumref>
+ <field name="geometryName" type="ATOM" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">Symbols</enumref>
+ <field name="symbolsName" type="ATOM" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">PhysSymbols</enumref>
+ <field name="physSymbolsName" type="ATOM" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">Types</enumref>
+ <field name="typesName" type="ATOM" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">Compat</enumref>
+ <field name="compatName" type="ATOM" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">KeyTypeNames</enumref>
+ <list name="typeNames" type="ATOM">
+ <fieldref>nTypes</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">KTLevelNames</enumref>
+ <list name="nLevelsPerType" type="CARD8">
+ <fieldref>nKTLevels</fieldref>
+ </list>
+ <list name="ktLevelNames" type="ATOM">
+ <sumof ref="nLevelsPerType" />
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">IndicatorNames</enumref>
+ <list name="indicatorNames" type="ATOM">
+ <popcount>
+ <fieldref>indicators</fieldref>
+ </popcount>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">VirtualModNames</enumref>
+ <list name="virtualModNames" type="ATOM">
+ <popcount>
+ <fieldref>virtualMods</fieldref>
+ </popcount>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">GroupNames</enumref>
+ <list name="groups" type="ATOM">
+ <popcount>
+ <fieldref>groupNames</fieldref>
+ </popcount>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">KeyNames</enumref>
+ <list name="keyNames" type="KeyName">
+ <fieldref>nKeys</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">KeyAliases</enumref>
+ <list name="keyAliases" type="KeyAlias">
+ <fieldref>nKeyAliases</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">RGNames</enumref>
+ <list name="radioGroupNames" type="ATOM">
+ <fieldref>nRadioGroups</fieldref>
+ </list>
+ </bitcase>
+ </switch>
+ </reply>
+ </request>
+
+ <request name="SetNames" opcode="18">
+ <field name="deviceSpec" type="DeviceSpec" />
+ <field name="virtualMods" type="CARD16" mask="VMod" />
+ <field name="which" type="CARD32" mask="NameDetail" />
+ <field name="firstType" type="CARD8" />
+ <field name="nTypes" type="CARD8" />
+ <field name="firstKTLevelt" type="CARD8" />
+ <field name="nKTLevels" type="CARD8" />
+ <field name="indicators" type="CARD32" />
+ <field name="groupNames" type="CARD8" mask="SetOfGroup" />
+ <field name="nRadioGroups" type="CARD8" />
+ <field name="firstKey" type="KEYCODE" />
+ <field name="nKeys" type="CARD8" />
+ <field name="nKeyAliases" type="CARD8"/>
+ <pad bytes="1" />
+ <field name="totalKTLevelNames" type="CARD16" />
+ <switch name="values">
+ <fieldref>which</fieldref>
+ <bitcase>
+ <enumref ref="NameDetail">Keycodes</enumref>
+ <field name="keycodesName" type="ATOM" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">Geometry</enumref>
+ <field name="geometryName" type="ATOM" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">Symbols</enumref>
+ <field name="symbolsName" type="ATOM" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">PhysSymbols</enumref>
+ <field name="physSymbolsName" type="ATOM" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">Types</enumref>
+ <field name="typesName" type="ATOM" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">Compat</enumref>
+ <field name="compatName" type="ATOM" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">KeyTypeNames</enumref>
+ <list name="typeNames" type="ATOM">
+ <fieldref>nTypes</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">KTLevelNames</enumref>
+ <list name="nLevelsPerType" type="CARD8">
+ <fieldref>nKTLevels</fieldref>
+ </list>
+ <list name="ktLevelNames" type="ATOM">
+ <sumof ref="nLevelsPerType" />
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">IndicatorNames</enumref>
+ <list name="indicatorNames" type="ATOM">
+ <popcount>
+ <fieldref>indicators</fieldref>
+ </popcount>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">VirtualModNames</enumref>
+ <list name="virtualModNames" type="ATOM">
+ <popcount>
+ <fieldref>virtualMods</fieldref>
+ </popcount>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">GroupNames</enumref>
+ <list name="groups" type="ATOM">
+ <popcount>
+ <fieldref>groupNames</fieldref>
+ </popcount>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">KeyNames</enumref>
+ <list name="keyNames" type="KeyName">
+ <fieldref>nKeys</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">KeyAliases</enumref>
+ <list name="keyAliases" type="KeyAlias">
+ <fieldref>nKeyAliases</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">RGNames</enumref>
+ <list name="radioGroupNames" type="ATOM">
+ <fieldref>nRadioGroups</fieldref>
+ </list>
+ </bitcase>
+ </switch>
+ </request>
+
+ <request name="GetGeometry" opcode="19">
+ <field name="deviceSpec" type="DeviceSpec" />
+ <pad bytes="2" />
+ <field name="name" type="ATOM" />
+ <reply>
+ <field name="deviceID" type="CARD8" />
+ <field name="name" type="ATOM" />
+ <field name="found" type="BOOL" />
+ <pad bytes="1" />
+ <field name="widthMM" type="CARD16" />
+ <field name="heightMM" type="CARD16" />
+ <field name="nProperties" type="CARD16" />
+ <field name="nColors" type="CARD16" />
+ <field name="nShapes" type="CARD16" />
+ <field name="nSections" type="CARD16" />
+ <field name="nDoodads" type="CARD16" />
+ <field name="nKeyAliases" type="CARD16" />
+ <field name="baseColorNdx" type="CARD8" />
+ <field name="labelColorNdx" type="CARD8" />
+ <field name="labelFont" type="CountedString16" />
+ <list name="properties" type="Property">
+ <fieldref>nProperties</fieldref>
+ </list>
+ <list name="colors" type="CountedString16">
+ <fieldref>nColors</fieldref>
+ </list>
+ <list name="shapes" type="Shape">
+ <fieldref>nShapes</fieldref>
+ </list>
+ <list name="sections" type="Section">
+ <fieldref>nSections</fieldref>
+ </list>
+ <list name="doodads" type="Doodad">
+ <fieldref>nDoodads</fieldref>
+ </list>
+ <list name="keyAliases" type="KeyAlias">
+ <fieldref>nKeyAliases</fieldref>
+ </list>
+ </reply>
+ </request>
+
+ <request name="SetGeometry" opcode="20">
+ <field name="deviceSpec" type="DeviceSpec" />
+ <field name="nShapes" type="CARD8" />
+ <field name="nSections" type="CARD8" />
+ <field name="name" type="ATOM" />
+ <field name="widthMM" type="CARD16" />
+ <field name="heightMM" type="CARD16" />
+ <field name="nProperties" type="CARD16" />
+ <field name="nColors" type="CARD16" />
+ <field name="nDoodads" type="CARD16" />
+ <field name="nKeyAliases" type="CARD16" />
+ <field name="baseColorNdx" type="CARD8" />
+ <field name="labelColorNdx" type="CARD8" />
+ <pad bytes="2" />
+ <field name="labelFont" type="CountedString16" />
+ <list name="properties" type="Property">
+ <fieldref>nProperties</fieldref>
+ </list>
+ <list name="colors" type="CountedString16">
+ <fieldref>nColors</fieldref>
+ </list>
+ <list name="shapes" type="Shape">
+ <fieldref>nShapes</fieldref>
+ </list>
+ <list name="sections" type="Section">
+ <fieldref>nSections</fieldref>
+ </list>
+ <list name="doodads" type="Doodad">
+ <fieldref>nDoodads</fieldref>
+ </list>
+ <list name="keyAliases" type="KeyAlias">
+ <fieldref>nKeyAliases</fieldref>
+ </list>
+ </request>
+
+ <request name="PerClientFlags" opcode="21">
+ <field name="deviceSpec" type="DeviceSpec" />
+ <pad bytes="2" />
+ <field name="change" type="CARD32" mask="PerClientFlag" />
+ <field name="value" type="CARD32" mask="PerClientFlag" />
+ <field name="ctrlsToChange" type="CARD32" mask="BoolCtrl" />
+ <field name="autoCtrls" type="CARD32" mask="BoolCtrl" />
+ <field name="autoCtrlsValues" type="CARD32" mask="BoolCtrl" />
+ <reply>
+ <field name="deviceID" type="CARD8"/>
+ <field name="supported" type="CARD32" mask="PerClientFlag" />
+ <field name="value" type="CARD32" mask="PerClientFlag" />
+ <field name="autoCtrls" type="CARD32" mask="BoolCtrl" />
+ <field name="autoCtrlsValues" type="CARD32" mask="BoolCtrl" />
+ <pad bytes="8" />
+ </reply>
+ </request>
+
+ <request name="ListComponents" opcode="22">
+ <field name="deviceSpec" type="DeviceSpec" />
+ <field name="maxNames" type="CARD16" />
+ <field name="keymapsSpecLen" type="CARD8" />
+ <list name="keymapsSpec" type="STRING8">
+ <fieldref>keymapsSpecLen</fieldref>
+ </list>
+ <field name="keycodesSpecLen" type="CARD8" />
+ <list name="keycodesSpec" type="STRING8">
+ <fieldref>keycodesSpecLen</fieldref>
+ </list>
+ <field name="typesSpecLen" type="CARD8" />
+ <list name="typesSpec" type="STRING8">
+ <fieldref>typesSpecLen</fieldref>
+ </list>
+ <field name="compatMapSpecLen" type="CARD8" />
+ <list name="compatMapSpec" type="STRING8">
+ <fieldref>compatMapSpecLen</fieldref>
+ </list>
+ <field name="symbolsSpecLen" type="CARD8" />
+ <list name="symbolsSpec" type="STRING8">
+ <fieldref>symbolsSpecLen</fieldref>
+ </list>
+ <field name="geometrySpecLen" type="CARD8" />
+ <list name="geometrySpec" type="STRING8">
+ <fieldref>geometrySpecLen</fieldref>
+ </list>
+ <reply>
+ <field name="deviceID" type="CARD8" />
+ <field name="nKeymaps" type="CARD16" />
+ <field name="nKeycodes" type="CARD16" />
+ <field name="nTypes" type="CARD16" />
+ <field name="nCompatMaps" type="CARD16" />
+ <field name="nSymbols" type="CARD16" />
+ <field name="nGeometries" type="CARD16" />
+ <field name="extra" type="CARD16" />
+ <pad bytes="10" />
+ <list name="keymaps" type="Listing">
+ <fieldref>nKeymaps</fieldref>
+ </list>
+ <list name="keycodes" type="Listing">
+ <fieldref>nKeycodes</fieldref>
+ </list>
+ <list name="types" type="Listing">
+ <fieldref>nTypes</fieldref>
+ </list>
+ <list name="compatMaps" type="Listing">
+ <fieldref>nCompatMaps</fieldref>
+ </list>
+ <list name="symbols" type="Listing">
+ <fieldref>nSymbols</fieldref>
+ </list>
+ <list name="geometries" type="Listing">
+ <fieldref>nGeometries</fieldref>
+ </list>
+ </reply>
+ </request>
+
+ <request name="GetKbdByName" opcode="23">
+ <field name="deviceSpec" type="DeviceSpec" />
+ <field name="need" type="CARD16" mask="GBNDetail" />
+ <field name="want" type="CARD16" mask="GBNDetail" />
+ <field name="load" type="BOOL" />
+ <pad bytes="1" />
+ <field name="keymapsSpecLen" type="CARD8" />
+ <list name="keymapsSpec" type="STRING8">
+ <fieldref>keymapsSpecLen</fieldref>
+ </list>
+ <field name="keycodesSpecLen" type="CARD8" />
+ <list name="keycodesSpec" type="STRING8">
+ <fieldref>keycodesSpecLen</fieldref>
+ </list>
+ <field name="typesSpecLen" type="CARD8" />
+ <list name="typesSpec" type="STRING8">
+ <fieldref>typesSpecLen</fieldref>
+ </list>
+ <field name="compatMapSpecLen" type="CARD8" />
+ <list name="compatMapSpec" type="STRING8">
+ <fieldref>compatMapSpecLen</fieldref>
+ </list>
+ <field name="symbolsSpecLen" type="CARD8" />
+ <list name="symbolsSpec" type="STRING8">
+ <fieldref>symbolsSpecLen</fieldref>
+ </list>
+ <field name="geometrySpecLen" type="CARD8" />
+ <list name="geometrySpec" type="STRING8">
+ <fieldref>geometrySpecLen</fieldref>
+ </list>
+ <reply>
+ <field name="deviceID" type="CARD8" />
+ <field name="minKeyCode" type="KEYCODE" />
+ <field name="maxKeyCode" type="KEYCODE" />
+ <field name="loaded" type="BOOL" />
+ <field name="newKeyboard" type="BOOL" />
+ <field name="found" type="CARD16" mask="GBNDetail" />
+ <field name="reported" type="CARD16" mask="GBNDetail" />
+ <pad bytes="16" />
+ <switch name="replies">
+ <fieldref>reported</fieldref>
+ <bitcase>
+ <enumref ref="GBNDetail">Types</enumref>
+ <field name="typeDeviceID" type="CARD8" />
+ <pad bytes="2" />
+ <field name="typeMinKeyCode" type="KEYCODE" />
+ <field name="typeMaxKeyCode" type="KEYCODE" />
+ <field name="present" type="CARD16" enum="MapPart" />
+ <field name="firstType" type="CARD8" />
+ <field name="nTypes" type="CARD8" />
+ <field name="totalTypes" type="CARD8" />
+ <field name="firstKeySym" type="KEYCODE" />
+ <field name="totalSyms" type="CARD16" />
+ <field name="nKeySyms" type="CARD8" />
+ <field name="firstKeyAction" type="KEYCODE" />
+ <field name="totalActions" type="CARD16" />
+ <field name="nKeyActions" type="CARD8" />
+ <field name="firstKeyBehavior" type="KEYCODE" />
+ <field name="nKeyBehaviors" type="CARD8" />
+ <field name="totalKeyBehaviors" type="CARD8" />
+ <field name="firstKeyExplicit" type="KEYCODE" />
+ <field name="nKeyExplicit" type="CARD8" />
+ <field name="totalKeyExplicit" type="CARD8" />
+ <field name="firstModMapKey" type="KEYCODE" />
+ <field name="nModMapKeys" type="CARD8" />
+ <field name="totalModMapKeys" type="CARD8" />
+ <field name="firstVModMapKey" type="KEYCODE" />
+ <field name="nVModMapKeys" type="CARD8" />
+ <field name="totalVModMapKeys" type="CARD8" />
+ <pad bytes="1" />
+ <field name="virtualMods" type="CARD16" mask="VMod" />
+ <switch name="map">
+ <fieldref>present</fieldref>
+ <bitcase>
+ <enumref ref="MapPart">KeyTypes</enumref>
+ <list name="types_rtrn" type="KeyType">
+ <fieldref>nTypes</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">KeySyms</enumref>
+ <list name="syms_rtrn" type="KeySymMap">
+ <fieldref>nKeySyms</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">KeyActions</enumref>
+ <list name="acts_rtrn_count" type="CARD8">
+ <fieldref>nKeyActions</fieldref>
+ </list>
+ <list name="acts_rtrn_acts" type="Action">
+ <fieldref>totalActions</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">KeyBehaviors</enumref>
+ <list name="behaviors_rtrn" type="SetBehavior">
+ <fieldref>totalKeyBehaviors</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">VirtualMods</enumref>
+ <list name="vmods_rtrn" type="CARD8" mask="ModMask">
+ <fieldref>nVModMapKeys</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">ExplicitComponents</enumref>
+ <list name="explicit_rtrn" type="SetExplicit">
+ <fieldref>totalKeyExplicit</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">ModifierMap</enumref>
+ <list name="modmap_rtrn" type="KeyModMap">
+ <fieldref>totalModMapKeys</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">VirtualModMap</enumref>
+ <list name="vmodmap_rtrn" type="KeyVModMap">
+ <fieldref>totalVModMapKeys</fieldref>
+ </list>
+ </bitcase>
+ </switch>
+ </bitcase>
+ <bitcase>
+ <enumref ref="GBNDetail">CompatMap</enumref>
+ <field name="compatDeviceID" type="CARD8" />
+ <field name="groupsRtrn" type="CARD8" mask="SetOfGroup" />
+ <pad bytes="1" />
+ <field name="firstSIRtrn" type="CARD16" />
+ <field name="nSIRtrn" type="CARD16" />
+ <field name="nTotalSI" type="CARD16" />
+ <pad bytes="16" />
+ <list name="si_rtrn" type="CARD8" mask="SymInterpret">
+ <op op="*">
+ <value>16</value>
+ <fieldref>nSIRtrn</fieldref>
+ </op>
+ </list>
+ <list name="group_rtrn" type="ModDef">
+ <popcount>
+ <fieldref>groupsRtrn</fieldref>
+ </popcount>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="GBNDetail">ClientSymbols</enumref>
+ <field name="clientDeviceID" type="CARD8" />
+ <pad bytes="2" />
+ <field name="clientMinKeyCode" type="KEYCODE" />
+ <field name="clientMaxKeyCode" type="KEYCODE" />
+ <field name="present" type="CARD16" enum="MapPart" />
+ <field name="firstType" type="CARD8" />
+ <field name="nTypes" type="CARD8" />
+ <field name="totalTypes" type="CARD8" />
+ <field name="firstKeySym" type="KEYCODE" />
+ <field name="totalSyms" type="CARD16" />
+ <field name="nKeySyms" type="CARD8" />
+ <field name="firstKeyAction" type="KEYCODE" />
+ <field name="totalActions" type="CARD16" />
+ <field name="nKeyActions" type="CARD8" />
+ <field name="firstKeyBehavior" type="KEYCODE" />
+ <field name="nKeyBehaviors" type="CARD8" />
+ <field name="totalKeyBehaviors" type="CARD8" />
+ <field name="firstKeyExplicit" type="KEYCODE" />
+ <field name="nKeyExplicit" type="CARD8" />
+ <field name="totalKeyExplicit" type="CARD8" />
+ <field name="firstModMapKey" type="KEYCODE" />
+ <field name="nModMapKeys" type="CARD8" />
+ <field name="totalModMapKeys" type="CARD8" />
+ <field name="firstVModMapKey" type="KEYCODE" />
+ <field name="nVModMapKeys" type="CARD8" />
+ <field name="totalVModMapKeys" type="CARD8" />
+ <pad bytes="1" />
+ <field name="virtualMods" type="CARD16" mask="VMod" />
+ <switch name="map">
+ <fieldref>present</fieldref>
+ <bitcase>
+ <enumref ref="MapPart">KeyTypes</enumref>
+ <list name="types_rtrn" type="KeyType">
+ <fieldref>nTypes</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">KeySyms</enumref>
+ <list name="syms_rtrn" type="KeySymMap">
+ <fieldref>nKeySyms</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">KeyActions</enumref>
+ <list name="acts_rtrn_count" type="CARD8">
+ <fieldref>nKeyActions</fieldref>
+ </list>
+ <list name="acts_rtrn_acts" type="Action">
+ <fieldref>totalActions</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">KeyBehaviors</enumref>
+ <list name="behaviors_rtrn" type="SetBehavior">
+ <fieldref>totalKeyBehaviors</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">VirtualMods</enumref>
+ <list name="vmods_rtrn" type="CARD8" mask="ModMask">
+ <fieldref>nVModMapKeys</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">ExplicitComponents</enumref>
+ <list name="explicit_rtrn" type="SetExplicit">
+ <fieldref>totalKeyExplicit</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">ModifierMap</enumref>
+ <list name="modmap_rtrn" type="KeyModMap">
+ <fieldref>totalModMapKeys</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">VirtualModMap</enumref>
+ <list name="vmodmap_rtrn" type="KeyVModMap">
+ <fieldref>totalVModMapKeys</fieldref>
+ </list>
+ </bitcase>
+ </switch>
+ </bitcase>
+ <bitcase>
+ <enumref ref="GBNDetail">ServerSymbols</enumref>
+ <field name="serverDeviceID" type="CARD8" />
+ <pad bytes="2" />
+ <field name="serverMinKeyCode" type="KEYCODE" />
+ <field name="serverMaxKeyCode" type="KEYCODE" />
+ <field name="present" type="CARD16" enum="MapPart" />
+ <field name="firstType" type="CARD8" />
+ <field name="nTypes" type="CARD8" />
+ <field name="totalTypes" type="CARD8" />
+ <field name="firstKeySym" type="KEYCODE" />
+ <field name="totalSyms" type="CARD16" />
+ <field name="nKeySyms" type="CARD8" />
+ <field name="firstKeyAction" type="KEYCODE" />
+ <field name="totalActions" type="CARD16" />
+ <field name="nKeyActions" type="CARD8" />
+ <field name="firstKeyBehavior" type="KEYCODE" />
+ <field name="nKeyBehaviors" type="CARD8" />
+ <field name="totalKeyBehaviors" type="CARD8" />
+ <field name="firstKeyExplicit" type="KEYCODE" />
+ <field name="nKeyExplicit" type="CARD8" />
+ <field name="totalKeyExplicit" type="CARD8" />
+ <field name="firstModMapKey" type="KEYCODE" />
+ <field name="nModMapKeys" type="CARD8" />
+ <field name="totalModMapKeys" type="CARD8" />
+ <field name="firstVModMapKey" type="KEYCODE" />
+ <field name="nVModMapKeys" type="CARD8" />
+ <field name="totalVModMapKeys" type="CARD8" />
+ <pad bytes="1" />
+ <field name="virtualMods" type="CARD16" mask="VMod" />
+ <switch name="map">
+ <fieldref>present</fieldref>
+ <bitcase>
+ <enumref ref="MapPart">KeyTypes</enumref>
+ <list name="types_rtrn" type="KeyType">
+ <fieldref>nTypes</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">KeySyms</enumref>
+ <list name="syms_rtrn" type="KeySymMap">
+ <fieldref>nKeySyms</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">KeyActions</enumref>
+ <list name="acts_rtrn_count" type="CARD8">
+ <fieldref>nKeyActions</fieldref>
+ </list>
+ <list name="acts_rtrn_acts" type="Action">
+ <fieldref>totalActions</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">KeyBehaviors</enumref>
+ <list name="behaviors_rtrn" type="SetBehavior">
+ <fieldref>totalKeyBehaviors</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">VirtualMods</enumref>
+ <list name="vmods_rtrn" type="CARD8" mask="ModMask">
+ <fieldref>nVModMapKeys</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">ExplicitComponents</enumref>
+ <list name="explicit_rtrn" type="SetExplicit">
+ <fieldref>totalKeyExplicit</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">ModifierMap</enumref>
+ <list name="modmap_rtrn" type="KeyModMap">
+ <fieldref>totalModMapKeys</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="MapPart">VirtualModMap</enumref>
+ <list name="vmodmap_rtrn" type="KeyVModMap">
+ <fieldref>totalVModMapKeys</fieldref>
+ </list>
+ </bitcase>
+ </switch>
+ </bitcase>
+ <bitcase>
+ <enumref ref="GBNDetail">IndicatorMaps</enumref>
+ <field name="indicatorDeviceID" type="CARD8" />
+ <field name="which" type="CARD32" />
+ <field name="realIndicators" type="CARD32" />
+ <field name="nIndicators" type="CARD8" />
+ <pad bytes="15" />
+ <list name="maps" type="IndicatorMap">
+ <fieldref>nIndicators</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="GBNDetail">KeyNames</enumref>
+ <field name="keyDeviceID" type="CARD8" />
+ <field name="which" type="CARD32" mask="NameDetail" />
+ <field name="keyMinKeyCode" type="KEYCODE" />
+ <field name="keyMaxKeyCode" type="KEYCODE" />
+ <field name="nTypes" type="CARD8" />
+ <field name="groupNames" type="CARD8" mask="SetOfGroup" />
+ <field name="virtualMods" type="CARD16" mask="VMod" />
+ <field name="firstKey" type="KEYCODE" />
+ <field name="nKeys" type="CARD8" />
+ <field name="indicators" type="CARD32" />
+ <field name="nRadioGroups" type="CARD8" />
+ <field name="nKeyAliases" type="CARD8" />
+ <field name="nKTLevels" type="CARD16" />
+ <pad bytes="4" />
+ <switch name="valueList">
+ <fieldref>which</fieldref>
+ <bitcase>
+ <enumref ref="NameDetail">Keycodes</enumref>
+ <field name="keycodesName" type="ATOM" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">Geometry</enumref>
+ <field name="geometryName" type="ATOM" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">Symbols</enumref>
+ <field name="symbolsName" type="ATOM" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">PhysSymbols</enumref>
+ <field name="physSymbolsName" type="ATOM" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">Types</enumref>
+ <field name="typesName" type="ATOM" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">Compat</enumref>
+ <field name="compatName" type="ATOM" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">KeyTypeNames</enumref>
+ <list name="typeNames" type="ATOM">
+ <fieldref>nTypes</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">KTLevelNames</enumref>
+ <list name="nLevelsPerType" type="CARD8">
+ <fieldref>nKTLevels</fieldref>
+ </list>
+ <list name="ktLevelNames" type="ATOM">
+ <sumof ref="nLevelsPerType" />
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">IndicatorNames</enumref>
+ <list name="indicatorNames" type="ATOM">
+ <popcount>
+ <fieldref>indicators</fieldref>
+ </popcount>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">VirtualModNames</enumref>
+ <list name="virtualModNames" type="ATOM">
+ <popcount>
+ <fieldref>virtualMods</fieldref>
+ </popcount>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">GroupNames</enumref>
+ <list name="groups" type="ATOM">
+ <popcount>
+ <fieldref>groupNames</fieldref>
+ </popcount>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">KeyNames</enumref>
+ <list name="keyNames" type="KeyName">
+ <fieldref>nKeys</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">KeyAliases</enumref>
+ <list name="keyAliases" type="KeyAlias">
+ <fieldref>nKeyAliases</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">RGNames</enumref>
+ <list name="radioGroupNames" type="ATOM">
+ <fieldref>nRadioGroups</fieldref>
+ </list>
+ </bitcase>
+ </switch>
+ </bitcase>
+ <bitcase>
+ <enumref ref="GBNDetail">OtherNames</enumref>
+ <field name="otherDeviceID" type="CARD8" />
+ <field name="which" type="CARD32" mask="NameDetail" />
+ <field name="otherMinKeyCode" type="KEYCODE" />
+ <field name="otherMaxKeyCode" type="KEYCODE" />
+ <field name="nTypes" type="CARD8" />
+ <field name="groupNames" type="CARD8" mask="SetOfGroup" />
+ <field name="virtualMods" type="CARD16" mask="VMod" />
+ <field name="firstKey" type="KEYCODE" />
+ <field name="nKeys" type="CARD8" />
+ <field name="indicators" type="CARD32" />
+ <field name="nRadioGroups" type="CARD8" />
+ <field name="nKeyAliases" type="CARD8" />
+ <field name="nKTLevels" type="CARD16" />
+ <pad bytes="4" />
+ <switch name="valueList">
+ <fieldref>which</fieldref>
+ <bitcase>
+ <enumref ref="NameDetail">Keycodes</enumref>
+ <field name="keycodesName" type="ATOM" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">Geometry</enumref>
+ <field name="geometryName" type="ATOM" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">Symbols</enumref>
+ <field name="symbolsName" type="ATOM" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">PhysSymbols</enumref>
+ <field name="physSymbolsName" type="ATOM" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">Types</enumref>
+ <field name="typesName" type="ATOM" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">Compat</enumref>
+ <field name="compatName" type="ATOM" />
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">KeyTypeNames</enumref>
+ <list name="typeNames" type="ATOM">
+ <fieldref>nTypes</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">KTLevelNames</enumref>
+ <list name="nLevelsPerType" type="CARD8">
+ <fieldref>nKTLevels</fieldref>
+ </list>
+ <list name="ktLevelNames" type="ATOM">
+ <sumof ref="nLevelsPerType" />
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">IndicatorNames</enumref>
+ <list name="indicatorNames" type="ATOM">
+ <popcount>
+ <fieldref>indicators</fieldref>
+ </popcount>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">VirtualModNames</enumref>
+ <list name="virtualModNames" type="ATOM">
+ <popcount>
+ <fieldref>virtualMods</fieldref>
+ </popcount>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">GroupNames</enumref>
+ <list name="groups" type="ATOM">
+ <popcount>
+ <fieldref>groupNames</fieldref>
+ </popcount>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">KeyNames</enumref>
+ <list name="keyNames" type="KeyName">
+ <fieldref>nKeys</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">KeyAliases</enumref>
+ <list name="keyAliases" type="KeyAlias">
+ <fieldref>nKeyAliases</fieldref>
+ </list>
+ </bitcase>
+ <bitcase>
+ <enumref ref="NameDetail">RGNames</enumref>
+ <list name="radioGroupNames" type="ATOM">
+ <fieldref>nRadioGroups</fieldref>
+ </list>
+ </bitcase>
+ </switch>
+ </bitcase>
+ <bitcase>
+ <enumref ref="GBNDetail">Geometry</enumref>
+ <field name="geometryDeviceID" type="CARD8" />
+ <field name="name" type="ATOM" />
+ <field name="geometryFound" type="BOOL" />
+ <pad bytes="1" />
+ <field name="widthMM" type="CARD16" />
+ <field name="heightMM" type="CARD16" />
+ <field name="nProperties" type="CARD16" />
+ <field name="nColors" type="CARD16" />
+ <field name="nShapes" type="CARD16" />
+ <field name="nSections" type="CARD16" />
+ <field name="nDoodads" type="CARD16" />
+ <field name="nKeyAliases" type="CARD16" />
+ <field name="baseColorNdx" type="CARD8" />
+ <field name="labelColorNdx" type="CARD8" />
+ <field name="labelFont" type="CountedString16" />
+ <list name="properties" type="Property">
+ <fieldref>nProperties</fieldref>
+ </list>
+ <list name="colors" type="CountedString16">
+ <fieldref>nColors</fieldref>
+ </list>
+ <list name="shapes" type="Shape">
+ <fieldref>nShapes</fieldref>
+ </list>
+ <list name="sections" type="Section">
+ <fieldref>nSections</fieldref>
+ </list>
+ <list name="doodads" type="Doodad">
+ <fieldref>nDoodads</fieldref>
+ </list>
+ <list name="keyAliases" type="KeyAlias">
+ <fieldref>nKeyAliases</fieldref>
+ </list>
+ </bitcase>
+ </switch>
+ </reply>
+ </request>
+
+ <request name="GetDeviceInfo" opcode="24">
+ <field name="deviceSpec" type="DeviceSpec" />
+ <field name="wanted" type="CARD16" mask="XIFeature" />
+ <field name="allButtons" type="BOOL" />
+ <field name="firstButton" type="CARD8" />
+ <field name="nButtons" type="CARD8" />
+ <pad bytes="1" />
+ <field name="ledClass" type="LedClassSpec" enum="LedClass" />
+ <field name="ledID" type="IDSpec" altenum="ID" />
+ <reply>
+ <field name="deviceID" type="CARD8" />
+ <field name="present" type="CARD16" mask="XIFeature" />
+ <field name="supported" type="CARD16" mask="XIFeature" />
+ <field name="unsupported" type="CARD16" mask="XIFeature" />
+ <field name="nDeviceLedFBs" type="CARD16" />
+ <field name="firstBtnWanted" type="CARD8" />
+ <field name="nBtnsWanted" type="CARD8" />
+ <field name="firstBtnRtrn" type="CARD8" />
+ <field name="nBtnsRtrn" type="CARD8" />
+ <field name="totalBtns" type="CARD8" />
+ <field name="hasOwnState" type="BOOL" />
+ <field name="dfltKbdFB" type="CARD16" altenum="ID" />
+ <field name="dfltLedFB" type="CARD16" altenum="ID" />
+ <pad bytes="2" />
+ <field name="devType" type="ATOM" />
+ <field name="nameLen" type="CARD16" />
+ <list name="name" type="STRING8">
+ <fieldref>nameLen</fieldref>
+ </list>
+ <list name="btnActions" type="Action">
+ <fieldref>nBtnsRtrn</fieldref>
+ </list>
+ <list name="leds" type="DeviceLedInfo">
+ <fieldref>nDeviceLedFBs</fieldref>
+ </list>
+ </reply>
+ </request>
+
+
+ <request name="SetDeviceInfo" opcode="25">
+ <field name="deviceSpec" type="DeviceSpec" />
+ <field name="firstBtn" type="CARD8" />
+ <field name="nBtns" type="CARD8" />
+ <field name="change" type="CARD16" mask="XIFeature" />
+ <field name="nDeviceLedFBs" type="CARD16" />
+ <list name="btnActions" type="Action">
+ <fieldref>nBtns</fieldref>
+ </list>
+ <list name="leds" type="DeviceLedInfo">
+ <fieldref>nDeviceLedFBs</fieldref>
+ </list>
+ </request>
+
+ <request name="SetDebuggingFlags" opcode="101">
+ <field name="msgLength" type="CARD16" />
+ <pad bytes="2" />
+ <field name="affectFlags" type="CARD32" />
+ <field name="flags" type="CARD32" />
+ <field name="affectCtrls" type="CARD32" />
+ <field name="ctrls" type="CARD32" />
+ <list name="message" type="STRING8">
+ <fieldref>msgLength</fieldref>
+ </list>
+ <reply>
+ <pad bytes="1" />
+ <field name="currentFlags" type="CARD32" />
+ <field name="currentCtrls" type="CARD32" />
+ <field name="supportedFlags" type="CARD32" />
+ <field name="supportedCtrls" type="CARD32" />
+ <pad bytes="8" />
+ </reply>
+ </request>
+
+ <!-- Events -->
+
+ <event name="NewKeyboardNotify" number="0">
+ <field name="time" type="TIMESTAMP" />
+ <field name="deviceID" type="CARD8" />
+ <field name="oldDeviceID" type="CARD8" />
+ <field name="minKeyCode" type="KEYCODE" />
+ <field name="maxKeyCode" type="KEYCODE" />
+ <field name="oldMinKeyCode" type="KEYCODE" />
+ <field name="oldMaxKeyCode" type="KEYCODE" />
+ <field name="requestMajor" type="CARD8" />
+ <field name="requestMinor" type="CARD8" />
+ <field name="changed" type="CARD16" mask="NKNDetail" />
+ <pad bytes="14" />
+ </event>
+
+ <event name="MapNotify" number="1">
+ <field name="time" type="TIMESTAMP" />
+ <field name="deviceID" type="CARD8" />
+ <field name="ptrBtnActions" type="CARD8" />
+ <field name="changed" type="CARD16" mask="MapPart" />
+ <field name="minKeyCode" type="KEYCODE" />
+ <field name="maxKeyCode" type="KEYCODE" />
+ <field name="firstType" type="CARD8" />
+ <field name="nTypes" type="CARD8" />
+ <field name="firstKeySym" type="KEYCODE" />
+ <field name="nKeySyms" type="CARD8" />
+ <field name="firstKeyAct" type="KEYCODE" />
+ <field name="nKeyActs" type="CARD8" />
+ <field name="firstKeyBehavior" type="KEYCODE" />
+ <field name="nKeyBehavior" type="CARD8" />
+ <field name="firstKeyExplicit" type="KEYCODE" />
+ <field name="nKeyExplicit" type="CARD8" />
+ <field name="firstModMapKey" type="KEYCODE" />
+ <field name="nModMapKeys" type="CARD8" />
+ <field name="firstVModMapKey" type="KEYCODE" />
+ <field name="nVModMapKeys" type="CARD8" />
+ <field name="virtualMods" type="CARD16" mask="VMod" />
+ <pad bytes="2" />
+ </event>
+
+ <event name="StateNotify" number="2">
+ <field name="time" type="TIMESTAMP" />
+ <field name="deviceID" type="CARD8" />
+ <field name="mods" type="CARD8" mask="ModMask" />
+ <field name="baseMods" type="CARD8" mask="ModMask" />
+ <field name="latchedMods" type="CARD8" mask="ModMask" />
+ <field name="lockedMods" type="CARD8" mask="ModMask" />
+ <field name="group" type="CARD8" enum="Group" />
+ <field name="baseGroup" type="INT16" />
+ <field name="latchedGroup" type="INT16" />
+ <field name="lockedGroup" type="CARD8" enum="Group" />
+ <field name="compatState" type="CARD8" mask="ModMask" />
+ <field name="grabMods" type="CARD8" mask="ModMask" />
+ <field name="compatGrabMods" type="CARD8" mask="ModMask" />
+ <field name="lookupMods" type="CARD8" mask="ModMask" />
+ <field name="compatLoockupMods" type="CARD8" mask="ModMask" />
+ <field name="ptrBtnState" type="CARD16" mask="KeyButMask" />
+ <field name="changed" type="CARD16" mask="StatePart" />
+ <field name="keycode" type="KEYCODE" />
+ <field name="eventType" type="CARD8" />
+ <field name="requestMajor" type="CARD8" />
+ <field name="requestMinor" type="CARD8" />
+ </event>
+
+ <event name="ControlsNotify" number="3">
+ <field name="time" type="TIMESTAMP" />
+ <field name="deviceID" type="CARD8" />
+ <field name="numGroups" type="CARD8" />
+ <pad bytes="2" />
+ <field name="changedControls" type="CARD32" mask="Control" />
+ <field name="enabledControls" type="CARD32" mask="BoolCtrl" />
+ <field name="enabledControlChanges" type="CARD32" mask="BoolCtrl" />
+ <field name="keycode" type="KEYCODE" />
+ <field name="eventType" type="CARD8" />
+ <field name="requestMajor" type="CARD8" />
+ <field name="requestMinor" type="CARD8" />
+ <pad bytes="4" />
+ </event>
+
+ <event name="IndicatorStateNotify" number="4">
+ <field name="time" type="TIMESTAMP" />
+ <field name="deviceID" type="CARD8" />
+ <pad bytes="3" />
+ <field name="state" type="CARD32" />
+ <field name="stateChanged" type="CARD32" />
+ <pad bytes="12" />
+ </event>
+
+ <event name="IndicatorMapNotify" number="5">
+ <field name="time" type="TIMESTAMP" />
+ <field name="deviceID" type="CARD8" />
+ <pad bytes="3" />
+ <field name="state" type="CARD32" />
+ <field name="mapChanged" type="CARD32" />
+ <pad bytes="12" />
+ </event>
+
+ <event name="NamesNotify" number="6">
+ <field name="time" type="TIMESTAMP" />
+ <field name="deviceID" type="CARD8" />
+ <pad bytes="1" />
+ <field name="changed" type="CARD16" mask="NameDetail" />
+ <field name="firstType" type="CARD8" />
+ <field name="nTypes" type="CARD8" />
+ <field name="firstLevelName" type="CARD8" />
+ <field name="nLevelNames" type="CARD8" />
+ <pad bytes="1" />
+ <field name="nRadioGroups" type="CARD8" />
+ <field name="nKeyAliases" type="CARD8" />
+ <field name="changedGroupNames" type="CARD8" mask="SetOfGroup" />
+ <field name="changedVirtualMods" type="CARD16" mask="VMod" />
+ <field name="firstKey" type="KEYCODE" />
+ <field name="nKeys" type="CARD8" />
+ <field name="changedIndicators" type="CARD32" />
+ <pad bytes="4" />
+ </event>
+
+ <event name="CompatMapNotify" number="7">
+ <field name="time" type="TIMESTAMP" />
+ <field name="deviceID" type="CARD8" />
+ <field name="changedGroups" type="CARD8" mask="SetOfGroup" />
+ <field name="firstSI" type="CARD16" />
+ <field name="nSI" type="CARD16" />
+ <field name="nTotalSI" type="CARD16" />
+ <pad bytes="16" />
+ </event>
+
+ <event name="BellNotify" number="8">
+ <field name="time" type="TIMESTAMP" />
+ <field name="deviceID" type="CARD8" />
+ <field name="bellClass" type="CARD8" enum="BellClassResult" />
+ <field name="bellID" type="CARD8" />
+ <field name="percent" type="CARD8" />
+ <field name="pitch" type="CARD16" />
+ <field name="duration" type="CARD16" />
+ <field name="name" type="ATOM" />
+ <field name="window" type="WINDOW" />
+ <field name="eventOnly" type="BOOL" />
+ <pad bytes="7" />
+ </event>
+
+ <event name="ActionMessage" number="9">
+ <field name="time" type="TIMESTAMP" />
+ <field name="deviceID" type="CARD8" />
+ <field name="keycode" type="KEYCODE" />
+ <field name="press" type="BOOL" />
+ <field name="keyEventFollows" type="BOOL" />
+ <field name="mods" type="CARD8" mask="ModMask" />
+ <field name="group" type="CARD8" enum="Group" />
+ <list name="message" type="STRING8">
+ <value>8</value>
+ </list>
+ <pad bytes="10" />
+ </event>
+
+ <event name="AccessXNotify" number="10">
+ <field name="time" type="TIMESTAMP" />
+ <field name="deviceID" type="CARD8" />
+ <field name="keycode" type="KEYCODE" />
+ <field name="detailt" type="CARD16" mask="AXNDetail" />
+ <field name="slowKeysDelay" type="CARD16" />
+ <field name="debounceDelay" type="CARD16" />
+ <pad bytes="16" />
+ </event>
+
+ <event name="ExtensionDeviceNotify" number="11">
+ <field name="time" type="TIMESTAMP" />
+ <field name="deviceID" type="CARD8" />
+ <pad bytes="1" />
+ <field name="reason" type="CARD16" mask="XIFeature" />
+ <field name="ledClass" type="CARD16" enum="LedClassResult" />
+ <field name="ledID" type="CARD8" />
+ <field name="ledsDefined" type="CARD32" />
+ <field name="ledState" type="CARD32" />
+ <field name="firstButton" type="CARD8" />
+ <field name="nButtons" type="CARD8" />
+ <field name="supported" type="CARD16" mask="XIFeature" />
+ <field name="unsupported" type="CARD16" mask="XIFeature" />
+ <pad bytes="2" />
+ </event>
+</xcb>