Browse Source

* merged x11 revs Nikolay at his request.

git-svn-id: branches/fixes_3_0@33662 -
marco 9 years ago
parent
commit
3fd1a082ed

+ 10 - 0
.gitattributes

@@ -7797,9 +7797,15 @@ packages/x11/src/xcms.pp svneol=native#text/plain
 packages/x11/src/xf86dga.pp svneol=native#text/plain
 packages/x11/src/xf86dga.pp svneol=native#text/plain
 packages/x11/src/xf86dga1.inc svneol=native#text/plain
 packages/x11/src/xf86dga1.inc svneol=native#text/plain
 packages/x11/src/xf86vmode.pp svneol=native#text/plain
 packages/x11/src/xf86vmode.pp svneol=native#text/plain
+packages/x11/src/xfixes.pp svneol=native#text/plain
+packages/x11/src/xfixeswire.inc svneol=native#text/plain
 packages/x11/src/xft.pas svneol=native#text/pascal
 packages/x11/src/xft.pas svneol=native#text/pascal
+packages/x11/src/xge.pp svneol=native#text/plain
 packages/x11/src/xi.pp svneol=native#text/plain
 packages/x11/src/xi.pp svneol=native#text/plain
+packages/x11/src/xi2.pp svneol=native#text/plain
 packages/x11/src/xinerama.pp svneol=native#text/plain
 packages/x11/src/xinerama.pp svneol=native#text/plain
+packages/x11/src/xinput.pp svneol=native#text/plain
+packages/x11/src/xinput2.pp svneol=native#text/plain
 packages/x11/src/xkb.pp svneol=native#text/plain
 packages/x11/src/xkb.pp svneol=native#text/plain
 packages/x11/src/xkblib.pp svneol=native#text/plain
 packages/x11/src/xkblib.pp svneol=native#text/plain
 packages/x11/src/xlib.pp svneol=native#text/plain
 packages/x11/src/xlib.pp svneol=native#text/plain
@@ -7810,6 +7816,10 @@ packages/x11/src/xshm.pp svneol=native#text/plain
 packages/x11/src/xutil.pp svneol=native#text/plain
 packages/x11/src/xutil.pp svneol=native#text/plain
 packages/x11/src/xv.pp svneol=native#text/plain
 packages/x11/src/xv.pp svneol=native#text/plain
 packages/x11/src/xvlib.pp svneol=native#text/plain
 packages/x11/src/xvlib.pp svneol=native#text/plain
+packages/x11/tests/xfixes_linktest.pp svneol=native#text/plain
+packages/x11/tests/xge_linktest.pp svneol=native#text/plain
+packages/x11/tests/xinput2_linktest.pp svneol=native#text/plain
+packages/x11/tests/xinput_linktest.pp svneol=native#text/plain
 packages/xforms/Makefile svneol=native#text/plain
 packages/xforms/Makefile svneol=native#text/plain
 packages/xforms/Makefile.fpc svneol=native#text/plain
 packages/xforms/Makefile.fpc svneol=native#text/plain
 packages/xforms/Makefile.fpc.fpcmake svneol=native#text/plain
 packages/xforms/Makefile.fpc.fpcmake svneol=native#text/plain

+ 29 - 0
packages/x11/fpmake.pp

@@ -50,6 +50,35 @@ begin
           AddUnit('xlib');
           AddUnit('xlib');
         end;
         end;
     T:=P.Targets.AddUnit('xi.pp');
     T:=P.Targets.AddUnit('xi.pp');
+    T:=P.Targets.AddUnit('xi2.pp');
+    T:=P.Targets.AddUnit('xinput.pp');
+      with T.Dependencies do
+        begin
+          AddUnit('x');
+          AddUnit('xlib');
+          AddUnit('xi');
+        end;
+    T:=P.Targets.AddUnit('xge.pp');
+      with T.Dependencies do
+        begin
+          AddUnit('x');
+          AddUnit('xlib');
+        end;
+    T:=P.Targets.AddUnit('xfixes.pp');
+      with T.Dependencies do
+        begin
+          AddUnit('x');
+          AddUnit('xlib');
+        end;
+    T:=P.Targets.AddUnit('xinput2.pp');
+      with T.Dependencies do
+        begin
+          AddUnit('x');
+          AddUnit('xlib');
+          AddUnit('xi2');
+          AddUnit('xge');
+          AddUnit('xfixes');
+        end;
     T:=P.Targets.AddUnit('xkblib.pp');
     T:=P.Targets.AddUnit('xkblib.pp');
       with T.Dependencies do
       with T.Dependencies do
         begin
         begin

+ 2 - 1
packages/x11/src/x.pp

@@ -142,7 +142,8 @@ const
    ColormapNotify = 32;
    ColormapNotify = 32;
    ClientMessage = 33;
    ClientMessage = 33;
    MappingNotify = 34;
    MappingNotify = 34;
-   LASTEvent = 35;
+   GenericEvent = 35;
+   LASTEvent = 36;
    ShiftMask = 1 shl 0;
    ShiftMask = 1 shl 0;
    LockMask = 1 shl 1;
    LockMask = 1 shl 1;
    ControlMask = 1 shl 2;
    ControlMask = 1 shl 2;

+ 288 - 0
packages/x11/src/xfixes.pp

@@ -0,0 +1,288 @@
+(*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2011 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *)
+(*
+ * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * 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, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Keith Packard makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH 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.
+ *)
+
+unit xfixes;
+
+interface
+
+{$PACKRECORDS C}
+
+uses
+  ctypes, x, xlib;
+
+const
+  libXfixes = 'Xfixes';
+
+{$I xfixeswire.inc}
+
+//#include <X11/Xfuncproto.h>
+//#include <X11/Xlib.h>
+
+const
+(*
+ * This revision number also appears in configure.ac, they have
+ * to be manually synchronized
+ *)
+  XFIXES_REVISION = 1;
+  XFIXES_VERSION = (XFIXES_MAJOR * 10000) + (XFIXES_MINOR * 100) + XFIXES_REVISION;
+
+type
+  PXFixesSelectionNotifyEvent = ^TXFixesSelectionNotifyEvent;
+  TXFixesSelectionNotifyEvent = record
+    _type: cint;                        { event base }
+    serial: culong;
+    send_event: TBool;
+    display: PDisplay;
+    window: TWindow;
+    subtype: cint;
+    owner: TWindow;
+    selection: TAtom;
+    timestamp: TTime;
+    selection_timestamp: TTime;
+  end;
+
+  PXFixesCursorNotifyEvent = ^TXFixesCursorNotifyEvent;
+  TXFixesCursorNotifyEvent = record
+    _type: cint;                        { event base }
+    serial: culong;
+    send_event: TBool;
+    display: PDisplay;
+    window: TWindow;
+    subtype: cint;
+    cursor_serial: culong;
+    timestamp: TTime;
+    cursor_name: TAtom;
+  end;
+
+  PXFixesCursorImage = ^TXFixesCursorImage;
+  TXFixesCursorImage = record
+    x, y: cshort;
+    width, height: cushort;
+    xhot, yhot: cushort;
+    cursor_serial: culong;
+    pixels: Pculong;
+//#if XFIXES_MAJOR >= 2
+    atom: TAtom;                    { Version >= 2 only }
+    name: PChar;                    { Version >= 2 only }
+//#endif
+  end;
+
+//#if XFIXES_MAJOR >= 2
+{ Version 2 types }
+
+  PXserverRegion = ^TXserverRegion;
+  TXserverRegion = TXID;
+
+  PXFixesCursorImageAndName = ^TXFixesCursorImageAndName;
+  TXFixesCursorImageAndName = record
+    x, y: cshort;
+    width, height: cushort;
+    xhot, yhot: cushort;
+    cursor_serial: culong;
+    pixels: Pculong;
+    atom: TAtom;
+    name: PChar;
+  end;
+
+//#endif
+
+//_XFUNCPROTOBEGIN
+
+function XFixesQueryExtension(dpy: PDisplay;
+                               event_base_return: Pcint;
+                               error_base_return: Pcint): TBoolResult; cdecl; external libXfixes;
+function XFixesQueryVersion(dpy: PDisplay;
+                             major_version_return: Pcint;
+                             minor_version_return: Pcint): TStatus; cdecl; external libXfixes;
+
+function XFixesVersion: cint; cdecl; external libXfixes;
+
+procedure
+XFixesChangeSaveSet(dpy: PDisplay;
+                    win: TWindow;
+                    mode: cint;
+                    target: cint;
+                    map: cint); cdecl; external libXfixes;
+
+procedure
+XFixesSelectSelectionInput(dpy: PDisplay;
+                           win: TWindow;
+                           selection: TAtom;
+                           eventMask: culong); cdecl; external libXfixes;
+
+procedure
+XFixesSelectCursorInput(dpy: PDisplay;
+                        win: TWindow;
+                        eventMask: culong); cdecl; external libXfixes;
+
+function XFixesGetCursorImage(dpy: PDisplay)
+: PXFixesCursorImage; cdecl; external libXfixes;
+
+//#if XFIXES_MAJOR >= 2
+{ Version 2 functions }
+
+function XFixesCreateRegion(dpy: PDisplay; rectangles: PXRectangle; nrectangles: cint)
+: TXserverRegion; cdecl; external libXfixes;
+
+function XFixesCreateRegionFromBitmap(dpy: PDisplay; bitmap: TPixmap)
+: TXserverRegion; cdecl; external libXfixes;
+
+function XFixesCreateRegionFromWindow(dpy: PDisplay; window: TWindow; kind: cint)
+: TXserverRegion; cdecl; external libXfixes;
+
+function XFixesCreateRegionFromGC(dpy: PDisplay; gc: TGC)
+: TXserverRegion; cdecl; external libXfixes;
+
+function XFixesCreateRegionFromPicture(dpy: PDisplay; picture: TXID)
+: TXserverRegion; cdecl; external libXfixes;
+
+procedure
+XFixesDestroyRegion(dpy: PDisplay; region: TXserverRegion); cdecl; external libXfixes;
+
+procedure
+XFixesSetRegion(dpy: PDisplay; region: TXserverRegion;
+                rectangles: PXRectangle; nrectangles: cint); cdecl; external libXfixes;
+
+procedure
+XFixesCopyRegion(dpy: PDisplay; dst: TXserverRegion; src: TXserverRegion); cdecl; external libXfixes;
+
+procedure
+XFixesUnionRegion(dpy: PDisplay; dst: TXserverRegion;
+                   src1: TXserverRegion; src2: TXserverRegion); cdecl; external libXfixes;
+
+procedure
+XFixesIntersectRegion(dpy: PDisplay; dst: TXserverRegion;
+                       src1: TXserverRegion; src2: TXserverRegion); cdecl; external libXfixes;
+
+procedure
+XFixesSubtractRegion(dpy: PDisplay; dst: TXserverRegion;
+                      src1: TXserverRegion; src2: TXserverRegion); cdecl; external libXfixes;
+
+procedure
+XFixesInvertRegion(dpy: PDisplay; dst: TXserverRegion;
+                    rect: PXRectangle; src: TXserverRegion); cdecl; external libXfixes;
+
+procedure
+XFixesTranslateRegion(dpy: PDisplay; region: TXserverRegion; dx, dy: cint); cdecl; external libXfixes;
+
+procedure
+XFixesRegionExtents(dpy: PDisplay; dst: TXserverRegion; src: TXserverRegion); cdecl; external libXfixes;
+
+function XFixesFetchRegion(dpy: PDisplay; region: TXserverRegion; nrectanglesRet: Pcint)
+: PXRectangle; cdecl; external libXfixes;
+
+function XFixesFetchRegionAndBounds(dpy: PDisplay; region: TXserverRegion;
+                                    nrectanglesRet: Pcint;
+                                    bounds: PXRectangle)
+: PXRectangle; cdecl; external libXfixes;
+
+procedure
+XFixesSetGCClipRegion(dpy: PDisplay; gc: TGC;
+                      clip_x_origin: cint; clip_y_origin: cint;
+                      region: TXserverRegion); cdecl; external libXfixes;
+
+procedure
+XFixesSetWindowShapeRegion(dpy: PDisplay; win: TWindow; shape_kind: cint;
+                           x_off: cint; y_off: cint; region: TXserverRegion); cdecl; external libXfixes;
+
+procedure
+XFixesSetPictureClipRegion(dpy: PDisplay; picture: TXID;
+                           clip_x_origin: cint; clip_y_origin: cint;
+                           region: TXserverRegion); cdecl; external libXfixes;
+
+procedure
+XFixesSetCursorName(dpy: PDisplay; cursor: TCursor; name: PChar); cdecl; external libXfixes;
+
+function XFixesGetCursorName(dpy: PDisplay; cursor: TCursor; atom: PAtom)
+: PChar; cdecl; external libXfixes;
+
+procedure
+XFixesChangeCursor(dpy: PDisplay; source: TCursor; destination: TCursor); cdecl; external libXfixes;
+
+procedure
+XFixesChangeCursorByName(dpy: PDisplay; source: TCursor; name: PChar); cdecl; external libXfixes;
+
+//#endif	/* XFIXES_MAJOR >= 2 */
+
+//#if XFIXES_MAJOR >= 3
+
+procedure
+XFixesExpandRegion(dpy: PDisplay; dst: TXserverRegion; src: TXserverRegion;
+                   left, right, top, bottom: cunsigned); cdecl; external libXfixes;
+
+//#endif	/* XFIXES_MAJOR >= 3 */
+
+//#if XFIXES_MAJOR >= 4
+{ Version 4.0 externs }
+
+procedure
+XFixesHideCursor(dpy: PDisplay; win: TWindow); cdecl; external libXfixes;
+
+procedure
+XFixesShowCursor(dpy: PDisplay; win: TWindow); cdecl; external libXfixes;
+
+//#endif /* XFIXES_MAJOR >= 4 */
+
+//#if XFIXES_MAJOR >= 5
+
+type
+  PPointerBarrier = ^TPointerBarrier;
+  TPointerBarrier = TXID;
+
+
+function
+XFixesCreatePointerBarrier(dpy: PDisplay; w: TWindow; x1, y1,
+			   x2, y2: cint; directions: cint;
+			   num_devices: cint; devices: Pcint): TPointerBarrier; cdecl; external libXfixes;
+
+procedure
+XFixesDestroyPointerBarrier(dpy: PDisplay; b: TPointerBarrier); cdecl; external libXfixes;
+
+//#endif /* XFIXES_MAJOR >= 5 */
+
+//_XFUNCPROTOEND
+
+implementation
+end.

+ 135 - 0
packages/x11/src/xfixeswire.inc

@@ -0,0 +1,135 @@
+(*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2010 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *)
+(*
+ * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * 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, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Keith Packard makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH 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.
+ *)
+
+const
+  XFIXES_NAME  = 'XFIXES';
+  XFIXES_MAJOR = 5;
+  XFIXES_MINOR = 0;
+
+(*************** Version 1 ******************)
+  X_XFixesQueryVersion                    = 0;
+  X_XFixesChangeSaveSet                   = 1;
+  X_XFixesSelectSelectionInput            = 2;
+  X_XFixesSelectCursorInput               = 3;
+  X_XFixesGetCursorImage                  = 4;
+(*************** Version 2 ******************)
+  X_XFixesCreateRegion                    = 5;
+  X_XFixesCreateRegionFromBitmap          = 6;
+  X_XFixesCreateRegionFromWindow          = 7;
+  X_XFixesCreateRegionFromGC              = 8;
+  X_XFixesCreateRegionFromPicture         = 9;
+  X_XFixesDestroyRegion                   = 10;
+  X_XFixesSetRegion                       = 11;
+  X_XFixesCopyRegion                      = 12;
+  X_XFixesUnionRegion                     = 13;
+  X_XFixesIntersectRegion                 = 14;
+  X_XFixesSubtractRegion                  = 15;
+  X_XFixesInvertRegion                    = 16;
+  X_XFixesTranslateRegion                 = 17;
+  X_XFixesRegionExtents                   = 18;
+  X_XFixesFetchRegion                     = 19;
+  X_XFixesSetGCClipRegion                 = 20;
+  X_XFixesSetWindowShapeRegion            = 21;
+  X_XFixesSetPictureClipRegion            = 22;
+  X_XFixesSetCursorName                   = 23;
+  X_XFixesGetCursorName                   = 24;
+  X_XFixesGetCursorImageAndName           = 25;
+  X_XFixesChangeCursor                    = 26;
+  X_XFixesChangeCursorByName              = 27;
+(*************** Version 3 ******************)
+  X_XFixesExpandRegion                    = 28;
+(*************** Version 4 ******************)
+  X_XFixesHideCursor                      = 29;
+  X_XFixesShowCursor                      = 30;
+(*************** Version 5 ******************)
+  X_XFixesCreatePointerBarrier            = 31;
+  X_XFixesDestroyPointerBarrier           = 32;
+
+  XFixesNumberRequests = X_XFixesDestroyPointerBarrier+1;
+
+{ Selection events share one event number }
+  XFixesSelectionNotify                   = 0;
+
+{ Within the selection, the 'subtype' field distinguishes }
+  XFixesSetSelectionOwnerNotify           = 0;
+  XFixesSelectionWindowDestroyNotify      = 1;
+  XFixesSelectionClientCloseNotify        = 2;
+
+  XFixesSetSelectionOwnerNotifyMask       = 1 shl 0;
+  XFixesSelectionWindowDestroyNotifyMask  = 1 shl 1;
+  XFixesSelectionClientCloseNotifyMask    = 1 shl 2;
+
+{ There's only one cursor event so far }
+  XFixesCursorNotify                      = 1;
+
+  XFixesDisplayCursorNotify               = 0;
+
+  XFixesDisplayCursorNotifyMask           = 1 shl 0;
+
+  XFixesNumberEvents                      = 2;
+
+{ errors }
+  BadRegion                               = 0;
+  BadBarrier                              = 1;
+  XFixesNumberErrors                      = BadBarrier+1;
+
+  SaveSetNearest                          = 0;
+  SaveSetRoot                             = 1;
+
+  SaveSetMap                              = 0;
+  SaveSetUnmap                            = 1;
+
+(*************** Version 2 ******************)
+
+  WindowRegionBounding                    = 0;
+  WindowRegionClip                        = 1;
+
+(*************** Version 5 ******************)
+
+  BarrierPositiveX                        = 1 shl 0;
+  BarrierPositiveY                        = 1 shl 1;
+  BarrierNegativeX                        = 1 shl 2;
+  BarrierNegativeY                        = 1 shl 3;
+

+ 64 - 0
packages/x11/src/xge.pp

@@ -0,0 +1,64 @@
+(*
+ * Copyright © 2007-2008 Peter Hutterer
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Authors: Peter Hutterer, University of South Australia, NICTA
+ *
+ *)
+unit xge;
+
+interface
+
+{$PACKRECORDS C}
+
+uses
+  ctypes, x, xlib;
+
+const
+  libXge = 'Xext';
+
+{ XGE Client interfaces }
+
+//_XFUNCPROTOBEGIN
+
+type
+(**
+ * Generic Event mask.
+ * To be used whenever a list of masks per extension has to be provided.
+ *
+ * But, don't actually use the CARD{8,16,32} types.  We can't get them them
+ * defined here without polluting the namespace.
+ *)
+  PXGenericEventMask = ^TXGenericEventMask;
+  TXGenericEventMask = record
+    extension: cuchar;
+    pad0: cuchar;
+    pad1: cushort;
+    evmask: cuint;
+  end;
+
+function XGEQueryExtension(dpy: PDisplay; event_basep: Pcint; err_basep: Pcint): TBoolResult; cdecl; external libXge;
+function XGEQueryVersion(dpy: PDisplay; major: Pcint; minor: Pcint): TBoolResult; cdecl; external libXge;
+
+//_XFUNCPROTOEND
+
+implementation
+end.

+ 50 - 5
packages/x11/src/xi.pp

@@ -63,6 +63,9 @@ Histroy:
 unit xi;
 unit xi;
 interface
 interface
 
 
+uses
+  ctypes;
+
 const
 const
         sz_xGetExtensionVersionReq           =  8;
         sz_xGetExtensionVersionReq           =  8;
         sz_xGetExtensionVersionReply         = 32;
         sz_xGetExtensionVersionReply         = 32;
@@ -121,6 +124,12 @@ const
         sz_xGetDeviceControlReply            = 32;
         sz_xGetDeviceControlReply            = 32;
         sz_xChangeDeviceControlReq           =  8;
         sz_xChangeDeviceControlReq           =  8;
         sz_xChangeDeviceControlReply         = 32;
         sz_xChangeDeviceControlReply         = 32;
+        sz_xListDevicePropertiesReq          =  8;
+        sz_xListDevicePropertiesReply        = 32;
+        sz_xChangeDevicePropertyReq          = 20;
+        sz_xDeleteDevicePropertyReq          = 12;
+        sz_xGetDevicePropertyReq             = 24;
+        sz_xGetDevicePropertyReply           = 32;
 
 
 const
 const
         INAME  = 'XInputExtension';
         INAME  = 'XInputExtension';
@@ -144,6 +153,7 @@ const
         XI_EYETRACKER  = 'EYETRACKER';
         XI_EYETRACKER  = 'EYETRACKER';
         XI_CURSORKEYS  = 'CURSORKEYS';
         XI_CURSORKEYS  = 'CURSORKEYS';
         XI_FOOTMOUSE   = 'FOOTMOUSE';
         XI_FOOTMOUSE   = 'FOOTMOUSE';
+        XI_JOYSTICK    = 'JOYSTICK';
 
 
 const
 const
         Dont_Check                      = 0;
         Dont_Check                      = 0;
@@ -151,6 +161,8 @@ const
         XInput_Add_XDeviceBell          = 2;
         XInput_Add_XDeviceBell          = 2;
         XInput_Add_XSetDeviceValuators  = 3;
         XInput_Add_XSetDeviceValuators  = 3;
         XInput_Add_XChangeDeviceControl = 4;
         XInput_Add_XChangeDeviceControl = 4;
+        XInput_Add_DevicePresenceNotify = 5;
+        XInput_Add_DeviceProperties     = 6;
 
 
 const
 const
         XI_Absent  = 0;
         XI_Absent  = 0;
@@ -172,8 +184,20 @@ const
         XI_Add_XChangeDeviceControl_Major = 1;
         XI_Add_XChangeDeviceControl_Major = 1;
         XI_Add_XChangeDeviceControl_Minor = 3;
         XI_Add_XChangeDeviceControl_Minor = 3;
 
 
+const
+        XI_Add_DevicePresenceNotify_Major = 1;
+        XI_Add_DevicePresenceNotify_Minor = 4;
+
+const
+        XI_Add_DeviceProperties_Major = 1;
+        XI_Add_DeviceProperties_Minor = 5;
+
 const
 const
         DEVICE_RESOLUTION = 1;
         DEVICE_RESOLUTION = 1;
+        DEVICE_ABS_CALIB  = 2;
+        DEVICE_CORE       = 3;
+        DEVICE_ENABLE     = 4;
+        DEVICE_ABS_AREA   = 5;
 
 
 const
 const
         NoSuchExtension = 1;
         NoSuchExtension = 1;
@@ -197,6 +221,8 @@ const
         IsXPointer         = 0;
         IsXPointer         = 0;
         IsXKeyboard        = 1;
         IsXKeyboard        = 1;
         IsXExtensionDevice = 2;
         IsXExtensionDevice = 2;
+        IsXExtensionKeyboard = 3;
+        IsXExtensionPointer  = 4;
 
 
 const
 const
         AsyncThisDevice   = 0;
         AsyncThisDevice   = 0;
@@ -265,6 +291,7 @@ const
         ProximityClass = 4;
         ProximityClass = 4;
         FocusClass     = 5;
         FocusClass     = 5;
         OtherClass     = 6;
         OtherClass     = 6;
+        AttachClass    = 7;
 
 
 const
 const
         KbdFeedbackClass     = 0;
         KbdFeedbackClass     = 0;
@@ -289,6 +316,18 @@ const
 const
 const
         _devicePresence = 0;
         _devicePresence = 0;
 
 
+const
+        _deviceEnter = 0;
+        _deviceLeave = 1;
+
+const
+        DeviceAdded          = 0;
+        DeviceRemoved        = 1;
+        DeviceEnabled        = 2;
+        DeviceDisabled       = 3;
+        DeviceUnrecoverable  = 4;
+        DeviceControlChanged = 5;
+
 const
 const
         XI_BadDevice  = 0;
         XI_BadDevice  = 0;
         XI_BadEvent   = 1;
         XI_BadEvent   = 1;
@@ -299,13 +338,19 @@ const
 { Make XEventClass be a CARD32 for 64 bit servers.  Don't affect client
 { Make XEventClass be a CARD32 for 64 bit servers.  Don't affect client
   definition of XEventClass since that would be a library interface change.
   definition of XEventClass since that would be a library interface change.
   See the top of X.h for more _XSERVER64 magic.
   See the top of X.h for more _XSERVER64 magic.
+
+  But, don't actually use the CARD32 type.  We can't get it defined here
+  without polluting the namespace.
 }
 }
 type
 type
 {$ifdef _XSERVER64}
 {$ifdef _XSERVER64}
-        XEventClass = CARD32;
+        XEventClass = cuint;
 {$ELSE}
 {$ELSE}
-        XEventClass = Longword;
+        XEventClass = culong;
 {$ENDIF}
 {$ENDIF}
+        PPXEventClass = ^PXEventClass;
+        PXEventClass = ^TXEventClass;
+        TXEventClass = XEventClass;
 
 
 (*******************************************************************
 (*******************************************************************
  *
  *
@@ -316,9 +361,9 @@ type
 type
 type
         PXExtensionVersion = ^TXExtensionVersion;
         PXExtensionVersion = ^TXExtensionVersion;
         TXExtensionVersion = record
         TXExtensionVersion = record
-                              present       : Smallint;
-                              major_version : Smallint;
-                              minor_version : Smallint;
+                              present       : cint;
+                              major_version : cshort;
+                              minor_version : cshort;
                              end;
                              end;
 
 
 implementation
 implementation

+ 276 - 0
packages/x11/src/xi2.pp

@@ -0,0 +1,276 @@
+(*
+ * Copyright © 2009 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ *)
+unit xi2;
+
+{$PACKRECORDS C}
+
+interface
+
+uses
+  ctypes;
+
+const
+  XInput_2_0                              = 7;
+(* DO NOT ADD TO THIS LIST. These are libXi-specific defines.
+   See commit libXi-1.4.2-21-ge8531dd *)
+
+  XI_2_Major                              = 2;
+  XI_2_Minor                              = 3;
+
+{ Property event flags }
+  XIPropertyDeleted                       = 0;
+  XIPropertyCreated                       = 1;
+  XIPropertyModified                      = 2;
+
+{ Property modes }
+  XIPropModeReplace                       = 0;
+  XIPropModePrepend                       = 1;
+  XIPropModeAppend                        = 2;
+
+{ Special property type used for XIGetProperty }
+  XIAnyPropertyType                       = 0;
+
+{ Enter/Leave and Focus In/Out modes }
+  XINotifyNormal                          = 0;
+  XINotifyGrab                            = 1;
+  XINotifyUngrab                          = 2;
+  XINotifyWhileGrabbed                    = 3;
+  XINotifyPassiveGrab                     = 4;
+  XINotifyPassiveUngrab                   = 5;
+
+{ Enter/Leave and focus In/out detail }
+  XINotifyAncestor                        = 0;
+  XINotifyVirtual                         = 1;
+  XINotifyInferior                        = 2;
+  XINotifyNonlinear                       = 3;
+  XINotifyNonlinearVirtual                = 4;
+  XINotifyPointer                         = 5;
+  XINotifyPointerRoot                     = 6;
+  XINotifyDetailNone                      = 7;
+
+{ Grab modes }
+  XIGrabModeSync                          = 0;
+  XIGrabModeAsync                         = 1;
+  XIGrabModeTouch                         = 2;
+
+{ Grab reply status codes }
+  XIGrabSuccess                           = 0;
+  XIAlreadyGrabbed                        = 1;
+  XIGrabInvalidTime                       = 2;
+  XIGrabNotViewable                       = 3;
+  XIGrabFrozen                            = 4;
+
+{ Grab owner events values }
+  XIOwnerEvents                           = True;
+  XINoOwnerEvents                         = False;
+
+{ Passive grab types }
+  XIGrabtypeButton                        = 0;
+  XIGrabtypeKeycode                       = 1;
+  XIGrabtypeEnter                         = 2;
+  XIGrabtypeFocusIn                       = 3;
+  XIGrabtypeTouchBegin                    = 4;
+
+{ Passive grab modifier }
+  XIAnyModifier                           = LongWord(1) shl 31;
+  XIAnyButton                             = 0;
+  XIAnyKeycode                            = 0;
+
+{ XIAllowEvents event-modes }
+  XIAsyncDevice                           = 0;
+  XISyncDevice                            = 1;
+  XIReplayDevice                          = 2;
+  XIAsyncPairedDevice                     = 3;
+  XIAsyncPair                             = 4;
+  XISyncPair                              = 5;
+  XIAcceptTouch                           = 6;
+  XIRejectTouch                           = 7;
+
+{ DeviceChangedEvent change reasons }
+  XISlaveSwitch                           = 1;
+  XIDeviceChange                          = 2;
+
+{ Hierarchy flags }
+  XIMasterAdded                           = 1 shl 0;
+  XIMasterRemoved                         = 1 shl 1;
+  XISlaveAdded                            = 1 shl 2;
+  XISlaveRemoved                          = 1 shl 3;
+  XISlaveAttached                         = 1 shl 4;
+  XISlaveDetached                         = 1 shl 5;
+  XIDeviceEnabled                         = 1 shl 6;
+  XIDeviceDisabled                        = 1 shl 7;
+
+{ ChangeHierarchy constants }
+  XIAddMaster                             = 1;
+  XIRemoveMaster                          = 2;
+  XIAttachSlave                           = 3;
+  XIDetachSlave                           = 4;
+
+  XIAttachToMaster                        = 1;
+  XIFloating                              = 2;
+
+{ Valuator modes }
+  XIModeRelative                          = 0;
+  XIModeAbsolute                          = 1;
+
+{ Device types }
+  XIMasterPointer                         = 1;
+  XIMasterKeyboard                        = 2;
+  XISlavePointer                          = 3;
+  XISlaveKeyboard                         = 4;
+  XIFloatingSlave                         = 5;
+
+(* Device classes: classes that are not identical to Xi 1.x classes must be
+ * numbered starting from 8. *)
+  XIKeyClass                              = 0;
+  XIButtonClass                           = 1;
+  XIValuatorClass                         = 2;
+  XIScrollClass                           = 3;
+  XITouchClass                            = 8;
+
+{ Scroll class types }
+  XIScrollTypeVertical                    = 1;
+  XIScrollTypeHorizontal                  = 2;
+
+{ Scroll class flags }
+  XIScrollFlagNoEmulation                 = 1 shl 0;
+  XIScrollFlagPreferred                   = 1 shl 1;
+
+{ Device event flags (common) }
+{ Device event flags (key events only) }
+  XIKeyRepeat                             = 1 shl 16;
+{ Device event flags (pointer events only) }
+  XIPointerEmulated                       = 1 shl 16;
+{ Device event flags (touch events only) }
+  XITouchPendingEnd                       = 1 shl 16;
+  XITouchEmulatingPointer                 = 1 shl 17;
+
+{ Barrier event flags }
+  XIBarrierPointerReleased                = 1 shl 0;
+  XIBarrierDeviceIsGrabbed                = 1 shl 1;
+
+
+{ Touch modes }
+  XIDirectTouch                           = 1;
+  XIDependentTouch                        = 2;
+
+{ XI2 event mask macros }
+procedure XISetMask(ptr: Pcuchar; event: cint); inline;
+procedure XIClearMask(ptr: Pcuchar; event: cint); inline;
+function XIMaskIsSet(ptr: Pcuchar; event: cint): Boolean; inline;
+function XIMaskLen(event: cint): cint; inline;
+
+const
+{ Fake device ID's for event selection }
+  XIAllDevices                            = 0;
+  XIAllMasterDevices                      = 1;
+
+{ Event types }
+  XI_DeviceChanged                 = 1;
+  XI_KeyPress                      = 2;
+  XI_KeyRelease                    = 3;
+  XI_ButtonPress                   = 4;
+  XI_ButtonRelease                 = 5;
+  XI_Motion                        = 6;
+  XI_Enter                         = 7;
+  XI_Leave                         = 8;
+  XI_FocusIn                       = 9;
+  XI_FocusOut                      = 10;
+  XI_HierarchyChanged              = 11;
+  XI_PropertyEvent                 = 12;
+  XI_RawKeyPress                   = 13;
+  XI_RawKeyRelease                 = 14;
+  XI_RawButtonPress                = 15;
+  XI_RawButtonRelease              = 16;
+  XI_RawMotion                     = 17;
+  XI_TouchBegin                    = 18; { XI 2.2 }
+  XI_TouchUpdate                   = 19;
+  XI_TouchEnd                      = 20;
+  XI_TouchOwnership                = 21;
+  XI_RawTouchBegin                 = 22;
+  XI_RawTouchUpdate                = 23;
+  XI_RawTouchEnd                   = 24;
+  XI_BarrierHit                    = 25; { XI 2.3 }
+  XI_BarrierLeave                  = 26;
+  XI_LASTEVENT                     = XI_BarrierLeave;
+(* NOTE: XI2LASTEVENT in xserver/include/inputstr.h must be the same value
+ * as XI_LASTEVENT if the server is supposed to handle masks etc. for this
+ * type of event. *)
+
+(* Event masks.
+ * Note: the protocol spec defines a mask to be of (1 << type). Clients are
+ * free to create masks by bitshifting instead of using these defines.
+ *)
+  XI_DeviceChangedMask             = 1 shl XI_DeviceChanged;
+  XI_KeyPressMask                  = 1 shl XI_KeyPress;
+  XI_KeyReleaseMask                = 1 shl XI_KeyRelease;
+  XI_ButtonPressMask               = 1 shl XI_ButtonPress;
+  XI_ButtonReleaseMask             = 1 shl XI_ButtonRelease;
+  XI_MotionMask                    = 1 shl XI_Motion;
+  XI_EnterMask                     = 1 shl XI_Enter;
+  XI_LeaveMask                     = 1 shl XI_Leave;
+  XI_FocusInMask                   = 1 shl XI_FocusIn;
+  XI_FocusOutMask                  = 1 shl XI_FocusOut;
+  XI_HierarchyChangedMask          = 1 shl XI_HierarchyChanged;
+  XI_PropertyEventMask             = 1 shl XI_PropertyEvent;
+  XI_RawKeyPressMask               = 1 shl XI_RawKeyPress;
+  XI_RawKeyReleaseMask             = 1 shl XI_RawKeyRelease;
+  XI_RawButtonPressMask            = 1 shl XI_RawButtonPress;
+  XI_RawButtonReleaseMask          = 1 shl XI_RawButtonRelease;
+  XI_RawMotionMask                 = 1 shl XI_RawMotion;
+  XI_TouchBeginMask                = 1 shl XI_TouchBegin;
+  XI_TouchEndMask                  = 1 shl XI_TouchEnd;
+  XI_TouchOwnershipChangedMask     = 1 shl XI_TouchOwnership;
+  XI_TouchUpdateMask               = 1 shl XI_TouchUpdate;
+  XI_RawTouchBeginMask             = 1 shl XI_RawTouchBegin;
+  XI_RawTouchEndMask               = 1 shl XI_RawTouchEnd;
+  XI_RawTouchUpdateMask            = 1 shl XI_RawTouchUpdate;
+  XI_BarrierHitMask                = 1 shl XI_BarrierHit;
+  XI_BarrierLeaveMask              = 1 shl XI_BarrierLeave;
+
+implementation
+
+{ XI2 event mask macros }
+procedure XISetMask(ptr: Pcuchar; event: cint); inline;
+begin
+  ptr[event shr 3] := ptr[event shr 3] or (1 shl (event and 7));
+end;
+
+procedure XIClearMask(ptr: Pcuchar; event: cint); inline;
+begin
+  ptr[event shr 3] := ptr[event shr 3] and not (1 shl (event and 7))
+end;
+
+function XIMaskIsSet(ptr: Pcuchar; event: cint): Boolean; inline;
+begin
+  XIMaskIsSet := (ptr[event shr 3] and (1 shl (event and 7))) <> 0;
+end;
+
+function XIMaskLen(event: cint): cint; inline;
+begin
+  XIMaskLen := (event shr 3) + 1;
+end;
+
+end.
+

+ 1451 - 0
packages/x11/src/xinput.pp

@@ -0,0 +1,1451 @@
+(************************************************************
+
+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.
+
+********************************************************)
+
+{ Definitions used by the library and client }
+
+unit xinput;
+
+interface
+
+{$PACKRECORDS C}
+{$MODE objfpc}
+
+uses
+  ctypes, x, xlib, xi;
+
+const
+  libXi = 'Xi';
+
+  _deviceKeyPress         = 0;
+  _deviceKeyRelease       = 1;
+
+  _deviceButtonPress      = 0;
+  _deviceButtonRelease    = 1;
+
+  _deviceMotionNotify     = 0;
+
+  _deviceFocusIn          = 0;
+  _deviceFocusOut         = 1;
+
+  _proximityIn            = 0;
+  _proximityOut           = 1;
+
+  _deviceStateNotify      = 0;
+  _deviceMappingNotify    = 1;
+  _changeDeviceNotify     = 2;
+(* Space of 3 between is necessary! Reserved for DeviceKeyStateNotify,
+   DeviceButtonStateNotify, DevicePresenceNotify (essentially unused). This
+   code has to be in sync with FixExtensionEvents() in xserver/Xi/extinit.c *)
+  _propertyNotify         = 6;
+
+{ We need the declaration for DevicePresence. }
+function _XiGetDevicePresenceNotifyEvent(dpy: PDisplay): cint; cdecl; external libXi;
+procedure _xibaddevice(dpy: PDisplay; error: Pcint); cdecl; external libXi;
+procedure _xibadclass(dpy: PDisplay; error: Pcint); cdecl; external libXi;
+procedure _xibadevent(dpy: PDisplay; error: Pcint); cdecl; external libXi;
+procedure _xibadmode(dpy: PDisplay; error: Pcint); cdecl; external libXi;
+procedure _xidevicebusy(dpy: PDisplay; error: Pcint); cdecl; external libXi;
+
+procedure DevicePresence(dpy: PDisplay; out event_type: cint; event_class: TXEventClass); inline;
+
+{ Errors }
+procedure BadDevice(dpy: PDisplay; out error: cint); inline;
+
+procedure BadClass(dpy: PDisplay; out error: cint); inline;
+
+procedure BadEvent(dpy: PDisplay; out error: cint); inline;
+
+procedure BadMode(dpy: PDisplay; out error: cint); inline;
+
+procedure DeviceBusy(dpy: PDisplay; out error: cint); inline;
+
+type
+
+(***************************************************************
+ *
+ * DeviceKey events.  These events are sent by input devices that
+ * support input class Keys.
+ * The location of the X pointer is reported in the coordinate
+ * fields of the x,y and x_root,y_root fields.
+ *
+ *)
+
+  PXDeviceKeyEvent = ^TXDeviceKeyEvent;
+  TXDeviceKeyEvent = record
+    _type: cint;                 { of event }
+    serial: culong;              { # of last request processed }
+    send_event: TBool;           { true if from SendEvent request }
+    display: PDisplay;           { Display the event was read from }
+    window: TWindow;             { "event" window reported relative to }
+    deviceid: TXID;
+    root: TWindow;               { root window event occured on }
+    subwindow: TWindow;          { child window }
+    time: TTime;                 { milliseconds }
+    x, y: cint;                  { x, y coordinates in event window }
+    x_root: cint;                { coordinates relative to root }
+    y_root: cint;                { coordinates relative to root }
+    state: cuint;                { key or button mask }
+    keycode: cuint;              { detail }
+    same_screen: TBool;          { same screen flag }
+    device_state: cuint;         { device key or button mask }
+    axes_count: cuchar;
+    first_axis: cuchar;
+    axis_data: array [0..5] of cint;
+  end;
+
+  PXDeviceKeyPressedEvent = ^TXDeviceKeyPressedEvent;
+  TXDeviceKeyPressedEvent = TXDeviceKeyEvent;
+  PXDeviceKeyReleasedEvent = ^TXDeviceKeyReleasedEvent;
+  TXDeviceKeyReleasedEvent = TXDeviceKeyEvent;
+
+(*******************************************************************
+ *
+ * DeviceButton events.  These events are sent by extension devices
+ * that support input class Buttons.
+ *
+ *)
+
+  PXDeviceButtonEvent = ^TXDeviceButtonEvent;
+  TXDeviceButtonEvent = record
+    _type: cint;                { of event }
+    serial: culong;             { # of last request processed by server }
+    send_event: TBool;          { true if from a SendEvent request }
+    display: PDisplay;          { Display the event was read from }
+    window: TWindow;            { "event" window reported relative to }
+    deviceid: TXID;
+    root: TWindow;              { root window that the event occured on }
+    subwindow: TWindow;         { child window }
+    time: TTime;                { milliseconds }
+    x, y: cint;                 { x, y coordinates in event window }
+    x_root: cint;               { coordinates relative to root }
+    y_root: cint;               { coordinates relative to root }
+    state: cuint;               { key or button mask }
+    button: cuint;              { detail }
+    same_screen: TBool;         { same screen flag }
+    device_state: cuint;        { device key or button mask }
+    axes_count: cuchar;
+    first_axis: cuchar;
+    axis_data: array [0..5] of cint;
+  end;
+
+  PXDeviceButtonPressedEvent = ^TXDeviceButtonPressedEvent;
+  TXDeviceButtonPressedEvent = TXDeviceButtonEvent;
+  PXDeviceButtonReleasedEvent = ^TXDeviceButtonReleasedEvent;
+  TXDeviceButtonReleasedEvent = TXDeviceButtonEvent;
+
+(*******************************************************************
+ *
+ * DeviceMotionNotify event.  These events are sent by extension devices
+ * that support input class Valuators.
+ *
+ *)
+
+  PXDeviceMotionEvent = ^TXDeviceMotionEvent;
+  TXDeviceMotionEvent = record
+    _type: cint;               { of event }
+    serial: culong;            { # of last request processed by server }
+    send_event: TBool;         { true if from a SendEvent request }
+    display: PDisplay;         { Display the event was read from }
+    window: TWindow;           { "event" window reported relative to }
+    deviceid: TXID;
+    root: TWindow;             { root window that the event occured on }
+    subwindow: TWindow;        { child window }
+    time: TTime;               { milliseconds }
+    x, y: cint;                { x, y coordinates in event window }
+    x_root: cint;              { coordinates relative to root }
+    y_root: cint;              { coordinates relative to root }
+    state: cuint;              { key or button mask }
+    is_hint: char;             { detail }
+    same_screen: TBool;        { same screen flag }
+    device_state: cuint;       { device key or button mask }
+    axes_count: cuchar;
+    first_axis: cuchar;
+    axis_data: array [0..5] of cint;
+  end;
+
+(*******************************************************************
+ *
+ * DeviceFocusChange events.  These events are sent when the focus
+ * of an extension device that can be focused is changed.
+ *
+ *)
+
+  PXDeviceFocusChangeEvent = ^TXDeviceFocusChangeEvent;
+  TXDeviceFocusChangeEvent = record
+    _type: cint;              { of event }
+    serial: culong;           { # of last request processed by server }
+    send_event: TBool;        { true if from a SendEvent request }
+    display: PDisplay;        { Display the event was read from }
+    window: TWindow;          { "event" window reported relative to }
+    deviceid: TXID;
+    mode: cint;               { NotifyNormal, NotifyGrab, NotifyUngrab }
+    detail: cint;
+        (*
+         * NotifyAncestor, NotifyVirtual, NotifyInferior,
+         * NotifyNonLinear,NotifyNonLinearVirtual, NotifyPointer,
+         * NotifyPointerRoot, NotifyDetailNone
+         *)
+    time: TTime;
+  end;
+
+  PXDeviceFocusInEvent = ^TXDeviceFocusInEvent;
+  TXDeviceFocusInEvent = TXDeviceFocusChangeEvent;
+  PXDeviceFocusOutEvent = ^TXDeviceFocusOutEvent;
+  TXDeviceFocusOutEvent = TXDeviceFocusChangeEvent;
+
+(*******************************************************************
+ *
+ * ProximityNotify events.  These events are sent by those absolute
+ * positioning devices that are capable of generating proximity information.
+ *
+ *)
+
+  PXProximityNotifyEvent = ^TXProximityNotifyEvent;
+  TXProximityNotifyEvent = record
+    _type: cint;               { ProximityIn or ProximityOut }
+    serial: culong;            { # of last request processed by server }
+    send_event: TBool;         { true if this came from a SendEvent request }
+    display: PDisplay;         { Display the event was read from }
+    window: TWindow;
+    deviceid: TXID;
+    root: TWindow;
+    subwindow: TWindow;
+    time: TTime;
+    x, y: cint;
+    x_root, y_root: cint;
+    state: cuint;
+    same_screen: TBool;
+    device_state: cuint;       { device key or button mask }
+    axes_count: cuchar;
+    first_axis: cuchar;
+    axis_data: array [0..5] of cint;
+  end;
+  PXProximityInEvent = ^TXProximityInEvent;
+  TXProximityInEvent = TXProximityNotifyEvent;
+  PXProximityOutEvent = ^TXProximityOutEvent;
+  TXProximityOutEvent = TXProximityNotifyEvent;
+
+(*******************************************************************
+ *
+ * DeviceStateNotify events are generated on EnterWindow and FocusIn 
+ * for those clients who have selected DeviceState.
+ *
+ *)
+
+  PXInputClass = ^TXInputClass;
+  TXInputClass = record
+    c_class: cuchar;
+    length: cuchar;
+  end;
+
+  PXDeviceStateNotifyEvent = ^TXDeviceStateNotifyEvent;
+  TXDeviceStateNotifyEvent = record
+     _type: cint;
+     serial: culong;             { # of last request processed by server }
+     send_event: TBool;          { true if this came from a SendEvent request }
+     display: PDisplay;          { Display the event was read from }
+     window: TWindow;
+     deviceid: TXID;
+     time: TTime;
+     num_classes: cint;
+     data: array [0..63] of cchar;
+  end;
+
+  PXValuatorStatus = ^TXValuatorStatus;
+  TXValuatorStatus = record
+    c_class: cuchar;
+    length: cuchar;
+    num_valuators: cuchar;
+    mode: cuchar;
+    valuators: array [0..5] of cint;
+  end;
+
+  PXKeyStatus = ^TXKeyStatus;
+  TXKeyStatus = record
+    c_class: cuchar;
+    length: cuchar;
+    num_keys: cshort;
+    keys: array [0..31] of cchar;
+  end;
+
+  PXButtonStatus = ^TXButtonStatus;
+  TXButtonStatus = record
+    c_class: cuchar;
+    length: cuchar;
+    num_buttons: cshort	;
+    buttons: array [0..31] of cchar;
+  end;
+
+(*******************************************************************
+ *
+ * DeviceMappingNotify event.  This event is sent when the key mapping,
+ * modifier mapping, or button mapping of an extension device is changed.
+ *
+ *)
+
+  PXDeviceMappingEvent = ^TXDeviceMappingEvent;
+  TXDeviceMappingEvent = record
+    _type: cint;
+    serial: culong;             { # of last request processed by server }
+    send_event: TBool;          { true if this came from a SendEvent request }
+    display: PDisplay;          { Display the event was read from }
+    window: TWindow;            { unused }
+    deviceid: TXID;
+    time: TTime;
+    request: cint;              { one of MappingModifier, MappingKeyboard,
+                                   MappingPointer }
+    first_keycode: cint;        { first keycode }
+    count: cint;                { defines range of change w. first_keycode }
+  end;
+
+(*******************************************************************
+ *
+ * ChangeDeviceNotify event.  This event is sent when an 
+ * XChangeKeyboard or XChangePointer request is made.
+ *
+ *)
+
+  PXChangeDeviceNotifyEvent = ^TXChangeDeviceNotifyEvent;
+  TXChangeDeviceNotifyEvent = record
+    _type: cint;
+    serial: culong;             { # of last request processed by server }
+    send_event: TBool;          { true if this came from a SendEvent request }
+    display: PDisplay;          { Display the event was read from }
+    window: TWindow;            { unused }
+    deviceid: TXID;
+    time: TTime;
+    request: cint;              { NewPointer or NewKeyboard }
+  end;
+
+(*******************************************************************
+ *
+ * DevicePresenceNotify event.  This event is sent when the list of
+ * input devices changes, in which case devchange will be false, and
+ * no information about the change will be contained in the event;
+ * the client should use XListInputDevices() to learn what has changed.
+ *
+ * If devchange is true, an attribute that the server believes is
+ * important has changed on a device, and the client should use
+ * XGetDeviceControl to examine the device.  If control is non-zero,
+ * then that control has changed meaningfully.
+ *)
+
+  PXDevicePresenceNotifyEvent = ^TXDevicePresenceNotifyEvent;
+  TXDevicePresenceNotifyEvent = record
+    _type: cint;
+    serial: culong;             { # of last request processed by server }
+    send_event: TBool;          { true if this came from a SendEvent request }
+    display: PDisplay;          { Display the event was read from }
+    window: TWindow;            { unused }
+    time: TTime;
+    devchange: TBool;
+    deviceid: TXID;
+    control: TXID;
+  end;
+
+(*
+ * Notifies the client that a property on a device has changed value. The
+ * client is expected to query the server for updated value of the property.
+ *)
+  PXDevicePropertyNotifyEvent = ^TXDevicePropertyNotifyEvent;
+  TXDevicePropertyNotifyEvent = record
+    _type: cint;
+    serial: culong;             { # of last request processed by server }
+    send_event: TBool;          { true if this came from a SendEvent request }
+    display: PDisplay;          { Display the event was read from }
+    window: TWindow;            { unused }
+    time: TTime;
+    deviceid: TXID;             { id of the device that changed }
+    atom: TAtom;                { the property that changed }
+    state: cint;                { PropertyNewValue or PropertyDeleted }
+  end;
+
+
+(*******************************************************************
+ *
+ * Control structures for input devices that support input class
+ * Feedback.  These are used by the XGetFeedbackControl and 
+ * XChangeFeedbackControl functions.
+ *
+ *)
+
+  PXFeedbackState = ^TXFeedbackState;
+  TXFeedbackState = record
+    c_class: TXID;
+    length: cint;
+    id: TXID;
+  end;
+
+  PXKbdFeedbackState = ^TXKbdFeedbackState;
+  TXKbdFeedbackState = record
+    c_class: TXID;
+    length: cint;
+    id: TXID;
+    click: cint;
+    percent: cint;
+    pitch: cint;
+    duration: cint;
+    led_mask: cint;
+    global_auto_repeat: cint;
+    auto_repeats: array [0..31] of cchar;
+  end;
+
+  PXPtrFeedbackState = ^TXPtrFeedbackState;
+  TXPtrFeedbackState = record
+    c_class: TXID;
+    length: cint;
+    id: TXID;
+    accelNum: cint;
+    accelDenom: cint;
+    threshold: cint;
+  end;
+
+  PXIntegerFeedbackState = ^TXIntegerFeedbackState;
+  TXIntegerFeedbackState = record
+    c_class: TXID;
+    length: cint;
+    id: TXID;
+    resolution: cint;
+    minVal: cint;
+    maxVal: cint;
+  end;
+
+  PXStringFeedbackState = ^TXStringFeedbackState;
+  TXStringFeedbackState = record
+    c_class: TXID;
+    length: cint;
+    id: TXID;
+    max_symbols: cint;
+    num_syms_supported: cint;
+    syms_supported: PKeySym;
+  end;
+
+  PXBellFeedbackState = ^TXBellFeedbackState;
+  TXBellFeedbackState = record
+    c_class: TXID;
+    length: cint;
+    id: TXID;
+    percent: cint;
+    pitch: cint;
+    duration: cint;
+  end;
+
+  PXLedFeedbackState = ^TXLedFeedbackState;
+  TXLedFeedbackState = record
+    c_class: TXID;
+    length: cint;
+    id: TXID;
+    led_values: cint;
+    led_mask: cint;
+  end;
+
+  PXFeedbackControl = ^TXFeedbackControl;
+  TXFeedbackControl = record
+    c_class: TXID;
+    length: cint;
+    id: TXID;
+  end;
+
+  PXPtrFeedbackControl = ^TXPtrFeedbackControl;
+  TXPtrFeedbackControl = record
+    c_class: TXID;
+    length: cint;
+    id: TXID;
+    accelNum: cint;
+    accelDenom: cint;
+    threshold: cint;
+  end;
+
+  PXKbdFeedbackControl = ^TXKbdFeedbackControl;
+  TXKbdFeedbackControl = record
+    c_class: TXID;
+    length: cint;
+    id: TXID;
+    click: cint;
+    percent: cint;
+    pitch: cint;
+    duration: cint;
+    led_mask: cint;
+    led_value: cint;
+    key: cint;
+    auto_repeat_mode: cint;
+  end;
+
+  PXStringFeedbackControl = ^TXStringFeedbackControl;
+  TXStringFeedbackControl = record
+    c_class: TXID;
+    length: cint;
+    id: TXID;
+    num_keysyms: cint;
+    syms_to_display: PKeySym;
+  end;
+
+  PXIntegerFeedbackControl = ^TXIntegerFeedbackControl;
+  TXIntegerFeedbackControl = record
+    c_class: TXID;
+    length: cint;
+    id: TXID;
+    int_to_display: cint;
+  end;
+
+  PXBellFeedbackControl = ^TXBellFeedbackControl;
+  TXBellFeedbackControl = record
+    c_class: TXID;
+    length: cint;
+    id: TXID;
+    percent: cint;
+    pitch: cint;
+    duration: cint;
+  end;
+
+  PXLedFeedbackControl = ^TXLedFeedbackControl;
+  TXLedFeedbackControl = record
+    c_class: TXID;
+    length: cint;
+    id: TXID;
+    led_mask: cint;
+    led_values: cint;
+  end;
+
+(*******************************************************************
+ *
+ * Device control structures.
+ *
+ *)
+
+  PXDeviceControl = ^TXDeviceControl;
+  TXDeviceControl = record
+    control: TXID;
+    length: cint;
+  end;
+
+  PXDeviceResolutionControl = ^TXDeviceResolutionControl;
+  TXDeviceResolutionControl = record
+    control: TXID;
+    length: cint;
+    first_valuator: cint;
+    num_valuators: cint;
+    resolutions: Pcint;
+  end;
+
+  PXDeviceResolutionState = ^TXDeviceResolutionState;
+  TXDeviceResolutionState = record
+    control: TXID;
+    length: cint;
+    num_valuators: cint;
+    resolutions: Pcint;
+    min_resolutions: Pcint;
+    max_resolutions: Pcint;
+  end;
+
+  PXDeviceAbsCalibControl = ^TXDeviceAbsCalibControl;
+  TXDeviceAbsCalibControl = record
+    control: TXID;
+    length: cint;
+    min_x: cint;
+    max_x: cint;
+    min_y: cint;
+    max_y: cint;
+    flip_x: cint;
+    flip_y: cint;
+    rotation: cint;
+    button_threshold: cint;
+  end;
+  PXDeviceAbsCalibState = ^TXDeviceAbsCalibState;
+  TXDeviceAbsCalibState = TXDeviceAbsCalibControl;
+
+  PXDeviceAbsAreaControl = ^TXDeviceAbsAreaControl;
+  TXDeviceAbsAreaControl = record
+    control: TXID;
+    length: cint;
+    offset_x: cint;
+    offset_y: cint;
+    width: cint;
+    height: cint;
+    screen: cint;
+    following: TXID;
+  end;
+  PXDeviceAbsAreaState = ^TXDeviceAbsAreaState;
+  TXDeviceAbsAreaState = TXDeviceAbsAreaControl;
+
+  PXDeviceCoreControl = ^TXDeviceCoreControl;
+  TXDeviceCoreControl = record
+    control: TXID;
+    length: cint;
+    status: cint;
+  end;
+
+  PXDeviceCoreState = ^TXDeviceCoreState;
+  TXDeviceCoreState = record
+    control: TXID;
+    length: cint;
+    status: cint;
+    iscore: cint;
+  end;
+
+  PXDeviceEnableControl = ^TXDeviceEnableControl;
+  TXDeviceEnableControl = record
+    control: TXID;
+    length: cint;
+    enable: cint;
+  end;
+  PXDeviceEnableState = ^TXDeviceEnableState;
+  TXDeviceEnableState = TXDeviceEnableControl;
+
+(*******************************************************************
+ *
+ * An array of XDeviceList structures is returned by the 
+ * XListInputDevices function.  Each entry contains information
+ * about one input device.  Among that information is an array of 
+ * pointers to structures that describe the characteristics of 
+ * the input device.
+ *
+ *)
+
+  PXAnyClassInfo = ^TXAnyClassInfo;
+  TXAnyClassPtr = PXAnyClassInfo;
+  TXAnyClassInfo = record
+    c_classs: TXID;
+    length: cint;
+  end;
+
+  PXDeviceInfo = ^TXDeviceInfo;
+  TXDeviceInfoPtr = PXDeviceInfo;
+  TXDeviceInfo = record
+    id: TXID;
+    _type: TAtom;
+    name: PChar;
+    num_classes: cint;
+    use: cint;
+    inputclassinfo: TXAnyClassPtr;
+  end;
+
+  PXKeyInfo = ^TXKeyInfo;
+  TXKeyInfoPtr = PXKeyInfo;
+  TXKeyInfo = record
+    c_class: TXID;
+    length: cint;
+    min_keycode: cushort;
+    max_keycode: cushort;
+    num_keys: cushort;
+  end;
+
+  PXButtonInfo = ^TXButtonInfo;
+  TXButtonInfoPtr = PXButtonInfo;
+  TXButtonInfo = record
+    c_class: TXID;
+    length: cint;
+    num_buttons: cshort;
+  end;
+
+  PXAxisInfo = ^TXAxisInfo;
+  TXAxisInfoPtr = PXAxisInfo;
+  TXAxisInfo = record
+    resolution: cint;
+    min_value: cint;
+    max_value: cint;
+  end;
+
+  PXValuatorInfo = ^TXValuatorInfo;
+  TXValuatorInfoPtr = PXValuatorInfo;
+  TXValuatorInfo = record
+    c_class: TXID;
+    length: cint;
+    num_axes: cuchar;
+    mode: cuchar;
+    motion_buffer: culong;
+    axes: TXAxisInfoPtr;
+  end;
+
+(*******************************************************************
+ *
+ * An XDevice structure is returned by the XOpenDevice function.  
+ * It contains an array of pointers to XInputClassInfo structures.
+ * Each contains information about a class of input supported by the
+ * device, including a pointer to an array of data for each type of event
+ * the device reports.
+ *
+ *)
+
+
+  PXInputClassInfo = ^TXInputClassInfo;
+  TXInputClassInfo = record
+    input_class: cuchar;
+    event_type_base: cuchar;
+  end;
+
+  PXDevice = ^TXDevice;
+  TXDevice = record
+    device_id: TXID;
+    num_classes: cint;
+    classes: PXInputClassInfo;
+  end;
+
+
+(*******************************************************************
+ *
+ * The following structure is used to return information for the 
+ * XGetSelectedExtensionEvents function.
+ *
+ *)
+
+  PXEventList = ^TXEventList;
+  TXEventList = record
+    event_type: TXEventClass;
+    device: TXID;
+  end;
+
+(*******************************************************************
+ *
+ * The following structure is used to return motion history data from 
+ * an input device that supports the input class Valuators.
+ * This information is returned by the XGetDeviceMotionEvents function.
+ *
+ *)
+
+  PXDeviceTimeCoord = ^TXDeviceTimeCoord;
+  TXDeviceTimeCoord = record
+    time: TTime;
+    data: Pcint;
+  end;
+
+
+(*******************************************************************
+ *
+ * Device state structure.
+ * This is returned by the XQueryDeviceState request.
+ *
+ *)
+
+  PXDeviceState = ^TXDeviceState;
+  TXDeviceState = record
+    device_id: TXID;
+    num_classes: cint;
+    data: PXInputClass;
+  end;
+
+(*******************************************************************
+ *
+ * Note that the mode field is a bitfield that reports the Proximity
+ * status of the device as well as the mode.  The mode field should
+ * be OR'd with the mask DeviceMode and compared with the values
+ * Absolute and Relative to determine the mode, and should be OR'd
+ * with the mask ProximityState and compared with the values InProximity
+ * and OutOfProximity to determine the proximity state.
+ *
+ *)
+
+  PXValuatorState = ^TXValuatorState;
+  TXValuatorState = record
+    c_class: cuchar;
+    length: cuchar;
+    num_valuators: cuchar;
+    mode: cuchar;
+    valuators: Pcint;
+  end;
+
+  PXKeyState = ^TXKeyState;
+  TXKeyState = record
+    c_class: cuchar;
+    length: cuchar;
+    num_keys: cshort;
+    keys: array [0..31] of cchar;
+  end;
+
+  PXButtonState = ^TXButtonState;
+  TXButtonState = record
+    c_class: cuchar;
+    length: cuchar;
+    num_buttons: cshort;
+    buttons: array [0..31] of cchar;
+  end;
+
+procedure FindTypeAndClass(d: PXDevice; out event_type: cint; out event_class: TXEventClass; classid: cuchar; offset: cint); inline;
+procedure DeviceKeyPress(d: PXDevice; out event_type: cint; out event_class: TXEventClass); inline;
+procedure DeviceKeyRelease(d: PXDevice; out event_type: cint; out event_class: TXEventClass); inline;
+procedure DeviceButtonPress(d: PXDevice; out event_type: cint; out event_class: TXEventClass); inline;
+procedure DeviceButtonRelease(d: PXDevice; out event_type: cint; out event_class: TXEventClass); inline;
+procedure DeviceMotionNotify(d: PXDevice; out event_type: cint; out event_class: TXEventClass); inline;
+procedure DeviceFocusIn(d: PXDevice; out event_type: cint; out event_class: TXEventClass); inline;
+procedure DeviceFocusOut(d: PXDevice; out event_type: cint; out event_class: TXEventClass); inline;
+procedure ProximityIn(d: PXDevice; out event_type: cint; out event_class: TXEventClass); inline;
+procedure ProximityOut(d: PXDevice; out event_type: cint; out event_class: TXEventClass); inline;
+procedure DeviceStateNotify(d: PXDevice; out event_type: cint; out event_class: TXEventClass); inline;
+procedure DeviceMappingNotify(d: PXDevice; out event_type: cint; out event_class: TXEventClass); inline;
+procedure ChangeDeviceNotify(d: PXDevice; out event_type: cint; out event_class: TXEventClass); inline;
+procedure DevicePropertyNotify(d: PXDevice; out event_type: cint; out event_class: TXEventClass); inline;
+procedure DevicePointerMotionHint(d: PXDevice; event_type: cint; out event_class: TXEventClass); inline;
+procedure DeviceButton1Motion(d: PXDevice; event_type: cint; out event_class: TXEventClass); inline;
+procedure DeviceButton2Motion(d: PXDevice; event_type: cint; out event_class: TXEventClass); inline;
+procedure DeviceButton3Motion(d: PXDevice; event_type: cint; out event_class: TXEventClass); inline;
+procedure DeviceButton4Motion(d: PXDevice; event_type: cint; out event_class: TXEventClass); inline;
+procedure DeviceButton5Motion(d: PXDevice; event_type: cint; out event_class: TXEventClass); inline;
+procedure DeviceButtonMotion(d: PXDevice; event_type: cint; out event_class: TXEventClass); inline;
+procedure DeviceOwnerGrabButton(d: PXDevice; event_type: cint; out event_class: TXEventClass); inline;
+procedure DeviceButtonPressGrab(d: PXDevice; event_type: cint; out event_class: TXEventClass); inline;
+procedure NoExtensionEvent(d: PXDevice; event_type: cint; out event_class: TXEventClass); inline;
+
+
+
+
+(*******************************************************************
+ *
+ * Function definitions.
+ *
+ *)
+
+//_XFUNCPROTOBEGIN
+
+function XChangeKeyboardDevice(
+    display: PDisplay;
+    device: PXDevice
+): cint; cdecl; external libXi;
+
+function XChangePointerDevice(
+    display: PDisplay;
+    device: PXDevice;
+    xaxis: cint;
+    yaxis: cint
+): cint; cdecl; external libXi;
+
+function XGrabDevice(
+    display: PDisplay;
+    device: PXDevice;
+    grab_window: TWindow;
+    ownerEvents: TBool;
+    event_count: cint;
+    event_list: PXEventClass;
+    this_device_mode: cint;
+    other_devices_mode: cint;
+    time: TTime
+): cint; cdecl; external libXi;
+
+{ boolean overload for the TBool parameter }
+function XGrabDevice(
+    display: PDisplay;
+    device: PXDevice;
+    grab_window: TWindow;
+    ownerEvents: Boolean;
+    event_count: cint;
+    event_list: PXEventClass;
+    this_device_mode: cint;
+    other_devices_mode: cint;
+    time: TTime
+): cint; inline;
+
+function XUngrabDevice(
+    display: PDisplay;
+    device: PXDevice;
+    time: TTime
+): cint; cdecl; external libXi;
+
+function XGrabDeviceKey(
+    display: PDisplay;
+    device: PXDevice;
+    key: cuint;
+    modifiers: cuint;
+    modifier_device: PXDevice;
+    grab_window: TWindow;
+    owner_events: TBool;
+    event_count: cuint;
+    event_list: PXEventClass;
+    this_device_mode: cint;
+    other_devices_mode: cint
+): cint; cdecl; external libXi;
+
+{ boolean overload for the TBool parameter }
+function XGrabDeviceKey(
+    display: PDisplay;
+    device: PXDevice;
+    key: cuint;
+    modifiers: cuint;
+    modifier_device: PXDevice;
+    grab_window: TWindow;
+    owner_events: Boolean;
+    event_count: cuint;
+    event_list: PXEventClass;
+    this_device_mode: cint;
+    other_devices_mode: cint
+): cint; inline;
+
+function XUngrabDeviceKey(
+    display: PDisplay;
+    device: PXDevice;
+    key: cuint;
+    modifiers: cuint;
+    modifier_dev: PXDevice;
+    grab_window: TWindow
+): cint; cdecl; external libXi;
+
+function XGrabDeviceButton(
+    display: PDisplay;
+    device: PXDevice;
+    button: cuint;
+    modifiers: cuint;
+    modifier_device: PXDevice;
+    grab_window: TWindow;
+    owner_events: TBool;
+    event_count: cuint;
+    event_list: PXEventClass;
+    this_device_mode: cint;
+    other_devices_mode: cint
+): cint; cdecl; external libXi;
+
+{ boolean overload for the TBool parameter }
+function XGrabDeviceButton(
+    display: PDisplay;
+    device: PXDevice;
+    button: cuint;
+    modifiers: cuint;
+    modifier_device: PXDevice;
+    grab_window: TWindow;
+    owner_events: Boolean;
+    event_count: cuint;
+    event_list: PXEventClass;
+    this_device_mode: cint;
+    other_devices_mode: cint
+): cint; inline;
+
+function XUngrabDeviceButton(
+    display: PDisplay;
+    device: PXDevice;
+    button: cuint;
+    modifiers: cuint;
+    modifier_dev: PXDevice;
+    grab_window: TWindow
+): cint; cdecl; external libXi;
+
+function XAllowDeviceEvents(
+    display: PDisplay;
+    device: PXDevice;
+    event_mode: cint;
+    time: TTime
+): cint; cdecl; external libXi;
+
+function XGetDeviceFocus(
+    display: PDisplay;
+    device: PXDevice;
+    focus: PWindow;
+    revert_to: Pcint;
+    time: PTime
+): cint; cdecl; external libXi;
+
+function XSetDeviceFocus(
+    display: PDisplay;
+    device: PXDevice;
+    focus: TWindow;
+    revert_to: cint;
+    time: TTime
+): cint; cdecl; external libXi;
+
+function XGetFeedbackControl(
+    display: PDisplay;
+    device: PXDevice;
+    num_feedbacks: Pcint
+): PXFeedbackState; cdecl; external libXi;
+
+procedure XFreeFeedbackList(
+    list: PXFeedbackState
+); cdecl; external libXi;
+
+function XChangeFeedbackControl(
+    display: PDisplay;
+    device: PXDevice;
+    mask: culong;
+    f: PXFeedbackControl
+): cint; cdecl; external libXi;
+
+function XDeviceBell(
+    display: PDisplay;
+    device: PXDevice;
+    feedbackclass: TXID;
+    feedbackid: TXID;
+    percent: cint
+): cint; cdecl; external libXi;
+
+function XGetDeviceKeyMapping(
+    display: PDisplay;
+    device: PXDevice;
+{$ifdef NeedWidePrototypes}
+    first: cuint;
+{$else}
+    first: TKeyCode;
+{$endif}
+    keycount: cint;
+    syms_per_code: Pcint
+): PKeySym; cdecl; external libXi;
+
+function XChangeDeviceKeyMapping(
+    display: PDisplay;
+    device: PXDevice;
+    first: cint;
+    syms_per_code: cint;
+    keysyms: PKeySym;
+    count: cint
+): cint; cdecl; external libXi;
+
+function XGetDeviceModifierMapping(
+    display: PDisplay;
+    device: PXDevice
+): PXModifierKeymap; cdecl; external libXi;
+
+function XSetDeviceModifierMapping(
+    display: PDisplay;
+    device: PXDevice;
+    modmap: PXModifierKeymap
+): cint; cdecl; external libXi;
+
+function XSetDeviceButtonMapping(
+    display: PDisplay;
+    device: PXDevice;
+    map: Pcuchar;
+    nmap: cint
+): cint; cdecl; external libXi;
+
+function XGetDeviceButtonMapping(
+    display: PDisplay;
+    device: PXDevice;
+    map: Pcuchar;
+    nmap: cuint
+): cint; cdecl; external libXi;
+
+function XQueryDeviceState(
+    display: PDisplay;
+    device: PXDevice
+): PXDeviceState; cdecl; external libXi;
+
+procedure XFreeDeviceState(
+    list: PXDeviceState
+); cdecl; external libXi;
+
+function XGetExtensionVersion(
+    display: PDisplay;
+    name: {_Xconst} Pchar
+): PXExtensionVersion; cdecl; external libXi;
+
+function XListInputDevices(
+    display: PDisplay;
+    ndevices: Pcint
+): PXDeviceInfo; cdecl; external libXi;
+
+procedure XFreeDeviceList(
+    list: PXDeviceInfo
+); cdecl; external libXi;
+
+function XOpenDevice(
+    display: PDisplay;
+    id: TXID
+): PXDevice; cdecl; external libXi;
+
+function XCloseDevice(
+    display: PDisplay;
+    device: PXDevice
+): cint; cdecl; external libXi;
+
+function XSetDeviceMode(
+    display: PDisplay;
+    device: PXDevice;
+    mode: cint
+): cint; cdecl; external libXi;
+
+function XSetDeviceValuators(
+    display: PDisplay;
+    device: PXDevice;
+    valuators: Pcint;
+    first_valuator: cint;
+    num_valuators: cint
+): cint; cdecl; external libXi;
+
+function XGetDeviceControl(
+    display: PDisplay;
+    device: PXDevice;
+    control: cint
+): PXDeviceControl; cdecl; external libXi;
+
+function XChangeDeviceControl(
+    display: PDisplay;
+    device: PXDevice;
+    control: cint;
+    d: PXDeviceControl
+): cint; cdecl; external libXi;
+
+function XSelectExtensionEvent(
+    display: PDisplay;
+    w: TWindow;
+    event_list: PXEventClass;
+    count: cint
+): cint; cdecl; external libXi;
+
+function XGetSelectedExtensionEvents(
+    display: PDisplay;
+    w: TWindow;
+    this_client_count: Pcint;
+    this_client_list: PPXEventClass;
+    all_clients_count: Pcint;
+    all_clients_list: PPXEventClass
+): cint; cdecl; external libXi;
+
+function XChangeDeviceDontPropagateList(
+    display: PDisplay;
+    window: TWindow;
+    count: cint;
+    events: PXEventClass;
+    mode: cint
+): cint; cdecl; external libXi;
+
+function XGetDeviceDontPropagateList(
+    display: PDisplay;
+    window: TWindow;
+    count: Pcint
+): PXEventClass; cdecl; external libXi;
+
+function XSendExtensionEvent(
+    display: PDisplay;
+    device: PXDevice;
+    dest: TWindow;
+    prop: TBool;
+    count: cint;
+    list: PXEventClass;
+    event: PXEvent
+): TStatus; cdecl; external libXi;
+
+{ boolean overload for the TBool parameter }
+function XSendExtensionEvent(
+    display: PDisplay;
+    device: PXDevice;
+    dest: TWindow;
+    prop: Boolean;
+    count: cint;
+    list: PXEventClass;
+    event: PXEvent
+): TStatus; inline;
+
+function XGetDeviceMotionEvents(
+    display: PDisplay;
+    device: PXDevice;
+    start: TTime;
+    stop: TTime;
+    nEvents: Pcint;
+    mode: Pcint;
+    axis_count: Pcint
+): PXDeviceTimeCoord; cdecl; external libXi;
+
+procedure XFreeDeviceMotionEvents(
+    events: PXDeviceTimeCoord
+); cdecl; external libXi;
+
+procedure XFreeDeviceControl(
+    control: PXDeviceControl
+); cdecl; external libXi;
+
+function XListDeviceProperties(
+    dpy: PDisplay;
+    dev: PXDevice;
+    nprops_return: Pcint
+): PAtom; cdecl; external libXi;
+
+procedure XChangeDeviceProperty(
+    dpy: PDisplay;
+    dev: PXDevice;
+    _property: TAtom;
+    _type: TAtom;
+    format: cint;
+    mode: cint;
+    data: {_Xconst} Pcuchar;
+    nelements: cint
+); cdecl; external libXi;
+
+procedure XDeleteDeviceProperty(
+    dpy: PDisplay;
+    dev: PXDevice;
+    _property: TAtom
+); cdecl; external libXi;
+
+function XGetDeviceProperty(
+     dpy: PDisplay;
+     dev: PXDevice;
+     _property: TAtom;
+     offset: clong;
+     length: clong;
+     delete: TBool;
+     req_type: TAtom;
+     actual_type: PAtom;
+     actual_format: Pcint;
+     nitems: Pculong;
+     bytes_after: Pculong;
+     prop: PPcuchar
+): TStatus; cdecl; external libXi;
+
+{ boolean overload for the TBool parameter }
+function XGetDeviceProperty(
+     dpy: PDisplay;
+     dev: PXDevice;
+     _property: TAtom;
+     offset: clong;
+     length: clong;
+     delete: Boolean;
+     req_type: TAtom;
+     actual_type: PAtom;
+     actual_format: Pcint;
+     nitems: Pculong;
+     bytes_after: Pculong;
+     prop: PPcuchar
+): TStatus; inline;
+
+//_XFUNCPROTOEND
+
+implementation
+
+procedure DevicePresence(dpy: PDisplay; out event_type: cint; event_class: TXEventClass); inline;
+begin
+  event_type := _XiGetDevicePresenceNotifyEvent(dpy);
+  event_class := $10000 or _devicePresence;
+end;
+
+procedure BadDevice(dpy: PDisplay; out error: cint); inline;
+begin
+  _xibaddevice(dpy, @error);
+end;
+
+procedure BadClass(dpy: PDisplay; out error: cint); inline;
+begin
+  _xibadclass(dpy, @error);
+end;
+
+procedure BadEvent(dpy: PDisplay; out error: cint); inline;
+begin
+  _xibadevent(dpy, @error);
+end;
+
+procedure BadMode(dpy: PDisplay; out error: cint); inline;
+begin
+  _xibadmode(dpy, @error);
+end;
+
+procedure DeviceBusy(dpy: PDisplay; out error: cint); inline;
+begin
+  _xidevicebusy(dpy, @error);
+end;
+
+procedure FindTypeAndClass(d: PXDevice; out event_type: cint; out event_class: TXEventClass; classid: cuchar; offset: cint); inline;
+var
+  _i : cint = 0;
+  _ip: PXInputClassInfo;
+begin
+  event_type := 0;
+  event_class := 0;
+
+  _ip := d^.classes;
+  for _i := 0 to d^.num_classes - 1 do
+  begin
+    if _ip^.input_class = classid then
+    begin
+      event_type := _ip^.event_type_base + offset;
+      event_class := (d^.device_id shl 8) or event_type;
+    end;
+    Inc(_ip);
+  end;
+end;
+
+procedure DeviceKeyPress(d: PXDevice; out event_type: cint; out event_class: TXEventClass); inline;
+begin
+  FindTypeAndClass(d, event_type, event_class, KeyClass, _deviceKeyPress);
+end;
+
+procedure DeviceKeyRelease(d: PXDevice; out event_type: cint; out event_class: TXEventClass); inline;
+begin
+  FindTypeAndClass(d, event_type, event_class, KeyClass, _deviceKeyRelease);
+end;
+
+procedure DeviceButtonPress(d: PXDevice; out event_type: cint; out event_class: TXEventClass); inline;
+begin
+  FindTypeAndClass(d, event_type, event_class, ButtonClass, _deviceButtonPress);
+end;
+
+procedure DeviceButtonRelease(d: PXDevice; out event_type: cint; out event_class: TXEventClass); inline;
+begin
+  FindTypeAndClass(d, event_type, event_class, ButtonClass, _deviceButtonRelease);
+end;
+
+procedure DeviceMotionNotify(d: PXDevice; out event_type: cint; out event_class: TXEventClass); inline;
+begin
+  FindTypeAndClass(d, event_type, event_class, ValuatorClass, _deviceMotionNotify);
+end;
+
+procedure DeviceFocusIn(d: PXDevice; out event_type: cint; out event_class: TXEventClass); inline;
+begin
+  FindTypeAndClass(d, event_type, event_class, FocusClass, _deviceFocusIn);
+end;
+
+procedure DeviceFocusOut(d: PXDevice; out event_type: cint; out event_class: TXEventClass); inline;
+begin
+  FindTypeAndClass(d, event_type, event_class, FocusClass, _deviceFocusOut);
+end;
+
+procedure ProximityIn(d: PXDevice; out event_type: cint; out event_class: TXEventClass); inline;
+begin
+  FindTypeAndClass(d, event_type, event_class, ProximityClass, _proximityIn);
+end;
+
+procedure ProximityOut(d: PXDevice; out event_type: cint; out event_class: TXEventClass); inline;
+begin
+  FindTypeAndClass(d, event_type, event_class, ProximityClass, _proximityOut);
+end;
+
+procedure DeviceStateNotify(d: PXDevice; out event_type: cint; out event_class: TXEventClass); inline;
+begin
+  FindTypeAndClass(d, event_type, event_class, OtherClass, _deviceStateNotify);
+end;
+
+procedure DeviceMappingNotify(d: PXDevice; out event_type: cint; out event_class: TXEventClass); inline;
+begin
+  FindTypeAndClass(d, event_type, event_class, OtherClass, _deviceMappingNotify);
+end;
+
+procedure ChangeDeviceNotify(d: PXDevice; out event_type: cint; out event_class: TXEventClass); inline;
+begin
+  FindTypeAndClass(d, event_type, event_class, OtherClass, _changeDeviceNotify);
+end;
+
+procedure DevicePropertyNotify(d: PXDevice; out event_type: cint; out event_class: TXEventClass); inline;
+begin
+  FindTypeAndClass(d, event_type, event_class, OtherClass, _propertyNotify);
+end;
+
+procedure DevicePointerMotionHint(d: PXDevice; event_type: cint; out event_class: TXEventClass); inline;
+begin
+  event_class := (d^.device_id shl 8) or _devicePointerMotionHint;
+end;
+
+procedure DeviceButton1Motion(d: PXDevice; event_type: cint; out event_class: TXEventClass); inline;
+begin
+  event_class := (d^.device_id shl 8) or _deviceButton1Motion;
+end;
+
+procedure DeviceButton2Motion(d: PXDevice; event_type: cint; out event_class: TXEventClass); inline;
+begin
+  event_class := (d^.device_id shl 8) or _deviceButton2Motion;
+end;
+
+procedure DeviceButton3Motion(d: PXDevice; event_type: cint; out event_class: TXEventClass); inline;
+begin
+  event_class := (d^.device_id shl 8) or _deviceButton3Motion;
+end;
+
+procedure DeviceButton4Motion(d: PXDevice; event_type: cint; out event_class: TXEventClass); inline;
+begin
+  event_class := (d^.device_id shl 8) or _deviceButton4Motion;
+end;
+
+procedure DeviceButton5Motion(d: PXDevice; event_type: cint; out event_class: TXEventClass); inline;
+begin
+  event_class := (d^.device_id shl 8) or _deviceButton5Motion;
+end;
+
+procedure DeviceButtonMotion(d: PXDevice; event_type: cint; out event_class: TXEventClass); inline;
+begin
+  event_class := (d^.device_id shl 8) or _deviceButtonMotion;
+end;
+
+procedure DeviceOwnerGrabButton(d: PXDevice; event_type: cint; out event_class: TXEventClass); inline;
+begin
+  event_class := (d^.device_id shl 8) or _deviceOwnerGrabButton;
+end;
+
+procedure DeviceButtonPressGrab(d: PXDevice; event_type: cint; out event_class: TXEventClass); inline;
+begin
+  event_class := (d^.device_id shl 8) or _deviceButtonGrab;
+end;
+
+procedure NoExtensionEvent(d: PXDevice; event_type: cint; out event_class: TXEventClass); inline;
+begin
+  event_class := (d^.device_id shl 8) or _noExtensionEvent;
+end;
+
+function XGrabDevice(display: PDisplay; device: PXDevice; grab_window: TWindow;
+  ownerEvents: Boolean; event_count: cint; event_list: PXEventClass;
+  this_device_mode: cint; other_devices_mode: cint; time: TTime): cint; inline;
+begin
+  XGrabDevice := XGrabDevice(display, device, grab_window, Ord(ownerEvents), event_count, event_list, this_device_mode,
+    other_devices_mode, time);
+end;
+
+function XGrabDeviceKey(display: PDisplay; device: PXDevice; key: cuint;
+  modifiers: cuint; modifier_device: PXDevice; grab_window: TWindow;
+  owner_events: Boolean; event_count: cuint; event_list: PXEventClass;
+  this_device_mode: cint; other_devices_mode: cint): cint; inline;
+begin
+  XGrabDeviceKey := XGrabDeviceKey(display, device, key, modifiers, modifier_device, grab_window,
+    Ord(owner_events), event_count, event_list, this_device_mode, other_devices_mode);
+end;
+
+function XGrabDeviceButton(display: PDisplay; device: PXDevice; button: cuint;
+  modifiers: cuint; modifier_device: PXDevice; grab_window: TWindow;
+  owner_events: Boolean; event_count: cuint; event_list: PXEventClass;
+  this_device_mode: cint; other_devices_mode: cint): cint; inline;
+begin
+  XGrabDeviceButton := XGrabDeviceButton(display, device, button, modifiers, modifier_device, grab_window, Ord(owner_events),
+    event_count, event_list, this_device_mode, other_devices_mode);
+end;
+
+function XSendExtensionEvent(display: PDisplay; device: PXDevice;
+  dest: TWindow; prop: Boolean; count: cint; list: PXEventClass; event: PXEvent
+  ): TStatus; inline;
+begin
+  XSendExtensionEvent := XSendExtensionEvent(display, device, dest, Ord(prop), count, list, event);
+end;
+
+function XGetDeviceProperty(dpy: PDisplay; dev: PXDevice; _property: TAtom;
+  offset: clong; length: clong; delete: Boolean; req_type: TAtom;
+  actual_type: PAtom; actual_format: Pcint; nitems: Pculong;
+  bytes_after: Pculong; prop: PPcuchar): TStatus; inline;
+begin
+  XGetDeviceProperty := XGetDeviceProperty(dpy, dev, _property, offset, length, Ord(delete), req_type, actual_type,
+    actual_format, nitems, bytes_after, prop);
+end;
+
+end.
+

+ 730 - 0
packages/x11/src/xinput2.pp

@@ -0,0 +1,730 @@
+(*
+ * Copyright © 2009 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ *)
+
+unit xinput2;
+
+interface
+
+{$PACKRECORDS C}
+
+{ Definitions used by the library and client }
+
+uses
+  ctypes, X, Xlib, XI2, Xge, Xfixes;
+
+
+const
+  libXi = 'Xi';
+
+type
+(*******************************************************************
+ *
+ *)
+  PXIAddMasterInfo = ^TXIAddMasterInfo;
+  TXIAddMasterInfo = record
+    _type: cint;
+    name: PChar;
+    send_core: TBool;
+    enable: TBool;
+  end;
+
+  PXIRemoveMasterInfo = ^TXIRemoveMasterInfo;
+  TXIRemoveMasterInfo = record
+    _type: cint;
+    deviceid: cint;
+    return_mode: cint; { AttachToMaster, Floating }
+    return_pointer: cint;
+    return_keyboard: cint;
+  end;
+
+  PXIAttachSlaveInfo = ^TXIAttachSlaveInfo;
+  TXIAttachSlaveInfo = record
+    _type: cint;
+    deviceid: cint;
+    new_master: cint;
+  end;
+
+  PXIDetachSlaveInfo = ^TXIDetachSlaveInfo;
+  TXIDetachSlaveInfo = record
+    _type: cint;
+    deviceid: cint;
+  end;
+
+  PXIAnyHierarchyChangeInfo = ^TXIAnyHierarchyChangeInfo;
+  TXIAnyHierarchyChangeInfo = record
+    case Integer of
+      0: (_type: cint); { must be first element }
+      1: (add: TXIAddMasterInfo);
+      2: (remove: TXIRemoveMasterInfo);
+      3: (attach: TXIAttachSlaveInfo);
+      4: (detach: TXIDetachSlaveInfo);
+  end;
+
+  PXIModifierState = ^TXIModifierState;
+  TXIModifierState = record
+    base: cint;
+    latched: cint;
+    locked: cint;
+    effective: cint;
+  end;
+
+  PXIGroupState = ^TXIGroupState;
+  TXIGroupState = TXIModifierState;
+
+  PXIButtonState = ^TXIButtonState;
+  TXIButtonState = record
+    mask_len: cint;
+    mask: Pcuchar;
+  end;
+
+  PXIValuatorState = ^TXIValuatorState;
+  TXIValuatorState = record
+    mask_len: cint;
+    mask: Pcuchar;
+    values: Pcdouble;
+  end;
+
+
+  PXIEventMask = ^TXIEventMask;
+  TXIEventMask = record
+    deviceid: cint;
+    mask_len: cint;
+    mask: Pcuchar;
+  end;
+
+  PPXIAnyClassInfo = ^PXIAnyClassInfo;
+  PXIAnyClassInfo = ^TXIAnyClassInfo;
+  TXIAnyClassInfo = record
+    _type: cint;
+    sourceid: cint;
+  end;
+
+  PXIButtonClassInfo = ^TXIButtonClassInfo;
+  TXIButtonClassInfo = record
+    _type: cint;
+    sourceid: cint;
+    num_buttons: cint;
+    labels: PAtom;
+    state: TXIButtonState;
+  end;
+
+  PXIKeyClassInfo = ^TXIKeyClassInfo;
+  TXIKeyClassInfo = record
+    _type: cint;
+    sourceid: cint;
+    num_keycodes: cint;
+    keycodes: Pcint;
+  end;
+
+  PXIValuatorClassInfo = ^TXIValuatorClassInfo;
+  TXIValuatorClassInfo = record
+    _type: cint;
+    sourceid: cint;
+    number: cint;
+    _label: TAtom;
+    min: cdouble;
+    max: cdouble;
+    value: cdouble;
+    resolution: cint;
+    mode: cint;
+  end;
+
+{ new in XI 2.1 }
+  PXIScrollClassInfo = ^TXIScrollClassInfo;
+  TXIScrollClassInfo = record
+    _type: cint;
+    sourceid: cint;
+    number: cint;
+    scroll_type: cint;
+    increment: cdouble;
+    flags: cint;
+  end;
+
+  PXITouchClassInfo = ^TXITouchClassInfo;
+  TXITouchClassInfo = record
+    _type: cint;
+    sourceid: cint;
+    mode: cint;
+    num_touches: cint;
+  end;
+
+  PXIDeviceInfo = ^TXIDeviceInfo;
+  TXIDeviceInfo = record
+    deviceid: cint;
+    name: PChar;
+    use: cint;
+    attachment: cint;
+    enabled: TBool;
+    num_classes: cint;
+    classes: PPXIAnyClassInfo;
+  end;
+
+  PXIGrabModifiers = ^TXIGrabModifiers;
+  TXIGrabModifiers = record
+    modifiers: cint;
+    status: cint;
+  end;
+
+  PBarrierEventID = ^TBarrierEventID;
+  TBarrierEventID = cuint;
+
+  PXIBarrierReleasePointerInfo = ^TXIBarrierReleasePointerInfo;
+  TXIBarrierReleasePointerInfo = record
+    deviceid: cint;
+    barrier: TPointerBarrier;
+    eventid: TBarrierEventID;
+  end;
+
+(**
+ * Generic XI2 event. All XI2 events have the same header.
+ *)
+  PXIEvent = ^TXIEvent;
+  TXIEvent = record
+    _type: cint;                { GenericEvent }
+    serial: culong;             { # of last request processed by server }
+    send_event: TBool;          { true if this came from a SendEvent request }
+    display: PDisplay;          { Display the event was read from }
+    extension: cint;            { XI extension offset }
+    evtype: cint;
+    time: TTime;
+ end;
+
+
+  PXIHierarchyInfo = ^TXIHierarchyInfo;
+  TXIHierarchyInfo = record
+    deviceid: cint;
+    attachment: cint;
+    use: cint;
+    enabled: TBool;
+    flags: cint;
+  end;
+
+(*
+ * Notifies the client that the device hierarchy has been changed. The client
+ * is expected to re-query the server for the device hierarchy.
+ *)
+  PXIHierarchyEvent = ^TXIHierarchyEvent;
+  TXIHierarchyEvent = record
+    _type: cint;                { GenericEvent }
+    serial: culong;             { # of last request processed by server }
+    send_event: TBool;          { true if this came from a SendEvent request }
+    display: PDisplay;          { Display the event was read from }
+    extension: cint;            { XI extension offset }
+    evtype: cint;               { XI_HierarchyChanged }
+    time: TTime;
+    flags: cint;
+    num_info: cint;
+    info: PXIHierarchyInfo;
+  end;
+
+(*
+ * Notifies the client that the classes have been changed. This happens when
+ * the slave device that sends through the master changes.
+ *)
+  PXIDeviceChangedEvent = ^TXIDeviceChangedEvent;
+  TXIDeviceChangedEvent = record
+    _type: cint;                { GenericEvent }
+    serial: culong;             { # of last request processed by server }
+    send_event: TBool;          { true if this came from a SendEvent request }
+    display: PDisplay;          { Display the event was read from }
+    extension: cint;            { XI extension offset }
+    evtype: cint;               { XI_DeviceChanged }
+    time: TTime;
+    deviceid: cint;             { id of the device that changed }
+    sourceid: cint;             { Source for the new classes. }
+    reason: cint;               { Reason for the change }
+    num_classes: cint;
+    classes: PPXIAnyClassInfo;  { same as in XIDeviceInfo }
+  end;
+
+  PXIDeviceEvent = ^TXIDeviceEvent;
+  TXIDeviceEvent = record
+    _type: cint;                { GenericEvent }
+    serial: culong;             { # of last request processed by server }
+    send_event: TBool;          { true if this came from a SendEvent request }
+    display: PDisplay;          { Display the event was read from }
+    extension: cint;            { XI extension offset }
+    evtype: cint;
+    time: TTime;
+    deviceid: cint;
+    sourceid: cint;
+    detail: cint;
+    root: TWindow;
+    event: TWindow;
+    child: TWindow;
+    root_x: cdouble;
+    root_y: cdouble;
+    event_x: cdouble;
+    event_y: cdouble;
+    flags: cint;
+    buttons: TXIButtonState;
+    valuators: TXIValuatorState;
+    mods: TXIModifierState;
+    group: TXIGroupState;
+  end;
+
+  PXIRawEvent = ^TXIRawEvent;
+  TXIRawEvent = record
+    _type: cint;                { GenericEvent }
+    serial: culong;             { # of last request processed by server }
+    send_event: TBool;          { true if this came from a SendEvent request }
+    display: PDisplay;          { Display the event was read from }
+    extension: cint;            { XI extension offset }
+    evtype: cint;               { XI_RawKeyPress, XI_RawKeyRelease, etc. }
+    time: TTime;
+    deviceid: cint;
+    sourceid: cint;             { Bug: Always 0. https://bugs.freedesktop.org//show_bug.cgi?id=34240 }
+    detail: cint;
+    flags: cint;
+    valuators: TXIValuatorState;
+    raw_values: Pcdouble;
+  end;
+
+  PXIEnterEvent = ^TXIEnterEvent;
+  TXIEnterEvent = record
+    _type: cint;                { GenericEvent }
+    serial: culong;             { # of last request processed by server }
+    send_event: TBool;          { true if this came from a SendEvent request }
+    display: PDisplay;          { Display the event was read from }
+    extension: cint;            { XI extension offset }
+    evtype: cint;
+    time: TTime;
+    deviceid: cint;
+    sourceid: cint;
+    detail: cint;
+    root: TWindow;
+    event: TWindow;
+    child: TWindow;
+    root_x: cdouble;
+    root_y: cdouble;
+    event_x: cdouble;
+    event_y: cdouble;
+    mode: cint;
+    focus: TBool;
+    same_screen: TBool;
+    buttons: TXIButtonState;
+    mods: TXIModifierState;
+    group: TXIGroupState;
+  end;
+
+  PXILeaveEvent = ^TXILeaveEvent;
+  TXILeaveEvent = TXIEnterEvent;
+  PXIFocusInEvent = ^TXIFocusInEvent;
+  TXIFocusInEvent = TXIEnterEvent;
+  PXIFocusOutEvent = ^TXIFocusOutEvent;
+  TXIFocusOutEvent = TXIEnterEvent;
+
+  PXIPropertyEvent = ^TXIPropertyEvent;
+  TXIPropertyEvent = record
+    _type: cint;                { GenericEvent }
+    serial: culong;             { # of last request processed by server }
+    send_event: TBool;          { true if this came from a SendEvent request }
+    display: PDisplay;          { Display the event was read from }
+    extension: cint;            { XI extension offset }
+    evtype: cint;               { XI_PropertyEvent }
+    time: TTime;
+    deviceid: cint;             { id of the device that changed }
+    _property: TAtom;
+    what: cint;
+  end;
+
+  PXITouchOwnershipEvent = ^TXITouchOwnershipEvent;
+  TXITouchOwnershipEvent = record
+    _type: cint;                { GenericEvent }
+    serial: culong;             { # of last request processed by server }
+    send_event: TBool;          { true if this came from a SendEvent request }
+    display: PDisplay;          { Display the event was read from }
+    extension: cint;            { XI extension offset }
+    evtype: cint;
+    time: TTime;
+    deviceid: cint;
+    sourceid: cint;
+    touchid: cuint;
+    root: TWindow;
+    event: TWindow;
+    child: TWindow;
+    flags: cint;
+  end;
+
+  PXIBarrierEvent = ^TXIBarrierEvent;
+  TXIBarrierEvent = record
+    _type: cint;                { GenericEvent }
+    serial: culong;             { # of last request processed by server }
+    send_event: TBool;          { true if this came from a SendEvent request }
+    display: PDisplay;          { Display the event was read from }
+    extension: cint;            { XI extension offset }
+    evtype: cint;
+    time: TTime;
+    deviceid: cint;
+    sourceid: cint;
+    event: TWindow;
+    root: TWindow;
+    root_x: cdouble;
+    root_y: cdouble;
+    dx: cdouble;
+    dy: cdouble;
+    dtime: cint;
+    flags: cint;
+    barrier: TPointerBarrier;
+    eventid: TBarrierEventID;
+  end;
+
+//_XFUNCPROTOBEGIN
+
+function XIQueryPointer(
+    display: PDisplay;
+    deviceid: cint;
+    win: TWindow;
+    root: PWindow;
+    child: PWindow;
+    root_x: Pcdouble;
+    root_y: Pcdouble;
+    win_x: Pcdouble;
+    win_y: Pcdouble;
+    buttons: PXIButtonState;
+    mods: PXIModifierState;
+    group: PXIGroupState
+): TBoolResult; cdecl; external libXi;
+
+function XIWarpPointer(
+    display: PDisplay;
+    deviceid: cint;
+    src_win: TWindow;
+    dst_win: TWindow;
+    src_x: cdouble;
+    src_y: cdouble;
+    src_width: cuint;
+    src_height: cuint;
+    dst_x: cdouble;
+    dst_y: cdouble
+): TBoolResult; cdecl; external libXi;
+
+function XIDefineCursor(
+    display: PDisplay;
+    deviceid: cint;
+    win: TWindow;
+    cursor: TCursor
+): TStatus; cdecl; external libXi;
+
+function XIUndefineCursor(
+    display: PDisplay;
+    deviceid: cint;
+    win: TWindow
+): TStatus; cdecl; external libXi;
+
+function XIChangeHierarchy(
+    display: PDisplay;
+    changes: PXIAnyHierarchyChangeInfo;
+    num_changes: cint
+): TStatus; cdecl; external libXi;
+
+function XISetClientPointer(
+    dpy: PDisplay;
+    win: TWindow;
+    deviceid: cint
+): TStatus; cdecl; external libXi;
+
+function XIGetClientPointer(
+    dpy: PDisplay;
+    win: TWindow;
+    deviceid: Pcint
+): TBoolResult; cdecl; external libXi;
+
+function XISelectEvents(
+    dpy: PDisplay;
+    win: TWindow;
+    masks: PXIEventMask;
+    num_masks: cint
+): cint; cdecl; external libXi;
+
+function XIGetSelectedEvents(
+    dpy: PDisplay;
+    win: TWindow;
+    num_masks_return: Pcint
+): PXIEventMask; cdecl; external libXi;
+
+function XIQueryVersion(
+    dpy: PDisplay;
+    major_version_inout: Pcint;
+    minor_version_inout: Pcint
+): TStatus; cdecl; external libXi;
+
+function XIQueryDevice(
+    dpy: PDisplay;
+    deviceid: cint;
+    ndevices_return: Pcint
+): PXIDeviceInfo; cdecl; external libXi;
+
+function XISetFocus(
+    dpy: PDisplay;
+    deviceid: cint;
+    focus: TWindow;
+    time: TTime
+): TStatus; cdecl; external libXi;
+
+function XIGetFocus(
+    dpy: PDisplay;
+    deviceid: cint;
+    focus_return: PWindow): TStatus; cdecl; external libXi;
+
+function XIGrabDevice(
+    dpy: PDisplay;
+    deviceid: cint;
+    grab_window: TWindow;
+    time: TTime;
+    cursor: TCursor;
+    grab_mode: cint;
+    paired_device_mode: cint;
+    owner_events: TBool;
+    mask: PXIEventMask
+): TStatus; cdecl; external libXi;
+
+{ boolean overload for the TBool parameter }
+function XIGrabDevice(
+    dpy: PDisplay;
+    deviceid: cint;
+    grab_window: TWindow;
+    time: TTime;
+    cursor: TCursor;
+    grab_mode: cint;
+    paired_device_mode: cint;
+    owner_events: Boolean;
+    mask: PXIEventMask
+): TStatus; inline;
+
+function XIUngrabDevice(
+    dpy: PDisplay;
+    deviceid: cint;
+    time: TTime
+): TStatus; cdecl; external libXi;
+
+function XIAllowEvents(
+    display: PDisplay;
+    deviceid: cint;
+    event_mode: cint;
+    time: TTime
+): TStatus; cdecl; external libXi;
+
+function XIAllowTouchEvents(
+    display: PDisplay;
+    deviceid: cint;
+    touchid: cuint;
+    grab_window: TWindow;
+    event_mode: cint
+): TStatus; cdecl; external libXi;
+
+function XIGrabButton(
+    display: PDisplay;
+    deviceid: cint;
+    button: cint;
+    grab_window: TWindow;
+    cursor: TCursor;
+    grab_mode: cint;
+    paired_device_mode: cint;
+    owner_events: cint;
+    mask: PXIEventMask;
+    num_modifiers: cint;
+    modifiers_inout: PXIGrabModifiers
+): cint; cdecl; external libXi;
+
+function XIGrabKeycode(
+    display: PDisplay;
+    deviceid: cint;
+    keycode: cint;
+    grab_window: TWindow;
+    grab_mode: cint;
+    paired_device_mode: cint;
+    owner_events: cint;
+    mask: PXIEventMask;
+    num_modifiers: cint;
+    modifiers_inout: PXIGrabModifiers
+): cint; cdecl; external libXi;
+
+function XIGrabEnter(
+    display: PDisplay;
+    deviceid: cint;
+    grab_window: TWindow;
+    cursor: TCursor;
+    grab_mode: cint;
+    paired_device_mode: cint;
+    owner_events: cint;
+    mask: PXIEventMask;
+    num_modifiers: cint;
+    modifiers_inout: PXIGrabModifiers
+): cint; cdecl; external libXi;
+
+function XIGrabFocusIn(
+    display: PDisplay;
+    deviceid: cint;
+    grab_window: TWindow;
+    grab_mode: cint;
+    paired_device_mode: cint;
+    owner_events: cint;
+    mask: PXIEventMask;
+    num_modifiers: cint;
+    modifiers_inout: PXIGrabModifiers
+): cint; cdecl; external libXi;
+
+function XIGrabTouchBegin(
+    display: PDisplay;
+    deviceid: cint;
+    grab_window: TWindow;
+    owner_events: cint;
+    mask: PXIEventMask;
+    num_modifiers: cint;
+    modifiers_inout: PXIGrabModifiers
+): cint; cdecl; external libXi;
+
+function XIUngrabButton(
+    display: PDisplay;
+    deviceid: cint;
+    button: cint;
+    grab_window: TWindow;
+    num_modifiers: cint;
+    modifiers: PXIGrabModifiers
+): TStatus; cdecl; external libXi;
+
+function XIUngrabKeycode(
+    display: PDisplay;
+    deviceid: cint;
+    keycode: cint;
+    grab_window: TWindow;
+    num_modifiers: cint;
+    modifiers: PXIGrabModifiers
+): TStatus; cdecl; external libXi;
+
+function XIUngrabEnter(
+    display: PDisplay;
+    deviceid: cint;
+    grab_window: TWindow;
+    num_modifiers: cint;
+    modifiers: PXIGrabModifiers
+): TStatus; cdecl; external libXi;
+
+function XIUngrabFocusIn(
+    display: PDisplay;
+    deviceid: cint;
+    grab_window: TWindow;
+    num_modifiers: cint;
+    modifiers: PXIGrabModifiers
+): TStatus; cdecl; external libXi;
+
+function XIUngrabTouchBegin(
+    display: PDisplay;
+    deviceid: cint;
+    grab_window: TWindow;
+    num_modifiers: cint;
+    modifiers: PXIGrabModifiers
+): TStatus; cdecl; external libXi;
+
+function XIListProperties(
+    display: PDisplay;
+    deviceid: cint;
+    num_props_return: Pcint
+): PAtom; cdecl; external libXi;
+
+procedure XIChangeProperty(
+    display: PDisplay;
+    deviceid: cint;
+    _property: TAtom;
+    _type: TAtom;
+    format: cint;
+    mode: cint;
+    data: Pcuchar;
+    num_items: cint
+); cdecl; external libXi;
+
+procedure XIDeleteProperty(
+    display: PDisplay;
+    deviceid: cint;
+    _property: TAtom
+); cdecl; external libXi;
+
+function XIGetProperty(
+    display: PDisplay;
+    deviceid: cint;
+    _property: TAtom;
+    offset: clong;
+    length: clong;
+    delete_property: TBool;
+    _type: TAtom;
+    type_return: PAtom;
+    format_return: Pcint;
+    num_items_return: Pculong;
+    bytes_after_return: Pculong;
+    data: PPcuchar
+): TStatus; cdecl; external libXi;
+
+{ boolean overload for the TBool parameter }
+function XIGetProperty(
+    display: PDisplay;
+    deviceid: cint;
+    _property: TAtom;
+    offset: clong;
+    length: clong;
+    delete_property: Boolean;
+    _type: TAtom;
+    type_return: PAtom;
+    format_return: Pcint;
+    num_items_return: Pculong;
+    bytes_after_return: Pculong;
+    data: PPcuchar
+): TStatus; inline;
+
+procedure XIBarrierReleasePointers(
+    display: PDisplay;
+    barriers: PXIBarrierReleasePointerInfo;
+    num_barriers: cint
+); cdecl; external libXi;
+
+procedure XIBarrierReleasePointer(
+    display: PDisplay;
+    deviceid: cint;
+    barrier: TPointerBarrier;
+    eventid: TBarrierEventID
+); cdecl; external libXi;
+
+procedure XIFreeDeviceInfo(info: PXIDeviceInfo); cdecl; external libXi;
+
+//_XFUNCPROTOEND
+
+implementation
+
+function XIGrabDevice(dpy: PDisplay; deviceid: cint; grab_window: TWindow;
+  time: TTime; cursor: TCursor; grab_mode: cint; paired_device_mode: cint;
+  owner_events: Boolean; mask: PXIEventMask): TStatus; inline;
+begin
+  XIGrabDevice := XIGrabDevice(dpy, deviceid, grab_window, time, cursor, grab_mode, paired_device_mode, Ord(owner_events), mask);
+end;
+
+function XIGetProperty(display: PDisplay; deviceid: cint; _property: TAtom;
+  offset: clong; length: clong; delete_property: Boolean; _type: TAtom;
+  type_return: PAtom; format_return: Pcint; num_items_return: Pculong;
+  bytes_after_return: Pculong; data: PPcuchar): TStatus;
+begin
+  XIGetProperty := XIGetProperty(display, deviceid, _property, offset, length, Ord(delete_property), _type, type_return, format_return,
+    num_items_return, bytes_after_return, data);
+end;
+
+end.

+ 40 - 1
packages/x11/src/xlib.pp

@@ -802,6 +802,33 @@ type
         window : TWindow;
         window : TWindow;
      end;
      end;
 
 
+   (***************************************************************
+    *
+    * GenericEvent.  This event is the standard event for all newer extensions.
+    *)
+
+   PXGenericEvent = ^TXGenericEvent;
+   TXGenericEvent = record
+        _type: cint;                 { of event. Always GenericEvent }
+        serial: culong;              { # of last request processed }
+        send_event: TBool;           { true if from SendEvent request }
+        display: PDisplay;           { Display the event was read from }
+        extension: cint;             { major opcode of extension that caused the event }
+        evtype: cint;                { actual event type. }
+     end;
+
+   PXGenericEventCookie = ^TXGenericEventCookie;
+   TXGenericEventCookie = record
+        _type: cint;                 { of event. Always GenericEvent }
+        serial: culong;              { # of last request processed }
+        send_event: TBool;           { true if from SendEvent request }
+        display: PDisplay;           { Display the event was read from }
+        extension: cint;             { major opcode of extension that caused the event }
+        evtype: cint;                { actual event type. }
+        cookie: cuint;
+        data: pointer;
+     end;
+
    PXEvent = ^TXEvent;
    PXEvent = ^TXEvent;
    TXEvent = record
    TXEvent = record
        case longint of
        case longint of
@@ -837,7 +864,9 @@ type
           29 : ( xmapping : TXMappingEvent );
           29 : ( xmapping : TXMappingEvent );
           30 : ( xerror : TXErrorEvent );
           30 : ( xerror : TXErrorEvent );
           31 : ( xkeymap : TXKeymapEvent );
           31 : ( xkeymap : TXKeymapEvent );
-          32 : ( pad : array[0..23] of clong );
+          32 : ( xgeneric : TXGenericEvent );
+          33 : ( xcookie : TXGenericEventCookie );
+          34 : ( pad : array[0..23] of clong );
        end;
        end;
 
 
 type
 type
@@ -1767,6 +1796,16 @@ procedure XSetAuthorization(para1:Pchar; para2:cint; para3:Pchar; para4:cint);cd
   _Xwctomb?
   _Xwctomb?
 }
 }
 
 
+function XGetEventData(
+    dpy: PDisplay;
+    cookie: PXGenericEventCookie
+): TBoolResult;cdecl;external libX11;
+
+procedure XFreeEventData(
+    dpy: PDisplay;
+    cookie: PXGenericEventCookie
+);cdecl;external libX11;
+
 {$ifdef MACROS}
 {$ifdef MACROS}
 function ConnectionNumber(dpy : PDisplay) : cint;
 function ConnectionNumber(dpy : PDisplay) : cint;
 function RootWindow(dpy : PDisplay; scr : cint) : TWindow;
 function RootWindow(dpy : PDisplay; scr : cint) : TWindow;

+ 41 - 0
packages/x11/tests/xfixes_linktest.pp

@@ -0,0 +1,41 @@
+{ this program just links all externals, declared in the xfixes unit }
+program xfixes_linktest;
+uses
+  xfixes;
+begin
+  halt(0);
+  XFixesQueryExtension(nil, nil, nil);
+  XFixesQueryVersion(nil, nil, nil);
+  XFixesVersion;
+  XFixesSelectSelectionInput(nil, 0, 0, 0);
+  XFixesSelectCursorInput(nil, 0, 0);
+  XFixesGetCursorImage(nil);
+  XFixesCreateRegion(nil, nil, 0);
+  XFixesCreateRegionFromBitmap(nil, 0);
+  XFixesCreateRegionFromWindow(nil, 0, 0);
+  XFixesCreateRegionFromGC(nil, nil);
+  XFixesCreateRegionFromPicture(nil, 0);
+  XFixesDestroyRegion(nil, 0);
+  XFixesSetRegion(nil, 0, nil, 0);
+  XFixesCopyRegion(nil, 0, 0);
+  XFixesUnionRegion(nil, 0, 0, 0);
+  XFixesIntersectRegion(nil, 0, 0, 0);
+  XFixesSubtractRegion(nil, 0, 0, 0);
+  XFixesInvertRegion(nil, 0, nil, 0);
+  XFixesTranslateRegion(nil, 0, 0, 0);
+  XFixesRegionExtents(nil, 0, 0);
+  XFixesFetchRegion(nil, 0, nil);
+  XFixesFetchRegionAndBounds(nil, 0, nil, nil);
+  XFixesSetGCClipRegion(nil, nil, 0, 0, 0);
+  XFixesSetWindowShapeRegion(nil, 0, 0, 0, 0, 0);
+  XFixesSetPictureClipRegion(nil, 0, 0, 0, 0);
+  XFixesSetCursorName(nil, 0, nil);
+  XFixesGetCursorName(nil, 0, nil);
+  XFixesChangeCursor(nil, 0, 0);
+  XFixesChangeCursorByName(nil, 0, nil);
+  XFixesExpandRegion(nil, 0, 0, 0, 0, 0, 0);
+  XFixesHideCursor(nil, 0);
+  XFixesShowCursor(nil, 0);
+  XFixesCreatePointerBarrier(nil, 0, 0, 0, 0, 0, 0, 0, nil);
+  XFixesDestroyPointerBarrier(nil, 0);
+end.

+ 9 - 0
packages/x11/tests/xge_linktest.pp

@@ -0,0 +1,9 @@
+{ this program just links all externals, declared in the xge unit }
+program xge_linktest;
+uses
+  xge;
+begin
+  halt(0);
+  XGEQueryExtension(nil, nil, nil);
+  XGEQueryVersion(nil, nil, nil);
+end.

+ 41 - 0
packages/x11/tests/xinput2_linktest.pp

@@ -0,0 +1,41 @@
+{ this program just links all externals, declared in the xinput2 unit }
+program xinput2_linktest;
+uses
+  xinput2;
+begin
+  halt(0);
+  XIQueryPointer(nil, 0, 0, nil, nil, nil, nil, nil, nil, nil, nil, nil);
+  XIWarpPointer(nil, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+  XIDefineCursor(nil, 0, 0, 0);
+  XIUndefineCursor(nil, 0, 0);
+  XIChangeHierarchy(nil, nil, 0);
+  XISetClientPointer(nil, 0, 0);
+  XIGetClientPointer(nil, 0, nil);
+  XISelectEvents(nil, 0, nil, 0);
+  XIGetSelectedEvents(nil, 0, nil);
+  XIQueryVersion(nil, nil, nil);
+  XIQueryDevice(nil, 0, nil);
+  XISetFocus(nil, 0, 0, 0);
+  XIGetFocus(nil, 0, nil);
+  XIGrabDevice(nil, 0, 0, 0, 0, 0, 0, 0, nil);
+  XIUngrabDevice(nil, 0, 0);
+  XIAllowEvents(nil, 0, 0, 0);
+  XIAllowTouchEvents(nil, 0, 0, 0, 0);
+  XIGrabButton(nil, 0, 0, 0, 0, 0, 0, 0, nil, 0, nil);
+  XIGrabKeycode(nil, 0, 0, 0, 0, 0, 0, nil, 0, nil);
+  XIGrabEnter(nil, 0, 0, 0, 0, 0, 0, nil, 0, nil);
+  XIGrabFocusIn(nil, 0, 0, 0, 0, 0, nil, 0, nil);
+  XIGrabTouchBegin(nil, 0, 0, 0, nil, 0, nil);
+  XIUngrabButton(nil, 0, 0, 0, 0, nil);
+  XIUngrabKeycode(nil, 0, 0, 0, 0, nil);
+  XIUngrabEnter(nil, 0, 0, 0, nil);
+  XIUngrabFocusIn(nil, 0, 0, 0, nil);
+  XIUngrabTouchBegin(nil, 0, 0, 0, nil);
+  XIListProperties(nil, 0, nil);
+  XIChangeProperty(nil, 0, 0, 0, 0, 0, nil, 0);
+  XIDeleteProperty(nil, 0, 0);
+  XIGetProperty(nil, 0, 0, 0, 0, 0, 0, nil, nil, nil, nil, nil);
+  XIBarrierReleasePointers(nil, nil, 0);
+  XIBarrierReleasePointer(nil, 0, 0, 0);
+  XIFreeDeviceInfo(nil);
+end.

+ 57 - 0
packages/x11/tests/xinput_linktest.pp

@@ -0,0 +1,57 @@
+{ this program just links all externals, declared in the xinput unit }
+program xinput_linktest;
+uses
+  xinput;
+begin
+  halt(0);
+  _XiGetDevicePresenceNotifyEvent(nil);
+  _xibaddevice(nil, nil);
+  _xibadclass(nil, nil);
+  _xibadevent(nil, nil);
+  _xibadmode(nil, nil);
+  _xidevicebusy(nil, nil);
+  XChangeKeyboardDevice(nil, nil);
+  XChangePointerDevice(nil, nil, 0, 0);
+  XGrabDevice(nil, nil, 0, 0, 0, nil, 0, 0, 0);
+  XUngrabDevice(nil, nil, 0);
+  XGrabDeviceKey(nil, nil, 0, 0, nil, 0, 0, 0, nil, 0, 0);
+  XUngrabDeviceKey(nil, nil, 0, 0, nil, 0);
+  XGrabDeviceButton(nil, nil, 0, 0, nil, 0, 0, 0, nil, 0, 0);
+  XUngrabDeviceButton(nil, nil, 0, 0, nil, 0);
+  XAllowDeviceEvents(nil, nil, 0, 0);
+  XGetDeviceFocus(nil, nil, nil, nil, nil);
+  XSetDeviceFocus(nil, nil, 0, 0, 0);
+  XGetFeedbackControl(nil, nil, nil);
+  XFreeFeedbackList(nil);
+  XChangeFeedbackControl(nil, nil, 0, nil);
+  XDeviceBell(nil, nil, 0, 0, 0);
+  XGetDeviceKeyMapping(nil, nil, 0, 0, nil);
+  XChangeDeviceKeyMapping(nil, nil, 0, 0, nil, 0);
+  XGetDeviceModifierMapping(nil, nil);
+  XSetDeviceModifierMapping(nil, nil, nil);
+  XSetDeviceButtonMapping(nil, nil, nil, 0);
+  XGetDeviceButtonMapping(nil, nil, nil, 0);
+  XQueryDeviceState(nil, nil);
+  XFreeDeviceState(nil);
+  XGetExtensionVersion(nil, nil);
+  XListInputDevices(nil, nil);
+  XFreeDeviceList(nil);
+  XOpenDevice(nil, 0);
+  XCloseDevice(nil, nil);
+  XSetDeviceMode(nil, nil, 0);
+  XSetDeviceValuators(nil, nil, nil, 0, 0);
+  XGetDeviceControl(nil, nil, 0);
+  XChangeDeviceControl(nil, nil, 0, nil);
+  XSelectExtensionEvent(nil, 0, nil, 0);
+  XGetSelectedExtensionEvents(nil, 0, nil, nil, nil, nil);
+  XChangeDeviceDontPropagateList(nil, 0, 0, nil, 0);
+  XGetDeviceDontPropagateList(nil, 0, nil);
+  XSendExtensionEvent(nil, nil, 0, 0, 0, nil, nil);
+  XGetDeviceMotionEvents(nil, nil, 0, 0, nil, nil, nil);
+  XFreeDeviceMotionEvents(nil);
+  XFreeDeviceControl(nil);
+  XListDeviceProperties(nil, nil, nil);
+  XChangeDeviceProperty(nil, nil, 0, 0, 0, 0, nil, 0);
+  XDeleteDeviceProperty(nil, nil, 0);
+  XGetDeviceProperty(nil, nil, 0, 0, 0, 0, 0, nil, nil, nil, nil, nil);
+end.