Git init
authorKibum Kim <kb0929.kim@samsung.com>
Fri, 6 Jan 2012 16:09:09 +0000 (01:09 +0900)
committerKibum Kim <kb0929.kim@samsung.com>
Fri, 6 Jan 2012 16:09:09 +0000 (01:09 +0900)
24 files changed:
COPYING [new file with mode: 0644]
ChangeLog [new file with mode: 0755]
Makefile.am [new file with mode: 0755]
README [new file with mode: 0755]
XKB.h [new file with mode: 0755]
XKBgeom.h [new file with mode: 0644]
XKBproto.h [new file with mode: 0644]
XKBsrv.h [new file with mode: 0644]
XKBstr.h [new file with mode: 0644]
autogen.sh [new file with mode: 0644]
configure.ac [new file with mode: 0755]
debian/README.source [new file with mode: 0644]
debian/changelog [new file with mode: 0755]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0755]
debian/copyright [new file with mode: 0644]
debian/rules [new file with mode: 0755]
debian/watch [new file with mode: 0644]
debian/x11proto-kb-dev.install [new file with mode: 0644]
debian/xsfbs/repack.sh [new file with mode: 0644]
debian/xsfbs/xsfbs.mk [new file with mode: 0644]
debian/xsfbs/xsfbs.sh [new file with mode: 0644]
kbproto.pc.in [new file with mode: 0644]
packaging/xorg-x11-proto-kbproto.spec [new file with mode: 0644]

diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..6f12c2f
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,22 @@
+Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be 
+used in advertising or publicity pertaining to distribution 
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability 
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/ChangeLog b/ChangeLog
new file mode 100755 (executable)
index 0000000..f2542c2
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,306 @@
+commit 2306fcd4c511d41ae4b31b9cbd9f79cf69287730
+Author: Dirk Wallenstein <halsmit@t-online.de>
+Date:   Fri Feb 5 20:42:43 2010 +0100
+
+    Use the correct value for XkbAllAccessXEventsMask
+    
+    Signed-off-by: Dirk Wallenstein <halsmit@t-online.de>
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 875e6f80e9ddcac010f6871214a92e4d50e8ee5e
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sun Mar 28 19:25:52 2010 -0400
+
+    config: update AC_PREREQ statement to 2.60
+    
+    Unrelated to the previous patches, the new value simply reflects
+    the reality that the minimum level for autoconf to configure
+    all x.org modules is 2.60 dated June 2006.
+    
+    ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit f6b32127be4c800f73bf68c6ac7d79c630cae1fa
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sun Mar 28 19:00:31 2010 -0400
+
+    config: remove the pkgconfig pc.in file from EXTRA_DIST
+    
+    Automake always includes it in the tarball.
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit cb489d131adb1d454e9f6196d7d766c0acde12e6
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sun Nov 22 19:24:48 2009 -0500
+
+    Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES
+    
+    Now that the INSTALL file is generated.
+    Allows running make maintainer-clean.
+
+commit 9a83b903ba2586f16e770d4911c4d7e42957abb7
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Nov 16 11:13:30 2009 -0500
+
+    README: file created or updated #24206
+    
+    Contains a set of URLs to freedesktop.org.
+
+commit 0a358e01f7fcb903077137c4d3ab51ce9eeabcce
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sun Nov 15 19:45:27 2009 -0500
+
+    Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432
+    
+    ChangeLog filename is known to Automake and requires no further
+    coding in the makefile.
+
+commit c8078878abaa2d2489a3778c89af043901582eac
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sun Nov 15 18:31:28 2009 -0500
+
+    Makefile.am: INSTALL file is missing or incorrect #24206
+    
+    The standard GNU file on building/installing  tarball is copied
+    using the XORG_INSTALL macro contained in XORG_DEFAULT_OPTIONS
+    Add INSTALL target
+
+commit ab57a912460acb83302152bd91c6336d500bb9cd
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sun Nov 15 18:11:36 2009 -0500
+
+    configure.ac: deploy the new XORG_DEFAULT_OPTIONS #24242
+    
+    This macro aggregate a number of existing macros that sets commmon
+    X.Org components configuration options. It shields the configuration file from
+    future changes.
+
+commit 4ddefc3a86050e06056d79b78ae0a1be119c4131
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sun Nov 15 13:55:25 2009 -0500
+
+    configure.ac: AM_MAINTAINER_MODE missing #24238
+    
+    This turns off maintainer mode build rules in tarballs.
+    Works in conjunction with autogen.sh --enable-maintainer-mode
+
+commit eb3d96018f4c2e20c23b837aa42f71ebb36661b1
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sat Nov 14 18:26:47 2009 -0500
+
+    .gitignore: use common defaults with custom section # 24239
+    
+    Using common defaults will reduce errors and maintenance.
+    Only the very small or inexistent custom section need periodic maintenance
+    when the structure of the component changes. Do not edit defaults.
+
+commit 4e3ccd5b2144005af1d5d2f9b96275a01156aec5
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Mon Oct 12 22:39:05 2009 -0700
+
+    kbproto 1.0.4
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit 6472994ea38a8416214b5ce12a34437541e6d15e
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Mon Oct 12 22:38:03 2009 -0700
+
+    Migrate to xorg macros 1.3 & XORG_DEFAULT_OPTIONS
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit 5273e7bc22cc7f11f2461ba1f5f30cbdecda1289
+Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
+Date:   Mon Apr 6 17:54:12 2009 -0700
+
+    Made some defines typedefs for better compatability
+
+commit 3baa0be057f2bf2e2f0f049c0dded4a93c68819e
+Author: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>
+Date:   Tue Jan 27 20:06:28 2009 -0200
+
+    Janitor: Correct make distcheck and dont distribute autogen.sh
+
+commit 0396fb99f96ff15e1000a6e4b5ccdca119319a8a
+Author: James Cloos <cloos@jhcloos.com>
+Date:   Thu Dec 6 16:39:02 2007 -0500
+
+    Replace static ChangeLog with dist-hook to generate from git log
+
+commit 1a41bb4ff63d0fa27238be2af6a8b59941c0f7db
+Author: James Cloos <cloos@jhcloos.com>
+Date:   Mon Sep 3 05:54:08 2007 -0400
+
+    Add *~ to .gitignore to skip patch/emacs droppings
+
+commit c4f5dac457e13d2cd5a1d8a1e28e56dd5d3be856
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Tue Jul 18 15:21:43 2006 -0400
+
+    Bump to 1.0.3.
+
+commit b23c0835504887f460deeac55b8be94d07336745
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Tue Jul 18 15:21:28 2006 -0400
+
+    unconditionally declare XFree86Private
+    This could probably be moved to generic DDX private.
+
+commit 85c889c725de1a0233c845c75ad62b39940b120a
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Fri Jul 14 18:56:20 2006 -0700
+
+    renamed: .cvsignore -> .gitignore
+
+commit d15dc14c2fb8996e1da9daaef748ff35f7844809
+Author: Kevin E Martin <kem@kem.org>
+Date:   Thu Dec 15 00:24:38 2005 +0000
+
+    Update package version number for final X11R7 release candidate.
+
+commit 9d625ab848eee9a7488e6ee3d4cfbeea5198f61b
+Author: Kevin E Martin <kem@kem.org>
+Date:   Wed Oct 19 02:48:14 2005 +0000
+
+    Update package version number for RC1 release.
+
+commit b9a70202a5d2edc2d62cbe2776635e994f07bb2d
+Author: Kristian Høgsberg <krh@redhat.com>
+Date:   Thu Sep 1 19:56:14 2005 +0000
+
+    Teach xkb how to optionally run xkbcomp from $bindir instead of
+        $datadir/xkb.
+
+commit ac13227d0007b6fac32af6281ae2e49f5e8fa90c
+Author: Eric Anholt <anholt@freebsd.org>
+Date:   Tue Aug 2 19:19:39 2005 +0000
+
+    Add basic .cvsignore files for proto modules.
+
+commit 81b6633f6509e0d8053a40cc9fe4025202991112
+Author: Kevin E Martin <kem@kem.org>
+Date:   Fri Jul 29 21:22:55 2005 +0000
+
+    Various changes preparing packages for RC0:
+    - Verify and update package version numbers as needed
+    - Implement versioning scheme
+    - Change bug address to point to bugzilla bug entry form
+    - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to
+        reenable it)
+    - Fix makedepend to use pkgconfig and pass distcheck
+    - Update build script to build macros first
+    - Update modular Xorg version
+
+commit 234e6351e159ec892c0f9878663819c32a88fabd
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Thu Jul 7 19:07:28 2005 +0000
+
+    More compiler warning fixes for missing prototypes:
+    Add prototype for XkbSetExtension()
+    Add #include <ctype.h> for isspace() & isdigit()
+    Add #include <grp.h> (for initgroups()) and remove extra *
+    Add prototype for xorgGetVersion()
+
+commit 4a9390f0bfc464967151b670179998d375e28d75
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Sun May 22 01:12:49 2005 +0000
+
+    Bugzilla #2800 <https://bugs.freedesktop.org/show_bug.cgi?id=2800> Xevie
+        extension crash with signal 11 on keyboard Bugzilla #1205
+        <https://bugs.freedesktop.org/show_bug.cgi?id=1205> Xevie client
+        receives two KeyPress events on consumed keys when XKB is enabled
+    Patch #2223 <https://bugs.freedesktop.org/attachment.cgi?id=2223> Fixes for
+        both of these and some other Xevie bugs (Derek Wang - Sun Microsystems)
+
+commit 3c68899e6798045e60d3c99900ab73825a612237
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Sat May 21 04:12:09 2005 +0000
+
+    Set version to 1.0.
+
+commit d346d81559dc1c8ca0d52c98c667a1afec40ce71
+Author: Adam Jackson <ajax@nwnk.net>
+Date:   Thu May 19 00:22:39 2005 +0000
+
+    revert last change, didn't do right thing at all, sorry for the noise
+
+commit 6882836c45e5a5e1caef49aa33b6fc1db0b48e27
+Author: Adam Jackson <ajax@nwnk.net>
+Date:   Thu May 19 00:10:18 2005 +0000
+
+    Require automake 1.7 in AM_INIT_AUTOMAKE
+
+commit d4a17c55d88d4a373fb1ade20001be80c5a956db
+Author: Josh Triplett <josh@speakeasy.net>
+Date:   Mon May 16 03:53:47 2005 +0000
+
+    Add COPYING file for KB.
+
+commit 19bc22d68a990a2498934695f4d938519345a1b0
+Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
+Date:   Mon May 9 18:20:05 2005 +0000
+
+    Change all the protonames from <extension>Ext to <extension>Proto.
+
+commit aaef7b5591cfaaa08ca1d03b113e04dd726059a1
+Author: Kevin E Martin <kem@kem.org>
+Date:   Fri May 6 01:46:31 2005 +0000
+
+    Initial build system files for proto module.
+
+commit b5bacc5786658560870cc24975d29d582e9a335c
+Author: Egbert Eich <eich@suse.de>
+Date:   Fri Apr 23 18:43:06 2004 +0000
+
+    Merging XORG-CURRENT into trunk
+
+commit 50b5d3dd26018cec029d04413bc8deabb83a3845
+Author: Egbert Eich <eich@suse.de>
+Date:   Sun Mar 14 08:31:35 2004 +0000
+
+    Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004
+
+commit f121988370dcc8b5dbdc5b77c49e3c2fb2558fb2
+Author: Egbert Eich <eich@suse.de>
+Date:   Wed Mar 3 12:10:54 2004 +0000
+
+    Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004
+
+commit 85a3d5bced3a1907fe42bbd25b77b3d2e35b1935
+Author: Egbert Eich <eich@suse.de>
+Date:   Thu Feb 26 13:35:11 2004 +0000
+
+    readding XFree86's cvs IDs
+
+commit 27095f92dfad92436113534f850098810d067fb0
+Author: Egbert Eich <eich@suse.de>
+Date:   Thu Feb 26 09:22:27 2004 +0000
+
+    Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004
+
+commit 532eebc568179adf69317855e2c3c9cf305ef81c
+Author: Egbert Eich <eich@suse.de>
+Date:   Thu Jan 29 08:07:56 2004 +0000
+
+    Importing vendor version xf86-012804-2330 on Thu Jan 29 00:06:33 PST 2004
+
+commit 66aafd71e17dbaeb0ba7fa4bf72f17e57d9022e5
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Tue Nov 25 19:28:02 2003 +0000
+
+    XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks
+
+commit bae998431a7285432eb5d1f519246e41832754d0
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Fri Nov 14 16:48:42 2003 +0000
+
+    XFree86 4.3.0.1
+
+commit 209ae2d4c9cd739e91f8c00184dc6f2f48e21100
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Fri Nov 14 15:54:35 2003 +0000
+
+    R6.6 is the Xorg base-line
diff --git a/Makefile.am b/Makefile.am
new file mode 100755 (executable)
index 0000000..bbe8a1e
--- /dev/null
@@ -0,0 +1,23 @@
+kbdir = $(includedir)/X11/extensions
+kb_HEADERS = \
+       XKBgeom.h \
+       XKB.h \
+       XKBproto.h \
+       XKBsrv.h \
+       XKBstr.h
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = kbproto.pc
+
+
+MAINTAINERCLEANFILES = ChangeLog INSTALL
+
+.PHONY: ChangeLog INSTALL
+
+INSTALL:
+       $(INSTALL_CMD)
+
+ChangeLog:
+       $(CHANGELOG_CMD)
+
+dist-hook: ChangeLog INSTALL
diff --git a/README b/README
new file mode 100755 (executable)
index 0000000..49fa4f9
--- /dev/null
+++ b/README
@@ -0,0 +1,30 @@
+                               X Keyboard Extension
+
+This extension defines a protcol to provide a number of new capabilities
+and controls for text keyboards.
+
+Extension name: XKEYBOARD
+
+All questions regarding this software should be directed at the
+Xorg mailing list:
+
+        http://lists.freedesktop.org/mailman/listinfo/xorg
+
+Please submit bug reports to the Xorg bugzilla:
+
+        https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
+
+The master development code repository can be found at:
+
+        git://anongit.freedesktop.org/git/xorg/proto/kbproto
+
+        http://cgit.freedesktop.org/xorg/proto/kbproto
+
+For patch submission instructions, see:
+
+       http://www.x.org/wiki/Development/Documentation/SubmittingPatches
+
+For more information on the git code manager, see:
+
+        http://wiki.x.org/wiki/GitPage
+
diff --git a/XKB.h b/XKB.h
new file mode 100755 (executable)
index 0000000..a3b3bc0
--- /dev/null
+++ b/XKB.h
@@ -0,0 +1,788 @@
+/* $Xorg: XKB.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ */
+/************************************************************
+Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be 
+used in advertising or publicity pertaining to distribution 
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability 
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/include/extensions/XKB.h,v 1.5tsi Exp $ */
+
+#ifndef _XKB_H_
+#define        _XKB_H_
+
+    /*
+     * XKB request codes, used in:
+     *  -  xkbReqType field of all requests
+     *  -  requestMinor field of some events
+     */
+#define        X_kbUseExtension                 0
+#define        X_kbSelectEvents                 1
+#define        X_kbBell                         3
+#define        X_kbGetState                     4
+#define        X_kbLatchLockState               5
+#define        X_kbGetControls                  6
+#define        X_kbSetControls                  7
+#define        X_kbGetMap                       8
+#define        X_kbSetMap                       9
+#define        X_kbGetCompatMap                10
+#define        X_kbSetCompatMap                11
+#define        X_kbGetIndicatorState           12
+#define        X_kbGetIndicatorMap             13
+#define        X_kbSetIndicatorMap             14
+#define        X_kbGetNamedIndicator           15
+#define        X_kbSetNamedIndicator           16
+#define        X_kbGetNames                    17
+#define        X_kbSetNames                    18
+#define        X_kbGetGeometry                 19
+#define        X_kbSetGeometry                 20
+#define        X_kbPerClientFlags              21
+#define        X_kbListComponents              22
+#define        X_kbGetKbdByName                23
+#define        X_kbGetDeviceInfo               24
+#define        X_kbSetDeviceInfo               25
+#define        X_kbSetDebuggingFlags           101
+
+    /*
+     * In the X sense, XKB reports only one event.
+     * The type field of all XKB events is XkbEventCode
+     */
+#define        XkbEventCode                    0
+#define        XkbNumberEvents                 (XkbEventCode+1)
+
+    /*
+     * XKB has a minor event code so it can use one X event code for 
+     * multiple purposes.  
+     *  - reported in the xkbType field of all XKB events.
+     *  - XkbSelectEventDetails: Indicates the event for which event details 
+     *    are being changed
+     */
+#define        XkbNewKeyboardNotify            0
+#define XkbMapNotify                   1
+#define        XkbStateNotify                  2
+#define XkbControlsNotify              3
+#define        XkbIndicatorStateNotify         4
+#define        XkbIndicatorMapNotify           5
+#define        XkbNamesNotify                  6
+#define XkbCompatMapNotify             7
+#define        XkbBellNotify                   8
+#define        XkbActionMessage                9
+#define        XkbAccessXNotify                10
+#define        XkbExtensionDeviceNotify        11
+
+    /*
+     * Event Mask:
+     *  - XkbSelectEvents:  Specifies event interest.
+     */
+#define        XkbNewKeyboardNotifyMask        (1L << 0)
+#define XkbMapNotifyMask               (1L << 1)
+#define        XkbStateNotifyMask              (1L << 2)
+#define XkbControlsNotifyMask          (1L << 3)
+#define        XkbIndicatorStateNotifyMask     (1L << 4)
+#define        XkbIndicatorMapNotifyMask       (1L << 5)
+#define        XkbNamesNotifyMask              (1L << 6)
+#define XkbCompatMapNotifyMask         (1L << 7)
+#define        XkbBellNotifyMask               (1L << 8)
+#define        XkbActionMessageMask            (1L << 9)
+#define        XkbAccessXNotifyMask            (1L << 10)
+#define        XkbExtensionDeviceNotifyMask    (1L << 11)
+#define        XkbAllEventsMask                (0xFFF)
+
+    /*
+     * NewKeyboardNotify event details:
+     */
+#define        XkbNKN_KeycodesMask             (1L << 0)
+#define        XkbNKN_GeometryMask             (1L << 1)
+#define        XkbNKN_DeviceIDMask             (1L << 2)
+#define        XkbAllNewKeyboardEventsMask     (0x7)
+
+    /*
+     * AccessXNotify event types:
+     *  - The 'what' field of AccessXNotify events reports the
+     *    reason that the event was generated.
+     */
+#define        XkbAXN_SKPress                  0
+#define        XkbAXN_SKAccept                 1
+#define        XkbAXN_SKReject                 2
+#define        XkbAXN_SKRelease                3
+#define        XkbAXN_BKAccept                 4
+#define        XkbAXN_BKReject                 5
+#define        XkbAXN_AXKWarning               6
+
+    /*
+     * AccessXNotify details:
+     * - Used as an event detail mask to limit the conditions under which
+     *   AccessXNotify events are reported
+     */
+#define        XkbAXN_SKPressMask              (1L << 0)
+#define        XkbAXN_SKAcceptMask             (1L << 1)
+#define        XkbAXN_SKRejectMask             (1L << 2)
+#define        XkbAXN_SKReleaseMask            (1L << 3)
+#define        XkbAXN_BKAcceptMask             (1L << 4)
+#define        XkbAXN_BKRejectMask             (1L << 5)
+#define        XkbAXN_AXKWarningMask           (1L << 6)
+#define        XkbAllAccessXEventsMask         (0x7f)
+
+    /*
+     * Miscellaneous event details:
+     * - event detail masks for assorted events that don't reall
+     *   have any details.
+     */
+#define        XkbAllStateEventsMask           XkbAllStateComponentsMask
+#define        XkbAllMapEventsMask             XkbAllMapComponentsMask
+#define        XkbAllControlEventsMask         XkbAllControlsMask
+#define        XkbAllIndicatorEventsMask       XkbAllIndicatorsMask
+#define        XkbAllNameEventsMask            XkbAllNamesMask
+#define        XkbAllCompatMapEventsMask       XkbAllCompatMask
+#define        XkbAllBellEventsMask            (1L << 0)
+#define        XkbAllActionMessagesMask        (1L << 0)
+
+    /*
+     * XKB reports one error:  BadKeyboard
+     * A further reason for the error is encoded into to most significant
+     * byte of the resourceID for the error:
+     *    XkbErr_BadDevice - the device in question was not found
+     *    XkbErr_BadClass  - the device was found but it doesn't belong to 
+     *                       the appropriate class.
+     *    XkbErr_BadId     - the device was found and belongs to the right
+     *                       class, but not feedback with a matching id was
+     *                       found.
+     * The low byte of the resourceID for this error contains the device
+     * id, class specifier or feedback id that failed.
+     */
+#define        XkbKeyboard                     0
+#define        XkbNumberErrors                 1
+
+#define        XkbErr_BadDevice        0xff
+#define        XkbErr_BadClass         0xfe
+#define        XkbErr_BadId            0xfd
+
+    /*
+     * Keyboard Components Mask:
+     * - Specifies the components that follow a GetKeyboardByNameReply
+     */
+#define        XkbClientMapMask                (1L << 0)
+#define        XkbServerMapMask                (1L << 1)
+#define        XkbCompatMapMask                (1L << 2)
+#define        XkbIndicatorMapMask             (1L << 3)
+#define        XkbNamesMask                    (1L << 4)
+#define        XkbGeometryMask                 (1L << 5)
+#define        XkbControlsMask                 (1L << 6)
+#define        XkbAllComponentsMask            (0x7f)
+
+    /*
+     * State detail mask:
+     *  - The 'changed' field of StateNotify events reports which of
+     *    the keyboard state components have changed.
+     *  - Used as an event detail mask to limit the conditions under
+     *    which StateNotify events are reported.
+     */
+#define        XkbModifierStateMask            (1L << 0)
+#define        XkbModifierBaseMask             (1L << 1)
+#define        XkbModifierLatchMask            (1L << 2)
+#define        XkbModifierLockMask             (1L << 3)
+#define        XkbGroupStateMask               (1L << 4)
+#define        XkbGroupBaseMask                (1L << 5)
+#define        XkbGroupLatchMask               (1L << 6)
+#define XkbGroupLockMask               (1L << 7)
+#define        XkbCompatStateMask              (1L << 8)
+#define        XkbGrabModsMask                 (1L << 9)
+#define        XkbCompatGrabModsMask           (1L << 10)
+#define        XkbLookupModsMask               (1L << 11)
+#define        XkbCompatLookupModsMask         (1L << 12)
+#define        XkbPointerButtonMask            (1L << 13)
+#define        XkbAllStateComponentsMask       (0x3fff)
+
+    /*
+     * Controls detail masks:
+     *  The controls specified in XkbAllControlsMask:
+     *  - The 'changed' field of ControlsNotify events reports which of 
+     *    the keyboard controls have changed.
+     *  - The 'changeControls' field of the SetControls request specifies
+     *    the controls for which values are to be changed.
+     *  - Used as an event detail mask to limit the conditions under 
+     *    which ControlsNotify events are reported.
+     *
+     *  The controls specified in the XkbAllBooleanCtrlsMask:
+     *  - The 'enabledControls' field of ControlsNotify events reports the
+     *    current status of the boolean controls.
+     *  - The 'enabledControlsChanges' field of ControlsNotify events reports
+     *    any boolean controls that have been turned on or off.
+     *  - The 'affectEnabledControls' and 'enabledControls' fields of the
+     *    kbSetControls request change the set of enabled controls.
+     *  - The 'accessXTimeoutMask' and 'accessXTimeoutValues' fields of
+     *    an XkbControlsRec specify the controls to be changed if the keyboard
+     *    times out and the values to which they should be changed.
+     *  - The 'autoCtrls' and 'autoCtrlsValues' fields of the PerClientFlags 
+     *    request specifies the specify the controls to be reset when the
+     *    client exits and the values to which they should be reset.
+     *  - The 'ctrls' field of an indicator map specifies the controls
+     *    that drive the indicator.
+     *  - Specifies the boolean controls affected by the SetControls and
+     *    LockControls key actions.
+     */
+#define        XkbRepeatKeysMask        (1L << 0)
+#define        XkbSlowKeysMask          (1L << 1)
+#define        XkbBounceKeysMask        (1L << 2)
+#define        XkbStickyKeysMask        (1L << 3)
+#define        XkbMouseKeysMask         (1L << 4)
+#define        XkbMouseKeysAccelMask    (1L << 5)
+#define        XkbAccessXKeysMask       (1L << 6)
+#define        XkbAccessXTimeoutMask    (1L << 7)
+#define        XkbAccessXFeedbackMask   (1L << 8)
+#define        XkbAudibleBellMask       (1L << 9)
+#define        XkbOverlay1Mask          (1L << 10)
+#define        XkbOverlay2Mask          (1L << 11)
+#define        XkbIgnoreGroupLockMask   (1L << 12)
+#define        XkbGroupsWrapMask        (1L << 27)
+#define        XkbInternalModsMask      (1L << 28)
+#define        XkbIgnoreLockModsMask    (1L << 29)
+#define        XkbPerKeyRepeatMask      (1L << 30)
+#define        XkbControlsEnabledMask   (1L << 31)
+
+#define        XkbAccessXOptionsMask    (XkbStickyKeysMask|XkbAccessXFeedbackMask)
+
+#define        XkbAllBooleanCtrlsMask   (0x00001FFF)
+#define        XkbAllControlsMask       (0xF8001FFF)
+#define        XkbAllControlEventsMask  XkbAllControlsMask
+
+    /*
+     * AccessX Options Mask
+     *  - The 'accessXOptions' field of an XkbControlsRec specifies the
+     *    AccessX options that are currently in effect.
+     *  - The 'accessXTimeoutOptionsMask' and 'accessXTimeoutOptionsValues'
+     *    fields of an XkbControlsRec specify the Access X options to be 
+     *    changed if the keyboard times out and the values to which they 
+     *    should be changed.
+     */
+#define        XkbAX_SKPressFBMask     (1L << 0)
+#define        XkbAX_SKAcceptFBMask    (1L << 1)
+#define        XkbAX_FeatureFBMask     (1L << 2)
+#define        XkbAX_SlowWarnFBMask    (1L << 3)
+#define        XkbAX_IndicatorFBMask   (1L << 4)
+#define        XkbAX_StickyKeysFBMask  (1L << 5)
+#define        XkbAX_TwoKeysMask       (1L << 6)
+#define        XkbAX_LatchToLockMask   (1L << 7)
+#define        XkbAX_SKReleaseFBMask   (1L << 8)
+#define        XkbAX_SKRejectFBMask    (1L << 9)
+#define        XkbAX_BKRejectFBMask    (1L << 10)
+#define        XkbAX_DumbBellFBMask    (1L << 11)
+#define        XkbAX_FBOptionsMask     (0xF3F)
+#define        XkbAX_SKOptionsMask     (0x0C0)
+#define        XkbAX_AllOptionsMask    (0xFFF)
+
+    /*
+     * XkbUseCoreKbd is used to specify the core keyboard without having
+     *                         to look up its X input extension identifier.
+     * XkbUseCorePtr is used to specify the core pointer without having
+     *                 to look up its X input extension identifier.
+     * XkbDfltXIClass is used to specify "don't care" any place that the
+     *                 XKB protocol is looking for an X Input Extension 
+     *                 device class.
+     * XkbDfltXIId is used to specify "don't care" any place that the
+     *                 XKB protocol is looking for an X Input Extension
+     *                 feedback identifier.
+     * XkbAllXIClasses is used to get information about all device indicators,
+     *                 whether they're part of the indicator feedback class
+     *                 or the keyboard feedback class.
+     * XkbAllXIIds is used to get information about all device indicator
+     *                 feedbacks without having to list them.
+     * XkbXINone is used to indicate that no class or id has been specified.
+     * XkbLegalXILedClass(c)  True if 'c' specifies a legal class with LEDs
+     * XkbLegalXIBellClass(c) True if 'c' specifies a legal class with bells
+     * XkbExplicitXIDevice(d) True if 'd' explicitly specifies a device
+     * XkbExplicitXIClass(c)  True if 'c' explicitly specifies a device class
+     * XkbExplicitXIId(c)     True if 'i' explicitly specifies a device id
+     * XkbSingleXIClass(c)    True if 'c' specifies exactly one device class, 
+     *                        including the default.
+     * XkbSingleXIId(i)       True if 'i' specifies exactly one device 
+     *                       identifier, including the default.
+     */
+#define        XkbUseCoreKbd           0x0100
+#define        XkbUseCorePtr           0x0200
+#define        XkbDfltXIClass          0x0300
+#define        XkbDfltXIId             0x0400
+#define        XkbAllXIClasses         0x0500
+#define        XkbAllXIIds             0x0600
+#define        XkbXINone               0xff00
+
+#define        XkbLegalXILedClass(c)   (((c)==KbdFeedbackClass)||\
+                                       ((c)==LedFeedbackClass)||\
+                                       ((c)==XkbDfltXIClass)||\
+                                       ((c)==XkbAllXIClasses))
+#define        XkbLegalXIBellClass(c)  (((c)==KbdFeedbackClass)||\
+                                       ((c)==BellFeedbackClass)||\
+                                       ((c)==XkbDfltXIClass)||\
+                                       ((c)==XkbAllXIClasses))
+#define        XkbExplicitXIDevice(c)  (((c)&(~0xff))==0)
+#define        XkbExplicitXIClass(c)   (((c)&(~0xff))==0)
+#define        XkbExplicitXIId(c)      (((c)&(~0xff))==0)
+#define        XkbSingleXIClass(c)     ((((c)&(~0xff))==0)||((c)==XkbDfltXIClass))
+#define        XkbSingleXIId(c)        ((((c)&(~0xff))==0)||((c)==XkbDfltXIId))
+
+#define        XkbNoModifier           0xff
+#define        XkbNoShiftLevel         0xff
+#define        XkbNoShape              0xff
+#define        XkbNoIndicator          0xff
+
+#define        XkbNoModifierMask       0
+#define        XkbAllModifiersMask     0xff
+#define        XkbAllVirtualModsMask   0xffff
+
+#define        XkbNumKbdGroups         4
+#define        XkbMaxKbdGroup          (XkbNumKbdGroups-1)
+
+#define        XkbMaxMouseKeysBtn      4
+
+    /*
+     * Group Index and Mask:
+     *  - Indices into the kt_index array of a key type.
+     *  - Mask specifies types to be changed for XkbChangeTypesOfKey
+     */
+#define        XkbGroup1Index          0
+#define        XkbGroup2Index          1
+#define        XkbGroup3Index          2
+#define        XkbGroup4Index          3
+#define        XkbAnyGroup             254
+#define        XkbAllGroups            255
+
+#define        XkbGroup1Mask           (1<<0)
+#define        XkbGroup2Mask           (1<<1)
+#define        XkbGroup3Mask           (1<<2)
+#define        XkbGroup4Mask           (1<<3)
+#define        XkbAnyGroupMask         (1<<7)
+#define        XkbAllGroupsMask        (0xf)
+
+    /*
+     * BuildCoreState: Given a keyboard group and a modifier state,
+     *                 construct the value to be reported an event.
+     * GroupForCoreState:  Given the state reported in an event,
+     *                 determine the keyboard group.
+     * IsLegalGroup:   Returns TRUE if 'g' is a valid group index.
+     */
+#define        XkbBuildCoreState(m,g)  ((((g)&0x3)<<13)|((m)&0xff))
+#define XkbGroupForCoreState(s)        (((s)>>13)&0x3)
+#define        XkbIsLegalGroup(g)      (((g)>=0)&&((g)<XkbNumKbdGroups))
+
+    /*
+     * GroupsWrap values:
+     *  - The 'groupsWrap' field of an XkbControlsRec specifies the
+     *    treatment of out of range groups.
+     *  - Bits 6 and 7 of the group info field of a key symbol map
+     *    specify the interpretation of out of range groups for the
+     *    corresponding key.
+     */
+#define        XkbWrapIntoRange        (0x00)
+#define        XkbClampIntoRange       (0x40)
+#define        XkbRedirectIntoRange    (0x80)
+
+    /*
+     * Action flags:  Reported in the 'flags' field of most key actions.
+     * Interpretation depends on the type of the action; not all actions
+     * accept all flags.
+     *
+     * Option                  Used for Actions
+     * ------                  ----------------
+     * ClearLocks              SetMods, LatchMods, SetGroup, LatchGroup
+     * LatchToLock             SetMods, LatchMods, SetGroup, LatchGroup
+     * LockNoLock              LockMods, ISOLock, LockPtrBtn, LockDeviceBtn
+     * LockNoUnlock            LockMods, ISOLock, LockPtrBtn, LockDeviceBtn
+     * UseModMapMods           SetMods, LatchMods, LockMods, ISOLock
+     * GroupAbsolute           SetGroup, LatchGroup, LockGroup, ISOLock
+     * UseDfltButton           PtrBtn, LockPtrBtn
+     * NoAcceleration          MovePtr
+     * MoveAbsoluteX           MovePtr
+     * MoveAbsoluteY           MovePtr
+     * ISODfltIsGroup          ISOLock
+     * ISONoAffectMods         ISOLock
+     * ISONoAffectGroup                ISOLock
+     * ISONoAffectPtr          ISOLock
+     * ISONoAffectCtrls                ISOLock
+     * MessageOnPress          ActionMessage
+     * MessageOnRelease                ActionMessage
+     * MessageGenKeyEvent      ActionMessage
+     * AffectDfltBtn           SetPtrDflt
+     * DfltBtnAbsolute         SetPtrDflt
+     * SwitchApplication       SwitchScreen
+     * SwitchAbsolute          SwitchScreen
+     */
+
+#define        XkbSA_ClearLocks        (1L << 0)
+#define        XkbSA_LatchToLock       (1L << 1)
+
+#define        XkbSA_LockNoLock        (1L << 0)
+#define        XkbSA_LockNoUnlock      (1L << 1)
+
+#define        XkbSA_UseModMapMods     (1L << 2)
+
+#define        XkbSA_GroupAbsolute     (1L << 2)
+#define        XkbSA_UseDfltButton     0
+
+#define        XkbSA_NoAcceleration    (1L << 0)
+#define        XkbSA_MoveAbsoluteX     (1L << 1)
+#define        XkbSA_MoveAbsoluteY     (1L << 2)
+
+#define        XkbSA_ISODfltIsGroup     (1L << 7)
+#define        XkbSA_ISONoAffectMods    (1L << 6)
+#define        XkbSA_ISONoAffectGroup   (1L << 5)
+#define        XkbSA_ISONoAffectPtr     (1L << 4)
+#define        XkbSA_ISONoAffectCtrls   (1L << 3)
+#define        XkbSA_ISOAffectMask      (0x78)
+
+#define        XkbSA_MessageOnPress     (1L << 0)
+#define        XkbSA_MessageOnRelease   (1L << 1)
+#define        XkbSA_MessageGenKeyEvent (1L << 2)
+
+#define        XkbSA_AffectDfltBtn     1
+#define        XkbSA_DfltBtnAbsolute   (1L << 2)
+
+#define        XkbSA_SwitchApplication (1L << 0)
+#define        XkbSA_SwitchAbsolute    (1L << 2)
+
+    /*
+     * The following values apply to the SA_DeviceValuator 
+     * action only.  Valuator operations specify the action 
+     * to be taken.   Values specified in the action are 
+     * multiplied by 2^scale before they are applied.
+     */
+#define        XkbSA_IgnoreVal         (0x00)
+#define        XkbSA_SetValMin         (0x10)
+#define        XkbSA_SetValCenter      (0x20)
+#define        XkbSA_SetValMax         (0x30)
+#define        XkbSA_SetValRelative    (0x40)
+#define        XkbSA_SetValAbsolute    (0x50)
+#define        XkbSA_ValOpMask         (0x70)
+#define        XkbSA_ValScaleMask      (0x07)
+#define        XkbSA_ValOp(a)          ((a)&XkbSA_ValOpMask)
+#define        XkbSA_ValScale(a)       ((a)&XkbSA_ValScaleMask)
+
+    /*
+     * Action types: specifies the type of a key action.  Reported in the
+     * type field of all key actions.
+     */
+#define        XkbSA_NoAction          0x00
+#define        XkbSA_SetMods           0x01
+#define        XkbSA_LatchMods         0x02
+#define        XkbSA_LockMods          0x03
+#define        XkbSA_SetGroup          0x04
+#define        XkbSA_LatchGroup        0x05
+#define        XkbSA_LockGroup         0x06
+#define        XkbSA_MovePtr           0x07
+#define        XkbSA_PtrBtn            0x08
+#define        XkbSA_LockPtrBtn        0x09
+#define        XkbSA_SetPtrDflt        0x0a
+#define        XkbSA_ISOLock           0x0b
+#define        XkbSA_Terminate         0x0c
+#define        XkbSA_SwitchScreen      0x0d
+#define        XkbSA_SetControls       0x0e
+#define        XkbSA_LockControls      0x0f
+#define        XkbSA_ActionMessage     0x10
+#define        XkbSA_RedirectKey       0x11
+#define        XkbSA_DeviceBtn         0x12
+#define        XkbSA_LockDeviceBtn     0x13
+#define        XkbSA_DeviceValuator    0x14
+#define        XkbSA_LastAction        XkbSA_DeviceValuator
+#define        XkbSA_NumActions        (XkbSA_LastAction+1)
+
+#define        XkbSA_XFree86Private    0x86
+
+    /*
+     * Specifies the key actions that clear latched groups or modifiers.
+     */
+#define        XkbSA_BreakLatch \
+       ((1<<XkbSA_NoAction)|(1<<XkbSA_PtrBtn)|(1<<XkbSA_LockPtrBtn)|\
+       (1<<XkbSA_Terminate)|(1<<XkbSA_SwitchScreen)|(1<<XkbSA_SetControls)|\
+       (1<<XkbSA_LockControls)|(1<<XkbSA_ActionMessage)|\
+       (1<<XkbSA_RedirectKey)|(1<<XkbSA_DeviceBtn)|(1<<XkbSA_LockDeviceBtn))
+        
+    /*
+     * Macros to classify key actions
+     */
+#define        XkbIsModAction(a)       (((a)->type>=Xkb_SASetMods)&&((a)->type<=XkbSA_LockMods))
+#define        XkbIsGroupAction(a)     (((a)->type>=XkbSA_SetGroup)&&((a)->type<=XkbSA_LockGroup))
+#define        XkbIsPtrAction(a)       (((a)->type>=XkbSA_MovePtr)&&((a)->type<=XkbSA_SetPtrDflt))
+
+
+    /*
+     * Key Behavior Qualifier:
+     *    KB_Permanent indicates that the behavior describes an unalterable
+     *    characteristic of the keyboard, not an XKB software-simulation of
+     *    the listed behavior.
+     * Key Behavior Types:  
+     *    Specifies the behavior of the underlying key.
+     */
+#define        XkbKB_Permanent         0x80
+#define        XkbKB_OpMask            0x7f
+
+#define        XkbKB_Default           0x00
+#define        XkbKB_Lock              0x01
+#define        XkbKB_RadioGroup        0x02
+#define        XkbKB_Overlay1          0x03
+#define        XkbKB_Overlay2          0x04
+
+#define        XkbKB_RGAllowNone       0x80
+
+    /*
+     * Various macros which describe the range of legal keycodes.
+     */
+#define        XkbMinLegalKeyCode      8
+#define        XkbMaxLegalKeyCode      255
+#define        XkbMaxKeyCount          (XkbMaxLegalKeyCode-XkbMinLegalKeyCode+1)
+#define        XkbPerKeyBitArraySize   ((XkbMaxLegalKeyCode+1)/8)
+/* Seems kinda silly to check that an unsigned char is <= 255... */
+#define        XkbIsLegalKeycode(k)    ((k)>=XkbMinLegalKeyCode)
+
+    /*
+     * Assorted constants and limits.
+     */
+#define        XkbNumModifiers         8
+#define        XkbNumVirtualMods       16
+#define        XkbNumIndicators        32
+#define        XkbAllIndicatorsMask    (0xffffffff)
+#define        XkbMaxRadioGroups       32
+#define        XkbAllRadioGroupsMask   (0xffffffff)
+#define        XkbMaxShiftLevel        63
+#define        XkbMaxSymsPerKey        (XkbMaxShiftLevel*XkbNumKbdGroups)
+#define        XkbRGMaxMembers         12
+#define        XkbActionMessageLength  6
+#define        XkbKeyNameLength        4
+#define        XkbMaxRedirectCount     8
+
+#define        XkbGeomPtsPerMM         10
+#define        XkbGeomMaxColors        32
+#define        XkbGeomMaxLabelColors   3
+#define        XkbGeomMaxPriority      255
+
+    /*
+     * Key Type index and mask for the four standard key types.
+     */
+#define        XkbOneLevelIndex        0
+#define        XkbTwoLevelIndex        1
+#define        XkbAlphabeticIndex      2
+#define        XkbKeypadIndex          3
+#define        XkbLastRequiredType     XkbKeypadIndex
+#define        XkbNumRequiredTypes     (XkbLastRequiredType+1)
+#define        XkbMaxKeyTypes          255
+
+#define        XkbOneLevelMask         (1<<0)
+#define        XkbTwoLevelMask         (1<<1)
+#define        XkbAlphabeticMask       (1<<2)
+#define        XkbKeypadMask           (1<<3)
+#define        XkbAllRequiredTypes     (0xf)
+
+#define        XkbShiftLevel(n)        ((n)-1)
+#define        XkbShiftLevelMask(n)    (1<<((n)-1))
+
+    /*
+     * Extension name and version information
+     */
+#define        XkbName "XKEYBOARD"
+#define        XkbMajorVersion 1
+#define        XkbMinorVersion 0
+
+    /*
+     * Explicit map components:
+     *  - Used in the 'explicit' field of an XkbServerMap.  Specifies
+     *    the keyboard components that should _not_ be updated automatically
+     *    in response to core protocol keyboard mapping requests.
+     */
+#define        XkbExplicitKeyTypesMask   (0x0f)
+#define        XkbExplicitKeyType1Mask   (1<<0)
+#define        XkbExplicitKeyType2Mask   (1<<1)
+#define        XkbExplicitKeyType3Mask   (1<<2)
+#define        XkbExplicitKeyType4Mask   (1<<3)
+#define        XkbExplicitInterpretMask  (1<<4)
+#define        XkbExplicitAutoRepeatMask (1<<5)
+#define        XkbExplicitBehaviorMask   (1<<6)
+#define        XkbExplicitVModMapMask    (1<<7)
+#define        XkbAllExplicitMask        (0xff)
+
+    /*
+     * Map components masks:
+     * Those in AllMapComponentsMask:
+     *  - Specifies the individual fields to be loaded or changed for the
+     *    GetMap and SetMap requests.
+     * Those in ClientInfoMask:
+     *  - Specifies the components to be allocated by XkbAllocClientMap.
+     * Those in ServerInfoMask:
+     *  - Specifies the components to be allocated by XkbAllocServerMap.
+     */
+#define        XkbKeyTypesMask         (1<<0)
+#define        XkbKeySymsMask          (1<<1)
+#define        XkbModifierMapMask      (1<<2)
+#define        XkbExplicitComponentsMask (1<<3)
+#define XkbKeyActionsMask      (1<<4)
+#define        XkbKeyBehaviorsMask     (1<<5)
+#define        XkbVirtualModsMask      (1<<6)
+#define        XkbVirtualModMapMask    (1<<7)
+
+#define        XkbAllClientInfoMask    (XkbKeyTypesMask|XkbKeySymsMask|XkbModifierMapMask)
+#define        XkbAllServerInfoMask    (XkbExplicitComponentsMask|XkbKeyActionsMask|XkbKeyBehaviorsMask|XkbVirtualModsMask|XkbVirtualModMapMask)
+#define        XkbAllMapComponentsMask (XkbAllClientInfoMask|XkbAllServerInfoMask)
+
+    /*
+     * Symbol interpretations flags:
+     *  - Used in the flags field of a symbol interpretation
+     */
+#define        XkbSI_AutoRepeat        (1<<0)
+#define        XkbSI_LockingKey        (1<<1)
+
+    /*
+     * Symbol interpretations match specification:
+     *  - Used in the match field of a symbol interpretation to specify 
+     *    the conditions under which an interpretation is used.
+     */
+#define        XkbSI_LevelOneOnly      (0x80)
+#define        XkbSI_OpMask            (0x7f)
+#define        XkbSI_NoneOf            (0)
+#define        XkbSI_AnyOfOrNone       (1)
+#define        XkbSI_AnyOf             (2)
+#define        XkbSI_AllOf             (3)
+#define        XkbSI_Exactly           (4)
+
+    /*
+     * Indicator map flags:
+     *  - Used in the flags field of an indicator map to indicate the
+     *    conditions under which and indicator can be changed and the
+     *    effects of changing the indicator.
+     */
+#define        XkbIM_NoExplicit        (1L << 7)
+#define        XkbIM_NoAutomatic       (1L << 6)
+#define        XkbIM_LEDDrivesKB       (1L << 5)
+
+    /*
+     * Indicator map component specifications:
+     *  - Used by the 'which_groups' and 'which_mods' fields of an indicator
+     *    map to specify which keyboard components should be used to drive
+     *    the indicator.
+     */
+#define        XkbIM_UseBase           (1L << 0)
+#define        XkbIM_UseLatched        (1L << 1)
+#define        XkbIM_UseLocked         (1L << 2)
+#define        XkbIM_UseEffective      (1L << 3)
+#define        XkbIM_UseCompat         (1L << 4)
+
+#define        XkbIM_UseNone     0
+#define        XkbIM_UseAnyGroup (XkbIM_UseBase|XkbIM_UseLatched|XkbIM_UseLocked\
+                           |XkbIM_UseEffective)
+#define        XkbIM_UseAnyMods  (XkbIM_UseAnyGroup|XkbIM_UseCompat)
+
+    /*
+     * Compatibility Map Compontents:
+     *  - Specifies the components to be allocated in XkbAllocCompatMap.
+     */
+#define        XkbSymInterpMask        (1<<0)
+#define        XkbGroupCompatMask      (1<<1)
+#define        XkbAllCompatMask        (0x3)
+
+    /*
+     * Names component mask:
+     *  - Specifies the names to be loaded or changed for the GetNames and
+     *    SetNames requests.
+     *  - Specifies the names that have changed in a NamesNotify event.
+     *  - Specifies the names components to be allocated by XkbAllocNames.
+     */
+#define        XkbKeycodesNameMask     (1<<0)
+#define        XkbGeometryNameMask     (1<<1)
+#define        XkbSymbolsNameMask      (1<<2)
+#define        XkbPhysSymbolsNameMask  (1<<3)
+#define        XkbTypesNameMask        (1<<4)
+#define        XkbCompatNameMask       (1<<5)
+#define        XkbKeyTypeNamesMask     (1<<6)
+#define        XkbKTLevelNamesMask     (1<<7)
+#define        XkbIndicatorNamesMask   (1<<8)
+#define        XkbKeyNamesMask         (1<<9)
+#define        XkbKeyAliasesMask       (1<<10)
+#define        XkbVirtualModNamesMask  (1<<11)
+#define        XkbGroupNamesMask       (1<<12)
+#define        XkbRGNamesMask          (1<<13)
+#define        XkbComponentNamesMask   (0x3f)
+#define        XkbAllNamesMask         (0x3fff)
+
+    /*
+     * GetByName components:
+     *  - Specifies desired or necessary components to GetKbdByName request.
+     *  - Reports the components that were found in a GetKbdByNameReply
+     */
+#define        XkbGBN_TypesMask                (1L << 0)
+#define        XkbGBN_CompatMapMask            (1L << 1)
+#define        XkbGBN_ClientSymbolsMask        (1L << 2)
+#define        XkbGBN_ServerSymbolsMask        (1L << 3)
+#define        XkbGBN_SymbolsMask (XkbGBN_ClientSymbolsMask|XkbGBN_ServerSymbolsMask)
+#define        XkbGBN_IndicatorMapMask         (1L << 4)
+#define        XkbGBN_KeyNamesMask             (1L << 5)
+#define        XkbGBN_GeometryMask             (1L << 6)
+#define        XkbGBN_OtherNamesMask           (1L << 7)
+#define        XkbGBN_AllComponentsMask        (0xff)
+
+     /*
+      * ListComponents flags
+      */
+#define        XkbLC_Hidden                    (1L <<  0)
+#define        XkbLC_Default                   (1L <<  1)
+#define        XkbLC_Partial                   (1L <<  2)
+
+#define        XkbLC_AlphanumericKeys          (1L <<  8)
+#define        XkbLC_ModifierKeys              (1L <<  9)
+#define        XkbLC_KeypadKeys                (1L << 10)
+#define        XkbLC_FunctionKeys              (1L << 11)
+#define        XkbLC_AlternateGroup            (1L << 12)
+
+    /*
+     * X Input Extension Interactions
+     * - Specifies the possible interactions between XKB and the X input
+     *   extension
+     * - Used to request (XkbGetDeviceInfo) or change (XKbSetDeviceInfo)
+     *   XKB information about an extension device.
+     * - Reports the list of supported optional features in the reply to
+     *   XkbGetDeviceInfo or in an XkbExtensionDeviceNotify event.
+     * XkbXI_UnsupportedFeature is reported in XkbExtensionDeviceNotify
+     * events to indicate an attempt to use an unsupported feature.
+     */
+#define        XkbXI_KeyboardsMask             (1L << 0)
+#define        XkbXI_ButtonActionsMask         (1L << 1)
+#define        XkbXI_IndicatorNamesMask        (1L << 2)
+#define        XkbXI_IndicatorMapsMask         (1L << 3)
+#define        XkbXI_IndicatorStateMask        (1L << 4)
+#define        XkbXI_UnsupportedFeatureMask    (1L << 15)
+#define        XkbXI_AllFeaturesMask           (0x001f)
+#define        XkbXI_AllDeviceFeaturesMask     (0x001e)
+
+#define        XkbXI_IndicatorsMask            (0x001c)
+#define        XkbAllExtensionDeviceEventsMask (0x801f)
+
+    /*
+     * Per-Client Flags:
+     *  - Specifies flags to be changed by the PerClientFlags request.
+     */
+#define        XkbPCF_DetectableAutoRepeatMask (1L << 0)
+#define        XkbPCF_GrabsUseXKBStateMask     (1L << 1)
+#define        XkbPCF_AutoResetControlsMask    (1L << 2)
+#define        XkbPCF_LookupStateWhenGrabbed   (1L << 3)
+#define        XkbPCF_SendEventUsesXKBState    (1L << 4)
+#define        XkbPCF_AllFlagsMask             (0x1F)
+
+    /*
+     * Debugging flags and controls
+     */
+#define        XkbDF_DisableLocks      (1<<0)
+
+#endif /* _XKB_H_ */
diff --git a/XKBgeom.h b/XKBgeom.h
new file mode 100644 (file)
index 0000000..89f902f
--- /dev/null
+++ b/XKBgeom.h
@@ -0,0 +1,659 @@
+/* $Xorg: XKBgeom.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ */
+/************************************************************
+Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be 
+used in advertising or publicity pertaining to distribution 
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability 
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/include/extensions/XKBgeom.h,v 3.9 2002/09/18 17:11:40 tsi Exp $ */
+
+#ifndef _XKBGEOM_H_
+#define        _XKBGEOM_H_
+
+#include <X11/extensions/XKBstr.h>
+
+#ifdef XKB_IN_SERVER
+#define XkbAddGeomKeyAlias             SrvXkbAddGeomKeyAlias
+#define XkbAddGeomColor                SrvXkbAddGeomColor
+#define XkbAddGeomDoodad               SrvXkbAddGeomDoodad
+#define XkbAddGeomKey                  SrvXkbAddGeomKey
+#define XkbAddGeomOutline              SrvXkbAddGeomOutline
+#define XkbAddGeomOverlay              SrvXkbAddGeomOverlay
+#define XkbAddGeomOverlayRow           SrvXkbAddGeomOverlayRow
+#define        XkbAddGeomOverlayKey            SrvXkbAddGeomOverlayKey
+#define XkbAddGeomProperty             SrvXkbAddGeomProperty
+#define XkbAddGeomRow                  SrvXkbAddGeomRow
+#define XkbAddGeomSection              SrvXkbAddGeomSection
+#define XkbAddGeomShape                        SrvXkbAddGeomShape
+#define XkbAllocGeomKeyAliases         SrvXkbAllocGeomKeyAliases
+#define XkbAllocGeomColors             SrvXkbAllocGeomColors
+#define XkbAllocGeomDoodads            SrvXkbAllocGeomDoodads
+#define XkbAllocGeomKeys               SrvXkbAllocGeomKeys
+#define XkbAllocGeomOutlines           SrvXkbAllocGeomOutlines
+#define XkbAllocGeomPoints             SrvXkbAllocGeomPoints
+#define XkbAllocGeomProps              SrvXkbAllocGeomProps
+#define XkbAllocGeomRows               SrvXkbAllocGeomRows
+#define XkbAllocGeomSectionDoodads     SrvXkbAllocGeomSectionDoodads
+#define XkbAllocGeomSections           SrvXkbAllocGeomSections
+#define        XkbAllocGeomOverlays            SrvXkbAllocGeomOverlays
+#define        XkbAllocGeomOverlayRows         SrvXkbAllocGeomOverlayRows
+#define        XkbAllocGeomOverlayKeys         SrvXkbAllocGeomOverlayKeys
+#define XkbAllocGeomShapes             SrvXkbAllocGeomShapes
+#define XkbAllocGeometry               SrvXkbAllocGeometry
+#define XkbFreeGeomKeyAliases          SrvXkbFreeGeomKeyAliases
+#define XkbFreeGeomColors              SrvXkbFreeGeomColors
+#define XkbFreeGeomDoodads             SrvXkbFreeGeomDoodads
+#define XkbFreeGeomProperties          SrvXkbFreeGeomProperties
+#define        XkbFreeGeomOverlayKeys          SrvXkbFreeGeomOverlayKeys
+#define        XkbFreeGeomOverlayRows          SrvXkbFreeGeomOverlayRows
+#define        XkbFreeGeomOverlays             SrvXkbFreeGeomOverlays
+#define        XkbFreeGeomKeys                 SrvXkbFreeGeomKeys
+#define        XkbFreeGeomRows                 SrvXkbFreeGeomRows
+#define XkbFreeGeomSections            SrvXkbFreeGeomSections
+#define        XkbFreeGeomPoints               SrvXkbFreeGeomPoints
+#define        XkbFreeGeomOutlines             SrvXkbFreeGeomOutlines
+#define XkbFreeGeomShapes              SrvXkbFreeGeomShapes
+#define XkbFreeGeometry                        SrvXkbFreeGeometry
+#endif
+
+typedef        struct _XkbProperty {
+       char    *name;
+       char    *value;
+} XkbPropertyRec,*XkbPropertyPtr;
+
+typedef struct _XkbColor {
+       unsigned int    pixel;
+       char *          spec;
+} XkbColorRec,*XkbColorPtr;
+
+typedef        struct _XkbPoint {
+       short   x;
+       short   y;
+} XkbPointRec, *XkbPointPtr;
+
+typedef struct _XkbBounds {
+       short   x1,y1;
+       short   x2,y2;
+} XkbBoundsRec, *XkbBoundsPtr;
+#define        XkbBoundsWidth(b)       (((b)->x2)-((b)->x1))
+#define        XkbBoundsHeight(b)      (((b)->y2)-((b)->y1))
+
+typedef struct _XkbOutline {
+       unsigned short  num_points;
+       unsigned short  sz_points;
+       unsigned short  corner_radius;
+       XkbPointPtr     points;
+} XkbOutlineRec, *XkbOutlinePtr;
+
+typedef struct _XkbShape {
+       Atom             name;
+       unsigned short   num_outlines;
+       unsigned short   sz_outlines;
+       XkbOutlinePtr    outlines;
+       XkbOutlinePtr    approx;
+       XkbOutlinePtr    primary;
+       XkbBoundsRec     bounds;
+} XkbShapeRec, *XkbShapePtr;
+#define        XkbOutlineIndex(s,o)    ((int)((o)-&(s)->outlines[0]))
+
+typedef struct _XkbShapeDoodad {
+       Atom             name;
+       unsigned char    type;
+       unsigned char    priority;
+       short            top;
+       short            left;
+       short            angle;
+       unsigned short   color_ndx;
+       unsigned short   shape_ndx;
+} XkbShapeDoodadRec, *XkbShapeDoodadPtr;
+#define        XkbShapeDoodadColor(g,d)        (&(g)->colors[(d)->color_ndx])
+#define        XkbShapeDoodadShape(g,d)        (&(g)->shapes[(d)->shape_ndx])
+#define        XkbSetShapeDoodadColor(g,d,c)   ((d)->color_ndx= (c)-&(g)->colors[0])
+#define        XkbSetShapeDoodadShape(g,d,s)   ((d)->shape_ndx= (s)-&(g)->shapes[0])
+
+typedef struct _XkbTextDoodad {
+       Atom             name;
+       unsigned char    type;
+       unsigned char    priority;
+       short            top;
+       short            left;
+       short            angle;
+       short            width;
+       short            height;
+       unsigned short   color_ndx;
+       char *           text;
+       char *           font;
+} XkbTextDoodadRec, *XkbTextDoodadPtr;
+#define        XkbTextDoodadColor(g,d) (&(g)->colors[(d)->color_ndx])
+#define        XkbSetTextDoodadColor(g,d,c)    ((d)->color_ndx= (c)-&(g)->colors[0])
+
+typedef struct _XkbIndicatorDoodad {
+       Atom             name;
+       unsigned char    type;
+       unsigned char    priority;
+       short            top;
+       short            left;
+       short            angle;
+       unsigned short   shape_ndx;
+       unsigned short   on_color_ndx;
+       unsigned short   off_color_ndx;
+} XkbIndicatorDoodadRec, *XkbIndicatorDoodadPtr;
+#define        XkbIndicatorDoodadShape(g,d)    (&(g)->shapes[(d)->shape_ndx])
+#define        XkbIndicatorDoodadOnColor(g,d)  (&(g)->colors[(d)->on_color_ndx])
+#define        XkbIndicatorDoodadOffColor(g,d) (&(g)->colors[(d)->off_color_ndx])
+#define        XkbSetIndicatorDoodadOnColor(g,d,c) \
+                               ((d)->on_color_ndx= (c)-&(g)->colors[0])
+#define        XkbSetIndicatorDoodadOffColor(g,d,c) \
+                               ((d)->off_color_ndx= (c)-&(g)->colors[0])
+#define        XkbSetIndicatorDoodadShape(g,d,s) \
+                               ((d)->shape_ndx= (s)-&(g)->shapes[0])
+
+typedef struct _XkbLogoDoodad {
+       Atom             name;
+       unsigned char    type;
+       unsigned char    priority;
+       short            top;
+       short            left;
+       short            angle;
+       unsigned short   color_ndx;
+       unsigned short   shape_ndx;
+       char *           logo_name;
+} XkbLogoDoodadRec, *XkbLogoDoodadPtr;
+#define        XkbLogoDoodadColor(g,d)         (&(g)->colors[(d)->color_ndx])
+#define        XkbLogoDoodadShape(g,d)         (&(g)->shapes[(d)->shape_ndx])
+#define        XkbSetLogoDoodadColor(g,d,c)    ((d)->color_ndx= (c)-&(g)->colors[0])
+#define        XkbSetLogoDoodadShape(g,d,s)    ((d)->shape_ndx= (s)-&(g)->shapes[0])
+
+typedef struct _XkbAnyDoodad {
+       Atom             name;
+       unsigned char    type;
+       unsigned char    priority;
+       short            top;
+       short            left;
+       short            angle;
+} XkbAnyDoodadRec, *XkbAnyDoodadPtr;
+
+typedef union _XkbDoodad {
+       XkbAnyDoodadRec         any;
+       XkbShapeDoodadRec       shape;
+       XkbTextDoodadRec        text;
+       XkbIndicatorDoodadRec   indicator;
+       XkbLogoDoodadRec        logo;
+} XkbDoodadRec, *XkbDoodadPtr;
+
+#define        XkbUnknownDoodad        0
+#define        XkbOutlineDoodad        1
+#define        XkbSolidDoodad          2
+#define        XkbTextDoodad           3
+#define        XkbIndicatorDoodad      4
+#define        XkbLogoDoodad           5
+
+typedef struct _XkbKey {
+       XkbKeyNameRec    name;
+       short            gap;
+       unsigned char    shape_ndx;
+       unsigned char    color_ndx;
+} XkbKeyRec, *XkbKeyPtr;
+#define        XkbKeyShape(g,k)        (&(g)->shapes[(k)->shape_ndx])
+#define        XkbKeyColor(g,k)        (&(g)->colors[(k)->color_ndx])
+#define        XkbSetKeyShape(g,k,s)   ((k)->shape_ndx= (s)-&(g)->shapes[0])
+#define        XkbSetKeyColor(g,k,c)   ((k)->color_ndx= (c)-&(g)->colors[0])
+
+typedef struct _XkbRow {
+       short           top;
+       short           left;
+       unsigned short  num_keys;
+       unsigned short  sz_keys;
+       int             vertical;
+       XkbKeyPtr       keys;
+       XkbBoundsRec    bounds;
+} XkbRowRec, *XkbRowPtr;
+
+typedef struct _XkbSection {
+       Atom             name;
+       unsigned char    priority;
+       short            top;
+       short            left;
+       unsigned short   width;
+       unsigned short   height;
+       short            angle;
+       unsigned short   num_rows;
+       unsigned short   num_doodads;
+       unsigned short   num_overlays;
+       unsigned short   sz_rows;
+       unsigned short   sz_doodads;
+       unsigned short   sz_overlays;
+       XkbRowPtr        rows;
+       XkbDoodadPtr     doodads;
+       XkbBoundsRec     bounds;
+       struct _XkbOverlay *overlays;
+} XkbSectionRec, *XkbSectionPtr;
+
+typedef        struct _XkbOverlayKey {
+       XkbKeyNameRec   over;
+       XkbKeyNameRec   under;
+} XkbOverlayKeyRec,*XkbOverlayKeyPtr;
+
+typedef struct _XkbOverlayRow {
+       unsigned short          row_under;
+       unsigned short          num_keys;
+       unsigned short          sz_keys;
+       XkbOverlayKeyPtr        keys;
+} XkbOverlayRowRec,*XkbOverlayRowPtr;
+
+typedef struct _XkbOverlay {
+       Atom                    name;
+       XkbSectionPtr           section_under;
+       unsigned short          num_rows;
+       unsigned short          sz_rows;
+       XkbOverlayRowPtr        rows;
+       XkbBoundsPtr            bounds;
+} XkbOverlayRec,*XkbOverlayPtr;
+
+typedef struct _XkbGeometry {
+       Atom             name;
+       unsigned short   width_mm;
+       unsigned short   height_mm;
+       char *           label_font;
+       XkbColorPtr      label_color;
+       XkbColorPtr      base_color;
+       unsigned short   sz_properties;
+       unsigned short   sz_colors;
+       unsigned short   sz_shapes;
+       unsigned short   sz_sections;
+       unsigned short   sz_doodads;
+       unsigned short   sz_key_aliases;
+       unsigned short   num_properties;
+       unsigned short   num_colors;
+       unsigned short   num_shapes;
+       unsigned short   num_sections;
+       unsigned short   num_doodads;
+       unsigned short   num_key_aliases;
+       XkbPropertyPtr   properties;
+       XkbColorPtr      colors;
+       XkbShapePtr      shapes;
+       XkbSectionPtr    sections;
+       XkbDoodadPtr     doodads;
+       XkbKeyAliasPtr   key_aliases;
+} XkbGeometryRec;
+#define        XkbGeomColorIndex(g,c)  ((int)((c)-&(g)->colors[0]))
+
+#define        XkbGeomPropertiesMask   (1<<0)
+#define        XkbGeomColorsMask       (1<<1)
+#define        XkbGeomShapesMask       (1<<2)
+#define        XkbGeomSectionsMask     (1<<3)
+#define        XkbGeomDoodadsMask      (1<<4)
+#define        XkbGeomKeyAliasesMask   (1<<5)
+#define        XkbGeomAllMask          (0x3f)
+
+typedef struct _XkbGeometrySizes {
+       unsigned int    which;
+       unsigned short  num_properties;
+       unsigned short  num_colors;
+       unsigned short  num_shapes;
+       unsigned short  num_sections;
+       unsigned short  num_doodads;
+       unsigned short  num_key_aliases;
+} XkbGeometrySizesRec,*XkbGeometrySizesPtr;
+
+_XFUNCPROTOBEGIN
+
+extern XkbPropertyPtr
+XkbAddGeomProperty(
+    XkbGeometryPtr     /* geom */,
+    char *             /* name */,
+    char *             /* value */
+);
+
+extern XkbKeyAliasPtr
+XkbAddGeomKeyAlias(
+    XkbGeometryPtr     /* geom */,
+    char *             /* alias */,
+    char *             /* real */
+);
+
+extern XkbColorPtr
+XkbAddGeomColor(
+    XkbGeometryPtr     /* geom */,
+    char *             /* spec */,
+    unsigned int       /* pixel */
+);
+
+extern XkbOutlinePtr
+XkbAddGeomOutline(
+    XkbShapePtr                /* shape */,
+    int                        /* sz_points */
+);
+
+extern XkbShapePtr
+XkbAddGeomShape(
+    XkbGeometryPtr     /* geom */,
+    Atom               /* name */,
+    int                        /* sz_outlines */
+);
+
+extern XkbKeyPtr
+XkbAddGeomKey(
+    XkbRowPtr          /* row */
+);
+
+extern XkbRowPtr
+XkbAddGeomRow(
+    XkbSectionPtr      /* section */,
+    int                        /* sz_keys */
+);
+
+extern XkbSectionPtr
+XkbAddGeomSection(
+    XkbGeometryPtr     /* geom */,
+    Atom               /* name */,
+    int                        /* sz_rows */,
+    int                        /* sz_doodads */,
+    int                        /* sz_overlays */
+);
+
+extern XkbOverlayPtr
+XkbAddGeomOverlay(
+    XkbSectionPtr      /* section */,
+    Atom               /* name */,
+    int                        /* sz_rows */
+);
+
+extern XkbOverlayRowPtr
+XkbAddGeomOverlayRow(
+    XkbOverlayPtr      /* overlay */,
+    int                        /* row_under */,
+    int                        /* sz_keys */
+);
+
+extern XkbOverlayKeyPtr
+XkbAddGeomOverlayKey(
+    XkbOverlayPtr      /* overlay */,
+    XkbOverlayRowPtr   /* row */,
+    char *             /* over */,
+    char *             /* under */
+);
+
+extern XkbDoodadPtr
+XkbAddGeomDoodad(
+    XkbGeometryPtr     /* geom */,
+    XkbSectionPtr      /* section */,
+    Atom               /* name */
+);
+
+
+extern void
+XkbFreeGeomKeyAliases(
+    XkbGeometryPtr     /* geom */,
+    int                        /* first */,
+    int                        /* count */,
+    Bool               /* freeAll */
+);
+
+extern void
+XkbFreeGeomColors(
+    XkbGeometryPtr     /* geom */,
+    int                        /* first */,
+    int                        /* count */,
+    Bool               /* freeAll */
+);
+
+extern void
+XkbFreeGeomDoodads(
+    XkbDoodadPtr       /* doodads */,
+    int                        /* nDoodads */,
+    Bool               /* freeAll */
+);
+
+
+extern void
+XkbFreeGeomProperties(
+    XkbGeometryPtr     /* geom */,
+    int                        /* first */,
+    int                        /* count */,
+    Bool               /* freeAll */
+);
+
+extern void
+XkbFreeGeomOverlayKeys(
+    XkbOverlayRowPtr   /* row */,
+    int                        /* first */,
+    int                        /* count */,
+    Bool               /* freeAll */
+);
+
+extern void
+XkbFreeGeomOverlayRows(
+    XkbOverlayPtr      /* overlay */,
+    int                        /* first */,
+    int                        /* count */,
+    Bool               /* freeAll */
+);
+
+extern void
+XkbFreeGeomOverlays(
+    XkbSectionPtr      /* section */,
+    int                        /* first */,
+    int                        /* count */,
+    Bool               /* freeAll */
+);
+
+extern void
+XkbFreeGeomKeys(
+    XkbRowPtr          /* row */,
+    int                        /* first */,
+    int                        /* count */,
+    Bool               /* freeAll */
+);
+
+extern void
+XkbFreeGeomRows(
+    XkbSectionPtr      /* section */,
+    int                        /* first */,
+    int                        /* count */,
+    Bool               /* freeAll */
+);
+
+extern void
+XkbFreeGeomSections(
+    XkbGeometryPtr     /* geom */,
+    int                        /* first */,
+    int                        /* count */,
+    Bool               /* freeAll */
+);
+
+
+extern void
+XkbFreeGeomPoints(
+    XkbOutlinePtr      /* outline */,
+    int                        /* first */,
+    int                        /* count */,
+    Bool               /* freeAll */
+);
+
+extern void
+XkbFreeGeomOutlines(
+    XkbShapePtr                /* shape */,
+    int                        /* first */,
+    int                        /* count */,
+    Bool               /* freeAll */
+);
+
+extern void
+XkbFreeGeomShapes(
+    XkbGeometryPtr     /* geom */,
+    int                        /* first */,
+    int                        /* count */,
+    Bool               /* freeAll */
+);
+
+extern void
+XkbFreeGeometry(
+    XkbGeometryPtr     /* geom */,
+    unsigned int       /* which */,
+    Bool               /* freeMap */
+);
+
+extern Status
+XkbAllocGeomProps(
+    XkbGeometryPtr     /* geom */,
+    int                        /* nProps */
+);
+
+extern Status
+XkbAllocGeomKeyAliases(
+    XkbGeometryPtr     /* geom */,
+    int                        /* nAliases */
+);
+
+extern Status
+XkbAllocGeomColors(
+    XkbGeometryPtr     /* geom */,
+    int                        /* nColors */
+);
+
+extern Status
+XkbAllocGeomShapes(
+    XkbGeometryPtr     /* geom */,
+    int                        /* nShapes */
+);
+
+extern Status
+XkbAllocGeomSections(
+    XkbGeometryPtr     /* geom */,
+    int                        /* nSections */
+);
+
+extern Status
+XkbAllocGeomOverlays(
+    XkbSectionPtr      /* section */,
+    int                        /* num_needed */
+);
+
+extern Status
+XkbAllocGeomOverlayRows(
+    XkbOverlayPtr      /* overlay */,
+    int                        /* num_needed */
+);
+
+extern Status
+XkbAllocGeomOverlayKeys(
+    XkbOverlayRowPtr   /* row */,
+    int                        /* num_needed */
+);
+
+extern Status
+XkbAllocGeomDoodads(
+    XkbGeometryPtr     /* geom */,
+    int                        /* nDoodads */
+);
+
+extern Status
+XkbAllocGeomSectionDoodads(
+    XkbSectionPtr      /* section */,
+    int                        /* nDoodads */
+);
+
+extern Status
+XkbAllocGeomOutlines(
+    XkbShapePtr                /* shape */,
+    int                        /* nOL */
+);
+
+extern Status
+XkbAllocGeomRows(
+    XkbSectionPtr      /* section */,
+    int                        /* nRows */
+);
+
+extern Status
+XkbAllocGeomPoints(
+    XkbOutlinePtr      /* ol */,
+    int                        /* nPts */
+);
+
+extern Status
+XkbAllocGeomKeys(
+    XkbRowPtr          /* row */,
+    int                        /* nKeys */
+);
+
+extern Status
+XkbAllocGeometry(
+       XkbDescPtr              /* xkb */,
+       XkbGeometrySizesPtr     /* sizes */
+);
+
+extern Status
+XkbSetGeometry(
+       Display *               /* dpy */,
+       unsigned                /* deviceSpec */,
+       XkbGeometryPtr          /* geom */
+);
+
+extern Bool
+XkbComputeShapeTop(
+       XkbShapePtr             /* shape */,
+       XkbBoundsPtr            /* bounds */
+);
+
+extern Bool
+XkbComputeShapeBounds(
+       XkbShapePtr             /* shape */
+);
+
+extern Bool
+XkbComputeRowBounds(
+       XkbGeometryPtr          /* geom */,
+       XkbSectionPtr           /* section */,
+       XkbRowPtr               /* row */
+);
+
+extern Bool
+XkbComputeSectionBounds(
+       XkbGeometryPtr          /* geom */,
+       XkbSectionPtr           /* section */
+);
+
+extern char *
+XkbFindOverlayForKey(
+       XkbGeometryPtr          /* geom */,
+       XkbSectionPtr           /* wanted */,
+       char *                  /* under */
+);
+
+extern Status
+XkbGetGeometry(
+    Display *                  /* dpy */,
+    XkbDescPtr                 /* xkb */
+);
+
+extern Status
+XkbGetNamedGeometry(
+    Display *                  /* dpy */,
+    XkbDescPtr                 /* xkb */,
+    Atom                       /* name */
+);
+
+_XFUNCPROTOEND
+
+#endif /* _XKBSTR_H_ */
diff --git a/XKBproto.h b/XKBproto.h
new file mode 100644 (file)
index 0000000..97dd4d2
--- /dev/null
@@ -0,0 +1,1282 @@
+/* $Xorg: XKBproto.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ */
+/************************************************************
+Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be 
+used in advertising or publicity pertaining to distribution 
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability 
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef _XKBPROTO_H_
+#define        _XKBPROTO_H_
+
+#include <X11/Xmd.h>
+#include <X11/extensions/XKB.h>
+
+#define Window CARD32
+#define Atom CARD32
+#define Time CARD32
+#define KeyCode CARD8
+#define KeySym CARD32
+
+#define        XkbPaddedSize(n)        ((((unsigned int)(n)+3) >> 2) << 2)
+
+typedef struct _xkbUseExtension {
+    CARD8      reqType;
+    CARD8      xkbReqType;     /* always X_KBUseExtension */
+    CARD16     length B16;
+    CARD16     wantedMajor B16;
+    CARD16     wantedMinor B16;
+} xkbUseExtensionReq;
+#define        sz_xkbUseExtensionReq   8
+
+typedef struct _xkbUseExtensionReply {
+    BYTE       type;           /* X_Reply */
+    BOOL       supported;
+    CARD16     sequenceNumber B16;
+    CARD32     length B32;
+    CARD16     serverMajor B16;
+    CARD16     serverMinor B16;
+    CARD32     pad1 B32;
+    CARD32     pad2 B32;
+    CARD32     pad3 B32;
+    CARD32     pad4 B32;
+    CARD32     pad5 B32;
+} xkbUseExtensionReply;
+#define        sz_xkbUseExtensionReply 32
+
+typedef        struct _xkbSelectEvents {
+    CARD8      reqType;
+    CARD8      xkbReqType;     /* X_KBSelectEvents */
+    CARD16     length B16;
+    CARD16     deviceSpec B16;
+    CARD16     affectWhich B16;
+    CARD16     clear B16;
+    CARD16     selectAll B16;
+    CARD16     affectMap B16;
+    CARD16     map B16;
+} xkbSelectEventsReq;
+#define        sz_xkbSelectEventsReq   16
+
+typedef struct _xkbBell {
+    CARD8      reqType;
+    CARD8      xkbReqType;     /* X_KBBell */
+    CARD16     length B16;
+    CARD16     deviceSpec B16;
+    CARD16     bellClass B16;
+    CARD16     bellID B16;
+    INT8       percent;
+    BOOL       forceSound;
+    BOOL       eventOnly;
+    CARD8      pad1;
+    INT16      pitch B16;
+    INT16      duration B16;
+    CARD16     pad2 B16;
+    Atom       name B32;
+    Window     window B32;
+} xkbBellReq;
+#define        sz_xkbBellReq           28
+
+typedef struct _xkbGetState {
+       CARD8           reqType;
+       CARD8           xkbReqType;     /* always X_KBGetState */
+       CARD16          length B16;
+       CARD16          deviceSpec B16;
+       CARD16          pad B16;
+} xkbGetStateReq;
+#define        sz_xkbGetStateReq       8
+
+typedef        struct _xkbGetStateReply {
+    BYTE       type;
+    BYTE       deviceID;
+    CARD16     sequenceNumber B16;
+    CARD32     length B32;
+    CARD8      mods;
+    CARD8      baseMods;
+    CARD8      latchedMods;
+    CARD8      lockedMods;
+    CARD8      group;
+    CARD8      lockedGroup;
+    INT16      baseGroup B16;
+    INT16      latchedGroup B16;
+    CARD8      compatState;
+    CARD8      grabMods;
+    CARD8      compatGrabMods;
+    CARD8      lookupMods;
+    CARD8      compatLookupMods;
+    CARD8      pad1;
+    CARD16     ptrBtnState B16;
+    CARD16     pad2 B16;
+    CARD32     pad3 B32;
+} xkbGetStateReply;
+#define        sz_xkbGetStateReply     32
+
+typedef struct _xkbLatchLockState {
+    CARD8      reqType;
+    CARD8      xkbReqType;     /* always X_KBLatchLockState */
+    CARD16     length B16;
+    CARD16     deviceSpec B16;
+    CARD8      affectModLocks;
+    CARD8      modLocks;
+    BOOL       lockGroup;
+    CARD8      groupLock;
+    CARD8      affectModLatches;
+    CARD8      modLatches;
+    CARD8      pad;
+    BOOL       latchGroup;
+    INT16      groupLatch B16;
+} xkbLatchLockStateReq;
+#define        sz_xkbLatchLockStateReq         16
+
+typedef struct _xkbGetControls {
+    CARD8      reqType;
+    CARD8      xkbReqType;     /* always X_KBGetControls */
+    CARD16     length B16;
+    CARD16     deviceSpec B16;
+    CARD16     pad B16;
+} xkbGetControlsReq;
+#define        sz_xkbGetControlsReq    8
+
+typedef struct _xkbGetControlsReply {
+    BYTE       type;           /* X_Reply */
+    CARD8      deviceID;
+    CARD16     sequenceNumber B16;
+    CARD32     length B32;
+    CARD8      mkDfltBtn;
+    CARD8      numGroups;
+    CARD8      groupsWrap;
+    CARD8      internalMods;
+    CARD8      ignoreLockMods;
+    CARD8      internalRealMods;
+    CARD8      ignoreLockRealMods;
+    CARD8      pad1;
+    CARD16     internalVMods B16;
+    CARD16     ignoreLockVMods B16;
+    CARD16     repeatDelay B16;
+    CARD16     repeatInterval B16;
+    CARD16     slowKeysDelay B16;
+    CARD16     debounceDelay B16;
+    CARD16     mkDelay B16;
+    CARD16     mkInterval B16;
+    CARD16     mkTimeToMax B16;
+    CARD16     mkMaxSpeed B16;
+    INT16      mkCurve B16;
+    CARD16     axOptions B16;
+    CARD16     axTimeout B16;
+    CARD16     axtOptsMask B16;
+    CARD16     axtOptsValues B16;
+    CARD16     pad2 B16;
+    CARD32     axtCtrlsMask B32;
+    CARD32     axtCtrlsValues B32;
+    CARD32     enabledCtrls B32;
+    BYTE       perKeyRepeat[XkbPerKeyBitArraySize];
+} xkbGetControlsReply;
+#define        sz_xkbGetControlsReply  92
+
+typedef struct _xkbSetControls {
+    CARD8      reqType;
+    CARD8      xkbReqType;     /* always X_KBSetControls */
+    CARD16     length B16;
+    CARD16     deviceSpec B16;
+    CARD8      affectInternalMods;
+    CARD8      internalMods;
+    CARD8      affectIgnoreLockMods;
+    CARD8      ignoreLockMods;
+    CARD16     affectInternalVMods B16;
+    CARD16     internalVMods B16;
+    CARD16     affectIgnoreLockVMods B16;
+    CARD16     ignoreLockVMods B16;
+    CARD8      mkDfltBtn;
+    CARD8      groupsWrap;
+    CARD16     axOptions B16;
+    CARD16     pad1 B16;
+    CARD32     affectEnabledCtrls B32;
+    CARD32     enabledCtrls B32;
+    CARD32     changeCtrls B32;
+    CARD16     repeatDelay B16;
+    CARD16     repeatInterval B16;
+    CARD16     slowKeysDelay B16;
+    CARD16     debounceDelay B16;
+    CARD16     mkDelay B16;
+    CARD16     mkInterval B16;
+    CARD16     mkTimeToMax B16;
+    CARD16     mkMaxSpeed B16;
+    INT16      mkCurve B16;
+    CARD16     axTimeout B16;
+    CARD32     axtCtrlsMask B32;
+    CARD32     axtCtrlsValues B32;
+    CARD16     axtOptsMask B16;
+    CARD16     axtOptsValues B16;
+    BYTE       perKeyRepeat[XkbPerKeyBitArraySize];
+} xkbSetControlsReq;
+#define        sz_xkbSetControlsReq    100
+
+typedef        struct _xkbKTMapEntryWireDesc {
+    BOOL       active;
+    CARD8      mask;
+    CARD8      level;
+    CARD8      realMods;
+    CARD16     virtualMods B16;
+    CARD16     pad B16;
+} xkbKTMapEntryWireDesc;
+#define sz_xkbKTMapEntryWireDesc       8
+
+typedef struct _xkbKTSetMapEntryWireDesc {
+    CARD8      level;
+    CARD8      realMods;
+    CARD16     virtualMods B16;
+} xkbKTSetMapEntryWireDesc;
+#define        sz_xkbKTSetMapEntryWireDesc     4
+
+typedef struct _xkbModsWireDesc {
+    CARD8      mask;           /* GetMap only */
+    CARD8      realMods;
+    CARD16     virtualMods B16;
+} xkbModsWireDesc;
+#define        sz_xkbModsWireDesc      4
+
+typedef struct _xkbKeyTypeWireDesc {
+    CARD8      mask;
+    CARD8      realMods;
+    CARD16     virtualMods B16;
+    CARD8      numLevels;
+    CARD8      nMapEntries;
+    BOOL       preserve;
+    CARD8      pad;
+} xkbKeyTypeWireDesc;
+#define        sz_xkbKeyTypeWireDesc   8
+
+typedef struct _xkbSymMapWireDesc {
+    CARD8      ktIndex[XkbNumKbdGroups];
+    CARD8      groupInfo;
+    CARD8      width;
+    CARD16     nSyms B16;
+} xkbSymMapWireDesc;
+#define        sz_xkbSymMapWireDesc    8
+
+typedef struct _xkbVModMapWireDesc {
+    KeyCode    key;
+    CARD8      pad;
+    CARD16     vmods B16;
+} xkbVModMapWireDesc;
+#define        sz_xkbVModMapWireDesc   4
+
+typedef struct _xkbBehaviorWireDesc {
+       CARD8   key;
+       CARD8   type;
+       CARD8   data;
+       CARD8   pad;
+} xkbBehaviorWireDesc;
+#define        sz_xkbBehaviorWireDesc  4
+
+typedef        struct _xkbActionWireDesc {
+    CARD8      type;
+    CARD8      data[7];
+} xkbActionWireDesc;
+#define        sz_xkbActionWireDesc    8
+
+typedef struct _xkbGetMap {
+    CARD8      reqType;
+    CARD8      xkbReqType;     /* always X_KBGetMap */
+    CARD16     length B16;
+    CARD16     deviceSpec B16;
+    CARD16     full B16;
+    CARD16     partial B16;
+    CARD8      firstType;
+    CARD8      nTypes;
+    KeyCode    firstKeySym;
+    CARD8      nKeySyms;
+    KeyCode    firstKeyAct;
+    CARD8      nKeyActs;
+    KeyCode    firstKeyBehavior;
+    CARD8      nKeyBehaviors;
+    CARD16     virtualMods B16;
+    KeyCode    firstKeyExplicit;
+    CARD8      nKeyExplicit;
+    KeyCode    firstModMapKey;
+    CARD8      nModMapKeys;
+    KeyCode    firstVModMapKey;
+    CARD8      nVModMapKeys;
+    CARD16     pad1 B16;
+} xkbGetMapReq;
+#define        sz_xkbGetMapReq 28
+
+typedef struct _xkbGetMapReply {
+    CARD8      type;           /* always X_Reply */
+    CARD8      deviceID;
+    CARD16     sequenceNumber B16;
+    CARD32     length B32;
+    CARD16     pad1 B16;
+    KeyCode    minKeyCode;
+    KeyCode    maxKeyCode;
+    CARD16     present B16;
+    CARD8      firstType;
+    CARD8      nTypes;
+    CARD8      totalTypes;
+    KeyCode    firstKeySym;
+    CARD16     totalSyms B16;
+    CARD8      nKeySyms;
+    KeyCode    firstKeyAct;
+    CARD16     totalActs B16;
+    CARD8      nKeyActs;
+    KeyCode    firstKeyBehavior;
+    CARD8      nKeyBehaviors;
+    CARD8      totalKeyBehaviors;
+    KeyCode    firstKeyExplicit;
+    CARD8      nKeyExplicit;
+    CARD8      totalKeyExplicit;
+    KeyCode    firstModMapKey;
+    CARD8      nModMapKeys;
+    CARD8      totalModMapKeys;
+    KeyCode    firstVModMapKey;
+    CARD8      nVModMapKeys;
+    CARD8      totalVModMapKeys;
+    CARD8      pad2;
+    CARD16     virtualMods B16;
+} xkbGetMapReply;
+#define        sz_xkbGetMapReply               40
+
+#define        XkbSetMapResizeTypes            (1L<<0)
+#define        XkbSetMapRecomputeActions       (1L<<1)
+#define        XkbSetMapAllFlags               (0x3)
+
+typedef struct _xkbSetMap {
+    CARD8      reqType;
+    CARD8      xkbReqType;     /* always X_KBSetMap */
+    CARD16     length B16;
+    CARD16     deviceSpec B16;
+    CARD16     present B16;
+    CARD16     flags B16;
+    KeyCode    minKeyCode;
+    KeyCode    maxKeyCode;
+    CARD8      firstType;
+    CARD8      nTypes;
+    KeyCode    firstKeySym;
+    CARD8      nKeySyms;
+    CARD16     totalSyms B16;
+    KeyCode    firstKeyAct;
+    CARD8      nKeyActs;
+    CARD16     totalActs B16;
+    KeyCode    firstKeyBehavior;
+    CARD8      nKeyBehaviors;
+    CARD8      totalKeyBehaviors;
+    KeyCode    firstKeyExplicit;
+    CARD8      nKeyExplicit;
+    CARD8      totalKeyExplicit;
+    KeyCode    firstModMapKey;
+    CARD8      nModMapKeys;
+    CARD8      totalModMapKeys;
+    KeyCode    firstVModMapKey;
+    CARD8      nVModMapKeys;
+    CARD8      totalVModMapKeys;
+    CARD16     virtualMods B16;
+} xkbSetMapReq;
+#define        sz_xkbSetMapReq 36
+
+typedef struct _xkbSymInterpretWireDesc {
+    CARD32             sym B32;
+    CARD8              mods;
+    CARD8              match;
+    CARD8              virtualMod;
+    CARD8              flags;
+    xkbActionWireDesc  act;
+} xkbSymInterpretWireDesc;
+#define        sz_xkbSymInterpretWireDesc      16
+
+typedef struct _xkbGetCompatMap {
+    CARD8      reqType;
+    CARD8      xkbReqType;     /* always X_KBGetCompatMap */
+    CARD16     length B16;
+    CARD16     deviceSpec B16;
+    CARD8      groups;
+    BOOL       getAllSI;
+    CARD16     firstSI B16;
+    CARD16     nSI B16;
+} xkbGetCompatMapReq;
+#define        sz_xkbGetCompatMapReq   12
+
+typedef struct _xkbGetCompatMapReply {
+    CARD8      type;           /* always X_Reply */
+    CARD8      deviceID;
+    CARD16     sequenceNumber B16;
+    CARD32     length B32;
+    CARD8      groups;
+    CARD8      pad1;
+    CARD16     firstSI B16;
+    CARD16     nSI B16;
+    CARD16     nTotalSI B16;
+    CARD32     pad2 B32;
+    CARD32     pad3 B32;
+    CARD32     pad4 B32;
+    CARD32     pad5 B32;
+} xkbGetCompatMapReply;
+#define        sz_xkbGetCompatMapReply         32
+
+typedef struct _xkbSetCompatMap {
+    CARD8      reqType;
+    CARD8      xkbReqType;     /* always X_KBSetCompatMap */
+    CARD16     length B16;
+    CARD16     deviceSpec B16;
+    CARD8      pad1;
+    BOOL       recomputeActions;
+    BOOL       truncateSI;
+    CARD8      groups;
+    CARD16     firstSI B16;
+    CARD16     nSI B16;
+    CARD16     pad2 B16;
+} xkbSetCompatMapReq;
+#define        sz_xkbSetCompatMapReq   16
+
+typedef struct _xkbGetIndicatorState {
+    CARD8      reqType;
+    CARD8      xkbReqType;     /* always X_KBGetIndicatorState */
+    CARD16     length B16;
+    CARD16     deviceSpec B16;
+    CARD16     pad1 B16;
+} xkbGetIndicatorStateReq;
+#define        sz_xkbGetIndicatorStateReq      8
+
+typedef struct _xkbGetIndicatorStateReply {
+    CARD8      type;           /* always X_Reply */
+    CARD8      deviceID;
+    CARD16     sequenceNumber B16;
+    CARD32     length B32;
+    CARD32     state B32;
+    CARD32     pad1 B32;
+    CARD32     pad2 B32;
+    CARD32     pad3 B32;
+    CARD32     pad4 B32;
+    CARD32     pad5 B32;
+} xkbGetIndicatorStateReply;
+#define        sz_xkbGetIndicatorStateReply    32
+
+typedef struct _xkbGetIndicatorMap {
+    CARD8      reqType;
+    CARD8      xkbReqType;     /* always X_KBGetIndicatorMap */
+    CARD16     length B16;
+    CARD16     deviceSpec B16;
+    CARD16     pad B16;
+    CARD32     which B32;
+} xkbGetIndicatorMapReq;
+#define        sz_xkbGetIndicatorMapReq        12
+
+typedef struct _xkbGetIndicatorMapReply {
+    CARD8      type;           /* always X_Reply */
+    CARD8      deviceID;
+    CARD16     sequenceNumber B16;
+    CARD32     length B32;
+    CARD32     which B32;
+    CARD32     realIndicators B32;
+    CARD8      nIndicators;
+    CARD8      pad1;
+    CARD16     pad2 B16;
+    CARD32     pad3 B32;
+    CARD32     pad4 B32;
+    CARD32     pad5 B32;
+} xkbGetIndicatorMapReply;
+#define        sz_xkbGetIndicatorMapReply      32
+
+typedef struct _xkbIndicatorMapWireDesc {
+    CARD8      flags;
+    CARD8      whichGroups;
+    CARD8      groups;
+    CARD8      whichMods;
+    CARD8      mods;
+    CARD8      realMods;
+    CARD16     virtualMods B16;
+    CARD32     ctrls B32;
+} xkbIndicatorMapWireDesc;
+#define        sz_xkbIndicatorMapWireDesc      12
+
+typedef struct _xkbSetIndicatorMap {
+    CARD8      reqType;
+    CARD8      xkbReqType;     /* always X_KBSetIndicatorMap */
+    CARD16     length B16;
+    CARD16     deviceSpec B16;
+    CARD16     pad1 B16;
+    CARD32     which B32;
+} xkbSetIndicatorMapReq;
+#define        sz_xkbSetIndicatorMapReq        12
+
+typedef struct _xkbGetNamedIndicator {
+    CARD8      reqType;
+    CARD8      xkbReqType;     /* X_KBGetNamedIndicator */
+    CARD16     length B16;
+    CARD16     deviceSpec B16;
+    CARD16     ledClass B16;
+    CARD16     ledID B16;
+    CARD16     pad1 B16;
+    Atom       indicator B32;
+} xkbGetNamedIndicatorReq;
+#define        sz_xkbGetNamedIndicatorReq              16
+
+typedef        struct _xkbGetNamedIndicatorReply {
+    BYTE       type;
+    BYTE       deviceID;
+    CARD16     sequenceNumber B16;
+    CARD32     length B32;
+    Atom       indicator B32;
+    BOOL       found;
+    BOOL       on;
+    BOOL       realIndicator;
+    CARD8      ndx;
+    CARD8      flags;
+    CARD8      whichGroups;
+    CARD8      groups;
+    CARD8      whichMods;
+    CARD8      mods;
+    CARD8      realMods;
+    CARD16     virtualMods B16;
+    CARD32     ctrls B32;
+    BOOL       supported;
+    CARD8      pad1;
+    CARD16     pad2 B16;
+} xkbGetNamedIndicatorReply;
+#define        sz_xkbGetNamedIndicatorReply    32
+
+typedef struct _xkbSetNamedIndicator {
+    CARD8      reqType;
+    CARD8      xkbReqType;     /* X_KBSetNamedIndicator */
+    CARD16     length B16;
+    CARD16     deviceSpec B16;
+    CARD16     ledClass B16;
+    CARD16     ledID B16;
+    CARD16     pad1 B16;
+    Atom       indicator B32;
+    BOOL       setState;
+    BOOL       on;
+    BOOL       setMap;
+    BOOL       createMap;
+    CARD8      pad2;
+    CARD8      flags;
+    CARD8      whichGroups;
+    CARD8      groups;
+    CARD8      whichMods;
+    CARD8      realMods;
+    CARD16     virtualMods B16;
+    CARD32     ctrls B32;
+} xkbSetNamedIndicatorReq;
+#define        sz_xkbSetNamedIndicatorReq      32
+
+typedef struct _xkbGetNames {
+    CARD8      reqType;
+    CARD8      xkbReqType;     /* always X_KBGetNames */
+    CARD16     length B16;
+    CARD16     deviceSpec B16;
+    CARD16     pad B16;
+    CARD32     which B32;
+} xkbGetNamesReq;
+#define        sz_xkbGetNamesReq               12
+
+typedef        struct _xkbGetNamesReply {
+    BYTE       type;
+    BYTE       deviceID;
+    CARD16     sequenceNumber B16;
+    CARD32     length B32;
+    CARD32     which B32;
+    KeyCode    minKeyCode;
+    KeyCode    maxKeyCode;
+    CARD8      nTypes;
+    CARD8      groupNames;
+    CARD16     virtualMods B16;
+    KeyCode    firstKey;
+    CARD8      nKeys;
+    CARD32     indicators B32;
+    CARD8      nRadioGroups;
+    CARD8      nKeyAliases;
+    CARD16     nKTLevels B16;
+    CARD32     pad3 B32;
+} xkbGetNamesReply;
+#define        sz_xkbGetNamesReply     32
+
+typedef struct _xkbSetNames {
+    CARD8      reqType;
+    CARD8      xkbReqType;     /* always X_KBSetNames */
+    CARD16     length B16;
+    CARD16     deviceSpec B16;
+    CARD16     virtualMods B16;
+    CARD32     which B32;
+    CARD8      firstType;
+    CARD8      nTypes;
+    CARD8      firstKTLevel;
+    CARD8      nKTLevels;
+    CARD32     indicators B32;
+    CARD8      groupNames;
+    CARD8      nRadioGroups;
+    KeyCode    firstKey;
+    CARD8      nKeys;
+    CARD8      nKeyAliases;
+    CARD8      pad1;
+    CARD16     totalKTLevelNames B16;
+} xkbSetNamesReq;
+#define        sz_xkbSetNamesReq       28
+
+typedef struct _xkbPointWireDesc {
+    INT16      x B16;
+    INT16      y B16;
+} xkbPointWireDesc;
+#define        sz_xkbPointWireDesc     4
+
+typedef struct _xkbOutlineWireDesc {
+    CARD8      nPoints;
+    CARD8      cornerRadius;
+    CARD16     pad B16;
+} xkbOutlineWireDesc;
+#define        sz_xkbOutlineWireDesc   4
+
+typedef struct _xkbShapeWireDesc {
+    Atom       name B32;
+    CARD8      nOutlines;
+    CARD8      primaryNdx;
+    CARD8      approxNdx;
+    CARD8      pad;
+} xkbShapeWireDesc;
+#define        sz_xkbShapeWireDesc     8
+
+typedef struct _xkbSectionWireDesc {
+    Atom       name B32;
+    INT16      top B16;
+    INT16      left B16;
+    CARD16     width B16;
+    CARD16     height B16;
+    INT16      angle B16;
+    CARD8      priority;
+    CARD8      nRows;
+    CARD8      nDoodads;
+    CARD8      nOverlays;
+    CARD16     pad B16;
+} xkbSectionWireDesc;
+#define        sz_xkbSectionWireDesc   20
+
+typedef struct _xkbRowWireDesc {
+    INT16      top B16;
+    INT16      left B16;
+    CARD8      nKeys;
+    BOOL       vertical;
+    CARD16     pad B16;
+} xkbRowWireDesc;
+#define        sz_xkbRowWireDesc       8
+
+typedef struct _xkbKeyWireDesc {
+    CARD8      name[XkbKeyNameLength];
+    INT16      gap B16;
+    CARD8      shapeNdx;
+    CARD8      colorNdx;
+} xkbKeyWireDesc;
+#define        sz_xkbKeyWireDesc       8
+
+typedef struct _xkbOverlayWireDesc {
+    Atom       name B32;
+    CARD8      nRows;
+    CARD8      pad1;
+    CARD16     pad2 B16;
+} xkbOverlayWireDesc;
+#define        sz_xkbOverlayWireDesc   8
+
+typedef struct _xkbOverlayRowWireDesc {
+   CARD8       rowUnder;
+   CARD8       nKeys;
+   CARD16      pad1 B16;
+} xkbOverlayRowWireDesc;
+#define        sz_xkbOverlayRowWireDesc        4
+
+typedef struct _xkbOverlayKeyWireDesc {
+   CARD8       over[XkbKeyNameLength];
+   CARD8       under[XkbKeyNameLength];
+} xkbOverlayKeyWireDesc;
+#define        sz_xkbOverlayKeyWireDesc        8
+
+typedef struct _xkbShapeDoodadWireDesc {
+    Atom       name B32;
+    CARD8      type;
+    CARD8      priority;
+    INT16      top B16;
+    INT16      left B16;
+    INT16      angle B16;
+    CARD8      colorNdx;
+    CARD8      shapeNdx;
+    CARD16     pad1 B16;
+    CARD32     pad2 B32;
+} xkbShapeDoodadWireDesc;
+#define        sz_xkbShapeDoodadWireDesc       20
+
+typedef struct _xkbTextDoodadWireDesc {
+    Atom       name B32;
+    CARD8      type;
+    CARD8      priority;
+    INT16      top B16;
+    INT16      left B16;
+    INT16      angle B16;
+    CARD16     width B16;
+    CARD16     height B16;
+    CARD8      colorNdx;
+    CARD8      pad1;
+    CARD16     pad2 B16;
+} xkbTextDoodadWireDesc;
+#define        sz_xkbTextDoodadWireDesc        20
+
+typedef struct _xkbIndicatorDoodadWireDesc {
+    Atom       name B32;
+    CARD8      type;
+    CARD8      priority;
+    INT16      top B16;
+    INT16      left B16;
+    INT16      angle B16;
+    CARD8      shapeNdx;
+    CARD8      onColorNdx;
+    CARD8      offColorNdx;
+    CARD8      pad1;
+    CARD32     pad2 B32;
+} xkbIndicatorDoodadWireDesc;
+#define        sz_xkbIndicatorDoodadWireDesc   20
+
+typedef struct _xkbLogoDoodadWireDesc {
+    Atom       name B32;
+    CARD8      type;
+    CARD8      priority;
+    INT16      top B16;
+    INT16      left B16;
+    INT16      angle B16;
+    CARD8      colorNdx;
+    CARD8      shapeNdx;
+    CARD16     pad1 B16;
+    CARD32     pad2 B32;
+} xkbLogoDoodadWireDesc;
+#define        sz_xkbLogoDoodadWireDesc        20
+
+typedef struct _xkbAnyDoodadWireDesc {
+    Atom       name B32;
+    CARD8      type;
+    CARD8      priority;
+    INT16      top B16;
+    INT16      left B16;
+    INT16      angle B16;
+    CARD32     pad2 B32;
+    CARD32     pad3 B32;
+} xkbAnyDoodadWireDesc;
+#define        sz_xkbAnyDoodadWireDesc 20
+
+typedef union _xkbDoodadWireDesc {
+    xkbAnyDoodadWireDesc       any;
+    xkbShapeDoodadWireDesc     shape;
+    xkbTextDoodadWireDesc      text;
+    xkbIndicatorDoodadWireDesc indicator;
+    xkbLogoDoodadWireDesc      logo;
+} xkbDoodadWireDesc;
+#define        sz_xkbDoodadWireDesc    20
+
+typedef struct _xkbGetGeometry {
+    CARD8      reqType;
+    CARD8      xkbReqType;     /* always X_KBGetGeometry */
+    CARD16     length B16;
+    CARD16     deviceSpec B16;
+    CARD16     pad B16;
+    Atom       name B32;
+} xkbGetGeometryReq;
+#define        sz_xkbGetGeometryReq    12
+
+typedef struct _xkbGetGeometryReply {
+    CARD8      type;           /* always X_Reply */
+    CARD8      deviceID;
+    CARD16     sequenceNumber B16;
+    CARD32     length B32;
+    Atom       name B32;
+    BOOL       found;
+    CARD8      pad;
+    CARD16     widthMM B16;
+    CARD16     heightMM B16;
+    CARD16     nProperties B16;
+    CARD16     nColors B16;
+    CARD16     nShapes B16;
+    CARD16     nSections B16;
+    CARD16     nDoodads B16;
+    CARD16     nKeyAliases B16;
+    CARD8      baseColorNdx;
+    CARD8      labelColorNdx;
+} xkbGetGeometryReply;
+#define        sz_xkbGetGeometryReply  32
+
+typedef struct _xkbSetGeometry {
+    CARD8      reqType;
+    CARD8      xkbReqType;     /* always X_KBSetGeometry */
+    CARD16     length B16;
+    CARD16     deviceSpec B16;
+    CARD8      nShapes;
+    CARD8      nSections;
+    Atom       name B32;
+    CARD16     widthMM B16;
+    CARD16     heightMM B16;
+    CARD16     nProperties B16;
+    CARD16     nColors B16;
+    CARD16     nDoodads B16;
+    CARD16     nKeyAliases B16;
+    CARD8      baseColorNdx;
+    CARD8      labelColorNdx;
+    CARD16     pad B16;
+} xkbSetGeometryReq;
+#define        sz_xkbSetGeometryReq    28
+
+typedef struct _xkbPerClientFlags {
+    CARD8      reqType;
+    CARD8      xkbReqType;/* always X_KBPerClientFlags */
+    CARD16     length B16;
+    CARD16     deviceSpec B16;
+    CARD16     pad1 B16;
+    CARD32     change B32;
+    CARD32     value B32;
+    CARD32     ctrlsToChange B32;
+    CARD32     autoCtrls B32;
+    CARD32     autoCtrlValues B32;
+} xkbPerClientFlagsReq;
+#define        sz_xkbPerClientFlagsReq 28
+
+typedef struct _xkbPerClientFlagsReply {
+    CARD8      type;           /* always X_Reply */
+    CARD8      deviceID;
+    CARD16     sequenceNumber B16;
+    CARD32     length B32;
+    CARD32     supported B32;
+    CARD32     value B32;
+    CARD32     autoCtrls B32;
+    CARD32     autoCtrlValues B32;
+    CARD32     pad1 B32;
+    CARD32     pad2 B32;
+} xkbPerClientFlagsReply;
+#define        sz_xkbPerClientFlagsReply       32
+
+typedef struct _xkbListComponents {
+    CARD8      reqType;
+    CARD8      xkbReqType;     /* always X_KBListComponents */
+    CARD16     length B16;
+    CARD16     deviceSpec B16;
+    CARD16     maxNames B16;
+} xkbListComponentsReq;
+#define        sz_xkbListComponentsReq 8
+
+typedef struct _xkbListComponentsReply {
+    CARD8      type;           /* always X_Reply */
+    CARD8      deviceID;
+    CARD16     sequenceNumber B16;
+    CARD32     length B32;
+    CARD16     nKeymaps B16;
+    CARD16     nKeycodes B16;
+    CARD16     nTypes B16;
+    CARD16     nCompatMaps B16;
+    CARD16     nSymbols B16;
+    CARD16     nGeometries B16;
+    CARD16     extra B16;
+    CARD16     pad1 B16;
+    CARD32     pad2 B32;
+    CARD32     pad3 B32;
+} xkbListComponentsReply;
+#define        sz_xkbListComponentsReply       32
+
+typedef struct _xkbGetKbdByName {
+    CARD8      reqType;
+    CARD8      xkbReqType;     /* always X_KBGetKbdByName */
+    CARD16     length B16;
+    CARD16     deviceSpec B16;
+    CARD16     need B16;       /* combination of XkbGBN_* */
+    CARD16     want B16;       /* combination of XkbGBN_* */
+    BOOL       load;
+    CARD8      pad;
+} xkbGetKbdByNameReq;
+#define        sz_xkbGetKbdByNameReq   12
+
+typedef struct _xkbGetKbdByNameReply {
+    CARD8      type;           /* always X_Reply */
+    CARD8      deviceID;
+    CARD16     sequenceNumber B16;
+    CARD32     length B32;
+    KeyCode    minKeyCode;
+    KeyCode    maxKeyCode;
+    BOOL       loaded;
+    BOOL       newKeyboard;
+    CARD16     found B16;      /* combination of XkbGBN_* */
+    CARD16     reported B16;   /* combination of XkbAllComponents */
+    CARD32     pad1 B32;
+    CARD32     pad2 B32;
+    CARD32     pad3 B32;
+    CARD32     pad4 B32;
+} xkbGetKbdByNameReply;
+#define        sz_xkbGetKbdByNameReply 32
+
+typedef        struct _xkbDeviceLedsWireDesc {
+    CARD16     ledClass B16;
+    CARD16     ledID B16;
+    CARD32     namesPresent B32;
+    CARD32     mapsPresent B32;
+    CARD32     physIndicators B32;
+    CARD32     state B32;
+} xkbDeviceLedsWireDesc;
+#define sz_xkbDeviceLedsWireDesc       20
+
+typedef struct _xkbGetDeviceInfo {
+    CARD8      reqType;
+    CARD8      xkbReqType;     /* always X_KBGetDeviceInfo */
+    CARD16     length B16;
+    CARD16     deviceSpec B16;
+    CARD16     wanted B16;
+    BOOL       allBtns;
+    CARD8      firstBtn;
+    CARD8      nBtns;
+    CARD8      pad;
+    CARD16     ledClass B16;
+    CARD16     ledID B16;
+} xkbGetDeviceInfoReq;
+#define        sz_xkbGetDeviceInfoReq  16
+
+typedef struct _xkbGetDeviceInfoReply {
+    CARD8      type;           /* always X_Reply */
+    CARD8      deviceID;
+    CARD16     sequenceNumber B16;
+    CARD32     length B32;
+    CARD16     present B16;
+    CARD16     supported B16;
+    CARD16     unsupported B16;
+    CARD16     nDeviceLedFBs B16;
+    CARD8      firstBtnWanted;
+    CARD8      nBtnsWanted;
+    CARD8      firstBtnRtrn;
+    CARD8      nBtnsRtrn;
+    CARD8      totalBtns;
+    BOOL       hasOwnState;
+    CARD16     dfltKbdFB B16;
+    CARD16     dfltLedFB B16;
+    CARD16     pad B16;
+    Atom       devType B32;
+} xkbGetDeviceInfoReply;
+#define        sz_xkbGetDeviceInfoReply        32
+
+typedef struct _xkbSetDeviceInfo {
+    CARD8      reqType;
+    CARD8      xkbReqType;     /* always X_KBSetDeviceInfo */
+    CARD16     length B16;
+    CARD16     deviceSpec B16;
+    CARD8      firstBtn;
+    CARD8      nBtns;
+    CARD16     change B16;
+    CARD16     nDeviceLedFBs B16;
+} xkbSetDeviceInfoReq;
+#define        sz_xkbSetDeviceInfoReq  12
+
+typedef struct _xkbSetDebuggingFlags {
+    CARD8      reqType;
+    CARD8      xkbReqType;     /* always X_KBSetDebuggingFlags */
+    CARD16     length B16;
+    CARD16     msgLength B16;
+    CARD16     pad B16;
+    CARD32     affectFlags B32;
+    CARD32     flags B32;
+    CARD32     affectCtrls B32;
+    CARD32     ctrls B32;
+} xkbSetDebuggingFlagsReq;
+#define        sz_xkbSetDebuggingFlagsReq      24
+
+typedef struct _xkbSetDebuggingFlagsReply {
+    BYTE       type;           /* X_Reply */
+    CARD8      pad0;
+    CARD16     sequenceNumber B16;
+    CARD32     length B32;
+    CARD32     currentFlags B32;
+    CARD32     currentCtrls B32;
+    CARD32     supportedFlags B32;
+    CARD32     supportedCtrls B32;
+    CARD32     pad1 B32;
+    CARD32     pad2 B32;
+} xkbSetDebuggingFlagsReply;
+#define        sz_xkbSetDebuggingFlagsReply    32
+
+       /*
+        * X KEYBOARD EXTENSION EVENT STRUCTURES
+        */
+
+typedef struct _xkbAnyEvent {
+    BYTE       type;
+    BYTE       xkbType;
+    CARD16     sequenceNumber B16;
+    Time       time B32;
+    CARD8      deviceID;
+    CARD8      pad1;
+    CARD16     pad2 B16;
+    CARD32     pad3 B32;
+    CARD32     pad4 B32;
+    CARD32     pad5 B32;
+    CARD32     pad6 B32;
+    CARD32     pad7 B32;
+} xkbAnyEvent;
+#define        sz_xkbAnyEvent 32
+
+typedef        struct _xkbNewKeyboardNotify {
+    BYTE       type;
+    BYTE       xkbType;
+    CARD16     sequenceNumber B16;
+    Time       time B32;
+    CARD8      deviceID;
+    CARD8      oldDeviceID;
+    KeyCode    minKeyCode;
+    KeyCode    maxKeyCode;
+    KeyCode    oldMinKeyCode;
+    KeyCode    oldMaxKeyCode;
+    CARD8      requestMajor;
+    CARD8      requestMinor;
+    CARD16     changed B16;
+    CARD8      detail;
+    CARD8      pad1;
+    CARD32     pad2 B32;
+    CARD32     pad3 B32;
+    CARD32     pad4 B32;
+} xkbNewKeyboardNotify;
+#define        sz_xkbNewKeyboardNotify 32
+
+typedef        struct _xkbMapNotify {
+    BYTE       type;
+    BYTE       xkbType;
+    CARD16     sequenceNumber B16;
+    Time       time B32;
+    CARD8      deviceID;
+    CARD8      ptrBtnActions;
+    CARD16     changed B16;
+    KeyCode    minKeyCode;
+    KeyCode    maxKeyCode;
+    CARD8      firstType;
+    CARD8      nTypes;
+    KeyCode    firstKeySym;
+    CARD8      nKeySyms;
+    KeyCode    firstKeyAct;
+    CARD8      nKeyActs;
+    KeyCode    firstKeyBehavior;
+    CARD8      nKeyBehaviors;
+    KeyCode    firstKeyExplicit;
+    CARD8      nKeyExplicit;
+    KeyCode    firstModMapKey;
+    CARD8      nModMapKeys;
+    KeyCode    firstVModMapKey;
+    CARD8      nVModMapKeys;
+    CARD16     virtualMods B16;
+    CARD16     pad1 B16;
+} xkbMapNotify;
+#define        sz_xkbMapNotify 32
+
+typedef        struct _xkbStateNotify {
+    BYTE       type;
+    BYTE       xkbType;
+    CARD16     sequenceNumber B16;
+    Time       time B32;
+    CARD8      deviceID;
+    CARD8      mods;
+    CARD8      baseMods;
+    CARD8      latchedMods;
+    CARD8      lockedMods;
+    CARD8      group;
+    INT16      baseGroup B16;
+    INT16      latchedGroup B16;
+    CARD8      lockedGroup;
+    CARD8      compatState;
+    CARD8      grabMods;
+    CARD8      compatGrabMods;
+    CARD8      lookupMods;
+    CARD8      compatLookupMods;
+    CARD16     ptrBtnState B16;
+    CARD16     changed B16;
+    KeyCode    keycode;
+    CARD8      eventType;
+    CARD8      requestMajor;
+    CARD8      requestMinor;
+} xkbStateNotify;
+#define        sz_xkbStateNotify       32
+
+typedef struct _xkbControlsNotify {
+    BYTE       type;
+    BYTE       xkbType;
+    CARD16     sequenceNumber B16;
+    Time       time B32;
+    CARD8      deviceID;
+    CARD8      numGroups;
+    CARD16     pad1 B16;
+    CARD32     changedControls B32;
+    CARD32     enabledControls B32;
+    CARD32     enabledControlChanges B32;
+    KeyCode    keycode;
+    CARD8      eventType;
+    CARD8      requestMajor;
+    CARD8      requestMinor;
+    CARD32     pad2 B32;
+} xkbControlsNotify;
+#define        sz_xkbControlsNotify    32
+
+typedef struct _xkbIndicatorNotify {
+    BYTE       type;
+    BYTE       xkbType;
+    CARD16     sequenceNumber B16;
+    Time       time B32;
+    CARD8      deviceID;
+    CARD8      pad1;
+    CARD16     pad2 B16;
+    CARD32     state B32;
+    CARD32     changed B32;
+    CARD32     pad3 B32;
+    CARD32     pad4 B32;
+    CARD32     pad5 B32;
+} xkbIndicatorNotify;
+#define        sz_xkbIndicatorNotify   32
+
+typedef struct _xkbNamesNotify {
+    BYTE       type;
+    BYTE       xkbType;
+    CARD16     sequenceNumber B16;
+    Time       time B32;
+    CARD8      deviceID;
+    CARD8      pad1;
+    CARD16     changed B16;
+    CARD8      firstType;
+    CARD8      nTypes;
+    CARD8      firstLevelName;
+    CARD8      nLevelNames;
+    CARD8      pad2;
+    CARD8      nRadioGroups;
+    CARD8      nAliases;
+    CARD8      changedGroupNames;
+    CARD16     changedVirtualMods B16;
+    CARD8      firstKey;
+    CARD8      nKeys;
+    CARD32     changedIndicators B32;
+    CARD32     pad3 B32;
+} xkbNamesNotify;
+#define        sz_xkbNamesNotify       32
+
+typedef struct _xkbCompatMapNotify {
+    BYTE       type;
+    BYTE       xkbType;
+    CARD16     sequenceNumber B16;
+    Time       time B32;
+    CARD8      deviceID;
+    CARD8      changedGroups;
+    CARD16     firstSI B16;
+    CARD16     nSI B16;
+    CARD16     nTotalSI B16;
+    CARD32     pad1 B32;
+    CARD32     pad2 B32;
+    CARD32     pad3 B32;
+    CARD32     pad4 B32;
+} xkbCompatMapNotify;
+#define sz_xkbCompatMapNotify  32
+
+typedef struct _xkbBellNotify {
+    BYTE       type;
+    BYTE       xkbType;
+    CARD16     sequenceNumber B16;
+    Time       time B32;
+    CARD8      deviceID;
+    CARD8      bellClass;
+    CARD8      bellID;
+    CARD8      percent;
+    CARD16     pitch B16;
+    CARD16     duration B16;
+    Atom       name B32;
+    Window     window B32;
+    BOOL       eventOnly;
+    CARD8      pad1;
+    CARD16     pad2 B16;
+    CARD32     pad3 B32;
+} xkbBellNotify;
+#define        sz_xkbBellNotify        32
+
+typedef struct _xkbActionMessage {
+    BYTE       type;
+    BYTE       xkbType;
+    CARD16     sequenceNumber B16;
+    Time       time B32;
+    CARD8      deviceID;
+    KeyCode    keycode;
+    BOOL       press;
+    BOOL       keyEventFollows;
+    CARD8      mods;
+    CARD8      group;
+    CARD8      message[8];
+    CARD16     pad1 B16;
+    CARD32     pad2 B32;
+    CARD32     pad3 B32;
+} xkbActionMessage;
+#define        sz_xkbActionMessage             32
+
+typedef struct _xkbAccessXNotify {
+    BYTE       type;
+    BYTE       xkbType;
+    CARD16     sequenceNumber B16;
+    Time       time B32;
+    CARD8      deviceID;
+    KeyCode    keycode;
+    CARD16     detail B16;
+    CARD16     slowKeysDelay B16;
+    CARD16     debounceDelay B16;
+    CARD32     pad1 B32;
+    CARD32     pad2 B32;
+    CARD32     pad3 B32;
+    CARD32     pad4 B32;
+} xkbAccessXNotify;
+#define        sz_xkbAccessXNotify     32
+
+typedef struct _xkbExtensionDeviceNotify {
+    BYTE       type;
+    BYTE       xkbType;
+    CARD16     sequenceNumber B16;
+    Time       time B32;
+    CARD8      deviceID;
+    CARD8      pad1;
+    CARD16     reason B16;
+    CARD16     ledClass B16;
+    CARD16     ledID B16;
+    CARD32     ledsDefined B32;
+    CARD32     ledState B32;
+    CARD8      firstBtn;
+    CARD8      nBtns;
+    CARD16     supported B16;
+    CARD16     unsupported B16;
+    CARD16     pad3 B16;
+} xkbExtensionDeviceNotify;
+#define        sz_xkbExtensionDeviceNotify             32
+
+typedef struct _xkbEvent {
+    union {
+       xkbAnyEvent             any;
+       xkbNewKeyboardNotify    new_kbd;
+       xkbMapNotify            map;
+       xkbStateNotify          state;
+       xkbControlsNotify       ctrls;
+       xkbIndicatorNotify      indicators;
+       xkbNamesNotify          names;
+       xkbCompatMapNotify      compat;
+       xkbBellNotify           bell;
+       xkbActionMessage        message;
+       xkbAccessXNotify        accessx;
+       xkbExtensionDeviceNotify device;
+    } u;
+} xkbEvent;
+#define sz_xkbEvent    32
+
+#undef Window
+#undef Atom
+#undef Time
+#undef KeyCode
+#undef KeySym
+
+#endif /* _XKBPROTO_H_ */
diff --git a/XKBsrv.h b/XKBsrv.h
new file mode 100644 (file)
index 0000000..26a4ed8
--- /dev/null
+++ b/XKBsrv.h
@@ -0,0 +1,1187 @@
+/* $Xorg: XKBsrv.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ */
+/* $XdotOrg: $ */
+/************************************************************
+Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be 
+used in advertising or publicity pertaining to distribution 
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability 
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/include/extensions/XKBsrv.h,v 3.22 2002/11/20 04:49:01 dawes Exp $ */
+
+#ifndef _XKBSRV_H_
+#define        _XKBSRV_H_
+
+#ifdef XKB_IN_SERVER
+#define XkbAllocClientMap              SrvXkbAllocClientMap
+#define XkbAllocServerMap              SrvXkbAllocServerMap
+#define XkbChangeTypesOfKey            SrvXkbChangeTypesOfKey
+#define        XkbAddKeyType                   SrvXkbAddKeyType
+#define XkbCopyKeyType                 SrvXkbCopyKeyType
+#define XkbCopyKeyTypes                        SrvXkbCopyKeyTypes
+#define XkbFreeClientMap               SrvXkbFreeClientMap
+#define XkbFreeServerMap               SrvXkbFreeServerMap
+#define XkbInitCanonicalKeyTypes       SrvXkbInitCanonicalKeyTypes
+#define        XkbKeyTypesForCoreSymbols       SrvXkbKeyTypesForCoreSymbols
+#define        XkbApplyCompatMapToKey          SrvXkbApplyCompatMapToKey
+#define        XkbUpdateMapFromCore            SrvXkbUpdateMapFromCore
+#define XkbResizeKeyActions            SrvXkbResizeKeyActions
+#define XkbResizeKeySyms               SrvXkbResizeKeySyms
+#define XkbResizeKeyType               SrvXkbResizeKeyType
+#define XkbAllocCompatMap              SrvXkbAllocCompatMap
+#define XkbAllocControls               SrvXkbAllocControls
+#define XkbAllocIndicatorMaps          SrvXkbAllocIndicatorMaps
+#define XkbAllocKeyboard               SrvXkbAllocKeyboard
+#define XkbAllocNames                  SrvXkbAllocNames
+#define XkbFreeCompatMap               SrvXkbFreeCompatMap
+#define XkbFreeControls                        SrvXkbFreeControls
+#define XkbFreeIndicatorMaps           SrvXkbFreeIndicatorMaps
+#define XkbFreeKeyboard                        SrvXkbFreeKeyboard
+#define XkbFreeNames                   SrvXkbFreeNames
+#define        XkbAddDeviceLedInfo             SrvXkbAddDeviceLedInfo
+#define        XkbAllocDeviceInfo              SrvXkbAllocDeviceInfo
+#define        XkbFreeDeviceInfo               SrvXkbFreeDeviceInfo
+#define        XkbResizeDeviceButtonActions    SrvXkbResizeDeviceButtonActions
+#define XkbLatchModifiers              SrvXkbLatchModifiers
+#define XkbLatchGroup                  SrvXkbLatchGroup
+#define XkbVirtualModsToReal           SrvXkbVirtualModsToReal
+#define        XkbChangeKeycodeRange           SrvXkbChangeKeycodeRange
+#define        XkbApplyVirtualModChanges       SrvXkbApplyVirtualModChanges
+#define        XkbUpdateActionVirtualMods      SrvXkbUpdateActionVirtualMods
+#define XkbUpdateKeyTypeVirtualMods    SrvXkbUpdateKeyTypeVirtualMods
+#endif
+
+#include <X11/extensions/XKBstr.h>
+#include <X11/extensions/XKBproto.h>
+#include "inputstr.h"
+
+typedef struct _XkbInterest {
+       DeviceIntPtr            dev;
+       ClientPtr               client;
+       XID                     resource;
+       struct _XkbInterest *   next;
+       CARD16                  extDevNotifyMask;
+       CARD16                  stateNotifyMask;
+       CARD16                  namesNotifyMask;
+       CARD32                  ctrlsNotifyMask;
+       CARD8                   compatNotifyMask;
+       BOOL                    bellNotifyMask;
+       BOOL                    actionMessageMask;
+       CARD16                  accessXNotifyMask;
+       CARD32                  iStateNotifyMask;
+       CARD32                  iMapNotifyMask;
+       CARD16                  altSymsNotifyMask;
+       CARD32                  autoCtrls;
+       CARD32                  autoCtrlValues;
+} XkbInterestRec,*XkbInterestPtr;
+
+typedef struct _XkbRadioGroup {
+       CARD8           flags;
+       CARD8           nMembers;
+       CARD8           dfltDown;
+       CARD8           currentDown;
+       CARD8           members[XkbRGMaxMembers];
+} XkbRadioGroupRec, *XkbRadioGroupPtr;
+
+typedef struct _XkbEventCause {
+       CARD8           kc;
+       CARD8           event;
+       CARD8           mjr;
+       CARD8           mnr;
+       ClientPtr       client;
+} XkbEventCauseRec,*XkbEventCausePtr;
+#define        XkbSetCauseKey(c,k,e)   { (c)->kc= (k),(c)->event= (e),\
+                                 (c)->mjr= (c)->mnr= 0; \
+                                 (c)->client= NULL; }
+#define        XkbSetCauseReq(c,j,n,cl) { (c)->kc= (c)->event= 0,\
+                                 (c)->mjr= (j),(c)->mnr= (n);\
+                                 (c)->client= (cl); }
+#define        XkbSetCauseCoreReq(c,e,cl) XkbSetCauseReq(c,e,0,cl)
+#define        XkbSetCauseXkbReq(c,e,cl)  XkbSetCauseReq(c,XkbReqCode,e,cl)
+#define        XkbSetCauseUnknown(c)      XkbSetCauseKey(c,0,0)
+
+#define        _OFF_TIMER              0
+#define        _KRG_WARN_TIMER         1
+#define        _KRG_TIMER              2
+#define        _SK_TIMEOUT_TIMER       3
+#define        _ALL_TIMEOUT_TIMER      4
+
+#define        _BEEP_NONE              0
+#define        _BEEP_FEATURE_ON        1
+#define        _BEEP_FEATURE_OFF       2
+#define        _BEEP_FEATURE_CHANGE    3
+#define        _BEEP_SLOW_WARN         4
+#define        _BEEP_SLOW_PRESS        5
+#define        _BEEP_SLOW_ACCEPT       6
+#define        _BEEP_SLOW_REJECT       7
+#define        _BEEP_SLOW_RELEASE      8
+#define        _BEEP_STICKY_LATCH      9
+#define        _BEEP_STICKY_LOCK       10
+#define        _BEEP_STICKY_UNLOCK     11
+#define        _BEEP_LED_ON            12
+#define        _BEEP_LED_OFF           13
+#define        _BEEP_LED_CHANGE        14
+#define        _BEEP_BOUNCE_REJECT     15
+
+typedef struct _XkbSrvInfo {
+       XkbStateRec      prev_state;
+       XkbStateRec      state;
+       XkbDescPtr       desc;
+
+       DeviceIntPtr     device;
+       KbdCtrlProcPtr   kbdProc;
+
+       XkbRadioGroupPtr radioGroups;
+       CARD8            nRadioGroups;
+       CARD8            clearMods;
+       CARD8            setMods;
+       INT16            groupChange;
+
+       CARD16           dfltPtrDelta;
+
+       double           mouseKeysCurve;
+       double           mouseKeysCurveFactor;
+       INT16            mouseKeysDX;
+       INT16            mouseKeysDY;
+       CARD8            mouseKeysFlags;
+       Bool             mouseKeysAccel;
+       CARD8            mouseKeysCounter;
+
+       CARD8            lockedPtrButtons;
+       CARD8            shiftKeyCount;
+       KeyCode          mouseKey;
+       KeyCode          inactiveKey;
+       KeyCode          slowKey;
+       KeyCode          repeatKey;
+       CARD8            krgTimerActive;
+       CARD8            beepType;
+       CARD8            beepCount;
+
+       CARD32           flags;
+       CARD32           lastPtrEventTime;
+       CARD32           lastShiftEventTime;
+       OsTimerPtr       beepTimer;
+       OsTimerPtr       mouseKeyTimer;
+       OsTimerPtr       slowKeysTimer;
+       OsTimerPtr       bounceKeysTimer;
+       OsTimerPtr       repeatKeyTimer;
+       OsTimerPtr       krgTimer;
+} XkbSrvInfoRec, *XkbSrvInfoPtr;
+
+#define        XkbSLI_IsDefault        (1L<<0)
+#define        XkbSLI_HasOwnState      (1L<<1)
+
+typedef struct _XkbSrvLedInfo {
+       CARD16                  flags;
+       CARD16                  class;
+       CARD16                  id;
+       union {
+           KbdFeedbackPtr      kf;
+           LedFeedbackPtr      lf;
+       }                       fb;
+
+       CARD32                  physIndicators;
+       CARD32                  autoState;
+       CARD32                  explicitState;
+       CARD32                  effectiveState;
+
+       CARD32                  mapsPresent;
+       CARD32                  namesPresent;
+       XkbIndicatorMapPtr      maps;
+       Atom *                  names;
+
+       CARD32                  usesBase;
+       CARD32                  usesLatched;
+       CARD32                  usesLocked;
+       CARD32                  usesEffective;
+       CARD32                  usesCompat;
+       CARD32                  usesControls;
+
+       CARD32                  usedComponents;
+} XkbSrvLedInfoRec, *XkbSrvLedInfoPtr;
+
+/*
+ * Settings for xkbClientFlags field (used by DIX)
+ * These flags _must_ not overlap with XkbPCF_*
+ */
+#define        _XkbClientInitialized           (1<<15)
+
+#define        _XkbWantsDetectableAutoRepeat(c)\
+       ((c)->xkbClientFlags&XkbPCF_DetectableAutoRepeatMask)
+
+/*
+ * Settings for flags field
+ */
+#define        _XkbStateNotifyInProgress       (1<<0)
+
+typedef struct
+{
+    ProcessInputProc processInputProc;
+    ProcessInputProc realInputProc;
+    DeviceUnwrapProc unwrapProc;
+} xkbDeviceInfoRec, *xkbDeviceInfoPtr;
+
+#define WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \
+       device->public.processInputProc = proc; \
+       oldprocs->processInputProc = \
+       oldprocs->realInputProc = device->public.realInputProc; \
+       device->public.realInputProc = proc; \
+       oldprocs->unwrapProc = device->unwrapProc; \
+       device->unwrapProc = unwrapproc;
+
+#define COND_WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \
+       if (device->public.processInputProc == device->public.realInputProc)\
+           device->public.processInputProc = proc; \
+       oldprocs->processInputProc = \
+       oldprocs->realInputProc = device->public.realInputProc; \
+       device->public.realInputProc = proc; \
+       oldprocs->unwrapProc = device->unwrapProc; \
+       device->unwrapProc = unwrapproc;
+
+#define UNWRAP_PROCESS_INPUT_PROC(device, oldprocs) \
+       device->public.processInputProc = oldprocs->processInputProc; \
+       device->public.realInputProc = oldprocs->realInputProc; \
+       device->unwrapProc = oldprocs->unwrapProc;
+
+#define XKBDEVICEINFO(dev) ((xkbDeviceInfoPtr) (dev)->devPrivates[xkbDevicePrivateIndex].ptr)
+
+/***====================================================================***/
+
+
+/***====================================================================***/
+
+#define XkbAX_KRGMask   (XkbSlowKeysMask|XkbBounceKeysMask)
+#define        XkbAllFilteredEventsMask \
+       (XkbAccessXKeysMask|XkbRepeatKeysMask|XkbMouseKeysAccelMask|XkbAX_KRGMask)
+
+/***====================================================================***/
+
+extern int     XkbReqCode;
+extern int     XkbEventBase;
+extern int     XkbKeyboardErrorCode;
+extern int     XkbDisableLockActions;
+extern char *  XkbBaseDirectory;
+extern char *  XkbBinDirectory;
+extern char *  XkbInitialMap;
+extern int     _XkbClientMajor;
+extern int     _XkbClientMinor;
+extern unsigned        int XkbXIUnsupported;
+
+extern char *  XkbModelUsed,*XkbLayoutUsed,*XkbVariantUsed,*XkbOptionsUsed;
+extern Bool    noXkbExtension;
+extern Bool    XkbWantRulesProp;
+
+extern pointer XkbLastRepeatEvent;
+
+extern CARD32  xkbDebugFlags;
+extern CARD32  xkbDebugCtrls;
+
+#define        _XkbAlloc(s)            xalloc((s))
+#define        _XkbCalloc(n,s)         Xcalloc((n)*(s))
+#define        _XkbRealloc(o,s)        Xrealloc((o),(s))
+#define        _XkbTypedAlloc(t)       ((t *)xalloc(sizeof(t)))
+#define        _XkbTypedCalloc(n,t)    ((t *)Xcalloc((n)*sizeof(t)))
+#define        _XkbTypedRealloc(o,n,t) \
+       ((o)?(t *)Xrealloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t))
+#define        _XkbClearElems(a,f,l,t) bzero(&(a)[f],((l)-(f)+1)*sizeof(t))
+#define        _XkbFree(p)             Xfree(p)
+
+#define        _XkbLibError(c,l,d) \
+       { _XkbErrCode= (c); _XkbErrLocation= (l); _XkbErrData= (d); }
+#define        _XkbErrCode2(a,b) ((XID)((((unsigned int)(a))<<24)|((b)&0xffffff)))
+#define        _XkbErrCode3(a,b,c)     _XkbErrCode2(a,(((unsigned int)(b))<<16)|(c))
+#define        _XkbErrCode4(a,b,c,d) _XkbErrCode3(a,b,((((unsigned int)(c))<<8)|(d)))
+
+extern int     DeviceKeyPress,DeviceKeyRelease;
+extern int     DeviceButtonPress,DeviceButtonRelease;
+
+#ifdef XINPUT
+#define        _XkbIsPressEvent(t)     (((t)==KeyPress)||((t)==DeviceKeyPress))
+#define        _XkbIsReleaseEvent(t)   (((t)==KeyRelease)||((t)==DeviceKeyRelease))
+#else
+#define        _XkbIsPressEvent(t)     ((t)==KeyPress)
+#define        _XkbIsReleaseEvent(t)   ((t)==KeyRelease)
+#endif
+
+#define        _XkbCoreKeycodeInRange(c,k)     (((k)>=(c)->curKeySyms.minKeyCode)&&\
+                                        ((k)<=(c)->curKeySyms.maxKeyCode))
+#define        _XkbCoreNumKeys(c)      ((c)->curKeySyms.maxKeyCode-\
+                                (c)->curKeySyms.minKeyCode+1)
+
+#define        XConvertCase(s,l,u)     XkbConvertCase(s,l,u)
+#undef IsKeypadKey
+#define        IsKeypadKey(s)          XkbKSIsKeypad(s)
+
+typedef int Status;
+typedef pointer XPointer;
+typedef struct _XDisplay Display;
+
+#ifndef True
+#define        True    1
+#define        False   0
+#endif
+
+#ifndef PATH_MAX
+#ifdef MAXPATHLEN
+#define        PATH_MAX MAXPATHLEN
+#else
+#define        PATH_MAX 1024
+#endif
+#endif
+
+_XFUNCPROTOBEGIN
+
+extern void XkbUseMsg(
+    void
+);
+
+extern int XkbProcessArguments(
+    int                                /* argc */,
+    char **                    /* argv */,
+    int                                /* i */
+);
+
+extern void    XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc);
+
+extern void    XkbFreeCompatMap(
+    XkbDescPtr                 /* xkb */,
+    unsigned int               /* which */,
+    Bool                       /* freeMap */
+);
+
+extern void XkbFreeNames(
+       XkbDescPtr              /* xkb */,
+       unsigned int            /* which */,
+       Bool                    /* freeMap */
+);
+
+extern DeviceIntPtr _XkbLookupAnyDevice(
+    int                        /* id */,
+    int *              /* why_rtrn */
+);
+
+extern DeviceIntPtr _XkbLookupKeyboard(
+    int                        /* id */,
+    int *              /* why_rtrn */
+);
+
+extern DeviceIntPtr _XkbLookupBellDevice(
+    int                        /* id */,
+    int *              /* why_rtrn */
+);
+
+extern DeviceIntPtr _XkbLookupLedDevice(
+    int                        /* id */,
+    int *              /* why_rtrn */
+);
+
+extern DeviceIntPtr _XkbLookupButtonDevice(
+    int                        /* id */,
+    int *              /* why_rtrn */
+);
+
+extern XkbDescPtr XkbAllocKeyboard(
+       void
+);
+
+extern Status XkbAllocClientMap(
+       XkbDescPtr              /* xkb */,
+       unsigned int            /* which */,
+       unsigned int            /* nTypes */
+);
+
+extern Status XkbAllocServerMap(
+       XkbDescPtr              /* xkb */,
+       unsigned int            /* which */,
+       unsigned int            /* nNewActions */
+);
+
+extern void    XkbFreeClientMap(
+    XkbDescPtr                 /* xkb */,
+    unsigned int               /* what */,
+    Bool                       /* freeMap */
+);
+
+extern void    XkbFreeServerMap(
+    XkbDescPtr                 /* xkb */,
+    unsigned int               /* what */,
+    Bool                       /* freeMap */
+);
+
+extern Status XkbAllocIndicatorMaps(
+       XkbDescPtr              /* xkb */
+);
+
+extern Status  XkbAllocCompatMap(
+    XkbDescPtr                 /* xkb */,
+    unsigned int               /* which */,
+    unsigned int               /* nInterpret */
+);
+
+extern Status XkbAllocNames(
+       XkbDescPtr              /* xkb */,
+       unsigned int            /* which */,
+       int                     /* nTotalRG */,
+       int                     /* nTotalAliases */
+);
+
+extern Status  XkbAllocControls(
+       XkbDescPtr              /* xkb */,
+       unsigned int            /* which*/
+);
+
+extern Status  XkbCopyKeyType(
+    XkbKeyTypePtr              /* from */,
+    XkbKeyTypePtr              /* into */
+);
+
+extern Status  XkbCopyKeyTypes(
+    XkbKeyTypePtr              /* from */,
+    XkbKeyTypePtr              /* into */,
+    int                                /* num_types */
+);
+
+extern Status  XkbResizeKeyType(
+    XkbDescPtr         /* xkb */,
+    int                        /* type_ndx */,
+    int                        /* map_count */,
+    Bool               /* want_preserve */,
+    int                        /* new_num_lvls */
+);
+
+extern void    XkbFreeKeyboard(
+       XkbDescPtr              /* xkb */,
+       unsigned int            /* which */,
+       Bool                    /* freeDesc */
+);
+
+extern  void XkbSetActionKeyMods(
+       XkbDescPtr              /* xkb */,
+       XkbAction *             /* act */,
+       unsigned int            /* mods */
+);
+
+extern Bool XkbCheckActionVMods(
+       XkbDescPtr              /* xkb */,
+       XkbAction *             /* act */,
+       unsigned int            /* changed */
+);
+
+extern Bool XkbApplyVModChanges(
+    XkbSrvInfoPtr      /* xkbi */,
+    unsigned int       /* changed */,
+    XkbChangesPtr      /* pChanges */,
+    unsigned int *     /* needChecksRtrn */,
+    XkbEventCausePtr   /* cause */
+);
+
+extern void XkbApplyVModChangesToAllDevices(
+    DeviceIntPtr       /* dev */,
+    XkbDescPtr                 /* xkb */,
+    unsigned int       /* changed */,
+    XkbEventCausePtr   /* cause */
+);
+
+extern unsigned int XkbMaskForVMask(
+    XkbDescPtr         /* xkb */,
+    unsigned int       /* vmask */
+);
+
+extern Bool XkbVirtualModsToReal(
+       XkbDescPtr      /* xkb */,
+       unsigned int    /* virtua_mask */,
+       unsigned int *  /* mask_rtrn */
+);
+
+extern unsigned int    XkbAdjustGroup(
+    int                        /* group */,
+    XkbControlsPtr     /* ctrls */
+);
+
+extern KeySym *XkbResizeKeySyms(
+    XkbDescPtr         /* xkb */,
+    int                /* key */,
+    int                /* needed */
+);
+
+extern XkbAction *XkbResizeKeyActions(
+    XkbDescPtr         /* xkb */,
+    int                /* key */,
+    int                /* needed */
+);
+
+extern void XkbUpdateKeyTypesFromCore(
+    DeviceIntPtr       /* pXDev */,
+    KeyCode            /* first */,
+    CARD8              /* num */,
+    XkbChangesPtr      /* pChanges */
+);
+
+extern void XkbUpdateDescActions(      
+    XkbDescPtr         /* xkb */,
+    KeyCode            /* first */,
+    CARD8              /* num */,
+    XkbChangesPtr      /* changes */
+);
+
+extern void XkbUpdateActions(
+    DeviceIntPtr       /* pXDev */,
+    KeyCode            /* first */,
+    CARD8              /* num */,
+    XkbChangesPtr      /* pChanges */,
+    unsigned int *     /* needChecksRtrn */,
+    XkbEventCausePtr   /* cause */
+);
+
+extern void XkbUpdateCoreDescription(
+    DeviceIntPtr       /* keybd */,
+    Bool               /* resize */
+);
+
+extern void XkbApplyMappingChange(
+    DeviceIntPtr       /* pXDev */,
+    CARD8              /* request */,
+    KeyCode            /* firstKey */,
+    CARD8              /* num */,
+    ClientPtr          /* client */
+);
+
+extern void XkbSetIndicators(
+    DeviceIntPtr               /* pXDev */,
+    CARD32                     /* affect */,
+    CARD32                     /* values */,
+    XkbEventCausePtr           /* cause */
+);
+
+extern void XkbUpdateIndicators(
+    DeviceIntPtr               /* keybd */,
+    CARD32                     /* changed */,
+    Bool                       /* check_edevs */,
+    XkbChangesPtr              /* pChanges */,
+    XkbEventCausePtr           /* cause */
+);
+
+extern XkbSrvLedInfoPtr XkbAllocSrvLedInfo(
+    DeviceIntPtr               /* dev */,
+    KbdFeedbackPtr             /* kf */,
+    LedFeedbackPtr             /* lf */,
+    unsigned int               /* needed_parts */
+);
+
+extern XkbSrvLedInfoPtr XkbFindSrvLedInfo(
+    DeviceIntPtr               /* dev */,
+    unsigned int               /* class */,
+    unsigned int               /* id */,
+    unsigned int               /* needed_parts */
+);
+
+extern void XkbApplyLedNameChanges(
+    DeviceIntPtr               /* dev */,
+    XkbSrvLedInfoPtr           /* sli */,
+    unsigned int               /* changed_names */,
+    xkbExtensionDeviceNotify * /* ed */,
+    XkbChangesPtr              /* changes */,
+    XkbEventCausePtr           /* cause */
+);
+
+extern void XkbApplyLedMapChanges(
+    DeviceIntPtr               /* dev */,
+    XkbSrvLedInfoPtr           /* sli */,
+    unsigned int               /* changed_maps */,
+    xkbExtensionDeviceNotify * /* ed */,
+    XkbChangesPtr              /* changes */,
+    XkbEventCausePtr           /* cause */
+);
+
+extern void XkbApplyLedStateChanges(
+    DeviceIntPtr               /* dev */,
+    XkbSrvLedInfoPtr           /* sli */,
+    unsigned int               /* changed_leds */,
+    xkbExtensionDeviceNotify * /* ed */,
+    XkbChangesPtr              /* changes */,
+    XkbEventCausePtr           /* cause */
+);
+
+extern void XkbUpdateLedAutoState(
+    DeviceIntPtr               /* dev */,
+    XkbSrvLedInfoPtr           /* sli */,
+    unsigned int               /* maps_to_check */,
+    xkbExtensionDeviceNotify * /* ed */,
+    XkbChangesPtr              /* changes */,
+    XkbEventCausePtr           /* cause */
+);
+
+extern void XkbFlushLedEvents( 
+    DeviceIntPtr               /* dev */,
+    DeviceIntPtr               /* kbd */,
+    XkbSrvLedInfoPtr           /* sli */,
+    xkbExtensionDeviceNotify * /* ed */,
+    XkbChangesPtr              /* changes */,
+    XkbEventCausePtr           /* cause */
+);
+
+extern void XkbUpdateAllDeviceIndicators(
+    XkbChangesPtr              /* changes */,
+    XkbEventCausePtr           /* cause */
+);
+
+extern unsigned int XkbIndicatorsToUpdate(
+    DeviceIntPtr               /* dev */,
+    unsigned long              /* state_changes */,
+    Bool                       /* enabled_ctrl_changes */
+);
+
+extern void XkbComputeDerivedState(
+    XkbSrvInfoPtr              /* xkbi */
+);
+
+extern void XkbCheckSecondaryEffects(
+    XkbSrvInfoPtr              /* xkbi */,
+    unsigned int               /* which */,
+    XkbChangesPtr              /* changes */,
+    XkbEventCausePtr           /* cause */
+);
+
+extern void XkbCheckIndicatorMaps(
+    DeviceIntPtr               /* dev */,
+    XkbSrvLedInfoPtr           /* sli */,
+    unsigned int               /* which */
+);
+
+extern unsigned int XkbStateChangedFlags(
+    XkbStatePtr                        /* old */,
+    XkbStatePtr                        /* new */
+);
+
+extern void XkbSendStateNotify(
+       DeviceIntPtr    /* kbd */,
+       xkbStateNotify *        /* pSN */
+);
+
+extern void XkbSendMapNotify(
+       DeviceIntPtr    /* kbd */,
+       xkbMapNotify *  /* ev */
+);
+
+extern int  XkbComputeControlsNotify(
+       DeviceIntPtr            /* kbd */,
+       XkbControlsPtr          /* old */,
+       XkbControlsPtr          /* new */,
+       xkbControlsNotify *     /* pCN */,
+       Bool                    /* forceCtrlProc */
+);
+
+extern void XkbSendControlsNotify(
+       DeviceIntPtr            /* kbd */,
+       xkbControlsNotify *     /* ev */
+);
+
+extern void XkbSendCompatMapNotify(
+       DeviceIntPtr            /* kbd */,
+       xkbCompatMapNotify *    /* ev */
+);
+
+extern void XkbSendIndicatorNotify(
+       DeviceIntPtr            /* kbd */,
+       int                     /* xkbType */,
+       xkbIndicatorNotify *    /* ev */
+);
+
+extern void XkbHandleBell(
+       BOOL            /* force */,
+       BOOL            /* eventOnly */,
+       DeviceIntPtr    /* kbd */,
+       CARD8           /* percent */,
+       pointer                 /* ctrl */,
+       CARD8           /* class */,
+       Atom            /* name */,
+       WindowPtr       /* pWin */,
+       ClientPtr       /* pClient */
+);
+
+extern void XkbSendAccessXNotify(
+       DeviceIntPtr            /* kbd */,
+       xkbAccessXNotify *      /* pEv */
+);
+
+extern void XkbSendNamesNotify(
+       DeviceIntPtr    /* kbd */,
+       xkbNamesNotify *        /* ev */
+);
+
+extern void XkbSendCompatNotify(
+       DeviceIntPtr            /* kbd */,
+       xkbCompatMapNotify *    /* ev */
+);
+
+extern void XkbSendActionMessage(
+       DeviceIntPtr            /* kbd */,
+       xkbActionMessage *      /* ev */
+);
+
+extern void XkbSendExtensionDeviceNotify(
+       DeviceIntPtr                    /* kbd */,
+       ClientPtr                       /* client */,
+       xkbExtensionDeviceNotify *      /* ev */
+);
+
+extern void XkbSendNotification(
+    DeviceIntPtr               /* kbd */,
+    XkbChangesPtr              /* pChanges */,
+    XkbEventCausePtr           /* cause */
+);
+
+extern void XkbProcessKeyboardEvent(
+    struct _xEvent *           /* xE */,
+    DeviceIntPtr               /* keybd */,
+    int                        /* count */
+);
+
+extern void XkbProcessOtherEvent(
+    struct _xEvent *           /* xE */,
+    DeviceIntPtr               /* keybd */,
+    int                        /* count */
+);
+
+extern void XkbHandleActions(
+    DeviceIntPtr               /* dev */,
+    DeviceIntPtr               /* kbd */,
+    struct _xEvent *           /* xE */,
+    int                        /* count */
+);
+
+extern Bool XkbEnableDisableControls(
+    XkbSrvInfoPtr      /* xkbi */,
+    unsigned long      /* change */,
+    unsigned long      /* newValues */,
+    XkbChangesPtr      /* changes */,
+    XkbEventCausePtr   /* cause */
+);
+
+extern void AccessXInit(
+    DeviceIntPtr        /* dev */
+);
+
+extern Bool AccessXFilterPressEvent(
+    register struct _xEvent *  /* xE */,
+    register DeviceIntPtr      /* keybd */,
+    int                                /* count */
+);
+
+extern Bool AccessXFilterReleaseEvent(
+    register struct _xEvent *  /* xE */,
+    register DeviceIntPtr      /* keybd */,
+    int                                /* count */
+);
+
+extern void AccessXCancelRepeatKey(
+    XkbSrvInfoPtr      /* xkbi */,
+    KeyCode            /* key */
+);
+
+extern void AccessXComputeCurveFactor(
+    XkbSrvInfoPtr      /* xkbi */,
+    XkbControlsPtr     /* ctrls */
+);
+
+extern XkbDeviceLedInfoPtr     XkbAddDeviceLedInfo(
+       XkbDeviceInfoPtr        /* devi */,
+       unsigned int            /* ledClass */,
+       unsigned int            /* ledId */
+);
+
+extern XkbDeviceInfoPtr        XkbAllocDeviceInfo(
+       unsigned int            /* deviceSpec */,
+       unsigned int            /* nButtons */,
+       unsigned int            /* szLeds */
+);
+
+extern void XkbFreeDeviceInfo(
+       XkbDeviceInfoPtr        /* devi */,
+       unsigned int            /* which */,
+       Bool                    /* freeDevI */
+);
+
+extern Status XkbResizeDeviceButtonActions(
+       XkbDeviceInfoPtr        /* devi */,
+       unsigned int            /* newTotal */
+);
+
+extern XkbInterestPtr XkbFindClientResource(
+       DevicePtr       /* inDev */,
+       ClientPtr       /* client */
+);
+
+extern XkbInterestPtr XkbAddClientResource(
+       DevicePtr       /* inDev */,
+       ClientPtr       /* client */,
+       XID             /* id */
+);
+
+extern int XkbRemoveClient(
+       DevicePtr       /* inDev */,
+       ClientPtr       /* client */
+);
+
+extern int XkbRemoveResourceClient(
+       DevicePtr       /* inDev */,
+       XID             /* id */
+);
+
+extern int XkbDDXInitDevice(
+    DeviceIntPtr        /* dev */
+);
+
+extern int XkbDDXAccessXBeep(
+    DeviceIntPtr        /* dev */,
+    unsigned int       /* what */,
+    unsigned int       /* which */
+);
+
+extern void XkbDDXKeyClick(
+    DeviceIntPtr       /* dev */,
+    int                        /* keycode */,
+    int                        /* synthetic */
+);
+
+extern         int XkbDDXUsesSoftRepeat(
+    DeviceIntPtr       /* dev */
+);
+
+extern void XkbDDXKeybdCtrlProc(
+       DeviceIntPtr    /* dev */,
+       KeybdCtrl *     /* ctrl */
+);
+
+extern void XkbDDXChangeControls(
+       DeviceIntPtr    /* dev */,
+       XkbControlsPtr  /* old */,
+       XkbControlsPtr  /* new */
+);
+
+extern void XkbDDXUpdateIndicators(
+       DeviceIntPtr    /* keybd */,
+       CARD32          /* newState */
+);
+
+extern void XkbDDXUpdateDeviceIndicators(
+       DeviceIntPtr            /* dev */,
+       XkbSrvLedInfoPtr        /* sli */,
+       CARD32                  /* newState */
+);
+
+extern void XkbDDXFakePointerButton(
+       int             /* event */,
+       int             /* button */
+);
+
+extern void XkbDDXFakePointerMotion(
+       unsigned int    /* flags */,
+       int             /* x */,
+       int             /* y */
+);
+
+extern void XkbDDXFakeDeviceButton(
+       DeviceIntPtr    /* dev */,
+       Bool            /* press */,
+       int             /* button */
+);
+
+extern int XkbDDXTerminateServer(
+       DeviceIntPtr    /* dev */,
+       KeyCode         /* key */,
+       XkbAction *     /* act */
+);
+
+extern int XkbDDXSwitchScreen(
+       DeviceIntPtr    /* dev */,
+       KeyCode         /* key */,
+       XkbAction *     /* act */
+);
+
+extern int XkbDDXPrivate(
+       DeviceIntPtr    /* dev */,
+       KeyCode         /* key */,
+       XkbAction *     /* act */
+);
+
+extern void XkbDisableComputedAutoRepeats(
+       DeviceIntPtr    /* pXDev */,
+       unsigned int    /* key */
+);
+
+extern void XkbSetRepeatKeys(
+       DeviceIntPtr    /* pXDev */,
+       int             /* key */,
+       int             /* onoff */
+);
+
+extern int XkbLatchModifiers(
+       DeviceIntPtr    /* pXDev */,
+       CARD8           /* mask */,
+       CARD8           /* latches */
+);
+
+extern int XkbLatchGroup(
+       DeviceIntPtr    /* pXDev */,
+       int             /* group */
+);
+
+extern void XkbClearAllLatchesAndLocks(
+       DeviceIntPtr            /* dev */,
+       XkbSrvInfoPtr           /* xkbi */,
+       Bool                    /* genEv */,
+       XkbEventCausePtr        /* cause */
+);
+
+extern void    XkbSetRulesDflts(
+       char *                  /* rulesFile */,
+       char *                  /* model */,
+       char *                  /* layout */,
+       char *                  /* variant */,
+       char *                  /* options */
+);
+
+extern void    XkbInitDevice(
+       DeviceIntPtr    /* pXDev */
+);
+
+extern Bool    XkbInitKeyboardDeviceStruct(
+       DeviceIntPtr            /* pXDev */,
+       XkbComponentNamesPtr    /* pNames */,
+       KeySymsPtr              /* pSyms */,
+       CARD8                   /* pMods */[],
+       BellProcPtr             /* bellProc */,
+       KbdCtrlProcPtr          /* ctrlProc */
+);
+
+extern int SProcXkbDispatch(
+       ClientPtr               /* client */
+);
+
+extern XkbGeometryPtr XkbLookupNamedGeometry(
+       DeviceIntPtr            /* dev */,
+       Atom                    /* name */,
+       Bool *                  /* shouldFree */
+);
+
+extern char *  _XkbDupString(
+       char *                  /* str */
+);
+
+extern void    XkbConvertCase(
+       KeySym                  /* sym */,
+       KeySym *                /* lower */,
+       KeySym *                /* upper */
+);
+
+extern Status   XkbChangeKeycodeRange( 
+       XkbDescPtr              /* xkb */,
+       int                     /* minKC */,
+       int                     /* maxKC */,
+       XkbChangesPtr           /* changes */
+);
+
+extern int XkbFinishDeviceInit(
+       DeviceIntPtr            /* pXDev */
+);
+
+extern void XkbFreeSrvLedInfo(
+       XkbSrvLedInfoPtr        /* sli */
+);
+
+extern void XkbFreeInfo(
+       XkbSrvInfoPtr           /* xkbi */
+);
+
+extern Status XkbChangeTypesOfKey(
+       XkbDescPtr              /* xkb */,
+       int                     /* key */,
+       int                     /* nGroups */,
+       unsigned int            /* groups */,
+       int *                   /* newTypesIn */,
+       XkbMapChangesPtr        /* changes */
+);
+
+extern XkbKeyTypePtr XkbAddKeyType(
+       XkbDescPtr              /* xkb */,
+       Atom                    /* name */,
+       int                     /* map_count */,
+       Bool                    /* want_preserve */,
+       int                     /* num_lvls */
+);
+
+extern Status XkbInitCanonicalKeyTypes(
+       XkbDescPtr              /* xkb */,
+       unsigned int            /* which */,
+       int                     /* keypadVMod */
+);
+
+extern int XkbKeyTypesForCoreSymbols(
+       XkbDescPtr              /* xkb */,
+       int                     /* map_width */,
+       KeySym *                /* core_syms */,
+       unsigned int            /* protected */,
+       int *                   /* types_inout */,
+       KeySym *                /* xkb_syms_rtrn */
+);
+
+extern Bool XkbApplyCompatMapToKey(
+       XkbDescPtr              /* xkb */,
+       KeyCode                 /* key */,
+       XkbChangesPtr           /* changes */
+);
+
+extern Bool XkbUpdateMapFromCore(
+       XkbDescPtr              /* xkb */,
+       KeyCode                 /* first_key */,
+       int                     /* num_keys */,
+       int                     /* map_width */,
+       KeySym *                /* core_keysyms */,
+       XkbChangesPtr           /* changes */
+);
+
+extern void XkbFreeControls(
+       XkbDescPtr              /* xkb */,
+       unsigned int            /* which */,
+       Bool                    /* freeMap */
+);
+
+extern void XkbFreeIndicatorMaps(
+       XkbDescPtr              /* xkb */
+);
+
+extern Bool XkbApplyVirtualModChanges(
+       XkbDescPtr              /* xkb */,
+       unsigned int            /* changed */,
+       XkbChangesPtr           /* changes */
+);
+
+extern Bool XkbUpdateActionVirtualMods(
+       XkbDescPtr              /* xkb */,
+       XkbAction *             /* act */,
+       unsigned int            /* changed */
+);
+
+extern void XkbUpdateKeyTypeVirtualMods(
+       XkbDescPtr              /* xkb */,
+       XkbKeyTypePtr           /* type */,
+       unsigned int            /* changed */,
+       XkbChangesPtr           /* changes */
+);
+
+extern void XkbSendNewKeyboardNotify(
+       DeviceIntPtr            /* kbd */,
+       xkbNewKeyboardNotify *  /* pNKN */
+);
+
+#ifdef XKBSRV_NEED_FILE_FUNCS
+
+#include <X11/extensions/XKMformat.h>
+#include <X11/extensions/XKBfile.h>
+#include <X11/extensions/XKBrules.h>
+
+#define        _XkbListKeymaps         0
+#define        _XkbListKeycodes        1
+#define        _XkbListTypes           2
+#define        _XkbListCompat          3
+#define        _XkbListSymbols         4
+#define        _XkbListGeometry        5
+#define        _XkbListNumComponents   6
+
+typedef struct _XkbSrvListInfo {
+       int             szPool;
+       int             nPool;
+       char *          pool;
+
+       int             maxRtrn;
+       int             nTotal;
+
+       char *          pattern[_XkbListNumComponents];
+       int             nFound[_XkbListNumComponents];
+} XkbSrvListInfoRec,*XkbSrvListInfoPtr;
+
+char *
+XkbGetRulesDflts(
+       XkbRF_VarDefsPtr        /* defs */
+);
+
+extern void    XkbSetRulesUsed(
+       XkbRF_VarDefsPtr        /* defs */
+);
+
+
+extern Status  XkbDDXList(
+       DeviceIntPtr            /* dev */,
+       XkbSrvListInfoPtr       /* listing */,
+       ClientPtr               /* client */
+);
+
+extern unsigned int XkbDDXLoadKeymapByNames(
+       DeviceIntPtr            /* keybd */,
+       XkbComponentNamesPtr    /* names */,
+       unsigned int            /* want */,
+       unsigned int            /* need */,
+       XkbFileInfoPtr          /* finfoRtrn */,
+       char *                  /* keymapNameRtrn */,
+       int                     /* keymapNameRtrnLen */
+);
+
+extern Bool XkbDDXNamesFromRules(
+       DeviceIntPtr            /* keybd */,
+       char *                  /* rules */,
+       XkbRF_VarDefsPtr        /* defs */,
+       XkbComponentNamesPtr    /* names */
+);
+
+extern FILE *XkbDDXOpenConfigFile(
+       char *  /* mapName */,
+       char *  /* fileNameRtrn */,
+       int     /* fileNameRtrnLen */
+);
+
+extern Bool XkbDDXApplyConfig(
+       XPointer        /* cfg_in */,
+       XkbSrvInfoPtr   /* xkbi */
+);
+
+extern XPointer XkbDDXPreloadConfig(
+       char **                 /* rulesFileRtrn */,
+       XkbRF_VarDefsPtr        /* defs */,
+       XkbComponentNamesPtr    /* names */,
+       DeviceIntPtr            /* dev */
+);
+
+extern int _XkbStrCaseCmp(
+       char *                  /* str1 */,
+       char *                  /* str2 */
+);
+
+#endif /* XKBSRV_NEED_FILE_FUNCS */
+
+
+_XFUNCPROTOEND
+
+#define        XkbAtomGetString(d,s)   NameForAtom(s)
+
+#endif /* _XKBSRV_H_ */
+
+
diff --git a/XKBstr.h b/XKBstr.h
new file mode 100644 (file)
index 0000000..bc63f49
--- /dev/null
+++ b/XKBstr.h
@@ -0,0 +1,614 @@
+/* $Xorg: XKBstr.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ */
+/************************************************************
+Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be 
+used in advertising or publicity pertaining to distribution 
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability 
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef _XKBSTR_H_
+#define        _XKBSTR_H_
+
+#include <X11/extensions/XKB.h>
+
+#define        XkbCharToInt(v)         ((v)&0x80?(int)((v)|(~0xff)):(int)((v)&0x7f))
+#define        XkbIntTo2Chars(i,h,l)   (((h)=((i>>8)&0xff)),((l)=((i)&0xff)))
+
+#if defined(WORD64) && defined(UNSIGNEDBITFIELDS)
+#define        Xkb2CharsToInt(h,l)     ((h)&0x80?(int)(((h)<<8)|(l)|(~0xffff)):\
+                                         (int)(((h)<<8)|(l)&0x7fff))
+#else
+#define        Xkb2CharsToInt(h,l)     ((short)(((h)<<8)|(l)))
+#endif
+
+       /*
+        * Common data structures and access macros
+        */
+
+typedef struct _XkbStateRec {
+       unsigned char   group;
+       unsigned char   locked_group;
+       unsigned short  base_group;
+       unsigned short  latched_group;
+       unsigned char   mods;
+       unsigned char   base_mods;
+       unsigned char   latched_mods;
+       unsigned char   locked_mods;
+       unsigned char   compat_state;
+       unsigned char   grab_mods;
+       unsigned char   compat_grab_mods;
+       unsigned char   lookup_mods;
+       unsigned char   compat_lookup_mods;
+       unsigned short  ptr_buttons;
+} XkbStateRec,*XkbStatePtr;
+#define        XkbModLocks(s)   ((s)->locked_mods)
+#define        XkbStateMods(s)  ((s)->base_mods|(s)->latched_mods|XkbModLocks(s))
+#define        XkbGroupLock(s)  ((s)->locked_group)
+#define        XkbStateGroup(s) ((s)->base_group+(s)->latched_group+XkbGroupLock(s))
+#define        XkbStateFieldFromRec(s) XkbBuildCoreState((s)->lookup_mods,(s)->group)
+#define        XkbGrabStateFromRec(s)  XkbBuildCoreState((s)->grab_mods,(s)->group)
+
+typedef struct _XkbMods {
+       unsigned char   mask;   /* effective mods */
+       unsigned char   real_mods;
+       unsigned short  vmods;
+} XkbModsRec,*XkbModsPtr;
+
+typedef struct _XkbKTMapEntry {
+       Bool            active;
+       unsigned char   level;
+       XkbModsRec      mods;
+} XkbKTMapEntryRec,*XkbKTMapEntryPtr;
+
+typedef struct _XkbKeyType {
+       XkbModsRec              mods;
+       unsigned char           num_levels;
+       unsigned char           map_count;
+       XkbKTMapEntryPtr        map;
+       XkbModsPtr              preserve;
+       Atom                    name;
+       Atom *                  level_names;
+} XkbKeyTypeRec, *XkbKeyTypePtr;
+
+#define        XkbNumGroups(g)                 ((g)&0x0f)
+#define        XkbOutOfRangeGroupInfo(g)       ((g)&0xf0)
+#define        XkbOutOfRangeGroupAction(g)     ((g)&0xc0)
+#define        XkbOutOfRangeGroupNumber(g)     (((g)&0x30)>>4)
+#define        XkbSetGroupInfo(g,w,n)  (((w)&0xc0)|(((n)&3)<<4)|((g)&0x0f))
+#define        XkbSetNumGroups(g,n)    (((g)&0xf0)|((n)&0x0f))
+
+       /*
+        * Structures and access macros used primarily by the server
+        */
+
+typedef struct _XkbBehavior {
+       unsigned char   type;
+       unsigned char   data;
+} XkbBehavior;
+
+#define        XkbAnyActionDataSize 7
+typedef        struct _XkbAnyAction {
+       unsigned char   type;
+       unsigned char   data[XkbAnyActionDataSize];
+} XkbAnyAction;
+
+typedef struct _XkbModAction {
+       unsigned char   type;
+       unsigned char   flags;
+       unsigned char   mask;
+       unsigned char   real_mods;
+       unsigned char   vmods1;
+       unsigned char   vmods2;
+} XkbModAction;
+#define        XkbModActionVMods(a)      \
+       ((short)(((a)->vmods1<<8)|((a)->vmods2)))
+#define        XkbSetModActionVMods(a,v) \
+       (((a)->vmods1=(((v)>>8)&0xff)),(a)->vmods2=((v)&0xff))
+
+typedef struct _XkbGroupAction {
+       unsigned char   type;
+       unsigned char   flags;
+       char            group_XXX;
+} XkbGroupAction;
+#define        XkbSAGroup(a)           (XkbCharToInt((a)->group_XXX))
+#define        XkbSASetGroup(a,g)      ((a)->group_XXX=(g))
+
+typedef struct _XkbISOAction {
+       unsigned char   type;
+       unsigned char   flags;
+       unsigned char   mask;
+       unsigned char   real_mods;
+       char            group_XXX;
+       unsigned char   affect;
+       unsigned char   vmods1;
+       unsigned char   vmods2;
+} XkbISOAction;
+
+typedef struct _XkbPtrAction {
+       unsigned char   type;
+       unsigned char   flags;
+       unsigned char   high_XXX;
+       unsigned char   low_XXX;
+       unsigned char   high_YYY;
+       unsigned char   low_YYY;
+} XkbPtrAction;
+#define        XkbPtrActionX(a)      (Xkb2CharsToInt((a)->high_XXX,(a)->low_XXX))
+#define        XkbPtrActionY(a)      (Xkb2CharsToInt((a)->high_YYY,(a)->low_YYY))
+#define        XkbSetPtrActionX(a,x) (XkbIntTo2Chars(x,(a)->high_XXX,(a)->low_XXX))
+#define        XkbSetPtrActionY(a,y) (XkbIntTo2Chars(y,(a)->high_YYY,(a)->low_YYY))
+
+typedef struct _XkbPtrBtnAction {
+       unsigned char   type;
+       unsigned char   flags;
+       unsigned char   count;
+       unsigned char   button;
+} XkbPtrBtnAction;
+
+typedef struct _XkbPtrDfltAction {
+       unsigned char   type;
+       unsigned char   flags;
+       unsigned char   affect;
+       char            valueXXX;
+} XkbPtrDfltAction;
+#define        XkbSAPtrDfltValue(a)            (XkbCharToInt((a)->valueXXX))
+#define        XkbSASetPtrDfltValue(a,c)       ((a)->valueXXX= ((c)&0xff))
+
+typedef struct _XkbSwitchScreenAction {
+       unsigned char   type;
+       unsigned char   flags;
+       char            screenXXX;
+} XkbSwitchScreenAction;
+#define        XkbSAScreen(a)                  (XkbCharToInt((a)->screenXXX))
+#define        XkbSASetScreen(a,s)             ((a)->screenXXX= ((s)&0xff))
+
+typedef struct _XkbCtrlsAction {
+       unsigned char   type;
+       unsigned char   flags;
+       unsigned char   ctrls3;
+       unsigned char   ctrls2;
+       unsigned char   ctrls1;
+       unsigned char   ctrls0;
+} XkbCtrlsAction;
+#define        XkbActionSetCtrls(a,c)  (((a)->ctrls3=(((c)>>24)&0xff)),\
+                                       ((a)->ctrls2=(((c)>>16)&0xff)),\
+                                       ((a)->ctrls1=(((c)>>8)&0xff)),\
+                                       ((a)->ctrls0=((c)&0xff)))
+#define        XkbActionCtrls(a) ((((unsigned int)(a)->ctrls3)<<24)|\
+                          (((unsigned int)(a)->ctrls2)<<16)|\
+                          (((unsigned int)(a)->ctrls1)<<8)|\
+                          ((unsigned int)((a)->ctrls0)))
+
+typedef struct _XkbMessageAction {
+       unsigned char   type;
+       unsigned char   flags;
+       unsigned char   message[6];
+} XkbMessageAction;
+
+typedef struct _XkbRedirectKeyAction {
+       unsigned char   type;
+       unsigned char   new_key;
+       unsigned char   mods_mask;
+       unsigned char   mods;
+       unsigned char   vmods_mask0;
+       unsigned char   vmods_mask1;
+       unsigned char   vmods0;
+       unsigned char   vmods1;
+} XkbRedirectKeyAction;
+
+#define        XkbSARedirectVMods(a)           ((((unsigned int)(a)->vmods1)<<8)|\
+                                       ((unsigned int)(a)->vmods0))
+#define        XkbSARedirectSetVMods(a,m)      (((a)->vmods_mask1=(((m)>>8)&0xff)),\
+                                        ((a)->vmods_mask0=((m)&0xff)))
+#define        XkbSARedirectVModsMask(a)       ((((unsigned int)(a)->vmods_mask1)<<8)|\
+                                       ((unsigned int)(a)->vmods_mask0))
+#define        XkbSARedirectSetVModsMask(a,m)  (((a)->vmods_mask1=(((m)>>8)&0xff)),\
+                                        ((a)->vmods_mask0=((m)&0xff)))
+
+typedef struct _XkbDeviceBtnAction {
+       unsigned char   type;
+       unsigned char   flags;
+       unsigned char   count;
+       unsigned char   button;
+       unsigned char   device;
+} XkbDeviceBtnAction;
+
+typedef struct _XkbDeviceValuatorAction {
+       unsigned char   type;
+       unsigned char   device;
+       unsigned char   v1_what;
+       unsigned char   v1_ndx;
+       unsigned char   v1_value;
+       unsigned char   v2_what;
+       unsigned char   v2_ndx;
+       unsigned char   v2_value;
+} XkbDeviceValuatorAction;
+
+typedef        union _XkbAction {
+       XkbAnyAction            any;
+       XkbModAction            mods;
+       XkbGroupAction          group;
+       XkbISOAction            iso;
+       XkbPtrAction            ptr;
+       XkbPtrBtnAction         btn;
+       XkbPtrDfltAction        dflt;
+       XkbSwitchScreenAction   screen;
+       XkbCtrlsAction          ctrls;
+       XkbMessageAction        msg;
+       XkbRedirectKeyAction    redirect;
+       XkbDeviceBtnAction      devbtn;
+       XkbDeviceValuatorAction devval;
+       unsigned char           type;
+} XkbAction;
+
+typedef        struct _XkbControls {
+       unsigned char   mk_dflt_btn;
+       unsigned char   num_groups;
+       unsigned char   groups_wrap;
+       XkbModsRec      internal;
+       XkbModsRec      ignore_lock;
+       unsigned int    enabled_ctrls;
+       unsigned short  repeat_delay;
+       unsigned short  repeat_interval;
+       unsigned short  slow_keys_delay;
+       unsigned short  debounce_delay;
+       unsigned short  mk_delay;
+       unsigned short  mk_interval;
+       unsigned short  mk_time_to_max;
+       unsigned short  mk_max_speed;
+                short  mk_curve;
+       unsigned short  ax_options;
+       unsigned short  ax_timeout;
+       unsigned short  axt_opts_mask;
+       unsigned short  axt_opts_values;
+       unsigned int    axt_ctrls_mask;
+       unsigned int    axt_ctrls_values;
+       unsigned char   per_key_repeat[XkbPerKeyBitArraySize];
+} XkbControlsRec, *XkbControlsPtr;
+
+#define        XkbAX_AnyFeedback(c)    ((c)->enabled_ctrls&XkbAccessXFeedbackMask)
+#define        XkbAX_NeedOption(c,w)   ((c)->ax_options&(w))
+#define        XkbAX_NeedFeedback(c,w) (XkbAX_AnyFeedback(c)&&XkbAX_NeedOption(c,w))
+
+typedef struct _XkbServerMapRec {
+       unsigned short           num_acts;
+       unsigned short           size_acts;
+       XkbAction               *acts;
+
+       XkbBehavior             *behaviors;
+       unsigned short          *key_acts;
+#if defined(__cplusplus) || defined(c_plusplus)
+       /* explicit is a C++ reserved word */
+       unsigned char           *c_explicit;
+#else
+       unsigned char           *explicit;
+#endif
+       unsigned char            vmods[XkbNumVirtualMods];
+       unsigned short          *vmodmap;
+} XkbServerMapRec, *XkbServerMapPtr;
+
+#define        XkbSMKeyActionsPtr(m,k) (&(m)->acts[(m)->key_acts[k]])
+
+       /*
+        * Structures and access macros used primarily by clients
+        */
+
+typedef        struct _XkbSymMapRec {
+       unsigned char    kt_index[XkbNumKbdGroups];
+       unsigned char    group_info;
+       unsigned char    width;
+       unsigned short   offset;
+} XkbSymMapRec, *XkbSymMapPtr;
+
+typedef struct _XkbClientMapRec {
+       unsigned char            size_types;
+       unsigned char            num_types;
+       XkbKeyTypePtr            types;
+
+       unsigned short           size_syms;
+       unsigned short           num_syms;
+       KeySym                  *syms;
+       XkbSymMapPtr             key_sym_map;
+
+       unsigned char           *modmap;
+} XkbClientMapRec, *XkbClientMapPtr;
+
+#define        XkbCMKeyGroupInfo(m,k)  ((m)->key_sym_map[k].group_info)
+#define        XkbCMKeyNumGroups(m,k)   (XkbNumGroups((m)->key_sym_map[k].group_info))
+#define        XkbCMKeyGroupWidth(m,k,g) (XkbCMKeyType(m,k,g)->num_levels)
+#define        XkbCMKeyGroupsWidth(m,k) ((m)->key_sym_map[k].width)
+#define        XkbCMKeyTypeIndex(m,k,g) ((m)->key_sym_map[k].kt_index[g&0x3])
+#define        XkbCMKeyType(m,k,g)      (&(m)->types[XkbCMKeyTypeIndex(m,k,g)])
+#define        XkbCMKeyNumSyms(m,k) (XkbCMKeyGroupsWidth(m,k)*XkbCMKeyNumGroups(m,k))
+#define        XkbCMKeySymsOffset(m,k) ((m)->key_sym_map[k].offset)
+#define        XkbCMKeySymsPtr(m,k)    (&(m)->syms[XkbCMKeySymsOffset(m,k)])
+
+       /*
+        * Compatibility structures and access macros
+        */
+
+typedef struct _XkbSymInterpretRec {
+       KeySym          sym;
+       unsigned char   flags;
+       unsigned char   match;
+       unsigned char   mods;
+       unsigned char   virtual_mod;
+       XkbAnyAction    act;
+} XkbSymInterpretRec,*XkbSymInterpretPtr;
+
+typedef struct _XkbCompatMapRec {
+       XkbSymInterpretPtr       sym_interpret;
+       XkbModsRec               groups[XkbNumKbdGroups];
+       unsigned short           num_si;
+       unsigned short           size_si;
+} XkbCompatMapRec, *XkbCompatMapPtr;
+
+typedef struct _XkbIndicatorMapRec {
+       unsigned char   flags;
+       unsigned char   which_groups;
+       unsigned char   groups;
+       unsigned char   which_mods;
+       XkbModsRec      mods;
+       unsigned int    ctrls;
+} XkbIndicatorMapRec, *XkbIndicatorMapPtr;
+
+#define        XkbIM_IsAuto(i) ((((i)->flags&XkbIM_NoAutomatic)==0)&&\
+                           (((i)->which_groups&&(i)->groups)||\
+                            ((i)->which_mods&&(i)->mods.mask)||\
+                            ((i)->ctrls)))
+#define        XkbIM_InUse(i)  (((i)->flags)||((i)->which_groups)||\
+                                       ((i)->which_mods)||((i)->ctrls))
+       
+
+typedef struct _XkbIndicatorRec {
+       unsigned long           phys_indicators;
+       XkbIndicatorMapRec      maps[XkbNumIndicators];
+} XkbIndicatorRec,*XkbIndicatorPtr;
+
+typedef        struct _XkbKeyNameRec {
+       char    name[XkbKeyNameLength];
+} XkbKeyNameRec,*XkbKeyNamePtr;
+
+typedef struct _XkbKeyAliasRec {
+       char    real[XkbKeyNameLength];
+       char    alias[XkbKeyNameLength];
+} XkbKeyAliasRec,*XkbKeyAliasPtr;
+
+       /*
+        * Names for everything 
+        */
+typedef struct _XkbNamesRec {
+       Atom              keycodes;
+       Atom              geometry;
+       Atom              symbols;
+       Atom              types;
+       Atom              compat;
+       Atom              vmods[XkbNumVirtualMods];
+       Atom              indicators[XkbNumIndicators];
+       Atom              groups[XkbNumKbdGroups];
+       XkbKeyNamePtr     keys;
+       XkbKeyAliasPtr    key_aliases;
+       Atom             *radio_groups;
+       Atom              phys_symbols;
+
+       unsigned char     num_keys;
+       unsigned char     num_key_aliases;
+       unsigned short    num_rg;
+} XkbNamesRec,*XkbNamesPtr;
+
+typedef        struct _XkbGeometry     *XkbGeometryPtr;
+       /*
+        * Tie it all together into one big keyboard description
+        */
+typedef        struct _XkbDesc {
+       struct _XDisplay *      dpy;
+       unsigned short          flags;
+       unsigned short          device_spec;
+       KeyCode                 min_key_code;
+       KeyCode                 max_key_code;
+
+       XkbControlsPtr          ctrls;
+       XkbServerMapPtr         server;
+       XkbClientMapPtr         map;
+       XkbIndicatorPtr         indicators;
+       XkbNamesPtr             names;
+       XkbCompatMapPtr         compat;
+       XkbGeometryPtr          geom;
+} XkbDescRec, *XkbDescPtr;
+#define        XkbKeyKeyTypeIndex(d,k,g)       (XkbCMKeyTypeIndex((d)->map,k,g))
+#define        XkbKeyKeyType(d,k,g)            (XkbCMKeyType((d)->map,k,g))
+#define        XkbKeyGroupWidth(d,k,g)         (XkbCMKeyGroupWidth((d)->map,k,g))
+#define        XkbKeyGroupsWidth(d,k)          (XkbCMKeyGroupsWidth((d)->map,k))
+#define        XkbKeyGroupInfo(d,k)            (XkbCMKeyGroupInfo((d)->map,(k)))
+#define        XkbKeyNumGroups(d,k)            (XkbCMKeyNumGroups((d)->map,(k)))
+#define        XkbKeyNumSyms(d,k)              (XkbCMKeyNumSyms((d)->map,(k)))
+#define        XkbKeySymsPtr(d,k)              (XkbCMKeySymsPtr((d)->map,(k)))
+#define        XkbKeySym(d,k,n)                (XkbKeySymsPtr(d,k)[n])
+#define        XkbKeySymEntry(d,k,sl,g) \
+       (XkbKeySym(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl))))
+#define        XkbKeyAction(d,k,n) \
+       (XkbKeyHasActions(d,k)?&XkbKeyActionsPtr(d,k)[n]:NULL)
+#define        XkbKeyActionEntry(d,k,sl,g) \
+       (XkbKeyHasActions(d,k)?\
+               XkbKeyAction(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl))):NULL)
+
+#define        XkbKeyHasActions(d,k)   ((d)->server->key_acts[k]!=0)
+#define        XkbKeyNumActions(d,k)   (XkbKeyHasActions(d,k)?XkbKeyNumSyms(d,k):1)
+#define        XkbKeyActionsPtr(d,k)   (XkbSMKeyActionsPtr((d)->server,k))
+#define        XkbKeycodeInRange(d,k)  (((k)>=(d)->min_key_code)&&\
+                                ((k)<=(d)->max_key_code))
+#define        XkbNumKeys(d)           ((d)->max_key_code-(d)->min_key_code+1)
+
+
+       /*
+        * The following structures can be used to track changes
+        * to a keyboard device
+        */
+typedef struct _XkbMapChanges {
+       unsigned short           changed;
+       KeyCode                  min_key_code;
+       KeyCode                  max_key_code;
+       unsigned char            first_type;
+       unsigned char            num_types;
+       KeyCode                  first_key_sym;
+       unsigned char            num_key_syms;
+       KeyCode                  first_key_act;
+       unsigned char            num_key_acts;
+       KeyCode                  first_key_behavior;
+       unsigned char            num_key_behaviors;
+       KeyCode                  first_key_explicit;
+       unsigned char            num_key_explicit;
+       KeyCode                  first_modmap_key;
+       unsigned char            num_modmap_keys;
+       KeyCode                  first_vmodmap_key;
+       unsigned char            num_vmodmap_keys;
+       unsigned char            pad;
+       unsigned short           vmods;
+} XkbMapChangesRec,*XkbMapChangesPtr;
+
+typedef struct _XkbControlsChanges {
+       unsigned int             changed_ctrls;
+       unsigned int             enabled_ctrls_changes;
+       Bool                     num_groups_changed;
+} XkbControlsChangesRec,*XkbControlsChangesPtr;
+
+typedef struct _XkbIndicatorChanges {
+       unsigned int             state_changes;
+       unsigned int             map_changes;
+} XkbIndicatorChangesRec,*XkbIndicatorChangesPtr;
+
+typedef struct _XkbNameChanges {
+       unsigned int            changed;
+       unsigned char           first_type;
+       unsigned char           num_types;
+       unsigned char           first_lvl;
+       unsigned char           num_lvls;
+       unsigned char           num_aliases;
+       unsigned char           num_rg;
+       unsigned char           first_key;
+       unsigned char           num_keys;
+       unsigned short          changed_vmods;
+       unsigned long           changed_indicators;
+       unsigned char           changed_groups;
+} XkbNameChangesRec,*XkbNameChangesPtr;
+
+typedef struct _XkbCompatChanges {
+       unsigned char           changed_groups;
+       unsigned short          first_si;
+       unsigned short          num_si;
+} XkbCompatChangesRec,*XkbCompatChangesPtr;
+
+typedef struct _XkbChanges {
+       unsigned short           device_spec;
+       unsigned short           state_changes;
+       XkbMapChangesRec         map;
+       XkbControlsChangesRec    ctrls;
+       XkbIndicatorChangesRec   indicators;
+       XkbNameChangesRec        names;
+       XkbCompatChangesRec      compat;
+} XkbChangesRec, *XkbChangesPtr;
+
+       /*
+        * These data structures are used to construct a keymap from 
+        * a set of components or to list components in the server
+        * database.
+        */
+typedef struct _XkbComponentNames {
+       char *                   keymap;
+       char *                   keycodes;
+       char *                   types;
+       char *                   compat;
+       char *                   symbols;
+       char *                   geometry;
+} XkbComponentNamesRec, *XkbComponentNamesPtr;
+
+typedef struct _XkbComponentName {
+       unsigned short          flags;
+       char *                  name;
+} XkbComponentNameRec,*XkbComponentNamePtr;
+
+typedef struct _XkbComponentList {
+       int                     num_keymaps;
+       int                     num_keycodes;
+       int                     num_types;
+       int                     num_compat;
+       int                     num_symbols;
+       int                     num_geometry;
+       XkbComponentNamePtr     keymaps;
+       XkbComponentNamePtr     keycodes;
+       XkbComponentNamePtr     types;
+       XkbComponentNamePtr     compat;
+       XkbComponentNamePtr     symbols;
+       XkbComponentNamePtr     geometry;
+} XkbComponentListRec, *XkbComponentListPtr;
+
+       /*
+        * The following data structures describe and track changes to a 
+        * non-keyboard extension device 
+        */
+typedef struct _XkbDeviceLedInfo {
+       unsigned short                  led_class;
+       unsigned short                  led_id;
+       unsigned int                    phys_indicators;
+       unsigned int                    maps_present;
+       unsigned int                    names_present;
+       unsigned int                    state;
+       Atom                            names[XkbNumIndicators];
+       XkbIndicatorMapRec              maps[XkbNumIndicators];
+} XkbDeviceLedInfoRec,*XkbDeviceLedInfoPtr;
+
+typedef struct _XkbDeviceInfo {
+       char *                  name;
+       Atom                    type;
+       unsigned short          device_spec;
+       Bool                    has_own_state;
+       unsigned short          supported;
+       unsigned short          unsupported;
+
+       unsigned short          num_btns;
+       XkbAction *             btn_acts;
+
+       unsigned short          sz_leds;
+       unsigned short          num_leds;
+       unsigned short          dflt_kbd_fb;
+       unsigned short          dflt_led_fb;
+       XkbDeviceLedInfoPtr     leds;
+} XkbDeviceInfoRec,*XkbDeviceInfoPtr;
+
+#define        XkbXI_DevHasBtnActs(d)  (((d)->num_btns>0)&&((d)->btn_acts!=NULL))
+#define        XkbXI_LegalDevBtn(d,b)  (XkbXI_DevHasBtnActs(d)&&((b)<(d)->num_btns))
+#define        XkbXI_DevHasLeds(d)     (((d)->num_leds>0)&&((d)->leds!=NULL))
+
+typedef struct _XkbDeviceLedChanges {
+       unsigned short          led_class;
+       unsigned short          led_id;
+       unsigned int            defined; /* names or maps changed */
+       struct _XkbDeviceLedChanges *next;
+} XkbDeviceLedChangesRec,*XkbDeviceLedChangesPtr;
+
+typedef struct _XkbDeviceChanges {
+       unsigned int            changed;
+       unsigned short          first_btn;
+       unsigned short          num_btns;
+       XkbDeviceLedChangesRec  leds;
+} XkbDeviceChangesRec,*XkbDeviceChangesPtr;
+
+#endif /* _XKBSTR_H_ */
diff --git a/autogen.sh b/autogen.sh
new file mode 100644 (file)
index 0000000..904cd67
--- /dev/null
@@ -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/configure.ac b/configure.ac
new file mode 100755 (executable)
index 0000000..1a7ab4a
--- /dev/null
@@ -0,0 +1,13 @@
+AC_PREREQ([2.60])
+AC_INIT([KBProto], [1.0.5], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
+AM_INIT_AUTOMAKE([foreign dist-bzip2])
+AM_MAINTAINER_MODE
+
+# Require xorg-macros: XORG_DEFAULT_OPTIONS
+m4_ifndef([XORG_MACROS_VERSION],
+          [m4_fatal([must install xorg-macros 1.3 or later before running autoconf/autogen])])
+XORG_MACROS_VERSION(1.3)
+XORG_DEFAULT_OPTIONS
+
+AC_OUTPUT([Makefile
+           kbproto.pc])
diff --git a/debian/README.source b/debian/README.source
new file mode 100644 (file)
index 0000000..34ab4bf
--- /dev/null
@@ -0,0 +1,73 @@
+------------------------------------------------------
+Quick Guide To Patching This Package For The Impatient
+------------------------------------------------------
+
+1. Make sure you have quilt installed
+2. Unpack the package as usual with "dpkg-source -x"
+3. Run the "patch" target in debian/rules
+4. Create a new patch with "quilt new" (see quilt(1))
+5. Edit all the files you want to include in the patch with "quilt edit" 
+   (see quilt(1)).
+6. Write the patch with "quilt refresh" (see quilt(1))
+7. Run the "clean" target in debian/rules
+
+Alternatively, instead of using quilt directly, you can drop the patch in to 
+debian/patches and add the name of the patch to debian/patches/series.
+
+------------------------------------
+Guide To The X Strike Force Packages
+------------------------------------
+
+The X Strike Force team maintains X packages in git repositories on
+git.debian.org in the pkg-xorg subdirectory. Most upstream packages
+are actually maintained in git repositories as well, so they often
+just need to be pulled into git.debian.org in a "upstream-*" branch.
+Otherwise, the upstream sources are manually installed in the Debian
+git repository.
+
+The .orig.tar.gz upstream source file could be generated this
+"upstream-*" branch in the Debian git repository but it is actually
+copied from upstream tarballs directly.
+
+Due to X.org being highly modular, packaging all X.org applications
+as their own independent packages would have created too many Debian
+packages. For this reason, some X.org applications have been grouped
+into larger packages: xutils, xutils-dev, x11-apps, x11-session-utils,
+x11-utils, x11-xfs-utils, x11-xkb-utils, x11-xserver-utils.
+Most packages, including the X.org server itself and all libraries
+and drivers are, however maintained independently.
+
+The Debian packaging is added by creating the "debian-*" git branch
+which contains the aforementioned "upstream-*" branch plus the debian/
+repository files.
+When a patch has to be applied to the Debian package, two solutions
+are involved:
+* If the patch is available in one of the upstream branches, it
+  may be git'cherry-picked into the Debian repository. In this
+  case, it appears directly in the .diff.gz.
+* Otherwise, the patch is added to debian/patches/ which is managed
+  with quilt as documented in /usr/share/doc/quilt/README.source.
+
+quilt is actually invoked by the Debian X packaging through a larger
+set of scripts called XSFBS. XSFBS brings some other X specific
+features such as managing dependencies and conflicts due to the video
+and input driver ABIs.
+XSFBS itself is maintained in a separate repository at
+  git://git.debian.org/pkg-xorg/xsfbs.git
+and it is pulled inside the other Debian X repositories when needed.
+
+The XSFBS patching system requires a build dependency on quilt. Also
+a dependency on $(STAMP_DIR)/patch has to be added to debian/rules
+so that the XSFBS patching occurs before the actual build. So the
+very first target of the build (likely the one running autoreconf)
+should depend on $(STAMP_DIR)/patch. It should also not depend on
+anything so that parallel builds are correctly supported (nothing
+should probably run while patching is being done). And finally, the
+clean target should depend on the xsfclean target so that patches
+are unapplied on clean.
+
+When the upstream sources contain some DFSG-nonfree files, they are
+listed in text files in debian/prune/ in the "debian-*" branch of
+the Debian repository. XSFBS' scripts then take care of removing
+these listed files during the build so as to generate a modified
+DFSG-free .orig.tar.gz tarball.
diff --git a/debian/changelog b/debian/changelog
new file mode 100755 (executable)
index 0000000..0b0c021
--- /dev/null
@@ -0,0 +1,116 @@
+x11proto-kb (1.0.5-1slp2) unstable; urgency=low
+
+  * [X11R7.6] upgrade package
+  * Git: 165.213.180.234:slp/pkgs/xorg/proto/x11proto-kb
+  * Tag: x11proto-kb_1.0.5-1slp2
+
+ -- SooChan Lim <sc1.lim@samsung.com>  Mon, 03 Jan 2011 20:18:38 +0900
+
+x11proto-kb (1.0.4-4slp2) unstable; urgency=low
+
+  * Fix Git repository and modify maintainer info
+  * Git: 165.213.180.234:/git/slp/pkgs/xorg/proto/x11proto-kb
+  * Tag: x11proto-kb_1.0.4-4slp2
+
+ -- Sung-Jin Park <sj76.park@samsung.com>  Thu, 02 Dec 2010 11:46:35 +0900
+
+x11proto-kb (1.0.4-3slp2) unstable; urgency=low
+
+  * Update maintainer
+  * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/X11
+  * Tag: x11proto-kb_1.0.4-3slp2
+
+ -- Sung-Jin Park <sj76.park@samsung.com>  Wed, 21 Apr 2010 11:21:09 +0900
+
+x11proto-kb (1.0.4-2slp2) unstable; urgency=low
+
+  * Changed package name as a pure open souroce code.
+
+ -- YoungHoon Jung <yhoon.jung@samsung.com>  Thu, 25 Mar 2010 17:02:10 +0900
+
+x11proto-kb (1.0.4-1) unstable; urgency=low
+
+  [ Timo Aaltonen ]
+  * New upstream release (closes: #556006).
+  * Add README.source from xsfbs. Bump Standards-Version to 3.8.3.
+  * Bump debhelper compat level to 5.
+  * Drop Conflicts/Replaces on libxkbfile-dev and Pre-Depends on x11-common.
+    This was needed for upgrades from sarge.
+  * Parse space-separated DEB_BUILD_OPTIONS, and handle parallel=N.
+  * Run autoreconf on build. Add build-deps on automake and xutils-dev.
+  * Bump the build-dep on xutils-dev (>= 1:7.5~1).
+
+ -- Julien Cristau <jcristau@debian.org>  Sat, 21 Nov 2009 13:31:13 +0100
+
+x11proto-kb (1.0.3-3) unstable; urgency=low
+
+  [ Brice Goglin ]
+  * Update the long description.
+  * Add URL in debian/copyright.
+  * Add Vcs-* to debian/control.
+  * Remove Fabio from Uploaders, with his permission.
+
+  [ Julien Cristau ]
+  * Remove Branden from Uploaders with his permission.
+  * Add myself to Uploaders.
+  * Bump Standards-Version to 3.7.3.
+
+ -- Julien Cristau <jcristau@debian.org>  Sun, 11 May 2008 19:05:39 +0200
+
+x11proto-kb (1.0.3-2) unstable; urgency=low
+
+  * Upload to unstable
+
+ -- David Nusinow <dnusinow@debian.org>  Mon, 21 Aug 2006 21:18:42 +0000
+
+x11proto-kb (1.0.3-1) experimental; urgency=low
+
+  * New upstream release.
+  * Test for obj-$(DEB_BUILD_GNU_TYPE) before creating it during build;
+    idempotency fix.
+  * Run dh_install w/ --list-missing.
+  * Change debhelper build-dep-indep to a normal build-dep, as dh_clean
+    is called inside the clean rule.
+  * Drop duplicate x11-common dep in -dev package.
+  * Bump standards version to 3.7.2.0.
+  * Version x11-common pre-dep in -dev package to 1:7.0.0 to match
+    the rest of Debian.
+
+ -- Andres Salomon <dilinger@debian.org>  Fri, 21 Jul 2006 02:57:25 -0400
+
+x11proto-kb (1.0.2-3) unstable; urgency=low
+
+  * Upload to unstable
+
+ -- David Nusinow <dnusinow@debian.org>  Thu, 23 Mar 2006 21:36:07 -0500
+
+x11proto-kb (1.0.2-2) experimental; urgency=low
+
+  * Add epoch to versioned Pre-Depends on x11-common to make upgrades
+    from monolithic x11-common work (Closes: #351779).
+
+ -- Michel Dänzer <daenzer@debian.org>  Thu,  9 Feb 2006 16:40:59 +0100
+
+x11proto-kb (1.0.2-1) experimental; urgency=low
+
+  * First release to Debian
+
+ -- David Nusinow <dnusinow@debian.org>  Fri, 30 Dec 2005 14:36:09 -0500
+
+x11proto-kb (1.0+cvs.20050817-1) breezy; urgency=low
+
+  * Update to today's CVS, which includes DeviceUnwrap functions.
+
+ -- Daniel Stone <daniel.stone@ubuntu.com>  Wed, 17 Aug 2005 23:02:54 +1000
+
+x11proto-kb (1.0-2) breezy; urgency=low
+
+  * Add Conflicts/Replaces on libxkbfile-dev.
+
+ -- Daniel Stone <daniel.stone@ubuntu.com>  Wed, 25 May 2005 11:53:28 +1000
+
+x11proto-kb (1.0-1) breezy; urgency=low
+
+  * First x11proto-kb release.
+
+ -- Daniel Stone <daniel.stone@ubuntu.com>  Mon, 16 May 2005 22:10:17 +1000
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100755 (executable)
index 0000000..8d967cc
--- /dev/null
@@ -0,0 +1,26 @@
+Source: x11proto-kb
+Section: x11
+Priority: optional
+Maintainer: Sung-Jin Park <sj76.park@samsung.com>, Sangjin Lee <lsj119@samsung.com>, Debian X Strike Force <debian-x@lists.debian.org>
+Uploaders: SooChan Lim <sc1.lim@samsung.com>, Sung-Jin Park <sj76.park@samsung.com>, David Nusinow <dnusinow@debian.org>, Andres Salomon <dilinger@debian.org>, Julien Cristau <jcristau@debian.org>
+Build-Depends: debhelper (>= 5.0.0), automake, xutils-dev (>= 1:7.3~1)
+Standards-Version: 3.8.3
+Vcs-Git: git://git.debian.org/git/pkg-xorg/proto/x11proto-kb
+Vcs-Browser: http://git.debian.org/?p=pkg-xorg/proto/x11proto-kb.git
+
+Package: x11proto-kb-dev
+Architecture: all
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: X11 XKB extension wire protocol
+ This package provides development headers describing the wire protocol
+ for the XKEYBOARD extension, used to control all manner of options
+ related to keyboard handling and layout in particular.
+ It does not control the addition/enabling/disabling of keyboards;
+ this is done with the XINPUT extension.
+ .
+ More information about X.Org can be found at:
+ <URL:http://www.X.org>
+ <URL:http://xorg.freedesktop.org>
+ <URL:http://lists.freedesktop.org/mailman/listinfo/xorg>
+ .
+ This package is built from the X.org kbproto proto module.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..c2f4f88
--- /dev/null
@@ -0,0 +1,25 @@
+This package was downloaded from
+http://xorg.freedesktop.org/releases/individual/proto/
+
+Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be 
+used in advertising or publicity pertaining to distribution 
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability 
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..4925583
--- /dev/null
@@ -0,0 +1,98 @@
+#!/usr/bin/make -f
+# debian/rules for the Debian x11proto-kb-dev package.
+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>
+# Copyright © 2005 Daniel Stone <daniel@fooishbar.org>
+# Copyright © 2005 David Nusinow <dnusinow@debian.org>
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+PACKAGE = x11proto-kb-dev
+
+include debian/xsfbs/xsfbs.mk
+
+CFLAGS = -Wall -g
+ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -O0
+else
+       CFLAGS += -O2
+endif
+ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+       NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+       MAKEFLAGS += -j$(NUMJOBS)
+endif
+
+DEB_HOST_ARCH      ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
+DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
+       confflags += --build=$(DEB_HOST_GNU_TYPE)
+else
+       confflags += --build=$(DEB_HOST_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
+#      confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
+endif
+
+
+build: build-stamp
+build-stamp:
+       dh_testdir
+
+       autoreconf -vfi
+       mkdir -p obj-$(DEB_BUILD_GNU_TYPE)
+       cd obj-$(DEB_BUILD_GNU_TYPE) && \
+       ../configure --prefix=/usr --mandir=\$${prefix}/share/man \
+                    --infodir=\$${prefix}/share/info --disable-shared \
+                    $(confflags) CFLAGS="$(CFLAGS)" 
+       cd obj-$(DEB_BUILD_GNU_TYPE) && $(MAKE)
+
+       >$@
+
+clean:
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp
+
+       rm -f config.cache config.log config.status config.guess config.sub
+       rm -f */config.cache */config.log */config.status */config.guess */config.sub
+       rm -f conftest* */conftest*
+       rm -rf autom4te.cache */autom4te.cache
+       rm -rf obj-*
+       rm -f aclocal.m4 configure install-sh missing mkinstalldirs
+       find -name Makefile.in -exec rm -f {} \;
+       #find -name Makefile.in -delete
+
+       dh_clean
+
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k
+       dh_installdirs
+
+       cd obj-$(DEB_BUILD_GNU_TYPE) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+
+# Build architecture-independent files here.
+binary-indep: build install
+       dh_testdir
+       dh_testroot
+
+#      dh_installdocs
+#      dh_installman
+       dh_install --sourcedir=debian/tmp --list-missing
+#      dh_installchangelogs
+       dh_link
+       dh_strip
+       dh_compress
+       dh_fixperms
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+# Build architecture-dependent files here.
+binary-arch: build install
+# Nothing to do
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
diff --git a/debian/watch b/debian/watch
new file mode 100644 (file)
index 0000000..426f70d
--- /dev/null
@@ -0,0 +1,2 @@
+version=3
+http://xorg.freedesktop.org/releases/individual/proto/ kbproto-(.*)\.tar\.gz
diff --git a/debian/x11proto-kb-dev.install b/debian/x11proto-kb-dev.install
new file mode 100644 (file)
index 0000000..7ab11d6
--- /dev/null
@@ -0,0 +1,2 @@
+usr/include/X11/extensions/*
+usr/lib/pkgconfig/kbproto.pc
diff --git a/debian/xsfbs/repack.sh b/debian/xsfbs/repack.sh
new file mode 100644 (file)
index 0000000..5935cc9
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+set -e
+
+if ! [ -d debian/prune ]; then
+       exit 0
+fi
+
+if [ "x$1" != x--upstream-version ]; then
+       exit 1
+fi
+
+version="$2"
+filename="$3"
+
+if [ -z "$version" ] || ! [ -f "$filename" ]; then
+       exit 1
+fi
+
+dir="$(pwd)"
+tempdir="$(mktemp -d)"
+
+cd "$tempdir"
+tar xf "$dir/$filename"
+cat "$dir"/debian/prune/* | while read file; do rm -f */$file; done
+
+tar czf "$dir/$filename" *
+cd "$dir"
+rm -rf "$tempdir"
+echo "Done pruning upstream tarball"
+
+exit 0
diff --git a/debian/xsfbs/xsfbs.mk b/debian/xsfbs/xsfbs.mk
new file mode 100644 (file)
index 0000000..f0f8953
--- /dev/null
@@ -0,0 +1,293 @@
+#!/usr/bin/make -f
+
+# Debian X Strike Force Build System (XSFBS): Make portion
+
+# Copyright 1996 Stephen Early
+# Copyright 1997 Mark Eichin
+# Copyright 1998-2005, 2007 Branden Robinson
+# Copyright 2005 David Nusinow
+#
+# Licensed under the GNU General Public License, version 2.  See the file
+# /usr/share/common-licenses/GPL or <http://www.gnu.org/copyleft/gpl.txt>.
+
+# Originally by Stephen Early <sde1000@debian.org>
+# Modified by Mark W. Eichin <eichin@kitten.gen.ma.us>
+# Modified by Adam Heath <doogie@debian.org>
+# Modified by Branden Robinson <branden@debian.org>
+# Modified by Fabio Massimo Di Nitto <fabbione@fabbione.net>
+# Modified by David Nusinow <dnusinow@debian.org>
+# Acknowledgements to Manoj Srivastava.
+
+# Pass $(DH_OPTIONS) into the environment for debhelper's benefit.
+export DH_OPTIONS
+
+# force quilt to not use ~/.quiltrc and to use debian/patches
+QUILT = QUILT_PATCHES=debian/patches quilt --quiltrc /dev/null
+
+# Set up parameters for the upstream build environment.
+
+# Determine (source) package name from Debian changelog.
+SOURCE_NAME:=$(shell dpkg-parsechangelog -ldebian/changelog \
+                        | grep '^Source:' | awk '{print $$2}')
+
+# Determine package version from Debian changelog.
+SOURCE_VERSION:=$(shell dpkg-parsechangelog -ldebian/changelog \
+                        | grep '^Version:' | awk '{print $$2}')
+
+# Determine upstream version number.
+UPSTREAM_VERSION:=$(shell echo $(SOURCE_VERSION) | sed 's/-.*//')
+
+# Determine the source version without the epoch for make-orig-tar-gz
+NO_EPOCH_VER:=$(shell echo $(UPSTREAM_VERSION) | sed 's/^.://')
+
+# Figure out who's building this package.
+BUILDER:=$(shell echo $${DEBEMAIL:-$${EMAIL:-$$(echo $$LOGNAME@$$(cat /etc/mailname 2>/dev/null))}})
+
+# Find out if this is an official build; an official build has nothing but
+# digits, dots, and/or the codename of a release in the Debian part of the
+# version number.  Anything else indicates an unofficial build.
+OFFICIAL_BUILD:=$(shell VERSION=$(SOURCE_VERSION); if ! expr "$$(echo $${VERSION\#\#*-} | sed 's/\(woody\|sarge\|etch\|lenny\)//g')" : ".*[^0-9.].*" >/dev/null 2>&1; then echo yes; fi)
+
+# Set up parameters for the Debian build environment.
+
+# Determine our architecture.
+BUILD_ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
+# Work around some old-time dpkg braindamage.
+BUILD_ARCH:=$(subst i486,i386,$(BUILD_ARCH))
+# The DEB_HOST_ARCH variable may be set per the Debian cross-compilation policy.
+ifdef DEB_HOST_ARCH
+ ARCH:=$(DEB_HOST_ARCH)
+else
+ # dpkg-cross sets the ARCH environment variable; if set, use it.
+ ifdef ARCH
+  ARCH:=$(ARCH)
+ else
+  ARCH:=$(BUILD_ARCH)
+ endif
+endif
+
+# $(STAMP_DIR) houses stamp files for complex targets.
+STAMP_DIR:=stampdir
+
+# $(DEBTREEDIR) is where all install rules are told (via $(DESTDIR)) to place
+# their files.
+DEBTREEDIR:=$(CURDIR)/debian/tmp
+
+# All "important" targets have four lines:
+#   1) A target name that is invoked by a package-building tool or the user.
+#      This consists of a dependency on a "$(STAMP_DIR)/"-prefixed counterpart.
+#   2) A line delcaring 1) as a phony target (".PHONY:").
+#   3) A "$(STAMP_DIR)/"-prefixed target which does the actual work, and may
+#   depend on other targets.
+#   4) A line declaring 3) as a member of the $(stampdir_targets) variable; the
+#   "$(STAMP_DIR)/" prefix is omitted.
+#
+# This indirection is needed so that the "stamp" files that signify when a rule
+# is done can be located in a separate "stampdir".  Recall that make has no way
+# to know when a goal has been met for a phony target (like "build" or
+# "install").
+#
+# At the end of each "$(STAMP_DIR)/" target, be sure to run the command ">$@"
+# so that the target will not be run again.  Removing the file will make Make
+# run the target over.
+
+# All phony targets should be declared as dependencies of .PHONY, even if they
+# do not have "($STAMP_DIR)/"-prefixed counterparts.
+
+# Define a harmless default rule to keep things from going nuts by accident.
+.PHONY: default
+default:
+
+# Set up the $(STAMP_DIR) directory.
+.PHONY: stampdir
+stampdir_targets+=stampdir
+stampdir: $(STAMP_DIR)/stampdir
+$(STAMP_DIR)/stampdir:
+       mkdir $(STAMP_DIR)
+       >$@
+
+# Set up the package build directory as quilt expects to find it.
+.PHONY: prepare
+stampdir_targets+=prepare
+prepare: $(STAMP_DIR)/prepare
+$(STAMP_DIR)/prepare: $(STAMP_DIR)/log $(STAMP_DIR)/genscripts
+       >$@
+
+.PHONY: log
+stampdir_targets+=log
+log: $(STAMP_DIR)/log
+$(STAMP_DIR)/log: $(STAMP_DIR)/stampdir
+       mkdir -p $(STAMP_DIR)/log
+
+# Apply all patches to the upstream source.
+.PHONY: patch
+stampdir_targets+=patch
+patch: $(STAMP_DIR)/patch
+$(STAMP_DIR)/patch: $(STAMP_DIR)/prepare
+       if ! [ `which quilt` ]; then \
+               echo "Couldn't find quilt. Please install it or add it to the build-depends for this package."; \
+               exit 1; \
+       fi; \
+       if $(QUILT) next >/dev/null 2>&1; then \
+         echo -n "Applying patches..."; \
+         if $(QUILT) push -a -v >$(STAMP_DIR)/log/patch 2>&1; then \
+           cat $(STAMP_DIR)/log/patch; \
+           echo "successful."; \
+         else \
+           cat $(STAMP_DIR)/log/patch; \
+           echo "failed! (check $(STAMP_DIR)/log/patch for details)"; \
+           exit 1; \
+         fi; \
+       else \
+         echo "No patches to apply"; \
+       fi; \
+       >$@
+
+# Revert all patches to the upstream source.
+.PHONY: unpatch
+unpatch: $(STAMP_DIR)/log
+       rm -f $(STAMP_DIR)/patch
+       @echo -n "Unapplying patches..."; \
+       if $(QUILT) applied >/dev/null 2>/dev/null; then \
+         if $(QUILT) pop -a -v >$(STAMP_DIR)/log/unpatch 2>&1; then \
+           cat $(STAMP_DIR)/log/unpatch; \
+           echo "successful."; \
+         else \
+           cat $(STAMP_DIR)/log/unpatch; \
+           echo "failed! (check $(STAMP_DIR)/log/unpatch for details)"; \
+           exit 1; \
+         fi; \
+       else \
+         echo "nothing to do."; \
+       fi
+
+# Clean the generated maintainer scripts.
+.PHONY: cleanscripts
+cleanscripts:
+       rm -f $(STAMP_DIR)/genscripts
+       rm -f debian/*.config \
+             debian/*.postinst \
+             debian/*.postrm \
+             debian/*.preinst \
+             debian/*.prerm
+
+# Clean the package build tree.
+.PHONY: xsfclean
+xsfclean: cleanscripts unpatch
+       dh_testdir
+       rm -rf .pc
+       rm -rf $(STAMP_DIR) $(SOURCE_DIR)
+       rm -rf imports
+       dh_clean debian/shlibs.local \
+                debian/po/pothead
+
+# Generate the debconf templates POT file header.
+debian/po/pothead: debian/po/pothead.in
+       sed -e 's/SOURCE_VERSION/$(SOURCE_VERSION)/' \
+         -e 's/DATE/$(shell date "+%F %X%z"/)' <$< >$@
+
+# Update POT and PO files.
+.PHONY: updatepo
+updatepo: debian/po/pothead
+       debian/scripts/debconf-updatepo --pot-header=pothead --verbose
+
+# Remove files from the upstream source tree that we don't need, or which have
+# licensing problems.  It must be run before creating the .orig.tar.gz.
+#
+# Note: This rule is for Debian package maintainers' convenience, and is not
+# needed for conventional build scenarios.
+.PHONY: prune-upstream-tree
+prune-upstream-tree:
+       # Ensure we're in the correct directory.
+       dh_testdir
+       grep -rvh '^#' debian/prune/ | xargs --no-run-if-empty rm -rf
+
+# Verify that there are no offsets or fuzz in the patches we apply.
+#
+# Note: This rule is for Debian package maintainers' convenience, and is not
+# needed for conventional build scenarios.
+.PHONY: patch-audit
+patch-audit: prepare unpatch
+       @echo -n "Auditing patches..."; \
+       >$(STAMP_DIR)/log/patch; \
+       FUZZY=; \
+       while [ -n "$$($(QUILT) next)" ]; do \
+         RESULT=$$($(QUILT) push -v | tee -a $(STAMP_DIR)/log/patch | grep ^Hunk | sed 's/^Hunk.*\(succeeded\|FAILED\).*/\1/');\
+         case "$$RESULT" in \
+           succeeded) \
+             echo "fuzzy patch: $$($(QUILT) top)" \
+               | tee -a $(STAMP_DIR)/log/$$($(QUILT) top); \
+             FUZZY=yes; \
+             ;; \
+           FAILED) \
+             echo "broken patch: $$($(QUILT) next)" \
+               | tee -a $(STAMP_DIR)/log/$$($(QUILT) next); \
+             exit 1; \
+             ;; \
+         esac; \
+       done; \
+       if [ -n "$$FUZZY" ]; then \
+         echo "there were fuzzy patches; please fix."; \
+         exit 1; \
+       else \
+         echo "done."; \
+       fi
+
+# Generate the maintainer scripts.
+.PHONY: genscripts
+stampdir_targets+=genscripts
+genscripts: $(STAMP_DIR)/genscripts
+$(STAMP_DIR)/genscripts: $(STAMP_DIR)/stampdir
+       for FILE in debian/*.config.in \
+                   debian/*.postinst.in \
+                   debian/*.postrm.in \
+                   debian/*.preinst.in \
+                   debian/*.prerm.in; do \
+         if [ -e "$$FILE" ]; then \
+           MAINTSCRIPT=$$(echo $$FILE | sed 's/.in$$//'); \
+           sed -n '1,/^#INCLUDE_SHELL_LIB#$$/p' <$$FILE \
+             | sed -e '/^#INCLUDE_SHELL_LIB#$$/d' >$$MAINTSCRIPT.tmp; \
+           cat debian/xsfbs/xsfbs.sh >>$$MAINTSCRIPT.tmp; \
+           sed -n '/^#INCLUDE_SHELL_LIB#$$/,$$p' <$$FILE \
+             | sed -e '/^#INCLUDE_SHELL_LIB#$$/d' >>$$MAINTSCRIPT.tmp; \
+           sed -e 's/@SOURCE_VERSION@/$(SOURCE_VERSION)/' \
+               -e 's/@OFFICIAL_BUILD@/$(OFFICIAL_BUILD)/' \
+               -e 's/@DEFAULT_DCRESOLUTIONS@/$(DEFAULT_DCRESOLUTIONS)/' \
+             <$$MAINTSCRIPT.tmp >$$MAINTSCRIPT; \
+           rm $$MAINTSCRIPT.tmp; \
+         fi; \
+       done
+       # Validate syntax of generated shell scripts.
+       #sh debian/scripts/validate-posix-sh debian/*.config \
+       #                                    debian/*.postinst \
+       #                                    debian/*.postrm \
+       #                                    debian/*.preinst \
+       #                                    debian/*.prerm
+       >$@
+
+# Generate the shlibs.local file.
+debian/shlibs.local:
+       cat debian/*.shlibs >$@
+
+SERVERMINVERS = $(shell cat /usr/share/xserver-xorg/serverminver 2>/dev/null)
+VIDEOABI = $(shell cat /usr/share/xserver-xorg/videoabiver 2>/dev/null)
+INPUTABI = $(shell cat /usr/share/xserver-xorg/inputabiver 2>/dev/null)
+SERVER_DEPENDS = xserver-xorg-core (>= $(SERVERMINVERS))
+VIDDRIVER_PROVIDES = xserver-xorg-video-$(VIDEOABI)
+INPDRIVER_PROVIDES = xserver-xorg-input-$(INPUTABI)
+ifeq ($(PACKAGE),)
+PACKAGE=$(shell awk '/^Package:/ { print $$2; exit }' < debian/control)
+endif
+
+.PHONY: serverabi
+serverabi: install
+ifeq ($(SERVERMINVERS),)
+       @echo error: xserver-xorg-dev needs to be installed
+       @exit 1
+else
+       echo "xserver:Depends=$(SERVER_DEPENDS)" >> debian/$(PACKAGE).substvars
+       echo "xviddriver:Provides=$(VIDDRIVER_PROVIDES)" >> debian/$(PACKAGE).substvars
+       echo "xinpdriver:Provides=$(INPDRIVER_PROVIDES)" >> debian/$(PACKAGE).substvars
+endif
+
+# vim:set noet ai sts=8 sw=8 tw=0:
diff --git a/debian/xsfbs/xsfbs.sh b/debian/xsfbs/xsfbs.sh
new file mode 100644 (file)
index 0000000..781826f
--- /dev/null
@@ -0,0 +1,853 @@
+# $Id$
+
+# This is the X Strike Force shell library for X Window System package
+# maintainer scripts.  It serves to define shell functions commonly used by
+# such packages, and performs some error checking necessary for proper operation
+# of those functions.  By itself, it does not "do" much; the maintainer scripts
+# invoke the functions defined here to accomplish package installation and
+# removal tasks.
+
+# If you are reading this within a Debian package maintainer script (e.g.,
+# /var/lib/dpkg)info/PACKAGE.{config,preinst,postinst,prerm,postrm}), you can
+# skip past this library by scanning forward in this file to the string
+# "GOBSTOPPER".
+
+SOURCE_VERSION=@SOURCE_VERSION@
+OFFICIAL_BUILD=@OFFICIAL_BUILD@
+
+# Use special abnormal exit codes so that problems with this library are more
+# easily tracked down.
+SHELL_LIB_INTERNAL_ERROR=86
+SHELL_LIB_THROWN_ERROR=74
+SHELL_LIB_USAGE_ERROR=99
+
+# old -> new variable names
+if [ -z "$DEBUG_XORG_PACKAGE" ] && [ -n "$DEBUG_XFREE86_PACKAGE" ]; then
+  DEBUG_XORG_PACKAGE="$DEBUG_XFREE86_PACKAGE"
+fi
+if [ -z "$DEBUG_XORG_DEBCONF" ] && [ -n "$DEBUG_XFREE86_DEBCONF" ]; then
+  DEBUG_XORG_DEBCONF="$DEBUG_XFREE86_DEBCONF"
+fi
+
+# initial sanity checks
+if [ -z "$THIS_PACKAGE" ]; then
+  cat >&2 <<EOF
+Error: package maintainer script attempted to use shell library without
+definining \$THIS_PACKAGE shell variable.  Please report the package name,
+version, and the text of this error message to the Debian Bug Tracking System.
+Visit <http://www.debian.org/Bugs/Reporting> on the World Wide Web for
+instructions, read the file /usr/share/doc/debian/bug-reporting.txt from the
+"doc-debian" package, or install the "reportbug" package and use the command of
+the same name to file a report against version $SOURCE_VERSION of this package.
+EOF
+  exit $SHELL_LIB_USAGE_ERROR
+fi
+
+if [ -z "$THIS_SCRIPT" ]; then
+  cat >&2 <<EOF
+Error: package maintainer script attempted to use shell library without
+definining \$THIS_SCRIPT shell variable.  Please report the package name,
+version, and the text of this error message to the Debian Bug Tracking System.
+Visit <http://www.debian.org/Bugs/Reporting> on the World Wide Web for
+instructions, read the file /usr/share/doc/debian/bug-reporting.txt from the
+"doc-debian" package, or install the "reportbug" package and use the command of
+the same name to file a report against version $SOURCE_VERSION of the
+"$THIS_PACKAGE" package.
+EOF
+  exit $SHELL_LIB_USAGE_ERROR
+fi
+
+if [ "$1" = "reconfigure" ] || [ -n "$DEBCONF_RECONFIGURE" ]; then
+  RECONFIGURE="true"
+else
+  RECONFIGURE=
+fi
+
+if ([ "$1" = "install" ] || [ "$1" = "configure" ]) && [ -z "$2" ]; then
+  FIRSTINST="yes"
+fi
+
+if [ -z "$RECONFIGURE" ] && [ -z "$FIRSTINST" ]; then
+  UPGRADE="yes"
+fi
+
+trap "message;\
+      message \"Received signal.  Aborting $THIS_PACKAGE package $THIS_SCRIPT script.\";\
+      message;\
+      exit 1" HUP INT QUIT TERM
+
+reject_nondigits () {
+  # syntax: reject_nondigits [ operand ... ]
+  #
+  # scan operands (typically shell variables whose values cannot be trusted) for
+  # characters other than decimal digits and barf if any are found
+  while [ -n "$1" ]; do
+    # does the operand contain anything but digits?
+    if ! expr "$1" : "[[:digit:]]\+$" > /dev/null 2>&1; then
+      # can't use die(), because it wraps message() which wraps this function
+      echo "$THIS_PACKAGE $THIS_SCRIPT error: reject_nondigits() encountered" \
+           "possibly malicious garbage \"$1\"" >&2
+      exit $SHELL_LIB_THROWN_ERROR
+    fi
+    shift
+  done
+}
+
+reject_whitespace () {
+  # syntax: reject_whitespace [ operand ]
+  #
+  # scan operand (typically a shell variable whose value cannot be trusted) for
+  # whitespace characters and barf if any are found
+  if [ -n "$1" ]; then
+    # does the operand contain any whitespace?
+    if expr "$1" : "[[:space:]]" > /dev/null 2>&1; then
+      # can't use die(), because I want to avoid forward references
+      echo "$THIS_PACKAGE $THIS_SCRIPT error: reject_whitespace() encountered" \
+           "possibly malicious garbage \"$1\"" >&2
+      exit $SHELL_LIB_THROWN_ERROR
+    fi
+  fi
+}
+
+reject_unlikely_path_chars () {
+  # syntax: reject_unlikely_path_chars [ operand ... ]
+  #
+  # scan operands (typically shell variables whose values cannot be trusted) for
+  # characters unlikely to be seen in a path and which the shell might
+  # interpret and barf if any are found
+  while [ -n "$1" ]; do
+    # does the operand contain any funny characters?
+    if expr "$1" : '.*[!$&()*;<>?|].*' > /dev/null 2>&1; then
+      # can't use die(), because I want to avoid forward references
+      echo "$THIS_PACKAGE $THIS_SCRIPT error: reject_unlikely_path_chars()" \
+           "encountered possibly malicious garbage \"$1\"" >&2
+      exit $SHELL_LIB_THROWN_ERROR
+    fi
+    shift
+  done
+}
+
+# Query the terminal to establish a default number of columns to use for
+# displaying messages to the user.  This is used only as a fallback in the
+# event the COLUMNS variable is not set.  ($COLUMNS can react to SIGWINCH while
+# the script is running, and this cannot, only being calculated once.)
+DEFCOLUMNS=$(stty size 2> /dev/null | awk '{print $2}') || true
+if ! expr "$DEFCOLUMNS" : "[[:digit:]]\+$" > /dev/null 2>&1; then
+  DEFCOLUMNS=80
+fi
+
+message () {
+  # pretty-print messages of arbitrary length
+  reject_nondigits "$COLUMNS"
+  echo "$*" | fmt -t -w ${COLUMNS:-$DEFCOLUMNS} >&2
+}
+
+observe () {
+  # syntax: observe message ...
+  #
+  # issue observational message suitable for logging someday when support for
+  # it exists in dpkg
+  if [ -n "$DEBUG_XORG_PACKAGE" ]; then
+    message "$THIS_PACKAGE $THIS_SCRIPT note: $*"
+  fi
+}
+
+warn () {
+  # syntax: warn message ...
+  #
+  # issue warning message suitable for logging someday when support for
+  # it exists in dpkg; also send to standard error
+  message "$THIS_PACKAGE $THIS_SCRIPT warning: $*"
+}
+
+die () {
+  # syntax: die message ...
+  #
+  # exit script with error message
+  message "$THIS_PACKAGE $THIS_SCRIPT error: $*"
+  exit $SHELL_LIB_THROWN_ERROR
+}
+
+internal_error () {
+  # exit script with error; essentially a "THIS SHOULD NEVER HAPPEN" message
+  message "internal error: $*"
+  if [ -n "$OFFICIAL_BUILD" ]; then
+    message "Please report a bug in the $THIS_SCRIPT script of the" \
+            "$THIS_PACKAGE package, version $SOURCE_VERSION to the Debian Bug" \
+            "Tracking System.  Include all messages above that mention the" \
+            "$THIS_PACKAGE package.  Visit " \
+            "<http://www.debian.org/Bugs/Reporting> on the World Wide Web for" \
+            "instructions, read the file" \
+            "/usr/share/doc/debian/bug-reporting.txt from the doc-debian" \
+            "package, or install the reportbug package and use the command of" \
+            "the same name to file a report."
+  fi
+  exit $SHELL_LIB_INTERNAL_ERROR
+}
+
+usage_error () {
+  message "usage error: $*"
+  message "Please report a bug in the $THIS_SCRIPT script of the" \
+          "$THIS_PACKAGE package, version $SOURCE_VERSION to the Debian Bug" \
+          "Tracking System.  Include all messages above that mention the" \
+          "$THIS_PACKAGE package.  Visit " \
+          "<http://www.debian.org/Bugs/Reporting> on the World Wide Web for" \
+          "instructions, read the file" \
+          "/usr/share/doc/debian/bug-reporting.txt from the doc-debian" \
+          "package, or install the reportbug package and use the command of" \
+          "the same name to file a report."
+  exit $SHELL_LIB_USAGE_ERROR
+}
+
+
+maplink () {
+  # returns what symlink should point to; i.e., what the "sane" answer is
+  # Keep this in sync with the debian/*.links files.
+  # This is only needed for symlinks to directories.
+  #
+  # XXX: Most of these look wrong in the X11R7 world and need to be fixed.
+  # If we've stopped using this function, fixing it might enable us to re-enable
+  # it again and catch more errors.
+  case "$1" in
+    /etc/X11/xkb/compiled) echo /var/lib/xkb ;;
+    /etc/X11/xkb/xkbcomp) echo /usr/X11R6/bin/xkbcomp ;;
+    /usr/X11R6/lib/X11/app-defaults) echo /etc/X11/app-defaults ;;
+    /usr/X11R6/lib/X11/fs) echo /etc/X11/fs ;;
+    /usr/X11R6/lib/X11/lbxproxy) echo /etc/X11/lbxproxy ;;
+    /usr/X11R6/lib/X11/proxymngr) echo /etc/X11/proxymngr ;;
+    /usr/X11R6/lib/X11/rstart) echo /etc/X11/rstart ;;
+    /usr/X11R6/lib/X11/twm) echo /etc/X11/twm ;;
+    /usr/X11R6/lib/X11/xdm) echo /etc/X11/xdm ;;
+    /usr/X11R6/lib/X11/xinit) echo /etc/X11/xinit ;;
+    /usr/X11R6/lib/X11/xkb) echo /etc/X11/xkb ;;
+    /usr/X11R6/lib/X11/xserver) echo /etc/X11/xserver ;;
+    /usr/X11R6/lib/X11/xsm) echo /etc/X11/xsm ;;
+    /usr/bin/X11) echo ../X11R6/bin ;;
+    /usr/bin/rstartd) echo ../X11R6/bin/rstartd ;;
+    /usr/include/X11) echo ../X11R6/include/X11 ;;
+    /usr/lib/X11) echo ../X11R6/lib/X11 ;;
+    *) internal_error "maplink() called with unknown path \"$1\"" ;;
+  esac
+}
+
+analyze_path () {
+  # given a supplied set of pathnames, break each one up by directory and do an
+  # ls -dl on each component, cumulatively; i.e.
+  # analyze_path /usr/X11R6/bin -> ls -dl /usr /usr/X11R6 /usr/X11R6/bin
+  # Thanks to Randolph Chung for this clever hack.
+
+  local f g
+
+  while [ -n "$1" ]; do
+    reject_whitespace "$1"
+    g=
+    message "Analyzing $1:"
+    for f in $(echo "$1" | tr / \  ); do
+      if [ -e /$g$f ]; then
+        ls -dl /$g$f /$g$f.dpkg-* 2> /dev/null || true
+        g=$g$f/
+      else
+        message "/$g$f: nonexistent; directory contents of /$g:"
+        ls -l /$g
+        break
+      fi
+    done
+    shift
+  done
+}
+
+find_culprits () {
+  local f p dpkg_info_dir possible_culprits smoking_guns bad_packages package \
+    msg
+
+  reject_whitespace "$1"
+  message "Searching for overlapping packages..."
+  dpkg_info_dir=/var/lib/dpkg/info
+  if [ -d $dpkg_info_dir ]; then
+    if [ "$(echo $dpkg_info_dir/*.list)" != "$dpkg_info_dir/*.list" ]; then
+      possible_culprits=$(ls -1 $dpkg_info_dir/*.list | egrep -v \
+        "(xbase-clients|x11-common|xfs|xlibs)")
+      if [ -n "$possible_culprits" ]; then
+        smoking_guns=$(grep -l "$1" $possible_culprits || true)
+        if [ -n "$smoking_guns" ]; then
+          bad_packages=$(printf "\\n")
+          for f in $smoking_guns; do
+            # too bad you can't nest parameter expansion voodoo
+            p=${f%*.list}      # strip off the trailing ".list"
+            package=${p##*/}   # strip off the directories
+            bad_packages=$(printf "%s\n%s" "$bad_packages" "$package")
+          done
+          msg=$(cat <<EOF
+The following packages appear to have file overlaps with the X.Org packages;
+these packages are either very old, or in violation of Debian Policy.  Try
+upgrading each of these packages to the latest available version if possible:
+for example, with the command "apt-get install".  If no newer version of a
+package is available, you will have to remove it; for example, with the command
+"apt-get remove".  If even the latest available version of the package has
+this file overlap, please file a bug against that package with the Debian Bug
+Tracking System.  You may want to refer the package maintainer to section 12.8
+of the Debian Policy manual.
+EOF
+)
+          message "$msg"
+          message "The overlapping packages are: $bad_packages"
+        else
+          message "no overlaps found."
+        fi
+      fi
+    else
+      message "cannot search; no matches for $dpkg_info_dir/*.list."
+    fi
+  else
+    message "cannot search; $dpkg_info_dir does not exist."
+  fi
+}
+
+check_symlink () {
+  # syntax: check_symlink symlink
+  #
+  # See if specified symlink points where it is supposed to.  Return 0 if it
+  # does, and 1 if it does not.
+  #
+  # Primarily used by check_symlinks_and_warn() and check_symlinks_and_bomb().
+
+  local symlink
+
+  # validate arguments
+  if [ $# -ne 1 ]; then
+    usage_error "check_symlink() called with wrong number of arguments;" \
+                "expected 1, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  symlink="$1"
+
+  if [ "$(maplink "$symlink")" = "$(readlink "$symlink")" ]; then
+    return 0
+  else
+    return 1
+  fi
+}
+
+check_symlinks_and_warn () {
+  # syntax: check_symlinks_and_warn symlink ...
+  #
+  # For each argument, check for symlink sanity, and warn if it isn't sane.
+  #
+  # Call this function from a preinst script in the event $1 is "upgrade" or
+  # "install".
+
+  local errmsg symlink
+
+  # validate arguments
+  if [ $# -lt 1 ]; then
+    usage_error "check_symlinks_and_warn() called with wrong number of" \
+                "arguments; expected at least 1, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  while [ -n "$1" ]; do
+    symlink="$1"
+    if [ -L "$symlink" ]; then
+      if ! check_symlink "$symlink"; then
+        observe "$symlink symbolic link points to wrong location" \
+                "$(readlink "$symlink"); removing"
+        rm "$symlink"
+      fi
+    elif [ -e "$symlink" ]; then
+      errmsg="$symlink exists and is not a symbolic link; this package cannot"
+      errmsg="$errmsg be installed until this"
+      if [ -f "$symlink" ]; then
+        errmsg="$errmsg file"
+      elif [ -d "$symlink" ]; then
+        errmsg="$errmsg directory"
+      else
+        errmsg="$errmsg thing"
+      fi
+      errmsg="$errmsg is removed"
+      die "$errmsg"
+    fi
+    shift
+  done
+}
+
+check_symlinks_and_bomb () {
+  # syntax: check_symlinks_and_bomb symlink ...
+  #
+  # For each argument, check for symlink sanity, and bomb if it isn't sane.
+  #
+  # Call this function from a postinst script.
+
+  local problem symlink
+
+  # validate arguments
+  if [ $# -lt 1 ]; then
+    usage_error "check_symlinks_and_bomb() called with wrong number of"
+                "arguments; expected at least 1, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  while [ -n "$1" ]; do
+    problem=
+    symlink="$1"
+    if [ -L "$symlink" ]; then
+      if ! check_symlink "$symlink"; then
+        problem=yes
+        warn "$symlink symbolic link points to wrong location" \
+             "$(readlink "$symlink")"
+      fi
+    elif [ -e "$symlink" ]; then
+      problem=yes
+      warn "$symlink is not a symbolic link"
+    else
+      problem=yes
+      warn "$symlink symbolic link does not exist"
+    fi
+    if [ -n "$problem" ]; then
+      analyze_path "$symlink" "$(readlink "$symlink")"
+      find_culprits "$symlink"
+      die "bad symbolic links on system"
+    fi
+    shift
+  done
+}
+
+font_update () {
+  # run $UPDATECMDS in $FONTDIRS
+
+  local dir cmd shortcmd x_font_dir_prefix
+
+  x_font_dir_prefix="/usr/share/fonts/X11"
+
+  if [ -z "$UPDATECMDS" ]; then
+    usage_error "font_update() called but \$UPDATECMDS not set"
+  fi
+  if [ -z "$FONTDIRS" ]; then
+    usage_error "font_update() called but \$FONTDIRS not set"
+  fi
+
+  reject_unlikely_path_chars "$UPDATECMDS"
+  reject_unlikely_path_chars "$FONTDIRS"
+
+  for dir in $FONTDIRS; do
+    if [ -d "$x_font_dir_prefix/$dir" ]; then
+      for cmd in $UPDATECMDS; do
+        if which "$cmd" > /dev/null 2>&1; then
+          shortcmd=${cmd##*/}
+          observe "running $shortcmd in $dir font directory"
+         cmd_opts=
+          if [ "$shortcmd" = "update-fonts-alias" ]; then
+            cmd_opts=--x11r7-layout
+          fi
+          if [ "$shortcmd" = "update-fonts-dir" ]; then
+            cmd_opts=--x11r7-layout
+          fi
+          if [ "$shortcmd" = "update-fonts-scale" ]; then
+            cmd_opts=--x11r7-layout
+          fi
+          $cmd $cmd_opts $dir || warn "$cmd $cmd_opts $dir" \
+                              "failed; font directory data may not" \
+                              "be up to date"
+        else
+          warn "$cmd not found; not updating corresponding $dir font" \
+               "directory data"
+        fi
+      done
+    else
+      warn "$dir is not a directory; not updating font directory data"
+    fi
+  done
+}
+
+remove_conffile_prepare () {
+  # syntax: remove_conffile_prepare filename official_md5sum ...
+  #
+  # Check a conffile "filename" against a list of canonical MD5 checksums.
+  # If the file's current MD5 checksum matches one of the "official_md5sum"
+  # operands provided, then prepare the conffile for removal from the system.
+  # We defer actual deletion until the package is configured so that we can
+  # roll this operation back if package installation fails.
+  #
+  # Call this function from a preinst script in the event $1 is "upgrade" or
+  # "install" and verify $2 to ensure the package is being upgraded from a
+  # version (or installed over a version removed-but-not-purged) prior to the
+  # one in which the conffile was obsoleted.
+
+  local conffile current_checksum
+
+  # validate arguments
+  if [ $# -lt 2 ]; then
+    usage_error "remove_conffile_prepare() called with wrong number of" \
+                "arguments; expected at least 2, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  conffile="$1"
+  shift
+
+  # does the conffile even exist?
+  if [ -e "$conffile" ]; then
+    # calculate its checksum
+    current_checksum=$(md5sum < "$conffile" | sed 's/[[:space:]].*//')
+    # compare it to each supplied checksum
+    while [ -n "$1" ]; do
+      if [ "$current_checksum" = "$1" ]; then
+        # we found a match; move the confffile and stop looking
+        observe "preparing obsolete conffile $conffile for removal"
+        mv "$conffile" "$conffile.$THIS_PACKAGE-tmp"
+        break
+      fi
+      shift
+    done
+  fi
+}
+
+remove_conffile_lookup () {
+  # syntax: remove_conffile_lookup package filename
+  #
+  # Lookup the md5sum of a conffile in dpkg's database, and prepare for removal
+  # if it matches the actual file's md5sum.
+  #
+  # Call this function when you would call remove_conffile_prepare but only
+  # want to check against dpkg's status database instead of known checksums.
+
+  local package conffile old_md5sum
+
+  # validate arguments
+  if [ $# -ne 2 ]; then
+    usage_error "remove_conffile_lookup() called with wrong number of" \
+                "arguments; expected 1, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  package="$1"
+  conffile="$2"
+
+  if ! [ -e "$conffile" ]; then
+    return
+  fi
+  old_md5sum="$(dpkg-query -W -f='${Conffiles}' "$package" | \
+    awk '{ if (match($0, "^ '"$conffile"' ")) print $2}')"
+  if [ -n "$old_md5sum" ]; then
+    remove_conffile_prepare "$conffile" "$old_md5sum"
+  fi
+}
+
+remove_conffile_commit () {
+  # syntax: remove_conffile_commit filename
+  #
+  # Complete the removal of a conffile "filename" that has become obsolete.
+  #
+  # Call this function from a postinst script after having used
+  # remove_conffile_prepare() in the preinst.
+
+  local conffile
+
+  # validate arguments
+  if [ $# -ne 1 ]; then
+    usage_error "remove_conffile_commit() called with wrong number of" \
+                "arguments; expected 1, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  conffile="$1"
+
+  # if the temporary file created by remove_conffile_prepare() exists, remove it
+  if [ -e "$conffile.$THIS_PACKAGE-tmp" ]; then
+    observe "committing removal of obsolete conffile $conffile"
+    rm "$conffile.$THIS_PACKAGE-tmp"
+  fi
+}
+
+remove_conffile_rollback () {
+  # syntax: remove_conffile_rollback filename
+  #
+  # Roll back the removal of a conffile "filename".
+  #
+  # Call this function from a postrm script in the event $1 is "abort-upgrade"
+  # or "abort-install" is  after having used remove_conffile_prepare() in the
+  # preinst.
+
+  local conffile
+
+  # validate arguments
+  if [ $# -ne 1 ]; then
+    usage_error "remove_conffile_rollback() called with wrong number of" \
+                "arguments; expected 1, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  conffile="$1"
+
+  # if the temporary file created by remove_conffile_prepare() exists, move it
+  # back
+  if [ -e "$conffile.$THIS_PACKAGE-tmp" ]; then
+    observe "rolling back removal of obsolete conffile $conffile"
+    mv "$conffile.$THIS_PACKAGE-tmp" "$conffile"
+  fi
+}
+
+replace_conffile_with_symlink_prepare () {
+  # syntax: replace_conffile_with_symlink_prepare oldfilename newfilename \
+  # official_md5sum ...
+  #
+  # Check a conffile "oldfilename" against a list of canonical MD5 checksums.
+  # If the file's current MD5 checksum matches one of the "official_md5sum"
+  # operands provided, then prepare the conffile for removal from the system.
+  # We defer actual deletion until the package is configured so that we can
+  # roll this operation back if package installation fails. Otherwise copy it
+  # to newfilename and let dpkg handle it through conffiles mechanism.
+  #
+  # Call this function from a preinst script in the event $1 is "upgrade" or
+  # "install" and verify $2 to ensure the package is being upgraded from a
+  # version (or installed over a version removed-but-not-purged) prior to the
+  # one in which the conffile was obsoleted.
+
+  local conffile current_checksum
+
+  # validate arguments
+  if [ $# -lt 3 ]; then
+    usage_error "replace_conffile_with_symlink_prepare() called with wrong" \
+                " number of arguments; expected at least 3, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  oldconffile="$1"
+  shift
+  newconffile="$1"
+  shift
+
+  remove_conffile_prepare "$_oldconffile" "$@"
+  # If $oldconffile still exists, then md5sums didn't match.
+  # Copy it to new one.
+  if [ -f "$oldconffile" ]; then
+    cp "$oldconffile" "$newconffile"
+  fi
+
+}
+
+replace_conffile_with_symlink_commit () {
+  # syntax: replace_conffile_with_symlink_commit oldfilename
+  #
+  # Complete the removal of a conffile "oldfilename" that has been
+  # replaced by a symlink.
+  #
+  # Call this function from a postinst script after having used
+  # replace_conffile_with_symlink_prepare() in the preinst.
+
+  local conffile
+
+  # validate arguments
+  if [ $# -ne 1 ]; then
+    usage_error "replace_conffile_with_symlink_commit() called with wrong" \
+                "number of arguments; expected 1, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  conffile="$1"
+
+  remove_conffile_commit "$conffile"
+}
+
+replace_conffile_with_symlink_rollback () {
+  # syntax: replace_conffile_with_symlink_rollback oldfilename newfilename
+  #
+  # Roll back the replacing of a conffile "oldfilename" with symlink to
+  # "newfilename".
+  #
+  # Call this function from a postrm script in the event $1 is "abort-upgrade"
+  # or "abort-install" and verify $2 to ensure the package failed to upgrade
+  # from a version (or install over a version removed-but-not-purged) prior
+  # to the one in which the conffile was obsoleted.
+  # You should have  used replace_conffile_with_symlink_prepare() in the
+  # preinst.
+
+  local conffile
+
+  # validate arguments
+  if [ $# -ne 2 ]; then
+    usage_error "replace_conffile_with_symlink_rollback() called with wrong" \
+                "number of arguments; expected 2, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  oldconffile="$1"
+  newconffile="$2"
+
+  remove_conffile_rollback "$_oldconffile"
+  if [ -f "$newconffile" ]; then
+    rm "$newconffile"
+  fi
+}
+
+run () {
+  # syntax: run command [ argument ... ]
+  #
+  # Run specified command with optional arguments and report its exit status.
+  # Useful for commands whose exit status may be nonzero, but still acceptable,
+  # or commands whose failure is not fatal to us.
+  #
+  # NOTE: Do *not* use this function with db_get or db_metaget commands; in
+  # those cases the return value of the debconf command *must* be checked
+  # before the string returned by debconf is used for anything.
+
+  local retval
+
+  # validate arguments
+  if [ $# -lt 1 ]; then
+    usage_error "run() called with wrong number of arguments; expected at" \
+                "least 1, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  "$@" || retval=$?
+
+  if [ ${retval:-0} -ne 0 ]; then
+    observe "command \"$*\" exited with status $retval"
+  fi
+}
+
+make_symlink_sane () {
+  # syntax: make_symlink_sane symlink target
+  #
+  # Ensure that the symbolic link symlink exists, and points to target.
+  #
+  # If symlink does not exist, create it and point it at target.
+  #
+  # If symlink exists but is not a symbolic link, back it up.
+  #
+  # If symlink exists, is a symbolic link, but points to the wrong location, fix
+  # it.
+  #
+  # If symlink exists, is a symbolic link, and already points to target, do
+  # nothing.
+  #
+  # This function wouldn't be needed if ln had an -I, --idempotent option.
+
+  # Validate arguments.
+  if [ $# -ne 2 ]; then
+    usage_error "make_symlink_sane() called with wrong number of arguments;" \
+      "expected 2, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  # We could just use the positional parameters as-is, but that makes things
+  # harder to follow.
+  local symlink target
+
+  symlink="$1"
+  target="$2"
+
+  if [ -L "$symlink" ] && [ "$(readlink "$symlink")" = "$target" ]; then
+      observe "link from $symlink to $target already exists"
+  else
+    observe "creating symbolic link from $symlink to $target"
+    mkdir -p "${target%/*}" "${symlink%/*}"
+    ln -s -b -S ".dpkg-old" "$target" "$symlink"
+  fi
+}
+
+migrate_dir_to_symlink () {
+  # syntax: migrate_dir_to_symlink old_location new_location
+  #
+  # Per Debian Policy section 6.5.4, "A directory will never be replaced by a
+  # symbolic link to a directory or vice versa; instead, the existing state
+  # (symlink or not) will be left alone and dpkg will follow the symlink if
+  # there is one."
+  #
+  # We have to do it ourselves.
+  #
+  # This function moves the contents of old_location, a directory, into
+  # new_location, a directory, then makes old_location a symbolic link to
+  # new_location.
+  #
+  # old_location need not exist, but if it does, it must be a directory (or a
+  # symlink to a directory).  If it is not, it is backed up.  If new_location
+  # exists already and is not a directory, it is backed up.
+  #
+  # This function should be called from a package's preinst so that other
+  # packages unpacked after this one --- but before this package's postinst runs
+  # --- are unpacked into new_location even if their payloads contain
+  # old_location filespecs.
+
+  # Validate arguments.
+  if [ $# -ne 2 ]; then
+    usage_error "migrate_dir_to_symlink() called with wrong number of"
+                "arguments; expected 2, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  # We could just use the positional parameters as-is, but that makes things
+  # harder to follow.
+  local new old
+
+  old="$1"
+  new="$2"
+
+  # Is old location a symlink?
+  if [ -L "$old" ]; then
+    # Does it already point to new location?
+    if [ "$(readlink "$old")" = "$new" ]; then
+      # Nothing to do; migration has already been done.
+      observe "migration of $old to $new already done"
+      return 0
+    else
+      # Back it up.
+      warn "backing up symbolic link $old as $old.dpkg-old"
+      mv -b "$old" "$old.dpkg-old"
+    fi
+  fi
+
+  # Does old location exist, but is not a directory?
+  if [ -e "$old" ] && ! [ -d "$old" ]; then
+      # Back it up.
+      warn "backing up non-directory $old as $old.dpkg-old"
+      mv -b "$old" "$old.dpkg-old"
+  fi
+
+  observe "migrating $old to $new"
+
+  # Is new location a symlink?
+  if [ -L "$new" ]; then
+    # Does it point the wrong way, i.e., back to where we're migrating from?
+    if [ "$(readlink "$new")" = "$old" ]; then
+      # Get rid of it.
+      observe "removing symbolic link $new which points to $old"
+      rm "$new"
+    else
+      # Back it up.
+      warn "backing up symbolic link $new as $new.dpkg-old"
+      mv -b "$new" "$new.dpkg-old"
+    fi
+  fi
+
+  # Does new location exist, but is not a directory?
+  if [ -e "$new" ] && ! [ -d "$new" ]; then
+    warn "backing up non-directory $new as $new.dpkg-old"
+    mv -b "$new" "$new.dpkg-old"
+  fi
+
+  # Create new directory if it does not yet exist.
+  if ! [ -e "$new" ]; then
+    observe "creating $new"
+    mkdir -p "$new"
+  fi
+
+  # Copy files in old location to new location.  Back up any filenames that
+  # already exist in the new location with the extension ".dpkg-old".
+  observe "copying files from $old to $new"
+  if ! (cd "$old" && cp -a -b -S ".dpkg-old" . "$new"); then
+    die "error(s) encountered while copying files from $old to $new"
+  fi
+
+  # Remove files at old location.
+  observe "removing $old"
+  rm -r "$old"
+
+  # Create symlink from old location to new location.
+  make_symlink_sane "$old" "$new"
+}
+
+# vim:set ai et sw=2 ts=2 tw=80:
+
+# GOBSTOPPER: The X Strike Force shell library ends here.
diff --git a/kbproto.pc.in b/kbproto.pc.in
new file mode 100644 (file)
index 0000000..02a6d44
--- /dev/null
@@ -0,0 +1,9 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+Name: KBProto
+Description: KB extension headers
+Version: @PACKAGE_VERSION@
+Cflags: -I${includedir}
diff --git a/packaging/xorg-x11-proto-kbproto.spec b/packaging/xorg-x11-proto-kbproto.spec
new file mode 100644 (file)
index 0000000..788e95c
--- /dev/null
@@ -0,0 +1,45 @@
+
+Name:       xorg-x11-proto-kbproto
+Summary:    X.Org X11 Protocol kbproto
+Version:    1.0.5
+Release:    0
+Group:      Development/System
+License:    MIT
+URL:        http://www.x.org
+Source0:    http://xorg.freedesktop.org/releases/individual/proto/kbproto-%{version}.tar.gz
+BuildRequires:  pkgconfig(xorg-macros)
+Provides:   kbproto
+
+
+%description
+Description: %{summary}
+
+
+
+%prep
+%setup -q -n kbproto-%{version}
+
+
+%build
+
+%reconfigure --disable-shared
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install 
+
+
+
+
+%files
+%defattr(-,root,root,-)
+%{_libdir}/pkgconfig/kbproto.pc
+%{_includedir}/X11/extensions/XKB.h
+%{_includedir}/X11/extensions/XKBsrv.h
+%{_includedir}/X11/extensions/XKBproto.h
+%{_includedir}/X11/extensions/XKBstr.h
+%{_includedir}/X11/extensions/XKBgeom.h
+
+