summaryrefslogtreecommitdiff
path: root/lib/libXi/src
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2006-11-25 17:23:06 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2006-11-25 17:23:06 +0000
commit13e66efef835e64606fd932213aceba5c8e2acca (patch)
tree184d3efda23e998de77d08291e8c502a477e1d94 /lib/libXi/src
parent025adb89135dda6f21becac4408eb28353137d30 (diff)
import from X.Org 7.2RC2
Diffstat (limited to 'lib/libXi/src')
-rw-r--r--lib/libXi/src/Makefile.am56
-rw-r--r--lib/libXi/src/Makefile.in626
-rw-r--r--lib/libXi/src/XAllowDv.c87
-rw-r--r--lib/libXi/src/XChgDCtl.c126
-rw-r--r--lib/libXi/src/XChgFCtl.c193
-rw-r--r--lib/libXi/src/XChgKMap.c94
-rw-r--r--lib/libXi/src/XChgKbd.c87
-rw-r--r--lib/libXi/src/XChgPnt.c91
-rw-r--r--lib/libXi/src/XChgProp.c97
-rw-r--r--lib/libXi/src/XCloseDev.c84
-rw-r--r--lib/libXi/src/XDevBell.c88
-rw-r--r--lib/libXi/src/XExtInt.c674
-rw-r--r--lib/libXi/src/XExtToWire.c461
-rw-r--r--lib/libXi/src/XFreeLst.c72
-rw-r--r--lib/libXi/src/XGMotion.c145
-rw-r--r--lib/libXi/src/XGetBMap.c106
-rw-r--r--lib/libXi/src/XGetDCtl.c171
-rw-r--r--lib/libXi/src/XGetFCtl.c272
-rw-r--r--lib/libXi/src/XGetKMap.c107
-rw-r--r--lib/libXi/src/XGetMMap.c102
-rw-r--r--lib/libXi/src/XGetProp.c115
-rw-r--r--lib/libXi/src/XGetVers.c107
-rw-r--r--lib/libXi/src/XGrDvBut.c114
-rw-r--r--lib/libXi/src/XGrDvKey.c116
-rw-r--r--lib/libXi/src/XGrabDev.c109
-rw-r--r--lib/libXi/src/XGtFocus.c91
-rw-r--r--lib/libXi/src/XGtSelect.c139
-rw-r--r--lib/libXi/src/XIint.h17
-rw-r--r--lib/libXi/src/XListDev.c247
-rw-r--r--lib/libXi/src/XOpenDev.c109
-rw-r--r--lib/libXi/src/XQueryDv.c193
-rw-r--r--lib/libXi/src/XSelect.c94
-rw-r--r--lib/libXi/src/XSetBMap.c93
-rw-r--r--lib/libXi/src/XSetDVal.c99
-rw-r--r--lib/libXi/src/XSetMMap.c92
-rw-r--r--lib/libXi/src/XSetMode.c87
-rw-r--r--lib/libXi/src/XSndExEv.c121
-rw-r--r--lib/libXi/src/XStFocus.c87
-rw-r--r--lib/libXi/src/XUngrDev.c86
-rw-r--r--lib/libXi/src/XUngrDvB.c93
-rw-r--r--lib/libXi/src/XUngrDvK.c93
-rw-r--r--lib/libXi/src/config.h.in55
42 files changed, 6096 insertions, 0 deletions
diff --git a/lib/libXi/src/Makefile.am b/lib/libXi/src/Makefile.am
new file mode 100644
index 000000000..a02428cca
--- /dev/null
+++ b/lib/libXi/src/Makefile.am
@@ -0,0 +1,56 @@
+# $XdotOrg: lib/Xi/src/Makefile.am,v 1.6 2005/12/03 04:41:49 kem Exp $
+
+lib_LTLIBRARIES = libXi.la
+
+libXi_la_SOURCES = \
+ XAllowDv.c \
+ XChgDCtl.c \
+ XChgFCtl.c \
+ XChgKbd.c \
+ XChgKMap.c \
+ XChgPnt.c \
+ XChgProp.c \
+ XCloseDev.c \
+ XDevBell.c \
+ XExtToWire.c \
+ XGetBMap.c \
+ XGetDCtl.c \
+ XGetFCtl.c \
+ XGetKMap.c \
+ XGetMMap.c \
+ XGetProp.c \
+ XGetVers.c \
+ XGMotion.c \
+ XGrabDev.c \
+ XGrDvBut.c \
+ XGrDvKey.c \
+ XGtFocus.c \
+ XGtSelect.c \
+ XListDev.c \
+ XOpenDev.c \
+ XQueryDv.c \
+ XSelect.c \
+ XSetBMap.c \
+ XSetDVal.c \
+ XSetMMap.c \
+ XSetMode.c \
+ XSndExEv.c \
+ XStFocus.c \
+ XUngrDev.c \
+ XUngrDvB.c \
+ XUngrDvK.c \
+ XExtInt.c \
+ XIint.h
+
+libXi_la_LIBADD = $(XI_LIBS)
+
+AM_CFLAGS = $(XI_CFLAGS) $(MALLOC_ZERO_CFLAGS)
+
+#INCLUDES = -I$(top_srcdir)/include/X11/extensions
+
+libXi_la_LDFLAGS = -version-number 6:0:0 -no-undefined
+
+#libXiincludedir = $(includedir)/X11/extensions
+#libXiinclude_HEADERS = $(top_srcdir)/include/X11/extensions/Xi.h
+
+EXTRA_DIST = XFreeLst.c
diff --git a/lib/libXi/src/Makefile.in b/lib/libXi/src/Makefile.in
new file mode 100644
index 000000000..c244fc4f1
--- /dev/null
+++ b/lib/libXi/src/Makefile.in
@@ -0,0 +1,626 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# $XdotOrg: lib/Xi/src/Makefile.am,v 1.6 2005/12/03 04:41:49 kem Exp $
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = src
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/config.h.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+libXi_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am_libXi_la_OBJECTS = XAllowDv.lo XChgDCtl.lo XChgFCtl.lo XChgKbd.lo \
+ XChgKMap.lo XChgPnt.lo XChgProp.lo XCloseDev.lo XDevBell.lo \
+ XExtToWire.lo XGetBMap.lo XGetDCtl.lo XGetFCtl.lo XGetKMap.lo \
+ XGetMMap.lo XGetProp.lo XGetVers.lo XGMotion.lo XGrabDev.lo \
+ XGrDvBut.lo XGrDvKey.lo XGtFocus.lo XGtSelect.lo XListDev.lo \
+ XOpenDev.lo XQueryDv.lo XSelect.lo XSetBMap.lo XSetDVal.lo \
+ XSetMMap.lo XSetMode.lo XSndExEv.lo XStFocus.lo XUngrDev.lo \
+ XUngrDvB.lo XUngrDvK.lo XExtInt.lo
+libXi_la_OBJECTS = $(am_libXi_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(LT_QUIET) --tag=CC --mode=compile $(CC) \
+ $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(LT_QUIET) --tag=CC --mode=link $(CCLD) \
+ $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libXi_la_SOURCES)
+DIST_SOURCES = $(libXi_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+AMCMDECHO = @AMCMDECHO@
+AMDEPSHOWCMDSAT = @AMDEPSHOWCMDSAT@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMPRETTYECHO = @AMPRETTYECHO@
+AMSHOWCMDSAT = @AMSHOWCMDSAT@
+AMTAR = @AMTAR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_QUIET = @LT_QUIET@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MALLOC_ZERO_CFLAGS = @MALLOC_ZERO_CFLAGS@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XI_CFLAGS = @XI_CFLAGS@
+XI_LIBS = @XI_LIBS@
+XMALLOC_ZERO_CFLAGS = @XMALLOC_ZERO_CFLAGS@
+XTMALLOC_ZERO_CFLAGS = @XTMALLOC_ZERO_CFLAGS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+lib_LTLIBRARIES = libXi.la
+libXi_la_SOURCES = \
+ XAllowDv.c \
+ XChgDCtl.c \
+ XChgFCtl.c \
+ XChgKbd.c \
+ XChgKMap.c \
+ XChgPnt.c \
+ XChgProp.c \
+ XCloseDev.c \
+ XDevBell.c \
+ XExtToWire.c \
+ XGetBMap.c \
+ XGetDCtl.c \
+ XGetFCtl.c \
+ XGetKMap.c \
+ XGetMMap.c \
+ XGetProp.c \
+ XGetVers.c \
+ XGMotion.c \
+ XGrabDev.c \
+ XGrDvBut.c \
+ XGrDvKey.c \
+ XGtFocus.c \
+ XGtSelect.c \
+ XListDev.c \
+ XOpenDev.c \
+ XQueryDv.c \
+ XSelect.c \
+ XSetBMap.c \
+ XSetDVal.c \
+ XSetMMap.c \
+ XSetMode.c \
+ XSndExEv.c \
+ XStFocus.c \
+ XUngrDev.c \
+ XUngrDvB.c \
+ XUngrDvK.c \
+ XExtInt.c \
+ XIint.h
+
+libXi_la_LIBADD = $(XI_LIBS)
+AM_CFLAGS = $(XI_CFLAGS) $(MALLOC_ZERO_CFLAGS)
+
+#INCLUDES = -I$(top_srcdir)/include/X11/extensions
+libXi_la_LDFLAGS = -version-number 6:0:0 -no-undefined
+
+#libXiincludedir = $(includedir)/X11/extensions
+#libXiinclude_HEADERS = $(top_srcdir)/include/X11/extensions/Xi.h
+EXTRA_DIST = XFreeLst.c
+all: config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ @AMPRETTYECHO@ ' [AUTOMAKE ] src/Makefile'; \
+ @AMCMDECHO@ ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ @AMPRETTYECHO@ ' [SH ] config.status $(subdir)/$@'; \
+ @AMCMDECHO@ ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ @@AMPRETTYECHO@ ' [SH ] config.status'
+ @AMSHOWCMDSAT@cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ @@AMPRETTYECHO@ ' [AUTOCONF ] Regenerate'
+ @AMSHOWCMDSAT@cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ @@AMPRETTYECHO@ ' [ACLOCAL ] Regenerate'
+ @AMSHOWCMDSAT@cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+config.h: stamp-h1
+ @if test ! -f $@; then \
+ rm -f stamp-h1; \
+ $(MAKE) stamp-h1; \
+ else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ @@AMPRETTYECHO@ ' [SH ] Regenerate src/config.h'
+ @AMSHOWCMDSAT@cd $(top_builddir) && $(SHELL) ./config.status src/config.h
+$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ @@AMPRETTYECHO@ ' [AUTOHEADER] Regenerate'
+ @AMSHOWCMDSAT@cd $(top_srcdir) && $(AUTOHEADER)
+ @AMSHOWCMDSAT@rm -f stamp-h1
+ @AMSHOWCMDSAT@touch $@
+
+distclean-hdr:
+ @@AMPRETTYECHO@ ' [RM ] config.h stamp-h1'
+ @AMSHOWCMDSAT@-rm -f config.h stamp-h1
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ @AMSHOWCMDSAT@test -z "$(libdir)" || ( @AMPRETTYECHO@ ' [MKDIR ] "$(DESTDIR)$(libdir)"'; $(mkdir_p) "$(DESTDIR)$(libdir)" )
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ @AMPRETTYECHO@ " [INSTALL ] $$p -> $(DESTDIR)$(libdir)/$$f"; \
+ @AMCMDECHO@ " $(LIBTOOL) $(LT_QUIET) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) $(LT_QUIET) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ @AMPRETTYECHO@ " [RM ] $(DESTDIR)$(libdir)/$$p"; \
+ @AMCMDECHO@ " $(LIBTOOL) $(LT_QUIET) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ $(LIBTOOL) $(LT_QUIET) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ done
+
+clean-libLTLIBRARIES:
+ @AMSHOWCMDSAT@-test -z "$(lib_LTLIBRARIES)" || ( \
+ @AMPRETTYECHO@ ' [RM ] $(lib_LTLIBRARIES)'; \
+ rm -f $(lib_LTLIBRARIES) )
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ @AMPRETTYECHO@ " [RM ] $${dir}/so_locations"; \
+ @AMCMDECHO@ "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libXi.la: $(libXi_la_OBJECTS) $(libXi_la_DEPENDENCIES)
+ @@AMPRETTYECHO@ ' [LD ] libXi.la'
+ @AMSHOWCMDSAT@$(LINK) -rpath $(libdir) $(libXi_la_LDFLAGS) $(libXi_la_OBJECTS) $(libXi_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ @@AMPRETTYECHO@ ' [RM ] *.$(OBJEXT)'
+ @AMSHOWCMDSAT@-rm -f *.$(OBJEXT)
+
+distclean-compile:
+ @@AMPRETTYECHO@ ' [RM ] *.tab.c'
+ @AMSHOWCMDSAT@-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XAllowDv.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XChgDCtl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XChgFCtl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XChgKMap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XChgKbd.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XChgPnt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XChgProp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XCloseDev.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XDevBell.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XExtInt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XExtToWire.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XGMotion.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XGetBMap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XGetDCtl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XGetFCtl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XGetKMap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XGetMMap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XGetProp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XGetVers.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XGrDvBut.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XGrDvKey.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XGrabDev.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XGtFocus.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XGtSelect.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XListDev.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XOpenDev.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XQueryDv.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XSelect.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XSetBMap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XSetDVal.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XSetMMap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XSetMode.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XSndExEv.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XStFocus.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XUngrDev.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XUngrDvB.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XUngrDvK.Plo@am__quote@
+
+.c.o:
+ @@AMPRETTYECHO@ ' [C ] $<'
+@am__fastdepCC_TRUE@ @AMSHOWCMDSAT@if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ @AMSHOWCMDSAT@source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ @AMDEPSHOWCMDSAT@$(COMPILE) -c $<
+
+.c.obj:
+ @@AMPRETTYECHO@ ' [C ] $<'
+@am__fastdepCC_TRUE@ @AMSHOWCMDSAT@if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ @AMSHOWCMDSAT@source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ @AMDEPSHOWCMDSAT@$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ @@AMPRETTYECHO@ ' [C ] $<'
+@am__fastdepCC_TRUE@ @AMSHOWCMDSAT@if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ @AMSHOWCMDSAT@source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ @AMDEPSHOWCMDSAT@$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ @@AMPRETTYECHO@ ' [RM ] *.lo'
+ @AMSHOWCMDSAT@-rm -f *.lo
+
+clean-libtool:
+ @@AMPRETTYECHO@ ' [RM ] .libs _libs'
+ @AMSHOWCMDSAT@-rm -rf .libs _libs
+
+distclean-libtool:
+ @@AMPRETTYECHO@ ' [RM ] libtool'
+ @AMSHOWCMDSAT@-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ @AMSHOWCMDSAT@list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ @AMPRETTYECHO@ ' [MKID ] $$unique'; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ @AMSHOWCMDSAT@tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ @AMPRETTYECHO@ " [ETAGS ] $$tags"; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ @AMSHOWCMDSAT@tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || ( \
+ @AMPRETTYECHO@ " [CTAGS ] $$tags"; \
+ $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique )
+
+GTAGS:
+ @@AMPRETTYECHO@ ' [GTAGS ]'
+ @AMSHOWCMDSAT@here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ @@AMPRETTYECHO@ ' [RM ] TAGS ID GTAGS GRTAGS GSYMS GPATH tags'
+ @AMSHOWCMDSAT@-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @@AMPRETTYECHO@ ' [MKDIR ] '
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) config.h
+installdirs:
+ @AMSHOWCMDSAT@for dir in "$(DESTDIR)$(libdir)"; do \
+ test -z "$$dir" || ( @AMPRETTYECHO@ " [MKDIR ] $$dir"; $(mkdir_p) "$$dir" ); \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ @AMSHOWCMDSAT@$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ @@AMPRETTYECHO@ ' [RM ] $(CONFIG_CLEAN_FILES)'
+ @AMSHOWCMDSAT@-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ @@AMPRETTYECHO@ ' [RM ] ./$(DEPDIR)'
+ @AMSHOWCMDSAT@-rm -rf ./$(DEPDIR)
+ @@AMPRETTYECHO@ ' [RM ] Makefile'
+ @AMSHOWCMDSAT@-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-hdr distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ @@AMPRETTYECHO@ ' [RM ] ./$(DEPDIR)'
+ @AMSHOWCMDSAT@-rm -rf ./$(DEPDIR)
+ @@AMPRETTYECHO@ ' [RM ] Makefile'
+ @AMSHOWCMDSAT@-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libLTLIBRARIES clean-libtool ctags distclean \
+ distclean-compile distclean-generic distclean-hdr \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-libLTLIBRARIES install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-info-am uninstall-libLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/lib/libXi/src/XAllowDv.c b/lib/libXi/src/XAllowDv.c
new file mode 100644
index 000000000..7fd2a07b0
--- /dev/null
+++ b/lib/libXi/src/XAllowDv.c
@@ -0,0 +1,87 @@
+/* $Xorg: XAllowDv.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XAllowDv.c,v 3.3 2001/12/14 19:55:03 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XAllowDeviceEvents - Thaw a frozen extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XAllowDeviceEvents(dpy, dev, event_mode, time)
+ register Display *dpy;
+ XDevice *dev;
+ int event_mode;
+ Time time;
+{
+ xAllowDeviceEventsReq *req;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return (NoSuchExtension);
+
+ GetReq(AllowDeviceEvents, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_AllowDeviceEvents;
+ req->deviceid = dev->device_id;
+ req->mode = event_mode;
+ req->time = time;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (Success);
+}
diff --git a/lib/libXi/src/XChgDCtl.c b/lib/libXi/src/XChgDCtl.c
new file mode 100644
index 000000000..c8e8f4cb6
--- /dev/null
+++ b/lib/libXi/src/XChgDCtl.c
@@ -0,0 +1,126 @@
+/* $Xorg: XChgDCtl.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XChgDCtl.c,v 3.3 2001/12/14 19:55:03 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XChangeDeviceControl - Change the control attributes of an extension
+ * input device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XChangeDeviceControl(dpy, dev, control, d)
+ register Display *dpy;
+ XDevice *dev;
+ int control;
+ XDeviceControl *d;
+{
+ int length;
+ xChangeDeviceControlReq *req;
+ xChangeDeviceControlReply rep;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Add_XChangeDeviceControl, info) == -1)
+ return (NoSuchExtension);
+
+ GetReq(ChangeDeviceControl, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_ChangeDeviceControl;
+ req->deviceid = dev->device_id;
+ req->control = control;
+
+ switch (control) {
+ case DEVICE_RESOLUTION:
+ {
+ XDeviceResolutionControl *R;
+ xDeviceResolutionCtl r;
+
+ R = (XDeviceResolutionControl *) d;
+ r.control = DEVICE_RESOLUTION;
+ r.length = sizeof(xDeviceResolutionCtl) +
+ R->num_valuators * sizeof(int);
+ r.first_valuator = R->first_valuator;
+ r.num_valuators = R->num_valuators;
+ req->length += ((unsigned)(r.length + 3) >> 2);
+ length = sizeof(xDeviceResolutionCtl);
+ Data(dpy, (char *)&r, length);
+ length = r.num_valuators * sizeof(int);
+ Data(dpy, (char *)R->resolutions, length);
+ if (!_XReply(dpy, (xReply *) & rep, 0, xTrue)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (NoSuchExtension);
+ } else
+ return (rep.status);
+ }
+ default:
+ {
+ xDeviceCtl u;
+
+ u.control = d->control;
+ u.length = d->length - sizeof(int);
+ length = ((unsigned)(u.length + 3) >> 2);
+ req->length += length;
+ length <<= 2;
+ Data(dpy, (char *)&u, length);
+ }
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (Success);
+}
diff --git a/lib/libXi/src/XChgFCtl.c b/lib/libXi/src/XChgFCtl.c
new file mode 100644
index 000000000..e499b411f
--- /dev/null
+++ b/lib/libXi/src/XChgFCtl.c
@@ -0,0 +1,193 @@
+/* $Xorg: XChgFCtl.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XChgFCtl.c,v 3.3 2001/12/14 19:55:03 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XChangeFeedbackControl - Change the control attributes of feedbacks on
+ * an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XChangeFeedbackControl(dpy, dev, mask, f)
+ register Display *dpy;
+ XDevice *dev;
+ unsigned long mask;
+ XFeedbackControl *f;
+{
+ int length;
+ xChangeFeedbackControlReq *req;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return (NoSuchExtension);
+
+ GetReq(ChangeFeedbackControl, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_ChangeFeedbackControl;
+ req->deviceid = dev->device_id;
+ req->mask = mask;
+ req->feedbackid = f->class;
+
+ if (f->class == KbdFeedbackClass) {
+ XKbdFeedbackControl *K;
+ xKbdFeedbackCtl k;
+
+ K = (XKbdFeedbackControl *) f;
+ k.class = KbdFeedbackClass;
+ k.length = sizeof(xKbdFeedbackCtl);
+ k.id = K->id;
+ k.click = K->click;
+ k.percent = K->percent;
+ k.pitch = K->pitch;
+ k.duration = K->duration;
+ k.led_mask = K->led_mask;
+ k.led_values = K->led_value;
+ k.key = K->key;
+ k.auto_repeat_mode = K->auto_repeat_mode;
+ length = ((unsigned)(k.length + 3) >> 2);
+ req->length += length;
+ length <<= 2;
+ Data(dpy, (char *)&k, length);
+ } else if (f->class == PtrFeedbackClass) {
+ XPtrFeedbackControl *P;
+ xPtrFeedbackCtl p;
+
+ P = (XPtrFeedbackControl *) f;
+ p.class = PtrFeedbackClass;
+ p.length = sizeof(xPtrFeedbackCtl);
+ p.id = P->id;
+ p.num = P->accelNum;
+ p.denom = P->accelDenom;
+ p.thresh = P->threshold;
+ length = ((unsigned)(p.length + 3) >> 2);
+ req->length += length;
+ length <<= 2;
+ Data(dpy, (char *)&p, length);
+ } else if (f->class == IntegerFeedbackClass) {
+ XIntegerFeedbackControl *I;
+ xIntegerFeedbackCtl i;
+
+ I = (XIntegerFeedbackControl *) f;
+ i.class = IntegerFeedbackClass;
+ i.length = sizeof(xIntegerFeedbackCtl);
+ i.id = I->id;
+ i.int_to_display = I->int_to_display;
+ length = ((unsigned)(i.length + 3) >> 2);
+ req->length += length;
+ length <<= 2;
+ Data(dpy, (char *)&i, length);
+ } else if (f->class == StringFeedbackClass) {
+ XStringFeedbackControl *S;
+ xStringFeedbackCtl s;
+
+ S = (XStringFeedbackControl *) f;
+ s.class = StringFeedbackClass;
+ s.length = sizeof(xStringFeedbackCtl) +
+ (S->num_keysyms * sizeof(KeySym));
+ s.id = S->id;
+ s.num_keysyms = S->num_keysyms;
+ req->length += ((unsigned)(s.length + 3) >> 2);
+ length = sizeof(xStringFeedbackCtl);
+ Data(dpy, (char *)&s, length);
+ length = (s.num_keysyms * sizeof(KeySym));
+ Data(dpy, (char *)S->syms_to_display, length);
+ } else if (f->class == BellFeedbackClass) {
+ XBellFeedbackControl *B;
+ xBellFeedbackCtl b;
+
+ B = (XBellFeedbackControl *) f;
+ b.class = BellFeedbackClass;
+ b.length = sizeof(xBellFeedbackCtl);
+ b.id = B->id;
+ b.percent = B->percent;
+ b.pitch = B->pitch;
+ b.duration = B->duration;
+ length = ((unsigned)(b.length + 3) >> 2);
+ req->length += length;
+ length <<= 2;
+ Data(dpy, (char *)&b, length);
+ } else if (f->class == LedFeedbackClass) {
+ XLedFeedbackControl *L;
+ xLedFeedbackCtl l;
+
+ L = (XLedFeedbackControl *) f;
+ l.class = LedFeedbackClass;
+ l.length = sizeof(xLedFeedbackCtl);
+ l.id = L->id;
+ l.led_mask = L->led_mask;
+ l.led_values = L->led_values;
+ length = ((unsigned)(l.length + 3) >> 2);
+ req->length += length;
+ length <<= 2;
+ Data(dpy, (char *)&l, length);
+ } else {
+ xFeedbackCtl u;
+
+ u.class = f->class;
+ u.length = f->length - sizeof(int);
+ u.id = f->id;
+ length = ((unsigned)(u.length + 3) >> 2);
+ req->length += length;
+ length <<= 2;
+ Data(dpy, (char *)&u, length);
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (Success);
+}
diff --git a/lib/libXi/src/XChgKMap.c b/lib/libXi/src/XChgKMap.c
new file mode 100644
index 000000000..73de75464
--- /dev/null
+++ b/lib/libXi/src/XChgKMap.c
@@ -0,0 +1,94 @@
+/* $Xorg: XChgKMap.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XChgKMap.c,v 3.3 2001/12/14 19:55:04 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XChangeDeviceKeyMapping - change the keymap of an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XChangeDeviceKeyMapping(dpy, dev, first, syms_per_code, keysyms, count)
+ register Display *dpy;
+ XDevice *dev;
+ int first;
+ int syms_per_code;
+ KeySym *keysyms;
+ int count;
+{
+ register long nbytes;
+ xChangeDeviceKeyMappingReq *req;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return (NoSuchExtension);
+
+ GetReq(ChangeDeviceKeyMapping, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_ChangeDeviceKeyMapping;
+ req->deviceid = dev->device_id;
+ req->firstKeyCode = first;
+ req->keyCodes = count;
+ req->keySymsPerKeyCode = syms_per_code;
+ req->length += count * syms_per_code;
+ nbytes = syms_per_code * count * sizeof(CARD32);
+ Data(dpy, (char *)keysyms, nbytes);
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (Success);
+}
diff --git a/lib/libXi/src/XChgKbd.c b/lib/libXi/src/XChgKbd.c
new file mode 100644
index 000000000..1b01207a7
--- /dev/null
+++ b/lib/libXi/src/XChgKbd.c
@@ -0,0 +1,87 @@
+/* $Xorg: XChgKbd.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XChgKbd.c,v 3.3 2001/12/14 19:55:04 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XChangeKeyboardDevice - Change the device used as the X keyboard.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XChangeKeyboardDevice(dpy, dev)
+ register Display *dpy;
+ XDevice *dev;
+{
+ xChangeKeyboardDeviceReq *req;
+ xChangeKeyboardDeviceReply rep;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return (NoSuchExtension);
+
+ GetReq(ChangeKeyboardDevice, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_ChangeKeyboardDevice;
+ req->deviceid = dev->device_id;
+ rep.status = Success;
+
+ (void)_XReply(dpy, (xReply *) & rep, 0, xTrue);
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (rep.status);
+}
diff --git a/lib/libXi/src/XChgPnt.c b/lib/libXi/src/XChgPnt.c
new file mode 100644
index 000000000..6123398ac
--- /dev/null
+++ b/lib/libXi/src/XChgPnt.c
@@ -0,0 +1,91 @@
+/* $Xorg: XChgPnt.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XChgPnt.c,v 3.3 2001/12/14 19:55:04 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XChangePointerDevice - Change the device used as the X Pointer.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XChangePointerDevice(dpy, dev, xaxis, yaxis)
+ register Display *dpy;
+ XDevice *dev;
+ int xaxis;
+ int yaxis;
+{
+ xChangePointerDeviceReq *req;
+ xChangePointerDeviceReply rep;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return (NoSuchExtension);
+
+ GetReq(ChangePointerDevice, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_ChangePointerDevice;
+ req->deviceid = dev->device_id;
+ req->xaxis = xaxis;
+ req->yaxis = yaxis;
+ rep.status = Success;
+
+ (void)_XReply(dpy, (xReply *) & rep, 0, xTrue);
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (rep.status);
+}
diff --git a/lib/libXi/src/XChgProp.c b/lib/libXi/src/XChgProp.c
new file mode 100644
index 000000000..0c7377f60
--- /dev/null
+++ b/lib/libXi/src/XChgProp.c
@@ -0,0 +1,97 @@
+/* $Xorg: XChgProp.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XChgProp.c,v 3.3 2001/12/14 19:55:05 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XChangeDeviceDontPropagateList - Get the dont_propagate_list for a
+ * window.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XChangeDeviceDontPropagateList(dpy, window, count, events, mode)
+ register Display *dpy;
+ Window window;
+ int count;
+ XEventClass *events;
+ int mode;
+{
+ xChangeDeviceDontPropagateListReq *req;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return (NoSuchExtension);
+
+ GetReq(ChangeDeviceDontPropagateList, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_ChangeDeviceDontPropagateList;
+ req->window = window;
+ req->count = count;
+ req->mode = mode;
+ req->length += count;
+
+ /* note: Data is a macro that uses its arguments multiple
+ * times, so "nvalues" is changed in a separate assignment
+ * statement */
+
+ count <<= 2;
+ Data32(dpy, (long *)events, count);
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (Success);
+}
diff --git a/lib/libXi/src/XCloseDev.c b/lib/libXi/src/XCloseDev.c
new file mode 100644
index 000000000..ca1986069
--- /dev/null
+++ b/lib/libXi/src/XCloseDev.c
@@ -0,0 +1,84 @@
+/* $Xorg: XCloseDev.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XCloseDev.c,v 3.3 2001/12/14 19:55:06 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XCloseDevice - Request the server to close an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XCloseDevice(dpy, dev)
+ register Display *dpy;
+ register XDevice *dev;
+{
+ xCloseDeviceReq *req;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return (NoSuchExtension);
+
+ GetReq(CloseDevice, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_CloseDevice;
+ req->deviceid = dev->device_id;
+
+ XFree((char *)dev);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (Success);
+}
diff --git a/lib/libXi/src/XDevBell.c b/lib/libXi/src/XDevBell.c
new file mode 100644
index 000000000..73f2e3537
--- /dev/null
+++ b/lib/libXi/src/XDevBell.c
@@ -0,0 +1,88 @@
+/* $Xorg: XDevBell.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XDevBell.c,v 3.3 2001/12/14 19:55:08 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XDeviceBell - Ring a bell on an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XDeviceBell(dpy, dev, feedbackclass, feedbackid, percent)
+ register Display *dpy;
+ XDevice *dev;
+ XID feedbackclass, feedbackid;
+ int percent;
+{
+ xDeviceBellReq *req;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Add_XDeviceBell, info) == -1)
+ return (NoSuchExtension);
+
+ GetReq(DeviceBell, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_DeviceBell;
+ req->deviceid = dev->device_id;
+ req->feedbackclass = feedbackclass;
+ req->feedbackid = feedbackid;
+ req->percent = percent;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (Success);
+}
diff --git a/lib/libXi/src/XExtInt.c b/lib/libXi/src/XExtInt.c
new file mode 100644
index 000000000..2f61dce28
--- /dev/null
+++ b/lib/libXi/src/XExtInt.c
@@ -0,0 +1,674 @@
+/* $Xorg: XExtInt.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XExtInt.c,v 3.6 2001/12/14 19:55:09 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * Input Extension library internal functions.
+ *
+ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include <stdio.h>
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+#define ENQUEUE_EVENT True
+#define DONT_ENQUEUE False
+
+static XExtensionInfo *xinput_info;
+static /* const */ char *xinput_extension_name = INAME;
+static int XInputClose();
+static char *XInputError();
+static Bool XInputWireToEvent();
+Status _XiEventToWire();
+static /* const */ XEvent emptyevent;
+
+typedef struct _XInputData
+{
+ XEvent data;
+ XExtensionVersion *vers;
+} XInputData;
+
+#define XInputCheckExtension(dpy,i,val) \
+ XextCheckExtension (dpy, i, xinput_extension_name, val)
+
+static /* const */ XExtensionHooks xinput_extension_hooks = {
+ NULL, /* create_gc */
+ NULL, /* copy_gc */
+ NULL, /* flush_gc */
+ NULL, /* free_gc */
+ NULL, /* create_font */
+ NULL, /* free_font */
+ XInputClose, /* close_display */
+ XInputWireToEvent, /* wire_to_event */
+ _XiEventToWire, /* event_to_wire */
+ NULL, /* error */
+ XInputError, /* error_string */
+};
+
+static char *XInputErrorList[] = {
+ "BadDevice, invalid or uninitialized input device", /* BadDevice */
+ "BadEvent, invalid event type", /* BadEvent */
+ "BadMode, invalid mode parameter", /* BadMode */
+ "DeviceBusy, device is busy", /* DeviceBusy */
+ "BadClass, invalid event class", /* BadClass */
+};
+
+XEXT_GENERATE_FIND_DISPLAY(XInput_find_display, xinput_info,
+ xinput_extension_name, &xinput_extension_hooks,
+ IEVENTS, NULL)
+
+ static XEXT_GENERATE_ERROR_STRING(XInputError, xinput_extension_name,
+ IERRORS, XInputErrorList)
+/*******************************************************************
+ *
+ * Input extension versions.
+ *
+ */
+ static XExtensionVersion versions[] = { {XI_Absent, 0, 0},
+ {XI_Present, XI_Initial_Release_Major, XI_Initial_Release_Minor},
+ {XI_Present, XI_Add_XDeviceBell_Major, XI_Add_XDeviceBell_Minor},
+ {XI_Present, XI_Add_XSetDeviceValuators_Major,
+ XI_Add_XSetDeviceValuators_Minor},
+ {XI_Present, XI_Add_XChangeDeviceControl_Major,
+ XI_Add_XChangeDeviceControl_Minor}
+ };
+
+/***********************************************************************
+ *
+ * Return errors reported by this extension.
+ *
+ */
+
+void
+_xibaddevice(dpy, error)
+ Display *dpy;
+ int *error;
+{
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ *error = info->codes->first_error + XI_BadDevice;
+}
+
+void
+_xibadclass(dpy, error)
+ Display *dpy;
+ int *error;
+{
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ *error = info->codes->first_error + XI_BadClass;
+}
+
+void
+_xibadevent(dpy, error)
+ Display *dpy;
+ int *error;
+{
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ *error = info->codes->first_error + XI_BadEvent;
+}
+
+void
+_xibadmode(dpy, error)
+ Display *dpy;
+ int *error;
+{
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ *error = info->codes->first_error + XI_BadMode;
+}
+
+void
+_xidevicebusy(dpy, error)
+ Display *dpy;
+ int *error;
+{
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ *error = info->codes->first_error + XI_DeviceBusy;
+}
+
+/***********************************************************************
+ *
+ * Check to see if the input extension is installed in the server.
+ * Also check to see if the version is >= the requested version.
+ *
+ */
+
+int
+_XiCheckExtInit(dpy, version_index, info)
+ register Display *dpy;
+ register int version_index;
+ XExtDisplayInfo *info;
+{
+ XExtensionVersion *ext;
+
+ XInputCheckExtension(dpy, info, -1);
+
+ if (info->data == NULL) {
+ info->data = (XPointer) Xmalloc(sizeof(XInputData));
+ if (!info->data) {
+ UnlockDisplay(dpy);
+ return (-1);
+ }
+ ((XInputData *) info->data)->vers =
+ _XiGetExtensionVersion(dpy, "XInputExtension");
+ }
+
+ if (versions[version_index].major_version > Dont_Check) {
+ ext = ((XInputData *) info->data)->vers;
+ if ((ext->major_version < versions[version_index].major_version) ||
+ ((ext->major_version == versions[version_index].major_version) &&
+ (ext->minor_version < versions[version_index].minor_version))) {
+ UnlockDisplay(dpy);
+ return (-1);
+ }
+ }
+ return (0);
+}
+
+/***********************************************************************
+ *
+ * Close display routine.
+ *
+ */
+
+static int
+XInputClose(dpy, codes)
+ Display *dpy;
+ XExtCodes *codes;
+{
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ if (info->data != NULL) {
+ XFree((char *)((XInputData *) info->data)->vers);
+ XFree((char *)info->data);
+ }
+ return XextRemoveDisplay(xinput_info, dpy);
+}
+
+static int
+Ones(mask)
+ Mask mask;
+{
+ register Mask y;
+
+ y = (mask >> 1) & 033333333333;
+ y = mask - y - ((y >> 1) & 033333333333);
+ return (((y + (y >> 3)) & 030707070707) % 077);
+}
+
+/***********************************************************************
+ *
+ * Handle Input extension events.
+ * Reformat a wire event into an XEvent structure of the right type.
+ *
+ */
+
+static Bool
+XInputWireToEvent(dpy, re, event)
+ Display *dpy;
+ XEvent *re;
+ xEvent *event;
+{
+ unsigned int type, reltype;
+ unsigned int i, j;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+ XEvent *save = (XEvent *) info->data;
+
+ type = event->u.u.type & 0x7f;
+ reltype = (type - info->codes->first_event);
+
+ if (reltype != XI_DeviceValuator &&
+ reltype != XI_DeviceKeystateNotify &&
+ reltype != XI_DeviceButtonstateNotify) {
+ *save = emptyevent;
+ save->type = type;
+ ((XAnyEvent *) save)->serial = _XSetLastRequestRead(dpy,
+ (xGenericReply *)
+ event);
+ ((XAnyEvent *) save)->send_event = ((event->u.u.type & 0x80) != 0);
+ ((XAnyEvent *) save)->display = dpy;
+ }
+
+ switch (reltype) {
+ case XI_DeviceMotionNotify:
+ {
+ register XDeviceMotionEvent *ev = (XDeviceMotionEvent *) save;
+ deviceKeyButtonPointer *ev2 = (deviceKeyButtonPointer *) event;
+
+ ev->root = ev2->root;
+ ev->window = ev2->event;
+ ev->subwindow = ev2->child;
+ ev->time = ev2->time;
+ ev->x_root = ev2->root_x;
+ ev->y_root = ev2->root_y;
+ ev->x = ev2->event_x;
+ ev->y = ev2->event_y;
+ ev->state = ev2->state;
+ ev->same_screen = ev2->same_screen;
+ ev->is_hint = ev2->detail;
+ ev->deviceid = ev2->deviceid & DEVICE_BITS;
+ return (DONT_ENQUEUE);
+ }
+ break;
+ case XI_DeviceKeyPress:
+ case XI_DeviceKeyRelease:
+ {
+ register XDeviceKeyEvent *ev = (XDeviceKeyEvent *) save;
+ deviceKeyButtonPointer *ev2 = (deviceKeyButtonPointer *) event;
+
+ ev->root = ev2->root;
+ ev->window = ev2->event;
+ ev->subwindow = ev2->child;
+ ev->time = ev2->time;
+ ev->x_root = ev2->root_x;
+ ev->y_root = ev2->root_y;
+ ev->x = ev2->event_x;
+ ev->y = ev2->event_y;
+ ev->state = ev2->state;
+ ev->same_screen = ev2->same_screen;
+ ev->keycode = ev2->detail;
+ ev->deviceid = ev2->deviceid & DEVICE_BITS;
+ if (ev2->deviceid & MORE_EVENTS)
+ return (DONT_ENQUEUE);
+ else {
+ *re = *save;
+ return (ENQUEUE_EVENT);
+ }
+ }
+ break;
+ case XI_DeviceButtonPress:
+ case XI_DeviceButtonRelease:
+ {
+ register XDeviceButtonEvent *ev = (XDeviceButtonEvent *) save;
+ deviceKeyButtonPointer *ev2 = (deviceKeyButtonPointer *) event;
+
+ ev->root = ev2->root;
+ ev->window = ev2->event;
+ ev->subwindow = ev2->child;
+ ev->time = ev2->time;
+ ev->x_root = ev2->root_x;
+ ev->y_root = ev2->root_y;
+ ev->x = ev2->event_x;
+ ev->y = ev2->event_y;
+ ev->state = ev2->state;
+ ev->same_screen = ev2->same_screen;
+ ev->button = ev2->detail;
+ ev->deviceid = ev2->deviceid & DEVICE_BITS;
+ if (ev2->deviceid & MORE_EVENTS)
+ return (DONT_ENQUEUE);
+ else {
+ *re = *save;
+ return (ENQUEUE_EVENT);
+ }
+ }
+ break;
+ case XI_ProximityIn:
+ case XI_ProximityOut:
+ {
+ register XProximityNotifyEvent *ev = (XProximityNotifyEvent *) save;
+ deviceKeyButtonPointer *ev2 = (deviceKeyButtonPointer *) event;
+
+ ev->root = ev2->root;
+ ev->window = ev2->event;
+ ev->subwindow = ev2->child;
+ ev->time = ev2->time;
+ ev->x_root = ev2->root_x;
+ ev->y_root = ev2->root_y;
+ ev->x = ev2->event_x;
+ ev->y = ev2->event_y;
+ ev->state = ev2->state;
+ ev->same_screen = ev2->same_screen;
+ ev->deviceid = ev2->deviceid & DEVICE_BITS;
+ if (ev2->deviceid & MORE_EVENTS)
+ return (DONT_ENQUEUE);
+ else {
+ *re = *save;
+ return (ENQUEUE_EVENT);
+ }
+ }
+ break;
+ case XI_DeviceValuator:
+ {
+ deviceValuator *xev = (deviceValuator *) event;
+ int save_type = save->type - info->codes->first_event;
+
+ if (save_type == XI_DeviceKeyPress || save_type == XI_DeviceKeyRelease) {
+ XDeviceKeyEvent *kev = (XDeviceKeyEvent *) save;
+
+ kev->device_state = xev->device_state;
+ kev->axes_count = xev->num_valuators;
+ kev->first_axis = xev->first_valuator;
+ i = xev->num_valuators;
+ if (i > 6)
+ i = 6;
+ switch (i) {
+ case 6:
+ kev->axis_data[5] = xev->valuator5;
+ case 5:
+ kev->axis_data[4] = xev->valuator4;
+ case 4:
+ kev->axis_data[3] = xev->valuator3;
+ case 3:
+ kev->axis_data[2] = xev->valuator2;
+ case 2:
+ kev->axis_data[1] = xev->valuator1;
+ case 1:
+ kev->axis_data[0] = xev->valuator0;
+ }
+ } else if (save_type == XI_DeviceButtonPress ||
+ save_type == XI_DeviceButtonRelease) {
+ XDeviceButtonEvent *bev = (XDeviceButtonEvent *) save;
+
+ bev->device_state = xev->device_state;
+ bev->axes_count = xev->num_valuators;
+ bev->first_axis = xev->first_valuator;
+ i = xev->num_valuators;
+ if (i > 6)
+ i = 6;
+ switch (i) {
+ case 6:
+ bev->axis_data[5] = xev->valuator5;
+ case 5:
+ bev->axis_data[4] = xev->valuator4;
+ case 4:
+ bev->axis_data[3] = xev->valuator3;
+ case 3:
+ bev->axis_data[2] = xev->valuator2;
+ case 2:
+ bev->axis_data[1] = xev->valuator1;
+ case 1:
+ bev->axis_data[0] = xev->valuator0;
+ }
+ } else if (save_type == XI_DeviceMotionNotify) {
+ XDeviceMotionEvent *mev = (XDeviceMotionEvent *) save;
+
+ mev->device_state = xev->device_state;
+ mev->axes_count = xev->num_valuators;
+ mev->first_axis = xev->first_valuator;
+ i = xev->num_valuators;
+ if (i > 6)
+ i = 6;
+ switch (i) {
+ case 6:
+ mev->axis_data[5] = xev->valuator5;
+ case 5:
+ mev->axis_data[4] = xev->valuator4;
+ case 4:
+ mev->axis_data[3] = xev->valuator3;
+ case 3:
+ mev->axis_data[2] = xev->valuator2;
+ case 2:
+ mev->axis_data[1] = xev->valuator1;
+ case 1:
+ mev->axis_data[0] = xev->valuator0;
+ }
+ } else if (save_type == XI_ProximityIn || save_type == XI_ProximityOut) {
+ XProximityNotifyEvent *pev = (XProximityNotifyEvent *) save;
+
+ pev->device_state = xev->device_state;
+ pev->axes_count = xev->num_valuators;
+ pev->first_axis = xev->first_valuator;
+ i = xev->num_valuators;
+ if (i > 6)
+ i = 6;
+ switch (i) {
+ case 6:
+ pev->axis_data[5] = xev->valuator5;
+ case 5:
+ pev->axis_data[4] = xev->valuator4;
+ case 4:
+ pev->axis_data[3] = xev->valuator3;
+ case 3:
+ pev->axis_data[2] = xev->valuator2;
+ case 2:
+ pev->axis_data[1] = xev->valuator1;
+ case 1:
+ pev->axis_data[0] = xev->valuator0;
+ }
+ } else if (save_type == XI_DeviceStateNotify) {
+ XDeviceStateNotifyEvent *sev = (XDeviceStateNotifyEvent *) save;
+ XInputClass *any = (XInputClass *) & sev->data[0];
+ XValuatorStatus *v;
+
+ for (i = 0; i < sev->num_classes; i++)
+ if (any->class != ValuatorClass)
+ any = (XInputClass *) ((char *)any + any->length);
+ v = (XValuatorStatus *) any;
+ i = v->num_valuators;
+ j = xev->num_valuators;
+ if (j > 3)
+ j = 3;
+ switch (j) {
+ case 3:
+ v->valuators[i + 2] = xev->valuator2;
+ case 2:
+ v->valuators[i + 1] = xev->valuator1;
+ case 1:
+ v->valuators[i + 0] = xev->valuator0;
+ }
+ v->num_valuators += j;
+
+ }
+ *re = *save;
+ return (ENQUEUE_EVENT);
+ }
+ break;
+ case XI_DeviceFocusIn:
+ case XI_DeviceFocusOut:
+ {
+ register XDeviceFocusChangeEvent *ev = (XDeviceFocusChangeEvent *) re;
+ deviceFocus *fev = (deviceFocus *) event;
+
+ *ev = *((XDeviceFocusChangeEvent *) save);
+ ev->window = fev->window;
+ ev->time = fev->time;
+ ev->mode = fev->mode;
+ ev->detail = fev->detail;
+ ev->deviceid = fev->deviceid & DEVICE_BITS;
+ return (ENQUEUE_EVENT);
+ }
+ break;
+ case XI_DeviceStateNotify:
+ {
+ XDeviceStateNotifyEvent *stev = (XDeviceStateNotifyEvent *) save;
+ deviceStateNotify *sev = (deviceStateNotify *) event;
+ char *data;
+
+ stev->window = None;
+ stev->deviceid = sev->deviceid & DEVICE_BITS;
+ stev->time = sev->time;
+ stev->num_classes = Ones((Mask) sev->classes_reported & InputClassBits);
+ data = (char *)&stev->data[0];
+ if (sev->classes_reported & (1 << KeyClass)) {
+ register XKeyStatus *kstev = (XKeyStatus *) data;
+
+ kstev->class = KeyClass;
+ kstev->length = sizeof(XKeyStatus);
+ kstev->num_keys = sev->num_keys;
+ memcpy((char *)&kstev->keys[0], (char *)&sev->keys[0], 4);
+ data += sizeof(XKeyStatus);
+ }
+ if (sev->classes_reported & (1 << ButtonClass)) {
+ register XButtonStatus *bev = (XButtonStatus *) data;
+
+ bev->class = ButtonClass;
+ bev->length = sizeof(XButtonStatus);
+ bev->num_buttons = sev->num_buttons;
+ memcpy((char *)bev->buttons, (char *)sev->buttons, 4);
+ data += sizeof(XButtonStatus);
+ }
+ if (sev->classes_reported & (1 << ValuatorClass)) {
+ register XValuatorStatus *vev = (XValuatorStatus *) data;
+
+ vev->class = ValuatorClass;
+ vev->length = sizeof(XValuatorStatus);
+ vev->num_valuators = sev->num_valuators;
+ vev->mode = sev->classes_reported >> ModeBitsShift;
+ j = sev->num_valuators;
+ if (j > 3)
+ j = 3;
+ switch (j) {
+ case 3:
+ vev->valuators[2] = sev->valuator2;
+ case 2:
+ vev->valuators[1] = sev->valuator1;
+ case 1:
+ vev->valuators[0] = sev->valuator0;
+ }
+ data += sizeof(XValuatorStatus);
+ }
+ if (sev->deviceid & MORE_EVENTS)
+ return (DONT_ENQUEUE);
+ else {
+ *re = *save;
+ stev = (XDeviceStateNotifyEvent *) re;
+ return (ENQUEUE_EVENT);
+ }
+ }
+ break;
+ case XI_DeviceKeystateNotify:
+ {
+ int i;
+ XInputClass *anyclass;
+ register XKeyStatus *kv;
+ deviceKeyStateNotify *ksev = (deviceKeyStateNotify *) event;
+ XDeviceStateNotifyEvent *kstev = (XDeviceStateNotifyEvent *) save;
+
+ anyclass = (XInputClass *) & kstev->data[0];
+ for (i = 0; i < kstev->num_classes; i++)
+ if (anyclass->class == KeyClass)
+ break;
+ else
+ anyclass = (XInputClass *) ((char *)anyclass +
+ anyclass->length);
+
+ kv = (XKeyStatus *) anyclass;
+ kv->num_keys = 256;
+ memcpy((char *)&kv->keys[4], (char *)ksev->keys, 28);
+ if (ksev->deviceid & MORE_EVENTS)
+ return (DONT_ENQUEUE);
+ else {
+ *re = *save;
+ kstev = (XDeviceStateNotifyEvent *) re;
+ return (ENQUEUE_EVENT);
+ }
+ }
+ break;
+ case XI_DeviceButtonstateNotify:
+ {
+ int i;
+ XInputClass *anyclass;
+ register XButtonStatus *bv;
+ deviceButtonStateNotify *bsev = (deviceButtonStateNotify *) event;
+ XDeviceStateNotifyEvent *bstev = (XDeviceStateNotifyEvent *) save;
+
+ anyclass = (XInputClass *) & bstev->data[0];
+ for (i = 0; i < bstev->num_classes; i++)
+ if (anyclass->class == ButtonClass)
+ break;
+ else
+ anyclass = (XInputClass *) ((char *)anyclass +
+ anyclass->length);
+
+ bv = (XButtonStatus *) anyclass;
+ bv->num_buttons = 256;
+ memcpy((char *)&bv->buttons[4], (char *)bsev->buttons, 28);
+ if (bsev->deviceid & MORE_EVENTS)
+ return (DONT_ENQUEUE);
+ else {
+ *re = *save;
+ bstev = (XDeviceStateNotifyEvent *) re;
+ return (ENQUEUE_EVENT);
+ }
+ }
+ break;
+ case XI_DeviceMappingNotify:
+ {
+ register XDeviceMappingEvent *ev = (XDeviceMappingEvent *) re;
+ deviceMappingNotify *ev2 = (deviceMappingNotify *) event;
+
+ *ev = *((XDeviceMappingEvent *) save);
+ ev->window = 0;
+ ev->first_keycode = ev2->firstKeyCode;
+ ev->request = ev2->request;
+ ev->count = ev2->count;
+ ev->time = ev2->time;
+ ev->deviceid = ev2->deviceid & DEVICE_BITS;
+ return (ENQUEUE_EVENT);
+ }
+ break;
+ case XI_ChangeDeviceNotify:
+ {
+ register XChangeDeviceNotifyEvent *ev = (XChangeDeviceNotifyEvent *) re;
+ changeDeviceNotify *ev2 = (changeDeviceNotify *) event;
+
+ *ev = *((XChangeDeviceNotifyEvent *) save);
+ ev->window = 0;
+ ev->request = ev2->request;
+ ev->time = ev2->time;
+ ev->deviceid = ev2->deviceid & DEVICE_BITS;
+ return (ENQUEUE_EVENT);
+ }
+ break;
+ default:
+ printf("XInputWireToEvent: UNKNOWN WIRE EVENT! type=%d\n", type);
+ break;
+ }
+
+ return (DONT_ENQUEUE);
+}
diff --git a/lib/libXi/src/XExtToWire.c b/lib/libXi/src/XExtToWire.c
new file mode 100644
index 000000000..213da327c
--- /dev/null
+++ b/lib/libXi/src/XExtToWire.c
@@ -0,0 +1,461 @@
+/* $Xorg: XExtToWire.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XExtToWire.c,v 3.5 2002/10/16 00:37:28 dawes Exp $ */
+
+/****************************************************************
+ *
+ * XExtToWire.c - reformat an XEvent into a wire event.
+ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+Status
+_XiEventToWire(dpy, re, event, count)
+ register Display *dpy; /* pointer to display structure */
+ register XEvent *re; /* pointer to client event */
+ register xEvent **event; /* wire protocol event */
+ register int *count;
+{
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+ int i;
+
+ switch ((re->type & 0x7f) - info->codes->first_event) {
+ case XI_DeviceKeyPress:
+ case XI_DeviceKeyRelease:
+ {
+ register XDeviceKeyEvent *ev = (XDeviceKeyEvent *) re;
+ register deviceKeyButtonPointer *kev;
+ register deviceValuator *vev;
+
+ *count = 2;
+ kev = (deviceKeyButtonPointer *) Xmalloc(*count * sizeof(xEvent));
+ if (!kev)
+ return (_XUnknownNativeEvent(dpy, re, *event));
+ *event = (xEvent *) kev;
+
+ kev->type = ev->type;
+ kev->root = ev->root;
+ kev->event = ev->window;
+ kev->child = ev->subwindow;
+ kev->time = ev->time;
+ kev->event_x = ev->x;
+ kev->event_y = ev->y;
+ kev->root_x = ev->x_root;
+ kev->root_y = ev->y_root;
+ kev->state = ev->state;
+ kev->same_screen = ev->same_screen;
+ kev->detail = ev->keycode;
+ kev->deviceid = ev->deviceid | MORE_EVENTS;
+
+ vev = (deviceValuator *)++ kev;
+ vev->type = info->codes->first_event + XI_DeviceValuator;
+ vev->deviceid = ev->deviceid;
+ vev->device_state = ev->device_state;
+ vev->first_valuator = ev->first_axis;
+ vev->num_valuators = ev->axes_count;
+ i = vev->num_valuators;
+ if (i > 6)
+ i = 6;
+ switch (i) {
+ case 6:
+ vev->valuator5 = ev->axis_data[5];
+ case 5:
+ vev->valuator4 = ev->axis_data[4];
+ case 4:
+ vev->valuator3 = ev->axis_data[3];
+ case 3:
+ vev->valuator2 = ev->axis_data[2];
+ case 2:
+ vev->valuator1 = ev->axis_data[1];
+ case 1:
+ vev->valuator0 = ev->axis_data[0];
+ }
+ break;
+ }
+ case XI_ProximityIn:
+ case XI_ProximityOut:
+ {
+ register XProximityNotifyEvent *ev = (XProximityNotifyEvent *) re;
+ register deviceKeyButtonPointer *pev;
+ register deviceValuator *vev;
+
+ *count = 2;
+ pev = (deviceKeyButtonPointer *) Xmalloc(*count * sizeof(xEvent));
+ if (!pev)
+ return (_XUnknownNativeEvent(dpy, re, *event));
+ *event = (xEvent *) pev;
+
+ pev->type = ev->type;
+ pev->root = ev->root;
+ pev->event = ev->window;
+ pev->child = ev->subwindow;
+ pev->time = ev->time;
+ pev->event_x = ev->x;
+ pev->event_y = ev->y;
+ pev->root_x = ev->x_root;
+ pev->root_y = ev->y_root;
+ pev->state = ev->state;
+ pev->same_screen = ev->same_screen;
+ pev->deviceid = ev->deviceid | MORE_EVENTS;
+
+ vev = (deviceValuator *)++ pev;
+ vev->type = info->codes->first_event + XI_DeviceValuator;
+ vev->deviceid = ev->deviceid;
+ vev->device_state = ev->device_state;
+ vev->first_valuator = ev->first_axis;
+ vev->num_valuators = ev->axes_count;
+
+ i = vev->num_valuators;
+ if (i > 6)
+ i = 6;
+ switch (i) {
+ case 6:
+ vev->valuator5 = ev->axis_data[5];
+ case 5:
+ vev->valuator4 = ev->axis_data[4];
+ case 4:
+ vev->valuator3 = ev->axis_data[3];
+ case 3:
+ vev->valuator2 = ev->axis_data[2];
+ case 2:
+ vev->valuator1 = ev->axis_data[1];
+ case 1:
+ vev->valuator0 = ev->axis_data[0];
+ }
+ break;
+ }
+ case XI_DeviceButtonPress:
+ case XI_DeviceButtonRelease:
+ {
+ register XDeviceButtonEvent *ev = (XDeviceButtonEvent *) re;
+ register deviceKeyButtonPointer *bev;
+ register deviceValuator *vev;
+
+ *count = 2;
+ bev = (deviceKeyButtonPointer *) Xmalloc(*count * sizeof(xEvent));
+ if (!bev)
+ return (_XUnknownNativeEvent(dpy, re, *event));
+ *event = (xEvent *) bev;
+
+ bev->type = ev->type;
+ bev->root = ev->root;
+ bev->event = ev->window;
+ bev->child = ev->subwindow;
+ bev->time = ev->time;
+ bev->event_x = ev->x;
+ bev->event_y = ev->y;
+ bev->root_x = ev->x_root;
+ bev->root_y = ev->y_root;
+ bev->state = ev->state;
+ bev->same_screen = ev->same_screen;
+ bev->detail = ev->button;
+ bev->deviceid = ev->deviceid | MORE_EVENTS;
+
+ vev = (deviceValuator *)++ bev;
+ vev->type = info->codes->first_event + XI_DeviceValuator;
+ vev->deviceid = ev->deviceid;
+ vev->device_state = ev->device_state;
+ vev->first_valuator = ev->first_axis;
+ vev->num_valuators = ev->axes_count;
+
+ i = vev->num_valuators;
+ if (i > 6)
+ i = 6;
+ switch (i) {
+ case 6:
+ vev->valuator5 = ev->axis_data[5];
+ case 5:
+ vev->valuator4 = ev->axis_data[4];
+ case 4:
+ vev->valuator3 = ev->axis_data[3];
+ case 3:
+ vev->valuator2 = ev->axis_data[2];
+ case 2:
+ vev->valuator1 = ev->axis_data[1];
+ case 1:
+ vev->valuator0 = ev->axis_data[0];
+ }
+ break;
+ }
+ case XI_DeviceMotionNotify:
+ {
+ register XDeviceMotionEvent *ev = (XDeviceMotionEvent *) re;
+ register deviceKeyButtonPointer *mev;
+ register deviceValuator *vev;
+
+ *count = 2;
+ mev = (deviceKeyButtonPointer *) Xmalloc(*count * sizeof(xEvent));
+ if (!mev)
+ return (_XUnknownNativeEvent(dpy, re, *event));
+ *event = (xEvent *) mev;
+
+ mev->type = ev->type;
+ mev->root = ev->root;
+ mev->event = ev->window;
+ mev->child = ev->subwindow;
+ mev->time = ev->time;
+ mev->event_x = ev->x;
+ mev->event_y = ev->y;
+ mev->root_x = ev->x_root;
+ mev->root_y = ev->y_root;
+ mev->state = ev->state;
+ mev->same_screen = ev->same_screen;
+ mev->detail = ev->is_hint;
+ mev->deviceid = ev->deviceid | MORE_EVENTS;
+
+ vev = (deviceValuator *)++ mev;
+ vev->type = info->codes->first_event + XI_DeviceValuator;
+ vev->deviceid = ev->deviceid;
+ vev->device_state = ev->device_state;
+ vev->first_valuator = ev->first_axis;
+ vev->num_valuators = ev->axes_count;
+
+ i = vev->num_valuators;
+ if (i > 6)
+ i = 6;
+ switch (i) {
+ case 6:
+ vev->valuator5 = ev->axis_data[5];
+ case 5:
+ vev->valuator4 = ev->axis_data[4];
+ case 4:
+ vev->valuator3 = ev->axis_data[3];
+ case 3:
+ vev->valuator2 = ev->axis_data[2];
+ case 2:
+ vev->valuator1 = ev->axis_data[1];
+ case 1:
+ vev->valuator0 = ev->axis_data[0];
+ }
+ break;
+ }
+ case XI_DeviceFocusIn:
+ case XI_DeviceFocusOut:
+ {
+ register XDeviceFocusChangeEvent *ev = (XDeviceFocusChangeEvent *) re;
+ register deviceFocus *fev;
+
+ *count = 1;
+ fev = (deviceFocus *) Xmalloc(*count * sizeof(xEvent));
+ if (!fev)
+ return (_XUnknownNativeEvent(dpy, re, *event));
+ *event = (xEvent *) fev;
+
+ fev->type = ev->type;
+ fev->window = ev->window;
+ fev->mode = ev->mode;
+ fev->detail = ev->detail;
+ fev->time = ev->time;
+ fev->deviceid = ev->deviceid;
+ break;
+ }
+ case XI_DeviceMappingNotify:
+ {
+ register XDeviceMappingEvent *ev = (XDeviceMappingEvent *) re;
+ register deviceMappingNotify *mev;
+
+ *count = 1;
+ mev = (deviceMappingNotify *) Xmalloc(*count * sizeof(xEvent));
+ if (!mev)
+ return (_XUnknownNativeEvent(dpy, re, *event));
+ *event = (xEvent *) mev;
+
+ mev->type = ev->type;
+ mev->firstKeyCode = ev->first_keycode;
+ mev->request = ev->request;
+ mev->count = ev->count;
+ mev->time = ev->time;
+ mev->deviceid = ev->deviceid;
+ break;
+ }
+ case XI_DeviceStateNotify:
+ {
+ register XDeviceStateNotifyEvent *ev = (XDeviceStateNotifyEvent *) re;
+ register deviceStateNotify *sev;
+ register xEvent *tev;
+ XInputClass *any = (XInputClass *) & ev->data[0];
+ unsigned char *sav_id;
+
+ *count = 1;
+
+ for (i = 0; i < ev->num_classes; i++) {
+ if (any->class == KeyClass) {
+ XKeyStatus *k = (XKeyStatus *) any;
+
+ if (k->num_keys > 32)
+ (*count)++;
+ } else if (any->class == ButtonClass) {
+ XButtonStatus *b = (XButtonStatus *) any;
+
+ if (b->num_buttons > 32)
+ (*count)++;
+ } else if (any->class == ValuatorClass) {
+ XValuatorStatus *v = (XValuatorStatus *) any;
+
+ if (v->num_valuators > 3)
+ (*count)++;
+ }
+ any = (XInputClass *) ((char *)any + any->length);
+ }
+
+ sev = (deviceStateNotify *) Xmalloc(*count * sizeof(xEvent));
+ if (!sev)
+ return (_XUnknownNativeEvent(dpy, re, *event));
+ *event = (xEvent *) sev;
+ tev = (xEvent *) (sev + 1);
+
+ sev->type = ev->type;
+ sev->deviceid = ev->deviceid;
+ sav_id = &(sev->deviceid);
+ sev->time = ev->time;
+ sev->classes_reported = 0;
+
+ any = (XInputClass *) & ev->data[0];
+ for (i = 0; i < ev->num_classes; i++) {
+ if (any->class == KeyClass) {
+ XKeyStatus *k = (XKeyStatus *) any;
+ register deviceKeyStateNotify *kev;
+
+ sev->classes_reported |= (1 << KeyClass);
+ sev->num_keys = k->num_keys;
+ memcpy((char *)(sev->keys), (char *)(k->keys), 4);
+ if (k->num_keys > 32) {
+ kev = (deviceKeyStateNotify *) tev++;
+ kev->type = info->codes->first_event +
+ XI_DeviceKeystateNotify;
+ kev->deviceid = ev->deviceid;
+ *sav_id |= MORE_EVENTS;
+ sav_id = &(kev->deviceid);
+ memcpy((char *)(kev->keys), (char *)(&k->keys[4]), 28);
+ }
+ } else if (any->class == ButtonClass) {
+ XButtonStatus *b = (XButtonStatus *) any;
+ register deviceButtonStateNotify *bev;
+
+ sev->classes_reported |= (1 << ButtonClass);
+ sev->num_buttons = b->num_buttons;
+ memcpy((char *)(sev->buttons), (char *)(b->buttons), 4);
+ if (b->num_buttons > 32) {
+ bev = (deviceButtonStateNotify *) tev++;
+ bev->type = info->codes->first_event +
+ XI_DeviceButtonstateNotify;
+ bev->deviceid = ev->deviceid;
+ *sav_id |= MORE_EVENTS;
+ sav_id = &(bev->deviceid);
+ memcpy((char *)(bev->buttons), (char *)(&b->buttons[4]),
+ 28);
+ }
+ } else if (any->class == ValuatorClass) {
+ XValuatorStatus *val = (XValuatorStatus *) any;
+ register deviceValuator *vev;
+
+ sev->classes_reported |= (1 << ValuatorClass);
+ sev->num_valuators = val->num_valuators < 3 ?
+ val->num_valuators : 3;
+ switch (sev->num_valuators) {
+ case 3:
+ sev->valuator2 = val->valuators[2];
+ case 2:
+ sev->valuator1 = val->valuators[1];
+ case 1:
+ sev->valuator0 = val->valuators[0];
+ }
+ if (val->num_valuators > 3) {
+ vev = (deviceValuator *) tev++;
+ vev->type = info->codes->first_event + XI_DeviceValuator;
+ vev->deviceid = ev->deviceid;
+ vev->first_valuator = 3;
+ vev->num_valuators = val->num_valuators - 3;
+ *sav_id |= MORE_EVENTS;
+ sav_id = &(vev->deviceid);
+ i = val->num_valuators;
+ if (i > 6)
+ i = 6;
+ switch (i) {
+ case 6:
+ vev->valuator2 = val->valuators[5];
+ case 5:
+ vev->valuator1 = val->valuators[4];
+ case 4:
+ vev->valuator0 = val->valuators[3];
+ }
+ }
+ }
+ any = (XInputClass *) ((char *)any + any->length);
+ }
+ break;
+ }
+ case XI_ChangeDeviceNotify:
+ {
+ register XChangeDeviceNotifyEvent *ev = (XChangeDeviceNotifyEvent *) re;
+ register changeDeviceNotify *cev;
+
+ *count = 1;
+ cev = (changeDeviceNotify *) Xmalloc(*count * sizeof(xEvent));
+ if (!cev)
+ return (_XUnknownNativeEvent(dpy, re, *event));
+ *event = (xEvent *) cev;
+
+ cev->type = ev->type;
+ cev->request = ev->request;
+ cev->time = ev->time;
+ cev->deviceid = ev->deviceid;
+ break;
+ }
+ default:
+ return (_XUnknownNativeEvent(dpy, re, *event));
+ }
+ return (1);
+}
diff --git a/lib/libXi/src/XFreeLst.c b/lib/libXi/src/XFreeLst.c
new file mode 100644
index 000000000..1805c3069
--- /dev/null
+++ b/lib/libXi/src/XFreeLst.c
@@ -0,0 +1,72 @@
+/* $Xorg: XFreeLst.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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$ */
+
+/***********************************************************************
+ *
+ * XFreeDeviceList - free the input device list.
+ *
+ */
+
+#include <stdio.h>
+#include <X11/Xlib.h>
+
+/***********************************************************************
+ *
+ * Free the list of input devices.
+ *
+ */
+
+XFreeDeviceList(list)
+ XDeviceList *list;
+{
+ if (list != NULL) {
+ XFree((list->name) - sizeof(XDeviceList));
+ XFree((XDeviceList *) list);
+ }
+}
diff --git a/lib/libXi/src/XGMotion.c b/lib/libXi/src/XGMotion.c
new file mode 100644
index 000000000..daa879292
--- /dev/null
+++ b/lib/libXi/src/XGMotion.c
@@ -0,0 +1,145 @@
+/* $Xorg: XGMotion.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XGMotion.c,v 3.3 2001/12/14 19:55:12 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XGetDeviceMotionEvents - Get the motion history of an input device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+XDeviceTimeCoord
+ * XGetDeviceMotionEvents(dpy, dev, start, stop, nEvents, mode, axis_count)
+ register Display *
+ dpy;
+ XDevice *
+ dev;
+
+Time start;
+Time stop;
+ int *
+ nEvents;
+ int *
+ mode;
+ int *
+ axis_count;
+{
+ xGetDeviceMotionEventsReq *req;
+ xGetDeviceMotionEventsReply rep;
+ XDeviceTimeCoord *tc;
+ int *data, *bufp, *readp, *savp;
+ long size, size2;
+ int i, j;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return ((XDeviceTimeCoord *) NoSuchExtension);
+
+ GetReq(GetDeviceMotionEvents, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_GetDeviceMotionEvents;
+ req->start = start;
+ req->stop = stop;
+ req->deviceid = dev->device_id;
+
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ *nEvents = 0;
+ return (NULL);
+ }
+
+ *mode = rep.mode;
+ *axis_count = rep.axes;
+ *nEvents = rep.nEvents;
+ if (!rep.nEvents) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (NULL);
+ }
+ size = rep.length << 2;
+ size2 = rep.nEvents * (sizeof(XDeviceTimeCoord) + (rep.axes * sizeof(int)));
+ savp = readp = (int *)Xmalloc(size);
+ bufp = (int *)Xmalloc(size2);
+ if (!bufp || !savp) {
+ *nEvents = 0;
+ _XEatData(dpy, (unsigned long)size);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (NULL);
+ }
+ _XRead(dpy, (char *)readp, size);
+
+ tc = (XDeviceTimeCoord *) bufp;
+ data = (int *)(tc + rep.nEvents);
+ for (i = 0; i < *nEvents; i++, tc++) {
+ tc->time = *readp++;
+ tc->data = data;
+ for (j = 0; j < *axis_count; j++)
+ *data++ = *readp++;
+ }
+ XFree((char *)savp);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return ((XDeviceTimeCoord *) bufp);
+}
+
+void
+XFreeDeviceMotionEvents(events)
+ XDeviceTimeCoord *events;
+{
+ XFree((char *)events);
+}
diff --git a/lib/libXi/src/XGetBMap.c b/lib/libXi/src/XGetBMap.c
new file mode 100644
index 000000000..15cad74bb
--- /dev/null
+++ b/lib/libXi/src/XGetBMap.c
@@ -0,0 +1,106 @@
+/* $Xorg: XGetBMap.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XGetBMap.c,v 3.3 2001/12/14 19:55:13 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XGetDeviceButtonMapping - Get the button mapping of an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+#ifdef MIN /* some systems define this in <sys/param.h> */
+#undef MIN
+#endif
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+
+int
+XGetDeviceButtonMapping(dpy, device, map, nmap)
+ register Display *dpy;
+ XDevice *device;
+ unsigned char map[];
+ unsigned int nmap;
+{
+ int status = 0;
+ unsigned char mapping[256]; /* known fixed size */
+ long nbytes;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ register xGetDeviceButtonMappingReq *req;
+ xGetDeviceButtonMappingReply rep;
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return (NoSuchExtension);
+ GetReq(GetDeviceButtonMapping, req);
+
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_GetDeviceButtonMapping;
+ req->deviceid = device->device_id;
+
+ status = _XReply(dpy, (xReply *) & rep, 0, xFalse);
+ if (status == 1) {
+ nbytes = (long)rep.length << 2;
+ _XRead(dpy, (char *)mapping, nbytes);
+
+ /* don't return more data than the user asked for. */
+ if (rep.nElts)
+ memcpy((char *)map, (char *)mapping, MIN((int)rep.nElts, nmap));
+ status = rep.nElts;
+ } else
+ status = 0;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (status);
+}
diff --git a/lib/libXi/src/XGetDCtl.c b/lib/libXi/src/XGetDCtl.c
new file mode 100644
index 000000000..9f258cfa5
--- /dev/null
+++ b/lib/libXi/src/XGetDCtl.c
@@ -0,0 +1,171 @@
+/* $Xorg: XGetDCtl.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XGetDCtl.c,v 3.3 2001/12/14 19:55:13 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XGetDeviceControl - get the Device control state of an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+XDeviceControl * XGetDeviceControl(dpy, dev, control)
+ register Display *
+ dpy;
+ XDevice *
+ dev;
+ int
+ control;
+{
+ int size = 0;
+ int nbytes, i;
+ XDeviceControl *Device = NULL;
+ XDeviceControl *Sav = NULL;
+ xDeviceState *d = NULL;
+ xDeviceState *sav = NULL;
+ xGetDeviceControlReq *req;
+ xGetDeviceControlReply rep;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Add_XChangeDeviceControl, info) == -1)
+ return ((XDeviceControl *) NoSuchExtension);
+
+ GetReq(GetDeviceControl, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_GetDeviceControl;
+ req->deviceid = dev->device_id;
+ req->control = control;
+
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (XDeviceControl *) NULL;
+ }
+ if (rep.length > 0) {
+ nbytes = (long)rep.length << 2;
+ d = (xDeviceState *) Xmalloc((unsigned)nbytes);
+ if (!d) {
+ _XEatData(dpy, (unsigned long)nbytes);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (XDeviceControl *) NULL;
+ }
+ sav = d;
+ _XRead(dpy, (char *)d, nbytes);
+
+ switch (d->control) {
+ case DEVICE_RESOLUTION:
+ {
+ xDeviceResolutionState *r;
+
+ r = (xDeviceResolutionState *) d;
+ size += sizeof(XDeviceResolutionState) +
+ (3 * sizeof(int) * r->num_valuators);
+ break;
+ }
+ default:
+ size += d->length;
+ break;
+ }
+
+ Device = (XDeviceControl *) Xmalloc((unsigned)size);
+ if (!Device) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (XDeviceControl *) NULL;
+ }
+ Sav = Device;
+
+ d = sav;
+ switch (control) {
+ case DEVICE_RESOLUTION:
+ {
+ int *iptr, *iptr2;
+ xDeviceResolutionState *r;
+ XDeviceResolutionState *R;
+
+ r = (xDeviceResolutionState *) d;
+ R = (XDeviceResolutionState *) Device;
+
+ R->control = DEVICE_RESOLUTION;
+ R->length = sizeof(XDeviceResolutionState);
+ R->num_valuators = r->num_valuators;
+ iptr = (int *)(R + 1);
+ iptr2 = (int *)(r + 1);
+ R->resolutions = iptr;
+ R->min_resolutions = iptr + R->num_valuators;
+ R->max_resolutions = iptr + (2 * R->num_valuators);
+ for (i = 0; i < (3 * R->num_valuators); i++)
+ *iptr++ = *iptr2++;
+ break;
+ }
+ default:
+ break;
+ }
+ XFree(sav);
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (Sav);
+}
+
+void
+XFreeDeviceControl(control)
+ XDeviceControl *control;
+{
+ XFree(control);
+}
diff --git a/lib/libXi/src/XGetFCtl.c b/lib/libXi/src/XGetFCtl.c
new file mode 100644
index 000000000..af4578c72
--- /dev/null
+++ b/lib/libXi/src/XGetFCtl.c
@@ -0,0 +1,272 @@
+/* $Xorg: XGetFCtl.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XGetFCtl.c,v 3.3 2001/12/14 19:55:14 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XGetFeedbackControl - get the feedback attributes of an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+XFeedbackState *
+XGetFeedbackControl(dpy, dev, num_feedbacks)
+ register Display *dpy;
+ XDevice *dev;
+ int *num_feedbacks;
+{
+ int size = 0;
+ int nbytes, i;
+ XFeedbackState *Feedback = NULL;
+ XFeedbackState *Sav = NULL;
+ xFeedbackState *f = NULL;
+ xFeedbackState *sav = NULL;
+ xGetFeedbackControlReq *req;
+ xGetFeedbackControlReply rep;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return ((XFeedbackState *) NoSuchExtension);
+
+ GetReq(GetFeedbackControl, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_GetFeedbackControl;
+ req->deviceid = dev->device_id;
+
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (XFeedbackState *) NULL;
+ }
+ if (rep.length > 0) {
+ *num_feedbacks = rep.num_feedbacks;
+ nbytes = (long)rep.length << 2;
+ f = (xFeedbackState *) Xmalloc((unsigned)nbytes);
+ if (!f) {
+ _XEatData(dpy, (unsigned long)nbytes);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (XFeedbackState *) NULL;
+ }
+ sav = f;
+ _XRead(dpy, (char *)f, nbytes);
+
+ for (i = 0; i < *num_feedbacks; i++) {
+ switch (f->class) {
+ case KbdFeedbackClass:
+ size += sizeof(XKbdFeedbackState);
+ break;
+ case PtrFeedbackClass:
+ size += sizeof(XPtrFeedbackState);
+ break;
+ case IntegerFeedbackClass:
+ size += sizeof(XIntegerFeedbackState);
+ break;
+ case StringFeedbackClass:
+ {
+ xStringFeedbackState *strf = (xStringFeedbackState *) f;
+
+ size += sizeof(XStringFeedbackState) +
+ (strf->num_syms_supported * sizeof(KeySym));
+ }
+ break;
+ case LedFeedbackClass:
+ size += sizeof(XLedFeedbackState);
+ break;
+ case BellFeedbackClass:
+ size += sizeof(XBellFeedbackState);
+ break;
+ default:
+ size += f->length;
+ break;
+ }
+ f = (xFeedbackState *) ((char *)f + f->length);
+ }
+
+ Feedback = (XFeedbackState *) Xmalloc((unsigned)size);
+ if (!Feedback) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (XFeedbackState *) NULL;
+ }
+ Sav = Feedback;
+
+ f = sav;
+ for (i = 0; i < *num_feedbacks; i++) {
+ switch (f->class) {
+ case KbdFeedbackClass:
+ {
+ xKbdFeedbackState *k;
+ XKbdFeedbackState *K;
+
+ k = (xKbdFeedbackState *) f;
+ K = (XKbdFeedbackState *) Feedback;
+
+ K->class = k->class;
+ K->length = sizeof(XKbdFeedbackState);
+ K->id = k->id;
+ K->click = k->click;
+ K->percent = k->percent;
+ K->pitch = k->pitch;
+ K->duration = k->duration;
+ K->led_mask = k->led_mask;
+ K->global_auto_repeat = k->global_auto_repeat;
+ memcpy((char *)&K->auto_repeats[0],
+ (char *)&k->auto_repeats[0], 32);
+ break;
+ }
+ case PtrFeedbackClass:
+ {
+ xPtrFeedbackState *p;
+ XPtrFeedbackState *P;
+
+ p = (xPtrFeedbackState *) f;
+ P = (XPtrFeedbackState *) Feedback;
+
+ P->class = p->class;
+ P->length = sizeof(XPtrFeedbackState);
+ P->id = p->id;
+ P->accelNum = p->accelNum;
+ P->accelDenom = p->accelDenom;
+ P->threshold = p->threshold;
+ break;
+ }
+ case IntegerFeedbackClass:
+ {
+ xIntegerFeedbackState *i;
+ XIntegerFeedbackState *I;
+
+ i = (xIntegerFeedbackState *) f;
+ I = (XIntegerFeedbackState *) Feedback;
+
+ I->class = i->class;
+ I->length = sizeof(XIntegerFeedbackState);
+ I->id = i->id;
+ I->resolution = i->resolution;
+ I->minVal = i->min_value;
+ I->maxVal = i->max_value;
+ break;
+ }
+ case StringFeedbackClass:
+ {
+ xStringFeedbackState *s;
+ XStringFeedbackState *S;
+
+ s = (xStringFeedbackState *) f;
+ S = (XStringFeedbackState *) Feedback;
+
+ S->class = s->class;
+ S->length = sizeof(XStringFeedbackState) +
+ (s->num_syms_supported * sizeof(KeySym));
+ S->id = s->id;
+ S->max_symbols = s->max_symbols;
+ S->num_syms_supported = s->num_syms_supported;
+ S->syms_supported = (KeySym *) (S + 1);
+ memcpy((char *)S->syms_supported, (char *)(s + 1),
+ (S->num_syms_supported * sizeof(KeySym)));
+ break;
+ }
+ case LedFeedbackClass:
+ {
+ xLedFeedbackState *l;
+ XLedFeedbackState *L;
+
+ l = (xLedFeedbackState *) f;
+ L = (XLedFeedbackState *) Feedback;
+
+ L->class = l->class;
+ L->length = sizeof(XLedFeedbackState);
+ L->id = l->id;
+ L->led_values = l->led_values;
+ L->led_mask = l->led_mask;
+ break;
+ }
+ case BellFeedbackClass:
+ {
+ xBellFeedbackState *b;
+ XBellFeedbackState *B;
+
+ b = (xBellFeedbackState *) f;
+ B = (XBellFeedbackState *) Feedback;
+
+ B->class = b->class;
+ B->length = sizeof(XBellFeedbackState);
+ B->id = b->id;
+ B->percent = b->percent;
+ B->pitch = b->pitch;
+ B->duration = b->duration;
+ break;
+ }
+ default:
+ break;
+ }
+ f = (xFeedbackState *) ((char *)f + f->length);
+ Feedback = (XFeedbackState *) ((char *)Feedback + Feedback->length);
+ }
+ XFree((char *)sav);
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (Sav);
+}
+
+void
+XFreeFeedbackList(list)
+ XFeedbackState *list;
+{
+ XFree((char *)list);
+}
diff --git a/lib/libXi/src/XGetKMap.c b/lib/libXi/src/XGetKMap.c
new file mode 100644
index 000000000..0381e8691
--- /dev/null
+++ b/lib/libXi/src/XGetKMap.c
@@ -0,0 +1,107 @@
+/* $Xorg: XGetKMap.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XGetKMap.c,v 3.4 2002/10/16 00:37:28 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XGetDeviceKeyMapping - get the keymap of an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+KeySym *
+XGetDeviceKeyMapping(register Display * dpy, XDevice * dev,
+#if NeedWidePrototypes
+ unsigned int first,
+#else
+ KeyCode first,
+#endif
+ int keycount, int *syms_per_code)
+{
+ long nbytes;
+ register KeySym *mapping = NULL;
+ xGetDeviceKeyMappingReq *req;
+ xGetDeviceKeyMappingReply rep;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return ((KeySym *) NoSuchExtension);
+
+ GetReq(GetDeviceKeyMapping, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_GetDeviceKeyMapping;
+ req->deviceid = dev->device_id;
+ req->firstKeyCode = first;
+ req->count = keycount;
+
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (KeySym *) NULL;
+ }
+ if (rep.length > 0) {
+ *syms_per_code = rep.keySymsPerKeyCode;
+ nbytes = (long)rep.length << 2;
+ mapping = (KeySym *) Xmalloc((unsigned)nbytes);
+ if (mapping)
+ _XRead(dpy, (char *)mapping, nbytes);
+ else
+ _XEatData(dpy, (unsigned long)nbytes);
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (mapping);
+}
diff --git a/lib/libXi/src/XGetMMap.c b/lib/libXi/src/XGetMMap.c
new file mode 100644
index 000000000..ef922817c
--- /dev/null
+++ b/lib/libXi/src/XGetMMap.c
@@ -0,0 +1,102 @@
+/* $Xorg: XGetMMap.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XGetMMap.c,v 3.3 2001/12/14 19:55:16 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XGetDeviceModifierMapping - get the modifier map of an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+XModifierKeymap *
+XGetDeviceModifierMapping(dpy, dev)
+ register Display *dpy;
+ XDevice *dev;
+{
+ unsigned long nbytes;
+ XModifierKeymap *res;
+ xGetDeviceModifierMappingReq *req;
+ xGetDeviceModifierMappingReply rep;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return ((XModifierKeymap *) NoSuchExtension);
+
+ GetReq(GetDeviceModifierMapping, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_GetDeviceModifierMapping;
+ req->deviceid = dev->device_id;
+
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (XModifierKeymap *) NULL;
+ }
+ nbytes = (unsigned long)rep.length << 2;
+ res = (XModifierKeymap *) Xmalloc(sizeof(XModifierKeymap));
+ if (res) {
+ res->modifiermap = (KeyCode *) Xmalloc(nbytes);
+ if (res->modifiermap)
+ _XReadPad(dpy, (char *)res->modifiermap, nbytes);
+ else
+ _XEatData(dpy, (unsigned long)nbytes);
+ res->max_keypermod = rep.numKeyPerModifier;
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (res);
+}
diff --git a/lib/libXi/src/XGetProp.c b/lib/libXi/src/XGetProp.c
new file mode 100644
index 000000000..71d844b1b
--- /dev/null
+++ b/lib/libXi/src/XGetProp.c
@@ -0,0 +1,115 @@
+/* $Xorg: XGetProp.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XGetProp.c,v 3.3 2001/12/14 19:55:17 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XGetDeviceDontPropagateList - Get the dont_propagate_list for a
+ * window.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+XEventClass *
+XGetDeviceDontPropagateList(dpy, window, count)
+ register Display *dpy;
+
+Window window;
+ int *count;
+{
+ XEventClass *list = NULL;
+ int rlen;
+ xGetDeviceDontPropagateListReq *req;
+ xGetDeviceDontPropagateListReply rep;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return ((XEventClass *) NoSuchExtension);
+
+ GetReq(GetDeviceDontPropagateList, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_GetDeviceDontPropagateList;
+ req->window = window;
+
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (XEventClass *) NULL;
+ }
+ *count = rep.count;
+
+ if (*count) {
+ rlen = rep.length << 2;
+ list = (XEventClass *) Xmalloc(rep.length * sizeof(XEventClass));
+ if (list) {
+ int i;
+ CARD32 ec;
+
+ /* read and assign each XEventClass separately because
+ * the library representation may not be the same size
+ * as the wire representation (64 bit machines)
+ */
+ for (i = 0; i < rep.length; i++) {
+ _XRead(dpy, (char *)(&ec), sizeof(CARD32));
+ list[i] = (XEventClass) ec;
+ }
+ } else
+ _XEatData(dpy, (unsigned long)rlen);
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (list);
+}
diff --git a/lib/libXi/src/XGetVers.c b/lib/libXi/src/XGetVers.c
new file mode 100644
index 000000000..5fe3a872c
--- /dev/null
+++ b/lib/libXi/src/XGetVers.c
@@ -0,0 +1,107 @@
+/* $Xorg: XGetVers.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XGetVers.c,v 3.6 2003/07/08 15:39:47 tsi Exp $ */
+
+/***********************************************************************
+ *
+ * XGetExtensionVersion - Get the version of the input extension.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+XExtensionVersion *
+XGetExtensionVersion(register Display * dpy, _Xconst char *name)
+{
+ XExtensionVersion *ext;
+
+ LockDisplay(dpy);
+ ext = _XiGetExtensionVersion(dpy, name);
+ if (ext != (XExtensionVersion *) NoSuchExtension) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+ return (ext);
+}
+
+XExtensionVersion *
+_XiGetExtensionVersion(register Display * dpy, _Xconst char *name)
+{
+ xGetExtensionVersionReq *req;
+ xGetExtensionVersionReply rep;
+ XExtensionVersion *ext;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ if (_XiCheckExtInit(dpy, Dont_Check, info) == -1)
+ return ((XExtensionVersion *) NoSuchExtension);
+
+ GetReq(GetExtensionVersion, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_GetExtensionVersion;
+ req->nbytes = name ? strlen(name) : 0;
+ req->length += (unsigned)(req->nbytes + 3) >> 2;
+ _XSend(dpy, name, (long)req->nbytes);
+
+ if (!_XReply(dpy, (xReply *) & rep, 0, xTrue)) {
+ return (XExtensionVersion *) NULL;
+ }
+ ext = (XExtensionVersion *) Xmalloc(sizeof(XExtensionVersion));
+ if (ext) {
+ ext->present = rep.present;
+ if (ext->present) {
+ ext->major_version = rep.major_version;
+ ext->minor_version = rep.minor_version;
+ }
+ }
+ return (ext);
+}
diff --git a/lib/libXi/src/XGrDvBut.c b/lib/libXi/src/XGrDvBut.c
new file mode 100644
index 000000000..6e3509996
--- /dev/null
+++ b/lib/libXi/src/XGrDvBut.c
@@ -0,0 +1,114 @@
+/* $Xorg: XGrDvBut.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XGrDvBut.c,v 3.4 2001/12/14 19:55:17 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XGrabDeviceBut - Grab a button on an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XGrabDeviceButton(dpy, dev, button, modifiers, modifier_device,
+ grab_window, owner_events, event_count, event_list,
+ this_device_mode, other_devices_mode)
+ register Display *dpy;
+ XDevice *dev;
+ unsigned int button; /* CARD8 */
+ unsigned int modifiers; /* CARD16 */
+ XDevice *modifier_device;
+ Window grab_window;
+ Bool owner_events;
+ unsigned int event_count;
+ XEventClass *event_list;
+ int this_device_mode;
+ int other_devices_mode;
+{
+ register xGrabDeviceButtonReq *req;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return (NoSuchExtension);
+
+ GetReq(GrabDeviceButton, req);
+
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_GrabDeviceButton;
+ req->grabbed_device = dev->device_id;
+ req->button = button;
+ req->modifiers = modifiers;
+ if (modifier_device)
+ req->modifier_device = modifier_device->device_id;
+ else
+ req->modifier_device = UseXKeyboard;
+ req->grabWindow = grab_window;
+ req->ownerEvents = owner_events;
+ req->event_count = event_count;
+ req->this_device_mode = this_device_mode;
+ req->other_devices_mode = other_devices_mode;
+ req->length += event_count;
+
+ /* note: Data is a macro that uses its arguments multiple
+ * times, so "nvalues" is changed in a separate assignment
+ * statement */
+
+ event_count <<= 2;
+ Data32(dpy, (long *)event_list, event_count);
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (Success);
+}
diff --git a/lib/libXi/src/XGrDvKey.c b/lib/libXi/src/XGrDvKey.c
new file mode 100644
index 000000000..1389753d2
--- /dev/null
+++ b/lib/libXi/src/XGrDvKey.c
@@ -0,0 +1,116 @@
+/* $Xorg: XGrDvKey.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XGrDvKey.c,v 3.3 2001/12/14 19:55:17 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XGrabDeviceKey - Grab a key on an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XGrabDeviceKey(dpy, dev, key, modifiers, modifier_device,
+ grab_window, owner_events, event_count, event_list,
+ this_device_mode, other_devices_mode)
+ register Display *dpy;
+ XDevice *dev;
+ unsigned int key; /* CARD8 */
+ unsigned int modifiers; /* CARD16 */
+ XDevice *modifier_device;
+ Window grab_window;
+ Bool owner_events;
+ unsigned int event_count;
+ XEventClass *event_list;
+ int this_device_mode;
+ int other_devices_mode;
+{
+ register xGrabDeviceKeyReq *req;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return (NoSuchExtension);
+
+ GetReq(GrabDeviceKey, req);
+
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_GrabDeviceKey;
+ req->grabbed_device = dev->device_id;
+ req->key = key;
+ req->modifiers = modifiers;
+ if (modifier_device)
+ req->modifier_device = modifier_device->device_id;
+ else
+ req->modifier_device = UseXKeyboard;
+ req->grabWindow = grab_window;
+ req->ownerEvents = owner_events;
+ req->event_count = event_count;
+ req->this_device_mode = this_device_mode;
+ req->other_devices_mode = other_devices_mode;
+ req->length += event_count;
+
+ /* note: Data is a macro that uses its arguments multiple
+ * times, so "nvalues" is changed in a separate assignment
+ * statement */
+
+ if (event_count) {
+ event_count <<= 2;
+ Data32(dpy, (long *)event_list, event_count);
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (Success);
+}
diff --git a/lib/libXi/src/XGrabDev.c b/lib/libXi/src/XGrabDev.c
new file mode 100644
index 000000000..92f1c118a
--- /dev/null
+++ b/lib/libXi/src/XGrabDev.c
@@ -0,0 +1,109 @@
+/* $Xorg: XGrabDev.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XGrabDev.c,v 3.3 2001/12/14 19:55:17 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XGrabDevice - grab an extension input device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XGrabDevice(dpy, dev, grab_window, ownerEvents, event_count, event_list,
+ this_device_mode, other_devices_mode, time)
+ register Display *dpy;
+ XDevice *dev;
+ Window grab_window;
+ Bool ownerEvents;
+ int event_count;
+ XEventClass *event_list;
+ int this_device_mode;
+ int other_devices_mode;
+ Time time;
+{
+ xGrabDeviceReply rep;
+ register xGrabDeviceReq *req;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return (NoSuchExtension);
+
+ GetReq(GrabDevice, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_GrabDevice;
+
+ req->deviceid = dev->device_id;
+ req->grabWindow = grab_window;
+ req->ownerEvents = ownerEvents;
+ req->event_count = event_count;
+ req->this_device_mode = this_device_mode;
+ req->other_devices_mode = other_devices_mode;
+ req->time = time;
+ req->length += event_count;
+
+ /* note: Data is a macro that uses its arguments multiple
+ * times, so "nvalues" is changed in a separate assignment
+ * statement */
+
+ event_count <<= 2;
+ Data32(dpy, (long *)event_list, event_count);
+
+ if (_XReply(dpy, (xReply *) & rep, 0, xTrue) == 0)
+ rep.status = GrabSuccess;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (rep.status);
+}
diff --git a/lib/libXi/src/XGtFocus.c b/lib/libXi/src/XGtFocus.c
new file mode 100644
index 000000000..4e6391813
--- /dev/null
+++ b/lib/libXi/src/XGtFocus.c
@@ -0,0 +1,91 @@
+/* $Xorg: XGtFocus.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XGtFocus.c,v 3.3 2001/12/14 19:55:18 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XGetDeviceFocus - Get the focus of an input device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XGetDeviceFocus(dpy, dev, focus, revert_to, time)
+ register Display *dpy;
+ XDevice *dev;
+ Window *focus;
+ int *revert_to;
+ Time *time;
+{
+ xGetDeviceFocusReq *req;
+ xGetDeviceFocusReply rep;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return (NoSuchExtension);
+
+ GetReq(GetDeviceFocus, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_GetDeviceFocus;
+ req->deviceid = dev->device_id;
+
+ (void)_XReply(dpy, (xReply *) & rep, 0, xTrue);
+ *focus = rep.focus;
+ *revert_to = rep.revertTo;
+ *time = rep.time;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (Success);
+}
diff --git a/lib/libXi/src/XGtSelect.c b/lib/libXi/src/XGtSelect.c
new file mode 100644
index 000000000..9f596fd5b
--- /dev/null
+++ b/lib/libXi/src/XGtSelect.c
@@ -0,0 +1,139 @@
+/* $Xorg: XGtSelect.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XGtSelect.c,v 3.3 2001/12/14 19:55:19 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XGetSelectedExtensionEvents - return a list of currently selected events.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XGetSelectedExtensionEvents(dpy, w, this_client_count, this_client_list,
+ all_clients_count, all_clients_list)
+ register Display *dpy;
+ Window w;
+ int *this_client_count;
+ XEventClass **this_client_list;
+ int *all_clients_count;
+ XEventClass **all_clients_list;
+{
+ int tlen, alen;
+ register xGetSelectedExtensionEventsReq *req;
+ xGetSelectedExtensionEventsReply rep;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return (NoSuchExtension);
+ GetReq(GetSelectedExtensionEvents, req);
+
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_GetSelectedExtensionEvents;
+ req->window = w;
+
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return Success;
+ }
+
+ *this_client_count = rep.this_client_count;
+ *all_clients_count = rep.all_clients_count;
+
+ if (rep.length) {
+ int i;
+ CARD32 ec;
+
+ tlen = (*this_client_count) * sizeof(CARD32);
+ alen = (rep.length << 2) - tlen;
+
+ if (tlen) {
+ *this_client_list =
+ (XEventClass *) Xmalloc(*this_client_count *
+ sizeof(XEventClass));
+ if (!*this_client_list) {
+ _XEatData(dpy, (unsigned long)tlen + alen);
+ return (Success);
+ }
+ for (i = 0; i < *this_client_count; i++) {
+ _XRead(dpy, (char *)(&ec), sizeof(CARD32));
+ (*this_client_list)[i] = (XEventClass) ec;
+ }
+ } else
+ *this_client_list = (XEventClass *) NULL;
+ if (alen) {
+ *all_clients_list =
+ (XEventClass *) Xmalloc(*all_clients_count *
+ sizeof(XEventClass));
+ if (!*all_clients_list) {
+ Xfree((char *)*this_client_list);
+ *this_client_list = NULL;
+ _XEatData(dpy, (unsigned long)alen);
+ return (Success);
+ }
+ for (i = 0; i < *all_clients_count; i++) {
+ _XRead(dpy, (char *)(&ec), sizeof(CARD32));
+ (*all_clients_list)[i] = (XEventClass) ec;
+ }
+ } else
+ *all_clients_list = (XEventClass *) NULL;
+
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (Success);
+}
diff --git a/lib/libXi/src/XIint.h b/lib/libXi/src/XIint.h
new file mode 100644
index 000000000..0924a887c
--- /dev/null
+++ b/lib/libXi/src/XIint.h
@@ -0,0 +1,17 @@
+/* $XFree86: xc/lib/Xi/XIint.h,v 3.2 2003/07/07 15:34:22 eich Exp $ */
+
+/*
+ * XIint.h - Header definition and support file for the internal
+ * support routines used by the Xi library.
+ */
+
+#ifndef _XIINT_H_
+#define _XIINT_H_
+
+extern XExtDisplayInfo *XInput_find_display(Display *);
+
+extern int _XiCheckExtInit(Display *, int, XExtDisplayInfo *);
+
+extern XExtensionVersion *_XiGetExtensionVersion(Display *, _Xconst char *);
+
+#endif
diff --git a/lib/libXi/src/XListDev.c b/lib/libXi/src/XListDev.c
new file mode 100644
index 000000000..b9a617ded
--- /dev/null
+++ b/lib/libXi/src/XListDev.c
@@ -0,0 +1,247 @@
+/* $Xorg: XListDev.c,v 1.5 2001/02/09 02:03:51 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XListDev.c,v 3.4 2001/12/14 19:55:19 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XListInputDevices - Request the server to return a list of
+ * available input devices.
+ *
+ */
+
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+XDeviceInfo *
+XListInputDevices(dpy, ndevices)
+ register Display *dpy;
+ int *ndevices;
+{
+ int size;
+ xListInputDevicesReq *req;
+ xListInputDevicesReply rep;
+ xDeviceInfo *list, *slist = NULL;
+ XDeviceInfo *sclist = NULL;
+ XDeviceInfo *clist = NULL;
+ xAnyClassPtr any, sav_any;
+ XAnyClassPtr Any;
+ char *nptr, *Nptr;
+ register int i, j, k;
+ register long rlen;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return ((XDeviceInfo *) NULL);
+
+ GetReq(ListInputDevices, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_ListInputDevices;
+
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (XDeviceInfo *) NULL;
+ }
+
+ if ((*ndevices = rep.ndevices)) { /* at least 1 input device */
+ size = *ndevices * sizeof(XDeviceInfo);
+ rlen = rep.length << 2; /* multiply length by 4 */
+ list = (xDeviceInfo *) Xmalloc(rlen);
+ slist = list;
+ if (!slist) {
+ _XEatData(dpy, (unsigned long)rlen);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (XDeviceInfo *) NULL;
+ }
+ _XRead(dpy, (char *)list, rlen);
+
+ any = (xAnyClassPtr) ((char *)list + (*ndevices * sizeof(xDeviceInfo)));
+ sav_any = any;
+ for (i = 0; i < *ndevices; i++, list++) {
+ for (j = 0; j < (int)list->num_classes; j++) {
+ switch (any->class) {
+ case KeyClass:
+ size += sizeof(XKeyInfo);
+ break;
+ case ButtonClass:
+ size += sizeof(XButtonInfo);
+ break;
+ case ValuatorClass:
+ {
+ xValuatorInfoPtr v;
+
+ v = (xValuatorInfoPtr) any;
+ size += sizeof(XValuatorInfo) +
+ (v->num_axes * sizeof(XAxisInfo));
+ break;
+ }
+ default:
+ break;
+ }
+ any = (xAnyClassPtr) ((char *)any + any->length);
+ }
+ }
+
+ for (i = 0, nptr = (char *)any; i < *ndevices; i++) {
+ size += *nptr + 1;
+ nptr += (*nptr + 1);
+ }
+
+ clist = (XDeviceInfoPtr) Xmalloc(size);
+ if (!clist) {
+ XFree((char *)slist);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (XDeviceInfo *) NULL;
+ }
+ sclist = clist;
+ Any = (XAnyClassPtr) ((char *)clist +
+ (*ndevices * sizeof(XDeviceInfo)));
+ list = slist;
+ any = sav_any;
+ for (i = 0; i < *ndevices; i++, list++, clist++) {
+ clist->type = list->type;
+ clist->id = list->id;
+ clist->use = list->use;
+ clist->num_classes = list->num_classes;
+ clist->inputclassinfo = Any;
+ for (j = 0; j < (int)list->num_classes; j++) {
+ switch (any->class) {
+ case KeyClass:
+ {
+ XKeyInfoPtr K = (XKeyInfoPtr) Any;
+ xKeyInfoPtr k = (xKeyInfoPtr) any;
+
+ K->class = KeyClass;
+ K->length = sizeof(XKeyInfo);
+ K->min_keycode = k->min_keycode;
+ K->max_keycode = k->max_keycode;
+ K->num_keys = k->num_keys;
+ break;
+ }
+ case ButtonClass:
+ {
+ XButtonInfoPtr B = (XButtonInfoPtr) Any;
+ xButtonInfoPtr b = (xButtonInfoPtr) any;
+
+ B->class = ButtonClass;
+ B->length = sizeof(XButtonInfo);
+ B->num_buttons = b->num_buttons;
+ break;
+ }
+ case ValuatorClass:
+ {
+ XValuatorInfoPtr V = (XValuatorInfoPtr) Any;
+ xValuatorInfoPtr v = (xValuatorInfoPtr) any;
+ XAxisInfoPtr A;
+ xAxisInfoPtr a;
+
+ V->class = ValuatorClass;
+ V->length = sizeof(XValuatorInfo) +
+ (v->num_axes * sizeof(XAxisInfo));
+ V->num_axes = v->num_axes;
+ V->motion_buffer = v->motion_buffer_size;
+ V->mode = v->mode;
+ A = (XAxisInfoPtr) ((char *)V + sizeof(XValuatorInfo));
+ V->axes = A;
+ a = (xAxisInfoPtr) ((char *)any + sizeof(xValuatorInfo));
+ for (k = 0; k < (int)v->num_axes; k++, a++, A++) {
+ A->min_value = a->min_value;
+ A->max_value = a->max_value;
+ A->resolution = a->resolution;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ any = (xAnyClassPtr) ((char *)any + any->length);
+ Any = (XAnyClassPtr) ((char *)Any + Any->length);
+ }
+ }
+
+ clist = sclist;
+ nptr = (char *)any;
+ Nptr = (char *)Any;
+ for (i = 0; i < *ndevices; i++, clist++) {
+ clist->name = (char *)Nptr;
+ memcpy(Nptr, nptr + 1, *nptr);
+ Nptr += (*nptr);
+ *Nptr++ = '\0';
+ nptr += (*nptr + 1);
+ }
+ }
+
+ XFree((char *)slist);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (sclist);
+}
+
+/***********************************************************************
+ *
+ * Free the list of input devices.
+ *
+ */
+
+void
+XFreeDeviceList(list)
+ XDeviceInfo *list;
+{
+ if (list != NULL) {
+ XFree((char *)list);
+ }
+}
diff --git a/lib/libXi/src/XOpenDev.c b/lib/libXi/src/XOpenDev.c
new file mode 100644
index 000000000..d220330cc
--- /dev/null
+++ b/lib/libXi/src/XOpenDev.c
@@ -0,0 +1,109 @@
+/* $Xorg: XOpenDev.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XOpenDev.c,v 3.3 2001/12/14 19:55:20 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XOpenDevice - Request the server to open and extension input device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+XDevice *
+XOpenDevice(dpy, id)
+ register Display *dpy;
+ register XID id;
+{
+ register long rlen; /* raw length */
+ xOpenDeviceReq *req;
+ xOpenDeviceReply rep;
+ XDevice *dev;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return ((XDevice *) NoSuchExtension);
+
+ GetReq(OpenDevice, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_OpenDevice;
+ req->deviceid = id;
+
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (XDevice *) NULL;
+ }
+
+ rlen = rep.length << 2;
+ dev = (XDevice *) Xmalloc(sizeof(XDevice) + rep.num_classes *
+ sizeof(XInputClassInfo));
+ if (dev) {
+ int dlen; /* data length */
+
+ dev->device_id = req->deviceid;
+ dev->num_classes = rep.num_classes;
+ dev->classes = (XInputClassInfo *) ((char *)dev + sizeof(XDevice));
+ dlen = rep.num_classes * sizeof(xInputClassInfo);
+ _XRead(dpy, (char *)dev->classes, dlen);
+ /* could be padding that we still need to eat (yummy!) */
+ if (rlen - dlen > 0)
+ _XEatData(dpy, (unsigned long)rlen - dlen);
+ } else
+ _XEatData(dpy, (unsigned long)rlen);
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (dev);
+}
diff --git a/lib/libXi/src/XQueryDv.c b/lib/libXi/src/XQueryDv.c
new file mode 100644
index 000000000..540f22411
--- /dev/null
+++ b/lib/libXi/src/XQueryDv.c
@@ -0,0 +1,193 @@
+/* $Xorg: XQueryDv.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XQueryDv.c,v 3.3 2001/12/14 19:55:20 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XQueryDeviceState - Query the state of an extension input device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+XDeviceState *
+XQueryDeviceState(dpy, dev)
+ register Display *dpy;
+ XDevice *dev;
+{
+ int i, j;
+ int rlen;
+ int size = 0;
+ xQueryDeviceStateReq *req;
+ xQueryDeviceStateReply rep;
+ XDeviceState *state = NULL;
+ XInputClass *any, *Any;
+ char *data;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return ((XDeviceState *) NoSuchExtension);
+
+ GetReq(QueryDeviceState, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_QueryDeviceState;
+ req->deviceid = dev->device_id;
+
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (XDeviceState *) NULL;
+ }
+
+ rlen = rep.length << 2;
+ if (rlen > 0) {
+ data = Xmalloc(rlen);
+ if (!data) {
+ _XEatData(dpy, (unsigned long)rlen);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return ((XDeviceState *) NULL);
+ }
+ _XRead(dpy, data, rlen);
+
+ for (i = 0, any = (XInputClass *) data; i < (int)rep.num_classes; i++) {
+ switch (any->class) {
+ case KeyClass:
+ size += sizeof(XKeyState);
+ break;
+ case ButtonClass:
+ size += sizeof(XButtonState);
+ break;
+ case ValuatorClass:
+ {
+ xValuatorState *v = (xValuatorState *) any;
+ size += (sizeof(XValuatorState) +
+ (v->num_valuators * sizeof(int)));
+ }
+ break;
+ }
+ any = (XInputClass *) ((char *)any + any->length);
+ }
+ state = (XDeviceState *) Xmalloc(size + sizeof(XDeviceState));
+ if (!state) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return ((XDeviceState *) NULL);
+ }
+ state->device_id = dev->device_id;
+ state->num_classes = rep.num_classes;
+ state->data = (XInputClass *) (state + 1);
+
+ Any = state->data;
+ for (i = 0, any = (XInputClass *) data; i < (int)rep.num_classes; i++) {
+ switch (any->class) {
+ case KeyClass:
+ {
+ xKeyState *k = (xKeyState *) any;
+ XKeyState *K = (XKeyState *) Any;
+
+ K->class = k->class;
+ K->length = sizeof(XKeyState);
+ K->num_keys = k->num_keys;
+ memcpy((char *)&K->keys[0], (char *)&k->keys[0], 32);
+ Any = (XInputClass *) (K + 1);
+ }
+ break;
+ case ButtonClass:
+ {
+ xButtonState *b = (xButtonState *) any;
+ XButtonState *B = (XButtonState *) Any;
+
+ B->class = b->class;
+ B->length = sizeof(XButtonState);
+ B->num_buttons = b->num_buttons;
+ memcpy((char *)&B->buttons[0], (char *)&b->buttons[0], 32);
+ Any = (XInputClass *) (B + 1);
+ }
+ break;
+ case ValuatorClass:
+ {
+ xValuatorState *v = (xValuatorState *) any;
+ XValuatorState *V = (XValuatorState *) Any;
+ CARD32 *valuators = (CARD32 *) (v + 1);
+
+ V->class = v->class;
+ V->length = sizeof(XValuatorState);
+ V->num_valuators = v->num_valuators;
+ V->mode = v->mode;
+ Any = (XInputClass *) (V + 1);
+ V->valuators = (int *)Any;
+ for (j = 0; j < (int)V->num_valuators; j++)
+ *(V->valuators + j) = *valuators++;
+ Any = (XInputClass *) ((char *)Any +
+ V->num_valuators * sizeof(int));
+ }
+ break;
+ }
+ any = (XInputClass *) ((char *)any + any->length);
+ }
+ Xfree(data);
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (state);
+}
+
+void
+XFreeDeviceState(list)
+ XDeviceState *list;
+{
+ XFree((char *)list);
+}
diff --git a/lib/libXi/src/XSelect.c b/lib/libXi/src/XSelect.c
new file mode 100644
index 000000000..af0fb84ae
--- /dev/null
+++ b/lib/libXi/src/XSelect.c
@@ -0,0 +1,94 @@
+/* $Xorg: XSelect.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XSelect.c,v 3.3 2001/12/14 19:55:21 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XSelectExtensionEvent - Select input from an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XSelectExtensionEvent(dpy, w, event_list, count)
+ register Display *dpy;
+ Window w;
+ XEventClass *event_list;
+ int count;
+{
+ register xSelectExtensionEventReq *req;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return (NoSuchExtension);
+ GetReq(SelectExtensionEvent, req);
+
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_SelectExtensionEvent;
+ req->window = w;
+ req->count = count;
+ req->length += count;
+
+ /* note: Data is a macro that uses its arguments multiple
+ * times, so "nvalues" is changed in a separate assignment
+ * statement */
+
+ count <<= 2;
+ Data32(dpy, (long *)event_list, count);
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (Success);
+}
diff --git a/lib/libXi/src/XSetBMap.c b/lib/libXi/src/XSetBMap.c
new file mode 100644
index 000000000..cad697613
--- /dev/null
+++ b/lib/libXi/src/XSetBMap.c
@@ -0,0 +1,93 @@
+/* $Xorg: XSetBMap.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XSetBMap.c,v 3.3 2001/12/14 19:55:21 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XSetDeviceButtonMapping - Set the button mapping of an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+#define NEED_REPLIES
+
+/* returns either DeviceMappingSuccess or DeviceMappingBusy */
+
+int
+XSetDeviceButtonMapping(dpy, device, map, nmap)
+ register Display *dpy;
+ XDevice *device;
+ unsigned char map[];
+ int nmap;
+{
+ register xSetDeviceButtonMappingReq *req;
+ xSetDeviceButtonMappingReply rep;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return (NoSuchExtension);
+ GetReq(SetDeviceButtonMapping, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_SetDeviceButtonMapping;
+ req->map_length = nmap;
+ req->length += (nmap + 3) >> 2;
+ req->deviceid = device->device_id;
+
+ Data(dpy, (char *)map, (long)nmap); /* note that map is char[] */
+ if (_XReply(dpy, (xReply *) & rep, 0, xFalse) == 0) /* suppress error */
+ rep.status = MappingSuccess;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return ((int)rep.status);
+}
diff --git a/lib/libXi/src/XSetDVal.c b/lib/libXi/src/XSetDVal.c
new file mode 100644
index 000000000..43702b008
--- /dev/null
+++ b/lib/libXi/src/XSetDVal.c
@@ -0,0 +1,99 @@
+/* $Xorg: XSetDVal.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XSetDVal.c,v 3.3 2001/12/14 19:55:22 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XSetDeviceValuators - Set the value of valuators on an extension input
+ * device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XSetDeviceValuators(dpy, dev, valuators, first_valuator, num_valuators)
+ register Display *dpy;
+ XDevice *dev;
+ int *valuators;
+ int first_valuator;
+ int num_valuators;
+{
+ xSetDeviceValuatorsReq *req;
+ xSetDeviceValuatorsReply rep;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Add_XSetDeviceValuators, info) == -1)
+ return (NoSuchExtension);
+
+ GetReq(SetDeviceValuators, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_SetDeviceValuators;
+ req->deviceid = dev->device_id;
+ req->first_valuator = first_valuator;
+ req->num_valuators = num_valuators;
+ req->length += num_valuators;
+
+ /* note: Data is a macro that uses its arguments multiple
+ * times, so "nvalues" is changed in a separate assignment
+ * statement */
+
+ num_valuators <<= 2;
+ Data(dpy, (char *)valuators, num_valuators);
+
+ (void)_XReply(dpy, (xReply *) & rep, 0, xTrue);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (rep.status);
+}
diff --git a/lib/libXi/src/XSetMMap.c b/lib/libXi/src/XSetMMap.c
new file mode 100644
index 000000000..10774339e
--- /dev/null
+++ b/lib/libXi/src/XSetMMap.c
@@ -0,0 +1,92 @@
+/* $Xorg: XSetMMap.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XSetMMap.c,v 3.3 2001/12/14 19:55:22 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XSetDeviceModifierMapping - set the modifier map of an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XSetDeviceModifierMapping(dpy, dev, modmap)
+ register Display *dpy;
+ XDevice *dev;
+ XModifierKeymap *modmap;
+{
+ int mapSize = modmap->max_keypermod << 3; /* 8 modifiers */
+ xSetDeviceModifierMappingReq *req;
+ xSetDeviceModifierMappingReply rep;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return (NoSuchExtension);
+
+ GetReqExtra(SetDeviceModifierMapping, mapSize, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_SetDeviceModifierMapping;
+ req->deviceid = dev->device_id;
+ req->numKeyPerModifier = modmap->max_keypermod;
+ memcpy((char *)&req[1], modmap->modifiermap, mapSize);
+
+ (void)_XReply(dpy, (xReply *) & rep,
+ (sizeof(xSetDeviceModifierMappingReply) -
+ sizeof(xReply)) >> 2, xTrue);
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (rep.success);
+}
diff --git a/lib/libXi/src/XSetMode.c b/lib/libXi/src/XSetMode.c
new file mode 100644
index 000000000..94e2b3d73
--- /dev/null
+++ b/lib/libXi/src/XSetMode.c
@@ -0,0 +1,87 @@
+/* $Xorg: XSetMode.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XSetMode.c,v 3.3 2001/12/14 19:55:23 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XSetDeviceMode - Set the mode of an extension input device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XSetDeviceMode(dpy, dev, mode)
+ register Display *dpy;
+ XDevice *dev;
+ int mode;
+{
+ xSetDeviceModeReq *req;
+ xSetDeviceModeReply rep;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return (NoSuchExtension);
+
+ GetReq(SetDeviceMode, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_SetDeviceMode;
+ req->deviceid = dev->device_id;
+ req->mode = mode;
+
+ (void)_XReply(dpy, (xReply *) & rep, 0, xTrue);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (rep.status);
+}
diff --git a/lib/libXi/src/XSndExEv.c b/lib/libXi/src/XSndExEv.c
new file mode 100644
index 000000000..71431cd2f
--- /dev/null
+++ b/lib/libXi/src/XSndExEv.c
@@ -0,0 +1,121 @@
+/* $Xorg: XSndExEv.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XSndExEv.c,v 3.3 2001/12/14 19:55:23 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XSendExtensionEvent - send an extension event to a client.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+extern Status _XiEventToWire();
+
+Status
+XSendExtensionEvent(dpy, dev, dest, prop, count, list, event)
+ register Display *dpy;
+ XDevice *dev;
+ Window dest;
+ Bool prop;
+ int count;
+ XEventClass *list;
+ XEvent *event;
+{
+ int num_events;
+ int ev_size;
+ xSendExtensionEventReq *req;
+ xEvent *ev;
+ register Status(**fp) ();
+ Status status;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return (NoSuchExtension);
+
+ /* call through display to find proper conversion routine */
+
+ fp = &dpy->wire_vec[event->type & 0177];
+ if (*fp == NULL)
+ *fp = _XiEventToWire;
+ status = (**fp) (dpy, event, &ev, &num_events);
+
+ if (status) {
+ GetReq(SendExtensionEvent, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_SendExtensionEvent;
+ req->deviceid = dev->device_id;
+ req->destination = dest;
+ req->propagate = prop;
+ req->count = count;
+ req->num_events = num_events;
+ ev_size = num_events * sizeof(xEvent);
+ req->length += (count + (ev_size >> 2));
+
+ /* note: Data is a macro that uses its arguments multiple
+ * times, so "count" is changed in a separate assignment
+ * statement. Any extra events must be sent before the event
+ * list, in order to ensure quad alignment. */
+
+ Data(dpy, (char *)ev, ev_size);
+
+ count <<= 2;
+ Data32(dpy, (long *)list, count);
+ XFree((char *)ev);
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (status);
+}
diff --git a/lib/libXi/src/XStFocus.c b/lib/libXi/src/XStFocus.c
new file mode 100644
index 000000000..08578c836
--- /dev/null
+++ b/lib/libXi/src/XStFocus.c
@@ -0,0 +1,87 @@
+/* $Xorg: XStFocus.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XStFocus.c,v 3.3 2001/12/14 19:55:23 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XSetDeviceFocus - Set the focus of an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XSetDeviceFocus(dpy, dev, focus, revert_to, time)
+ register Display *dpy;
+ XDevice *dev;
+ Window focus;
+ int revert_to;
+ Time time;
+{
+ xSetDeviceFocusReq *req;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+
+ GetReq(SetDeviceFocus, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_SetDeviceFocus;
+ req->device = dev->device_id;
+ req->focus = focus;
+ req->revertTo = revert_to;
+ req->time = time;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (Success);
+}
diff --git a/lib/libXi/src/XUngrDev.c b/lib/libXi/src/XUngrDev.c
new file mode 100644
index 000000000..70ba03d5c
--- /dev/null
+++ b/lib/libXi/src/XUngrDev.c
@@ -0,0 +1,86 @@
+/* $Xorg: XUngrDev.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XUngrDev.c,v 3.3 2001/12/14 19:55:23 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XUngrabDevice - Ungrab an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XUngrabDevice(dpy, dev, time)
+ register Display *dpy;
+ XDevice *dev;
+ Time time;
+{
+ register xUngrabDeviceReq *req;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return (NoSuchExtension);
+
+ GetReq(UngrabDevice, req);
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_UngrabDevice;
+
+ req->deviceid = dev->device_id;
+ req->time = time;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (Success);
+}
diff --git a/lib/libXi/src/XUngrDvB.c b/lib/libXi/src/XUngrDvB.c
new file mode 100644
index 000000000..77dbe77fe
--- /dev/null
+++ b/lib/libXi/src/XUngrDvB.c
@@ -0,0 +1,93 @@
+/* $Xorg: XUngrDvB.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XUngrDvB.c,v 3.3 2001/12/14 19:55:25 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XUngrabDeviceButton - Ungrab a button on an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XUngrabDeviceButton(dpy, dev, button, modifiers, modifier_dev, grab_window)
+ register Display *dpy;
+ XDevice *dev;
+ unsigned int button; /* CARD8 */
+ unsigned int modifiers; /* CARD16 */
+ XDevice *modifier_dev;
+ Window grab_window;
+{
+ register xUngrabDeviceButtonReq *req;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return (NoSuchExtension);
+ GetReq(UngrabDeviceButton, req);
+
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_UngrabDeviceButton;
+ req->grabbed_device = dev->device_id;
+ req->button = button;
+ req->modifiers = modifiers;
+ if (modifier_dev)
+ req->modifier_device = modifier_dev->device_id;
+ else
+ req->modifier_device = UseXKeyboard;
+ req->grabWindow = grab_window;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (Success);
+}
diff --git a/lib/libXi/src/XUngrDvK.c b/lib/libXi/src/XUngrDvK.c
new file mode 100644
index 000000000..0ae317858
--- /dev/null
+++ b/lib/libXi/src/XUngrDvK.c
@@ -0,0 +1,93 @@
+/* $Xorg: XUngrDvK.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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/lib/Xi/XUngrDvK.c,v 3.3 2001/12/14 19:55:26 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * XUngrabDeviceKey - Ungrab a key on an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XUngrabDeviceKey(dpy, dev, key, modifiers, modifier_dev, grab_window)
+ register Display *dpy;
+ XDevice *dev;
+ unsigned int key; /* CARD8 */
+ unsigned int modifiers; /* CARD16 */
+ XDevice *modifier_dev;
+ Window grab_window;
+{
+ register xUngrabDeviceKeyReq *req;
+ XExtDisplayInfo *info = XInput_find_display(dpy);
+
+ LockDisplay(dpy);
+ if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+ return (NoSuchExtension);
+ GetReq(UngrabDeviceKey, req);
+
+ req->reqType = info->codes->major_opcode;
+ req->ReqType = X_UngrabDeviceKey;
+ req->grabbed_device = dev->device_id;
+ req->key = key;
+ req->modifiers = modifiers;
+ if (modifier_dev)
+ req->modifier_device = modifier_dev->device_id;
+ else
+ req->modifier_device = UseXKeyboard;
+ req->grabWindow = grab_window;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (Success);
+}
diff --git a/lib/libXi/src/config.h.in b/lib/libXi/src/config.h.in
new file mode 100644
index 000000000..6b4c3e48b
--- /dev/null
+++ b/lib/libXi/src/config.h.in
@@ -0,0 +1,55 @@
+/* src/config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION