aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/Xi
diff options
context:
space:
mode:
authorReinhard Tartler <siretart@tauware.de>2011-10-10 17:43:39 +0200
committerReinhard Tartler <siretart@tauware.de>2011-10-10 17:43:39 +0200
commitf4092abdf94af6a99aff944d6264bc1284e8bdd4 (patch)
tree2ac1c9cc16ceb93edb2c4382c088dac5aeafdf0f /nx-X11/lib/Xi
parenta840692edc9c6d19cd7c057f68e39c7d95eb767d (diff)
downloadnx-libs-f4092abdf94af6a99aff944d6264bc1284e8bdd4.tar.gz
nx-libs-f4092abdf94af6a99aff944d6264bc1284e8bdd4.tar.bz2
nx-libs-f4092abdf94af6a99aff944d6264bc1284e8bdd4.zip
Imported nx-X11-3.1.0-1.tar.gznx-X11/3.1.0-1
Summary: Imported nx-X11-3.1.0-1.tar.gz Keywords: Imported nx-X11-3.1.0-1.tar.gz into Git repository
Diffstat (limited to 'nx-X11/lib/Xi')
-rw-r--r--nx-X11/lib/Xi/Imakefile107
-rw-r--r--nx-X11/lib/Xi/XAllowDv.c88
-rw-r--r--nx-X11/lib/Xi/XChgDCtl.c130
-rw-r--r--nx-X11/lib/Xi/XChgFCtl.c207
-rw-r--r--nx-X11/lib/Xi/XChgKMap.c94
-rw-r--r--nx-X11/lib/Xi/XChgKbd.c88
-rw-r--r--nx-X11/lib/Xi/XChgPnt.c92
-rw-r--r--nx-X11/lib/Xi/XChgProp.c98
-rw-r--r--nx-X11/lib/Xi/XCloseDev.c85
-rw-r--r--nx-X11/lib/Xi/XDevBell.c89
-rw-r--r--nx-X11/lib/Xi/XExtInt.c663
-rw-r--r--nx-X11/lib/Xi/XExtToWire.c452
-rw-r--r--nx-X11/lib/Xi/XFreeLst.c73
-rw-r--r--nx-X11/lib/Xi/XGMotion.c142
-rw-r--r--nx-X11/lib/Xi/XGetBMap.c108
-rw-r--r--nx-X11/lib/Xi/XGetDCtl.c173
-rw-r--r--nx-X11/lib/Xi/XGetFCtl.c273
-rw-r--r--nx-X11/lib/Xi/XGetKMap.c111
-rw-r--r--nx-X11/lib/Xi/XGetMMap.c104
-rw-r--r--nx-X11/lib/Xi/XGetProp.c120
-rw-r--r--nx-X11/lib/Xi/XGetVers.c115
-rw-r--r--nx-X11/lib/Xi/XGrDvBut.c114
-rw-r--r--nx-X11/lib/Xi/XGrDvKey.c117
-rw-r--r--nx-X11/lib/Xi/XGrabDev.c109
-rw-r--r--nx-X11/lib/Xi/XGtFocus.c92
-rw-r--r--nx-X11/lib/Xi/XGtSelect.c146
-rw-r--r--nx-X11/lib/Xi/XIint.h25
-rw-r--r--nx-X11/lib/Xi/XListDev.c259
-rw-r--r--nx-X11/lib/Xi/XOpenDev.c113
-rw-r--r--nx-X11/lib/Xi/XQueryDv.c198
-rw-r--r--nx-X11/lib/Xi/XSelect.c94
-rw-r--r--nx-X11/lib/Xi/XSetBMap.c93
-rw-r--r--nx-X11/lib/Xi/XSetDVal.c100
-rw-r--r--nx-X11/lib/Xi/XSetMMap.c91
-rw-r--r--nx-X11/lib/Xi/XSetMode.c88
-rw-r--r--nx-X11/lib/Xi/XSndExEv.c123
-rw-r--r--nx-X11/lib/Xi/XStFocus.c87
-rw-r--r--nx-X11/lib/Xi/XUngrDev.c86
-rw-r--r--nx-X11/lib/Xi/XUngrDvB.c93
-rw-r--r--nx-X11/lib/Xi/XUngrDvK.c93
-rw-r--r--nx-X11/lib/Xi/Xi-def.cpp49
41 files changed, 5582 insertions, 0 deletions
diff --git a/nx-X11/lib/Xi/Imakefile b/nx-X11/lib/Xi/Imakefile
new file mode 100644
index 000000000..365d78280
--- /dev/null
+++ b/nx-X11/lib/Xi/Imakefile
@@ -0,0 +1,107 @@
+XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:45:53 cpqbld Exp $
+
+
+
+
+XCOMM $XFree86: xc/lib/Xi/Imakefile,v 1.4 2001/01/17 19:42:47 dawes Exp $
+
+#define DoNormalLib NormalLibXi
+#define DoSharedLib SharedLibXi
+#define DoExtraLib SharedLibXi
+#define DoDebugLib DebugLibXi
+#define DoProfileLib ProfileLibXi
+#define LibName Xi
+#define SoRev SOXINPUTREV
+#define LibHeaders NO
+
+#include <Threads.tmpl>
+
+#ifdef SharedXiReqs
+REQUIREDLIBS = SharedXiReqs
+#endif
+
+#if Malloc0ReturnsNull
+ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
+#endif
+
+ DEFINES = $(ALLOC_DEFINES)
+SRCS = 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
+OBJS = XAllowDv.o \
+ XChgDCtl.o \
+ XChgFCtl.o \
+ XChgKbd.o \
+ XChgKMap.o \
+ XChgPnt.o \
+ XChgProp.o \
+ XCloseDev.o \
+ XDevBell.o \
+ XExtToWire.o \
+ XGetBMap.o \
+ XGetDCtl.o \
+ XGetFCtl.o \
+ XGetKMap.o \
+ XGetMMap.o \
+ XGetProp.o \
+ XGetVers.o \
+ XGMotion.o \
+ XGrabDev.o \
+ XGrDvBut.o \
+ XGrDvKey.o \
+ XGtFocus.o \
+ XGtSelect.o \
+ XListDev.o \
+ XOpenDev.o \
+ XQueryDv.o \
+ XSelect.o \
+ XSetBMap.o \
+ XSetDVal.o \
+ XSetMMap.o \
+ XSetMode.o \
+ XSndExEv.o \
+ XStFocus.o \
+ XUngrDev.o \
+ XUngrDvB.o \
+ XUngrDvK.o \
+ XExtInt.o
+
+ LINTLIBS = $(LINTXLIB) $(LINTXEXT)
+
+#include <Library.tmpl>
+
+DependTarget()
diff --git a/nx-X11/lib/Xi/XAllowDv.c b/nx-X11/lib/Xi/XAllowDv.c
new file mode 100644
index 000000000..d74504608
--- /dev/null
+++ b/nx-X11/lib/Xi/XAllowDv.c
@@ -0,0 +1,88 @@
+/* $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) == -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/nx-X11/lib/Xi/XChgDCtl.c b/nx-X11/lib/Xi/XChgDCtl.c
new file mode 100644
index 000000000..b1fd7a18b
--- /dev/null
+++ b/nx-X11/lib/Xi/XChgDCtl.c
@@ -0,0 +1,130 @@
+/* $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) == -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/nx-X11/lib/Xi/XChgFCtl.c b/nx-X11/lib/Xi/XChgFCtl.c
new file mode 100644
index 000000000..8f4c009c0
--- /dev/null
+++ b/nx-X11/lib/Xi/XChgFCtl.c
@@ -0,0 +1,207 @@
+/* $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) == -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/nx-X11/lib/Xi/XChgKMap.c b/nx-X11/lib/Xi/XChgKMap.c
new file mode 100644
index 000000000..8ad77ca2c
--- /dev/null
+++ b/nx-X11/lib/Xi/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) == -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/nx-X11/lib/Xi/XChgKbd.c b/nx-X11/lib/Xi/XChgKbd.c
new file mode 100644
index 000000000..b3e2c06c1
--- /dev/null
+++ b/nx-X11/lib/Xi/XChgKbd.c
@@ -0,0 +1,88 @@
+/* $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) == -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/nx-X11/lib/Xi/XChgPnt.c b/nx-X11/lib/Xi/XChgPnt.c
new file mode 100644
index 000000000..c7248fd64
--- /dev/null
+++ b/nx-X11/lib/Xi/XChgPnt.c
@@ -0,0 +1,92 @@
+/* $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) == -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/nx-X11/lib/Xi/XChgProp.c b/nx-X11/lib/Xi/XChgProp.c
new file mode 100644
index 000000000..3fa68cfde
--- /dev/null
+++ b/nx-X11/lib/Xi/XChgProp.c
@@ -0,0 +1,98 @@
+/* $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) == -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/nx-X11/lib/Xi/XCloseDev.c b/nx-X11/lib/Xi/XCloseDev.c
new file mode 100644
index 000000000..170843b96
--- /dev/null
+++ b/nx-X11/lib/Xi/XCloseDev.c
@@ -0,0 +1,85 @@
+/* $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) == -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/nx-X11/lib/Xi/XDevBell.c b/nx-X11/lib/Xi/XDevBell.c
new file mode 100644
index 000000000..2b7669ff5
--- /dev/null
+++ b/nx-X11/lib/Xi/XDevBell.c
@@ -0,0 +1,89 @@
+/* $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) == -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/nx-X11/lib/Xi/XExtInt.c b/nx-X11/lib/Xi/XExtInt.c
new file mode 100644
index 000000000..9e569df44
--- /dev/null
+++ b/nx-X11/lib/Xi/XExtInt.c
@@ -0,0 +1,663 @@
+/* $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)
+ register Display *dpy;
+ register int version_index;
+ {
+ XExtensionVersion *ext;
+ XExtDisplayInfo *info = XInput_find_display (dpy);
+
+ 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/nx-X11/lib/Xi/XExtToWire.c b/nx-X11/lib/Xi/XExtToWire.c
new file mode 100644
index 000000000..30f01408b
--- /dev/null
+++ b/nx-X11/lib/Xi/XExtToWire.c
@@ -0,0 +1,452 @@
+/* $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/nx-X11/lib/Xi/XFreeLst.c b/nx-X11/lib/Xi/XFreeLst.c
new file mode 100644
index 000000000..3966f3f0a
--- /dev/null
+++ b/nx-X11/lib/Xi/XFreeLst.c
@@ -0,0 +1,73 @@
+/* $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/nx-X11/lib/Xi/XGMotion.c b/nx-X11/lib/Xi/XGMotion.c
new file mode 100644
index 000000000..4ce41bf99
--- /dev/null
+++ b/nx-X11/lib/Xi/XGMotion.c
@@ -0,0 +1,142 @@
+/* $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) == -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/nx-X11/lib/Xi/XGetBMap.c b/nx-X11/lib/Xi/XGetBMap.c
new file mode 100644
index 000000000..1c1658fda
--- /dev/null
+++ b/nx-X11/lib/Xi/XGetBMap.c
@@ -0,0 +1,108 @@
+/* $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) == -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/nx-X11/lib/Xi/XGetDCtl.c b/nx-X11/lib/Xi/XGetDCtl.c
new file mode 100644
index 000000000..66b352594
--- /dev/null
+++ b/nx-X11/lib/Xi/XGetDCtl.c
@@ -0,0 +1,173 @@
+/* $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) == -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/nx-X11/lib/Xi/XGetFCtl.c b/nx-X11/lib/Xi/XGetFCtl.c
new file mode 100644
index 000000000..e34c7ced5
--- /dev/null
+++ b/nx-X11/lib/Xi/XGetFCtl.c
@@ -0,0 +1,273 @@
+/* $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) == -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/nx-X11/lib/Xi/XGetKMap.c b/nx-X11/lib/Xi/XGetKMap.c
new file mode 100644
index 000000000..c794006a3
--- /dev/null
+++ b/nx-X11/lib/Xi/XGetKMap.c
@@ -0,0 +1,111 @@
+/* $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) == -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/nx-X11/lib/Xi/XGetMMap.c b/nx-X11/lib/Xi/XGetMMap.c
new file mode 100644
index 000000000..04e89d839
--- /dev/null
+++ b/nx-X11/lib/Xi/XGetMMap.c
@@ -0,0 +1,104 @@
+/* $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) == -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/nx-X11/lib/Xi/XGetProp.c b/nx-X11/lib/Xi/XGetProp.c
new file mode 100644
index 000000000..ed5a2d185
--- /dev/null
+++ b/nx-X11/lib/Xi/XGetProp.c
@@ -0,0 +1,120 @@
+/* $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) == -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/nx-X11/lib/Xi/XGetVers.c b/nx-X11/lib/Xi/XGetVers.c
new file mode 100644
index 000000000..318083735
--- /dev/null
+++ b/nx-X11/lib/Xi/XGetVers.c
@@ -0,0 +1,115 @@
+/* $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) == -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/nx-X11/lib/Xi/XGrDvBut.c b/nx-X11/lib/Xi/XGrDvBut.c
new file mode 100644
index 000000000..48381f8e5
--- /dev/null
+++ b/nx-X11/lib/Xi/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) == -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/nx-X11/lib/Xi/XGrDvKey.c b/nx-X11/lib/Xi/XGrDvKey.c
new file mode 100644
index 000000000..94e9ba444
--- /dev/null
+++ b/nx-X11/lib/Xi/XGrDvKey.c
@@ -0,0 +1,117 @@
+/* $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) == -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/nx-X11/lib/Xi/XGrabDev.c b/nx-X11/lib/Xi/XGrabDev.c
new file mode 100644
index 000000000..f49a6bd34
--- /dev/null
+++ b/nx-X11/lib/Xi/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) == -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/nx-X11/lib/Xi/XGtFocus.c b/nx-X11/lib/Xi/XGtFocus.c
new file mode 100644
index 000000000..29e8de7b4
--- /dev/null
+++ b/nx-X11/lib/Xi/XGtFocus.c
@@ -0,0 +1,92 @@
+/* $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) == -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/nx-X11/lib/Xi/XGtSelect.c b/nx-X11/lib/Xi/XGtSelect.c
new file mode 100644
index 000000000..966365367
--- /dev/null
+++ b/nx-X11/lib/Xi/XGtSelect.c
@@ -0,0 +1,146 @@
+/* $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) == -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/nx-X11/lib/Xi/XIint.h b/nx-X11/lib/Xi/XIint.h
new file mode 100644
index 000000000..fdca57d6a
--- /dev/null
+++ b/nx-X11/lib/Xi/XIint.h
@@ -0,0 +1,25 @@
+/* $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
+);
+
+extern XExtensionVersion * _XiGetExtensionVersion(
+ Display*,
+ _Xconst char*
+);
+
+#endif
diff --git a/nx-X11/lib/Xi/XListDev.c b/nx-X11/lib/Xi/XListDev.c
new file mode 100644
index 000000000..279beded0
--- /dev/null
+++ b/nx-X11/lib/Xi/XListDev.c
@@ -0,0 +1,259 @@
+/* $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) == -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/nx-X11/lib/Xi/XOpenDev.c b/nx-X11/lib/Xi/XOpenDev.c
new file mode 100644
index 000000000..7930a9a80
--- /dev/null
+++ b/nx-X11/lib/Xi/XOpenDev.c
@@ -0,0 +1,113 @@
+/* $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) == -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/nx-X11/lib/Xi/XQueryDv.c b/nx-X11/lib/Xi/XQueryDv.c
new file mode 100644
index 000000000..1450c15fb
--- /dev/null
+++ b/nx-X11/lib/Xi/XQueryDv.c
@@ -0,0 +1,198 @@
+/* $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) == -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/nx-X11/lib/Xi/XSelect.c b/nx-X11/lib/Xi/XSelect.c
new file mode 100644
index 000000000..c0a8dc832
--- /dev/null
+++ b/nx-X11/lib/Xi/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) == -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/nx-X11/lib/Xi/XSetBMap.c b/nx-X11/lib/Xi/XSetBMap.c
new file mode 100644
index 000000000..716d8c5fc
--- /dev/null
+++ b/nx-X11/lib/Xi/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) == -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/nx-X11/lib/Xi/XSetDVal.c b/nx-X11/lib/Xi/XSetDVal.c
new file mode 100644
index 000000000..3cee1a939
--- /dev/null
+++ b/nx-X11/lib/Xi/XSetDVal.c
@@ -0,0 +1,100 @@
+/* $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) == -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/nx-X11/lib/Xi/XSetMMap.c b/nx-X11/lib/Xi/XSetMMap.c
new file mode 100644
index 000000000..d31197cff
--- /dev/null
+++ b/nx-X11/lib/Xi/XSetMMap.c
@@ -0,0 +1,91 @@
+/* $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) == -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/nx-X11/lib/Xi/XSetMode.c b/nx-X11/lib/Xi/XSetMode.c
new file mode 100644
index 000000000..5f62fb197
--- /dev/null
+++ b/nx-X11/lib/Xi/XSetMode.c
@@ -0,0 +1,88 @@
+/* $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) == -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/nx-X11/lib/Xi/XSndExEv.c b/nx-X11/lib/Xi/XSndExEv.c
new file mode 100644
index 000000000..28b654ba5
--- /dev/null
+++ b/nx-X11/lib/Xi/XSndExEv.c
@@ -0,0 +1,123 @@
+/* $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) == -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/nx-X11/lib/Xi/XStFocus.c b/nx-X11/lib/Xi/XStFocus.c
new file mode 100644
index 000000000..fc61896b6
--- /dev/null
+++ b/nx-X11/lib/Xi/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/nx-X11/lib/Xi/XUngrDev.c b/nx-X11/lib/Xi/XUngrDev.c
new file mode 100644
index 000000000..e3aec3606
--- /dev/null
+++ b/nx-X11/lib/Xi/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) == -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/nx-X11/lib/Xi/XUngrDvB.c b/nx-X11/lib/Xi/XUngrDvB.c
new file mode 100644
index 000000000..7e96665dd
--- /dev/null
+++ b/nx-X11/lib/Xi/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) == -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/nx-X11/lib/Xi/XUngrDvK.c b/nx-X11/lib/Xi/XUngrDvK.c
new file mode 100644
index 000000000..26a5841de
--- /dev/null
+++ b/nx-X11/lib/Xi/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) == -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/nx-X11/lib/Xi/Xi-def.cpp b/nx-X11/lib/Xi/Xi-def.cpp
new file mode 100644
index 000000000..62760066d
--- /dev/null
+++ b/nx-X11/lib/Xi/Xi-def.cpp
@@ -0,0 +1,49 @@
+LIBRARY XI
+VERSION LIBRARY_VERSION
+EXPORTS
+ XAllowDeviceEvents
+ XChangeDeviceControl
+ XChangeDeviceDontPropagateList
+ XChangeDeviceKeyMapping
+ XChangeFeedbackControl
+ XChangeKeyboardDevice
+ XChangePointerDevice
+ XCloseDevice
+ XDeviceBell
+ XFreeDeviceControl
+ XFreeDeviceList
+ XFreeDeviceMotionEvents
+ XFreeDeviceState
+ XFreeFeedbackList
+ XGetDeviceButtonMapping
+ XGetDeviceControl
+ XGetDeviceDontPropagateList
+ XGetDeviceFocus
+ XGetDeviceKeyMapping
+ XGetDeviceModifierMapping
+ XGetDeviceMotionEvents
+ XGetExtensionVersion
+ XGetFeedbackControl
+ XGetSelectedExtensionEvents
+ XGrabDevice
+ XGrabDeviceButton
+ XGrabDeviceKey
+ XListInputDevices
+ XOpenDevice
+ XQueryDeviceState
+ XSelectExtensionEvent
+ XSendExtensionEvent
+ XSetDeviceButtonMapping
+ XSetDeviceFocus
+ XSetDeviceMode
+ XSetDeviceModifierMapping
+ XSetDeviceValuators
+ XUngrabDevice
+ XUngrabDeviceButton
+ XUngrabDeviceKey
+ _xibadclass
+ _xibaddevice
+ _xibadevent
+ _xibadmode
+ _xidevicebusy
+/* $Xorg: Xi-def.cpp,v 1.3 2000/08/17 19:45:58 cpqbld Exp $ */