Browse Source

* X11 moved

git-svn-id: trunk@9963 -
marco 17 years ago
parent
commit
05b92aa557

+ 24 - 0
.gitattributes

@@ -4674,6 +4674,30 @@ packages/winunits-jedi/src/jwawsrm.pas svneol=native#text/plain
 packages/winunits-jedi/src/jwawsvns.pas svneol=native#text/plain
 packages/winunits-jedi/src/jwawtsapi32.pas svneol=native#text/plain
 packages/winunits-jedi/src/jwazmouse.pas svneol=native#text/plain
+packages/x11/Makefile svneol=native#text/plain
+packages/x11/Makefile.fpc svneol=native#text/plain
+packages/x11/fpmake.pp svneol=native#text/plain
+packages/x11/src/cursorfont.pp svneol=native#text/plain
+packages/x11/src/keysym.pp svneol=native#text/plain
+packages/x11/src/randr.inc svneol=native#text/plain
+packages/x11/src/x.pp svneol=native#text/plain
+packages/x11/src/xatom.pp svneol=native#text/plain
+packages/x11/src/xcms.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/xf86vmode.pp svneol=native#text/plain
+packages/x11/src/xi.pp svneol=native#text/plain
+packages/x11/src/xinerama.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/xlib.pp svneol=native#text/plain
+packages/x11/src/xrandr.pp svneol=native#text/plain
+packages/x11/src/xrender.pp svneol=native#text/plain
+packages/x11/src/xresource.pp svneol=native#text/plain
+packages/x11/src/xshm.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/xvlib.pp svneol=native#text/plain
 packages/zlib/Makefile svneol=native#text/plain
 packages/zlib/Makefile.fpc svneol=native#text/plain
 packages/zlib/fpmake.pp svneol=native#text/plain

+ 93 - 24
packages/Makefile

@@ -241,7 +241,7 @@ UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
 endif
 PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng  libc  unixutil
+override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11  libc  unixutil
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
@@ -250,19 +250,19 @@ ifeq ($(FULL_TARGET),i386-win32)
 override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  winunits-base winunits-jedi fcl-web ibase mysql zlib oracle odbc postgres sqlite imagemagick gdbint libpng
 endif
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  zlib libpng
+override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  zlib libpng x11
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng
+override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng
+override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng
+override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
 override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
@@ -271,16 +271,16 @@ ifeq ($(FULL_TARGET),i386-netware)
 override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  zlib
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc  postgres sqlite pthreads imagemagick gdbint libpng
+override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc  postgres sqlite pthreads imagemagick gdbint libpng x11
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng
+override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11
 endif
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  zlib  libpng
+override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  zlib  libpng x11
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
 override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
@@ -298,13 +298,13 @@ ifeq ($(FULL_TARGET),i386-symbian)
 override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng
+override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng
+override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng
+override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
 override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
@@ -313,7 +313,7 @@ ifeq ($(FULL_TARGET),m68k-atari)
 override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc  postgres sqlite pthreads imagemagick gdbint libpng
+override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc  postgres sqlite pthreads imagemagick gdbint libpng x11
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
@@ -322,10 +322,10 @@ ifeq ($(FULL_TARGET),m68k-embedded)
 override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng
+override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng
+override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
 override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
@@ -334,7 +334,7 @@ ifeq ($(FULL_TARGET),powerpc-macos)
 override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng
+override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
@@ -343,25 +343,25 @@ ifeq ($(FULL_TARGET),powerpc-embedded)
 override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng
+override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng
+override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng
+override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
 override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng
+override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng
+override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11
 endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
-override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng
+override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  winunits-base winunits-jedi fcl-web ibase mysql zlib oracle odbc postgres sqlite imagemagick gdbint
@@ -370,7 +370,7 @@ ifeq ($(FULL_TARGET),x86_64-embedded)
 override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
 endif
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng
+override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
 override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
@@ -391,10 +391,10 @@ ifeq ($(FULL_TARGET),arm-symbian)
 override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng
+override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
-override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng
+override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr  fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 override TARGET_DIRS+=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
@@ -1514,6 +1514,7 @@ TARGET_DIRS_PTHREADS=1
 TARGET_DIRS_IMAGEMAGICK=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBPNG=1
+TARGET_DIRS_X11=1
 TARGET_DIRS_LIBC=1
 TARGET_DIRS_UNIXUTIL=1
 endif
@@ -1594,6 +1595,7 @@ TARGET_DIRS_UNZIP=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_ZLIB=1
 TARGET_DIRS_LIBPNG=1
+TARGET_DIRS_X11=1
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 TARGET_DIRS_BASE=1
@@ -1629,6 +1631,7 @@ TARGET_DIRS_PTHREADS=1
 TARGET_DIRS_IMAGEMAGICK=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBPNG=1
+TARGET_DIRS_X11=1
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 TARGET_DIRS_BASE=1
@@ -1685,6 +1688,7 @@ TARGET_DIRS_PTHREADS=1
 TARGET_DIRS_IMAGEMAGICK=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBPNG=1
+TARGET_DIRS_X11=1
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
 TARGET_DIRS_BASE=1
@@ -1720,6 +1724,7 @@ TARGET_DIRS_PTHREADS=1
 TARGET_DIRS_IMAGEMAGICK=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBPNG=1
+TARGET_DIRS_X11=1
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
 TARGET_DIRS_BASE=1
@@ -1798,6 +1803,7 @@ TARGET_DIRS_PTHREADS=1
 TARGET_DIRS_IMAGEMAGICK=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBPNG=1
+TARGET_DIRS_X11=1
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 TARGET_DIRS_BASE=1
@@ -1854,6 +1860,7 @@ TARGET_DIRS_PTHREADS=1
 TARGET_DIRS_IMAGEMAGICK=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBPNG=1
+TARGET_DIRS_X11=1
 endif
 ifeq ($(FULL_TARGET),i386-emx)
 TARGET_DIRS_BASE=1
@@ -1877,6 +1884,7 @@ TARGET_DIRS_UNZIP=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_ZLIB=1
 TARGET_DIRS_LIBPNG=1
+TARGET_DIRS_X11=1
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
 TARGET_DIRS_BASE=1
@@ -2023,6 +2031,7 @@ TARGET_DIRS_PTHREADS=1
 TARGET_DIRS_IMAGEMAGICK=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBPNG=1
+TARGET_DIRS_X11=1
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 TARGET_DIRS_BASE=1
@@ -2058,6 +2067,7 @@ TARGET_DIRS_PTHREADS=1
 TARGET_DIRS_IMAGEMAGICK=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBPNG=1
+TARGET_DIRS_X11=1
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 TARGET_DIRS_BASE=1
@@ -2093,6 +2103,7 @@ TARGET_DIRS_PTHREADS=1
 TARGET_DIRS_IMAGEMAGICK=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBPNG=1
+TARGET_DIRS_X11=1
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
 TARGET_DIRS_BASE=1
@@ -2170,6 +2181,7 @@ TARGET_DIRS_PTHREADS=1
 TARGET_DIRS_IMAGEMAGICK=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBPNG=1
+TARGET_DIRS_X11=1
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 TARGET_DIRS_BASE=1
@@ -2249,6 +2261,7 @@ TARGET_DIRS_PTHREADS=1
 TARGET_DIRS_IMAGEMAGICK=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBPNG=1
+TARGET_DIRS_X11=1
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 TARGET_DIRS_BASE=1
@@ -2284,6 +2297,7 @@ TARGET_DIRS_PTHREADS=1
 TARGET_DIRS_IMAGEMAGICK=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBPNG=1
+TARGET_DIRS_X11=1
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
 TARGET_DIRS_BASE=1
@@ -2361,6 +2375,7 @@ TARGET_DIRS_PTHREADS=1
 TARGET_DIRS_IMAGEMAGICK=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBPNG=1
+TARGET_DIRS_X11=1
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 TARGET_DIRS_BASE=1
@@ -2440,6 +2455,7 @@ TARGET_DIRS_PTHREADS=1
 TARGET_DIRS_IMAGEMAGICK=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBPNG=1
+TARGET_DIRS_X11=1
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 TARGET_DIRS_BASE=1
@@ -2475,6 +2491,7 @@ TARGET_DIRS_PTHREADS=1
 TARGET_DIRS_IMAGEMAGICK=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBPNG=1
+TARGET_DIRS_X11=1
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 TARGET_DIRS_BASE=1
@@ -2510,6 +2527,7 @@ TARGET_DIRS_PTHREADS=1
 TARGET_DIRS_IMAGEMAGICK=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBPNG=1
+TARGET_DIRS_X11=1
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
 TARGET_DIRS_BASE=1
@@ -2568,6 +2586,7 @@ TARGET_DIRS_PTHREADS=1
 TARGET_DIRS_IMAGEMAGICK=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBPNG=1
+TARGET_DIRS_X11=1
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 TARGET_DIRS_BASE=1
@@ -2603,6 +2622,7 @@ TARGET_DIRS_PTHREADS=1
 TARGET_DIRS_IMAGEMAGICK=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBPNG=1
+TARGET_DIRS_X11=1
 endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
 TARGET_DIRS_BASE=1
@@ -2638,6 +2658,7 @@ TARGET_DIRS_PTHREADS=1
 TARGET_DIRS_IMAGEMAGICK=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBPNG=1
+TARGET_DIRS_X11=1
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 TARGET_DIRS_BASE=1
@@ -2729,6 +2750,7 @@ TARGET_DIRS_PTHREADS=1
 TARGET_DIRS_IMAGEMAGICK=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBPNG=1
+TARGET_DIRS_X11=1
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
 TARGET_DIRS_BASE=1
@@ -2895,6 +2917,7 @@ TARGET_DIRS_PTHREADS=1
 TARGET_DIRS_IMAGEMAGICK=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBPNG=1
+TARGET_DIRS_X11=1
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
 TARGET_DIRS_BASE=1
@@ -2930,6 +2953,7 @@ TARGET_DIRS_PTHREADS=1
 TARGET_DIRS_IMAGEMAGICK=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBPNG=1
+TARGET_DIRS_X11=1
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 TARGET_DIRS_BASE=1
@@ -4482,6 +4506,51 @@ libpng:
 	$(MAKE) -C libpng all
 .PHONY: libpng_all libpng_debug libpng_smart libpng_release libpng_units libpng_examples libpng_shared libpng_install libpng_sourceinstall libpng_exampleinstall libpng_distinstall libpng_zipinstall libpng_zipsourceinstall libpng_zipexampleinstall libpng_zipdistinstall libpng_clean libpng_distclean libpng_cleanall libpng_info libpng_makefiles libpng
 endif
+ifdef TARGET_DIRS_X11
+x11_all:
+	$(MAKE) -C x11 all
+x11_debug:
+	$(MAKE) -C x11 debug
+x11_smart:
+	$(MAKE) -C x11 smart
+x11_release:
+	$(MAKE) -C x11 release
+x11_units:
+	$(MAKE) -C x11 units
+x11_examples:
+	$(MAKE) -C x11 examples
+x11_shared:
+	$(MAKE) -C x11 shared
+x11_install:
+	$(MAKE) -C x11 install
+x11_sourceinstall:
+	$(MAKE) -C x11 sourceinstall
+x11_exampleinstall:
+	$(MAKE) -C x11 exampleinstall
+x11_distinstall:
+	$(MAKE) -C x11 distinstall
+x11_zipinstall:
+	$(MAKE) -C x11 zipinstall
+x11_zipsourceinstall:
+	$(MAKE) -C x11 zipsourceinstall
+x11_zipexampleinstall:
+	$(MAKE) -C x11 zipexampleinstall
+x11_zipdistinstall:
+	$(MAKE) -C x11 zipdistinstall
+x11_clean:
+	$(MAKE) -C x11 clean
+x11_distclean:
+	$(MAKE) -C x11 distclean
+x11_cleanall:
+	$(MAKE) -C x11 cleanall
+x11_info:
+	$(MAKE) -C x11 info
+x11_makefiles:
+	$(MAKE) -C x11 makefiles
+x11:
+	$(MAKE) -C x11 all
+.PHONY: x11_all x11_debug x11_smart x11_release x11_units x11_examples x11_shared x11_install x11_sourceinstall x11_exampleinstall x11_distinstall x11_zipinstall x11_zipsourceinstall x11_zipexampleinstall x11_zipdistinstall x11_clean x11_distclean x11_cleanall x11_info x11_makefiles x11
+endif
 ifdef TARGET_DIRS_LIBC
 libc_all:
 	$(MAKE) -C libc all

+ 10 - 10
packages/Makefile.fpc

@@ -4,26 +4,26 @@
 
 [target]
 dirs=base fv hash pasjpeg paszlib fpmkunit fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-xml fcl-fpcunit fcl-json extra fcl-process unzip regexpr
-dirs_linux_i386=libc  unixutil
+dirs_linux_i386=libc  unixutil 
 dirs_freebsd=fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick \
-               gdbint libpng
+               gdbint libpng x11
 dirs_darwin=fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick \
-               gdbint libpng
+               gdbint libpng x11
 dirs_solaris=fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick \
-               gdbint libpng
+               gdbint libpng x11
 dirs_netbsd=fcl-web fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick \
-               gdbint libpng
+               gdbint libpng x11
 dirs_openbsd=fcl-web fcl-async ibase mysql ncurses zlib oracle odbc  postgres sqlite pthreads imagemagick \
-               gdbint libpng
+               gdbint libpng x11
 dirs_linux=fcl-web fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick \
-               gdbint libpng
+               gdbint libpng x11
 dirs_win32=winunits-base winunits-jedi fcl-web ibase mysql zlib oracle odbc postgres sqlite imagemagick \
-               gdbint libpng
+               gdbint libpng 
 dirs_win64=winunits-base winunits-jedi fcl-web ibase mysql zlib oracle odbc postgres sqlite imagemagick \
                gdbint 
 dirs_wince=fcl-web ibase mysql
-dirs_os2=zlib libpng
-dirs_emx=zlib  libpng
+dirs_os2=zlib libpng x11
+dirs_emx=zlib  libpng x11
 dirs_netware=zlib
 dirs_netwlibc= zlib
 

+ 24 - 93
packages/extra/Makefile

@@ -241,7 +241,7 @@ UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
 endif
 PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_DIRS+=chm  fftw x11 opengl gtk gtk2 syslog forms svgalib ggi  libgd utmp bfd gdbm  tcl cdrom imlib gnome1 fpgtk newt uuid ldap openal mad oggvorbis a52 modplug dts openssl pcap libcurl cairo aspell lua sdl graph
+override TARGET_DIRS+=chm  fftw opengl gtk gtk2 syslog forms svgalib ggi  libgd utmp bfd gdbm  tcl cdrom imlib gnome1 fpgtk newt uuid ldap openal mad oggvorbis a52 modplug dts openssl pcap libcurl cairo aspell lua sdl graph
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 override TARGET_DIRS+=chm  graph
@@ -250,19 +250,19 @@ ifeq ($(FULL_TARGET),i386-win32)
 override TARGET_DIRS+=chm  opengl gtk gtk2 tcl cdrom fpgtk fftw mad openal oggvorbis a52  openssl pcap sdl lua graph
 endif
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_DIRS+=chm  os2units rexx x11 gtk tcl imlib fpgtk
+override TARGET_DIRS+=chm  os2units rexx gtk tcl imlib fpgtk
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_DIRS+=chm  fftw x11 opengl gtk gtk2 syslog forms svgalib ggi  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl pcap libcurl cairo sdl graph aspell
+override TARGET_DIRS+=chm  fftw opengl gtk gtk2 syslog forms svgalib ggi  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl pcap libcurl cairo sdl graph aspell
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 override TARGET_DIRS+=chm  graph
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_DIRS+=chm  x11 opengl gtk syslog forms svgalib ggi  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl pcap libcurl cairo aspell
+override TARGET_DIRS+=chm  opengl gtk syslog forms svgalib ggi  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl pcap libcurl cairo aspell
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_DIRS+=chm  fftw x11 opengl gtk gtk2 syslog forms svgalib ggi  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl pcap libcurl cairo
+override TARGET_DIRS+=chm  fftw opengl gtk gtk2 syslog forms svgalib ggi  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl pcap libcurl cairo
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
 override TARGET_DIRS+=chm
@@ -271,16 +271,16 @@ ifeq ($(FULL_TARGET),i386-netware)
 override TARGET_DIRS+=chm
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_DIRS+=chm  x11 opengl gtk syslog forms svgalib ggi  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl pcap libcurl cairo aspell
+override TARGET_DIRS+=chm  opengl gtk syslog forms svgalib ggi  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl pcap libcurl cairo aspell
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 override TARGET_DIRS+=chm
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_DIRS+=chm  fftw x11 opengl gtk gtk2 syslog forms  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl libcurl cairo aspell univint sdl graph
+override TARGET_DIRS+=chm  fftw opengl gtk gtk2 syslog forms  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl libcurl cairo aspell univint sdl graph
 endif
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_DIRS+=chm  os2units rexx x11 gtk tcl imlib fpgtk
+override TARGET_DIRS+=chm  os2units rexx gtk tcl imlib fpgtk
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
 override TARGET_DIRS+=chm
@@ -298,13 +298,13 @@ ifeq ($(FULL_TARGET),i386-symbian)
 override TARGET_DIRS+=chm
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_DIRS+=chm  fftw x11 opengl gtk gtk2 syslog forms svgalib ggi  libgd utmp bfd gdbm  tcl cdrom imlib gnome1 fpgtk newt uuid ldap openal mad oggvorbis a52 modplug dts openssl pcap libcurl cairo aspell graph
+override TARGET_DIRS+=chm  fftw opengl gtk gtk2 syslog forms svgalib ggi  libgd utmp bfd gdbm  tcl cdrom imlib gnome1 fpgtk newt uuid ldap openal mad oggvorbis a52 modplug dts openssl pcap libcurl cairo aspell graph
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_DIRS+=chm  fftw x11 opengl gtk gtk2 syslog forms svgalib ggi  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl pcap libcurl cairo sdl graph aspell
+override TARGET_DIRS+=chm  fftw opengl gtk gtk2 syslog forms svgalib ggi  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl pcap libcurl cairo sdl graph aspell
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_DIRS+=chm  x11 opengl gtk syslog forms svgalib ggi  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl pcap libcurl cairo aspell
+override TARGET_DIRS+=chm  opengl gtk syslog forms svgalib ggi  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl pcap libcurl cairo aspell
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
 override TARGET_DIRS+=chm  amunits
@@ -313,7 +313,7 @@ ifeq ($(FULL_TARGET),m68k-atari)
 override TARGET_DIRS+=chm
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_DIRS+=chm  x11 opengl gtk syslog forms svgalib ggi  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl pcap libcurl cairo aspell
+override TARGET_DIRS+=chm  opengl gtk syslog forms svgalib ggi  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl pcap libcurl cairo aspell
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 override TARGET_DIRS+=chm  palmunits
@@ -322,10 +322,10 @@ ifeq ($(FULL_TARGET),m68k-embedded)
 override TARGET_DIRS+=chm
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_DIRS+=chm  fftw x11 opengl gtk gtk2 syslog forms svgalib ggi  libgd utmp bfd gdbm  tcl cdrom imlib gnome1 fpgtk newt uuid ldap openal mad oggvorbis a52 modplug dts openssl pcap libcurl cairo aspell sdl graph
+override TARGET_DIRS+=chm  fftw opengl gtk gtk2 syslog forms svgalib ggi  libgd utmp bfd gdbm  tcl cdrom imlib gnome1 fpgtk newt uuid ldap openal mad oggvorbis a52 modplug dts openssl pcap libcurl cairo aspell sdl graph
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_DIRS+=chm  x11 opengl gtk syslog forms svgalib ggi  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl pcap libcurl cairo aspell
+override TARGET_DIRS+=chm  opengl gtk syslog forms svgalib ggi  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl pcap libcurl cairo aspell
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
 override TARGET_DIRS+=chm  amunits
@@ -334,7 +334,7 @@ ifeq ($(FULL_TARGET),powerpc-macos)
 override TARGET_DIRS+=chm
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_DIRS+=chm  fftw x11 opengl gtk gtk2 syslog forms  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl libcurl cairo aspell univint sdl graph
+override TARGET_DIRS+=chm  fftw opengl gtk gtk2 syslog forms  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl libcurl cairo aspell univint sdl graph
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 override TARGET_DIRS+=chm
@@ -343,25 +343,25 @@ ifeq ($(FULL_TARGET),powerpc-embedded)
 override TARGET_DIRS+=chm
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_DIRS+=chm  fftw x11 opengl gtk gtk2 syslog forms svgalib ggi  libgd utmp bfd gdbm  tcl cdrom imlib gnome1 fpgtk newt uuid ldap openal mad oggvorbis a52 modplug dts openssl pcap libcurl cairo aspell graph
+override TARGET_DIRS+=chm  fftw opengl gtk gtk2 syslog forms svgalib ggi  libgd utmp bfd gdbm  tcl cdrom imlib gnome1 fpgtk newt uuid ldap openal mad oggvorbis a52 modplug dts openssl pcap libcurl cairo aspell graph
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_DIRS+=chm  x11 opengl gtk syslog forms svgalib ggi  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl pcap libcurl cairo aspell
+override TARGET_DIRS+=chm  opengl gtk syslog forms svgalib ggi  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl pcap libcurl cairo aspell
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_DIRS+=chm  fftw x11 opengl gtk gtk2 syslog forms svgalib ggi  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl pcap libcurl cairo
+override TARGET_DIRS+=chm  fftw opengl gtk gtk2 syslog forms svgalib ggi  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl pcap libcurl cairo
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
 override TARGET_DIRS+=chm
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_DIRS+=chm  fftw x11 opengl gtk gtk2 syslog forms svgalib ggi  libgd utmp bfd gdbm  tcl cdrom imlib gnome1 fpgtk newt uuid ldap openal mad oggvorbis a52 modplug dts openssl pcap libcurl cairo aspell sdl graph
+override TARGET_DIRS+=chm  fftw opengl gtk gtk2 syslog forms svgalib ggi  libgd utmp bfd gdbm  tcl cdrom imlib gnome1 fpgtk newt uuid ldap openal mad oggvorbis a52 modplug dts openssl pcap libcurl cairo aspell sdl graph
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_DIRS+=chm  fftw x11 opengl gtk gtk2 syslog forms svgalib ggi  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl pcap libcurl cairo sdl graph aspell
+override TARGET_DIRS+=chm  fftw opengl gtk gtk2 syslog forms svgalib ggi  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl pcap libcurl cairo sdl graph aspell
 endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
-override TARGET_DIRS+=chm  fftw x11 opengl gtk gtk2 syslog forms  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl libcurl cairo aspell
+override TARGET_DIRS+=chm  fftw opengl gtk gtk2 syslog forms  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl libcurl cairo aspell
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 override TARGET_DIRS+=chm  opengl gtk gtk2 tcl cdrom fpgtk fftw openssl sdl
@@ -370,7 +370,7 @@ ifeq ($(FULL_TARGET),x86_64-embedded)
 override TARGET_DIRS+=chm
 endif
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_DIRS+=chm  fftw x11 opengl gtk gtk2 syslog forms svgalib ggi  libgd utmp bfd gdbm  tcl cdrom imlib gnome1 fpgtk newt uuid ldap openal mad oggvorbis a52 modplug dts openssl pcap libcurl cairo aspell graph
+override TARGET_DIRS+=chm  fftw opengl gtk gtk2 syslog forms svgalib ggi  libgd utmp bfd gdbm  tcl cdrom imlib gnome1 fpgtk newt uuid ldap openal mad oggvorbis a52 modplug dts openssl pcap libcurl cairo aspell graph
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
 override TARGET_DIRS+=chm  palmunits
@@ -391,10 +391,10 @@ ifeq ($(FULL_TARGET),arm-symbian)
 override TARGET_DIRS+=chm
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_DIRS+=chm  fftw x11 opengl gtk gtk2 syslog forms svgalib ggi  libgd utmp bfd gdbm  tcl cdrom imlib gnome1 fpgtk newt uuid ldap openal mad oggvorbis a52 modplug dts openssl pcap libcurl cairo aspell graph
+override TARGET_DIRS+=chm  fftw opengl gtk gtk2 syslog forms svgalib ggi  libgd utmp bfd gdbm  tcl cdrom imlib gnome1 fpgtk newt uuid ldap openal mad oggvorbis a52 modplug dts openssl pcap libcurl cairo aspell graph
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
-override TARGET_DIRS+=chm  fftw x11 opengl gtk gtk2 syslog forms  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl libcurl cairo aspell
+override TARGET_DIRS+=chm  fftw opengl gtk gtk2 syslog forms  libgd utmp bfd gdbm  fpgtk tcl imlib gnome1 openssl libcurl cairo aspell
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 override TARGET_DIRS+=chm
@@ -1481,7 +1481,6 @@ fpc_makefiles: fpc_makefile fpc_makefile_dirs
 ifeq ($(FULL_TARGET),i386-linux)
 TARGET_DIRS_CHM=1
 TARGET_DIRS_FFTW=1
-TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_GTK2=1
@@ -1543,7 +1542,6 @@ ifeq ($(FULL_TARGET),i386-os2)
 TARGET_DIRS_CHM=1
 TARGET_DIRS_OS2UNITS=1
 TARGET_DIRS_REXX=1
-TARGET_DIRS_X11=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_TCL=1
 TARGET_DIRS_IMLIB=1
@@ -1552,7 +1550,6 @@ endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 TARGET_DIRS_CHM=1
 TARGET_DIRS_FFTW=1
-TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_GTK2=1
@@ -1582,7 +1579,6 @@ TARGET_DIRS_GRAPH=1
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 TARGET_DIRS_CHM=1
-TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_SYSLOG=1
@@ -1606,7 +1602,6 @@ endif
 ifeq ($(FULL_TARGET),i386-solaris)
 TARGET_DIRS_CHM=1
 TARGET_DIRS_FFTW=1
-TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_GTK2=1
@@ -1635,7 +1630,6 @@ TARGET_DIRS_CHM=1
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
 TARGET_DIRS_CHM=1
-TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_SYSLOG=1
@@ -1662,7 +1656,6 @@ endif
 ifeq ($(FULL_TARGET),i386-darwin)
 TARGET_DIRS_CHM=1
 TARGET_DIRS_FFTW=1
-TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_GTK2=1
@@ -1688,7 +1681,6 @@ ifeq ($(FULL_TARGET),i386-emx)
 TARGET_DIRS_CHM=1
 TARGET_DIRS_OS2UNITS=1
 TARGET_DIRS_REXX=1
-TARGET_DIRS_X11=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_TCL=1
 TARGET_DIRS_IMLIB=1
@@ -1714,7 +1706,6 @@ endif
 ifeq ($(FULL_TARGET),m68k-linux)
 TARGET_DIRS_CHM=1
 TARGET_DIRS_FFTW=1
-TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_GTK2=1
@@ -1750,7 +1741,6 @@ endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 TARGET_DIRS_CHM=1
 TARGET_DIRS_FFTW=1
-TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_GTK2=1
@@ -1776,7 +1766,6 @@ TARGET_DIRS_ASPELL=1
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 TARGET_DIRS_CHM=1
-TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_SYSLOG=1
@@ -1806,7 +1795,6 @@ TARGET_DIRS_CHM=1
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
 TARGET_DIRS_CHM=1
-TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_SYSLOG=1
@@ -1837,7 +1825,6 @@ endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 TARGET_DIRS_CHM=1
 TARGET_DIRS_FFTW=1
-TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_GTK2=1
@@ -1873,7 +1860,6 @@ TARGET_DIRS_GRAPH=1
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 TARGET_DIRS_CHM=1
-TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_SYSLOG=1
@@ -1904,7 +1890,6 @@ endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 TARGET_DIRS_CHM=1
 TARGET_DIRS_FFTW=1
-TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_GTK2=1
@@ -1935,7 +1920,6 @@ endif
 ifeq ($(FULL_TARGET),sparc-linux)
 TARGET_DIRS_CHM=1
 TARGET_DIRS_FFTW=1
-TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_GTK2=1
@@ -1970,7 +1954,6 @@ TARGET_DIRS_GRAPH=1
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 TARGET_DIRS_CHM=1
-TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_SYSLOG=1
@@ -1994,7 +1977,6 @@ endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 TARGET_DIRS_CHM=1
 TARGET_DIRS_FFTW=1
-TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_GTK2=1
@@ -2021,7 +2003,6 @@ endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 TARGET_DIRS_CHM=1
 TARGET_DIRS_FFTW=1
-TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_GTK2=1
@@ -2058,7 +2039,6 @@ endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 TARGET_DIRS_CHM=1
 TARGET_DIRS_FFTW=1
-TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_GTK2=1
@@ -2085,7 +2065,6 @@ endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
 TARGET_DIRS_CHM=1
 TARGET_DIRS_FFTW=1
-TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_GTK2=1
@@ -2122,7 +2101,6 @@ endif
 ifeq ($(FULL_TARGET),arm-linux)
 TARGET_DIRS_CHM=1
 TARGET_DIRS_FFTW=1
-TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_GTK2=1
@@ -2179,7 +2157,6 @@ endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 TARGET_DIRS_CHM=1
 TARGET_DIRS_FFTW=1
-TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_GTK2=1
@@ -2215,7 +2192,6 @@ endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
 TARGET_DIRS_CHM=1
 TARGET_DIRS_FFTW=1
-TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_GTK2=1
@@ -2327,51 +2303,6 @@ fftw:
 	$(MAKE) -C fftw all
 .PHONY: fftw_all fftw_debug fftw_smart fftw_release fftw_units fftw_examples fftw_shared fftw_install fftw_sourceinstall fftw_exampleinstall fftw_distinstall fftw_zipinstall fftw_zipsourceinstall fftw_zipexampleinstall fftw_zipdistinstall fftw_clean fftw_distclean fftw_cleanall fftw_info fftw_makefiles fftw
 endif
-ifdef TARGET_DIRS_X11
-x11_all:
-	$(MAKE) -C x11 all
-x11_debug:
-	$(MAKE) -C x11 debug
-x11_smart:
-	$(MAKE) -C x11 smart
-x11_release:
-	$(MAKE) -C x11 release
-x11_units:
-	$(MAKE) -C x11 units
-x11_examples:
-	$(MAKE) -C x11 examples
-x11_shared:
-	$(MAKE) -C x11 shared
-x11_install:
-	$(MAKE) -C x11 install
-x11_sourceinstall:
-	$(MAKE) -C x11 sourceinstall
-x11_exampleinstall:
-	$(MAKE) -C x11 exampleinstall
-x11_distinstall:
-	$(MAKE) -C x11 distinstall
-x11_zipinstall:
-	$(MAKE) -C x11 zipinstall
-x11_zipsourceinstall:
-	$(MAKE) -C x11 zipsourceinstall
-x11_zipexampleinstall:
-	$(MAKE) -C x11 zipexampleinstall
-x11_zipdistinstall:
-	$(MAKE) -C x11 zipdistinstall
-x11_clean:
-	$(MAKE) -C x11 clean
-x11_distclean:
-	$(MAKE) -C x11 distclean
-x11_cleanall:
-	$(MAKE) -C x11 cleanall
-x11_info:
-	$(MAKE) -C x11 info
-x11_makefiles:
-	$(MAKE) -C x11 makefiles
-x11:
-	$(MAKE) -C x11 all
-.PHONY: x11_all x11_debug x11_smart x11_release x11_units x11_examples x11_shared x11_install x11_sourceinstall x11_exampleinstall x11_distinstall x11_zipinstall x11_zipsourceinstall x11_zipexampleinstall x11_zipdistinstall x11_clean x11_distclean x11_cleanall x11_info x11_makefiles x11
-endif
 ifdef TARGET_DIRS_OPENGL
 opengl_all:
 	$(MAKE) -C opengl all

+ 8 - 8
packages/extra/Makefile.fpc

@@ -4,7 +4,7 @@
 [target]
 dirs=chm
 dirs_linux= fftw \
-           x11 opengl gtk gtk2 syslog \
+            opengl gtk gtk2 syslog \
            forms svgalib ggi  libgd \
            utmp bfd gdbm  tcl cdrom \
            imlib gnome1 fpgtk newt uuid \
@@ -18,17 +18,17 @@ dirs_sparc_linux=graph
 dirs_arm_linux=graph
 dirs_m68k_linux=graph
 dirs_netbsd= \
-            x11 opengl gtk syslog \
+             opengl gtk syslog \
             forms svgalib ggi  libgd \
             utmp bfd gdbm  fpgtk \
             tcl imlib gnome1 openssl pcap libcurl cairo aspell
 dirs_freebsd= fftw \
-             x11 opengl gtk gtk2 syslog \
+              opengl gtk gtk2 syslog \
              forms svgalib ggi  libgd \
              utmp bfd gdbm  fpgtk \
              tcl imlib gnome1 openssl pcap libcurl cairo sdl graph aspell
 dirs_openbsd= \
-             x11 opengl gtk syslog \
+              opengl gtk syslog \
              forms svgalib ggi  libgd \
              utmp bfd gdbm  fpgtk \
              tcl imlib gnome1 openssl pcap libcurl cairo aspell
@@ -39,26 +39,26 @@ dirs_win64= opengl gtk gtk2 tcl cdrom fpgtk fftw openssl sdl
 dirs_wince= tcl fftw
 dirs_os2=os2units \
          rexx \
-         x11 gtk \
+          gtk \
          tcl \
          imlib fpgtk
 dirs_emx=os2units \
          rexx \
-         x11 gtk \
+          gtk \
          tcl \
          imlib fpgtk
 dirs_go32v2= graph
 dirs_amiga=amunits
 dirs_palmos=palmunits
 dirs_darwin=  fftw \
-             x11 opengl gtk gtk2 syslog \
+              opengl gtk gtk2 syslog \
              forms  libgd \
              utmp bfd gdbm  fpgtk tcl imlib gnome1 \
              openssl libcurl cairo aspell
 dirs_powerpc_darwin=univint sdl graph
 dirs_i386_darwin=univint sdl graph
 dirs_solaris= fftw \
-             x11 opengl gtk gtk2 syslog \
+              opengl gtk gtk2 syslog \
              forms svgalib ggi  libgd \
              utmp bfd gdbm  fpgtk tcl imlib gnome1 \
              openssl pcap libcurl cairo

+ 2288 - 0
packages/x11/Makefile

@@ -0,0 +1,2288 @@
+#
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/01/26]
+#
+default: all
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded
+BSDs = freebsd netbsd openbsd darwin
+UNIXs = linux $(BSDs) solaris qnx
+LIMIT83fs = go32v2 os2 emx watcom
+OSNeedsComspecToRunBatch = go32v2 watcom
+FORCE:
+.PHONY: FORCE
+override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH)))
+ifneq ($(findstring darwin,$(OSTYPE)),)
+inUnix=1 #darwin
+SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
+else
+ifeq ($(findstring ;,$(PATH)),)
+inUnix=1
+SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
+else
+SEARCHPATH:=$(subst ;, ,$(PATH))
+endif
+endif
+SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE))))
+PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH))))
+ifeq ($(PWD),)
+PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH))))
+ifeq ($(PWD),)
+$(error You need the GNU utils package to use this Makefile)
+else
+PWD:=$(firstword $(PWD))
+SRCEXEEXT=
+endif
+else
+PWD:=$(firstword $(PWD))
+SRCEXEEXT=.exe
+endif
+ifndef inUnix
+ifeq ($(OS),Windows_NT)
+inWinNT=1
+else
+ifdef OS2_SHELL
+inOS2=1
+endif
+endif
+else
+ifneq ($(findstring cygdrive,$(PATH)),)
+inCygWin=1
+endif
+endif
+ifdef inUnix
+SRCBATCHEXT=.sh
+else
+ifdef inOS2
+SRCBATCHEXT=.cmd
+else
+SRCBATCHEXT=.bat
+endif
+endif
+ifdef COMSPEC
+ifneq ($(findstring $(OS_SOURCE),$(OSNeedsComspecToRunBatch)),)
+RUNBATCH=$(COMSPEC) /C
+endif
+endif
+ifdef inUnix
+PATHSEP=/
+else
+PATHSEP:=$(subst /,\,/)
+ifdef inCygWin
+PATHSEP=/
+endif
+endif
+ifdef PWD
+BASEDIR:=$(subst \,/,$(shell $(PWD)))
+ifdef inCygWin
+ifneq ($(findstring /cygdrive/,$(BASEDIR)),)
+BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR))
+BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR)))
+BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR))
+endif
+endif
+else
+BASEDIR=.
+endif
+ifdef inOS2
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO=echo
+else
+ECHO:=$(firstword $(ECHO))
+endif
+else
+ECHO:=$(firstword $(ECHO))
+endif
+endif
+export ECHO
+endif
+override DEFAULT_FPCDIR=../..
+ifndef FPC
+ifdef PP
+FPC=$(PP)
+endif
+endif
+ifndef FPC
+FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH))))
+ifneq ($(FPCPROG),)
+FPCPROG:=$(firstword $(FPCPROG))
+ifneq ($(CPU_TARGET),)
+FPC:=$(shell $(FPCPROG) -P$(CPU_TARGET) -PB)
+else
+FPC:=$(shell $(FPCPROG) -PB)
+endif
+ifneq ($(findstring Error,$(FPC)),)
+override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+endif
+else
+override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+endif
+endif
+override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
+override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
+FOUNDFPC:=$(strip $(wildcard $(FPC)))
+ifeq ($(FOUNDFPC),)
+FOUNDFPC=$(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))
+ifeq ($(FOUNDFPC),)
+$(error Compiler $(FPC) not found)
+endif
+endif
+ifndef FPC_COMPILERINFO
+FPC_COMPILERINFO:=$(shell $(FPC) -iVSPTPSOTO)
+endif
+ifndef FPC_VERSION
+FPC_VERSION:=$(word 1,$(FPC_COMPILERINFO))
+endif
+export FPC FPC_VERSION FPC_COMPILERINFO
+unexport CHECKDEPEND ALLDEPENDENCIES
+ifndef CPU_TARGET
+ifdef CPU_TARGET_DEFAULT
+CPU_TARGET=$(CPU_TARGET_DEFAULT)
+endif
+endif
+ifndef OS_TARGET
+ifdef OS_TARGET_DEFAULT
+OS_TARGET=$(OS_TARGET_DEFAULT)
+endif
+endif
+ifneq ($(words $(FPC_COMPILERINFO)),5)
+FPC_COMPILERINFO+=$(shell $(FPC) -iSP)
+FPC_COMPILERINFO+=$(shell $(FPC) -iTP)
+FPC_COMPILERINFO+=$(shell $(FPC) -iSO)
+FPC_COMPILERINFO+=$(shell $(FPC) -iTO)
+endif
+ifndef CPU_SOURCE
+CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO))
+endif
+ifndef CPU_TARGET
+CPU_TARGET:=$(word 3,$(FPC_COMPILERINFO))
+endif
+ifndef OS_SOURCE
+OS_SOURCE:=$(word 4,$(FPC_COMPILERINFO))
+endif
+ifndef OS_TARGET
+OS_TARGET:=$(word 5,$(FPC_COMPILERINFO))
+endif
+FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
+FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
+ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
+TARGETSUFFIX=$(OS_TARGET)
+SOURCESUFFIX=$(OS_SOURCE)
+else
+TARGETSUFFIX=$(FULL_TARGET)
+SOURCESUFFIX=$(FULL_SOURCE)
+endif
+ifneq ($(FULL_TARGET),$(FULL_SOURCE))
+CROSSCOMPILE=1
+endif
+ifeq ($(findstring makefile,$(MAKECMDGOALS)),)
+ifeq ($(findstring $(FULL_TARGET),$(MAKEFILETARGETS)),)
+$(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first)
+endif
+endif
+ifneq ($(findstring $(OS_TARGET),$(BSDs)),)
+BSDhier=1
+endif
+ifeq ($(OS_TARGET),linux)
+linuxHier=1
+endif
+export OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX CROSSCOMPILE
+ifdef FPCDIR
+override FPCDIR:=$(subst \,/,$(FPCDIR))
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=wrong
+endif
+else
+override FPCDIR=wrong
+endif
+ifdef DEFAULT_FPCDIR
+ifeq ($(FPCDIR),wrong)
+override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR))
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=wrong
+endif
+endif
+endif
+ifeq ($(FPCDIR),wrong)
+ifdef inUnix
+override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION)
+ifeq ($(wildcard $(FPCDIR)/units),)
+override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)
+endif
+else
+override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))))
+override FPCDIR:=$(FPCDIR)/..
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR:=$(FPCDIR)/..
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR:=$(BASEDIR)
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=c:/pp
+endif
+endif
+endif
+endif
+endif
+ifndef CROSSBINDIR
+CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX))
+endif
+ifndef BINUTILSPREFIX
+ifndef CROSSBINDIR
+ifdef CROSSCOMPILE
+BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)-
+endif
+endif
+endif
+UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX))
+ifeq ($(UNITSDIR),)
+UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
+endif
+PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
+override PACKAGE_NAME=x11
+override PACKAGE_VERSION=2.0.0
+ifeq ($(FULL_TARGET),i386-linux)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+endif
+override INSTALL_FPCPACKAGE=y
+ifeq ($(FULL_TARGET),i386-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-linux)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override COMPILER_SOURCEDIR+=src tests
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+override COMPILER_SOURCEDIR+=src tests
+endif
+override SHARED_BUILD=n
+override SHARED_BUILD=n
+ifdef REQUIRE_UNITSDIR
+override UNITSDIR+=$(REQUIRE_UNITSDIR)
+endif
+ifdef REQUIRE_PACKAGESDIR
+override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR)
+endif
+ifdef ZIPINSTALL
+ifneq ($(findstring $(OS_TARGET),$(UNIXs)),)
+UNIXHier=1
+endif
+else
+ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),)
+UNIXHier=1
+endif
+endif
+ifndef INSTALL_PREFIX
+ifdef PREFIX
+INSTALL_PREFIX=$(PREFIX)
+endif
+endif
+ifndef INSTALL_PREFIX
+ifdef UNIXHier
+INSTALL_PREFIX=/usr/local
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_BASEDIR:=/pp
+else
+INSTALL_BASEDIR:=/$(PACKAGE_NAME)
+endif
+endif
+endif
+export INSTALL_PREFIX
+ifdef INSTALL_FPCSUBDIR
+export INSTALL_FPCSUBDIR
+endif
+ifndef DIST_DESTDIR
+DIST_DESTDIR:=$(BASEDIR)
+endif
+export DIST_DESTDIR
+ifndef COMPILER_UNITTARGETDIR
+ifdef PACKAGEDIR_MAIN
+COMPILER_UNITTARGETDIR=$(PACKAGEDIR_MAIN)/units/$(TARGETSUFFIX)
+else
+COMPILER_UNITTARGETDIR=units/$(TARGETSUFFIX)
+endif
+endif
+ifndef COMPILER_TARGETDIR
+COMPILER_TARGETDIR=.
+endif
+ifndef INSTALL_BASEDIR
+ifdef UNIXHier
+ifdef INSTALL_FPCPACKAGE
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION)
+else
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME)
+endif
+else
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)
+endif
+endif
+ifndef INSTALL_BINDIR
+ifdef UNIXHier
+INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin
+else
+INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin
+ifdef INSTALL_FPCPACKAGE
+ifdef CROSSCOMPILE
+ifdef CROSSINSTALL
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(SOURCESUFFIX)
+else
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX)
+endif
+else
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX)
+endif
+endif
+endif
+endif
+ifndef INSTALL_UNITDIR
+INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(TARGETSUFFIX)
+ifdef INSTALL_FPCPACKAGE
+ifdef PACKAGE_NAME
+INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME)
+endif
+endif
+endif
+ifndef INSTALL_LIBDIR
+ifdef UNIXHier
+INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib
+else
+INSTALL_LIBDIR:=$(INSTALL_UNITDIR)
+endif
+endif
+ifndef INSTALL_SOURCEDIR
+ifdef UNIXHier
+ifdef BSDhier
+SRCPREFIXDIR=share/src
+else
+ifdef linuxHier
+SRCPREFIXDIR=share/src
+else
+SRCPREFIXDIR=src
+endif
+endif
+ifdef INSTALL_FPCPACKAGE
+ifdef INSTALL_FPCSUBDIR
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
+else
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+endif
+else
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+ifdef INSTALL_FPCSUBDIR
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
+else
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME)
+endif
+else
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source
+endif
+endif
+endif
+ifndef INSTALL_DOCDIR
+ifdef UNIXHier
+ifdef BSDhier
+DOCPREFIXDIR=share/doc
+else
+ifdef linuxHier
+DOCPREFIXDIR=share/doc
+else
+DOCPREFIXDIR=doc
+endif
+endif
+ifdef INSTALL_FPCPACKAGE
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+else
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME)
+else
+INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc
+endif
+endif
+endif
+ifndef INSTALL_EXAMPLEDIR
+ifdef UNIXHier
+ifdef INSTALL_FPCPACKAGE
+ifdef BSDhier
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+else
+ifdef linuxHier
+INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME)
+endif
+endif
+else
+ifdef BSDhier
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+else
+ifdef linuxHier
+INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+endif
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME)
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples
+endif
+endif
+endif
+ifndef INSTALL_DATADIR
+INSTALL_DATADIR=$(INSTALL_BASEDIR)
+endif
+ifndef INSTALL_SHAREDDIR
+INSTALL_SHAREDDIR=$(INSTALL_PREFIX)/lib
+endif
+ifdef CROSSCOMPILE
+ifndef CROSSBINDIR
+CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX))
+ifeq ($(CROSSBINDIR),)
+CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(TARGETSUFFIX)/bin/$(FULL_SOURCE))
+endif
+endif
+else
+CROSSBINDIR=
+endif
+ifeq ($(OS_SOURCE),linux)
+ifndef GCCLIBDIR
+ifeq ($(CPU_TARGET),i386)
+ifneq ($(findstring x86_64,$(shell uname -a)),)
+ifeq ($(BINUTILSPREFIX),)
+GCCLIBDIR:=$(shell dirname `gcc -m32 -print-libgcc-file-name`)
+endif
+endif
+endif
+ifeq ($(CPU_TARGET),powerpc64)
+ifeq ($(BINUTILSPREFIX),)
+GCCLIBDIR:=$(shell dirname `gcc -m64 -print-libgcc-file-name`)
+endif
+endif
+endif
+ifndef GCCLIBDIR
+CROSSGCC=$(strip $(wildcard $(addsuffix /$(BINUTILSPREFIX)gcc$(SRCEXEEXT),$(SEARCHPATH))))
+ifneq ($(CROSSGCC),)
+GCCLIBDIR:=$(shell dirname `$(CROSSGCC) -print-libgcc-file-name`)
+endif
+endif
+ifndef OTHERLIBDIR
+OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }')
+endif
+endif
+ifdef inUnix
+ifeq ($(OS_SOURCE),netbsd)
+OTHERLIBDIR+=/usr/pkg/lib
+endif
+export GCCLIBDIR OTHERLIB
+endif
+BATCHEXT=.bat
+LOADEREXT=.as
+EXEEXT=.exe
+PPLEXT=.ppl
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.so
+SHAREDLIBPREFIX=libfp
+STATICLIBPREFIX=libp
+IMPORTLIBPREFIX=libimp
+RSTEXT=.rst
+ifeq ($(findstring 1.0.,$(FPC_VERSION)),)
+ifeq ($(OS_TARGET),go32v1)
+STATICLIBPREFIX=
+SHORTSUFFIX=v1
+endif
+ifeq ($(OS_TARGET),go32v2)
+STATICLIBPREFIX=
+SHORTSUFFIX=dos
+endif
+ifeq ($(OS_TARGET),watcom)
+STATICLIBPREFIX=
+OEXT=.obj
+ASMEXT=.asm
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=wat
+endif
+ifeq ($(OS_TARGET),linux)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=lnx
+endif
+ifeq ($(OS_TARGET),freebsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=fbs
+endif
+ifeq ($(OS_TARGET),netbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=nbs
+endif
+ifeq ($(OS_TARGET),openbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=obs
+endif
+ifeq ($(OS_TARGET),win32)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=w32
+endif
+ifeq ($(OS_TARGET),os2)
+BATCHEXT=.cmd
+AOUTEXT=.out
+STATICLIBPREFIX=
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=os2
+ECHO=echo
+endif
+ifeq ($(OS_TARGET),emx)
+BATCHEXT=.cmd
+AOUTEXT=.out
+STATICLIBPREFIX=
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=emx
+ECHO=echo
+endif
+ifeq ($(OS_TARGET),amiga)
+EXEEXT=
+SHAREDLIBEXT=.library
+SHORTSUFFIX=amg
+endif
+ifeq ($(OS_TARGET),morphos)
+EXEEXT=
+SHAREDLIBEXT=.library
+SHORTSUFFIX=mos
+endif
+ifeq ($(OS_TARGET),atari)
+EXEEXT=.ttp
+SHORTSUFFIX=ata
+endif
+ifeq ($(OS_TARGET),beos)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=be
+endif
+ifeq ($(OS_TARGET),solaris)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=sun
+endif
+ifeq ($(OS_TARGET),qnx)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=qnx
+endif
+ifeq ($(OS_TARGET),netware)
+EXEEXT=.nlm
+STATICLIBPREFIX=
+SHORTSUFFIX=nw
+endif
+ifeq ($(OS_TARGET),netwlibc)
+EXEEXT=.nlm
+STATICLIBPREFIX=
+SHORTSUFFIX=nwl
+endif
+ifeq ($(OS_TARGET),macos)
+BATCHEXT=
+EXEEXT=
+DEBUGSYMEXT=.xcoff
+SHORTSUFFIX=mac
+endif
+ifeq ($(OS_TARGET),darwin)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=dwn
+endif
+ifeq ($(OS_TARGET),gba)
+EXEEXT=.gba
+SHAREDLIBEXT=.so
+SHORTSUFFIX=gba
+endif
+ifeq ($(OS_TARGET),symbian)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=symbian
+endif
+else
+ifeq ($(OS_TARGET),go32v1)
+PPUEXT=.pp1
+OEXT=.o1
+ASMEXT=.s1
+SMARTEXT=.sl1
+STATICLIBEXT=.a1
+SHAREDLIBEXT=.so1
+STATICLIBPREFIX=
+SHORTSUFFIX=v1
+endif
+ifeq ($(OS_TARGET),go32v2)
+STATICLIBPREFIX=
+SHORTSUFFIX=dos
+endif
+ifeq ($(OS_TARGET),watcom)
+STATICLIBPREFIX=
+SHORTSUFFIX=wat
+endif
+ifeq ($(OS_TARGET),linux)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=lnx
+endif
+ifeq ($(OS_TARGET),freebsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=fbs
+endif
+ifeq ($(OS_TARGET),netbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=nbs
+endif
+ifeq ($(OS_TARGET),openbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=obs
+endif
+ifeq ($(OS_TARGET),win32)
+PPUEXT=.ppw
+OEXT=.ow
+ASMEXT=.sw
+SMARTEXT=.slw
+STATICLIBEXT=.aw
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=w32
+endif
+ifeq ($(OS_TARGET),os2)
+BATCHEXT=.cmd
+PPUEXT=.ppo
+ASMEXT=.so2
+OEXT=.oo2
+AOUTEXT=.out
+SMARTEXT=.sl2
+STATICLIBPREFIX=
+STATICLIBEXT=.ao2
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=os2
+ECHO=echo
+endif
+ifeq ($(OS_TARGET),amiga)
+EXEEXT=
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.library
+SHORTSUFFIX=amg
+endif
+ifeq ($(OS_TARGET),atari)
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=.ttp
+SHORTSUFFIX=ata
+endif
+ifeq ($(OS_TARGET),beos)
+BATCHEXT=.sh
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=
+SHORTSUFFIX=be
+endif
+ifeq ($(OS_TARGET),solaris)
+BATCHEXT=.sh
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=
+SHORTSUFFIX=sun
+endif
+ifeq ($(OS_TARGET),qnx)
+BATCHEXT=.sh
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=
+SHORTSUFFIX=qnx
+endif
+ifeq ($(OS_TARGET),netware)
+STATICLIBPREFIX=
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.nlm
+EXEEXT=.nlm
+SHORTSUFFIX=nw
+endif
+ifeq ($(OS_TARGET),netwlibc)
+STATICLIBPREFIX=
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.nlm
+EXEEXT=.nlm
+SHORTSUFFIX=nwl
+endif
+ifeq ($(OS_TARGET),macos)
+BATCHEXT=
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=
+DEBUGSYMEXT=.xcoff
+SHORTSUFFIX=mac
+endif
+endif
+ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
+FPCMADE=fpcmade.$(SHORTSUFFIX)
+ZIPSUFFIX=$(SHORTSUFFIX)
+ZIPCROSSPREFIX=
+ZIPSOURCESUFFIX=src
+ZIPEXAMPLESUFFIX=exm
+else
+FPCMADE=fpcmade.$(TARGETSUFFIX)
+ZIPSOURCESUFFIX=.source
+ZIPEXAMPLESUFFIX=.examples
+ifdef CROSSCOMPILE
+ZIPSUFFIX=.$(SOURCESUFFIX)
+ZIPCROSSPREFIX=$(TARGETSUFFIX)-
+else
+ZIPSUFFIX=.$(TARGETSUFFIX)
+ZIPCROSSPREFIX=
+endif
+endif
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO= __missing_command_ECHO
+else
+ECHO:=$(firstword $(ECHO))
+endif
+else
+ECHO:=$(firstword $(ECHO))
+endif
+endif
+export ECHO
+ifndef DATE
+DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE= __missing_command_DATE
+else
+DATE:=$(firstword $(DATE))
+endif
+else
+DATE:=$(firstword $(DATE))
+endif
+endif
+export DATE
+ifndef GINSTALL
+GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(GINSTALL),)
+GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(GINSTALL),)
+GINSTALL= __missing_command_GINSTALL
+else
+GINSTALL:=$(firstword $(GINSTALL))
+endif
+else
+GINSTALL:=$(firstword $(GINSTALL))
+endif
+endif
+export GINSTALL
+ifndef CPPROG
+CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(CPPROG),)
+CPPROG= __missing_command_CPPROG
+else
+CPPROG:=$(firstword $(CPPROG))
+endif
+endif
+export CPPROG
+ifndef RMPROG
+RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(RMPROG),)
+RMPROG= __missing_command_RMPROG
+else
+RMPROG:=$(firstword $(RMPROG))
+endif
+endif
+export RMPROG
+ifndef MVPROG
+MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MVPROG),)
+MVPROG= __missing_command_MVPROG
+else
+MVPROG:=$(firstword $(MVPROG))
+endif
+endif
+export MVPROG
+ifndef MKDIRPROG
+MKDIRPROG:=$(strip $(wildcard $(addsuffix /gmkdir$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MKDIRPROG),)
+MKDIRPROG:=$(strip $(wildcard $(addsuffix /mkdir$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MKDIRPROG),)
+MKDIRPROG= __missing_command_MKDIRPROG
+else
+MKDIRPROG:=$(firstword $(MKDIRPROG))
+endif
+else
+MKDIRPROG:=$(firstword $(MKDIRPROG))
+endif
+endif
+export MKDIRPROG
+ifndef ECHOREDIR
+ifndef inUnix
+ECHOREDIR=echo
+else
+ECHOREDIR=$(ECHO)
+endif
+endif
+ifndef COPY
+COPY:=$(CPPROG) -fp
+endif
+ifndef COPYTREE
+COPYTREE:=$(CPPROG) -Rfp
+endif
+ifndef MKDIRTREE
+MKDIRTREE:=$(MKDIRPROG) -p
+endif
+ifndef MOVE
+MOVE:=$(MVPROG) -f
+endif
+ifndef DEL
+DEL:=$(RMPROG) -f
+endif
+ifndef DELTREE
+DELTREE:=$(RMPROG) -rf
+endif
+ifndef INSTALL
+ifdef inUnix
+INSTALL:=$(GINSTALL) -c -m 644
+else
+INSTALL:=$(COPY)
+endif
+endif
+ifndef INSTALLEXE
+ifdef inUnix
+INSTALLEXE:=$(GINSTALL) -c -m 755
+else
+INSTALLEXE:=$(COPY)
+endif
+endif
+ifndef MKDIR
+MKDIR:=$(GINSTALL) -m 755 -d
+endif
+export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
+ifndef PPUMOVE
+PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(PPUMOVE),)
+PPUMOVE= __missing_command_PPUMOVE
+else
+PPUMOVE:=$(firstword $(PPUMOVE))
+endif
+endif
+export PPUMOVE
+ifndef FPCMAKE
+FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(FPCMAKE),)
+FPCMAKE= __missing_command_FPCMAKE
+else
+FPCMAKE:=$(firstword $(FPCMAKE))
+endif
+endif
+export FPCMAKE
+ifndef ZIPPROG
+ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ZIPPROG),)
+ZIPPROG= __missing_command_ZIPPROG
+else
+ZIPPROG:=$(firstword $(ZIPPROG))
+endif
+endif
+export ZIPPROG
+ifndef TARPROG
+TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(TARPROG),)
+TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(TARPROG),)
+TARPROG= __missing_command_TARPROG
+else
+TARPROG:=$(firstword $(TARPROG))
+endif
+else
+TARPROG:=$(firstword $(TARPROG))
+endif
+endif
+export TARPROG
+ASNAME=$(BINUTILSPREFIX)as
+LDNAME=$(BINUTILSPREFIX)ld
+ARNAME=$(BINUTILSPREFIX)ar
+RCNAME=$(BINUTILSPREFIX)rc
+ifneq ($(findstring 1.0.,$(FPC_VERSION)),)
+ifeq ($(OS_TARGET),win32)
+ifeq ($(CROSSBINDIR),)
+ASNAME=asw
+LDNAME=ldw
+ARNAME=arw
+endif
+endif
+endif
+ifndef ASPROG
+ifdef CROSSBINDIR
+ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT)
+else
+ASPROG=$(ASNAME)
+endif
+endif
+ifndef LDPROG
+ifdef CROSSBINDIR
+LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT)
+else
+LDPROG=$(LDNAME)
+endif
+endif
+ifndef RCPROG
+ifdef CROSSBINDIR
+RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT)
+else
+RCPROG=$(RCNAME)
+endif
+endif
+ifndef ARPROG
+ifdef CROSSBINDIR
+ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT)
+else
+ARPROG=$(ARNAME)
+endif
+endif
+AS=$(ASPROG)
+LD=$(LDPROG)
+RC=$(RCPROG)
+AR=$(ARPROG)
+PPAS=ppas$(SRCBATCHEXT)
+ifdef inUnix
+LDCONFIG=ldconfig
+else
+LDCONFIG=
+endif
+ifdef DATE
+DATESTR:=$(shell $(DATE) +%Y%m%d)
+else
+DATESTR=
+endif
+ifndef UPXPROG
+ifeq ($(OS_TARGET),go32v2)
+UPXPROG:=1
+endif
+ifeq ($(OS_TARGET),win32)
+UPXPROG:=1
+endif
+ifdef UPXPROG
+UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(UPXPROG),)
+UPXPROG=
+else
+UPXPROG:=$(firstword $(UPXPROG))
+endif
+else
+UPXPROG=
+endif
+endif
+export UPXPROG
+ZIPOPT=-9
+ZIPEXT=.zip
+ifeq ($(USETAR),bz2)
+TAROPT=vj
+TAREXT=.tar.bz2
+else
+TAROPT=vz
+TAREXT=.tar.gz
+endif
+override REQUIRE_PACKAGES=rtl 
+ifeq ($(FULL_TARGET),i386-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifdef REQUIRE_PACKAGES_RTL
+PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_RTL),)
+ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)),)
+UNITDIR_RTL=$(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)
+else
+UNITDIR_RTL=$(PACKAGEDIR_RTL)
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_RTL)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_RTL) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_RTL)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_RTL=
+UNITDIR_RTL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /rtl/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_RTL),)
+UNITDIR_RTL:=$(firstword $(UNITDIR_RTL))
+else
+UNITDIR_RTL=
+endif
+endif
+ifdef UNITDIR_RTL
+override COMPILER_UNITDIR+=$(UNITDIR_RTL)
+endif
+endif
+ifndef NOCPUDEF
+override FPCOPTDEF=$(CPU_TARGET)
+endif
+ifneq ($(OS_TARGET),$(OS_SOURCE))
+override FPCOPT+=-T$(OS_TARGET)
+endif
+ifneq ($(CPU_TARGET),$(CPU_SOURCE))
+override FPCOPT+=-P$(CPU_TARGET)
+endif
+ifeq ($(OS_SOURCE),openbsd)
+override FPCOPT+=-FD$(NEW_BINUTILS_PATH)
+endif
+ifndef CROSSBOOTSTRAP
+ifneq ($(BINUTILSPREFIX),)
+override FPCOPT+=-XP$(BINUTILSPREFIX)
+endif
+ifneq ($(BINUTILSPREFIX),)
+override FPCOPT+=-Xr$(RLINKPATH)
+endif
+endif
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+endif
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+endif
+ifdef LINKSMART
+override FPCOPT+=-XX
+endif
+ifdef CREATESMART
+override FPCOPT+=-CX
+endif
+ifdef DEBUG
+override FPCOPT+=-gl
+override FPCOPTDEF+=DEBUG
+endif
+ifdef RELEASE
+ifneq ($(findstring 2.0.,$(FPC_VERSION)),)
+ifeq ($(CPU_TARGET),i386)
+FPCCPUOPT:=-OG2p3
+endif
+ifeq ($(CPU_TARGET),powerpc)
+FPCCPUOPT:=-O1r
+endif
+else
+FPCCPUOPT:=-O2
+endif
+override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n
+override FPCOPTDEF+=RELEASE
+endif
+ifdef STRIP
+override FPCOPT+=-Xs
+endif
+ifdef OPTIMIZE
+override FPCOPT+=-O2
+endif
+ifdef VERBOSE
+override FPCOPT+=-vwni
+endif
+ifdef COMPILER_OPTIONS
+override FPCOPT+=$(COMPILER_OPTIONS)
+endif
+ifdef COMPILER_UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR))
+endif
+ifdef COMPILER_LIBRARYDIR
+override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR))
+endif
+ifdef COMPILER_OBJECTDIR
+override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR))
+endif
+ifdef COMPILER_INCLUDEDIR
+override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR))
+endif
+ifdef CROSSBINDIR
+override FPCOPT+=-FD$(CROSSBINDIR)
+endif
+ifdef COMPILER_TARGETDIR
+override FPCOPT+=-FE$(COMPILER_TARGETDIR)
+ifeq ($(COMPILER_TARGETDIR),.)
+override TARGETDIRPREFIX=
+else
+override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/
+endif
+endif
+ifdef COMPILER_UNITTARGETDIR
+override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR)
+ifeq ($(COMPILER_UNITTARGETDIR),.)
+override UNITTARGETDIRPREFIX=
+else
+override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/
+endif
+else
+ifdef COMPILER_TARGETDIR
+override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR)
+override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)
+endif
+endif
+ifdef CREATESHARED
+override FPCOPT+=-Cg
+ifeq ($(CPU_TARGET),i386)
+override FPCOPT+=-Aas
+endif
+endif
+ifeq ($(findstring 2.0.,$(FPC_VERSION)),)
+ifeq ($(OS_TARGET),linux)
+ifeq ($(CPU_TARGET),x86_64)
+override FPCOPT+=-Cg
+endif
+endif
+endif
+ifdef LINKSHARED
+endif
+ifdef GCCLIBDIR
+override FPCOPT+=-Fl$(GCCLIBDIR)
+endif
+ifdef OTHERLIBDIR
+override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR))
+endif
+ifdef OPT
+override FPCOPT+=$(OPT)
+endif
+ifdef FPCOPTDEF
+override FPCOPT+=$(addprefix -d,$(FPCOPTDEF))
+endif
+ifdef CFGFILE
+override FPCOPT+=@$(CFGFILE)
+endif
+ifdef USEENV
+override FPCEXTCMD:=$(FPCOPT)
+override FPCOPT:=!FPCEXTCMD
+export FPCEXTCMD
+endif
+override AFULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
+override AFULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
+ifneq ($(AFULL_TARGET),$(AFULL_SOURCE))
+override ACROSSCOMPILE=1
+endif
+ifdef ACROSSCOMPILE
+override FPCOPT+=$(CROSSOPT)
+endif
+override COMPILER:=$(FPC) $(FPCOPT)
+ifeq (,$(findstring -s ,$(COMPILER)))
+EXECPPAS=
+else
+ifeq ($(FULL_SOURCE),$(FULL_TARGET))
+ifdef RUNBATCH
+EXECPPAS:=@$(RUNBATCH) $(PPAS)
+else
+EXECPPAS:=@$(PPAS)
+endif
+endif
+endif
+.PHONY: fpc_units
+ifneq ($(TARGET_UNITS)$(TARGET_IMPLICITUNITS),)
+override ALLTARGET+=fpc_units
+override UNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_UNITS))
+override IMPLICITUNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_IMPLICITUNITS))
+override INSTALLPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES)
+override CLEANPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES)
+endif
+fpc_units: $(COMPILER_UNITTARGETDIR) $(UNITPPUFILES)
+ifdef TARGET_RSTS
+override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS))
+override CLEANRSTFILES+=$(RSTFILES)
+endif
+.PHONY: fpc_all fpc_smart fpc_debug fpc_release fpc_shared
+$(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET)
+	@$(ECHOREDIR) Compiled > $(FPCMADE)
+fpc_all: $(FPCMADE)
+fpc_smart:
+	$(MAKE) all LINKSMART=1 CREATESMART=1
+fpc_debug:
+	$(MAKE) all DEBUG=1
+fpc_release:
+	$(MAKE) all RELEASE=1
+.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .lpr .dpr .pp .rc .res
+$(COMPILER_UNITTARGETDIR):
+	$(MKDIRTREE) $(COMPILER_UNITTARGETDIR)
+$(COMPILER_TARGETDIR):
+	$(MKDIRTREE) $(COMPILER_TARGETDIR)
+%$(PPUEXT): %.pp
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(PPUEXT): %.pas
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.pp
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.pas
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.lpr
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.dpr
+	$(COMPILER) $<
+	$(EXECPPAS)
+%.res: %.rc
+	windres -i $< -o $@
+vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.inc $(COMPILER_INCLUDEDIR)
+vpath %$(OEXT) $(COMPILER_UNITTARGETDIR)
+vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR)
+.PHONY: fpc_shared
+override INSTALLTARGET+=fpc_shared_install
+ifndef SHARED_LIBVERSION
+SHARED_LIBVERSION=$(FPC_VERSION)
+endif
+ifndef SHARED_LIBNAME
+SHARED_LIBNAME=$(PACKAGE_NAME)
+endif
+ifndef SHARED_FULLNAME
+SHARED_FULLNAME=$(SHAREDLIBPREFIX)$(SHARED_LIBNAME)-$(SHARED_LIBVERSION)$(SHAREDLIBEXT)
+endif
+ifndef SHARED_LIBUNITS
+SHARED_LIBUNITS:=$(TARGET_UNITS) $(TARGET_IMPLICITUNITS)
+override SHARED_LIBUNITS:=$(filter-out $(INSTALL_BUILDUNIT),$(SHARED_LIBUNITS))
+endif
+fpc_shared:
+ifdef HASSHAREDLIB
+	$(MAKE) all CREATESHARED=1 LINKSHARED=1 CREATESMART=1
+ifneq ($(SHARED_BUILD),n)
+	$(PPUMOVE) -q $(SHARED_LIBUNITS) -i$(COMPILER_UNITTARGETDIR) -o$(SHARED_FULLNAME) -d$(COMPILER_UNITTARGETDIR)
+endif
+else
+	@$(ECHO) Shared Libraries not supported
+endif
+fpc_shared_install:
+ifneq ($(SHARED_BUILD),n)
+ifneq ($(SHARED_LIBUNITS),)
+ifneq ($(wildcard $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME)),)
+	$(INSTALL) $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME) $(INSTALL_SHAREDDIR)
+endif
+endif
+endif
+.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall
+ifdef INSTALL_UNITS
+override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS))
+endif
+ifdef INSTALL_BUILDUNIT
+override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES))
+endif
+ifdef INSTALLPPUFILES
+override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))
+ifneq ($(UNITTARGETDIRPREFIX),)
+override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPUFILES)))
+override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPULINKFILES))))
+endif
+override INSTALL_CREATEPACKAGEFPC=1
+endif
+ifdef INSTALLEXEFILES
+ifneq ($(TARGETDIRPREFIX),)
+override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(notdir $(INSTALLEXEFILES)))
+endif
+endif
+fpc_install: all $(INSTALLTARGET)
+ifdef INSTALLEXEFILES
+	$(MKDIR) $(INSTALL_BINDIR)
+ifdef UPXPROG
+	-$(UPXPROG) $(INSTALLEXEFILES)
+endif
+	$(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR)
+endif
+ifdef INSTALL_CREATEPACKAGEFPC
+ifdef FPCMAKE
+ifdef PACKAGE_VERSION
+ifneq ($(wildcard Makefile.fpc),)
+	$(FPCMAKE) -p -T$(CPU_TARGET)-$(OS_TARGET) Makefile.fpc
+	$(MKDIR) $(INSTALL_UNITDIR)
+	$(INSTALL) Package.fpc $(INSTALL_UNITDIR)
+endif
+endif
+endif
+endif
+ifdef INSTALLPPUFILES
+	$(MKDIR) $(INSTALL_UNITDIR)
+	$(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR)
+ifneq ($(INSTALLPPULINKFILES),)
+	$(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR)
+endif
+ifneq ($(wildcard $(LIB_FULLNAME)),)
+	$(MKDIR) $(INSTALL_LIBDIR)
+	$(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR)
+ifdef inUnix
+	ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME)
+endif
+endif
+endif
+ifdef INSTALL_FILES
+	$(MKDIR) $(INSTALL_DATADIR)
+	$(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR)
+endif
+fpc_sourceinstall: distclean
+	$(MKDIR) $(INSTALL_SOURCEDIR)
+	$(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR)
+fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS))
+ifdef HASEXAMPLES
+	$(MKDIR) $(INSTALL_EXAMPLEDIR)
+endif
+ifdef EXAMPLESOURCEFILES
+	$(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR)
+endif
+ifdef TARGET_EXAMPLEDIRS
+	$(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR)
+endif
+.PHONY: fpc_distinstall
+fpc_distinstall: install exampleinstall
+.PHONY: fpc_zipinstall fpc_zipsourceinstall fpc_zipexampleinstall
+ifndef PACKDIR
+ifndef inUnix
+PACKDIR=$(BASEDIR)/../fpc-pack
+else
+PACKDIR=/tmp/fpc-pack
+endif
+endif
+ifndef ZIPNAME
+ifdef DIST_ZIPNAME
+ZIPNAME=$(DIST_ZIPNAME)
+else
+ZIPNAME=$(PACKAGE_NAME)
+endif
+endif
+ifndef FULLZIPNAME
+FULLZIPNAME=$(ZIPCROSSPREFIX)$(ZIPPREFIX)$(ZIPNAME)$(ZIPSUFFIX)
+endif
+ifndef ZIPTARGET
+ifdef DIST_ZIPTARGET
+ZIPTARGET=DIST_ZIPTARGET
+else
+ZIPTARGET=install
+endif
+endif
+ifndef USEZIP
+ifdef inUnix
+USETAR=1
+endif
+endif
+ifndef inUnix
+USEZIPWRAPPER=1
+endif
+ifdef USEZIPWRAPPER
+ZIPPATHSEP=$(PATHSEP)
+ZIPWRAPPER=$(subst /,$(PATHSEP),$(DIST_DESTDIR)/fpczip$(SRCBATCHEXT))
+else
+ZIPPATHSEP=/
+endif
+ZIPCMD_CDPACK:=cd $(subst /,$(ZIPPATHSEP),$(PACKDIR))
+ZIPCMD_CDBASE:=cd $(subst /,$(ZIPPATHSEP),$(BASEDIR))
+ifdef USETAR
+ZIPDESTFILE:=$(DIST_DESTDIR)/$(FULLZIPNAME)$(TAREXT)
+ZIPCMD_ZIP:=$(TARPROG) cf$(TAROPT) $(ZIPDESTFILE) *
+else
+ZIPDESTFILE:=$(DIST_DESTDIR)/$(FULLZIPNAME)$(ZIPEXT)
+ZIPCMD_ZIP:=$(subst /,$(ZIPPATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) *
+endif
+fpc_zipinstall:
+	$(MAKE) $(ZIPTARGET) INSTALL_PREFIX=$(PACKDIR) ZIPINSTALL=1
+	$(MKDIR) $(DIST_DESTDIR)
+	$(DEL) $(ZIPDESTFILE)
+ifdef USEZIPWRAPPER
+ifneq ($(ECHOREDIR),echo)
+	$(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDPACK))" > $(ZIPWRAPPER)
+	$(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_ZIP))" >> $(ZIPWRAPPER)
+	$(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDBASE))" >> $(ZIPWRAPPER)
+else
+	echo $(ZIPCMD_CDPACK) > $(ZIPWRAPPER)
+	echo $(ZIPCMD_ZIP) >> $(ZIPWRAPPER)
+	echo $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER)
+endif
+ifdef inUnix
+	/bin/sh $(ZIPWRAPPER)
+else
+ifdef RUNBATCH
+	$(RUNBATCH) (ZIPWRAPPER)
+else
+	$(ZIPWRAPPER)
+endif
+endif
+	$(DEL) $(ZIPWRAPPER)
+else
+	$(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE)
+endif
+	$(DELTREE) $(PACKDIR)
+fpc_zipsourceinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall ZIPSUFFIX=$(ZIPSOURCESUFFIX)
+fpc_zipexampleinstall:
+ifdef HASEXAMPLES
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall ZIPSUFFIX=$(ZIPEXAMPLESUFFIX)
+endif
+fpc_zipdistinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=distinstall
+.PHONY: fpc_clean fpc_cleanall fpc_distclean
+ifdef EXEFILES
+override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES))
+endif
+ifdef CLEAN_UNITS
+override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS))
+endif
+ifdef CLEANPPUFILES
+override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))
+ifdef DEBUGSYMEXT
+override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES))
+endif
+override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES))
+override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)))
+endif
+fpc_clean: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+ifdef CLEANPPUFILES
+	-$(DEL) $(CLEANPPUFILES)
+endif
+ifneq ($(CLEANPPULINKFILES),)
+	-$(DEL) $(CLEANPPULINKFILES)
+endif
+ifdef CLEANRSTFILES
+	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
+endif
+ifdef CLEAN_FILES
+	-$(DEL) $(CLEAN_FILES)
+endif
+ifdef LIB_NAME
+	-$(DEL) $(LIB_NAME) $(LIB_FULLNAME)
+endif
+	-$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
+	-$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT)
+fpc_cleanall: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+ifdef COMPILER_UNITTARGETDIR
+ifdef CLEANPPUFILES
+	-$(DEL) $(CLEANPPUFILES)
+endif
+ifneq ($(CLEANPPULINKFILES),)
+	-$(DEL) $(CLEANPPULINKFILES)
+endif
+ifdef CLEANRSTFILES
+	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
+endif
+endif
+	-$(DELTREE) units
+	-$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
+ifneq ($(PPUEXT),.ppu)
+	-$(DEL) *.o *.ppu *.a
+endif
+	-$(DELTREE) *$(SMARTEXT)
+	-$(DEL) fpcmade.* Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
+	-$(DEL) *_ppas$(BATCHEXT)
+ifdef AOUTEXT
+	-$(DEL) *$(AOUTEXT)
+endif
+ifdef DEBUGSYMEXT
+	-$(DEL) *$(DEBUGSYMEXT)
+endif
+fpc_distclean: cleanall
+.PHONY: fpc_baseinfo
+override INFORULES+=fpc_baseinfo
+fpc_baseinfo:
+	@$(ECHO)
+	@$(ECHO)  == Package info ==
+	@$(ECHO)  Package Name..... $(PACKAGE_NAME)
+	@$(ECHO)  Package Version.. $(PACKAGE_VERSION)
+	@$(ECHO)
+	@$(ECHO)  == Configuration info ==
+	@$(ECHO)
+	@$(ECHO)  FPC.......... $(FPC)
+	@$(ECHO)  FPC Version.. $(FPC_VERSION)
+	@$(ECHO)  Source CPU... $(CPU_SOURCE)
+	@$(ECHO)  Target CPU... $(CPU_TARGET)
+	@$(ECHO)  Source OS.... $(OS_SOURCE)
+	@$(ECHO)  Target OS.... $(OS_TARGET)
+	@$(ECHO)  Full Source.. $(FULL_SOURCE)
+	@$(ECHO)  Full Target.. $(FULL_TARGET)
+	@$(ECHO)  SourceSuffix. $(SOURCESUFFIX)
+	@$(ECHO)  TargetSuffix. $(TARGETSUFFIX)
+	@$(ECHO)
+	@$(ECHO)  == Directory info ==
+	@$(ECHO)
+	@$(ECHO)  Required pkgs... $(REQUIRE_PACKAGES)
+	@$(ECHO)
+	@$(ECHO)  Basedir......... $(BASEDIR)
+	@$(ECHO)  FPCDir.......... $(FPCDIR)
+	@$(ECHO)  CrossBinDir..... $(CROSSBINDIR)
+	@$(ECHO)  UnitsDir........ $(UNITSDIR)
+	@$(ECHO)  PackagesDir..... $(PACKAGESDIR)
+	@$(ECHO)
+	@$(ECHO)  GCC library..... $(GCCLIBDIR)
+	@$(ECHO)  Other library... $(OTHERLIBDIR)
+	@$(ECHO)
+	@$(ECHO)  == Tools info ==
+	@$(ECHO)
+	@$(ECHO)  As........ $(AS)
+	@$(ECHO)  Ld........ $(LD)
+	@$(ECHO)  Ar........ $(AR)
+	@$(ECHO)  Rc........ $(RC)
+	@$(ECHO)
+	@$(ECHO)  Mv........ $(MVPROG)
+	@$(ECHO)  Cp........ $(CPPROG)
+	@$(ECHO)  Rm........ $(RMPROG)
+	@$(ECHO)  GInstall.. $(GINSTALL)
+	@$(ECHO)  Echo...... $(ECHO)
+	@$(ECHO)  Shell..... $(SHELL)
+	@$(ECHO)  Date...... $(DATE)
+	@$(ECHO)  FPCMake... $(FPCMAKE)
+	@$(ECHO)  PPUMove... $(PPUMOVE)
+	@$(ECHO)  Upx....... $(UPXPROG)
+	@$(ECHO)  Zip....... $(ZIPPROG)
+	@$(ECHO)
+	@$(ECHO)  == Object info ==
+	@$(ECHO)
+	@$(ECHO)  Target Loaders........ $(TARGET_LOADERS)
+	@$(ECHO)  Target Units.......... $(TARGET_UNITS)
+	@$(ECHO)  Target Implicit Units. $(TARGET_IMPLICITUNITS)
+	@$(ECHO)  Target Programs....... $(TARGET_PROGRAMS)
+	@$(ECHO)  Target Dirs........... $(TARGET_DIRS)
+	@$(ECHO)  Target Examples....... $(TARGET_EXAMPLES)
+	@$(ECHO)  Target ExampleDirs.... $(TARGET_EXAMPLEDIRS)
+	@$(ECHO)
+	@$(ECHO)  Clean Units......... $(CLEAN_UNITS)
+	@$(ECHO)  Clean Files......... $(CLEAN_FILES)
+	@$(ECHO)
+	@$(ECHO)  Install Units....... $(INSTALL_UNITS)
+	@$(ECHO)  Install Files....... $(INSTALL_FILES)
+	@$(ECHO)
+	@$(ECHO)  == Install info ==
+	@$(ECHO)
+	@$(ECHO)  DateStr.............. $(DATESTR)
+	@$(ECHO)  ZipName.............. $(ZIPNAME)
+	@$(ECHO)  ZipPrefix............ $(ZIPPREFIX)
+	@$(ECHO)  ZipCrossPrefix....... $(ZIPCROSSPREFIX)
+	@$(ECHO)  ZipSuffix............ $(ZIPSUFFIX)
+	@$(ECHO)  FullZipName.......... $(FULLZIPNAME)
+	@$(ECHO)  Install FPC Package.. $(INSTALL_FPCPACKAGE)
+	@$(ECHO)
+	@$(ECHO)  Install base dir..... $(INSTALL_BASEDIR)
+	@$(ECHO)  Install binary dir... $(INSTALL_BINDIR)
+	@$(ECHO)  Install library dir.. $(INSTALL_LIBDIR)
+	@$(ECHO)  Install units dir.... $(INSTALL_UNITDIR)
+	@$(ECHO)  Install source dir... $(INSTALL_SOURCEDIR)
+	@$(ECHO)  Install doc dir...... $(INSTALL_DOCDIR)
+	@$(ECHO)  Install example dir.. $(INSTALL_EXAMPLEDIR)
+	@$(ECHO)  Install data dir..... $(INSTALL_DATADIR)
+	@$(ECHO)
+	@$(ECHO)  Dist destination dir. $(DIST_DESTDIR)
+	@$(ECHO)  Dist zip name........ $(DIST_ZIPNAME)
+	@$(ECHO)
+.PHONY: fpc_info
+fpc_info: $(INFORULES)
+.PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \
+	fpc_makefile_dirs
+fpc_makefile:
+	$(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc
+fpc_makefile_sub1:
+ifdef TARGET_DIRS
+	$(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS))
+endif
+ifdef TARGET_EXAMPLEDIRS
+	$(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS))
+endif
+fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS))
+fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2
+fpc_makefiles: fpc_makefile fpc_makefile_dirs
+all: fpc_all
+debug: fpc_debug
+smart: fpc_smart
+release: fpc_release
+units: fpc_units
+examples:
+shared: fpc_shared
+install: fpc_install
+sourceinstall: fpc_sourceinstall
+exampleinstall: fpc_exampleinstall
+distinstall: fpc_distinstall
+zipinstall: fpc_zipinstall
+zipsourceinstall: fpc_zipsourceinstall
+zipexampleinstall: fpc_zipexampleinstall
+zipdistinstall: fpc_zipdistinstall
+clean: fpc_clean
+distclean: fpc_distclean
+cleanall: fpc_cleanall
+info: fpc_info
+makefiles: fpc_makefiles
+.PHONY: all debug smart release units examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info makefiles
+ifneq ($(wildcard fpcmake.loc),)
+include fpcmake.loc
+endif
+.NOTPARALLEL:

+ 29 - 0
packages/x11/Makefile.fpc

@@ -0,0 +1,29 @@
+#
+#   Makefile.fpc for X11 Bindings
+#
+
+[package]
+name=x11
+version=2.0.0
+
+[target]
+units=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+
+[require]
+libc=y
+
+[install]
+fpcpackage=y
+
+[default]
+fpcdir=../..
+
+[compiler]
+includedir=src
+sourcedir=src tests
+
+[shared]
+build=n
+
+[rules]
+.NOTPARALLEL:

+ 101 - 0
packages/x11/fpmake.pp

@@ -0,0 +1,101 @@
+{$ifndef ALLPACKAGES}
+{$mode objfpc}{$H+}
+program fpmake;
+
+uses fpmkunit;
+
+Var
+  P : TPackage;
+  T : TTarget;
+begin
+  With Installer do
+    begin
+{$endif ALLPACKAGES}
+
+    P:=AddPackage('x11');
+{$ifdef ALLPACKAGES}
+    P.Directory:='x11';
+{$endif ALLPACKAGES}
+    P.Version:='2.0.0';
+    P.SourcePath.Add('src');
+
+    T:=P.Targets.AddUnit('cursorfont.pp');
+    T:=P.Targets.AddUnit('keysym.pp');
+    T:=P.Targets.AddUnit('xatom.pp');
+    T:=P.Targets.AddUnit('xcms.pp');
+      with T.Dependencies do
+        begin
+          AddUnit('xlib');
+        end;
+    T:=P.Targets.AddUnit('xf86dga.pp');
+      with T.Dependencies do
+        begin
+          AddInclude('xf86dga1.inc');
+          AddUnit('xlib');
+        end;
+    T:=P.Targets.AddUnit('xf86vmode.pp');
+      with T.Dependencies do
+        begin
+          AddUnit('xlib');
+        end;
+    T:=P.Targets.AddUnit('xinerama.pp');
+      with T.Dependencies do
+        begin
+          AddUnit('xlib');
+        end;
+    T:=P.Targets.AddUnit('xi.pp');
+    T:=P.Targets.AddUnit('xkblib.pp');
+      with T.Dependencies do
+        begin
+          AddUnit('xlib');
+          AddUnit('xkb');
+        end;
+    T:=P.Targets.AddUnit('xkb.pp');
+      with T.Dependencies do
+        begin
+          AddUnit('xlib');
+          AddUnit('xi');
+        end;
+    T:=P.Targets.AddUnit('xlib.pp');
+    T:=P.Targets.AddUnit('x.pp');
+    T:=P.Targets.AddUnit('xrandr.pp');
+      with T.Dependencies do
+        begin
+          AddInclude('randr.inc');
+          AddUnit('xlib');
+        end;
+    T:=P.Targets.AddUnit('xrender.pp');
+      with T.Dependencies do
+        begin
+          AddUnit('xlib');
+        end;
+    T:=P.Targets.AddUnit('xresource.pp');
+      with T.Dependencies do
+        begin
+          AddUnit('xlib');
+        end;
+    T:=P.Targets.AddUnit('xshm.pp');
+      with T.Dependencies do
+        begin
+          AddUnit('xlib');
+        end;
+    T:=P.Targets.AddUnit('xutil.pp');
+      with T.Dependencies do
+        begin
+          AddUnit('xlib');
+          AddUnit('keysym');
+        end;
+    T:=P.Targets.AddUnit('xvlib.pp');
+      with T.Dependencies do
+        begin
+          AddUnit('xlib');
+          AddUnit('xshm');
+        end;
+    T:=P.Targets.AddUnit('xv.pp');
+
+
+{$ifndef ALLPACKAGES}
+    Run;
+    end;
+end.
+{$endif ALLPACKAGES}

+ 116 - 0
packages/x11/src/cursorfont.pp

@@ -0,0 +1,116 @@
+{ $Xorg: cursorfont.h,v 1.4 2001/02/09 02:03:39 xorgcvs Exp $ }
+{
+
+Copyright 1987, 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.
+
+}
+
+unit cursorfont;
+
+interface
+
+const
+  XC_num_glyphs = 154;
+  XC_X_cursor = 0;
+  XC_arrow = 2;
+  XC_based_arrow_down = 4;
+  XC_based_arrow_up = 6;
+  XC_boat = 8;
+  XC_bogosity = 10;
+  XC_bottom_left_corner = 12;
+  XC_bottom_right_corner = 14;
+  XC_bottom_side = 16;
+  XC_bottom_tee = 18;
+  XC_box_spiral = 20;
+  XC_center_ptr = 22;
+  XC_circle = 24;
+  XC_clock = 26;
+  XC_coffee_mug = 28;
+  XC_cross = 30;
+  XC_cross_reverse = 32;
+  XC_crosshair = 34;
+  XC_diamond_cross = 36;
+  XC_dot = 38;
+  XC_dotbox = 40;
+  XC_double_arrow = 42;
+  XC_draft_large = 44;
+  XC_draft_small = 46;
+  XC_draped_box = 48;
+  XC_exchange = 50;
+  XC_fleur = 52;
+  XC_gobbler = 54;
+  XC_gumby = 56;
+  XC_hand1 = 58;
+  XC_hand2 = 60;
+  XC_heart = 62;
+  XC_icon = 64;
+  XC_iron_cross = 66;
+  XC_left_ptr = 68;
+  XC_left_side = 70;
+  XC_left_tee = 72;
+  XC_leftbutton = 74;
+  XC_ll_angle = 76;
+  XC_lr_angle = 78;
+  XC_man = 80;
+  XC_middlebutton = 82;
+  XC_mouse = 84;
+  XC_pencil = 86;
+  XC_pirate = 88;
+  XC_plus = 90;
+  XC_question_arrow = 92;
+  XC_right_ptr = 94;
+  XC_right_side = 96;
+  XC_right_tee = 98;
+  XC_rightbutton = 100;
+  XC_rtl_logo = 102;
+  XC_sailboat = 104;
+  XC_sb_down_arrow = 106;
+  XC_sb_h_double_arrow = 108;
+  XC_sb_left_arrow = 110;
+  XC_sb_right_arrow = 112;
+  XC_sb_up_arrow = 114;
+  XC_sb_v_double_arrow = 116;
+  XC_shuttle = 118;
+  XC_sizing = 120;
+  XC_spider = 122;
+  XC_spraycan = 124;
+  XC_star = 126;
+  XC_target = 128;
+  XC_tcross = 130;
+  XC_top_left_arrow = 132;
+  XC_top_left_corner = 134;
+  XC_top_right_corner = 136;
+  XC_top_side = 138;
+  XC_top_tee = 140;
+  XC_trek = 142;
+  XC_ul_angle = 144;
+  XC_umbrella = 146;
+  XC_ur_angle = 148;
+  XC_watch = 150;
+  XC_xterm = 152;
+
+implementation
+
+end.

+ 2009 - 0
packages/x11/src/keysym.pp

@@ -0,0 +1,2009 @@
+{
+Converted from X11/keysym.h and X11/keysymdef.h
+
+Capital letter consts renamed from XK_... to XKc_...
+ (since Pascal isn't case-sensitive)
+
+i.e.
+C      Pascal
+XK_a   XK_a
+XK_A   XKc_A
+}
+
+Unit keysym;
+
+Interface
+
+{* default keysyms *}
+{$DEFINE XK_MISCELLANY}
+{$DEFINE XK_XKB_KEYS}
+{$DEFINE XK_3270}
+{$DEFINE XK_LATIN1}
+{$DEFINE XK_LATIN2}
+{$DEFINE XK_LATIN3}
+{$DEFINE XK_LATIN4}
+{$DEFINE XK_LATIN8}
+{$DEFINE XK_LATIN9}
+{$DEFINE XK_KATAKANA}
+{$DEFINE XK_ARABIC}
+{$DEFINE XK_CYRILLIC}
+{$DEFINE XK_GREEK}
+{$DEFINE XK_TECHNICAL}
+{$DEFINE XK_SPECIAL}
+{$DEFINE XK_PUBLISHING}
+{$DEFINE XK_APL}
+{$DEFINE XK_HEBREW}
+{$DEFINE XK_THAI}
+{$DEFINE XK_KOREAN}
+{$DEFINE XK_ARMENIAN}
+{$DEFINE XK_GEORGIAN}
+{$DEFINE XK_CAUCASUS}
+{$DEFINE XK_VIETNAMESE}
+{$DEFINE XK_CURRENCY}
+
+Const
+  XK_VoidSymbol         = $FFFFFF;      { void symbol }
+
+{$IFDEF XK_MISCELLANY}
+{*
+ * TTY Functions, cleverly chosen to map to ascii, for convenience of
+ * programming, but could have been arbitrary (at the cost of lookup
+ * tables in client code.
+ *}
+
+  XK_BackSpace          = $FF08;        { back space, back char }
+  XK_Tab                = $FF09;
+  XK_Linefeed           = $FF0A;        { Linefeed, LF }
+  XK_Clear              = $FF0B;
+  XK_Return             = $FF0D;        { Return, enter }
+  XK_Pause              = $FF13;        { Pause, hold }
+  XK_Scroll_Lock        = $FF14;
+  XK_Sys_Req            = $FF15;
+  XK_Escape             = $FF1B;
+  XK_Delete             = $FFFF;        { Delete, rubout }
+
+
+
+{ International & multi-key character composition }
+
+  XK_Multi_key          = $FF20;  { Multi-key character compose }
+  XK_Codeinput          = $FF37;
+  XK_SingleCandidate    = $FF3C;
+  XK_MultipleCandidate  = $FF3D;
+  XK_PreviousCandidate  = $FF3E;
+
+{ Japanese keyboard support }
+
+  XK_Kanji              = $FF21;        { Kanji, Kanji convert }
+  XK_Muhenkan           = $FF22;  { Cancel Conversion }
+  XK_Henkan_Mode        = $FF23;  { Start/Stop Conversion }
+  XK_Henkan             = $FF23;  { Alias for Henkan_Mode }
+  XK_Romaji             = $FF24;  { to Romaji }
+  XK_Hiragana           = $FF25;  { to Hiragana }
+  XK_Katakana           = $FF26;  { to Katakana }
+  XK_Hiragana_Katakana  = $FF27;  { Hiragana/Katakana toggle }
+  XK_Zenkaku            = $FF28;  { to Zenkaku }
+  XK_Hankaku            = $FF29;  { to Hankaku }
+  XK_Zenkaku_Hankaku    = $FF2A;  { Zenkaku/Hankaku toggle }
+  XK_Touroku            = $FF2B;  { Add to Dictionary }
+  XK_Massyo             = $FF2C;  { Delete from Dictionary }
+  XK_Kana_Lock          = $FF2D;  { Kana Lock }
+  XK_Kana_Shift         = $FF2E;  { Kana Shift }
+  XK_Eisu_Shift         = $FF2F;  { Alphanumeric Shift }
+  XK_Eisu_toggle        = $FF30;  { Alphanumeric toggle }
+  XK_Kanji_Bangou       = $FF37;  { Codeinput }
+  XK_Zen_Koho           = $FF3D;  { Multiple/All Candidate(s) }
+  XK_Mae_Koho           = $FF3E;  { Previous Candidate }
+
+{ = $FF31 thru = $FF3F are under XK_KOREAN }
+
+{ Cursor control & motion }
+
+  XK_Home               = $FF50;
+  XK_Left               = $FF51;        { Move left, left arrow }
+  XK_Up                 = $FF52;        { Move up, up arrow }
+  XK_Right              = $FF53;        { Move right, right arrow }
+  XK_Down               = $FF54;        { Move down, down arrow }
+  XK_Prior              = $FF55;        { Prior, previous }
+  XK_Page_Up            = $FF55;
+  XK_Next               = $FF56;        { Next }
+  XK_Page_Down          = $FF56;
+  XK_End                = $FF57;        { EOL }
+  XK_Begin              = $FF58;        { BOL }
+
+
+{ Misc Functions }
+
+  XK_Select             = $FF60;        { Select, mark }
+  XK_Print              = $FF61;
+  XK_Execute            = $FF62;        { Execute, run, do }
+  XK_Insert             = $FF63;        { Insert, insert here }
+  XK_Undo               = $FF65;        { Undo, oops }
+  XK_Redo               = $FF66;        { redo, again }
+  XK_Menu               = $FF67;
+  XK_Find               = $FF68;        { Find, search }
+  XK_Cancel             = $FF69;        { Cancel, stop, abort, exit }
+  XK_Help               = $FF6A;        { Help }
+  XK_Break              = $FF6B;
+  XK_Mode_switch        = $FF7E;        { Character set switch }
+  XK_script_switch      = $FF7E;        { Alias for mode_switch }
+  XK_Num_Lock           = $FF7F;
+
+{ Keypad Functions, keypad numbers cleverly chosen to map to ascii }
+
+  XK_KP_Space           = $FF80;        { space }
+  XK_KP_Tab             = $FF89;
+  XK_KP_Enter           = $FF8D;        { enter }
+  XK_KP_F1              = $FF91;        { PF1, KP_A, ... }
+  XK_KP_F2              = $FF92;
+  XK_KP_F3              = $FF93;
+  XK_KP_F4              = $FF94;
+  XK_KP_Home            = $FF95;
+  XK_KP_Left            = $FF96;
+  XK_KP_Up              = $FF97;
+  XK_KP_Right           = $FF98;
+  XK_KP_Down            = $FF99;
+  XK_KP_Prior           = $FF9A;
+  XK_KP_Page_Up         = $FF9A;
+  XK_KP_Next            = $FF9B;
+  XK_KP_Page_Down       = $FF9B;
+  XK_KP_End             = $FF9C;
+  XK_KP_Begin           = $FF9D;
+  XK_KP_Insert          = $FF9E;
+  XK_KP_Delete          = $FF9F;
+  XK_KP_Equal           = $FFBD;        { equals }
+  XK_KP_Multiply        = $FFAA;
+  XK_KP_Add             = $FFAB;
+  XK_KP_Separator       = $FFAC;        { separator, often comma }
+  XK_KP_Subtract        = $FFAD;
+  XK_KP_Decimal         = $FFAE;
+  XK_KP_Divide          = $FFAF;
+
+  XK_KP_0               = $FFB0;
+  XK_KP_1               = $FFB1;
+  XK_KP_2               = $FFB2;
+  XK_KP_3               = $FFB3;
+  XK_KP_4               = $FFB4;
+  XK_KP_5               = $FFB5;
+  XK_KP_6               = $FFB6;
+  XK_KP_7               = $FFB7;
+  XK_KP_8               = $FFB8;
+  XK_KP_9               = $FFB9;
+
+
+
+{*
+ * Auxilliary Functions; note the duplicate definitions for left and right
+ * function keys;  Sun keyboards and a few other manufactures have such
+ * function key groups on the left and/or right sides of the keyboard.
+ * We've not found a keyboard with more than 35 function keys total.
+ *}
+
+  XK_F1                 = $FFBE;
+  XK_F2                 = $FFBF;
+  XK_F3                 = $FFC0;
+  XK_F4                 = $FFC1;
+  XK_F5                 = $FFC2;
+  XK_F6                 = $FFC3;
+  XK_F7                 = $FFC4;
+  XK_F8                 = $FFC5;
+  XK_F9                 = $FFC6;
+  XK_F10                = $FFC7;
+  XK_F11                = $FFC8;
+  XK_L1                 = $FFC8;
+  XK_F12                = $FFC9;
+  XK_L2                 = $FFC9;
+  XK_F13                = $FFCA;
+  XK_L3                 = $FFCA;
+  XK_F14                = $FFCB;
+  XK_L4                 = $FFCB;
+  XK_F15                = $FFCC;
+  XK_L5                 = $FFCC;
+  XK_F16                = $FFCD;
+  XK_L6                 = $FFCD;
+  XK_F17                = $FFCE;
+  XK_L7                 = $FFCE;
+  XK_F18                = $FFCF;
+  XK_L8                 = $FFCF;
+  XK_F19                = $FFD0;
+  XK_L9                 = $FFD0;
+  XK_F20                = $FFD1;
+  XK_L10                = $FFD1;
+  XK_F21                = $FFD2;
+  XK_R1                 = $FFD2;
+  XK_F22                = $FFD3;
+  XK_R2                 = $FFD3;
+  XK_F23                = $FFD4;
+  XK_R3                 = $FFD4;
+  XK_F24                = $FFD5;
+  XK_R4                 = $FFD5;
+  XK_F25                = $FFD6;
+  XK_R5                 = $FFD6;
+  XK_F26                = $FFD7;
+  XK_R6                 = $FFD7;
+  XK_F27                = $FFD8;
+  XK_R7                 = $FFD8;
+  XK_F28                = $FFD9;
+  XK_R8                 = $FFD9;
+  XK_F29                = $FFDA;
+  XK_R9                 = $FFDA;
+  XK_F30                = $FFDB;
+  XK_R10                = $FFDB;
+  XK_F31                = $FFDC;
+  XK_R11                = $FFDC;
+  XK_F32                = $FFDD;
+  XK_R12                = $FFDD;
+  XK_F33                = $FFDE;
+  XK_R13                = $FFDE;
+  XK_F34                = $FFDF;
+  XK_R14                = $FFDF;
+  XK_F35                = $FFE0;
+  XK_R15                = $FFE0;
+
+{ Modifiers }
+
+  XK_Shift_L            = $FFE1;        { Left shift }
+  XK_Shift_R            = $FFE2;        { Right shift }
+  XK_Control_L          = $FFE3;        { Left control }
+  XK_Control_R          = $FFE4;        { Right control }
+  XK_Caps_Lock          = $FFE5;        { Caps lock }
+  XK_Shift_Lock         = $FFE6;        { Shift lock }
+
+  XK_Meta_L             = $FFE7;        { Left meta }
+  XK_Meta_R             = $FFE8;        { Right meta }
+  XK_Alt_L              = $FFE9;        { Left alt }
+  XK_Alt_R              = $FFEA;        { Right alt }
+  XK_Super_L            = $FFEB;        { Left super }
+  XK_Super_R            = $FFEC;        { Right super }
+  XK_Hyper_L            = $FFED;        { Left hyper }
+  XK_Hyper_R            = $FFEE;        { Right hyper }
+{$ENDIF} { XK_MISCELLANY }
+
+{*
+ * ISO 9995 Function and Modifier Keys
+ * Byte 3 = = $FE
+ *}
+
+{$IFDEF XK_XKB_KEYS}
+  XK_ISO_Lock                                   = $FE01;
+  XK_ISO_Level2_Latch                           = $FE02;
+  XK_ISO_Level3_Shift                           = $FE03;
+  XK_ISO_Level3_Latch                           = $FE04;
+  XK_ISO_Level3_Lock                            = $FE05;
+  XK_ISO_Group_Shift                            = $FF7E;        { Alias for mode_switch }
+  XK_ISO_Group_Latch                            = $FE06;
+  XK_ISO_Group_Lock                             = $FE07;
+  XK_ISO_Next_Group                             = $FE08;
+  XK_ISO_Next_Group_Lock                                = $FE09;
+  XK_ISO_Prev_Group                             = $FE0A;
+  XK_ISO_Prev_Group_Lock                                = $FE0B;
+  XK_ISO_First_Group                            = $FE0C;
+  XK_ISO_First_Group_Lock                               = $FE0D;
+  XK_ISO_Last_Group                             = $FE0E;
+  XK_ISO_Last_Group_Lock                                = $FE0F;
+
+  XK_ISO_Left_Tab                                       = $FE20;
+  XK_ISO_Move_Line_Up                           = $FE21;
+  XK_ISO_Move_Line_Down                         = $FE22;
+  XK_ISO_Partial_Line_Up                                = $FE23;
+  XK_ISO_Partial_Line_Down                      = $FE24;
+  XK_ISO_Partial_Space_Left                     = $FE25;
+  XK_ISO_Partial_Space_Right                    = $FE26;
+  XK_ISO_Set_Margin_Left                                = $FE27;
+  XK_ISO_Set_Margin_Right                               = $FE28;
+  XK_ISO_Release_Margin_Left                    = $FE29;
+  XK_ISO_Release_Margin_Right                   = $FE2A;
+  XK_ISO_Release_Both_Margins                   = $FE2B;
+  XK_ISO_Fast_Cursor_Left                               = $FE2C;
+  XK_ISO_Fast_Cursor_Right                      = $FE2D;
+  XK_ISO_Fast_Cursor_Up                         = $FE2E;
+  XK_ISO_Fast_Cursor_Down                               = $FE2F;
+  XK_ISO_Continuous_Underline                   = $FE30;
+  XK_ISO_Discontinuous_Underline                        = $FE31;
+  XK_ISO_Emphasize                              = $FE32;
+  XK_ISO_Center_Object                          = $FE33;
+  XK_ISO_Enter                                  = $FE34;
+
+  XK_dead_grave                                 = $FE50;
+  XK_dead_acute                                 = $FE51;
+  XK_dead_circumflex                            = $FE52;
+  XK_dead_tilde                                 = $FE53;
+  XK_dead_macron                                        = $FE54;
+  XK_dead_breve                                 = $FE55;
+  XK_dead_abovedot                              = $FE56;
+  XK_dead_diaeresis                             = $FE57;
+  XK_dead_abovering                             = $FE58;
+  XK_dead_doubleacute                           = $FE59;
+  XK_dead_caron                                 = $FE5A;
+  XK_dead_cedilla                                       = $FE5B;
+  XK_dead_ogonek                                        = $FE5C;
+  XK_dead_iota                                  = $FE5D;
+  XK_dead_voiced_sound                          = $FE5E;
+  XK_dead_semivoiced_sound                      = $FE5F;
+  XK_dead_belowdot                              = $FE60;
+  XK_dead_hook                                  = $FE61;
+  XK_dead_horn                                  = $FE62;
+
+  XK_First_Virtual_Screen                               = $FED0;
+  XK_Prev_Virtual_Screen                                = $FED1;
+  XK_Next_Virtual_Screen                                = $FED2;
+  XK_Last_Virtual_Screen                                = $FED4;
+  XK_Terminate_Server                           = $FED5;
+
+  XK_AccessX_Enable                             = $FE70;
+  XK_AccessX_Feedback_Enable                    = $FE71;
+  XK_RepeatKeys_Enable                          = $FE72;
+  XK_SlowKeys_Enable                            = $FE73;
+  XK_BounceKeys_Enable                          = $FE74;
+  XK_StickyKeys_Enable                          = $FE75;
+  XK_MouseKeys_Enable                           = $FE76;
+  XK_MouseKeys_Accel_Enable                     = $FE77;
+  XK_Overlay1_Enable                            = $FE78;
+  XK_Overlay2_Enable                            = $FE79;
+  XK_AudibleBell_Enable                         = $FE7A;
+
+  XK_Pointer_Left                                       = $FEE0;
+  XK_Pointer_Right                              = $FEE1;
+  XK_Pointer_Up                                 = $FEE2;
+  XK_Pointer_Down                                       = $FEE3;
+  XK_Pointer_UpLeft                             = $FEE4;
+  XK_Pointer_UpRight                            = $FEE5;
+  XK_Pointer_DownLeft                           = $FEE6;
+  XK_Pointer_DownRight                          = $FEE7;
+  XK_Pointer_Button_Dflt                                = $FEE8;
+  XK_Pointer_Button1                            = $FEE9;
+  XK_Pointer_Button2                            = $FEEA;
+  XK_Pointer_Button3                            = $FEEB;
+  XK_Pointer_Button4                            = $FEEC;
+  XK_Pointer_Button5                            = $FEED;
+  XK_Pointer_DblClick_Dflt                      = $FEEE;
+  XK_Pointer_DblClick1                          = $FEEF;
+  XK_Pointer_DblClick2                          = $FEF0;
+  XK_Pointer_DblClick3                          = $FEF1;
+  XK_Pointer_DblClick4                          = $FEF2;
+  XK_Pointer_DblClick5                          = $FEF3;
+  XK_Pointer_Drag_Dflt                          = $FEF4;
+  XK_Pointer_Drag1                              = $FEF5;
+  XK_Pointer_Drag2                              = $FEF6;
+  XK_Pointer_Drag3                              = $FEF7;
+  XK_Pointer_Drag4                              = $FEF8;
+  XK_Pointer_Drag5                              = $FEFD;
+
+  XK_Pointer_EnableKeys                         = $FEF9;
+  XK_Pointer_Accelerate                         = $FEFA;
+  XK_Pointer_DfltBtnNext                                = $FEFB;
+  XK_Pointer_DfltBtnPrev                                = $FEFC;
+
+{$ENDIF}
+
+{*
+ * 3270 Terminal Keys
+ * Byte 3 = = $FD
+ *}
+
+{$IFDEF XK_3270}
+  XK_3270_Duplicate      = $FD01;
+  XK_3270_FieldMark      = $FD02;
+  XK_3270_Right2         = $FD03;
+  XK_3270_Left2          = $FD04;
+  XK_3270_BackTab        = $FD05;
+  XK_3270_EraseEOF       = $FD06;
+  XK_3270_EraseInput     = $FD07;
+  XK_3270_Reset          = $FD08;
+  XK_3270_Quit           = $FD09;
+  XK_3270_PA1            = $FD0A;
+  XK_3270_PA2            = $FD0B;
+  XK_3270_PA3            = $FD0C;
+  XK_3270_Test           = $FD0D;
+  XK_3270_Attn           = $FD0E;
+  XK_3270_CursorBlink    = $FD0F;
+  XK_3270_AltCursor      = $FD10;
+  XK_3270_KeyClick       = $FD11;
+  XK_3270_Jump           = $FD12;
+  XK_3270_Ident          = $FD13;
+  XK_3270_Rule           = $FD14;
+  XK_3270_Copy           = $FD15;
+  XK_3270_Play           = $FD16;
+  XK_3270_Setup          = $FD17;
+  XK_3270_Record         = $FD18;
+  XK_3270_ChangeScreen   = $FD19;
+  XK_3270_DeleteWord     = $FD1A;
+  XK_3270_ExSelect       = $FD1B;
+  XK_3270_CursorSelect   = $FD1C;
+  XK_3270_PrintScreen    = $FD1D;
+  XK_3270_Enter          = $FD1E;
+{$ENDIF}
+
+{*
+ *  Latin 1
+ *  Byte 3 = 0
+ *}
+{$IFDEF XK_LATIN1}
+  XK_space               = $020;
+  XK_exclam              = $021;
+  XK_quotedbl            = $022;
+  XK_numbersign          = $023;
+  XK_dollar              = $024;
+  XK_percent             = $025;
+  XK_ampersand           = $026;
+  XK_apostrophe          = $027;
+  XK_quoteright          = $027;        { deprecated }
+  XK_parenleft           = $028;
+  XK_parenright          = $029;
+  XK_asterisk            = $02a;
+  XK_plus                = $02b;
+  XK_comma               = $02c;
+  XK_minus               = $02d;
+  XK_period              = $02e;
+  XK_slash               = $02f;
+  XK_0                   = $030;
+  XK_1                   = $031;
+  XK_2                   = $032;
+  XK_3                   = $033;
+  XK_4                   = $034;
+  XK_5                   = $035;
+  XK_6                   = $036;
+  XK_7                   = $037;
+  XK_8                   = $038;
+  XK_9                   = $039;
+  XK_colon               = $03a;
+  XK_semicolon           = $03b;
+  XK_less                = $03c;
+  XK_equal               = $03d;
+  XK_greater             = $03e;
+  XK_question            = $03f;
+  XK_at                  = $040;
+  XKc_A                   = $041;
+  XKc_B                   = $042;
+  XKc_C                   = $043;
+  XKc_D                   = $044;
+  XKc_E                   = $045;
+  XKc_F                   = $046;
+  XKc_G                   = $047;
+  XKc_H                   = $048;
+  XKc_I                   = $049;
+  XKc_J                   = $04a;
+  XKc_K                   = $04b;
+  XKc_L                   = $04c;
+  XKc_M                   = $04d;
+  XKc_N                   = $04e;
+  XKc_O                   = $04f;
+  XKc_P                   = $050;
+  XKc_Q                   = $051;
+  XKc_R                   = $052;
+  XKc_S                   = $053;
+  XKc_T                   = $054;
+  XKc_U                   = $055;
+  XKc_V                   = $056;
+  XKc_W                   = $057;
+  XKc_X                   = $058;
+  XKc_Y                   = $059;
+  XKc_Z                   = $05a;
+  XK_bracketleft         = $05b;
+  XK_backslash           = $05c;
+  XK_bracketright        = $05d;
+  XK_asciicircum         = $05e;
+  XK_underscore          = $05f;
+  XK_grave               = $060;
+  XK_quoteleft           = $060;        { deprecated }
+  XK_a                   = $061;
+  XK_b                   = $062;
+  XK_c                   = $063;
+  XK_d                   = $064;
+  XK_e                   = $065;
+  XK_f                   = $066;
+  XK_g                   = $067;
+  XK_h                   = $068;
+  XK_i                   = $069;
+  XK_j                   = $06a;
+  XK_k                   = $06b;
+  XK_l                   = $06c;
+  XK_m                   = $06d;
+  XK_n                   = $06e;
+  XK_o                   = $06f;
+  XK_p                   = $070;
+  XK_q                   = $071;
+  XK_r                   = $072;
+  XK_s                   = $073;
+  XK_t                   = $074;
+  XK_u                   = $075;
+  XK_v                   = $076;
+  XK_w                   = $077;
+  XK_x                   = $078;
+  XK_y                   = $079;
+  XK_z                   = $07a;
+  XK_braceleft           = $07b;
+  XK_bar                 = $07c;
+  XK_braceright          = $07d;
+  XK_asciitilde          = $07e;
+
+  XK_nobreakspace        = $0a0;
+  XK_exclamdown          = $0a1;
+  XK_cent                = $0a2;
+  XK_sterling            = $0a3;
+  XK_currency            = $0a4;
+  XK_yen                 = $0a5;
+  XK_brokenbar           = $0a6;
+  XK_section             = $0a7;
+  XK_diaeresis           = $0a8;
+  XK_copyright           = $0a9;
+  XK_ordfeminine         = $0aa;
+  XK_guillemotleft       = $0ab;        { left angle quotation mark }
+  XK_notsign             = $0ac;
+  XK_hyphen              = $0ad;
+  XK_registered          = $0ae;
+  XK_macron              = $0af;
+  XK_degree              = $0b0;
+  XK_plusminus           = $0b1;
+  XK_twosuperior         = $0b2;
+  XK_threesuperior       = $0b3;
+  XK_acute               = $0b4;
+  XK_mu                  = $0b5;
+  XK_paragraph           = $0b6;
+  XK_periodcentered      = $0b7;
+  XK_cedilla             = $0b8;
+  XK_onesuperior         = $0b9;
+  XK_masculine           = $0ba;
+  XK_guillemotright      = $0bb;        { right angle quotation mark }
+  XK_onequarter          = $0bc;
+  XK_onehalf             = $0bd;
+  XK_threequarters       = $0be;
+  XK_questiondown        = $0bf;
+  XKc_Agrave              = $0c0;
+  XKc_Aacute              = $0c1;
+  XKc_Acircumflex         = $0c2;
+  XKc_Atilde              = $0c3;
+  XKc_Adiaeresis          = $0c4;
+  XKc_Aring               = $0c5;
+  XKc_AE                  = $0c6;
+  XKc_Ccedilla            = $0c7;
+  XKc_Egrave              = $0c8;
+  XKc_Eacute              = $0c9;
+  XKc_Ecircumflex         = $0ca;
+  XKc_Ediaeresis          = $0cb;
+  XKc_Igrave              = $0cc;
+  XKc_Iacute              = $0cd;
+  XKc_Icircumflex         = $0ce;
+  XKc_Idiaeresis          = $0cf;
+  XKc_ETH                 = $0d0;
+  XKc_Ntilde              = $0d1;
+  XKc_Ograve              = $0d2;
+  XKc_Oacute              = $0d3;
+  XKc_Ocircumflex         = $0d4;
+  XKc_Otilde              = $0d5;
+  XKc_Odiaeresis          = $0d6;
+  XK_multiply            = $0d7;
+  XKc_Ooblique            = $0d8;
+  XKc_Oslash              = XKc_Ooblique;
+  XKc_Ugrave              = $0d9;
+  XKc_Uacute              = $0da;
+  XKc_Ucircumflex         = $0db;
+  XKc_Udiaeresis          = $0dc;
+  XKc_Yacute              = $0dd;
+  XKc_THORN               = $0de;
+  XK_ssharp              = $0df;
+  XK_agrave              = $0e0;
+  XK_aacute              = $0e1;
+  XK_acircumflex         = $0e2;
+  XK_atilde              = $0e3;
+  XK_adiaeresis          = $0e4;
+  XK_aring               = $0e5;
+  XK_ae                  = $0e6;
+  XK_ccedilla            = $0e7;
+  XK_egrave              = $0e8;
+  XK_eacute              = $0e9;
+  XK_ecircumflex         = $0ea;
+  XK_ediaeresis          = $0eb;
+  XK_igrave              = $0ec;
+  XK_iacute              = $0ed;
+  XK_icircumflex         = $0ee;
+  XK_idiaeresis          = $0ef;
+  XK_eth                 = $0f0;
+  XK_ntilde              = $0f1;
+  XK_ograve              = $0f2;
+  XK_oacute              = $0f3;
+  XK_ocircumflex         = $0f4;
+  XK_otilde              = $0f5;
+  XK_odiaeresis          = $0f6;
+  XK_division            = $0f7;
+  XK_oslash              = $0f8;
+  XK_ooblique            = XK_oslash;
+  XK_ugrave              = $0f9;
+  XK_uacute              = $0fa;
+  XK_ucircumflex         = $0fb;
+  XK_udiaeresis          = $0fc;
+  XK_yacute              = $0fd;
+  XK_thorn               = $0fe;
+  XK_ydiaeresis          = $0ff;
+{$ENDIF} { XK_LATIN1 }
+
+{*
+ *   Latin 2
+ *   Byte 3 = 1
+ *}
+
+{$IFDEF XK_LATIN2}
+  XKc_Aogonek             = $1a1;
+  XK_breve               = $1a2;
+  XKc_Lstroke             = $1a3;
+  XKc_Lcaron              = $1a5;
+  XKc_Sacute              = $1a6;
+  XKc_Scaron              = $1a9;
+  XKc_Scedilla            = $1aa;
+  XKc_Tcaron              = $1ab;
+  XKc_Zacute              = $1ac;
+  XKc_Zcaron              = $1ae;
+  XKc_Zabovedot           = $1af;
+  XK_aogonek             = $1b1;
+  XK_ogonek              = $1b2;
+  XK_lstroke             = $1b3;
+  XK_lcaron              = $1b5;
+  XK_sacute              = $1b6;
+  XK_caron               = $1b7;
+  XK_scaron              = $1b9;
+  XK_scedilla            = $1ba;
+  XK_tcaron              = $1bb;
+  XK_zacute              = $1bc;
+  XK_doubleacute         = $1bd;
+  XK_zcaron              = $1be;
+  XK_zabovedot           = $1bf;
+  XKc_Racute              = $1c0;
+  XKc_Abreve              = $1c3;
+  XKc_Lacute              = $1c5;
+  XKc_Cacute              = $1c6;
+  XKc_Ccaron              = $1c8;
+  XKc_Eogonek             = $1ca;
+  XKc_Ecaron              = $1cc;
+  XKc_Dcaron              = $1cf;
+  XKc_Dstroke             = $1d0;
+  XKc_Nacute              = $1d1;
+  XKc_Ncaron              = $1d2;
+  XKc_Odoubleacute        = $1d5;
+  XKc_Rcaron              = $1d8;
+  XKc_Uring               = $1d9;
+  XKc_Udoubleacute        = $1db;
+  XKc_Tcedilla            = $1de;
+  XK_racute              = $1e0;
+  XK_abreve              = $1e3;
+  XK_lacute              = $1e5;
+  XK_cacute              = $1e6;
+  XK_ccaron              = $1e8;
+  XK_eogonek             = $1ea;
+  XK_ecaron              = $1ec;
+  XK_dcaron              = $1ef;
+  XK_dstroke             = $1f0;
+  XK_nacute              = $1f1;
+  XK_ncaron              = $1f2;
+  XK_odoubleacute        = $1f5;
+  XK_udoubleacute        = $1fb;
+  XK_rcaron              = $1f8;
+  XK_uring               = $1f9;
+  XK_tcedilla            = $1fe;
+  XK_abovedot            = $1ff;
+{$ENDIF} { XK_LATIN2 }
+
+{*
+ *   Latin 3
+ *   Byte 3 = 2
+ *}
+
+{$IFDEF XK_LATIN3}
+  XKc_Hstroke             = $2a1;
+  XKc_Hcircumflex         = $2a6;
+  XKc_Iabovedot           = $2a9;
+  XKc_Gbreve              = $2ab;
+  XKc_Jcircumflex         = $2ac;
+  XK_hstroke             = $2b1;
+  XK_hcircumflex         = $2b6;
+  XK_idotless            = $2b9;
+  XK_gbreve              = $2bb;
+  XK_jcircumflex         = $2bc;
+  XKc_Cabovedot           = $2c5;
+  XKc_Ccircumflex         = $2c6;
+  XKc_Gabovedot           = $2d5;
+  XKc_Gcircumflex         = $2d8;
+  XKc_Ubreve              = $2dd;
+  XKc_Scircumflex         = $2de;
+  XK_cabovedot           = $2e5;
+  XK_ccircumflex         = $2e6;
+  XK_gabovedot           = $2f5;
+  XK_gcircumflex         = $2f8;
+  XK_ubreve              = $2fd;
+  XK_scircumflex         = $2fe;
+{$ENDIF} { XK_LATIN3 }
+
+
+{*
+ *   Latin 4
+ *   Byte 3 = 3
+ *}
+
+{$IFDEF XK_LATIN4}
+  XK_kra                 = $3a2;
+  XK_kappa               = $3a2;{ deprecated }
+  XKc_Rcedilla            = $3a3;
+  XKc_Itilde              = $3a5;
+  XKc_Lcedilla            = $3a6;
+  XKc_Emacron             = $3aa;
+  XKc_Gcedilla            = $3ab;
+  XKc_Tslash              = $3ac;
+  XK_rcedilla            = $3b3;
+  XK_itilde              = $3b5;
+  XK_lcedilla            = $3b6;
+  XK_emacron             = $3ba;
+  XK_gcedilla            = $3bb;
+  XK_tslash              = $3bc;
+  XKc_ENG                 = $3bd;
+  XK_eng                 = $3bf;
+  XKc_Amacron             = $3c0;
+  XKc_Iogonek             = $3c7;
+  XKc_Eabovedot           = $3cc;
+  XKc_Imacron             = $3cf;
+  XKc_Ncedilla            = $3d1;
+  XKc_Omacron             = $3d2;
+  XKc_Kcedilla            = $3d3;
+  XKc_Uogonek             = $3d9;
+  XKc_Utilde              = $3dd;
+  XKc_Umacron             = $3de;
+  XK_amacron             = $3e0;
+  XK_iogonek             = $3e7;
+  XK_eabovedot           = $3ec;
+  XK_imacron             = $3ef;
+  XK_ncedilla            = $3f1;
+  XK_omacron             = $3f2;
+  XK_kcedilla            = $3f3;
+  XK_uogonek             = $3f9;
+  XK_utilde              = $3fd;
+  XK_umacron             = $3fe;
+{$ENDIF} { XK_LATIN4 }
+
+{*
+ * Latin-8
+ * Byte 3 = 18
+ *}
+{$IFDEF XK_LATIN8}
+  XKc_Babovedot           = $12a1;
+  XK_babovedot           = $12a2;
+  XKc_Dabovedot           = $12a6;
+  XKc_Wgrave              = $12a8;
+  XKc_Wacute              = $12aa;
+  XK_dabovedot           = $12ab;
+  XKc_Ygrave              = $12ac;
+  XKc_Fabovedot           = $12b0;
+  XK_fabovedot           = $12b1;
+  XKc_Mabovedot           = $12b4;
+  XK_mabovedot           = $12b5;
+  XKc_Pabovedot           = $12b7;
+  XK_wgrave              = $12b8;
+  XK_pabovedot           = $12b9;
+  XK_wacute              = $12ba;
+  XKc_Sabovedot           = $12bb;
+  XK_ygrave              = $12bc;
+  XKc_Wdiaeresis          = $12bd;
+  XK_wdiaeresis          = $12be;
+  XK_sabovedot           = $12bf;
+  XKc_Wcircumflex         = $12d0;
+  XKc_Tabovedot           = $12d7;
+  XKc_Ycircumflex         = $12de;
+  XK_wcircumflex         = $12f0;
+  XK_tabovedot           = $12f7;
+  XK_ycircumflex         = $12fe;
+{$ENDIF} { XK_LATIN8 }
+
+{*
+ * Latin-9 (a.k.a. Latin-0)
+ * Byte 3 = 19
+ *}
+
+{$IFDEF XK_LATIN9}
+  XKc_OE                  = $13bc;
+  XK_oe                  = $13bd;
+  XKc_Ydiaeresis          = $13be;
+{$ENDIF} { XK_LATIN9 }
+
+{*
+ * Katakana
+ * Byte 3 = 4
+ *}
+
+{$IFDEF XK_KATAKANA}
+  XK_overline                                    = $47e;
+  XK_kana_fullstop                               = $4a1;
+  XK_kana_openingbracket                         = $4a2;
+  XK_kana_closingbracket                         = $4a3;
+  XK_kana_comma                                  = $4a4;
+  XK_kana_conjunctive                            = $4a5;
+  XK_kana_middledot                              = $4a5; { deprecated }
+  XKc_kana_WO                                     = $4a6;
+  XK_kana_a                                      = $4a7;
+  XK_kana_i                                      = $4a8;
+  XK_kana_u                                      = $4a9;
+  XK_kana_e                                      = $4aa;
+  XK_kana_o                                      = $4ab;
+  XK_kana_ya                                     = $4ac;
+  XK_kana_yu                                     = $4ad;
+  XK_kana_yo                                     = $4ae;
+  XK_kana_tsu                                    = $4af;
+  XK_kana_tu                                     = $4af; { deprecated }
+  XK_prolongedsound                              = $4b0;
+  XKc_kana_A                                      = $4b1;
+  XKc_kana_I                                      = $4b2;
+  XKc_kana_U                                      = $4b3;
+  XKc_kana_E                                      = $4b4;
+  XKc_kana_O                                      = $4b5;
+  XKc_kana_KA                                     = $4b6;
+  XKc_kana_KI                                     = $4b7;
+  XKc_kana_KU                                     = $4b8;
+  XKc_kana_KE                                     = $4b9;
+  XKc_kana_KO                                     = $4ba;
+  XKc_kana_SA                                     = $4bb;
+  XKc_kana_SHI                                    = $4bc;
+  XKc_kana_SU                                     = $4bd;
+  XKc_kana_SE                                     = $4be;
+  XKc_kana_SO                                     = $4bf;
+  XKc_kana_TA                                     = $4c0;
+  XKc_kana_CHI                                    = $4c1;
+  XKc_kana_TI                                     = $4c1;  { deprecated }
+  XKc_kana_TSU                                    = $4c2;
+  XKc_kana_TU                                     = $4c2;  { deprecated }
+  XKc_kana_TE                                     = $4c3;
+  XKc_kana_TO                                     = $4c4;
+  XKc_kana_NA                                     = $4c5;
+  XKc_kana_NI                                     = $4c6;
+  XKc_kana_NU                                     = $4c7;
+  XKc_kana_NE                                     = $4c8;
+  XKc_kana_NO                                     = $4c9;
+  XKc_kana_HA                                     = $4ca;
+  XKc_kana_HI                                     = $4cb;
+  XKc_kana_FU                                     = $4cc;
+  XKc_kana_HU                                     = $4cc; { deprecated }
+  XKc_kana_HE                                     = $4cd;
+  XKc_kana_HO                                     = $4ce;
+  XKc_kana_MA                                     = $4cf;
+  XKc_kana_MI                                     = $4d0;
+  XKc_kana_MU                                     = $4d1;
+  XKc_kana_ME                                     = $4d2;
+  XKc_kana_MO                                     = $4d3;
+  XKc_kana_YA                                     = $4d4;
+  XKc_kana_YU                                     = $4d5;
+  XKc_kana_YO                                     = $4d6;
+  XKc_kana_RA                                     = $4d7;
+  XKc_kana_RI                                     = $4d8;
+  XKc_kana_RU                                     = $4d9;
+  XKc_kana_RE                                     = $4da;
+  XKc_kana_RO                                     = $4db;
+  XKc_kana_WA                                     = $4dc;
+  XKc_kana_N                                      = $4dd;
+  XK_voicedsound                                 = $4de;
+  XK_semivoicedsound                             = $4df;
+  XK_kana_switch          = $FF7E;  { Alias for mode_switch }
+{$ENDIF} { XK_KATAKANA }
+
+{*
+ *  Arabic
+ *  Byte 3 = 5
+ *}
+
+{$IFDEF XK_ARABIC}
+  XK_Farsi_0                                     = $590;
+  XK_Farsi_1                                     = $591;
+  XK_Farsi_2                                     = $592;
+  XK_Farsi_3                                     = $593;
+  XK_Farsi_4                                     = $594;
+  XK_Farsi_5                                     = $595;
+  XK_Farsi_6                                     = $596;
+  XK_Farsi_7                                     = $597;
+  XK_Farsi_8                                     = $598;
+  XK_Farsi_9                                     = $599;
+  XK_Arabic_percent                              = $5a5;
+  XK_Arabic_superscript_alef                     = $5a6;
+  XK_Arabic_tteh                                 = $5a7;
+  XK_Arabic_peh                                  = $5a8;
+  XK_Arabic_tcheh                                = $5a9;
+  XK_Arabic_ddal                                 = $5aa;
+  XK_Arabic_rreh                                 = $5ab;
+  XK_Arabic_comma                                = $5ac;
+  XK_Arabic_fullstop                             = $5ae;
+  XK_Arabic_0                                    = $5b0;
+  XK_Arabic_1                                    = $5b1;
+  XK_Arabic_2                                    = $5b2;
+  XK_Arabic_3                                    = $5b3;
+  XK_Arabic_4                                    = $5b4;
+  XK_Arabic_5                                    = $5b5;
+  XK_Arabic_6                                    = $5b6;
+  XK_Arabic_7                                    = $5b7;
+  XK_Arabic_8                                    = $5b8;
+  XK_Arabic_9                                    = $5b9;
+  XK_Arabic_semicolon                            = $5bb;
+  XK_Arabic_question_mark                        = $5bf;
+  XK_Arabic_hamza                                = $5c1;
+  XK_Arabic_maddaonalef                          = $5c2;
+  XK_Arabic_hamzaonalef                          = $5c3;
+  XK_Arabic_hamzaonwaw                           = $5c4;
+  XK_Arabic_hamzaunderalef                       = $5c5;
+  XK_Arabic_hamzaonyeh                           = $5c6;
+  XK_Arabic_alef                                 = $5c7;
+  XK_Arabic_beh                                  = $5c8;
+  XK_Arabic_tehmarbuta                           = $5c9;
+  XK_Arabic_teh                                  = $5ca;
+  XK_Arabic_theh                                 = $5cb;
+  XK_Arabic_jeem                                 = $5cc;
+  XK_Arabic_hah                                  = $5cd;
+  XK_Arabic_khah                                 = $5ce;
+  XK_Arabic_dal                                  = $5cf;
+  XK_Arabic_thal                                 = $5d0;
+  XK_Arabic_ra                                   = $5d1;
+  XK_Arabic_zain                                 = $5d2;
+  XK_Arabic_seen                                 = $5d3;
+  XK_Arabic_sheen                                = $5d4;
+  XK_Arabic_sad                                  = $5d5;
+  XK_Arabic_dad                                  = $5d6;
+  XK_Arabic_tah                                  = $5d7;
+  XK_Arabic_zah                                  = $5d8;
+  XK_Arabic_ain                                  = $5d9;
+  XK_Arabic_ghain                                = $5da;
+  XK_Arabic_tatweel                              = $5e0;
+  XK_Arabic_feh                                  = $5e1;
+  XK_Arabic_qaf                                  = $5e2;
+  XK_Arabic_kaf                                  = $5e3;
+  XK_Arabic_lam                                  = $5e4;
+  XK_Arabic_meem                                 = $5e5;
+  XK_Arabic_noon                                 = $5e6;
+  XK_Arabic_ha                                   = $5e7;
+  XK_Arabic_heh                                  = $5e7;  { deprecated }
+  XK_Arabic_waw                                  = $5e8;
+  XK_Arabic_alefmaksura                          = $5e9;
+  XK_Arabic_yeh                                  = $5ea;
+  XK_Arabic_fathatan                             = $5eb;
+  XK_Arabic_dammatan                             = $5ec;
+  XK_Arabic_kasratan                             = $5ed;
+  XK_Arabic_fatha                                = $5ee;
+  XK_Arabic_damma                                = $5ef;
+  XK_Arabic_kasra                                = $5f0;
+  XK_Arabic_shadda                               = $5f1;
+  XK_Arabic_sukun                                = $5f2;
+  XK_Arabic_madda_above                          = $5f3;
+  XK_Arabic_hamza_above                          = $5f4;
+  XK_Arabic_hamza_below                          = $5f5;
+  XK_Arabic_jeh                                  = $5f6;
+  XK_Arabic_veh                                  = $5f7;
+  XK_Arabic_keheh                                = $5f8;
+  XK_Arabic_gaf                                  = $5f9;
+  XK_Arabic_noon_ghunna                          = $5fa;
+  XK_Arabic_heh_doachashmee                      = $5fb;
+  XK_Farsi_yeh                                   = $5fc;
+  XK_Arabic_farsi_yeh                    = XK_Farsi_yeh;
+  XK_Arabic_yeh_baree                            = $5fd;
+  XK_Arabic_heh_goal                             = $5fe;
+  XK_Arabic_switch        = $FF7E;  { Alias for mode_switch }
+{$ENDIF} { XK_ARABIC }
+
+{*
+ * Cyrillic
+ * Byte 3 = 6
+ *}
+{$IFDEF XK_CYRILLIC}
+  XKc_Cyrillic_GHE_bar                             = $680;
+  XK_Cyrillic_ghe_bar                              = $690;
+  XKc_Cyrillic_ZHE_descender                       = $681;
+  XK_Cyrillic_zhe_descender                        = $691;
+  XKc_Cyrillic_KA_descender                        = $682;
+  XK_Cyrillic_ka_descender                         = $692;
+  XKc_Cyrillic_KA_vertstroke                       = $683;
+  XK_Cyrillic_ka_vertstroke                        = $693;
+  XKc_Cyrillic_EN_descender                        = $684;
+  XK_Cyrillic_en_descender                         = $694;
+  XKc_Cyrillic_U_straight                              = $685;
+  XK_Cyrillic_u_straight                               = $695;
+  XKc_Cyrillic_U_straight_bar                      = $686;
+  XK_Cyrillic_u_straight_bar                       = $696;
+  XKc_Cyrillic_HA_descender                        = $687;
+  XK_Cyrillic_ha_descender                         = $697;
+  XKc_Cyrillic_CHE_descender                       = $688;
+  XK_Cyrillic_che_descender                        = $698;
+  XKc_Cyrillic_CHE_vertstroke                      = $689;
+  XK_Cyrillic_che_vertstroke                       = $699;
+  XKc_Cyrillic_SHHA                                = $68a;
+  XK_Cyrillic_shha                                 = $69a;
+
+  XKc_Cyrillic_SCHWA                               = $68c;
+  XK_Cyrillic_schwa                                = $69c;
+  XKc_Cyrillic_I_macron                            = $68d;
+  XK_Cyrillic_i_macron                             = $69d;
+  XKc_Cyrillic_O_bar                               = $68e;
+  XK_Cyrillic_o_bar                                = $69e;
+  XKc_Cyrillic_U_macron                            = $68f;
+  XK_Cyrillic_u_macron                             = $69f;
+
+  XK_Serbian_dje                                 = $6a1;
+  XK_Macedonia_gje                               = $6a2;
+  XK_Cyrillic_io                                 = $6a3;
+  XK_Ukrainian_ie                                = $6a4;
+  XK_Ukranian_je                                 = $6a4;  { deprecated }
+  XK_Macedonia_dse                               = $6a5;
+  XK_Ukrainian_i                                 = $6a6;
+  XK_Ukranian_i                                  = $6a6;  { deprecated }
+  XK_Ukrainian_yi                                = $6a7;
+  XK_Ukranian_yi                                 = $6a7;  { deprecated }
+  XK_Cyrillic_je                                 = $6a8;
+  XK_Serbian_je                                  = $6a8;  { deprecated }
+  XK_Cyrillic_lje                                = $6a9;
+  XK_Serbian_lje                                 = $6a9;  { deprecated }
+  XK_Cyrillic_nje                                = $6aa;
+  XK_Serbian_nje                                 = $6aa;  { deprecated }
+  XK_Serbian_tshe                                = $6ab;
+  XK_Macedonia_kje                               = $6ac;
+  XK_Ukrainian_ghe_with_upturn                   = $6ad;
+  XK_Byelorussian_shortu                         = $6ae;
+  XK_Cyrillic_dzhe                               = $6af;
+  XK_Serbian_dze                                 = $6af;  { deprecated }
+  XK_numerosign                                  = $6b0;
+  XKc_Serbian_DJE                                 = $6b1;
+  XKc_Macedonia_GJE                               = $6b2;
+  XKc_Cyrillic_IO                                 = $6b3;
+  XKc_Ukrainian_IE                                = $6b4;
+  XKc_Ukranian_JE                                 = $6b4;  { deprecated }
+  XKc_Macedonia_DSE                               = $6b5;
+  XKc_Ukrainian_I                                 = $6b6;
+  XKc_Ukranian_I                                  = $6b6;  { deprecated }
+  XKc_Ukrainian_YI                                = $6b7;
+  XKc_Ukranian_YI                                 = $6b7;  { deprecated }
+  XKc_Cyrillic_JE                                 = $6b8;
+  XKc_Serbian_JE                                  = $6b8;  { deprecated }
+  XKc_Cyrillic_LJE                                = $6b9;
+  XKc_Serbian_LJE                                 = $6b9;  { deprecated }
+  XKc_Cyrillic_NJE                                = $6ba;
+  XKc_Serbian_NJE                                 = $6ba;  { deprecated }
+  XKc_Serbian_TSHE                                = $6bb;
+  XKc_Macedonia_KJE                               = $6bc;
+  XKc_Ukrainian_GHE_WITH_UPTURN                   = $6bd;
+  XKc_Byelorussian_SHORTU                         = $6be;
+  XKc_Cyrillic_DZHE                               = $6bf;
+  XKc_Serbian_DZE                                 = $6bf;  { deprecated }
+  XK_Cyrillic_yu                                 = $6c0;
+  XK_Cyrillic_a                                  = $6c1;
+  XK_Cyrillic_be                                 = $6c2;
+  XK_Cyrillic_tse                                = $6c3;
+  XK_Cyrillic_de                                 = $6c4;
+  XK_Cyrillic_ie                                 = $6c5;
+  XK_Cyrillic_ef                                 = $6c6;
+  XK_Cyrillic_ghe                                = $6c7;
+  XK_Cyrillic_ha                                 = $6c8;
+  XK_Cyrillic_i                                  = $6c9;
+  XK_Cyrillic_shorti                             = $6ca;
+  XK_Cyrillic_ka                                 = $6cb;
+  XK_Cyrillic_el                                 = $6cc;
+  XK_Cyrillic_em                                 = $6cd;
+  XK_Cyrillic_en                                 = $6ce;
+  XK_Cyrillic_o                                  = $6cf;
+  XK_Cyrillic_pe                                 = $6d0;
+  XK_Cyrillic_ya                                 = $6d1;
+  XK_Cyrillic_er                                 = $6d2;
+  XK_Cyrillic_es                                 = $6d3;
+  XK_Cyrillic_te                                 = $6d4;
+  XK_Cyrillic_u                                  = $6d5;
+  XK_Cyrillic_zhe                                = $6d6;
+  XK_Cyrillic_ve                                 = $6d7;
+  XK_Cyrillic_softsign                           = $6d8;
+  XK_Cyrillic_yeru                               = $6d9;
+  XK_Cyrillic_ze                                 = $6da;
+  XK_Cyrillic_sha                                = $6db;
+  XK_Cyrillic_e                                  = $6dc;
+  XK_Cyrillic_shcha                              = $6dd;
+  XK_Cyrillic_che                                = $6de;
+  XK_Cyrillic_hardsign                           = $6df;
+  XKc_Cyrillic_YU                                 = $6e0;
+  XKc_Cyrillic_A                                  = $6e1;
+  XKc_Cyrillic_BE                                 = $6e2;
+  XKc_Cyrillic_TSE                                = $6e3;
+  XKc_Cyrillic_DE                                 = $6e4;
+  XKc_Cyrillic_IE                                 = $6e5;
+  XKc_Cyrillic_EF                                 = $6e6;
+  XKc_Cyrillic_GHE                                = $6e7;
+  XKc_Cyrillic_HA                                 = $6e8;
+  XKc_Cyrillic_I                                  = $6e9;
+  XKc_Cyrillic_SHORTI                             = $6ea;
+  XKc_Cyrillic_KA                                 = $6eb;
+  XKc_Cyrillic_EL                                 = $6ec;
+  XKc_Cyrillic_EM                                 = $6ed;
+  XKc_Cyrillic_EN                                 = $6ee;
+  XKc_Cyrillic_O                                  = $6ef;
+  XKc_Cyrillic_PE                                 = $6f0;
+  XKc_Cyrillic_YA                                 = $6f1;
+  XKc_Cyrillic_ER                                 = $6f2;
+  XKc_Cyrillic_ES                                 = $6f3;
+  XKc_Cyrillic_TE                                 = $6f4;
+  XKc_Cyrillic_U                                  = $6f5;
+  XKc_Cyrillic_ZHE                                = $6f6;
+  XKc_Cyrillic_VE                                 = $6f7;
+  XKc_Cyrillic_SOFTSIGN                           = $6f8;
+  XKc_Cyrillic_YERU                               = $6f9;
+  XKc_Cyrillic_ZE                                 = $6fa;
+  XKc_Cyrillic_SHA                                = $6fb;
+  XKc_Cyrillic_E                                  = $6fc;
+  XKc_Cyrillic_SHCHA                              = $6fd;
+  XKc_Cyrillic_CHE                                = $6fe;
+  XKc_Cyrillic_HARDSIGN                           = $6ff;
+{$ENDIF} { XK_CYRILLIC }
+
+{*
+ * Greek
+ * Byte 3 = 7
+ *}
+
+{$IFDEF XK_GREEK}
+  XKc_Greek_ALPHAaccent                           = $7a1;
+  XKc_Greek_EPSILONaccent                         = $7a2;
+  XKc_Greek_ETAaccent                             = $7a3;
+  XKc_Greek_IOTAaccent                            = $7a4;
+  XKc_Greek_IOTAdieresis                          = $7a5;
+  XKc_Greek_IOTAdiaeresis = XKc_Greek_IOTAdieresis; { old typo }
+  XKc_Greek_OMICRONaccent                         = $7a7;
+  XKc_Greek_UPSILONaccent                         = $7a8;
+  XKc_Greek_UPSILONdieresis                       = $7a9;
+  XKc_Greek_OMEGAaccent                           = $7ab;
+  XK_Greek_accentdieresis                        = $7ae;
+  XK_Greek_horizbar                              = $7af;
+  XK_Greek_alphaaccent                           = $7b1;
+  XK_Greek_epsilonaccent                         = $7b2;
+  XK_Greek_etaaccent                             = $7b3;
+  XK_Greek_iotaaccent                            = $7b4;
+  XK_Greek_iotadieresis                          = $7b5;
+  XK_Greek_iotaaccentdieresis                    = $7b6;
+  XK_Greek_omicronaccent                         = $7b7;
+  XK_Greek_upsilonaccent                         = $7b8;
+  XK_Greek_upsilondieresis                       = $7b9;
+  XK_Greek_upsilonaccentdieresis                 = $7ba;
+  XK_Greek_omegaaccent                           = $7bb;
+  XKc_Greek_ALPHA                                 = $7c1;
+  XKc_Greek_BETA                                  = $7c2;
+  XKc_Greek_GAMMA                                 = $7c3;
+  XKc_Greek_DELTA                                 = $7c4;
+  XKc_Greek_EPSILON                               = $7c5;
+  XKc_Greek_ZETA                                  = $7c6;
+  XKc_Greek_ETA                                   = $7c7;
+  XKc_Greek_THETA                                 = $7c8;
+  XKc_Greek_IOTA                                  = $7c9;
+  XKc_Greek_KAPPA                                 = $7ca;
+  XKc_Greek_LAMDA                                 = $7cb;
+  XKc_Greek_LAMBDA                                = $7cb;
+  XKc_Greek_MU                                    = $7cc;
+  XKc_Greek_NU                                    = $7cd;
+  XKc_Greek_XI                                    = $7ce;
+  XKc_Greek_OMICRON                               = $7cf;
+  XKc_Greek_PI                                    = $7d0;
+  XKc_Greek_RHO                                   = $7d1;
+  XKc_Greek_SIGMA                                 = $7d2;
+  XKc_Greek_TAU                                   = $7d4;
+  XKc_Greek_UPSILON                               = $7d5;
+  XKc_Greek_PHI                                   = $7d6;
+  XKc_Greek_CHI                                   = $7d7;
+  XKc_Greek_PSI                                   = $7d8;
+  XKc_Greek_OMEGA                                 = $7d9;
+  XK_Greek_alpha                                 = $7e1;
+  XK_Greek_beta                                  = $7e2;
+  XK_Greek_gamma                                 = $7e3;
+  XK_Greek_delta                                 = $7e4;
+  XK_Greek_epsilon                               = $7e5;
+  XK_Greek_zeta                                  = $7e6;
+  XK_Greek_eta                                   = $7e7;
+  XK_Greek_theta                                 = $7e8;
+  XK_Greek_iota                                  = $7e9;
+  XK_Greek_kappa                                 = $7ea;
+  XK_Greek_lamda                                 = $7eb;
+  XK_Greek_lambda                                = $7eb;
+  XK_Greek_mu                                    = $7ec;
+  XK_Greek_nu                                    = $7ed;
+  XK_Greek_xi                                    = $7ee;
+  XK_Greek_omicron                               = $7ef;
+  XK_Greek_pi                                    = $7f0;
+  XK_Greek_rho                                   = $7f1;
+  XK_Greek_sigma                                 = $7f2;
+  XK_Greek_finalsmallsigma                       = $7f3;
+  XK_Greek_tau                                   = $7f4;
+  XK_Greek_upsilon                               = $7f5;
+  XK_Greek_phi                                   = $7f6;
+  XK_Greek_chi                                   = $7f7;
+  XK_Greek_psi                                   = $7f8;
+  XK_Greek_omega                                 = $7f9;
+  XK_Greek_switch         = $FF7E;  { Alias for mode_switch }
+{$ENDIF} { XK_GREEK }
+
+{*
+ * Technical
+ * Byte 3 = 8
+ *}
+
+{$IFDEF XK_TECHNICAL}
+  XK_leftradical                                 = $8a1;
+  XK_topleftradical                              = $8a2;
+  XK_horizconnector                              = $8a3;
+  XK_topintegral                                 = $8a4;
+  XK_botintegral                                 = $8a5;
+  XK_vertconnector                               = $8a6;
+  XK_topleftsqbracket                            = $8a7;
+  XK_botleftsqbracket                            = $8a8;
+  XK_toprightsqbracket                           = $8a9;
+  XK_botrightsqbracket                           = $8aa;
+  XK_topleftparens                               = $8ab;
+  XK_botleftparens                               = $8ac;
+  XK_toprightparens                              = $8ad;
+  XK_botrightparens                              = $8ae;
+  XK_leftmiddlecurlybrace                        = $8af;
+  XK_rightmiddlecurlybrace                       = $8b0;
+  XK_topleftsummation                            = $8b1;
+  XK_botleftsummation                            = $8b2;
+  XK_topvertsummationconnector                   = $8b3;
+  XK_botvertsummationconnector                   = $8b4;
+  XK_toprightsummation                           = $8b5;
+  XK_botrightsummation                           = $8b6;
+  XK_rightmiddlesummation                        = $8b7;
+  XK_lessthanequal                               = $8bc;
+  XK_notequal                                    = $8bd;
+  XK_greaterthanequal                            = $8be;
+  XK_integral                                    = $8bf;
+  XK_therefore                                   = $8c0;
+  XK_variation                                   = $8c1;
+  XK_infinity                                    = $8c2;
+  XK_nabla                                       = $8c5;
+  XK_approximate                                 = $8c8;
+  XK_similarequal                                = $8c9;
+  XK_ifonlyif                                    = $8cd;
+  XK_implies                                     = $8ce;
+  XK_identical                                   = $8cf;
+  XK_radical                                     = $8d6;
+  XK_includedin                                  = $8da;
+  XK_includes                                    = $8db;
+  XK_intersection                                = $8dc;
+  XK_union                                       = $8dd;
+  XK_logicaland                                  = $8de;
+  XK_logicalor                                   = $8df;
+  XK_partialderivative                           = $8ef;
+  XK_function                                    = $8f6;
+  XK_leftarrow                                   = $8fb;
+  XK_uparrow                                     = $8fc;
+  XK_rightarrow                                  = $8fd;
+  XK_downarrow                                   = $8fe;
+{$ENDIF} { XK_TECHNICAL }
+
+{*
+ *  Special
+ *  Byte 3 = 9
+ *}
+
+{$IFDEF XK_SPECIAL}
+  XK_blank                                       = $9df;
+  XK_soliddiamond                                = $9e0;
+  XK_checkerboard                                = $9e1;
+  XK_ht                                          = $9e2;
+  XK_ff                                          = $9e3;
+  XK_cr                                          = $9e4;
+  XK_lf                                          = $9e5;
+  XK_nl                                          = $9e8;
+  XK_vt                                          = $9e9;
+  XK_lowrightcorner                              = $9ea;
+  XK_uprightcorner                               = $9eb;
+  XK_upleftcorner                                = $9ec;
+  XK_lowleftcorner                               = $9ed;
+  XK_crossinglines                               = $9ee;
+  XK_horizlinescan1                              = $9ef;
+  XK_horizlinescan3                              = $9f0;
+  XK_horizlinescan5                              = $9f1;
+  XK_horizlinescan7                              = $9f2;
+  XK_horizlinescan9                              = $9f3;
+  XK_leftt                                       = $9f4;
+  XK_rightt                                      = $9f5;
+  XK_bott                                        = $9f6;
+  XK_topt                                        = $9f7;
+  XK_vertbar                                     = $9f8;
+{$ENDIF} { XK_SPECIAL }
+
+{*
+ *  Publishing
+ *  Byte 3 = a
+ *}
+
+{$IFDEF XK_PUBLISHING}
+  XK_emspace                                     = $aa1;
+  XK_enspace                                     = $aa2;
+  XK_em3space                                    = $aa3;
+  XK_em4space                                    = $aa4;
+  XK_digitspace                                  = $aa5;
+  XK_punctspace                                  = $aa6;
+  XK_thinspace                                   = $aa7;
+  XK_hairspace                                   = $aa8;
+  XK_emdash                                      = $aa9;
+  XK_endash                                      = $aaa;
+  XK_signifblank                                 = $aac;
+  XK_ellipsis                                    = $aae;
+  XK_doubbaselinedot                             = $aaf;
+  XK_onethird                                    = $ab0;
+  XK_twothirds                                   = $ab1;
+  XK_onefifth                                    = $ab2;
+  XK_twofifths                                   = $ab3;
+  XK_threefifths                                 = $ab4;
+  XK_fourfifths                                  = $ab5;
+  XK_onesixth                                    = $ab6;
+  XK_fivesixths                                  = $ab7;
+  XK_careof                                      = $ab8;
+  XK_figdash                                     = $abb;
+  XK_leftanglebracket                            = $abc;
+  XK_decimalpoint                                = $abd;
+  XK_rightanglebracket                           = $abe;
+  XK_marker                                      = $abf;
+  XK_oneeighth                                   = $ac3;
+  XK_threeeighths                                = $ac4;
+  XK_fiveeighths                                 = $ac5;
+  XK_seveneighths                                = $ac6;
+  XK_trademark                                   = $ac9;
+  XK_signaturemark                               = $aca;
+  XK_trademarkincircle                           = $acb;
+  XK_leftopentriangle                            = $acc;
+  XK_rightopentriangle                           = $acd;
+  XK_emopencircle                                = $ace;
+  XK_emopenrectangle                             = $acf;
+  XK_leftsinglequotemark                         = $ad0;
+  XK_rightsinglequotemark                        = $ad1;
+  XK_leftdoublequotemark                         = $ad2;
+  XK_rightdoublequotemark                        = $ad3;
+  XK_prescription                                = $ad4;
+  XK_minutes                                     = $ad6;
+  XK_seconds                                     = $ad7;
+  XK_latincross                                  = $ad9;
+  XK_hexagram                                    = $ada;
+  XK_filledrectbullet                            = $adb;
+  XK_filledlefttribullet                         = $adc;
+  XK_filledrighttribullet                        = $add;
+  XK_emfilledcircle                              = $ade;
+  XK_emfilledrect                                = $adf;
+  XK_enopencircbullet                            = $ae0;
+  XK_enopensquarebullet                          = $ae1;
+  XK_openrectbullet                              = $ae2;
+  XK_opentribulletup                             = $ae3;
+  XK_opentribulletdown                           = $ae4;
+  XK_openstar                                    = $ae5;
+  XK_enfilledcircbullet                          = $ae6;
+  XK_enfilledsqbullet                            = $ae7;
+  XK_filledtribulletup                           = $ae8;
+  XK_filledtribulletdown                         = $ae9;
+  XK_leftpointer                                 = $aea;
+  XK_rightpointer                                = $aeb;
+  XK_club                                        = $aec;
+  XK_diamond                                     = $aed;
+  XK_heart                                       = $aee;
+  XK_maltesecross                                = $af0;
+  XK_dagger                                      = $af1;
+  XK_doubledagger                                = $af2;
+  XK_checkmark                                   = $af3;
+  XK_ballotcross                                 = $af4;
+  XK_musicalsharp                                = $af5;
+  XK_musicalflat                                 = $af6;
+  XK_malesymbol                                  = $af7;
+  XK_femalesymbol                                = $af8;
+  XK_telephone                                   = $af9;
+  XK_telephonerecorder                           = $afa;
+  XK_phonographcopyright                         = $afb;
+  XK_caret                                       = $afc;
+  XK_singlelowquotemark                          = $afd;
+  XK_doublelowquotemark                          = $afe;
+  XK_cursor                                      = $aff;
+{$ENDIF} { XK_PUBLISHING }
+
+{*
+ *  APL
+ *  Byte 3 = b
+ *}
+
+{$IFDEF XK_APL}
+  XK_leftcaret                                   = $ba3;
+  XK_rightcaret                                  = $ba6;
+  XK_downcaret                                   = $ba8;
+  XK_upcaret                                     = $ba9;
+  XK_overbar                                     = $bc0;
+  XK_downtack                                    = $bc2;
+  XK_upshoe                                      = $bc3;
+  XK_downstile                                   = $bc4;
+  XK_underbar                                    = $bc6;
+  XK_jot                                         = $bca;
+  XK_quad                                        = $bcc;
+  XK_uptack                                      = $bce;
+  XK_circle                                      = $bcf;
+  XK_upstile                                     = $bd3;
+  XK_downshoe                                    = $bd6;
+  XK_rightshoe                                   = $bd8;
+  XK_leftshoe                                    = $bda;
+  XK_lefttack                                    = $bdc;
+  XK_righttack                                   = $bfc;
+{$ENDIF} { XK_APL }
+
+{*
+ * Hebrew
+ * Byte 3 = c
+ *}
+
+{$IFDEF XK_HEBREW}
+  XK_hebrew_doublelowline                        = $cdf;
+  XK_hebrew_aleph                                = $ce0;
+  XK_hebrew_bet                                  = $ce1;
+  XK_hebrew_beth                                 = $ce1;  { deprecated }
+  XK_hebrew_gimel                                = $ce2;
+  XK_hebrew_gimmel                               = $ce2;  { deprecated }
+  XK_hebrew_dalet                                = $ce3;
+  XK_hebrew_daleth                               = $ce3;  { deprecated }
+  XK_hebrew_he                                   = $ce4;
+  XK_hebrew_waw                                  = $ce5;
+  XK_hebrew_zain                                 = $ce6;
+  XK_hebrew_zayin                                = $ce6;  { deprecated }
+  XK_hebrew_chet                                 = $ce7;
+  XK_hebrew_het                                  = $ce7;  { deprecated }
+  XK_hebrew_tet                                  = $ce8;
+  XK_hebrew_teth                                 = $ce8;  { deprecated }
+  XK_hebrew_yod                                  = $ce9;
+  XK_hebrew_finalkaph                            = $cea;
+  XK_hebrew_kaph                                 = $ceb;
+  XK_hebrew_lamed                                = $cec;
+  XK_hebrew_finalmem                             = $ced;
+  XK_hebrew_mem                                  = $cee;
+  XK_hebrew_finalnun                             = $cef;
+  XK_hebrew_nun                                  = $cf0;
+  XK_hebrew_samech                               = $cf1;
+  XK_hebrew_samekh                               = $cf1;  { deprecated }
+  XK_hebrew_ayin                                 = $cf2;
+  XK_hebrew_finalpe                              = $cf3;
+  XK_hebrew_pe                                   = $cf4;
+  XK_hebrew_finalzade                            = $cf5;
+  XK_hebrew_finalzadi                            = $cf5;  { deprecated }
+  XK_hebrew_zade                                 = $cf6;
+  XK_hebrew_zadi                                 = $cf6;  { deprecated }
+  XK_hebrew_qoph                                 = $cf7;
+  XK_hebrew_kuf                                  = $cf7;  { deprecated }
+  XK_hebrew_resh                                 = $cf8;
+  XK_hebrew_shin                                 = $cf9;
+  XK_hebrew_taw                                  = $cfa;
+  XK_hebrew_taf                                  = $cfa;  { deprecated }
+  XK_Hebrew_switch        = $FF7E;  { Alias for mode_switch }
+{$ENDIF} { XK_HEBREW }
+
+{*
+ * Thai
+ * Byte 3 = d
+ *}
+
+{$IFDEF XK_THAI}
+  XK_Thai_kokai                                 = $da1;
+  XK_Thai_khokhai                                       = $da2;
+  XK_Thai_khokhuat                              = $da3;
+  XK_Thai_khokhwai                              = $da4;
+  XK_Thai_khokhon                                       = $da5;
+  XK_Thai_khorakhang                            = $da6;
+  XK_Thai_ngongu                                        = $da7;
+  XK_Thai_chochan                                       = $da8;
+  XK_Thai_choching                              = $da9;
+  XK_Thai_chochang                              = $daa;
+  XK_Thai_soso                                  = $dab;
+  XK_Thai_chochoe                                       = $dac;
+  XK_Thai_yoying                                        = $dad;
+  XK_Thai_dochada                                       = $dae;
+  XK_Thai_topatak                                       = $daf;
+  XK_Thai_thothan                                       = $db0;
+  XK_Thai_thonangmontho                         = $db1;
+  XK_Thai_thophuthao                            = $db2;
+  XK_Thai_nonen                                 = $db3;
+  XK_Thai_dodek                                 = $db4;
+  XK_Thai_totao                                 = $db5;
+  XK_Thai_thothung                              = $db6;
+  XK_Thai_thothahan                             = $db7;
+  XK_Thai_thothong                              = $db8;
+  XK_Thai_nonu                                  = $db9;
+  XK_Thai_bobaimai                              = $dba;
+  XK_Thai_popla                                 = $dbb;
+  XK_Thai_phophung                              = $dbc;
+  XK_Thai_fofa                                  = $dbd;
+  XK_Thai_phophan                                       = $dbe;
+  XK_Thai_fofan                                 = $dbf;
+  XK_Thai_phosamphao                            = $dc0;
+  XK_Thai_moma                                  = $dc1;
+  XK_Thai_yoyak                                 = $dc2;
+  XK_Thai_rorua                                 = $dc3;
+  XK_Thai_ru                                    = $dc4;
+  XK_Thai_loling                                        = $dc5;
+  XK_Thai_lu                                    = $dc6;
+  XK_Thai_wowaen                                        = $dc7;
+  XK_Thai_sosala                                        = $dc8;
+  XK_Thai_sorusi                                        = $dc9;
+  XK_Thai_sosua                                 = $dca;
+  XK_Thai_hohip                                 = $dcb;
+  XK_Thai_lochula                                       = $dcc;
+  XK_Thai_oang                                  = $dcd;
+  XK_Thai_honokhuk                              = $dce;
+  XK_Thai_paiyannoi                             = $dcf;
+  XK_Thai_saraa                                 = $dd0;
+  XK_Thai_maihanakat                            = $dd1;
+  XK_Thai_saraaa                                        = $dd2;
+  XK_Thai_saraam                                        = $dd3;
+  XK_Thai_sarai                                 = $dd4;
+  XK_Thai_saraii                                        = $dd5;
+  XK_Thai_saraue                                        = $dd6;
+  XK_Thai_sarauee                                       = $dd7;
+  XK_Thai_sarau                                 = $dd8;
+  XK_Thai_sarauu                                        = $dd9;
+  XK_Thai_phinthu                                       = $dda;
+  XK_Thai_maihanakat_maitho                     = $dde;
+  XK_Thai_baht                                  = $ddf;
+  XK_Thai_sarae                                 = $de0;
+  XK_Thai_saraae                                        = $de1;
+  XK_Thai_sarao                                 = $de2;
+  XK_Thai_saraaimaimuan                         = $de3;
+  XK_Thai_saraaimaimalai                                = $de4;
+  XK_Thai_lakkhangyao                           = $de5;
+  XK_Thai_maiyamok                              = $de6;
+  XK_Thai_maitaikhu                             = $de7;
+  XK_Thai_maiek                                 = $de8;
+  XK_Thai_maitho                                        = $de9;
+  XK_Thai_maitri                                        = $dea;
+  XK_Thai_maichattawa                           = $deb;
+  XK_Thai_thanthakhat                           = $dec;
+  XK_Thai_nikhahit                              = $ded;
+  XK_Thai_leksun                                        = $df0;
+  XK_Thai_leknung                                       = $df1;
+  XK_Thai_leksong                                       = $df2;
+  XK_Thai_leksam                                        = $df3;
+  XK_Thai_leksi                                 = $df4;
+  XK_Thai_lekha                                 = $df5;
+  XK_Thai_lekhok                                        = $df6;
+  XK_Thai_lekchet                                       = $df7;
+  XK_Thai_lekpaet                                       = $df8;
+  XK_Thai_lekkao                                        = $df9;
+{$ENDIF} { XK_THAI }
+
+{*
+ *   Korean
+ *   Byte 3 = e
+ *}
+
+{$IFDEF XK_KOREAN}
+
+  XK_Hangul             = $ff31;    { Hangul start/stop(toggle) }
+  XK_Hangul_Start               = $ff32;    { Hangul start }
+  XK_Hangul_End         = $ff33;    { Hangul end, English start }
+  XK_Hangul_Hanja               = $ff34;    { Start Hangul->Hanja Conversion }
+  XK_Hangul_Jamo                = $ff35;    { Hangul Jamo mode }
+  XK_Hangul_Romaja      = $ff36;    { Hangul Romaja mode }
+  XK_Hangul_Codeinput   = $ff37;    { Hangul code input mode }
+  XK_Hangul_Jeonja      = $ff38;    { Jeonja mode }
+  XK_Hangul_Banja               = $ff39;    { Banja mode }
+  XK_Hangul_PreHanja    = $ff3a;    { Pre Hanja conversion }
+  XK_Hangul_PostHanja   = $ff3b;    { Post Hanja conversion }
+  XK_Hangul_SingleCandidate     = $ff3c;    { Single candidate }
+  XK_Hangul_MultipleCandidate   = $ff3d;    { Multiple candidate }
+  XK_Hangul_PreviousCandidate   = $ff3e;    { Previous candidate }
+  XK_Hangul_Special     = $ff3f;    { Special symbols }
+  XK_Hangul_switch      = $FF7E;    { Alias for mode_switch }
+
+{ Hangul Consonant Characters }
+  XK_Hangul_Kiyeog                              = $ea1;
+  XK_Hangul_SsangKiyeog                         = $ea2;
+  XK_Hangul_KiyeogSios                          = $ea3;
+  XK_Hangul_Nieun                                       = $ea4;
+  XK_Hangul_NieunJieuj                          = $ea5;
+  XK_Hangul_NieunHieuh                          = $ea6;
+  XK_Hangul_Dikeud                              = $ea7;
+  XK_Hangul_SsangDikeud                         = $ea8;
+  XK_Hangul_Rieul                                       = $ea9;
+  XK_Hangul_RieulKiyeog                         = $eaa;
+  XK_Hangul_RieulMieum                          = $eab;
+  XK_Hangul_RieulPieub                          = $eac;
+  XK_Hangul_RieulSios                           = $ead;
+  XK_Hangul_RieulTieut                          = $eae;
+  XK_Hangul_RieulPhieuf                         = $eaf;
+  XK_Hangul_RieulHieuh                          = $eb0;
+  XK_Hangul_Mieum                                       = $eb1;
+  XK_Hangul_Pieub                                       = $eb2;
+  XK_Hangul_SsangPieub                          = $eb3;
+  XK_Hangul_PieubSios                           = $eb4;
+  XK_Hangul_Sios                                        = $eb5;
+  XK_Hangul_SsangSios                           = $eb6;
+  XK_Hangul_Ieung                                       = $eb7;
+  XK_Hangul_Jieuj                                       = $eb8;
+  XK_Hangul_SsangJieuj                          = $eb9;
+  XK_Hangul_Cieuc                                       = $eba;
+  XK_Hangul_Khieuq                              = $ebb;
+  XK_Hangul_Tieut                                       = $ebc;
+  XK_Hangul_Phieuf                              = $ebd;
+  XK_Hangul_Hieuh                                       = $ebe;
+
+{ Hangul Vowel Characters }
+  XK_Hangul_A                                   = $ebf;
+  XK_Hangul_AE                                  = $ec0;
+  XK_Hangul_YA                                  = $ec1;
+  XK_Hangul_YAE                                 = $ec2;
+  XK_Hangul_EO                                  = $ec3;
+  XK_Hangul_E                                   = $ec4;
+  XK_Hangul_YEO                                 = $ec5;
+  XK_Hangul_YE                                  = $ec6;
+  XK_Hangul_O                                   = $ec7;
+  XK_Hangul_WA                                  = $ec8;
+  XK_Hangul_WAE                                 = $ec9;
+  XK_Hangul_OE                                  = $eca;
+  XK_Hangul_YO                                  = $ecb;
+  XK_Hangul_U                                   = $ecc;
+  XK_Hangul_WEO                                 = $ecd;
+  XK_Hangul_WE                                  = $ece;
+  XK_Hangul_WI                                  = $ecf;
+  XK_Hangul_YU                                  = $ed0;
+  XK_Hangul_EU                                  = $ed1;
+  XK_Hangul_YI                                  = $ed2;
+  XK_Hangul_I                                   = $ed3;
+
+{ Hangul syllable-final (JongSeong) Characters }
+  XK_Hangul_J_Kiyeog                            = $ed4;
+  XK_Hangul_J_SsangKiyeog                               = $ed5;
+  XK_Hangul_J_KiyeogSios                                = $ed6;
+  XK_Hangul_J_Nieun                             = $ed7;
+  XK_Hangul_J_NieunJieuj                                = $ed8;
+  XK_Hangul_J_NieunHieuh                                = $ed9;
+  XK_Hangul_J_Dikeud                            = $eda;
+  XK_Hangul_J_Rieul                             = $edb;
+  XK_Hangul_J_RieulKiyeog                               = $edc;
+  XK_Hangul_J_RieulMieum                                = $edd;
+  XK_Hangul_J_RieulPieub                                = $ede;
+  XK_Hangul_J_RieulSios                         = $edf;
+  XK_Hangul_J_RieulTieut                                = $ee0;
+  XK_Hangul_J_RieulPhieuf                               = $ee1;
+  XK_Hangul_J_RieulHieuh                                = $ee2;
+  XK_Hangul_J_Mieum                             = $ee3;
+  XK_Hangul_J_Pieub                             = $ee4;
+  XK_Hangul_J_PieubSios                         = $ee5;
+  XK_Hangul_J_Sios                              = $ee6;
+  XK_Hangul_J_SsangSios                         = $ee7;
+  XK_Hangul_J_Ieung                             = $ee8;
+  XK_Hangul_J_Jieuj                             = $ee9;
+  XK_Hangul_J_Cieuc                             = $eea;
+  XK_Hangul_J_Khieuq                            = $eeb;
+  XK_Hangul_J_Tieut                             = $eec;
+  XK_Hangul_J_Phieuf                            = $eed;
+  XK_Hangul_J_Hieuh                             = $eee;
+
+{ Ancient Hangul Consonant Characters }
+  XK_Hangul_RieulYeorinHieuh                    = $eef;
+  XK_Hangul_SunkyeongeumMieum                   = $ef0;
+  XK_Hangul_SunkyeongeumPieub                   = $ef1;
+  XK_Hangul_PanSios                             = $ef2;
+  XK_Hangul_KkogjiDalrinIeung                   = $ef3;
+  XK_Hangul_SunkyeongeumPhieuf                  = $ef4;
+  XK_Hangul_YeorinHieuh                         = $ef5;
+
+{ Ancient Hangul Vowel Characters }
+  XK_Hangul_AraeA                                       = $ef6;
+  XK_Hangul_AraeAE                              = $ef7;
+
+{ Ancient Hangul syllable-final (JongSeong) Characters }
+  XK_Hangul_J_PanSios                           = $ef8;
+  XK_Hangul_J_KkogjiDalrinIeung                 = $ef9;
+  XK_Hangul_J_YeorinHieuh                               = $efa;
+
+{ Korean currency symbol }
+  XK_Korean_Won                                 = $eff;
+
+{$ENDIF} { XK_KOREAN }
+
+{*
+ *   Armenian
+ *   Byte 3 = = $14
+ *}
+
+{$IFDEF XK_ARMENIAN}
+  XK_Armenian_eternity                          = $14a1;
+  XK_Armenian_ligature_ew                               = $14a2;
+  XK_Armenian_full_stop                         = $14a3;
+  XK_Armenian_verjaket                          = $14a3;
+  XK_Armenian_parenright                                = $14a4;
+  XK_Armenian_parenleft                         = $14a5;
+  XK_Armenian_guillemotright                    = $14a6;
+  XK_Armenian_guillemotleft                     = $14a7;
+  XK_Armenian_em_dash                           = $14a8;
+  XK_Armenian_dot                                       = $14a9;
+  XK_Armenian_mijaket                           = $14a9;
+  XK_Armenian_separation_mark                   = $14aa;
+  XK_Armenian_but                                       = $14aa;
+  XK_Armenian_comma                             = $14ab;
+  XK_Armenian_en_dash                           = $14ac;
+  XK_Armenian_hyphen                            = $14ad;
+  XK_Armenian_yentamna                          = $14ad;
+  XK_Armenian_ellipsis                          = $14ae;
+  XK_Armenian_exclam                            = $14af;
+  XK_Armenian_amanak                            = $14af;
+  XK_Armenian_accent                            = $14b0;
+  XK_Armenian_shesht                            = $14b0;
+  XK_Armenian_question                          = $14b1;
+  XK_Armenian_paruyk                            = $14b1;
+  XKc_Armenian_AYB                                      = $14b2;
+  XK_Armenian_ayb                                       = $14b3;
+  XKc_Armenian_BEN                                      = $14b4;
+  XK_Armenian_ben                                       = $14b5;
+  XKc_Armenian_GIM                                      = $14b6;
+  XK_Armenian_gim                                       = $14b7;
+  XKc_Armenian_DA                                       = $14b8;
+  XK_Armenian_da                                        = $14b9;
+  XKc_Armenian_YECH                             = $14ba;
+  XK_Armenian_yech                              = $14bb;
+  XKc_Armenian_ZA                                       = $14bc;
+  XK_Armenian_za                                        = $14bd;
+  XKc_Armenian_E                                        = $14be;
+  XK_Armenian_e                                 = $14bf;
+  XKc_Armenian_AT                                       = $14c0;
+  XK_Armenian_at                                        = $14c1;
+  XKc_Armenian_TO                                       = $14c2;
+  XK_Armenian_to                                        = $14c3;
+  XKc_Armenian_ZHE                                      = $14c4;
+  XK_Armenian_zhe                                       = $14c5;
+  XKc_Armenian_INI                                      = $14c6;
+  XK_Armenian_ini                                       = $14c7;
+  XKc_Armenian_LYUN                             = $14c8;
+  XK_Armenian_lyun                              = $14c9;
+  XKc_Armenian_KHE                                      = $14ca;
+  XK_Armenian_khe                                       = $14cb;
+  XKc_Armenian_TSA                                      = $14cc;
+  XK_Armenian_tsa                                       = $14cd;
+  XKc_Armenian_KEN                                      = $14ce;
+  XK_Armenian_ken                                       = $14cf;
+  XKc_Armenian_HO                                       = $14d0;
+  XK_Armenian_ho                                        = $14d1;
+  XKc_Armenian_DZA                                      = $14d2;
+  XK_Armenian_dza                                       = $14d3;
+  XKc_Armenian_GHAT                             = $14d4;
+  XK_Armenian_ghat                              = $14d5;
+  XKc_Armenian_TCHE                             = $14d6;
+  XK_Armenian_tche                              = $14d7;
+  XKc_Armenian_MEN                                      = $14d8;
+  XK_Armenian_men                                       = $14d9;
+  XKc_Armenian_HI                                       = $14da;
+  XK_Armenian_hi                                        = $14db;
+  XKc_Armenian_NU                                       = $14dc;
+  XK_Armenian_nu                                        = $14dd;
+  XKc_Armenian_SHA                                      = $14de;
+  XK_Armenian_sha                                       = $14df;
+  XKc_Armenian_VO                                       = $14e0;
+  XK_Armenian_vo                                        = $14e1;
+  XKc_Armenian_CHA                                      = $14e2;
+  XK_Armenian_cha                                       = $14e3;
+  XKc_Armenian_PE                                       = $14e4;
+  XK_Armenian_pe                                        = $14e5;
+  XKc_Armenian_JE                                       = $14e6;
+  XK_Armenian_je                                        = $14e7;
+  XKc_Armenian_RA                                       = $14e8;
+  XK_Armenian_ra                                        = $14e9;
+  XKc_Armenian_SE                                       = $14ea;
+  XK_Armenian_se                                        = $14eb;
+  XKc_Armenian_VEV                                      = $14ec;
+  XK_Armenian_vev                                       = $14ed;
+  XKc_Armenian_TYUN                             = $14ee;
+  XK_Armenian_tyun                              = $14ef;
+  XKc_Armenian_RE                                       = $14f0;
+  XK_Armenian_re                                        = $14f1;
+  XKc_Armenian_TSO                                      = $14f2;
+  XK_Armenian_tso                                       = $14f3;
+  XKc_Armenian_VYUN                             = $14f4;
+  XK_Armenian_vyun                              = $14f5;
+  XKc_Armenian_PYUR                             = $14f6;
+  XK_Armenian_pyur                              = $14f7;
+  XKc_Armenian_KE                                       = $14f8;
+  XK_Armenian_ke                                        = $14f9;
+  XKc_Armenian_O                                        = $14fa;
+  XK_Armenian_o                                 = $14fb;
+  XKc_Armenian_FE                                       = $14fc;
+  XK_Armenian_fe                                        = $14fd;
+  XK_Armenian_apostrophe                                = $14fe;
+  XK_Armenian_section_sign                      = $14ff;
+{$ENDIF} { XK_ARMENIAN }
+
+{*
+ *   Georgian
+ *   Byte 3 = = $15
+ *}
+
+{$IFDEF XK_GEORGIAN}
+  XK_Georgian_an                                        = $15d0;
+  XK_Georgian_ban                                       = $15d1;
+  XK_Georgian_gan                                       = $15d2;
+  XK_Georgian_don                                       = $15d3;
+  XK_Georgian_en                                        = $15d4;
+  XK_Georgian_vin                                       = $15d5;
+  XK_Georgian_zen                                       = $15d6;
+  XK_Georgian_tan                                       = $15d7;
+  XK_Georgian_in                                        = $15d8;
+  XK_Georgian_kan                                       = $15d9;
+  XK_Georgian_las                                       = $15da;
+  XK_Georgian_man                                       = $15db;
+  XK_Georgian_nar                                       = $15dc;
+  XK_Georgian_on                                        = $15dd;
+  XK_Georgian_par                                       = $15de;
+  XK_Georgian_zhar                              = $15df;
+  XK_Georgian_rae                                       = $15e0;
+  XK_Georgian_san                                       = $15e1;
+  XK_Georgian_tar                                       = $15e2;
+  XK_Georgian_un                                        = $15e3;
+  XK_Georgian_phar                              = $15e4;
+  XK_Georgian_khar                              = $15e5;
+  XK_Georgian_ghan                              = $15e6;
+  XK_Georgian_qar                                       = $15e7;
+  XK_Georgian_shin                              = $15e8;
+  XK_Georgian_chin                              = $15e9;
+  XK_Georgian_can                                       = $15ea;
+  XK_Georgian_jil                                       = $15eb;
+  XK_Georgian_cil                                       = $15ec;
+  XK_Georgian_char                              = $15ed;
+  XK_Georgian_xan                                       = $15ee;
+  XK_Georgian_jhan                              = $15ef;
+  XK_Georgian_hae                                       = $15f0;
+  XK_Georgian_he                                        = $15f1;
+  XK_Georgian_hie                                       = $15f2;
+  XK_Georgian_we                                        = $15f3;
+  XK_Georgian_har                                       = $15f4;
+  XK_Georgian_hoe                                       = $15f5;
+  XK_Georgian_fi                                        = $15f6;
+{$ENDIF} { XK_GEORGIAN }
+
+{*
+ * Azeri (and other Turkic or Caucasian languages of ex-USSR)
+ * Byte 3 = = $16
+ *}
+
+{$IFDEF XK_CAUCASUS}
+{ latin }
+  XKc_Ccedillaabovedot  = $16a2;
+  XKc_Xabovedot         = $16a3;
+  XKc_Qabovedot         = $16a5;
+  XKc_Ibreve            = $16a6;
+  XKc_IE                        = $16a7;
+  XKc_UO                        = $16a8;
+  XKc_Zstroke           = $16a9;
+  XKc_Gcaron            = $16aa;
+  XKc_Obarred           = $16af;
+  XK_ccedillaabovedot   = $16b2;
+  XK_xabovedot          = $16b3;
+  XKc_Ocaron            = $16b4;
+  XK_qabovedot          = $16b5;
+  XK_ibreve             = $16b6;
+  XK_ie                 = $16b7;
+  XK_uo                 = $16b8;
+  XK_zstroke            = $16b9;
+  XK_gcaron             = $16ba;
+  XK_ocaron             = $16bd;
+  XK_obarred            = $16bf;
+  XKc_SCHWA             = $16c6;
+  XK_schwa              = $16f6;
+{ those are not really Caucasus, but I put them here for now }
+{ For Inupiak }
+  XKc_Lbelowdot         = $16d1;
+  XKc_Lstrokebelowdot   = $16d2;
+  XK_lbelowdot          = $16e1;
+  XK_lstrokebelowdot    = $16e2;
+{ For Guarani }
+  XKc_Gtilde            = $16d3;
+  XK_gtilde             = $16e3;
+{$ENDIF} { XK_CAUCASUS }
+
+{*
+ *   Vietnamese
+ *   Byte 3 = = $1e
+ *}
+
+{$IFDEF XK_VIETNAMESE}
+  XKc_Abelowdot                                 = $1ea0;
+  XK_abelowdot                                  = $1ea1;
+  XKc_Ahook                                     = $1ea2;
+  XK_ahook                                      = $1ea3;
+  XKc_Acircumflexacute                          = $1ea4;
+  XK_acircumflexacute                           = $1ea5;
+  XKc_Acircumflexgrave                          = $1ea6;
+  XK_acircumflexgrave                           = $1ea7;
+  XKc_Acircumflexhook                           = $1ea8;
+  XK_acircumflexhook                            = $1ea9;
+  XKc_Acircumflextilde                          = $1eaa;
+  XK_acircumflextilde                           = $1eab;
+  XKc_Acircumflexbelowdot                               = $1eac;
+  XK_acircumflexbelowdot                                = $1ead;
+  XKc_Abreveacute                                       = $1eae;
+  XK_abreveacute                                        = $1eaf;
+  XKc_Abrevegrave                                       = $1eb0;
+  XK_abrevegrave                                        = $1eb1;
+  XKc_Abrevehook                                        = $1eb2;
+  XK_abrevehook                                 = $1eb3;
+  XKc_Abrevetilde                                       = $1eb4;
+  XK_abrevetilde                                        = $1eb5;
+  XKc_Abrevebelowdot                            = $1eb6;
+  XK_abrevebelowdot                             = $1eb7;
+  XKc_Ebelowdot                                 = $1eb8;
+  XK_ebelowdot                                  = $1eb9;
+  XKc_Ehook                                     = $1eba;
+  XK_ehook                                      = $1ebb;
+  XKc_Etilde                                    = $1ebc;
+  XK_etilde                                     = $1ebd;
+  XKc_Ecircumflexacute                          = $1ebe;
+  XK_ecircumflexacute                           = $1ebf;
+  XKc_Ecircumflexgrave                          = $1ec0;
+  XK_ecircumflexgrave                           = $1ec1;
+  XKc_Ecircumflexhook                           = $1ec2;
+  XK_ecircumflexhook                            = $1ec3;
+  XKc_Ecircumflextilde                          = $1ec4;
+  XK_ecircumflextilde                           = $1ec5;
+  XKc_Ecircumflexbelowdot                               = $1ec6;
+  XK_ecircumflexbelowdot                                = $1ec7;
+  XKc_Ihook                                     = $1ec8;
+  XK_ihook                                      = $1ec9;
+  XKc_Ibelowdot                                 = $1eca;
+  XK_ibelowdot                                  = $1ecb;
+  XKc_Obelowdot                                 = $1ecc;
+  XK_obelowdot                                  = $1ecd;
+  XKc_Ohook                                     = $1ece;
+  XK_ohook                                      = $1ecf;
+  XKc_Ocircumflexacute                          = $1ed0;
+  XK_ocircumflexacute                           = $1ed1;
+  XKc_Ocircumflexgrave                          = $1ed2;
+  XK_ocircumflexgrave                           = $1ed3;
+  XKc_Ocircumflexhook                           = $1ed4;
+  XK_ocircumflexhook                            = $1ed5;
+  XKc_Ocircumflextilde                          = $1ed6;
+  XK_ocircumflextilde                           = $1ed7;
+  XKc_Ocircumflexbelowdot                               = $1ed8;
+  XK_ocircumflexbelowdot                                = $1ed9;
+  XKc_Ohornacute                                        = $1eda;
+  XK_ohornacute                                 = $1edb;
+  XKc_Ohorngrave                                        = $1edc;
+  XK_ohorngrave                                 = $1edd;
+  XKc_Ohornhook                                 = $1ede;
+  XK_ohornhook                                  = $1edf;
+  XKc_Ohorntilde                                        = $1ee0;
+  XK_ohorntilde                                 = $1ee1;
+  XKc_Ohornbelowdot                             = $1ee2;
+  XK_ohornbelowdot                              = $1ee3;
+  XKc_Ubelowdot                                 = $1ee4;
+  XK_ubelowdot                                  = $1ee5;
+  XKc_Uhook                                     = $1ee6;
+  XK_uhook                                      = $1ee7;
+  XKc_Uhornacute                                        = $1ee8;
+  XK_uhornacute                                 = $1ee9;
+  XKc_Uhorngrave                                        = $1eea;
+  XK_uhorngrave                                 = $1eeb;
+  XKc_Uhornhook                                 = $1eec;
+  XK_uhornhook                                  = $1eed;
+  XKc_Uhorntilde                                        = $1eee;
+  XK_uhorntilde                                 = $1eef;
+  XKc_Uhornbelowdot                             = $1ef0;
+  XK_uhornbelowdot                              = $1ef1;
+  XKc_Ybelowdot                                 = $1ef4;
+  XK_ybelowdot                                  = $1ef5;
+  XKc_Yhook                                     = $1ef6;
+  XK_yhook                                      = $1ef7;
+  XKc_Ytilde                                    = $1ef8;
+  XK_ytilde                                     = $1ef9;
+  XKc_Ohorn                                     = $1efa; { U+01a0 }
+  XK_ohorn                                      = $1efb; { U+01a1 }
+  XKc_Uhorn                                     = $1efc; { U+01af }
+  XK_uhorn                                      = $1efd; { U+01b0 }
+
+  XK_combining_tilde                            = $1e9f; { U+0303 }
+  XK_combining_grave                            = $1ef2; { U+0300 }
+  XK_combining_acute                            = $1ef3; { U+0301 }
+  XK_combining_hook                             = $1efe; { U+0309 }
+  XK_combining_belowdot                         = $1eff; { U+0323 }
+{$ENDIF} { XK_VIETNAMESE }
+
+{$IFDEF XK_CURRENCY}
+  XK_EcuSign                                    = $20a0;
+  XK_ColonSign                                  = $20a1;
+  XK_CruzeiroSign                                       = $20a2;
+  XK_FFrancSign                                 = $20a3;
+  XK_LiraSign                                   = $20a4;
+  XK_MillSign                                   = $20a5;
+  XK_NairaSign                                  = $20a6;
+  XK_PesetaSign                                 = $20a7;
+  XK_RupeeSign                                  = $20a8;
+  XK_WonSign                                    = $20a9;
+  XK_NewSheqelSign                              = $20aa;
+  XK_DongSign                                   = $20ab;
+  XK_EuroSign                                   = $20ac;
+{$ENDIF}
+Implementation
+End.

+ 74 - 0
packages/x11/src/randr.inc

@@ -0,0 +1,74 @@
+{*
+ * $XFree86: xc/include/extensions/randr.h,v 1.4 2001/11/24 07:24:58 keithp Exp $
+ *
+ * Copyright (C) 2000, Compaq Computer Corporation, 
+ * Copyright (C) 2002, Hewlett Packard, 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 Compaq or HP not be used in advertising
+ * or publicity pertaining to distribution of the software without specific,
+ * written prior permission.  HP makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ * HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HP
+ * 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.
+ *
+ * Author:  Jim Gettys, HP Labs, Hewlett-Packard, Inc.
+ *}
+
+type
+  PRotation      = ^TRotation;
+  TRotation      = cushort;
+  PSizeID        = ^TSizeID;
+  TSizeID        = cushort;
+  PSubpixelOrder = ^TSubpixelOrder;
+  TSubpixelOrder = cushort;
+
+const
+  RANDR_NAME                     = 'RANDR';
+  RANDR_MAJOR                    = 1;
+  RANDR_MINOR                    = 1;
+
+  RRNumberErrors                 = 0;
+  RRNumberEvents                 = 1;
+
+  X_RRQueryVersion               = 0;
+{ we skip 1 to make old clients fail pretty immediately }
+  X_RROldGetScreenInfo           = 1;
+  X_RR1_0SetScreenConfig         = 2;
+{ V1.0 apps share the same set screen config request id }
+  X_RRSetScreenConfig            = 2;
+  X_RROldScreenChangeSelectInput = 3;
+{ 3 used to be ScreenChangeSelectInput; deprecated }
+  X_RRSelectInput                = 4;
+  X_RRGetScreenInfo              = 5;
+
+{ used in XRRSelectInput }
+
+  RRScreenChangeNotifyMask       = 1 shl 0;
+
+  RRScreenChangeNotify           = 0;
+
+{ used in the rotation field; rotation and reflection in 0.1 proto. }
+  RR_Rotate_0                    = 1;
+  RR_Rotate_90                   = 2;
+  RR_Rotate_180                  = 4;
+  RR_Rotate_270                  = 8;
+
+{ new in 1.0 protocol, to allow reflection of screen }
+
+  RR_Reflect_X                   = 16;
+  RR_Reflect_Y                   = 32;
+
+  RRSetConfigSuccess             = 0;
+  RRSetConfigInvalidConfigTime   = 1;
+  RRSetConfigInvalidTime         = 2;
+  RRSetConfigFailed              = 3;

+ 432 - 0
packages/x11/src/x.pp

@@ -0,0 +1,432 @@
+unit x;
+interface
+uses
+  ctypes;
+
+{$ifndef os2}
+  {$LinkLib c}
+  {$LinkLib X11}
+{$endif}
+
+{
+  Automatically converted by H2Pas 0.99.15 from x.h
+  The following command line parameters were used:
+    -p
+    -T
+    -S
+    -d
+    -c
+    x.h
+}
+
+{ Pointers to basic pascal types, inserted by h2pas conversion program.}
+Type
+  PPLongint = ^PLongint;
+  PPByte    = ^PByte;
+  PPChar    = ^PChar;
+  PPPChar   = ^PPChar;
+  PPWideChar  = ^PWideChar;
+  PPPWideChar = ^PPWideChar;
+
+
+{$PACKRECORDS C}
+
+
+const
+   X_PROTOCOL = 11;
+   X_PROTOCOL_REVISION = 0;
+type
+
+   PXID = ^TXID;
+   TXID = culong;
+
+   PMask = ^TMask;
+   TMask = culong;
+
+   PPAtom = ^PAtom;
+   PAtom = ^TAtom;
+   TAtom = culong;
+
+   PVisualID = ^TVisualID;
+   TVisualID = culong;
+
+   PTime = ^TTime;
+   TTime = culong;
+
+   PPWindow = ^PWindow;
+   PWindow = ^TWindow;
+   TWindow = TXID;
+
+   PDrawable = ^TDrawable;
+   TDrawable = TXID;
+
+   PFont = ^TFont;
+   TFont = TXID;
+
+   PPixmap = ^TPixmap;
+   TPixmap = TXID;
+
+   PCursor = ^TCursor;
+   TCursor = TXID;
+
+   PColormap = ^TColormap;
+   TColormap = TXID;
+
+   PGContext = ^TGContext;
+   TGContext = TXID;
+
+   PKeySym = ^TKeySym;
+   TKeySym = TXID;
+
+   PKeyCode = ^TKeyCode;
+   TKeyCode = cuchar;
+
+const
+   None = 0;
+   ParentRelative = 1;
+   CopyFromParent = 0;
+   PointerWindow = 0;
+   InputFocus = 1;
+   PointerRoot = 1;
+   AnyPropertyType = 0;
+   AnyKey = 0;
+   AnyButton = 0;
+   AllTemporary = 0;
+   CurrentTime = 0;
+   NoSymbol = 0;
+   NoEventMask = 0;
+   KeyPressMask = 1 shl 0;
+   KeyReleaseMask = 1 shl 1;
+   ButtonPressMask = 1 shl 2;
+   ButtonReleaseMask = 1 shl 3;
+   EnterWindowMask = 1 shl 4;
+   LeaveWindowMask = 1 shl 5;
+   PointerMotionMask = 1 shl 6;
+   PointerMotionHintMask = 1 shl 7;
+   Button1MotionMask = 1 shl 8;
+   Button2MotionMask = 1 shl 9;
+   Button3MotionMask = 1 shl 10;
+   Button4MotionMask = 1 shl 11;
+   Button5MotionMask = 1 shl 12;
+   ButtonMotionMask = 1 shl 13;
+   KeymapStateMask = 1 shl 14;
+   ExposureMask = 1 shl 15;
+   VisibilityChangeMask = 1 shl 16;
+   StructureNotifyMask = 1 shl 17;
+   ResizeRedirectMask = 1 shl 18;
+   SubstructureNotifyMask = 1 shl 19;
+   SubstructureRedirectMask = 1 shl 20;
+   FocusChangeMask = 1 shl 21;
+   PropertyChangeMask = 1 shl 22;
+   ColormapChangeMask = 1 shl 23;
+   OwnerGrabButtonMask = 1 shl 24;
+   KeyPress = 2;
+   KeyRelease = 3;
+   ButtonPress = 4;
+   ButtonRelease = 5;
+   MotionNotify = 6;
+   EnterNotify = 7;
+   LeaveNotify = 8;
+   FocusIn = 9;
+   FocusOut = 10;
+   KeymapNotify = 11;
+   Expose = 12;
+   GraphicsExpose = 13;
+   NoExpose = 14;
+   VisibilityNotify = 15;
+   CreateNotify = 16;
+   DestroyNotify = 17;
+   UnmapNotify = 18;
+   MapNotify = 19;
+   MapRequest = 20;
+   ReparentNotify = 21;
+   ConfigureNotify = 22;
+   ConfigureRequest = 23;
+   GravityNotify = 24;
+   ResizeRequest = 25;
+   CirculateNotify = 26;
+   CirculateRequest = 27;
+   PropertyNotify = 28;
+   SelectionClear = 29;
+   SelectionRequest = 30;
+   SelectionNotify = 31;
+   ColormapNotify = 32;
+   ClientMessage = 33;
+   MappingNotify = 34;
+   LASTEvent = 35;
+   ShiftMask = 1 shl 0;
+   LockMask = 1 shl 1;
+   ControlMask = 1 shl 2;
+   Mod1Mask = 1 shl 3;
+   Mod2Mask = 1 shl 4;
+   Mod3Mask = 1 shl 5;
+   Mod4Mask = 1 shl 6;
+   Mod5Mask = 1 shl 7;
+   ShiftMapIndex = 0;
+   LockMapIndex = 1;
+   ControlMapIndex = 2;
+   Mod1MapIndex = 3;
+   Mod2MapIndex = 4;
+   Mod3MapIndex = 5;
+   Mod4MapIndex = 6;
+   Mod5MapIndex = 7;
+   Button1Mask = 1 shl 8;
+   Button2Mask = 1 shl 9;
+   Button3Mask = 1 shl 10;
+   Button4Mask = 1 shl 11;
+   Button5Mask = 1 shl 12;
+   AnyModifier = 1 shl 15;
+   Button1 = 1;
+   Button2 = 2;
+   Button3 = 3;
+   Button4 = 4;
+   Button5 = 5;
+   NotifyNormal = 0;
+   NotifyGrab = 1;
+   NotifyUngrab = 2;
+   NotifyWhileGrabbed = 3;
+   NotifyHint = 1;
+   NotifyAncestor = 0;
+   NotifyVirtual = 1;
+   NotifyInferior = 2;
+   NotifyNonlinear = 3;
+   NotifyNonlinearVirtual = 4;
+   NotifyPointer = 5;
+   NotifyPointerRoot = 6;
+   NotifyDetailNone = 7;
+   VisibilityUnobscured = 0;
+   VisibilityPartiallyObscured = 1;
+   VisibilityFullyObscured = 2;
+   PlaceOnTop = 0;
+   PlaceOnBottom = 1;
+   FamilyInternet = 0;
+   FamilyDECnet = 1;
+   FamilyChaos = 2;
+   FamilyInternet6 = 6;
+   FamilyServerInterpreted = 5;
+   PropertyNewValue = 0;
+   PropertyDelete = 1;
+   ColormapUninstalled = 0;
+   ColormapInstalled = 1;
+   GrabModeSync = 0;
+   GrabModeAsync = 1;
+   GrabSuccess = 0;
+   AlreadyGrabbed = 1;
+   GrabInvalidTime = 2;
+   GrabNotViewable = 3;
+   GrabFrozen = 4;
+   AsyncPointer = 0;
+   SyncPointer = 1;
+   ReplayPointer = 2;
+   AsyncKeyboard = 3;
+   SyncKeyboard = 4;
+   ReplayKeyboard = 5;
+   AsyncBoth = 6;
+   SyncBoth = 7;
+   RevertToNone = None;
+   RevertToPointerRoot = PointerRoot;
+   RevertToParent = 2;
+   Success = 0;
+   BadRequest = 1;
+   BadValue = 2;
+   BadWindow = 3;
+   BadPixmap = 4;
+   BadAtom = 5;
+   BadCursor = 6;
+   BadFont = 7;
+   BadMatch = 8;
+   BadDrawable = 9;
+   BadAccess = 10;
+   BadAlloc = 11;
+   BadColor = 12;
+   BadGC = 13;
+   BadIDChoice = 14;
+   BadName = 15;
+   BadLength = 16;
+   BadImplementation = 17;
+   FirstExtensionError = 128;
+   LastExtensionError = 255;
+   InputOutput = 1;
+   InputOnly = 2;
+   CWBackPixmap = 1 shl 0;
+   CWBackPixel = 1 shl 1;
+   CWBorderPixmap = 1 shl 2;
+   CWBorderPixel = 1 shl 3;
+   CWBitGravity = 1 shl 4;
+   CWWinGravity = 1 shl 5;
+   CWBackingStore = 1 shl 6;
+   CWBackingPlanes = 1 shl 7;
+   CWBackingPixel = 1 shl 8;
+   CWOverrideRedirect = 1 shl 9;
+   CWSaveUnder = 1 shl 10;
+   CWEventMask = 1 shl 11;
+   CWDontPropagate = 1 shl 12;
+   CWColormap = 1 shl 13;
+   CWCursor = 1 shl 14;
+   CWX = 1 shl 0;
+   CWY = 1 shl 1;
+   CWWidth = 1 shl 2;
+   CWHeight = 1 shl 3;
+   CWBorderWidth = 1 shl 4;
+   CWSibling = 1 shl 5;
+   CWStackMode = 1 shl 6;
+   ForgetGravity = 0;
+   NorthWestGravity = 1;
+   NorthGravity = 2;
+   NorthEastGravity = 3;
+   WestGravity = 4;
+   CenterGravity = 5;
+   EastGravity = 6;
+   SouthWestGravity = 7;
+   SouthGravity = 8;
+   SouthEastGravity = 9;
+   StaticGravity = 10;
+   UnmapGravity = 0;
+   NotUseful = 0;
+   WhenMapped = 1;
+   Always = 2;
+   IsUnmapped = 0;
+   IsUnviewable = 1;
+   IsViewable = 2;
+   SetModeInsert = 0;
+   SetModeDelete = 1;
+   DestroyAll = 0;
+   RetainPermanent = 1;
+   RetainTemporary = 2;
+   Above = 0;
+   Below = 1;
+   TopIf = 2;
+   BottomIf = 3;
+   Opposite = 4;
+   RaiseLowest = 0;
+   LowerHighest = 1;
+   PropModeReplace = 0;
+   PropModePrepend = 1;
+   PropModeAppend = 2;
+   GXclear = $0;
+   GXand = $1;
+   GXandReverse = $2;
+   GXcopy = $3;
+   GXandInverted = $4;
+   GXnoop = $5;
+   GXxor = $6;
+   GXor = $7;
+   GXnor = $8;
+   GXequiv = $9;
+   GXinvert = $a;
+   GXorReverse = $b;
+   GXcopyInverted = $c;
+   GXorInverted = $d;
+   GXnand = $e;
+   GXset = $f;
+   LineSolid = 0;
+   LineOnOffDash = 1;
+   LineDoubleDash = 2;
+   CapNotLast = 0;
+   CapButt = 1;
+   CapRound = 2;
+   CapProjecting = 3;
+   JoinMiter = 0;
+   JoinRound = 1;
+   JoinBevel = 2;
+   FillSolid = 0;
+   FillTiled = 1;
+   FillStippled = 2;
+   FillOpaqueStippled = 3;
+   EvenOddRule = 0;
+   WindingRule = 1;
+   ClipByChildren = 0;
+   IncludeInferiors = 1;
+   Unsorted = 0;
+   YSorted = 1;
+   YXSorted = 2;
+   YXBanded = 3;
+   CoordModeOrigin = 0;
+   CoordModePrevious = 1;
+   Complex = 0;
+   Nonconvex = 1;
+   Convex = 2;
+   ArcChord = 0;
+   ArcPieSlice = 1;
+   GCFunction = 1 shl 0;
+   GCPlaneMask = 1 shl 1;
+   GCForeground = 1 shl 2;
+   GCBackground = 1 shl 3;
+   GCLineWidth = 1 shl 4;
+   GCLineStyle = 1 shl 5;
+   GCCapStyle = 1 shl 6;
+   GCJoinStyle = 1 shl 7;
+   GCFillStyle = 1 shl 8;
+   GCFillRule = 1 shl 9;
+   GCTile = 1 shl 10;
+   GCStipple = 1 shl 11;
+   GCTileStipXOrigin = 1 shl 12;
+   GCTileStipYOrigin = 1 shl 13;
+   GCFont = 1 shl 14;
+   GCSubwindowMode = 1 shl 15;
+   GCGraphicsExposures = 1 shl 16;
+   GCClipXOrigin = 1 shl 17;
+   GCClipYOrigin = 1 shl 18;
+   GCClipMask = 1 shl 19;
+   GCDashOffset = 1 shl 20;
+   GCDashList = 1 shl 21;
+   GCArcMode = 1 shl 22;
+   GCLastBit = 22;
+   FontLeftToRight = 0;
+   FontRightToLeft = 1;
+   FontChange = 255;
+   XYBitmap = 0;
+   XYPixmap = 1;
+   ZPixmap = 2;
+   AllocNone = 0;
+   AllocAll = 1;
+   DoRed = 1 shl 0;
+   DoGreen = 1 shl 1;
+   DoBlue = 1 shl 2;
+   CursorShape = 0;
+   TileShape = 1;
+   StippleShape = 2;
+   AutoRepeatModeOff = 0;
+   AutoRepeatModeOn = 1;
+   AutoRepeatModeDefault = 2;
+   LedModeOff = 0;
+   LedModeOn = 1;
+   KBKeyClickPercent = 1 shl 0;
+   KBBellPercent = 1 shl 1;
+   KBBellPitch = 1 shl 2;
+   KBBellDuration = 1 shl 3;
+   KBLed = 1 shl 4;
+   KBLedMode = 1 shl 5;
+   KBKey = 1 shl 6;
+   KBAutoRepeatMode = 1 shl 7;
+   MappingSuccess = 0;
+   MappingBusy = 1;
+   MappingFailed = 2;
+   MappingModifier = 0;
+   MappingKeyboard = 1;
+   MappingPointer = 2;
+   DontPreferBlanking = 0;
+   PreferBlanking = 1;
+   DefaultBlanking = 2;
+   DisableScreenSaver = 0;
+   DisableScreenInterval = 0;
+   DontAllowExposures = 0;
+   AllowExposures = 1;
+   DefaultExposures = 2;
+   ScreenSaverReset = 0;
+   ScreenSaverActive = 1;
+   HostInsert = 0;
+   HostDelete = 1;
+   EnableAccess = 1;
+   DisableAccess = 0;
+   StaticGray = 0;
+   GrayScale = 1;
+   StaticColor = 2;
+   PseudoColor = 3;
+   TrueColor = 4;
+   DirectColor = 5;
+   LSBFirst = 0;
+   MSBFirst = 1;
+
+implementation
+end.

+ 88 - 0
packages/x11/src/xatom.pp

@@ -0,0 +1,88 @@
+{$PACKRECORDS C}
+{$MODE OBJFPC}
+
+unit xatom;
+interface
+uses X;
+
+{
+ THIS IS A GENERATED FILE
+
+ Do not change!  Changing this file implies a protocol change!
+}
+
+const
+        XA_PRIMARY             = TAtom ( 1);
+        XA_SECONDARY           = TAtom ( 2);
+        XA_ARC                 = TAtom ( 3);
+        XA_ATOM                = TAtom ( 4);
+        XA_BITMAP              = TAtom ( 5);
+        XA_CARDINAL            = TAtom ( 6);
+        XA_COLORMAP            = TAtom ( 7);
+        XA_CURSOR              = TAtom ( 8);
+        XA_CUT_BUFFER0         = TAtom ( 9);
+        XA_CUT_BUFFER1         = TAtom (10);
+        XA_CUT_BUFFER2         = TAtom (11);
+        XA_CUT_BUFFER3         = TAtom (12);
+        XA_CUT_BUFFER4         = TAtom (13);
+        XA_CUT_BUFFER5         = TAtom (14);
+        XA_CUT_BUFFER6         = TAtom (15);
+        XA_CUT_BUFFER7         = TAtom (16);
+        XA_DRAWABLE            = TAtom (17);
+        XA_FONT                = TAtom (18);
+        XA_INTEGER             = TAtom (19);
+        XA_PIXMAP              = TAtom (20);
+        XA_POINT               = TAtom (21);
+        XA_RECTANGLE           = TAtom (22);
+        XA_RESOURCE_MANAGER    = TAtom (23);
+        XA_RGB_COLOR_MAP       = TAtom (24);
+        XA_RGB_BEST_MAP        = TAtom (25);
+        XA_RGB_BLUE_MAP        = TAtom (26);
+        XA_RGB_DEFAULT_MAP     = TAtom (27);
+        XA_RGB_GRAY_MAP        = TAtom (28);
+        XA_RGB_GREEN_MAP       = TAtom (29);
+        XA_RGB_RED_MAP         = TAtom (30);
+        XA_STRING              = TAtom (31);
+        XA_VISUALID            = TAtom (32);
+        XA_WINDOW              = TAtom (33);
+        XA_WM_COMMAND          = TAtom (34);
+        XA_WM_HINTS            = TAtom (35);
+        XA_WM_CLIENT_MACHINE   = TAtom (36);
+        XA_WM_ICON_NAME        = TAtom (37);
+        XA_WM_ICON_SIZE        = TAtom (38);
+        XA_WM_NAME             = TAtom (39);
+        XA_WM_NORMAL_HINTS     = TAtom (40);
+        XA_WM_SIZE_HINTS       = TAtom (41);
+        XA_WM_ZOOM_HINTS       = TAtom (42);
+        XA_MIN_SPACE           = TAtom (43);
+        XA_NORM_SPACE          = TAtom (44);
+        XA_MAX_SPACE           = TAtom (45);
+        XA_END_SPACE           = TAtom (46);
+        XA_SUPERSCRIPT_X       = TAtom (47);
+        XA_SUPERSCRIPT_Y       = TAtom (48);
+        XA_SUBSCRIPT_X         = TAtom (49);
+        XA_SUBSCRIPT_Y         = TAtom (50);
+        XA_UNDERLINE_POSITION  = TAtom (51);
+        XA_UNDERLINE_THICKNESS = TAtom (52);
+        XA_STRIKEOUT_ASCENT    = TAtom (53);
+        XA_STRIKEOUT_DESCENT   = TAtom (54);
+        XA_ITALIC_ANGLE        = TAtom (55);
+        XA_X_HEIGHT            = TAtom (56);
+        XA_QUAD_WIDTH          = TAtom (57);
+        XA_WEIGHT              = TAtom (58);
+        XA_POINT_SIZE          = TAtom (59);
+        XA_RESOLUTION          = TAtom (60);
+        XA_COPYRIGHT           = TAtom (61);
+        XA_NOTICE              = TAtom (62);
+        XA_FONT_NAME           = TAtom (63);
+        XA_FAMILY_NAME         = TAtom (64);
+        XA_FULL_NAME           = TAtom (65);
+        XA_CAP_HEIGHT          = TAtom (66);
+        XA_WM_CLASS            = TAtom (67);
+        XA_WM_TRANSIENT_FOR    = TAtom (68);
+
+        XA_LAST_PREDEFINED     = TAtom (68);
+
+implementation
+
+end.

+ 378 - 0
packages/x11/src/xcms.pp

@@ -0,0 +1,378 @@
+unit xcms;
+interface
+uses
+  x,xlib;
+
+{$ifndef os2}
+  {$LinkLib c}
+  {$LinkLib X11}
+const
+  libX11='X11';
+{$else}
+const
+  libX11='X11';
+{$endif}
+
+{
+  Automatically converted by H2Pas 0.99.15 from xcms.h
+  The following command line parameters were used:
+    -p
+    -T
+    -S
+    -d
+    -c
+    xcms.h
+}
+
+
+{$PACKRECORDS C}
+
+
+const
+   XcmsFailure = 0;
+   XcmsSuccess = 1;
+   XcmsSuccessWithCompression = 2;
+type
+   PXcmsColorFormat = ^TXcmsColorFormat;
+   TXcmsColorFormat = dword;
+function XcmsUndefinedFormat : TXcmsColorFormat;
+
+function XcmsCIEXYZFormat : TXcmsColorFormat;
+
+function XcmsCIEuvYFormat : TXcmsColorFormat;
+
+function XcmsCIExyYFormat : TXcmsColorFormat;
+
+function XcmsCIELabFormat : TXcmsColorFormat;
+
+function XcmsCIELuvFormat : TXcmsColorFormat;
+
+function XcmsTekHVCFormat : TXcmsColorFormat;
+
+function XcmsRGBFormat : TXcmsColorFormat;
+
+function XcmsRGBiFormat : TXcmsColorFormat;
+
+
+const
+   XcmsInitNone = $00;
+   XcmsInitSuccess = $01;
+   XcmsInitFailure = $ff;
+{$ifdef MACROS}
+function DisplayOfCCC(ccc : longint) : longint;
+
+function ScreenNumberOfCCC(ccc : longint) : longint;
+
+function VisualOfCCC(ccc : longint) : longint;
+
+function ClientWhitePointOfCCC(ccc : longint) : longint;
+
+function ScreenWhitePointOfCCC(ccc : longint) : longint;
+
+function FunctionSetOfCCC(ccc : longint) : longint;
+{$endif MACROS}
+
+type
+
+   PXcmsFloat = ^TXcmsFloat;
+   TXcmsFloat = double;
+
+   PXcmsRGB = ^TXcmsRGB;
+   TXcmsRGB = record
+        red : word;
+        green : word;
+        blue : word;
+     end;
+
+   PXcmsRGBi = ^TXcmsRGBi;
+   TXcmsRGBi = record
+        red : TXcmsFloat;
+        green : TXcmsFloat;
+        blue : TXcmsFloat;
+     end;
+
+   PXcmsCIEXYZ = ^TXcmsCIEXYZ;
+   TXcmsCIEXYZ = record
+        X : TXcmsFloat;
+        Y : TXcmsFloat;
+        Z : TXcmsFloat;
+     end;
+
+   PXcmsCIEuvY = ^TXcmsCIEuvY;
+   TXcmsCIEuvY = record
+        u_prime : TXcmsFloat;
+        v_prime : TXcmsFloat;
+        Y : TXcmsFloat;
+     end;
+
+   PXcmsCIExyY = ^TXcmsCIExyY;
+   TXcmsCIExyY = record
+        x : TXcmsFloat;
+        y : TXcmsFloat;
+        _Y : TXcmsFloat;
+     end;
+
+   PXcmsCIELab = ^TXcmsCIELab;
+   TXcmsCIELab = record
+        L_star : TXcmsFloat;
+        a_star : TXcmsFloat;
+        b_star : TXcmsFloat;
+     end;
+
+   PXcmsCIELuv = ^TXcmsCIELuv;
+   TXcmsCIELuv = record
+        L_star : TXcmsFloat;
+        u_star : TXcmsFloat;
+        v_star : TXcmsFloat;
+     end;
+
+   PXcmsTekHVC = ^TXcmsTekHVC;
+   TXcmsTekHVC = record
+        H : TXcmsFloat;
+        V : TXcmsFloat;
+        C : TXcmsFloat;
+     end;
+
+   PXcmsPad = ^TXcmsPad;
+   TXcmsPad = record
+        pad0 : TXcmsFloat;
+        pad1 : TXcmsFloat;
+        pad2 : TXcmsFloat;
+        pad3 : TXcmsFloat;
+     end;
+
+   PXcmsColor = ^TXcmsColor;
+   TXcmsColor = record
+        spec : record
+            case longint of
+               0 : ( RGB : TXcmsRGB );
+               1 : ( RGBi : TXcmsRGBi );
+               2 : ( CIEXYZ : TXcmsCIEXYZ );
+               3 : ( CIEuvY : TXcmsCIEuvY );
+               4 : ( CIExyY : TXcmsCIExyY );
+               5 : ( CIELab : TXcmsCIELab );
+               6 : ( CIELuv : TXcmsCIELuv );
+               7 : ( TekHVC : TXcmsTekHVC );
+               8 : ( Pad : TXcmsPad );
+            end;
+        pixel : dword;
+        format : TXcmsColorFormat;
+     end;
+
+   PXcmsPerScrnInfo = ^TXcmsPerScrnInfo;
+   TXcmsPerScrnInfo = record
+        screenWhitePt : TXcmsColor;
+        functionSet : TXPointer;
+        screenData : TXPointer;
+        state : byte;
+        pad : array[0..2] of char;
+     end;
+
+   PXcmsCCC = ^TXcmsCCC;
+
+   TXcmsCompressionProc = function (para1:PXcmsCCC; para2:PXcmsColor; para3:dword; para4:dword; para5:PBool):TStatus;cdecl;
+
+   TXcmsWhiteAdjustProc = function (para1:PXcmsCCC; para2:PXcmsColor; para3:PXcmsColor; para4:TXcmsColorFormat; para5:PXcmsColor;
+                para6:dword; para7:PBool):TStatus;cdecl;
+
+   TXcmsCCC = record
+        dpy : PDisplay;
+        screenNumber : longint;
+        visual : PVisual;
+        clientWhitePt : TXcmsColor;
+        gamutCompProc : TXcmsCompressionProc;
+        gamutCompClientData : TXPointer;
+        whitePtAdjProc : TXcmsWhiteAdjustProc;
+        whitePtAdjClientData : TXPointer;
+        pPerScrnInfo : PXcmsPerScrnInfo;
+     end;
+   TXcmsCCCRec = TXcmsCCC;
+   PXcmsCCCRec = ^TXcmsCCCRec;
+
+   TXcmsScreenInitProc = function (para1:PDisplay; para2:longint; para3:PXcmsPerScrnInfo):TStatus;cdecl;
+
+   TXcmsScreenFreeProc = procedure (para1:TXPointer);cdecl;
+
+   TXcmsConversionProc = procedure;cdecl;
+
+       PXcmsFuncListPtr = ^TXcmsFuncListPtr;
+       TXcmsFuncListPtr = TXcmsConversionProc;
+
+       TXcmsParseStringProc = function (para1:Pchar; para2:PXcmsColor):longint;cdecl;
+
+       PXcmsColorSpace = ^TXcmsColorSpace;
+       TXcmsColorSpace = record
+            prefix : Pchar;
+            id : TXcmsColorFormat;
+            parseString : TXcmsParseStringProc;
+            to_CIEXYZ : TXcmsFuncListPtr;
+            from_CIEXYZ : TXcmsFuncListPtr;
+            inverse_flag : longint;
+         end;
+
+       PXcmsFunctionSet = ^TXcmsFunctionSet;
+       TXcmsFunctionSet = record
+            DDColorSpaces : ^PXcmsColorSpace;
+            screenInitProc : TXcmsScreenInitProc;
+            screenFreeProc : TXcmsScreenFreeProc;
+         end;
+(* error
+extern Status XcmsAddColorSpace (
+in declaration at line 323 *)
+
+function XcmsAddFunctionSet(para1:PXcmsFunctionSet):TStatus;cdecl;external libX11;
+function XcmsAllocColor(para1:PDisplay; para2:TColormap; para3:PXcmsColor; para4:TXcmsColorFormat):TStatus;cdecl;external libX11;
+function XcmsAllocNamedColor(para1:PDisplay; para2:TColormap; para3:Pchar; para4:PXcmsColor; para5:PXcmsColor;
+               para6:TXcmsColorFormat):TStatus;cdecl;external libX11;
+function XcmsCCCOfColormap(para1:PDisplay; para2:TColormap):TXcmsCCC;cdecl;external libX11;
+function XcmsCIELabClipab(para1:TXcmsCCC; para2:PXcmsColor; para3:dword; para4:dword; para5:PBool):TStatus;cdecl;external libX11;
+function XcmsCIELabClipL(para1:TXcmsCCC; para2:PXcmsColor; para3:dword; para4:dword; para5:PBool):TStatus;cdecl;external libX11;
+function XcmsCIELabClipLab(para1:TXcmsCCC; para2:PXcmsColor; para3:dword; para4:dword; para5:PBool):TStatus;cdecl;external libX11;
+function XcmsCIELabQueryMaxC(para1:TXcmsCCC; para2:TXcmsFloat; para3:TXcmsFloat; para4:PXcmsColor):TStatus;cdecl;external libX11;
+function XcmsCIELabQueryMaxL(para1:TXcmsCCC; para2:TXcmsFloat; para3:TXcmsFloat; para4:PXcmsColor):TStatus;cdecl;external libX11;
+function XcmsCIELabQueryMaxLC(para1:TXcmsCCC; para2:TXcmsFloat; para3:PXcmsColor):TStatus;cdecl;external libX11;
+function XcmsCIELabQueryMinL(para1:TXcmsCCC; para2:TXcmsFloat; para3:TXcmsFloat; para4:PXcmsColor):TStatus;cdecl;external libX11;
+function XcmsCIELabToCIEXYZ(para1:TXcmsCCC; para2:PXcmsColor; para3:PXcmsColor; para4:dword):TStatus;cdecl;external libX11;
+function XcmsCIELabWhiteShiftColors(para1:TXcmsCCC; para2:PXcmsColor; para3:PXcmsColor; para4:TXcmsColorFormat; para5:PXcmsColor;
+               para6:dword; para7:PBool):TStatus;cdecl;external libX11;
+function XcmsCIELuvClipL(para1:TXcmsCCC; para2:PXcmsColor; para3:dword; para4:dword; para5:PBool):TStatus;cdecl;external libX11;
+function XcmsCIELuvClipLuv(para1:TXcmsCCC; para2:PXcmsColor; para3:dword; para4:dword; para5:PBool):TStatus;cdecl;external libX11;
+function XcmsCIELuvClipuv(para1:TXcmsCCC; para2:PXcmsColor; para3:dword; para4:dword; para5:PBool):TStatus;cdecl;external libX11;
+function XcmsCIELuvQueryMaxC(para1:TXcmsCCC; para2:TXcmsFloat; para3:TXcmsFloat; para4:PXcmsColor):TStatus;cdecl;external libX11;
+function XcmsCIELuvQueryMaxL(para1:TXcmsCCC; para2:TXcmsFloat; para3:TXcmsFloat; para4:PXcmsColor):TStatus;cdecl;external libX11;
+function XcmsCIELuvQueryMaxLC(para1:TXcmsCCC; para2:TXcmsFloat; para3:PXcmsColor):TStatus;cdecl;external libX11;
+function XcmsCIELuvQueryMinL(para1:TXcmsCCC; para2:TXcmsFloat; para3:TXcmsFloat; para4:PXcmsColor):TStatus;cdecl;external libX11;
+function XcmsCIELuvToCIEuvY(para1:TXcmsCCC; para2:PXcmsColor; para3:PXcmsColor; para4:dword):TStatus;cdecl;external libX11;
+function XcmsCIELuvWhiteShiftColors(para1:TXcmsCCC; para2:PXcmsColor; para3:PXcmsColor; para4:TXcmsColorFormat; para5:PXcmsColor;
+               para6:dword; para7:PBool):TStatus;cdecl;external libX11;
+function XcmsCIEXYZToCIELab(para1:TXcmsCCC; para2:PXcmsColor; para3:PXcmsColor; para4:dword):TStatus;cdecl;external libX11;
+function XcmsCIEXYZToCIEuvY(para1:TXcmsCCC; para2:PXcmsColor; para3:PXcmsColor; para4:dword):TStatus;cdecl;external libX11;
+function XcmsCIEXYZToCIExyY(para1:TXcmsCCC; para2:PXcmsColor; para3:PXcmsColor; para4:dword):TStatus;cdecl;external libX11;
+function XcmsCIEXYZToRGBi(para1:TXcmsCCC; para2:PXcmsColor; para3:dword; para4:PBool):TStatus;cdecl;external libX11;
+function XcmsCIEuvYToCIELuv(para1:TXcmsCCC; para2:PXcmsColor; para3:PXcmsColor; para4:dword):TStatus;cdecl;external libX11;
+function XcmsCIEuvYToCIEXYZ(para1:TXcmsCCC; para2:PXcmsColor; para3:PXcmsColor; para4:dword):TStatus;cdecl;external libX11;
+function XcmsCIEuvYToTekHVC(para1:TXcmsCCC; para2:PXcmsColor; para3:PXcmsColor; para4:dword):TStatus;cdecl;external libX11;
+function XcmsCIExyYToCIEXYZ(para1:TXcmsCCC; para2:PXcmsColor; para3:PXcmsColor; para4:dword):TStatus;cdecl;external libX11;
+function XcmsClientWhitePointOfCCC(para1:TXcmsCCC):PXcmsColor;cdecl;external libX11;
+function XcmsConvertColors(para1:TXcmsCCC; para2:PXcmsColor; para3:dword; para4:TXcmsColorFormat; para5:PBool):TStatus;cdecl;external libX11;
+function XcmsCreateCCC(para1:PDisplay; para2:longint; para3:PVisual; para4:PXcmsColor; para5:TXcmsCompressionProc;
+               para6:TXPointer; para7:TXcmsWhiteAdjustProc; para8:TXPointer):TXcmsCCC;cdecl;external libX11;
+function XcmsDefaultCCC(para1:PDisplay; para2:longint):TXcmsCCC;cdecl;external libX11;
+function XcmsDisplayOfCCC(para1:TXcmsCCC):PDisplay;cdecl;external libX11;
+function XcmsFormatOfPrefix(para1:Pchar):TXcmsColorFormat;cdecl;external libX11;
+procedure XcmsFreeCCC(para1:TXcmsCCC);cdecl;external libX11;
+function XcmsLookupColor(para1:PDisplay; para2:TColormap; para3:Pchar; para4:PXcmsColor; para5:PXcmsColor;
+               para6:TXcmsColorFormat):TStatus;cdecl;external libX11;
+function XcmsPrefixOfFormat(para1:TXcmsColorFormat):Pchar;cdecl;external libX11;
+function XcmsQueryBlack(para1:TXcmsCCC; para2:TXcmsColorFormat; para3:PXcmsColor):TStatus;cdecl;external libX11;
+function XcmsQueryBlue(para1:TXcmsCCC; para2:TXcmsColorFormat; para3:PXcmsColor):TStatus;cdecl;external libX11;
+function XcmsQueryColor(para1:PDisplay; para2:TColormap; para3:PXcmsColor; para4:TXcmsColorFormat):TStatus;cdecl;external libX11;
+function XcmsQueryColors(para1:PDisplay; para2:TColormap; para3:PXcmsColor; para4:dword; para5:TXcmsColorFormat):TStatus;cdecl;external libX11;
+function XcmsQueryGreen(para1:TXcmsCCC; para2:TXcmsColorFormat; para3:PXcmsColor):TStatus;cdecl;external libX11;
+function XcmsQueryRed(para1:TXcmsCCC; para2:TXcmsColorFormat; para3:PXcmsColor):TStatus;cdecl;external libX11;
+function XcmsQueryWhite(para1:TXcmsCCC; para2:TXcmsColorFormat; para3:PXcmsColor):TStatus;cdecl;external libX11;
+function XcmsRGBiToCIEXYZ(para1:TXcmsCCC; para2:PXcmsColor; para3:dword; para4:PBool):TStatus;cdecl;external libX11;
+function XcmsRGBiToRGB(para1:TXcmsCCC; para2:PXcmsColor; para3:dword; para4:PBool):TStatus;cdecl;external libX11;
+function XcmsRGBToRGBi(para1:TXcmsCCC; para2:PXcmsColor; para3:dword; para4:PBool):TStatus;cdecl;external libX11;
+function XcmsScreenNumberOfCCC(para1:TXcmsCCC):longint;cdecl;external libX11;
+function XcmsScreenWhitePointOfCCC(para1:TXcmsCCC):PXcmsColor;cdecl;external libX11;
+function XcmsSetCCCOfColormap(para1:PDisplay; para2:TColormap; para3:TXcmsCCC):TXcmsCCC;cdecl;external libX11;
+function XcmsSetCompressionProc(para1:TXcmsCCC; para2:TXcmsCompressionProc; para3:TXPointer):TXcmsCompressionProc;cdecl;external libX11;
+function XcmsSetWhiteAdjustProc(para1:TXcmsCCC; para2:TXcmsWhiteAdjustProc; para3:TXPointer):TXcmsWhiteAdjustProc;cdecl;external libX11;
+function XcmsSetWhitePoint(para1:TXcmsCCC; para2:PXcmsColor):TStatus;cdecl;external libX11;
+function XcmsStoreColor(para1:PDisplay; para2:TColormap; para3:PXcmsColor):TStatus;cdecl;external libX11;
+function XcmsStoreColors(para1:PDisplay; para2:TColormap; para3:PXcmsColor; para4:dword; para5:PBool):TStatus;cdecl;external libX11;
+function XcmsTekHVCClipC(para1:TXcmsCCC; para2:PXcmsColor; para3:dword; para4:dword; para5:PBool):TStatus;cdecl;external libX11;
+function XcmsTekHVCClipV(para1:TXcmsCCC; para2:PXcmsColor; para3:dword; para4:dword; para5:PBool):TStatus;cdecl;external libX11;
+function XcmsTekHVCClipVC(para1:TXcmsCCC; para2:PXcmsColor; para3:dword; para4:dword; para5:PBool):TStatus;cdecl;external libX11;
+function XcmsTekHVCQueryMaxC(para1:TXcmsCCC; para2:TXcmsFloat; para3:TXcmsFloat; para4:PXcmsColor):TStatus;cdecl;external libX11;
+function XcmsTekHVCQueryMaxV(para1:TXcmsCCC; para2:TXcmsFloat; para3:TXcmsFloat; para4:PXcmsColor):TStatus;cdecl;external libX11;
+function XcmsTekHVCQueryMaxVC(para1:TXcmsCCC; para2:TXcmsFloat; para3:PXcmsColor):TStatus;cdecl;external libX11;
+function XcmsTekHVCQueryMaxVSamples(para1:TXcmsCCC; para2:TXcmsFloat; para3:PXcmsColor; para4:dword):TStatus;cdecl;external libX11;
+function XcmsTekHVCQueryMinV(para1:TXcmsCCC; para2:TXcmsFloat; para3:TXcmsFloat; para4:PXcmsColor):TStatus;cdecl;external libX11;
+function XcmsTekHVCToCIEuvY(para1:TXcmsCCC; para2:PXcmsColor; para3:PXcmsColor; para4:dword):TStatus;cdecl;external libX11;
+function XcmsTekHVCWhiteShiftColors(para1:TXcmsCCC; para2:PXcmsColor; para3:PXcmsColor; para4:TXcmsColorFormat; para5:PXcmsColor;
+               para6:dword; para7:PBool):TStatus;cdecl;external libX11;
+function XcmsVisualOfCCC(para1:TXcmsCCC):PVisual;cdecl;external libX11;
+
+
+implementation
+
+function XcmsUndefinedFormat : TXcmsColorFormat;
+  begin
+     XcmsUndefinedFormat:=TXcmsColorFormat($00000000);
+  end;
+
+function XcmsCIEXYZFormat : TXcmsColorFormat;
+  begin
+     XcmsCIEXYZFormat:=TXcmsColorFormat($00000001);
+  end;
+
+function XcmsCIEuvYFormat : TXcmsColorFormat;
+  begin
+     XcmsCIEuvYFormat:=TXcmsColorFormat($00000002);
+  end;
+
+function XcmsCIExyYFormat : TXcmsColorFormat;
+  begin
+     XcmsCIExyYFormat:=TXcmsColorFormat($00000003);
+  end;
+
+function XcmsCIELabFormat : TXcmsColorFormat;
+  begin
+     XcmsCIELabFormat:=TXcmsColorFormat($00000004);
+  end;
+
+function XcmsCIELuvFormat : TXcmsColorFormat;
+  begin
+     XcmsCIELuvFormat:=TXcmsColorFormat($00000005);
+  end;
+
+function XcmsTekHVCFormat : TXcmsColorFormat;
+  begin
+     XcmsTekHVCFormat:=TXcmsColorFormat($00000006);
+  end;
+
+function XcmsRGBFormat : TXcmsColorFormat;
+  begin
+     XcmsRGBFormat:=TXcmsColorFormat($80000000);
+  end;
+
+function XcmsRGBiFormat : TXcmsColorFormat;
+  begin
+     XcmsRGBiFormat:=TXcmsColorFormat($80000001);
+  end;
+
+{$ifdef MACROS}
+function DisplayOfCCC(ccc : longint) : longint;
+begin
+   DisplayOfCCC:=ccc^.dpy;
+end;
+
+function ScreenNumberOfCCC(ccc : longint) : longint;
+begin
+   ScreenNumberOfCCC:=ccc^.screenNumber;
+end;
+
+function VisualOfCCC(ccc : longint) : longint;
+begin
+   VisualOfCCC:=ccc^.visual;
+end;
+
+function ClientWhitePointOfCCC(ccc : longint) : longint;
+begin
+   ClientWhitePointOfCCC:=@(ccc^.clientWhitePt);
+end;
+
+function ScreenWhitePointOfCCC(ccc : longint) : longint;
+begin
+   ScreenWhitePointOfCCC:=@(ccc^.(pPerScrnInfo^.screenWhitePt));
+end;
+
+function FunctionSetOfCCC(ccc : longint) : longint;
+begin
+   FunctionSetOfCCC:=ccc^.(pPerScrnInfo^.functionSet);
+end;
+{$endif MACROS}
+
+end.

+ 279 - 0
packages/x11/src/xf86dga.pp

@@ -0,0 +1,279 @@
+{
+   Copyright (c) 1999  XFree86 Inc
+}
+{ $XFree86: xc/include/extensions/xf86dga.h,v 3.20 1999/10/13 04:20:48 dawes Exp $ }
+
+Unit xf86dga;
+
+{$PACKRECORDS C}
+
+Interface
+
+Uses
+  ctypes, x, xlib;
+
+Const
+  libXxf86dga='Xxf86dga';
+
+Type
+  cfloat = Single;
+
+{$linklib Xext}
+
+{$INCLUDE xf86dga1.inc}
+
+Const
+  X_XDGAQueryVersion           = 0;
+
+{ 1 through 9 are in xf86dga1.pp }
+
+{ 10 and 11 are reserved to avoid conflicts with rogue DGA extensions }
+
+  X_XDGAQueryModes            = 12;
+  X_XDGASetMode               = 13;
+  X_XDGASetViewport           = 14;
+  X_XDGAInstallColormap       = 15;
+  X_XDGASelectInput           = 16;
+  X_XDGAFillRectangle         = 17;
+  X_XDGACopyArea              = 18;
+  X_XDGACopyTransparentArea   = 19;
+  X_XDGAGetViewportStatus     = 20;
+  X_XDGASync                  = 21;
+  X_XDGAOpenFramebuffer       = 22;
+  X_XDGACloseFramebuffer      = 23;
+  X_XDGASetClientVersion      = 24;
+  X_XDGAChangePixmapMode      = 25;
+  X_XDGACreateColormap        = 26;
+
+
+  XDGAConcurrentAccess = $00000001;
+  XDGASolidFillRect    = $00000002;
+  XDGABlitRect         = $00000004;
+  XDGABlitTransRect    = $00000008;
+  XDGAPixmap           = $00000010;
+
+  XDGAInterlaced       = $00010000;
+  XDGADoublescan       = $00020000;
+
+  XDGAFlipImmediate    = $00000001;
+  XDGAFlipRetrace      = $00000002;
+
+  XDGANeedRoot         = $00000001;
+
+  XF86DGANumberEvents          = 7;
+
+  XDGAPixmapModeLarge          = 0;
+  XDGAPixmapModeSmall          = 1;
+
+  XF86DGAClientNotLocal        = 0;
+  XF86DGANoDirectVideoMode     = 1;
+  XF86DGAScreenNotActive       = 2;
+  XF86DGADirectNotActivated    = 3;
+  XF86DGAOperationNotSupported = 4;
+  XF86DGANumberErrors          = (XF86DGAOperationNotSupported + 1);
+
+Type
+  PXDGAMode = ^TXDGAMode;
+  TXDGAMode = Record
+    num : cint;                 { A unique identifier for the mode (num > 0) }
+    name : PChar;               { name of mode given in the XF86Config }
+    verticalRefresh : cfloat;
+    flags : cint;               { DGA_CONCURRENT_ACCESS, etc... }
+    imageWidth : cint;          { linear accessible portion (pixels) }
+    imageHeight : cint;
+    pixmapWidth : cint;         { Xlib accessible portion (pixels) }
+    pixmapHeight : cint;        { both fields ignored if no concurrent access }
+    bytesPerScanline : cint;
+    byteOrder : cint;           { MSBFirst, LSBFirst }
+    depth : cint;
+    bitsPerPixel : cint;
+    redMask : culong;
+    greenMask : culong;
+    blueMask : culong;
+    visualClass : cshort;
+    viewportWidth : cint;
+    viewportHeight : cint;
+    xViewportStep : cint;       { viewport position granularity }
+    yViewportStep : cint;
+    maxViewportX : cint;        { max viewport origin }
+    maxViewportY : cint;
+    viewportFlags : cint;       { types of page flipping possible }
+    reserved1 : cint;
+    reserved2 : cint;
+  End;
+
+  PXDGADevice = ^TXDGADevice;
+  TXDGADevice = Record
+    mode : TXDGAMode;
+    data : Pcuchar;
+    pixmap : TPixmap;
+  End;
+
+  PXDGAButtonEvent = ^TXDGAButtonEvent;
+  TXDGAButtonEvent = Record
+    _type : cint;
+    serial : culong;
+    display : PDisplay;
+    screen : cint;
+    time : TTime;
+    state : cuint;
+    button : cuint;
+  End;
+
+  PXDGAKeyEvent = ^TXDGAKeyEvent;
+  TXDGAKeyEvent = Record
+    _type : cint;
+    serial : culong;
+    display : PDisplay;
+    screen : cint;
+    time : TTime;
+    state : cuint;
+    keycode : cuint;
+  End;
+
+  PXDGAMotionEvent = ^TXDGAMotionEvent;
+  TXDGAMotionEvent = Record
+    _type : cint;
+    serial : culong;
+    display : PDisplay;
+    screen : cint;
+    time : TTime;
+    state : cuint;
+    dx : cint;
+    dy : cint;
+  End;
+
+  PXDGAEvent = ^TXDGAEvent;
+  TXDGAEvent = Record
+    Case LongInt Of
+      0 : (_type : cint);
+      1 : (xbutton : TXDGAButtonEvent);
+      2 : (xkey : TXDGAKeyEvent);
+      3 : (xmotion : TXDGAMotionEvent);
+      4 : (pad : Array[0..23] Of clong);
+  End;
+
+Function XDGAQueryExtension(
+    dpy : PDisplay;
+    eventBase : Pcint;
+    erroBase : Pcint
+  ) : TBool; CDecl; External libXxf86dga;
+
+Function XDGAQueryVersion(
+    dpy : PDisplay;
+    majorVersion : Pcint;
+    minorVersion : Pcint
+  ) : TBool; CDecl; External libXxf86dga;
+
+Function XDGAQueryModes(
+    dpy : PDisplay;
+    screen : cint;
+    num : Pcint
+  ) : PXDGAMode; CDecl; External libXxf86dga;
+
+Function XDGASetMode(
+    dpy : PDisplay;
+    screen : cint;
+    mode : cint
+  ) : PXDGADevice; CDecl; External libXxf86dga;
+
+Function XDGAOpenFramebuffer(
+    dpy : PDisplay;
+    screen : cint
+  ) : TBool; CDecl; External libXxf86dga;
+
+Procedure XDGACloseFramebuffer(
+    dpy : PDisplay;
+    screen : cint
+  ); CDecl; External libXxf86dga;
+
+Procedure XDGASetViewport(
+    dpy : PDisplay;
+    screen : cint;
+    x : cint;
+    y : cint;
+    flags : cint
+  ); CDecl; External libXxf86dga;
+
+Procedure XDGAInstallColormap(
+    dpy : PDisplay;
+    screen : cint;
+    cmap : TColormap
+  ); CDecl; External libXxf86dga;
+
+Function XDGACreateColormap(
+    dpy : PDisplay;
+    screen : cint;
+    device : PXDGADevice;
+    alloc : cint
+  ) : TColormap; CDecl; External libXxf86dga;
+
+Procedure XDGASelectInput(
+    dpy : PDisplay;
+    screen : cint;
+    event_mask : clong
+  ); CDecl; External libXxf86dga;
+
+Procedure XDGAFillRectangle(
+    dpy : PDisplay;
+    screen : cint;
+    x : cint;
+    y : cint;
+    width : cuint;
+    height : cuint;
+    color : culong
+  ); CDecl; External libXxf86dga;
+
+Procedure XDGACopyArea(
+    dpy : PDisplay;
+    screen : cint;
+    srcx : cint;
+    srcy : cint;
+    width : cuint;
+    height : cuint;
+    dstx : cint;
+    dsty : cint
+  ); CDecl; External libXxf86dga;
+
+Procedure XDGACopyTransparentArea(
+    dpy : PDisplay;
+    screen : cint;
+    srcx : cint;
+    srcy : cint;
+    width : cuint;
+    height : cuint;
+    dstx : cint;
+    dsty : cint;
+    key : culong
+  ); CDecl; External libXxf86dga;
+
+Function XDGAGetViewportStatus(
+    dpy : PDisplay;
+    screen : cint
+  ) : cint; CDecl; External libXxf86dga;
+
+Procedure XDGASync(
+    dpy : PDisplay;
+    screen : cint
+  ); CDecl; External libXxf86dga;
+
+Function XDGASetClientVersion(
+    dpy : PDisplay
+  ) : TBool; CDecl; External libXxf86dga;
+
+Procedure XDGAChangePixmapMode(
+    dpy : PDisplay;
+    screen : cint;
+    x : Pcint;
+    y : Pcint;
+    mode : cint
+  ); CDecl; External libXxf86dga;
+
+Procedure XDGAKeyEventToXKeyEvent(
+    dk : PXDGAKeyEvent;
+    xk : PXKeyEvent
+  ); CDecl; External libXxf86dga;
+
+Implementation
+
+End.

+ 125 - 0
packages/x11/src/xf86dga1.inc

@@ -0,0 +1,125 @@
+{ $XFree86: xc/include/extensions/xf86dga1.h,v 1.2 1999/04/17 07:05:41 dawes Exp $ }
+{
+
+Copyright (c) 1995  Jon Tombs
+Copyright (c) 1995  XFree86 Inc
+
+}
+
+{************************************************************************
+
+   THIS IS THE OLD DGA API AND IS OBSOLETE.  PLEASE DO NOT USE IT ANYMORE
+
+************************************************************************}
+
+Type
+  PPcchar = ^Pcchar;
+
+Const
+  X_XF86DGAQueryVersion     = 0;
+  X_XF86DGAGetVideoLL       = 1;
+  X_XF86DGADirectVideo      = 2;
+  X_XF86DGAGetViewPortSize  = 3;
+  X_XF86DGASetViewPort      = 4;
+  X_XF86DGAGetVidPage       = 5;
+  X_XF86DGASetVidPage       = 6;
+  X_XF86DGAInstallColormap  = 7;
+  X_XF86DGAQueryDirectVideo = 8;
+  X_XF86DGAViewPortChanged  = 9;
+
+  XF86DGADirectPresent      = $0001;
+  XF86DGADirectGraphics     = $0002;
+  XF86DGADirectMouse        = $0004;
+  XF86DGADirectKeyb         = $0008;
+  XF86DGAHasColormap        = $0100;
+  XF86DGADirectColormap     = $0200;
+
+Function XF86DGAQueryVersion(
+    dpy : PDisplay;
+    majorVersion : Pcint;
+    minorVersion : Pcint
+  ) : TBool; CDecl; External libXxf86dga;
+
+Function XF86DGAQueryExtension(
+    dpy : PDisplay;
+    event_base : Pcint;
+    error_base : Pcint
+  ) : TBool; CDecl; External libXxf86dga;
+
+Function XF86DGAGetVideoLL(
+    dpy : PDisplay;
+    screen : cint;
+    base_addr : Pcint;
+    width : Pcint;
+    bank_size : Pcint;
+    ram_size : Pcint
+  ) : TStatus; CDecl; External libXxf86dga;
+
+Function XF86DGAGetVideo(
+    dpy : PDisplay;
+    screen : cint;
+    base_addr : PPcchar;
+    width : Pcint;
+    bank_size : Pcint;
+    ram_size : Pcint
+  ) : TStatus; CDecl; External libXxf86dga;
+
+Function XF86DGADirectVideo(
+    dpy : PDisplay;
+    screen : cint;
+    enable : cint
+  ) : TStatus; CDecl; External libXxf86dga;
+
+Function XF86DGADirectVideoLL(
+    dpy : PDisplay;
+    screen : cint;
+    enable : cint
+  ) : TStatus; CDecl; External libXxf86dga;
+
+Function XF86DGAGetViewPortSize(
+    dpy : PDisplay;
+    screen : cint;
+    width : Pcint;
+    height : Pcint
+  ) : TStatus; CDecl; External libXxf86dga;
+
+Function XF86DGASetViewPort(
+    dpy : PDisplay;
+    screen : cint;
+    x : cint;
+    y : cint
+  ) : TStatus; CDecl; External libXxf86dga;
+
+Function XF86DGAGetVidPage(
+    dpy : PDisplay;
+    screen : cint;
+    vid_page : Pcint
+  ) : TStatus; CDecl; External libXxf86dga;
+
+Function XF86DGASetVidPage(
+    dpy : PDisplay;
+    screen : cint;
+    vid_page : cint
+  ) : TStatus; CDecl; External libXxf86dga;
+
+Function XF86DGAInstallColormap(
+    dpy : PDisplay;
+    screen : cint;
+    Colormap : TColormap
+  ) : TStatus; CDecl; External libXxf86dga;
+
+Function XF86DGAForkApp(
+    screen : cint
+  ) : cint; CDecl; External libXxf86dga;
+
+Function XF86DGAQueryDirectVideo(
+    dpy : PDisplay;
+    screen : cint;
+    flags : Pcint
+  ) : TStatus; CDecl; External libXxf86dga;
+
+Function XF86DGAViewPortChanged(
+    dpy : PDisplay;
+    screen : cint;
+    n : cint
+  ) : TBool; CDecl; External libXxf86dga;

+ 339 - 0
packages/x11/src/xf86vmode.pp

@@ -0,0 +1,339 @@
+{ $XFree86: xc/include/extensions/xf86vmode.h,v 3.30 2001/05/07 20:09:50 mvojkovi Exp $ }
+{
+
+Copyright 1995  Kaleb S. KEITHLEY
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL Kaleb S. KEITHLEY 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 Kaleb S. KEITHLEY 
+shall not be used in advertising or otherwise to promote the sale, use 
+or other dealings in this Software without prior written authorization
+from Kaleb S. KEITHLEY
+
+}
+{ $Xorg: xf86vmode.h,v 1.3 2000/08/18 04:05:46 coskrey Exp $ }
+
+{ THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION }
+
+Unit xf86vmode;
+
+{$PACKRECORDS c}
+{$DEFINE MACROS}
+
+Interface
+
+Uses
+  ctypes, x, xlib;
+
+Const
+  libXxf86vm = 'Xxf86vm';
+
+Type
+  PINT32 = ^LongInt; {INT32 *}
+
+Const
+  X_XF86VidModeQueryVersion     = 0;
+  X_XF86VidModeGetModeLine      = 1;
+  X_XF86VidModeModModeLine      = 2;
+  X_XF86VidModeSwitchMode       = 3;
+  X_XF86VidModeGetMonitor       = 4;
+  X_XF86VidModeLockModeSwitch   = 5;
+  X_XF86VidModeGetAllModeLines  = 6;
+  X_XF86VidModeAddModeLine      = 7;
+  X_XF86VidModeDeleteModeLine   = 8;
+  X_XF86VidModeValidateModeLine = 9;
+  X_XF86VidModeSwitchToMode     = 10;
+  X_XF86VidModeGetViewPort      = 11;
+  X_XF86VidModeSetViewPort      = 12;
+{ new for version 2.x of this extension }
+  X_XF86VidModeGetDotClocks     = 13;
+  X_XF86VidModeSetClientVersion = 14;
+  X_XF86VidModeSetGamma         = 15;
+  X_XF86VidModeGetGamma         = 16;
+  X_XF86VidModeGetGammaRamp     = 17;
+  X_XF86VidModeSetGammaRamp     = 18;
+  X_XF86VidModeGetGammaRampSize = 19;
+  X_XF86VidModeGetPermissions   = 20;
+
+  CLKFLAG_PROGRAMABLE           = 1;
+
+{$IFDEF XF86VIDMODE_EVENTS}
+  XF86VidModeNotify             = 0;
+  XF86VidModeNumberEvents       = (XF86VidModeNotify + 1);
+
+  XF86VidModeNotifyMask         = $00000001;
+
+  XF86VidModeNonEvent           = 0;
+  XF86VidModeModeChange         = 1;
+{$ELSE XF86VIDMODE_EVENTS}
+  XF86VidModeNumberEvents       = 0;
+{$ENDIF XF86VIDMODE_EVENTS}
+
+  XF86VidModeBadClock           = 0;
+  XF86VidModeBadHTimings        = 1;
+  XF86VidModeBadVTimings        = 2;
+  XF86VidModeModeUnsuitable     = 3;
+  XF86VidModeExtensionDisabled  = 4;
+  XF86VidModeClientNotLocal     = 5;
+  XF86VidModeZoomLocked         = 6;
+  XF86VidModeNumberErrors       = (XF86VidModeZoomLocked + 1);
+
+  XF86VM_READ_PERMISSION  = 1;
+  XF86VM_WRITE_PERMISSION = 2;
+
+Type
+  PXF86VidModeModeLine = ^TXF86VidModeModeLine;
+  TXF86VidModeModeLine = Record
+    hdisplay : cushort;
+    hsyncstart : cushort;
+    hsyncend : cushort;
+    htotal : cushort;
+    hskew : cushort;
+    vdisplay : cushort;
+    vsyncstart : cushort;
+    vsyncend : cushort;
+    vtotal : cushort;
+    flags : cuint;
+    privsize : cint;
+    c_private : PINT32;
+  End;
+
+  PPPXF86VidModeModeInfo = ^PPXF86VidModeModeInfo;
+  PPXF86VidModeModeInfo = ^PXF86VidModeModeInfo;
+  PXF86VidModeModeInfo = ^TXF86VidModeModeInfo;
+  TXF86VidModeModeInfo = Record
+    dotclock : cuint;
+    hdisplay : cushort;
+    hsyncstart : cushort;
+    hsyncend : cushort;
+    htotal : cushort;
+    hskew : cushort;
+    vdisplay : cushort;
+    vsyncstart : cushort;
+    vsyncend : cushort;
+    vtotal : cushort;
+    flags : cuint;
+    privsize : cint;
+    c_private : PINT32;
+  End;
+
+  PXF86VidModeSyncRange = ^TXF86VidModeSyncRange;
+  TXF86VidModeSyncRange = Record
+    hi : cfloat;
+    lo : cfloat;
+  End;
+
+  PXF86VidModeMonitor = ^TXF86VidModeMonitor;
+  TXF86VidModeMonitor = Record
+    vendor : PChar;
+    model : PChar;
+    EMPTY : cfloat;
+    nhsync : cuchar;
+    hsync : PXF86VidModeSyncRange;
+    nvsync : cuchar;
+    vsync : PXF86VidModeSyncRange;
+  End;
+
+  PXF86VidModeNotifyEvent = ^TXF86VidModeNotifyEvent;
+  TXF86VidModeNotifyEvent = Record
+    _type : cint;       { of event }
+    serial : culong;    { # of last request processed by server }
+    send_event : TBool; { true if this came from a SendEvent req }
+    display : PDisplay; { Display the event was read from }
+    root : TWindow;     { root window of event screen }
+    state : cint;       { What happened }
+    kind : cint;        { What happened }
+    forced : TBool;     { extents of new region }
+    time : TTime;       { event timestamp }
+  End;
+
+  PXF86VidModeGamma = ^TXF86VidModeGamma;
+  TXF86VidModeGamma = Record
+    red : cfloat;   { Red Gamma value }
+    green : cfloat; { Green Gamma value }
+    blue : cfloat;  { Blue Gamma value }
+  End;
+
+{$IFDEF MACROS}
+Function XF86VidModeSelectNextMode(disp : PDisplay; scr : cint) : TBool;
+Function XF86VidModeSelectPrevMode(disp : PDisplay; scr : cint) : TBool;
+{$ENDIF MACROS}
+
+Function XF86VidModeQueryVersion(
+    dpy : PDisplay;
+    majorVersion : Pcint;
+    minorVersion : Pcint
+  ) : TBool; CDecl; External libXxf86vm;
+
+Function XF86VidModeQueryExtension(
+    dpy : PDisplay;
+    event_base : Pcint;
+    error_base : Pcint
+  ) : TBool; CDecl; External libXxf86vm;
+
+Function XF86VidModeSetClientVersion(
+    dpy : PDisplay
+  ) : TBool; CDecl; External libXxf86vm;
+
+Function XF86VidModeGetModeLine(
+    dpy : PDisplay;
+    screen : cint;
+    dotclock : Pcint;
+    modeline : PXF86VidModeModeLine
+  ) : TBool; CDecl; External libXxf86vm;
+
+Function XF86VidModeGetAllModeLines(
+    dpy : PDisplay;
+    screen : cint;
+    modecount : Pcint;
+    modelinesPtr : PPPXF86VidModeModeInfo
+  ) : TBool; CDecl; External libXxf86vm;
+
+Function XF86VidModeAddModeLine(
+    dpy : PDisplay;
+    screen : cint;
+    new_modeline : PXF86VidModeModeInfo;
+    after_modeline : PXF86VidModeModeInfo
+  ) : TBool; CDecl; External libXxf86vm;
+
+Function XF86VidModeDeleteModeLine(
+    dpy : PDisplay;
+    screen : cint;
+    modeline : PXF86VidModeModeInfo
+  ) : TBool; CDecl; External libXxf86vm;
+
+Function XF86VidModeModModeLine(
+    dpy : PDisplay;
+    screen : cint;
+    modeline : PXF86VidModeModeLine
+  ) : TBool; CDecl; External libXxf86vm;
+
+Function XF86VidModeValidateModeLine(
+    dpy : PDisplay;
+    screen : cint;
+    modeline : PXF86VidModeModeInfo
+  ) : TStatus; CDecl; External libXxf86vm;
+
+Function XF86VidModeSwitchMode(
+    dpy : PDisplay;
+    screen : cint;
+    zoom : cint
+  ) : TBool; CDecl; External libXxf86vm;
+
+Function XF86VidModeSwitchToMode(
+    dpy : PDisplay;
+    screen : cint;
+    modeline : PXF86VidModeModeInfo
+  ) : TBool; CDecl; External libXxf86vm;
+
+Function XF86VidModeLockModeSwitch(
+    dpy : PDisplay;
+    screen : cint;
+    lock : cint
+  ) : TBool; CDecl; External libXxf86vm;
+
+Function XF86VidModeGetMonitor(
+    dpy : PDisplay;
+    screen : cint;
+    monitor : PXF86VidModeMonitor
+  ) : TBool; CDecl; External libXxf86vm;
+
+Function XF86VidModeGetViewPort(
+    dpy : PDisplay;
+    screen : cint;
+    x_return : Pcint;
+    y_return : Pcint
+  ) : TBool; CDecl; External libXxf86vm;
+
+Function XF86VidModeSetViewPort(
+    dpy : PDisplay;
+    screen : cint;
+    x : cint;
+    y : cint
+  ) : TBool; CDecl; External libXxf86vm;
+
+Function XF86VidModeGetDotClocks(
+    dpy : PDisplay;
+    screen : cint;
+    flags_return : Pcint;
+    number_of_clocks_return : Pcint;
+    max_dot_clock_return : Pcint;
+    clocks_return : PPcint
+  ) : TBool; CDecl; External libXxf86vm;
+
+Function XF86VidModeGetGamma(
+    dpy : PDisplay;
+    screen : cint;
+    Gamma : PXF86VidModeGamma
+  ) : TBool; CDecl; External libXxf86vm;
+
+Function XF86VidModeSetGamma(
+    dpy : PDisplay;
+    screen : cint;
+    Gamma : PXF86VidModeGamma
+  ) : TBool; CDecl; External libXxf86vm;
+
+Function XF86VidModeSetGammaRamp(
+    dpy : PDisplay;
+    screen : cint;
+    size : cint;
+    red_array : Pcushort;
+    green_array : Pcushort;
+    blue_array : Pcushort
+  ) : TBool; CDecl; External libXxf86vm;
+
+Function XF86VidModeGetGammaRamp(
+    dpy : PDisplay;
+    screen : cint;
+    size : cint;
+    red_array : Pcushort;
+    green_array : Pcushort;
+    blue_array : Pcushort
+  ) : TBool; CDecl; External libXxf86vm;
+
+Function XF86VidModeGetGammaRampSize(
+    dpy : PDisplay;
+    screen : cint;
+    size : Pcint
+  ) : TBool; CDecl; External libXxf86vm;
+
+Function XF86VidModeGetPermissions(
+    dpy : PDisplay;
+    screen : cint;
+    permissions : Pcint
+  ) : TBool; CDecl; External libXxf86vm;
+
+Implementation
+
+{$IFDEF MACROS}
+Function XF86VidModeSelectNextMode(disp : PDisplay; scr : cint) : TBool;
+
+Begin
+  XF86VidModeSelectNextMode := XF86VidModeSwitchMode(disp, scr, 1);
+End;
+
+Function XF86VidModeSelectPrevMode(disp : PDisplay; scr : cint) : TBool;
+
+Begin
+  XF86VidModeSelectPrevMode := XF86VidModeSwitchMode(disp, scr, -1);
+End;
+{$ENDIF MACROS}
+
+End.

+ 323 - 0
packages/x11/src/xi.pp

@@ -0,0 +1,323 @@
+{
+ $Xorg: XI.h,v 1.4 2001/02/09 02:03:23 xorgcvs Exp $
+
+************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+ $XFree86: xc/include/extensions/XI.h,v 1.5 2001/12/14 19:53:28 dawes Exp $
+
+ Definitions used by the server, library and client
+
+        Pascal Convertion was made by Ido Kannner - [email protected]
+
+Histroy:
+        2004/10/15 - Fixed a bug of accessing second based records by removing "paced record" and chnaged it to
+                     "reocrd" only.
+        2004/10/07 - Removed the "uses X;" line. The unit does not need it.
+        2004/10/03 - Conversion from C header to Pascal unit.
+}
+{$PACKRECORDS C} {$MACRO ON} {$DEFINE MACROS}
+{$MODE OBJFPC}
+unit xi;
+interface
+
+const
+        sz_xGetExtensionVersionReq           =  8;
+        sz_xGetExtensionVersionReply         = 32;
+        sz_xListInputDevicesReq              =  4;
+        sz_xListInputDevicesReply            = 32;
+        sz_xOpenDeviceReq                    =  8;
+        sz_xOpenDeviceReply                  = 32;
+        sz_xCloseDeviceReq                   =  8;
+        sz_xSetDeviceModeReq                 =  8;
+        sz_xSetDeviceModeReply               = 32;
+        sz_xSelectExtensionEventReq          = 12;
+        sz_xGetSelectedExtensionEventsReq    =  8;
+        sz_xGetSelectedExtensionEventsReply  = 32;
+        sz_xChangeDeviceDontPropagateListReq = 12;
+        sz_xGetDeviceDontPropagateListReq    =  8;
+        sz_xGetDeviceDontPropagateListReply  = 32;
+        sz_xGetDeviceMotionEventsReq         = 16;
+        sz_xGetDeviceMotionEventsReply       = 32;
+        sz_xChangeKeyboardDeviceReq          =  8;
+        sz_xChangeKeyboardDeviceReply        = 32;
+        sz_xChangePointerDeviceReq           =  8;
+        sz_xChangePointerDeviceReply         = 32;
+        sz_xGrabDeviceReq                    = 20;
+        sz_xGrabDeviceReply                  = 32;
+        sz_xUngrabDeviceReq                  = 12;
+        sz_xGrabDeviceKeyReq                 = 20;
+        sz_xGrabDeviceKeyReply               = 32;
+        sz_xUngrabDeviceKeyReq               = 16;
+        sz_xGrabDeviceButtonReq              = 20;
+        sz_xGrabDeviceButtonReply            = 32;
+        sz_xUngrabDeviceButtonReq            = 16;
+        sz_xAllowDeviceEventsReq             = 12;
+        sz_xGetDeviceFocusReq                =  8;
+        sz_xGetDeviceFocusReply              = 32;
+        sz_xSetDeviceFocusReq                = 16;
+        sz_xGetFeedbackControlReq            =  8;
+        sz_xGetFeedbackControlReply          = 32;
+        sz_xChangeFeedbackControlReq         = 12;
+        sz_xGetDeviceKeyMappingReq           =  8;
+        sz_xGetDeviceKeyMappingReply         = 32;
+        sz_xChangeDeviceKeyMappingReq        =  8;
+        sz_xGetDeviceModifierMappingReq      =  8;
+        sz_xSetDeviceModifierMappingReq      =  8;
+        sz_xSetDeviceModifierMappingReply    = 32;
+        sz_xGetDeviceButtonMappingReq        =  8;
+        sz_xGetDeviceButtonMappingReply      = 32;
+        sz_xSetDeviceButtonMappingReq        =  8;
+        sz_xSetDeviceButtonMappingReply      = 32;
+        sz_xQueryDeviceStateReq              =  8;
+        sz_xQueryDeviceStateReply            = 32;
+        sz_xSendExtensionEventReq            = 16;
+        sz_xDeviceBellReq                    =  8;
+        sz_xSetDeviceValuatorsReq            =  8;
+        sz_xSetDeviceValuatorsReply          = 32;
+        sz_xGetDeviceControlReq              =  8;
+        sz_xGetDeviceControlReply            = 32;
+        sz_xChangeDeviceControlReq           =  8;
+        sz_xChangeDeviceControlReply         = 32;
+
+const
+        INAME  = 'XInputExtension';
+
+const
+        XI_KEYBOARD    = 'KEYBOARD';
+        XI_MOUSE       = 'MOUSE';
+        XI_TABLET      = 'TABLET';
+        XI_TOUCHSCREEN = 'TOUCHSCREEN';
+        XI_TOUCHPAD    = 'TOUCHPAD';
+        XI_BARCODE     = 'BARCODE';
+        XI_BUTTONBOX   = 'BUTTONBOX';
+        XI_KNOB_BOX    = 'KNOB_BOX';
+        XI_ONE_KNOB    = 'ONE_KNOB';
+        XI_NINE_KNOB   = 'NINE_KNOB';
+        XI_TRACKBALL   = 'TRACKBALL';
+        XI_QUADRATURE  = 'QUADRATURE';
+        XI_ID_MODULE   = 'ID_MODULE';
+        XI_SPACEBALL   = 'SPACEBALL';
+        XI_DATAGLOVE   = 'DATAGLOVE';
+        XI_EYETRACKER  = 'EYETRACKER';
+        XI_CURSORKEYS  = 'CURSORKEYS';
+        XI_FOOTMOUSE   = 'FOOTMOUSE';
+
+const
+        Dont_Check                      = 0;
+        XInput_Initial_Release          = 1;
+        XInput_Add_XDeviceBell          = 2;
+        XInput_Add_XSetDeviceValuators  = 3;
+        XInput_Add_XChangeDeviceControl = 4;
+
+const
+        XI_Absent  = 0;
+        XI_Present = 1;
+
+const
+        XI_Initial_Release_Major = 1;
+        XI_Initial_Release_Minor = 0;
+
+const
+        XI_Add_XDeviceBell_Major = 1;
+        XI_Add_XDeviceBell_Minor = 1;
+
+const
+        XI_Add_XSetDeviceValuators_Major = 1;
+        XI_Add_XSetDeviceValuators_Minor = 2;
+
+const
+        XI_Add_XChangeDeviceControl_Major = 1;
+        XI_Add_XChangeDeviceControl_Minor = 3;
+
+const
+        DEVICE_RESOLUTION = 1;
+
+const
+        NoSuchExtension = 1;
+
+const
+        COUNT  = 0;
+        CREATE = 1;
+
+const
+        NewPointer  = 0;
+        NewKeyboard = 1;
+
+const
+        XPOINTER  = 0;
+        XKEYBOARD = 1;
+
+const
+        UseXKeyboard = $FF;
+
+const
+        IsXPointer         = 0;
+        IsXKeyboard        = 1;
+        IsXExtensionDevice = 2;
+
+const
+        AsyncThisDevice   = 0;
+        SyncThisDevice    = 1;
+        ReplayThisDevice  = 2;
+        AsyncOtherDevices = 3;
+        AsyncAll          = 4;
+        SyncAll           = 5;
+
+const
+        FollowKeyboard = 3;
+{$ifndef RevertToFollowKeyboard}
+        {$IFDEF MACROS}
+                {$define RevertToFollowKeyboard := 3}
+        {$ELSE}
+                RevertToFollowKeyboard = 3;
+        {$ENDIF}
+{$ENDIF}
+
+const
+        DvAccelNum   = Cardinal(1) shl 0;
+        DvAccelDenom = Cardinal(1) shl 1;
+        DvThreshold  = Cardinal(1) shl 2;
+
+const
+        DvKeyClickPercent = Cardinal(1) shl 0;
+        DvPercent         = Cardinal(1) shl 1;
+        DvPitch           = Cardinal(1) shl 2;
+        DvDuration        = Cardinal(1) shl 3;
+        DvLed             = Cardinal(1) shl 4;
+        DvLedMode         = Cardinal(1) shl 5;
+        DvKey             = Cardinal(1) shl 6;
+        DvAutoRepeatMode  = Cardinal(1) shl 7;
+
+const
+        DvString = Cardinal(1) shl 0;
+
+const
+        DvInteger = Cardinal(1) shl 0;
+
+const
+        DeviceMode         = Cardinal(1) shl 0;
+        Relative           =  0;
+        Absolute           =  1;
+{ Merged from Metrolink tree for XINPUT stuff }
+        TS_Raw             = 57;
+        TS_Scaled          = 58;
+        SendCoreEvents     = 59;
+        DontSendCoreEvents = 60;
+{ End of merged section }
+
+const
+        ProximityState = Cardinal(1) shl 1;
+        InProximity    = Cardinal(0) shl 1;
+        OutOfProximity = Cardinal(1) shl 1;
+
+const
+        AddToList      = 0;
+        DeleteFromList = 1;
+
+const
+        KeyClass       = 0;
+        ButtonClass    = 1;
+        ValuatorClass  = 2;
+        FeedbackClass  = 3;
+        ProximityClass = 4;
+        FocusClass     = 5;
+        OtherClass     = 6;
+
+const
+        KbdFeedbackClass     = 0;
+        PtrFeedbackClass     = 1;
+        StringFeedbackClass  = 2;
+        IntegerFeedbackClass = 3;
+        LedFeedbackClass     = 4;
+        BellFeedbackClass    = 5;
+
+const
+        _devicePointerMotionHint = 0;
+        _deviceButton1Motion     = 1;
+        _deviceButton2Motion     = 2;
+        _deviceButton3Motion     = 3;
+        _deviceButton4Motion     = 4;
+        _deviceButton5Motion     = 5;
+        _deviceButtonMotion      = 6;
+        _deviceButtonGrab        = 7;
+        _deviceOwnerGrabButton   = 8;
+        _noExtensionEvent        = 9;
+
+const
+        XI_BadDevice  = 0;
+        XI_BadEvent   = 1;
+        XI_BadMode    = 2;
+        XI_DeviceBusy = 3;
+        XI_BadClass   = 4;
+
+{ Make XEventClass be a CARD32 for 64 bit servers.  Don't affect client
+  definition of XEventClass since that would be a library interface change.
+  See the top of X.h for more _XSERVER64 magic.
+}
+type
+{$ifdef _XSERVER64}
+        XEventClass = CARD32;
+{$ELSE}
+        XEventClass = Longword;
+{$ENDIF}
+
+(*******************************************************************
+ *
+ * Extension version structure.
+ *
+ *)
+
+type
+        PXExtensionVersion = ^TXExtensionVersion;
+        TXExtensionVersion = record
+                              present       : Smallint;
+                              major_version : Smallint;
+                              minor_version : Smallint;
+                             end;
+
+implementation
+
+end.

+ 28 - 0
packages/x11/src/xinerama.pp

@@ -0,0 +1,28 @@
+unit xinerama;
+interface
+uses
+ ctypes, xlib;
+{ Converted from X11/Xinerama.h }
+
+{$PACKRECORDS C}
+
+
+type
+
+   PXineramaScreenInfo = ^TXineramaScreenInfo;
+   TXineramaScreenInfo = record
+        screen_number : cint;
+        x_org         : cshort;
+        y_org         : cshort;
+        width         : cshort;
+        height        : cshort;
+     end;
+
+function XineramaQueryExtension(dpy:PDisplay; event_base:Pcint; error_base:Pcint):TBool;cdecl;external 'Xinerama';
+function XineramaQueryVersion(dpy:PDisplay; major:Pcint; minor:Pcint):TStatus;cdecl;external 'Xinerama';
+function XineramaIsActive(dpy:PDisplay):TBool;cdecl;external 'Xinerama';
+function XineramaQueryScreens(dpy:PDisplay; number:Pcint):PXineramaScreenInfo;cdecl;external 'Xinerama';
+
+implementation
+
+end.

+ 2855 - 0
packages/x11/src/xkb.pp

@@ -0,0 +1,2855 @@
+{
+ $Xorg: XKB.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $
+************************************************************
+ $Xorg: XKBstr.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $
+************************************************************
+ $Xorg: XKBgeom.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $
+************************************************************
+
+Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be
+used in advertising or publicity pertaining to distribution
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************
+ $XFree86: xc/include/extensions/XKB.h,v 1.5 2002/11/20 04:49:01 dawes Exp $
+ $XFree86: xc/include/extensions/XKBgeom.h,v 3.9 2002/09/18 17:11:40 tsi Exp $
+
+ Pascal Convertion was made by Ido Kannner - [email protected]
+
+Thanks:
+         I want to thanks to oliebol for putting up with all of the problems that was found
+         while translating this code. ;)
+
+         I want to thanks #fpc channel in freenode irc, for helping me, and to put up with my
+         wierd questions ;)
+
+         Thanks for mmc in #xlib on freenode irc And so for the channel itself for the helping me to
+         understanding some of the problems I had converting this headers and pointing me to resources
+         that helped translating this headers.
+
+ Ido
+
+History:
+        2004/10/15           - Fixed a bug of accessing second based records by removing "paced record" and
+                               chnaged it to "reocrd" only.
+        2004/10/04 - 06      - Convertion from the c header of XKBgeom.h.
+        2004/10/03           - Removed the XKBstr_UNIT compiler decleration. Afther the joined files,
+                                                                                     There is no need for it anymore.
+                                                                             - There is a need to define (for now) XKBgeom (compiler define) in order
+                                                                               to use the code of it. At this moment, I did not yet converted it to Pascal.
+
+        2004/09/17 - 10/04   - Convertion from the c header of XKBstr.
+
+        2004/10/03           - Joined xkbstr.pas into xkb.pas because of the circular calls problems.
+                             - Added the history of xkbstr.pas above this addition.
+
+        2004/09/17           - Fixed a wrong convertion number of XkbPerKeyBitArraySize, insted
+                               of float, it's now converted into integer (as it should have been).
+
+        2004/09/15 - 16      - Convertion from the c header of XKB.h.
+}
+{$PACKRECORDS C}
+{$MODE OBJFPC} {$MACRO ON} {$DEFINE MACRO}
+
+unit XKB;
+interface
+uses X, Xlib;
+
+function XkbCharToInt    (v       : Byte) : SmallInt;
+procedure XkbIntTo2Chars (i : Word; var h, l : byte);
+
+function Xkb2CharsToInt (h, l    : Byte)  : SmallInt;
+
+        {
+          Common data structures and access macros
+        }
+type
+        PXkbStatePtr = ^TXkbStateRec;
+        TXkbStateRec = record
+                         group              : Byte;
+                         locked_group       : Byte;
+                         base_group         : Word;
+                                                                         latched_group      : Word;
+                                                                         mods               : Byte;
+                         base_mods          : Byte;
+                         latched_mods       : Byte;
+                         locked_mods        : Byte;
+                         compat_state       : Byte;
+                         grab_mods          : Byte;
+                                                                         compat_grab_mods   : Byte;
+                                                                         lookup_mods        : Byte;
+                         compat_lookup_mods : Byte;
+                         ptr_buttons        : Word;
+                        end;
+
+function XkbModLocks          (s : PXkbStatePtr) : Byte;
+function XkbStateMods         (s : PXkbStatePtr) : Word;
+function XkbGroupLock         (s : PXkbStatePtr) : Byte;
+function XkbStateGroup        (s : PXkbStatePtr) : Word;
+function XkbStateFieldFromRec (s : PXkbStatePtr) : Cardinal;
+function XkbGrabStateFromRec  (s : PXkbStatePtr) : Cardinal;
+
+type
+        PXkbModsPtr = ^TXkbModsRec;
+        TXkbModsRec = record
+                       mask      : Byte; // effective mods
+                                                                 real_mods : Byte;
+                       vmods     : Word;
+                      end;
+
+type
+        PXkbKTMapEntryPtr = ^TXkbKTMapEntryRec;
+        TXkbKTMapEntryRec = record
+                             active : Boolean;
+                             level  : Byte;
+                             mods   : TXkbModsRec;
+                            end;
+
+type
+        PXkbKeyTypePtr = ^TXkbKeyTypeRec;
+        TXkbKeyTypeRec = record
+                          mods        : TXkbModsRec;
+                          num_levels  : Byte;
+                          map_count   : Byte;
+                          map         : PXkbKTMapEntryPtr;
+                          preserve    : PXkbModsPtr;
+                          name        : TAtom;
+                          level_names : TAtom;
+                         end;
+
+function XkbNumGroups             (g       : Word) : Word;
+function XkbOutOfRangeGroupInfo   (g       : Word) : Word;
+function XkbOutOfRangeGroupAction (g       : Word) : Word;
+function XkbOutOfRangeGroupNumber (g       : Word) : Word;
+function XkbSetGroupInfo          (g, w, n : Word) : Word;
+function XkbSetNumGroups          (g, n    : Word) : Word;
+
+        {
+          Structures and access macros used primarily by the server
+        }
+
+type
+        PXkbBehavior = ^TXkbBehavior;
+        TXkbBehavior = record
+                        _type : Byte;
+                        data  : Byte;
+                       end;
+
+
+type
+        PXkbModAction = ^TXkbModAction;
+        TXkbModAction = record
+                                                                         _type     : Byte;
+                         flags     : Byte;
+                         mask      : Byte;
+                                                                         real_mods : Byte;
+                         vmods1    : Byte;
+                         vmods2    : Byte;
+                        end;
+
+function XkbModActionVMods     (a : PXkbModAction) : SmallInt;
+procedure XkbSetModActionVMods (a : PXkbModAction; v : Byte);
+
+type
+        PXkbGroupAction = ^TXkbGroupAction;
+        TXkbGroupAction = record
+                           _type     : Byte;
+                           flags     : Byte;
+                           group_XXX : ShortInt;
+                                                                                end;
+
+function  XkbSAGroup    (a : PXkbGroupAction) : ShortInt;
+procedure XkbSASetGroup (a : PXkbGroupAction; g : ShortInt);
+
+type
+        PXkbISOAction = ^TXkbISOAction;
+        TXkbISOAction = record
+                         _type     : Byte;
+                         flags     : Byte;
+                         mask      : Byte;
+                         real_mods : Byte;
+                         group_XXX : ShortInt;
+                                                                         affect    : Byte;
+                         vmods1    : Byte;
+                         vmods2    : Byte;
+                        end;
+
+type
+        PXkbPtrAction = ^TXkbPtrAction;
+        TXkbPtrAction = record
+                         _type    : Byte;
+                         flags    : Byte;
+                         high_XXX : Byte;
+                                                                         low_XXX  : Byte;
+                                                                         high_YYY : Byte;
+                         low_YYY  : Byte;
+                        end;
+
+function  XkbPtrActionX    (a : PXkbPtrAction) : Word;
+function  XkbPtrActionY    (a : PXkbPtrAction) : Word;
+procedure XkbSetPtrActionX (a : PXkbPtrAction; x : Byte);
+procedure XkbSetPtrActionY (a : PXkbPtrAction; y : Byte);
+
+type
+        PXkbPtrBtnAction = ^TXkbPtrBtnAction;
+        TXkbPtrBtnAction = record
+                                                                                        _type  : Byte;
+                            flags  : Byte;
+                            count  : Byte;
+                            button : Byte;
+                           end;
+
+type
+        PXkbPtrDfltAction = ^TXkbPtrDfltAction;
+        TXkbPtrDfltAction = record
+                             _type    : Byte;
+                             flags    : Byte;
+                             affect   : Byte;
+                             valueXXX : ShortInt;
+                            end;
+
+function XkbSAPtrDfltValue    (a : PXkbPtrDfltAction) : ShortInt;
+procedure XkbSASetPtrDfltValue (a : PXkbPtrDfltAction; const c);
+
+type
+        PXkbSwitchScreenAction = ^TXkbSwitchScreenAction;
+        TXkbSwitchScreenAction = record
+                                  _type     : Byte;
+                                  flags     : Byte;
+                                  screenXXX : ShortInt;
+                                end;
+
+function XkbSAScreen     (a : PXkbSwitchScreenAction) : ShortInt;
+procedure XkbSASetScreen (a : PXkbSwitchScreenAction; const s);
+
+type
+        PXkbCtrlsAction = ^TXkbCtrlsAction;
+        TXkbCtrlsAction = record
+                           _type  : Byte;
+                           flags  : Byte;
+                           ctrls3 : Byte;
+                           ctrls2 : Byte;
+                                                                                 ctrls1 : Byte;
+                           ctrls0 : Byte;
+                          end;
+
+procedure XkbActionSetCtrls (a : PXkbCtrlsAction; c : Byte);
+function XkbActionCtrls     (a : PXkbCtrlsAction) : Word;
+
+type
+        PXkbMessageAction = ^TXkbMessageAction;
+        TXkbMessageAction = record
+                             _type   : Byte;
+                             flags   : Byte;
+                             message : array [0..5] of char;
+                            end;
+
+type
+        PXkbRedirectKeyAction = ^TXkbRedirectKeyAction;
+        TXkbRedirectKeyAction = record
+                                 _type       : Byte;
+                                 new_key     : Byte;
+                                 mods_mask   : Byte;
+                                 mods        : Byte;
+                                 vmods_mask0 : Byte;
+                                 vmods_mask1 : Byte;
+                                 vmods0      : Byte;
+                                                                                                         vmods1      : Byte;
+                                end;
+
+function XkbSARedirectVMods         (a : PXkbRedirectKeyAction) : Word;
+procedure XkbSARedirectSetVMods     (a : PXkbRedirectKeyAction; m : Byte);
+function XkbSARedirectVModsMask     (a : PXkbRedirectKeyAction) : Word;
+procedure XkbSARedirectSetVModsMask (a : PXkbRedirectKeyAction; m : Byte);
+
+type
+        PXkbDeviceBtnAction = ^TXkbDeviceBtnAction;
+        TXkbDeviceBtnAction = record
+                               _type  : Byte;
+                               flags  : Byte;
+                               count  : Byte;
+                               button : Byte;
+                                                                                                 device : Byte;
+                              end;
+
+type
+        PXkbDeviceValuatorAction = ^TXkbDeviceValuatorAction;
+        TXkbDeviceValuatorAction = record
+                                    _type    : Byte;
+                                    device   : Byte;
+                                                                                                                        v1_what  : Byte;
+                                    v1_ndx   : Byte;
+                                    v1_value : Byte;
+                                    v2_what  : Byte;
+                                                                                                                        v2_ndx   : Byte;
+                                    v2_value : Byte;
+                                   end;
+
+    {
+      Macros to classify key actions
+                }
+const
+        XkbAnyActionDataSize = 7;
+
+type
+        PXkbAnyAction = ^TXkbAnyAction;
+        TXkbAnyAction = record
+                         _type : byte;
+                         data  : array [0..XkbAnyActionDataSize-1] of byte;
+                        end;
+
+function XkbIsModAction   (a : PXkbAnyAction) : LongBool;
+function XkbIsGroupAction (a : PXkbAnyAction) : LongBool;
+function XkbIsPtrAction   (a : PXkbAnyAction) : LongBool;
+
+type
+        PXkbAction = ^TXkbAction;
+        TXkbAction = record
+                                                                any      : TXkbAnyAction;
+                      mods     : TXkbModAction;
+                      group    : TXkbGroupAction;
+                      iso      : TXkbISOAction;
+                      ptr      : TXkbPtrAction;
+                      btn      : TXkbPtrBtnAction;
+                      dflt     : TXkbPtrDfltAction;
+                      screen   : TXkbSwitchScreenAction;
+                      ctrls    : TXkbCtrlsAction;
+                      msg      : TXkbMessageAction;
+                      redirect : TXkbRedirectKeyAction;
+                      devbtn   : TXkbDeviceBtnAction;
+                      devval   : TXkbDeviceValuatorAction;
+                      _type    : Byte;
+                     end;
+
+   {
+      XKB request codes, used in:
+      -  xkbReqType field of all requests
+      -  requestMinor field of some events
+                }
+const
+        X_kbUseExtension      =   0;
+        X_kbSelectEvents      =   1;
+        X_kbBell              =   3;
+        X_kbGetState          =   4;
+        X_kbLatchLockState    =   5;
+        X_kbGetControls       =   6;
+        X_kbSetControls       =   7;
+        X_kbGetMap            =   8;
+        X_kbSetMap            =   9;
+        X_kbGetCompatMap      =  10;
+        X_kbSetCompatMap      =  11;
+        X_kbGetIndicatorState =  12;
+        X_kbGetIndicatorMap   =  13;
+        X_kbSetIndicatorMap   =  14;
+        X_kbGetNamedIndicator =  15;
+        X_kbSetNamedIndicator =  16;
+        X_kbGetNames          =  17;
+        X_kbSetNames          =  18;
+        X_kbGetGeometry       =  19;
+        X_kbSetGeometry       =  20;
+        X_kbPerClientFlags    =  21;
+        X_kbListComponents    =  22;
+        X_kbGetKbdByName      =  23;
+        X_kbGetDeviceInfo     =  24;
+        X_kbSetDeviceInfo     =  25;
+        X_kbSetDebuggingFlags = 101;
+
+   {
+      In the X sense, XKB reports only one event.
+      The type field of all XKB events is XkbEventCode
+                }
+const
+        XkbEventCode    = 0;
+        XkbNumberEvents = XkbEventCode +1;
+
+   {
+      XKB has a minor event code so it can use one X event code for
+      multiple purposes.
+       - reported in the xkbType field of all XKB events.
+       - XkbSelectEventDetails: Indicates the event for which event details
+         are being changed
+                }
+const
+        XkbNewKeyboardNotify     =  0;
+        XkbMapNotify             =  1;
+        XkbStateNotify           =  2;
+        XkbControlsNotify        =  3;
+        XkbIndicatorStateNotify  =  4;
+        XkbIndicatorMapNotify    =  5;
+        XkbNamesNotify           =  6;
+        XkbCompatMapNotify       =  7;
+        XkbBellNotify            =  8;
+        XkbActionMessage         =  9;
+        XkbAccessXNotify         = 10;
+        XkbExtensionDeviceNotify = 11;
+
+    {
+      Event Mask:
+       - XkbSelectEvents:  Specifies event interest.
+    }
+const
+        XkbNewKeyboardNotifyMask     = Cardinal(1) shl  0;
+        XkbMapNotifyMask             = Cardinal(1) shl  1;
+        XkbStateNotifyMask           = Cardinal(1) shl  2;
+        XkbControlsNotifyMask        = Cardinal(1) shl  3;
+        XkbIndicatorStateNotifyMask  = Cardinal(1) shl  4;
+        XkbIndicatorMapNotifyMask    = Cardinal(1) shl  5;
+        XkbNamesNotifyMask           = Cardinal(1) shl  6;
+        XkbCompatMapNotifyMask       = Cardinal(1) shl  7;
+        XkbBellNotifyMask            = Cardinal(1) shl  8;
+        XkbActionMessageMask         = Cardinal(1) shl  9;
+        XkbAccessXNotifyMask         = Cardinal(1) shl 10;
+        XkbExtensionDeviceNotifyMask = Cardinal(1) shl 11;
+        XkbAllEventsMask             = $FFF;
+
+    {
+      NewKeyboardNotify event details:
+    }
+const
+        XkbNKN_KeycodesMask         = Cardinal(1) shl 0;
+        XkbNKN_GeometryMask         = Cardinal(1) shl 1;
+        XkbNKN_DeviceIDMask         = Cardinal(1) shl 2;
+        XkbAllNewKeyboardEventsMask = $7;
+
+    {
+      AccessXNotify event types:
+       - The 'what' field of AccessXNotify events reports the
+         reason that the event was generated.
+                }
+const
+        XkbAXN_SKPress    = 0;
+        XkbAXN_SKAccept   = 1;
+        XkbAXN_SKReject   = 2;
+        XkbAXN_SKRelease  = 3;
+        XkbAXN_BKAccept   = 4;
+        XkbAXN_BKReject   = 5;
+        XkbAXN_AXKWarning = 6;
+
+   {
+      AccessXNotify details:
+      - Used as an event detail mask to limit the conditions under which
+        AccessXNotify events are reported
+                }
+const
+        XkbAXN_SKPressMask      = Cardinal(1) shl 0;
+        XkbAXN_SKAcceptMask     = Cardinal(1) shl 1;
+        XkbAXN_SKRejectMask     = Cardinal(1) shl 2;
+        XkbAXN_SKReleaseMask    = Cardinal(1) shl 3;
+        XkbAXN_BKAcceptMask     = Cardinal(1) shl 4;
+        XkbAXN_BKRejectMask     = Cardinal(1) shl 5;
+        XkbAXN_AXKWarningMask   = Cardinal(1) shl 6;
+        XkbAllAccessXEventsMask = $f;
+  {
+      State detail mask:
+       - The 'changed' field of StateNotify events reports which of
+         the keyboard state components have changed.
+       - Used as an event detail mask to limit the conditions under
+         which StateNotify events are reported.
+                }
+const
+        XkbModifierStateMask      = Cardinal(1) shl  0;
+        XkbModifierBaseMask       = Cardinal(1) shl  1;
+        XkbModifierLatchMask      = Cardinal(1) shl  2;
+        XkbModifierLockMask       = Cardinal(1) shl  3;
+        XkbGroupStateMask         = Cardinal(1) shl  4;
+        XkbGroupBaseMask          = Cardinal(1) shl  5;
+        XkbGroupLatchMask         = Cardinal(1) shl  6;
+        XkbGroupLockMask          = Cardinal(1) shl  7;
+        XkbCompatStateMask        = Cardinal(1) shl  8;
+        XkbGrabModsMask           = Cardinal(1) shl  9;
+        XkbCompatGrabModsMask     = Cardinal(1) shl 10;
+        XkbLookupModsMask         = Cardinal(1) shl 11;
+        XkbCompatLookupModsMask   = Cardinal(1) shl 12;
+        XkbPointerButtonMask      = Cardinal(1) shl 13;
+        XkbAllStateComponentsMask = $3fff;
+
+   {
+      Controls detail masks:
+       The controls specified in XkbAllControlsMask:
+       - The 'changed' field of ControlsNotify events reports which of
+         the keyboard controls have changed.
+       - The 'changeControls' field of the SetControls request specifies
+         the controls for which values are to be changed.
+       - Used as an event detail mask to limit the conditions under
+         which ControlsNotify events are reported.
+
+       The controls specified in the XkbAllBooleanCtrlsMask:
+       - The 'enabledControls' field of ControlsNotify events reports the
+         current status of the boolean controls.
+       - The 'enabledControlsChanges' field of ControlsNotify events reports
+         any boolean controls that have been turned on or off.
+       - The 'affectEnabledControls' and 'enabledControls' fields of the
+         kbSetControls request change the set of enabled controls.
+       - The 'accessXTimeoutMask' and 'accessXTimeoutValues' fields of
+         an XkbControlsRec specify the controls to be changed if the keyboard
+         times out and the values to which they should be changed.
+       - The 'autoCtrls' and 'autoCtrlsValues' fields of the PerClientFlags
+         request specifies the specify the controls to be reset when the
+         client exits and the values to which they should be reset.
+       - The 'ctrls' field of an indicator map specifies the controls
+         that drive the indicator.
+       - Specifies the boolean controls affected by the SetControls and
+         LockControls key actions.
+                }
+const
+        XkbRepeatKeysMask       = Cardinal(1) shl  0;
+        XkbSlowKeysMask         = Cardinal(1) shl  1;
+        XkbBounceKeysMask       = Cardinal(1) shl  2;
+        XkbStickyKeysMask       = Cardinal(1) shl  3;
+        XkbMouseKeysMask        = Cardinal(1) shl  4;
+        XkbMouseKeysAccelMask   = Cardinal(1) shl  5;
+        XkbAccessXKeysMask      = Cardinal(1) shl  6;
+        XkbAccessXTimeoutMask   = Cardinal(1) shl  7;
+        XkbAccessXFeedbackMask  = Cardinal(1) shl  8;
+        XkbAudibleBellMask      = Cardinal(1) shl  9;
+        XkbOverlay1Mask         = Cardinal(1) shl 10;
+        XkbOverlay2Mask         = Cardinal(1) shl 11;
+        XkbIgnoreGroupLockMask  = Cardinal(1) shl 12;
+        XkbGroupsWrapMask       = Cardinal(1) shl 27;
+        XkbInternalModsMask     = Cardinal(1) shl 28;
+        XkbIgnoreLockModsMask   = Cardinal(1) shl 29;
+        XkbPerKeyRepeatMask     = Cardinal(1) shl 30;
+        XkbControlsEnabledMask  = Cardinal(1) shl 31;
+
+        XkbAccessXOptionsMask   = XkbStickyKeysMask or XkbAccessXFeedbackMask;
+
+        XkbAllBooleanCtrlsMask  = $00001FFF;
+        XkbAllControlsMask      = $F8001FFF;
+
+    {
+      Compatibility Map Compontents:
+       - Specifies the components to be allocated in XkbAllocCompatMap.
+                }
+const
+        XkbSymInterpMask   = 1 shl 0;
+        XkbGroupCompatMask = 1 shl 1;
+        XkbAllCompatMask   = $3;
+
+    {
+      Assorted constants and limits.
+                }
+const
+        XkbAllIndicatorsMask   = $ffffffff;
+
+    {
+      Map components masks:
+      Those in AllMapComponentsMask:
+       - Specifies the individual fields to be loaded or changed for the
+         GetMap and SetMap requests.
+      Those in ClientInfoMask:
+       - Specifies the components to be allocated by XkbAllocClientMap.
+      Those in ServerInfoMask:
+       - Specifies the components to be allocated by XkbAllocServerMap.
+                }
+const
+        XkbKeyTypesMask           = 1 shl 0;
+        XkbKeySymsMask            = 1 shl 1;
+        XkbModifierMapMask        = 1 shl 2;
+        XkbExplicitComponentsMask = 1 shl 3;
+        XkbKeyActionsMask         = 1 shl 4;
+        XkbKeyBehaviorsMask       = 1 shl 5;
+        XkbVirtualModsMask        = 1 shl 6;
+        XkbVirtualModMapMask      = 1 shl 7;
+
+        XkbAllClientInfoMask      = XkbKeyTypesMask           or XkbKeySymsMask       or XkbModifierMapMask;
+        XkbAllServerInfoMask      = XkbExplicitComponentsMask or XkbKeyActionsMask    or XkbKeyBehaviorsMask or
+                                    XkbVirtualModsMask        or XkbVirtualModMapMask;
+        XkbAllMapComponentsMask   = XkbAllClientInfoMask      or XkbAllServerInfoMask;
+
+    {
+      Names component mask:
+       - Specifies the names to be loaded or changed for the GetNames and
+         SetNames requests.
+       - Specifies the names that have changed in a NamesNotify event.
+       - Specifies the names components to be allocated by XkbAllocNames.
+                }
+const
+        XkbKeycodesNameMask    = 1 shl  0;
+        XkbGeometryNameMask    = 1 shl  1;
+        XkbSymbolsNameMask     = 1 shl  2;
+        XkbPhysSymbolsNameMask = 1 shl  3;
+        XkbTypesNameMask       = 1 shl  4;
+        XkbCompatNameMask      = 1 shl  5;
+        XkbKeyTypeNamesMask    = 1 shl  6;
+        XkbKTLevelNamesMask    = 1 shl  7;
+        XkbIndicatorNamesMask  = 1 shl  8;
+        XkbKeyNamesMask        = 1 shl  9;
+        XkbKeyAliasesMask      = 1 shl 10;
+        XkbVirtualModNamesMask = 1 shl 11;
+        XkbGroupNamesMask      = 1 shl 12;
+        XkbRGNamesMask         = 1 shl 13;
+        XkbComponentNamesMask  = $3f;
+        XkbAllNamesMask        = $3fff;
+
+  {
+      Miscellaneous event details:
+      - event detail masks for assorted events that don't reall
+        have any details.
+                }
+const
+        XkbAllStateEventsMask     = XkbAllStateComponentsMask;
+        XkbAllMapEventsMask       = XkbAllMapComponentsMask;
+        XkbAllControlEventsMask   = XkbAllControlsMask;
+        XkbAllIndicatorEventsMask = XkbAllIndicatorsMask;
+        XkbAllNameEventsMask      = XkbAllNamesMask;
+        XkbAllCompatMapEventsMask = XkbAllCompatMask;
+        XkbAllBellEventsMask      = Cardinal(1) shl 0;
+        XkbAllActionMessagesMask  = Cardinal(1) shl 0;
+
+    {
+      XKB reports one error:  BadKeyboard
+      A further reason for the error is encoded into to most significant
+      byte of the resourceID for the error:
+         XkbErr_BadDevice - the device in question was not found
+         XkbErr_BadClass  - the device was found but it doesn't belong to
+                            the appropriate class.
+         XkbErr_BadId     - the device was found and belongs to the right
+                            class, but not feedback with a matching id was
+                            found.
+      The low byte of the resourceID for this error contains the device
+      id, class specifier or feedback id that failed.
+                }
+const
+        XkbKeyboard      =   0;
+        XkbNumberErrors  =   1;
+        XkbErr_BadDevice = $ff;
+        XkbErr_BadClass  = $fe;
+        XkbErr_BadId     = $fd;
+
+    {
+      Keyboard Components Mask:
+      - Specifies the components that follow a GetKeyboardByNameReply
+                }
+const
+        XkbClientMapMask     = Cardinal(1) shl 0;
+        XkbServerMapMask     = Cardinal(1) shl 1;
+        XkbCompatMapMask     = Cardinal(1) shl 2;
+        XkbIndicatorMapMask  = Cardinal(1) shl 3;
+        XkbNamesMask         = Cardinal(1) shl 4;
+        XkbGeometryMask      = Cardinal(1) shl 5;
+        XkbControlsMask      = Cardinal(1) shl 6;
+        XkbAllComponentsMask = $7f;
+
+
+    {
+      AccessX Options Mask
+       - The 'accessXOptions' field of an XkbControlsRec specifies the
+         AccessX options that are currently in effect.
+       - The 'accessXTimeoutOptionsMask' and 'accessXTimeoutOptionsValues'
+         fields of an XkbControlsRec specify the Access X options to be
+         changed if the keyboard times out and the values to which they
+         should be changed.
+                }
+const
+        XkbAX_SKPressFBMask    = Cardinal(1) shl  0;
+        XkbAX_SKAcceptFBMask   = Cardinal(1) shl  1;
+        XkbAX_FeatureFBMask    = Cardinal(1) shl  2;
+        XkbAX_SlowWarnFBMask   = Cardinal(1) shl  3;
+        XkbAX_IndicatorFBMask  = Cardinal(1) shl  4;
+        XkbAX_StickyKeysFBMask = Cardinal(1) shl  5;
+        XkbAX_TwoKeysMask      = Cardinal(1) shl  6;
+        XkbAX_LatchToLockMask  = Cardinal(1) shl  7;
+        XkbAX_SKReleaseFBMask  = Cardinal(1) shl  8;
+        XkbAX_SKRejectFBMask   = Cardinal(1) shl  9;
+        XkbAX_BKRejectFBMask   = Cardinal(1) shl 10;
+        XkbAX_DumbBellFBMask   = Cardinal(1) shl 11;
+        XkbAX_FBOptionsMask    = $F3F;
+        XkbAX_SKOptionsMask    = $0C0;
+        XkbAX_AllOptionsMask   = $FFF;
+
+    {
+      XkbUseCoreKbd is used to specify the core keyboard without having
+                        to look up its X input extension identifier.
+      XkbUseCorePtr is used to specify the core pointer without having
+                        to look up its X input extension identifier.
+      XkbDfltXIClass is used to specify "don't care" any place that the
+                        XKB protocol is looking for an X Input Extension
+                        device class.
+      XkbDfltXIId is used to specify "don't care" any place that the
+                        XKB protocol is looking for an X Input Extension
+                        feedback identifier.
+      XkbAllXIClasses is used to get information about all device indicators,
+                        whether they're part of the indicator feedback class
+                        or the keyboard feedback class.
+      XkbAllXIIds is used to get information about all device indicator
+                        feedbacks without having to list them.
+      XkbXINone is used to indicate that no class or id has been specified.
+      XkbLegalXILedClass(c)  True if 'c' specifies a legal class with LEDs
+      XkbLegalXIBellClass(c) True if 'c' specifies a legal class with bells
+      XkbExplicitXIDevice(d) True if 'd' explicitly specifies a device
+      XkbExplicitXIClass(c)  True if 'c' explicitly specifies a device class
+      XkbExplicitXIId(c)     True if 'i' explicitly specifies a device id
+      XkbSingleXIClass(c)    True if 'c' specifies exactly one device class,
+                             including the default.
+      XkbSingleXIId(i)       True if 'i' specifies exactly one device
+                              identifier, including the default.
+                }
+const
+        XkbUseCoreKbd   = $0100;
+        XkbUseCorePtr   = $0200;
+        XkbDfltXIClass  = $0300;
+        XkbDfltXIId     = $0400;
+        XkbAllXIClasses = $0500;
+        XkbAllXIIds     = $0600;
+        XkbXINone       = $ff00;
+
+function XkbLegalXILedClass  (c : Cardinal) : LongBool;
+function XkbLegalXIBellClass (c : Cardinal) : LongBool;
+function XkbExplicitXIDevice (c : Cardinal) : LongBool;
+function XkbExplicitXIClass  (c : Cardinal) : LongBool;
+function XkbExplicitXIId     (c : Cardinal) : LongBool;
+function XkbSingleXIClass    (c : Cardinal) : LongBool;
+function XkbSingleXIId       (c : Cardinal) : LongBool;
+
+const
+        XkbNoModifier         = $ff;
+        XkbNoShiftLevel       = $ff;
+        XkbNoShape            = $ff;
+        XkbNoIndicator        = $ff;
+
+        XkbNoModifierMask     = 0;
+        XkbAllModifiersMask   = $ff;
+        XkbAllVirtualModsMask = $ffff;
+
+        XkbNumKbdGroups       = 4;
+        XkbMaxKbdGroup        = XkbNumKbdGroups-1;
+
+        XkbMaxMouseKeysBtn    = 4;
+
+                {
+      Group Index and Mask:
+       - Indices into the kt_index array of a key type.
+       - Mask specifies types to be changed for XkbChangeTypesOfKey
+    }
+const
+        XkbGroup1Index   =   0;
+        XkbGroup2Index   =   1;
+        XkbGroup3Index   =   2;
+        XkbGroup4Index   =   3;
+        XkbAnyGroup      = 254;
+        XkbAllGroups     = 255;
+
+        XkbGroup1Mask    = 1 shl  0;
+        XkbGroup2Mask    = 1 shl  1;
+        XkbGroup3Mask    = 1 shl  2;
+        XkbGroup4Mask    = 1 shl  3;
+        XkbAnyGroupMask  = 1 shl  7;
+        XkbAllGroupsMask = $f;
+
+    {
+      BuildCoreState: Given a keyboard group and a modifier state,
+                      construct the value to be reported an event.
+      GroupForCoreState:  Given the state reported in an event,
+                      determine the keyboard group.
+      IsLegalGroup:   Returns TRUE if 'g' is a valid group index.
+                }
+function XkbBuildCoreState    (m, g : Cardinal) : Cardinal;
+function XkbGroupForCoreState (s    : Cardinal) : Cardinal;
+function XkbIsLegalGroup      (g    : Cardinal) : LongBool;
+
+    {
+      GroupsWrap values:
+       - The 'groupsWrap' field of an XkbControlsRec specifies the
+         treatment of out of range groups.
+       - Bits 6 and 7 of the group info field of a key symbol map
+         specify the interpretation of out of range groups for the
+         corresponding key.
+                }
+const
+        XkbWrapIntoRange     = $00;
+        XkbClampIntoRange    = $40;
+        XkbRedirectIntoRange = $80;
+
+    {
+      Action flags:  Reported in the 'flags' field of most key actions.
+      Interpretation depends on the type of the action; not all actions
+      accept all flags.
+
+      Option                    Used for Actions
+      ------                    ----------------
+      ClearLocks                SetMods, LatchMods, SetGroup, LatchGroup
+      LatchToLock               SetMods, LatchMods, SetGroup, LatchGroup
+      LockNoLock                LockMods, ISOLock, LockPtrBtn, LockDeviceBtn
+      LockNoUnlock              LockMods, ISOLock, LockPtrBtn, LockDeviceBtn
+      UseModMapMods             SetMods, LatchMods, LockMods, ISOLock
+      GroupAbsolute             SetGroup, LatchGroup, LockGroup, ISOLock
+      UseDfltButton             PtrBtn, LockPtrBtn
+      NoAcceleration            MovePtr
+      MoveAbsoluteX             MovePtr
+      MoveAbsoluteY             MovePtr
+      ISODfltIsGroup            ISOLock
+      ISONoAffectMods           ISOLock
+      ISONoAffectGroup          ISOLock
+      ISONoAffectPtr            ISOLock
+      ISONoAffectCtrls          ISOLock
+      MessageOnPress            ActionMessage
+      MessageOnRelease          ActionMessage
+      MessageGenKeyEvent        ActionMessage
+      AffectDfltBtn             SetPtrDflt
+      DfltBtnAbsolute           SetPtrDflt
+      SwitchApplication SwitchScreen
+      SwitchAbsolute            SwitchScreen
+                }
+const
+        XkbSA_ClearLocks         = Cardinal(1) shl 0;
+        XkbSA_LatchToLock        = Cardinal(1) shl 1;
+
+        XkbSA_LockNoLock         = Cardinal(1) shl 0;
+        XkbSA_LockNoUnlock       = Cardinal(1) shl 1;
+
+        XkbSA_UseModMapMods      = Cardinal(1) shl 2;
+
+        XkbSA_GroupAbsolute      = Cardinal(1) shl 2;
+        XkbSA_UseDfltButton      = 0;
+
+        XkbSA_NoAcceleration     = Cardinal(1) shl 0;
+        XkbSA_MoveAbsoluteX      = Cardinal(1) shl 1;
+        XkbSA_MoveAbsoluteY      = Cardinal(1) shl 2;
+
+        XkbSA_ISODfltIsGroup     = Cardinal(1) shl 7;
+        XkbSA_ISONoAffectMods    = Cardinal(1) shl 6;
+        XkbSA_ISONoAffectGroup   = Cardinal(1) shl 5;
+        XkbSA_ISONoAffectPtr     = Cardinal(1) shl 4;
+        XkbSA_ISONoAffectCtrls   = Cardinal(1) shl 3;
+        XkbSA_ISOAffectMask      = $78;
+
+        XkbSA_MessageOnPress     = Cardinal(1) shl 0;
+        XkbSA_MessageOnRelease   = Cardinal(1) shl 1;
+        XkbSA_MessageGenKeyEvent = Cardinal(1) shl 2;
+
+        XkbSA_AffectDfltBtn      = 1;
+        XkbSA_DfltBtnAbsolute    = Cardinal(1) shl 2;
+
+        XkbSA_SwitchApplication  = Cardinal(1) shl 0;
+        XkbSA_SwitchAbsolute     = Cardinal(1) shl 2;
+
+    {
+      The following values apply to the SA_DeviceValuator
+      action only.  Valuator operations specify the action
+      to be taken.   Values specified in the action are
+      multiplied by 2^scale before they are applied.
+                }
+const
+        XkbSA_IgnoreVal      = $00;
+        XkbSA_SetValMin      = $10;
+        XkbSA_SetValCenter   = $20;
+        XkbSA_SetValMax      = $30;
+        XkbSA_SetValRelative = $40;
+        XkbSA_SetValAbsolute = $50;
+        XkbSA_ValOpMask      = $70;
+        XkbSA_ValScaleMask   = $07;
+
+function XkbSA_ValOp    (a : Cardinal) : Cardinal;
+function XkbSA_ValScale (a : Cardinal) : Cardinal;
+
+    {
+      Action types: specifies the type of a key action.  Reported in the
+      type field of all key actions.
+                }
+const
+        XkbSA_NoAction        = $00;
+        XkbSA_SetMods         = $01;
+        XkbSA_LatchMods       = $02;
+        XkbSA_LockMods        = $03;
+        XkbSA_SetGroup        = $04;
+        XkbSA_LatchGroup      = $05;
+        XkbSA_LockGroup       = $06;
+        XkbSA_MovePtr         = $07;
+        XkbSA_PtrBtn          = $08;
+        XkbSA_LockPtrBtn      = $09;
+        XkbSA_SetPtrDflt      = $0a;
+        XkbSA_ISOLock         = $0b;
+        XkbSA_Terminate       = $0c;
+        XkbSA_SwitchScreen    = $0d;
+        XkbSA_SetControls     = $0e;
+        XkbSA_LockControls    = $0f;
+        XkbSA_ActionMessage   = $10;
+        XkbSA_RedirectKey     = $11;
+        XkbSA_DeviceBtn       = $12;
+        XkbSA_LockDeviceBtn   = $13;
+        XkbSA_DeviceValuator  = $14;
+        XkbSA_LastAction      = XkbSA_DeviceValuator;
+        XkbSA_NumActions      = XkbSA_LastAction +1;
+
+{$ifDef XF86DDXACTIONS}
+        {$Define XF86}
+{$ELSE}
+        {$IFDEF XFree86Server}
+                 {$DEFINE XF86}
+        {$endif}
+{$ENDIF}
+
+{$IFDEF XF86}
+        XkbSA_XFree86Private  = $86;
+{$Endif}
+
+   {
+      Specifies the key actions that clear latched groups or modifiers.
+                }
+const
+{#define        XkbSA_BreakLatch \
+        ((1<<XkbSA_NoAction)|(1<<XkbSA_PtrBtn)|(1<<XkbSA_LockPtrBtn)|\
+        (1<<XkbSA_Terminate)|(1<<XkbSA_SwitchScreen)|(1<<XkbSA_SetControls)|\
+        (1<<XkbSA_LockControls)|(1<<XkbSA_ActionMessage)|\
+        (1<<XkbSA_RedirectKey)|(1<<XkbSA_DeviceBtn)|(1<<XkbSA_LockDeviceBtn))
+}
+        XkbSA_BreakLatch = (1 shl XkbSA_PtrBtn)        or (1 shl XkbSA_LockPtrBtn)  or (1 shl XkbSA_Terminate)
+                           or
+                           (1 shl XkbSA_SwitchScreen)  or (1 shl XkbSA_SetControls) or (1 shl XkbSA_LockControls)
+                                                                                 or
+                                                                                 (1 shl XkbSA_ActionMessage) or (1 shl XkbSA_RedirectKey) or (1 shl XkbSA_DeviceBtn)
+                                                                                 or
+                                                                                 (1 shl XkbSA_LockDeviceBtn);
+
+    {
+      Key Behavior Qualifier:
+         KB_Permanent indicates that the behavior describes an unalterable
+         characteristic of the keyboard, not an XKB software-simulation of
+         the listed behavior.
+      Key Behavior Types:
+         Specifies the behavior of the underlying key.
+                }
+const
+        XkbKB_Permanent   = $80;
+        XkbKB_OpMask      = $7f;
+
+        XkbKB_Default     = $00;
+        XkbKB_Lock        = $01;
+        XkbKB_RadioGroup  = $02;
+        XkbKB_Overlay1    = $03;
+        XkbKB_Overlay2    = $04;
+
+        XkbKB_RGAllowNone = $80;
+
+    {
+      Various macros which describe the range of legal keycodes.
+                }
+const
+        XkbMinLegalKeyCode    =   8;
+        XkbMaxLegalKeyCode    = 255;
+        XkbMaxKeyCount        = XkbMaxLegalKeyCode - XkbMinLegalKeyCode +1;
+        XkbPerKeyBitArraySize = (XkbMaxLegalKeyCode + 1) div 8;
+
+function XkbIsLegalKeycode (const k : Cardinal) : LongBool;
+
+type
+        PXkbControlsPtr = ^TXkbControlsRec;
+        TXkbControlsRec = record
+                           mk_dflt_btn      : Byte;
+                           num_groups       : Byte;
+                           groups_wrap      : Byte;
+                           internal         : TXkbModsRec;
+                           ignore_lock      : TXkbModsRec;
+                           enabled_ctrls    : Word;
+                           repeat_delay     : Word;
+                           repeat_interval  : Word;
+                           slow_keys_delay  : Word;
+                           debounce_delay   : Word;
+                           mk_delay         : Word;
+                           mk_interval      : Word;
+                           mk_time_to_max   : Word;
+                           mk_max_speed     : Word;
+                           mk_curve         : SmallInt;
+                           ax_options       : Word;
+                           ax_timeout       : Word;
+                           axt_opts_mask    : Word;
+                           axt_opts_values  : Word;
+                                                                                 axt_ctrls_mask   : Word;
+                                                                                 axt_ctrls_values : Word;
+                                                                                 per_key_repeat   : array [0..XkbPerKeyBitArraySize -1] of Byte;
+                          end;
+
+function XkbAX_AnyFeedback  (c : PXkbControlsPtr)           : Word;
+function XkbAX_NeedOption   (c : PXkbControlsPtr; w : Word) : Word;
+function XkbAX_NeedFeedback (c : PXkbControlsPtr; w : Word) : Boolean;
+
+    {
+      Assorted constants and limits.
+                }
+const
+        XkbNumModifiers        =   8;
+        XkbNumVirtualMods      =  16;
+        XkbNumIndicators       =  32;
+
+        XkbMaxRadioGroups      =  32;
+        XkbAllRadioGroupsMask  = $ffffffff;
+        XkbMaxShiftLevel       =  63;
+        XkbMaxSymsPerKey       = XkbMaxShiftLevel * XkbNumKbdGroups;
+        XkbRGMaxMembers        =  12;
+        XkbActionMessageLength =   6;
+        XkbKeyNameLength       =   4;
+        XkbMaxRedirectCount    =   8;
+
+        XkbGeomPtsPerMM        =  10;
+        XkbGeomMaxColors       =  32;
+        XkbGeomMaxLabelColors  =   3;
+        XkbGeomMaxPriority     = 255;
+
+type
+        PXkbServerMapPtr = ^TXkbServerMapRec;
+        TXkbServerMapRec = record
+                            num_acts   : Word;
+                                                                                        size_acts  : Word;
+                            acts       : PXkbAction;
+                            behaviors  : PXkbBehavior;
+                            key_acts   : PWord;
+                                                                                {$IF defined (__cplusplus) or defined (c_plusplus)}
+                                                                                        //explicit is a C++ reserved word
+                            c_explicit : PByte;
+                                                                                {$ELSE}
+                            explicit   : PByte;
+                          {$ENDIF}
+                                                                                        vmods      : array [0..XkbNumVirtualMods -1] of Byte;
+                            vmodmap    : PWord;
+                           end;
+
+function XkbSMKeyActionsPtr (m : PXkbServerMapPtr; k : Word) : PXkbAction;
+
+        {
+          Structures and access macros used primarily by clients
+        }
+
+type
+        PXkbSymMapPtr = ^TXkbSymMapRec;
+        TXkbSymMapRec = record
+                         kt_index   : array [0..XkbNumKbdGroups -1] of Byte;
+                         group_info : Byte;
+                         width      : Byte;
+                         offset     : Byte;
+                                                                        end;
+
+type
+        PXkbClientMapPtr = ^TXkbClientMapRec;
+        TXkbClientMapRec = record
+                            size_types  : Byte;
+                            num_types   : Byte;
+                            types       : PXkbKeyTypePtr;
+
+                            size_syms   : Word;
+                            num_syms    : Word;
+                            syms        : PKeySym;
+                            key_sym_map : PXkbSymMapPtr;
+
+                            modmap      : PByte;
+                           end;
+
+function XkbCMKeyGroupInfo   (m : PXkbClientMapPtr; k : Word)           : Byte;
+function XkbCMKeyNumGroups   (m : PXkbClientMapPtr; k : Word)           : Byte;
+function XkbCMKeyGroupWidth  (m : PXkbClientMapPtr; k : Word; g : Byte) : Byte;
+function XkbCMKeyGroupsWidth (m : PXkbClientMapPtr; k : Word)           : Byte;
+function XkbCMKeyTypeIndex   (m : PXkbClientMapPtr; k : Word; g : Byte) : Byte;
+function XkbCMKeyType        (m : PXkbClientMapPtr; k : Word; g : Byte) : PXkbKeyTypePtr;
+function XkbCMKeyNumSyms     (m : PXkbClientMapPtr; k : Word)           : Word;
+function XkbCMKeySymsOffset  (m : PXkbClientMapPtr; k : Word)           : Byte;
+function XkbCMKeySymsPtr     (m : PXkbClientMapPtr; k : Word)           : PKeySym;
+
+        {
+          Compatibility structures and access macros
+        }
+type
+        PXkbSymInterpretPtr = ^TXkbSymInterpretRec;
+        TXkbSymInterpretRec = record
+                               sym         : TKeySym;
+                               flags       : Byte;
+                               match       : Byte;
+                               mods        : Byte;
+                               virtual_mod : Byte;
+                               act         : TXkbAnyAction;
+                              end;
+
+type
+        PXkbCompatMapPtr = ^TXkbCompatMapRec;
+        TXkbCompatMapRec = record
+                            sym_interpret : PXkbSymInterpretPtr;
+                            groups        : array [0..XkbNumKbdGroups -1] of TXkbModsRec;
+                            num_si        : Word;
+                            size_si       : Word;
+                           end;
+
+type
+        PXkbIndicatorMapPtr = ^TXkbIndicatorMapRec;
+        TXkbIndicatorMapRec = record
+                               flags        : Byte;
+                               which_groups : Byte;
+                               groups       : Byte;
+                               which_mods   : Byte;
+                                                                                                 mods         : TXkbModsRec;
+                               ctrls        : Word;
+                              end;
+
+function XkbIM_IsAuto (i : PXkbIndicatorMapPtr) : Boolean;
+function XkbIM_InUse  (i : PXkbIndicatorMapPtr) : Boolean;
+
+type
+        PXkbIndicatorPtr = ^TXkbIndicatorRec;
+        TXkbIndicatorRec = record
+                            phys_indicators : LongWord;
+                            maps            : array [0..XkbNumIndicators -1] of TXkbIndicatorMapRec;
+                           end;
+
+type
+        PXkbKeyNamePtr = ^TXkbKeyNameRec;
+        TXkbKeyNameRec = record
+                          name : array [0..XkbKeyNameLength -1] of Char;
+                         end;
+
+type
+        PXkbKeyAliasPtr = ^TXkbKeyAliasRec;
+        TXkbKeyAliasRec = record
+                                                                                 real  : array [0..XkbKeyNameLength -1] of Char;
+                           alias : array [0..XkbKeyNameLength -1] of Char;
+                          end;
+
+        {
+          Names for everything
+        }
+type
+        PXkbNamesPtr = ^TXkbNamesRec;
+        TXkbNamesRec = record
+                        keycodes        : TAtom;
+                        geometry        : TAtom;
+                        symbols         : TAtom;
+                                                                        types           : TAtom;
+                        compat          : TAtom;
+                        vmods           : Array [0..XkbNumVirtualMods -1] of TAtom;
+                        indicators      : array [0..XkbNumIndicators  -1] of TAtom;
+                                                                        groups          : array [0..XkbNumKbdGroups   -1] of TAtom;
+                        keys            : PXkbKeyNamePtr;
+                        key_aliases     : PXkbKeyAliasPtr;
+                        radio_groups    : PAtom;
+                        phys_symbols    : TAtom;
+                        num_keys        : Byte;
+                                                                        num_key_aliases : Byte;
+                                                                        num_rg          : Word;
+                       end;
+
+    {
+      Key Type index and mask for the four standard key types.
+                }
+const
+        XkbOneLevelIndex    =   0;
+        XkbTwoLevelIndex    =   1;
+        XkbAlphabeticIndex  =   2;
+        XkbKeypadIndex      =   3;
+        XkbLastRequiredType = XkbKeypadIndex;
+        XkbNumRequiredTypes = XkbLastRequiredType + 1;
+        XkbMaxKeyTypes      = 255;
+
+        XkbOneLevelMask     = 1 shl 0;
+        XkbTwoLevelMask     = 1 shl 1;
+        XkbAlphabeticMask   = 1 shl 2;
+        XkbKeypadMask       = 1 shl 3;
+        XkbAllRequiredTypes = $f;
+
+function XkbShiftLevel     (n : Byte) : Byte;
+function XkbShiftLevelMask (n : Byte) : Byte;
+
+    {
+      Extension name and version information
+                }
+{$IFDEF MACRO}
+        {$DEFINE XkbName         := 'XKEYBOARD'}
+        {$DEFINE XkbMajorVersion := 1}
+        {$DEFINE XkbMinorVersion := 0}
+{$ELSE}
+const
+        XkbName         = 'XKEYBOARD';
+        XkbMajorVersion = 1;
+        XkbMinorVersion = 0;
+{$ENDIF}
+
+    {
+      Explicit map components:
+       - Used in the 'explicit' field of an XkbServerMap.  Specifies
+         the keyboard components that should _not_ be updated automatically
+         in response to core protocol keyboard mapping requests.
+                }
+const
+        XkbExplicitKeyTypesMask   = $0f;
+        XkbExplicitKeyType1Mask   = 1 shl 0;
+        XkbExplicitKeyType2Mask   = 1 shl 1;
+        XkbExplicitKeyType3Mask   = 1 shl 2;
+        XkbExplicitKeyType4Mask   = 1 shl 3;
+        XkbExplicitInterpretMask  = 1 shl 4;
+        XkbExplicitAutoRepeatMask = 1 shl 5;
+        XkbExplicitBehaviorMask   = 1 shl 6;
+        XkbExplicitVModMapMask    = 1 shl 7;
+        XkbAllExplicitMask        = $ff;
+
+    {
+      Symbol interpretations flags:
+       - Used in the flags field of a symbol interpretation
+                }
+const
+        XkbSI_AutoRepeat = 1 shl 0;
+        XkbSI_LockingKey = 1 shl 1;
+
+    {
+      Symbol interpretations match specification:
+       - Used in the match field of a symbol interpretation to specify
+         the conditions under which an interpretation is used.
+                }
+const
+        XkbSI_LevelOneOnly = $80;
+        XkbSI_OpMask       = $7f;
+        XkbSI_NoneOf       = 0;
+        XkbSI_AnyOfOrNone  = 1;
+        XkbSI_AnyOf        = 2;
+        XkbSI_AllOf        = 3;
+        XkbSI_Exactly      = 4;
+
+    {
+      Indicator map flags:
+       - Used in the flags field of an indicator map to indicate the
+         conditions under which and indicator can be changed and the
+         effects of changing the indicator.
+                }
+const
+        XkbIM_NoExplicit  = Cardinal(1) shl 7;
+        XkbIM_NoAutomatic = Cardinal(1) shl 6;
+        XkbIM_LEDDrivesKB = Cardinal(1) shl 5;
+
+    {
+      Indicator map component specifications:
+       - Used by the 'which_groups' and 'which_mods' fields of an indicator
+         map to specify which keyboard components should be used to drive
+         the indicator.
+                }
+const
+        XkbIM_UseBase      = Cardinal(1) shl 0;
+        XkbIM_UseLatched   = Cardinal(1) shl 1;
+        XkbIM_UseLocked    = Cardinal(1) shl 2;
+        XkbIM_UseEffective = Cardinal(1) shl 3;
+        XkbIM_UseCompat    = Cardinal(1) shl 4;
+
+        XkbIM_UseNone      = 0;
+        XkbIM_UseAnyGroup  = XkbIM_UseBase     or XkbIM_UseLatched or XkbIM_UseLocked or XkbIM_UseEffective;
+        XkbIM_UseAnyMods   = XkbIM_UseAnyGroup or XkbIM_UseCompat;
+
+    {
+      GetByName components:
+       - Specifies desired or necessary components to GetKbdByName request.
+       - Reports the components that were found in a GetKbdByNameReply
+                }
+const
+        XkbGBN_TypesMask         = Cardinal(1) shl 0;
+        XkbGBN_CompatMapMask     = Cardinal(1) shl 1;
+        XkbGBN_ClientSymbolsMask = Cardinal(1) shl 2;
+        XkbGBN_ServerSymbolsMask = Cardinal(1) shl 3;
+        XkbGBN_SymbolsMask       = XkbGBN_ClientSymbolsMask or XkbGBN_ServerSymbolsMask;
+        XkbGBN_IndicatorMapMask  = Cardinal(1) shl 4;
+        XkbGBN_KeyNamesMask      = Cardinal(1) shl 5;
+        XkbGBN_GeometryMask      = Cardinal(1) shl 6;
+        XkbGBN_OtherNamesMask    = Cardinal(1) shl 7;
+        XkbGBN_AllComponentsMask = $ff;
+
+     {
+       ListComponents flags
+                        }
+const
+        XkbLC_Hidden           = Cardinal(1) shl  0;
+        XkbLC_Default          = Cardinal(1) shl  1;
+        XkbLC_Partial          = Cardinal(1) shl  2;
+
+        XkbLC_AlphanumericKeys = Cardinal(1) shl  8;
+        XkbLC_ModifierKeys     = Cardinal(1) shl  9;
+        XkbLC_KeypadKeys       = Cardinal(1) shl 10;
+        XkbLC_FunctionKeys     = Cardinal(1) shl 11;
+        XkbLC_AlternateGroup   = Cardinal(1) shl 12;
+
+    {
+      X Input Extension Interactions
+      - Specifies the possible interactions between XKB and the X input
+        extension
+      - Used to request (XkbGetDeviceInfo) or change (XKbSetDeviceInfo)
+        XKB information about an extension device.
+      - Reports the list of supported optional features in the reply to
+        XkbGetDeviceInfo or in an XkbExtensionDeviceNotify event.
+      XkbXI_UnsupportedFeature is reported in XkbExtensionDeviceNotify
+      events to indicate an attempt to use an unsupported feature.
+                }
+const
+        XkbXI_KeyboardsMask             = Cardinal(1) shl  0;
+        XkbXI_ButtonActionsMask         = Cardinal(1) shl  1;
+        XkbXI_IndicatorNamesMask        = Cardinal(1) shl  2;
+        XkbXI_IndicatorMapsMask         = Cardinal(1) shl  3;
+        XkbXI_IndicatorStateMask        = Cardinal(1) shl  4;
+        XkbXI_UnsupportedFeatureMask    = Cardinal(1) shl 15;
+        XkbXI_AllFeaturesMask           = $001f;
+        XkbXI_AllDeviceFeaturesMask     = $001e;
+
+        XkbXI_IndicatorsMask            = $001c;
+        XkbAllExtensionDeviceEventsMask = $801f;
+
+    {
+      Per-Client Flags:
+       - Specifies flags to be changed by the PerClientFlags request.
+                }
+const
+        XkbPCF_DetectableAutoRepeatMask = Cardinal(1) shl 0;
+        XkbPCF_GrabsUseXKBStateMask     = Cardinal(1) shl 1;
+        XkbPCF_AutoResetControlsMask    = Cardinal(1) shl 2;
+        XkbPCF_LookupStateWhenGrabbed   = Cardinal(1) shl 3;
+        XkbPCF_SendEventUsesXKBState    = Cardinal(1) shl 4;
+        XkbPCF_AllFlagsMask             = $1F;
+
+    {
+      Debugging flags and controls
+                }
+const
+        XkbDF_DisableLocks = 1 shl 0;
+
+type
+        PXkbPropertyPtr = ^TXkbPropertyRec;
+        TXkbPropertyRec = record
+                           name  : PChar;
+                           value : PChar;
+                          end;
+
+type
+        PXkbColorPtr = ^TXkbColorRec;
+        TXkbColorRec = record
+                        pixel : Word;
+                        spec  : PChar;
+                       end;
+
+type
+        PXkbPointPtr = ^TXkbPointRec;
+        TXkbPointRec = record
+                        x : SmallInt;
+                        y : SmallInt;
+                       end;
+
+type
+        PXkbBoundsPtr = ^TXkbBoundsRec;
+        TXkbBoundsRec = record
+                         x1 : SmallInt;
+                         y1 : SmallInt;
+                         x2 : SmallInt;
+                         y2 : SmallInt;
+                        end;
+
+function XkbBoundsWidth  (b : PXkbBoundsPtr) : SmallInt;
+function XkbBoundsHeight (b : PXkbBoundsPtr) : SmallInt;
+
+type
+        PXkbOutlinePtr = ^TXkbOutlineRec;
+        TXkbOutlineRec = record
+                          num_points    : Word;
+                          sz_points     : Word;
+                          corner_radius : Word;
+                          points        : PXkbPointPtr;
+                         end;
+
+type
+        PXkbShapePtr = ^TXkbShapeRec;
+        TXkbShapeRec = record
+                        name         : TAtom;
+                        num_outlines : Word;
+                        sz_outlines  : Word;
+                        outlines     : PXkbOutlinePtr;
+                                                                        approx       : PXkbOutlinePtr;
+                        primary      : PXkbOutlinePtr;
+                                                                        bounds       : TXkbBoundsRec;
+                       end;
+
+function XkbOutlineIndex (s : PXkbShapePtr; o : PXkbOutlinePtr) : longint;
+
+type
+        PXkbShapeDoodadPtr = ^TXkbShapeDoodadRec;
+        TXkbShapeDoodadRec = record
+                              name      : TAtom;
+                              _type     : Byte;
+                              priority  : Byte;
+                              top       : SmallInt;
+                                                                                                left      : SmallInt;
+                              angle     : SmallInt;
+                              color_ndx : Word;
+                                                                                                shape_ndx : Word;
+                             end;
+
+type
+        PXkbTextDoodadPtr = ^TXkbTextDoodadRec;
+        TXkbTextDoodadRec = record
+                             name      : TAtom;
+                             _type     : Byte;
+                             priority  : Byte;
+                             top       : SmallInt;
+                             left      : SmallInt;
+                             angle     : SmallInt;
+                             width     : SmallInt;
+                             height    : SmallInt;
+                             color_ndx : Word;
+                             text      : PChar;
+                             font      : PChar;
+                            end;
+
+type
+        PXkbIndicatorDoodadPtr = ^TXkbIndicatorDoodadRec;
+        TXkbIndicatorDoodadRec = record
+                                  name          : TAtom;
+                                  _type         : Byte;
+                                  priority      : Byte;
+                                  top           : SmallInt;
+                                  left          : SmallInt;
+                                  angle         : SmallInt;
+                                  shape_ndx     : Word;
+                                  on_color_ndx  : Word;
+                                  off_color_ndx : Word;
+                                 end;
+
+type
+        PXkbLogoDoodadPtr = ^TXkbLogoDoodadRec;
+        TXkbLogoDoodadRec = record
+                                                                                         name      : TAtom;
+                             _type     : Byte;
+                             priority  : Byte;
+                             top       : SmallInt;
+                             left      : SmallInt;
+                             angle     : SmallInt;
+                             color_ndx : Word;
+                             shape_ndx : Word;
+                             logo_name : PChar;
+                            end;
+
+type
+        PXkbAnyDoodadPtr = ^TXkbAnyDoodadRec;
+        TXkbAnyDoodadRec = record
+                            name     : TAtom;
+                            _type    : Byte;
+                            priority : Byte;
+                            top      : SmallInt;
+                            left     : SmallInt;
+                            angle    : SmallInt;
+                           end;
+
+type
+        PXkbDoodadPtr = ^TXkbDoodadRec;
+        TXkbDoodadRec = record
+                         any       : TXkbAnyDoodadRec;
+                         shape     : TXkbShapeDoodadRec;
+                         text      : TXkbTextDoodadRec;
+                         indicator : TXkbIndicatorDoodadRec;
+                         logo      : TXkbLogoDoodadRec;
+                        end;
+
+const
+        XkbUnknownDoodad   = 0;
+        XkbOutlineDoodad   = 1;
+        XkbSolidDoodad     = 2;
+        XkbTextDoodad      = 3;
+        XkbIndicatorDoodad = 4;
+        XkbLogoDoodad      = 5;
+
+type
+        PXkbKeyPtr = ^TXkbKeyRec;
+        TXkbKeyRec = record
+                      name      : TXkbKeyNameRec;
+                      gap       : SmallInt;
+                      shape_ndx : Byte;
+                      color_ndx : Byte;
+                     end;
+
+type
+        PXkbRowPtr = ^TXkbRowRec;
+        TXkbRowRec = record
+                      top      : SmallInt;
+                      left     : SmallInt;
+                                                                num_keys : Word;
+                      sz_keys  : Word;
+                      vertical : SmallInt;
+                      Keys     : PXkbKeyPtr;
+                      bounds   : TXkbBoundsRec;
+                     end;
+
+type
+        PXkbOverlayPtr = ^TXkbOverlayRec; //forward for TXkbSectionRec use.
+
+//Do not add more "type"
+        PXkbSectionPtr = ^TXkbSectionRec;
+        TXkbSectionRec = record
+                          name         : TAtom;
+                          priority     : Byte;
+                          top          : SmallInt;
+                          left         : SmallInt;
+                          width        : Word;
+                          height       : Word;
+                          angle        : SmallInt;
+                          num_rows     : Word;
+                          num_doodads  : Word;
+                          num_overlays : Word;
+                          rows         : PXkbRowPtr;
+                                                                                doodads      : PXkbDoodadPtr;
+                          bounds       : TXkbBoundsRec;
+                          overlays     : PXkbOverlayPtr;
+                         end;
+
+//Do not add more "type"
+        PXkbOverlayKeyPtr = ^TXkbOverlayKeyRec;
+        TXkbOverlayKeyRec = record
+                             over  : TXkbKeyNameRec;
+                             under : TXkbKeyNameRec;
+                            end;
+
+//Do not add more "type"
+        PXkbOverlayRowPtr = ^TXkbOverlayRowRec;
+        TXkbOverlayRowRec = record
+                             row_under : SmallInt;
+                             num_keys  : SmallInt;
+                             sz_keys   : SmallInt;
+                             keys      : PXkbOverlayKeyPtr;
+                            end;
+
+//Do not add more "type"
+        TXkbOverlayRec = record
+                          name          : TAtom;
+                          section_under : PXkbSectionPtr;
+                          num_rows      : Word;
+                          sz_rows       : Word;
+                          rows          : PXkbOverlayRowPtr;
+                          bounds        : PXkbBoundsPtr;
+                         end;
+
+type
+        PXkbGeometryRec = ^TXkbGeometryRec;
+        PXkbGeometryPtr = PXkbGeometryRec;
+        TXkbGeometryRec = record
+                           name            : TAtom;
+                           width_mm        : Word;
+                                                                                 height_mm       : Word;
+                           label_font      : PChar;
+                           label_color     : PXkbColorPtr;
+                           base_color      : PXkbColorPtr;
+                           sz_properties   : Word;
+                           sz_colors       : Word;
+                           sz_shapes       : Word;
+                           sz_sections     : Word;
+                           sz_doodads      : Word;
+                                                                                 sz_key_aliases  : Word;
+                           num_properties  : Word;
+                           num_colors      : Word;
+                           num_shapes      : Word;
+                                                                                 num_sections    : Word;
+                                                                                 num_doodads     : Word;
+                                                                                 num_key_aliases : Word;
+                                                                                 properties      : PXkbPropertyPtr;
+                                                                                 colors          : PXkbColorPtr;
+                                                                                 shapes          : PXkbShapePtr;
+                                                                                 sections        : PXkbSectionPtr;
+                                                                                 key_aliases     : PXkbKeyAliasPtr;
+                          end;
+
+const
+        XkbGeomPropertiesMask = 1 shl 0;
+        XkbGeomColorsMask     = 1 shl 1;
+        XkbGeomShapesMask     = 1 shl 2;
+        XkbGeomSectionsMask   = 1 shl 3;
+        XkbGeomDoodadsMask    = 1 shl 4;
+        XkbGeomKeyAliasesMask = 1 shl 5;
+        XkbGeomAllMask        = $3f;
+
+type
+        PXkbGeometrySizesPtr = ^TXkbGeometrySizesRec;
+        TXkbGeometrySizesRec = record
+                                which           : Word;
+                                num_properties  : Word;
+                                                                                                        num_colors      : Word;
+                                num_shapes      : Word;
+                                num_sections    : Word;
+                                num_doodads     : Word;
+                                num_key_aliases : Word;
+                                                                                                 end;
+
+        {
+          Tie it all together into one big keyboard description
+        }
+type
+        PXkbDescPtr = ^TXkbDescRec;
+        TXkbDescRec = record
+                       dpy          : PDisplay;
+                       flags        : Word;
+                       device_spec  : Word;
+                       min_key_code : TKeyCode;
+                       max_key_code : TKeyCode;
+                       ctrls        : PXkbControlsPtr;
+                       server       : PXkbServerMapPtr;
+                       map          : PXkbClientMapPtr;
+                       indicators   : PXkbIndicatorPtr;
+                       names        : PXkbNamesPtr;
+                       compat       : PXkbCompatMapPtr;
+                       geom         : PXkbGeometryPtr;
+                      end;
+
+function XkbKeyKeyTypeIndex (d : PXkbDescPtr; k : Word; g  : Byte)           : Byte;
+function XkbKeyKeyType      (d : PXkbDescPtr; k : Word; g  : Byte)           : PXkbKeyTypePtr;
+function XkbKeyGroupWidth   (d : PXkbDescPtr; k : Word; g  : Byte)           : Byte;
+function XkbKeyGroupsWidth  (d : PXkbDescPtr; k : Word)                      : Byte;
+function XkbKeyGroupInfo    (d : PXkbDescPtr; k : Word)                      : Byte;
+function XkbKeyNumGroups    (d : PXkbDescPtr; k : Word)                      : Byte;
+function XkbKeyNumSyms      (d : PXkbDescPtr; k : Word)                      : Word;
+function XkbKeySymsPtr      (d : PXkbDescPtr; k : Word)                      : PKeySym;
+function XkbKeySym          (d : PXkbDescPtr; k : Word; n  : Word)           : TKeySym;
+function XkbKeySymEntry     (d : PXkbDescPtr; k : Word; sl : Word; g : Byte) : TKeySym;
+function XkbKeyAction       (d : PXkbDescPtr; k : Word; n  : Word)           : PXkbAction;
+function XkbKeyActionEntry  (d : PXkbDescPtr; k : Word; sl : Word; g : Byte) : Byte;
+function XkbKeyHasActions   (d : PXkbDescPtr; k : Word)                      : Boolean;
+function XkbKeyNumActions   (d : PXkbDescPtr; k : Word)                      : Word;
+function XkbKeyActionsPtr   (d : PXkbDescPtr; k : Word)                      : PXkbAction;
+function XkbKeycodeInRange  (d : PXkbDescPtr; k : Word)                      : Boolean;
+function XkbNumKeys         (d : PXkbDescPtr)                                : Byte;
+
+        {
+          The following structures can be used to track changes
+          to a keyboard device
+        }
+type
+        PXkbMapChangesPtr = ^TXkbMapChangesRec;
+        TXkbMapChangesRec = record
+                             changed            : Word;
+                             min_key_code       : TKeyCode;
+                             max_key_code       : TKeyCode;
+                             first_type         : Byte;
+                             num_types          : Byte;
+                             first_key_sym      : TKeyCode;
+                             num_key_syms       : Byte;
+                             first_key_act      : TKeyCode;
+                             num_key_acts       : Byte;
+                             first_key_behavior : TKeyCode;
+                             num_key_behaviors  : Byte;
+                             first_key_explicit : TKeyCode;
+                             num_key_explicit   : Byte;
+                             first_modmap_key   : TKeyCode;
+                             num_modmap_keys    : Byte;
+                             first_vmodmap_key  : TKeyCode;
+                             num_vmodmap_keys   : Byte;
+                             pad                : Byte;
+                             vmods              : Word;
+                            end;
+
+type
+        PXkbControlsChangesPtr = ^TXkbControlsChangesRec;
+        TXkbControlsChangesRec = record
+                                                                                                                changed_ctrls         : Word;
+                                  enabled_ctrls_changes : Word;
+                                  num_groups_changed    : Boolean;
+                                 end;
+
+type
+        PXkbIndicatorChangesPtr = ^TXkbIndicatorChangesRec;
+        TXkbIndicatorChangesRec = record
+                                   state_changes : Word;
+                                                                                                                 map_changes   : Word;
+                                  end;
+
+type
+        PXkbNameChangesPtr = ^TXkbNameChangesRec;
+        TXkbNameChangesRec = record
+                              changed            : Word;
+                              first_type         : Byte;
+                              num_types          : Byte;
+                              first_lvl          : Byte;
+                              num_lvls           : Byte;
+                              num_aliases        : Byte;
+                              num_rg             : Byte;
+                              first_key          : Byte;
+                                                                                                num_keys           : Byte;
+                                                                                                changed_vmods      : Word;
+                              changed_indicators : LongWord;
+                              changed_groups     : Byte;
+                             end;
+
+type
+        PXkbCompatChangesPtr = ^TXkbCompatChangesRec;
+        TXkbCompatChangesRec = record
+                                                                                                        changed_groups : Byte;
+                                first_si       : Word;
+                                num_si         : Word;
+                               end;
+
+type
+        PXkbChangesPtr = ^TXkbChangesRec;
+        TXkbChangesRec = record
+                          device_spec   : Word;
+                          state_changes : Word;
+                                                                                map           : TXkbMapChangesRec;
+                          ctrls         : TXkbControlsChangesRec;
+                          indicators    : TXkbIndicatorChangesRec;
+                                                                                names         : TXkbNameChangesRec;
+                          compat        : TXkbCompatChangesRec;
+                         end;
+
+        {
+          These data structures are used to construct a keymap from
+          a set of components or to list components in the server
+          database.
+        }
+type
+        PXkbComponentNamesPtr = ^TXkbComponentNamesRec;
+        TXkbComponentNamesRec = record
+                                 keymap   : PShortInt;
+                                 keycodes : PShortInt;
+                                 types    : PShortInt;
+                                 compat   : PShortInt;
+                                 symbols  : PShortInt;
+                                 geometry : PShortInt;
+                                end;
+
+type
+        PXkbComponentNamePtr = ^TXkbComponentNameRec;
+        TXkbComponentNameRec = record
+                                flags : Word;
+                                name  : PChar;
+                               end;
+
+type
+        PXkbComponentListPtr = ^TXkbComponentListRec;
+        TXkbComponentListRec = record
+                                num_keymaps  : SmallInt;
+                                num_keycodes : SmallInt;
+                                num_types    : SmallInt;
+                                num_compat   : SmallInt;
+                                                                                                        num_symbols  : SmallInt;
+                                num_geometry : SmallInt;
+                                keymaps      : PXkbComponentNamePtr;
+                                                                                                        keycodes     : PXkbComponentNamePtr;
+                                types        : PXkbComponentNamePtr;
+                                compat       : PXkbComponentNamePtr;
+                                symbols      : PXkbComponentNamePtr;
+                                geometry     : PXkbComponentNamePtr;
+                               end;
+
+        {
+          The following data structures describe and track changes to a
+          non-keyboard extension device
+        }
+type
+        PXkbDeviceLedInfoPtr = ^TXkbDeviceLedInfoRec;
+        TXkbDeviceLedInfoRec = record
+                                led_class       : Word;
+                                                                                                        led_id          : Word;
+                                phys_indicators : Word;
+                                maps_present    : Word;
+                                names_present   : Word;
+                                state           : Word;
+                                names           : array [0..XkbNumIndicators -1] of TAtom;
+                                                                                                        maps            : array [0..XkbNumIndicators -1] of TXkbIndicatorMapRec;
+                               end;
+
+type
+        PXkbDeviceInfoPtr = ^TXkbDeviceInfoRec;
+        TXkbDeviceInfoRec = record
+                             name          : PChar;
+                             _type         : TAtom;
+                             device_spec   : Word;
+                             has_own_state : Boolean;
+                                                                                         supported     : Word;
+                             unsupported   : Word;
+                             num_btns      : Word;
+                             btn_acts      : PXkbAction;
+                             sz_leds       : Word;
+                             num_leds      : Word;
+                                                                                         dflt_kbd_fb   : Word;
+                             dflt_led_fb   : Word;
+                                                                                         leds          : PXkbDeviceLedInfoPtr;
+                            end;
+
+function XkbXI_DevHasBtnActs (d : PXkbDeviceInfoPtr)           : Boolean;
+function XkbXI_LegalDevBtn   (d : PXkbDeviceInfoPtr; b : Word) : Boolean;
+function XkbXI_DevHasLeds    (d : PXkbDeviceInfoPtr)           : Boolean;
+
+type
+        PXkbDeviceLedChangesPtr = ^TXkbDeviceLedChangesRec;
+        TXkbDeviceLedChangesRec = record
+                                   led_class : Word;
+                                   led_id    : Word;
+                                   defined   : Word; //names or maps changed
+                                   next      : PXkbDeviceLedChangesPtr;
+                                  end;
+
+type
+        PXkbDeviceChangesPtr = ^TXkbDeviceChangesRec;
+        TXkbDeviceChangesRec = record
+                                changed   : Word;
+                                                                                                        first_btn : Word;
+                                num_btns  : Word;
+                                                                                                        leds      : TXkbDeviceLedChangesRec;
+                               end;
+
+function XkbShapeDoodadColor     (g : PXkbGeometryPtr; d : PXkbShapeDoodadPtr)  : PXkbColorPtr;
+function XkbShapeDoodadShape     (g : PXkbGeometryPtr; d : PXkbShapeDoodadPtr)  : PXkbShapePtr;
+procedure XkbSetShapeDoodadColor (g : PXkbGeometryPtr; d : PXkbShapeDoodadPtr; c : PXkbColorPtr);
+procedure XkbSetShapeDoodadShape (g : PXkbGeometryPtr; d : PXkbShapeDoodadPtr; s : PXkbShapePtr);
+
+function XkbTextDoodadColor     (g : PXkbGeometryPtr; d : PXkbTextDoodadPtr)    : PXkbColorPtr;
+procedure XkbSetTextDoodadColor (g : PXkbGeometryPtr; d : PXkbTextDoodadPtr; c : PXkbColorPtr);
+
+function XkbIndicatorDoodadShape        (g : PXkbGeometryPtr; d : PXkbIndicatorDoodadPtr)
+                                                                                                                                                                                                                                                                                                                                : PXkbShapeDoodadPtr;
+function XkbIndicatorDoodadOnColor      (g : PXkbGeometryPtr; d : PXkbIndicatorDoodadPtr) : PXkbColorPtr;
+function XkbIndicatorDoodadOffColor     (g : PXkbGeometryPtr; d : PXkbIndicatorDoodadPtr) : PXkbColorPtr;
+procedure XkbSetIndicatorDoodadOnColor  (g : PXkbGeometryPtr; d : PXkbIndicatorDoodadPtr;
+                                         c : PXkbColorPtr);
+procedure XkbSetIndicatorDoodadOffColor (g : PXkbGeometryPtr; d : PXkbIndicatorDoodadPtr;
+                                         c : PXkbColorPtr);
+procedure XkbSetIndicatorDoodadShape    (g : PXkbGeometryPtr; d : PXkbIndicatorDoodadPtr;
+                                                                                                                                                                 s : PXkbShapeDoodadPtr);
+
+function XkbLogoDoodadColor     (g : PXkbGeometryPtr; d : PXkbLogoDoodadPtr) : PXkbColorPtr;
+function XkbLogoDoodadShape     (g : PXkbGeometryPtr; d : PXkbLogoDoodadPtr) : PXkbShapeDoodadPtr;
+procedure XkbSetLogoDoodadColor (g : PXkbGeometryPtr; d : PXkbLogoDoodadPtr; c : PXkbColorPtr);
+procedure XkbSetLogoDoodadShape (g : PXkbGeometryPtr; d : PXkbLogoDoodadPtr; s : PXkbShapeDoodadPtr);
+
+function XkbKeyShape     (g : PXkbGeometryPtr; k : PXkbKeyPtr) : PXkbShapeDoodadPtr;
+function XkbKeyColor     (g : PXkbGeometryPtr; k : PXkbKeyPtr) : PXkbColorPtr;
+procedure XkbSetKeyShape (g : PXkbGeometryPtr; k : PXkbKeyPtr; s : PXkbShapeDoodadPtr);
+procedure XkbSetKeyColor (g : PXkbGeometryPtr; k : PXkbKeyPtr; c : PXkbColorPtr);
+
+function XkbGeomColorIndex (g : PXkbGeometryPtr; c : PXkbColorPtr) : longint;
+
+function XkbAddGeomProperty (geom : PXkbGeometryPtr; name : PChar; value : PChar) : PXkbPropertyPtr;
+        cdecl; external libX11 name 'XkbAddGeomProperty';
+
+function XkbAddGeomKeyAlias (geom : PXkbGeometryPtr; alias : PChar; real : PChar) : PXkbKeyAliasPtr;
+        cdecl; external libX11 name 'XkbAddGeomKeyAlias';
+
+function XkbAddGeomColor (geom : PXkbGeometryPtr; spec : PChar; pixel : Word) : PXkbColorPtr;
+        cdecl; external libX11 name 'XkbAddGeomColor';
+
+function XkbAddGeomOutline (shape : PXkbShapePtr; sz_points : SmallInt) : PXkbOutlinePtr;
+        cdecl; external libX11 name 'XkbAddGeomOutline';
+
+function XkbAddGeomShape (geom : PXkbGeometryPtr; name : TAtom; sz_outlines : SmallInt) : PXkbShapePtr;
+        cdecl; external libX11 name 'XkbAddGeomShape';
+
+function XkbAddGeomKey (row : PXkbRowPtr) : PXkbKeyPtr;
+        cdecl; external libX11 name 'XkbAddGeomKey';
+
+function XkbAddGeomRow (section : PXkbSectionPtr; sz_keys : SmallInt) : PXkbRowPtr;
+        cdecl; external libX11 name 'XkbAddGeomRow';
+
+function XkbAddGeomSection (geom        : PXkbGeometryPtr; name       : TAtom;
+                            sz_rows     : SmallInt;               sz_doodads : SmallInt;
+                                                                                                                sz_overlays : SmallInt)                              : PXkbSectionPtr;
+        cdecl; external libX11 name 'XkbAddGeomSection';
+
+function XkbAddGeomOverlay (section : PXkbSectionPtr; name : TAtom; sz_rows : SmallInt) : PXkbOverlayPtr;
+        cdecl; external libX11 name 'XkbAddGeomOverlay';
+
+function XkbAddGeomOverlayRow (overlay : PXkbOverlayPtr; row_under : SmallInt;
+                               sz_keys : SmallInt)                              : PXkbOverlayRowPtr;
+        cdecl; external libX11 name 'XkbAddGeomOverlayRow';
+
+function XkbAddGeomOverlayKey (overlay : PXkbOverlayPtr; row   : PXkbOverlayRowPtr;
+                                                                                                                         over    : PChar;          under : PChar)              : PXkbOverlayKeyPtr;
+        cdecl; external libX11 name 'XkbAddGeomOverlayKey';
+
+function XkbAddGeomDoodad (geom : PXkbGeometryPtr; section : PXkbSectionPtr; name : TAtom) : PXkbDoodadPtr;
+        cdecl; external libX11 name 'XkbAddGeomDoodad';
+
+procedure XkbFreeGeomKeyAliases (geom  : PXkbGeometryPtr; first   : SmallInt;
+                                 count : SmallInt;        freeAll : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeomKeyAliases';
+
+procedure XkbFreeGeomColors (geom : PXkbGeometryPtr; first : SmallInt; count : SmallInt; freeAll : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeomColors';
+
+procedure XkbFreeGeomDoodads (doodads : PXkbDoodadPtr; nDoodads : SmallInt; freeAll : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeomDoodads';
+
+procedure XkbFreeGeomProperties (geom  : PXkbGeometryPtr; first   : SmallInt;
+                                 count : SmallInt;        freeAll : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeomProperties';
+
+procedure XkbFreeGeomOverlayKeys (row   : PXkbOverlayRowPtr; first   : SmallInt;
+                                  count : SmallInt;          freeAll : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeomOverlayKeys';
+
+procedure XkbFreeGeomOverlayRows (overlay : PXkbOverlayPtr; first   : SmallInt;
+                                  count   : SmallInt;       freeAll : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeomOverlayRows';
+
+procedure XkbFreeGeomOverlays (section : PXkbSectionPtr; first   : SmallInt;
+                               count   : SmallInt;       freeAll : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeomOverlays';
+
+procedure XkbFreeGeomKeys (row : PXkbRowPtr; first : SmallInt; count : SmallInt; freeAll : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeomKeys';
+
+procedure XkbFreeGeomRows (section : PXkbSectionPtr; first   : SmallInt;
+                           count   : SmallInt;       freeAll : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeomRows';
+
+procedure XkbFreeGeomSections (geom  : PXkbGeometryPtr; first   : SmallInt;
+                               count : SmallInt;        freeAll : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeomSections';
+
+procedure XkbFreeGeomPoints (outline : PXkbOutlinePtr; first   : SmallInt;
+                             count   : SmallInt;       freeAll : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeomPoints';
+
+procedure XkbFreeGeomOutlines (shape : PXkbShapePtr; first   : SmallInt;
+                               count : SmallInt;     freeAll : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeomOutlines';
+
+procedure XkbFreeGeomShapes (geom  : PXkbGeometryPtr; first   : SmallInt;
+                             count : SmallInt;        freeAll : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeomShapes';
+
+procedure XkbFreeGeometry (geom : PXkbGeometryPtr; which : Word; freeMap : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeometry';
+
+function XkbAllocGeomProps (geom : PXkbGeometryPtr; nProps : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomProps';
+
+function XkbAllocGeomKeyAliases (geom : PXkbGeometryPtr; nAliases : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomKeyAliases';
+
+function XkbAllocGeomColors (geom : PXkbGeometryPtr; nColors : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomColors';
+
+function XkbAllocGeomShapes (geom : PXkbGeometryPtr; nShapes : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomShapes';
+
+function XkbAllocGeomSections (geom : PXkbGeometryPtr; nSections : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomSections';
+
+function XkbAllocGeomOverlays (section : PXkbSectionPtr; num_needed : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomOverlays';
+
+function XkbAllocGeomOverlayRows (overlay : PXkbOverlayPtr; num_needed : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomOverlayRows';
+
+function XkbAllocGeomOverlayKeys (row : PXkbOverlayRowPtr; num_needed : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomOverlayKeys';
+
+function XkbAllocGeomDoodads (geom : PXkbGeometryPtr; nDoodads : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomDoodads';
+
+function XkbAllocGeomSectionDoodads (section : PXkbSectionPtr; nDoodads : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomSectionDoodads';
+
+function XkbAllocGeomOutlines (shape : PXkbShapePtr; nOL : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomOutlines';
+
+function XkbAllocGeomRows (section : PXkbSectionPtr; nRows : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomRows';
+
+function XkbAllocGeomPoints (ol : PXkbOutlinePtr; nPts : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomPoints';
+
+function XkbAllocGeomKeys (row : PXkbRowPtr; nKeys : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomKeys';
+
+function XkbAllocGeometry (xkb : PXkbDescPtr; sizes : PXkbGeometrySizesPtr) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeometry';
+
+function XkbSetGeometry (dpy : PDisplay; deviceSpec : Word; geom : PXkbGeometryPtr) : TStatus;
+        cdecl; external libX11 name 'XkbSetGeometry';
+
+function XkbComputeShapeTop (shape : PXkbShapePtr; bounds : PXkbBoundsPtr) : Boolean;
+        cdecl; external libX11 name 'XkbComputeShapeTop';
+
+function XkbComputeShapeBounds (shape : PXkbShapePtr) : Boolean;
+        cdecl; external libX11 name 'XkbComputeShapeBounds';
+
+function XkbComputeRowBounds (geom : PXkbGeometryPtr; section : PXkbSectionPtr; row : PXkbRowPtr) : Boolean;
+        cdecl; external libX11 name 'XkbComputeRowBounds';
+
+function XkbComputeSectionBounds (geom : PXkbGeometryPtr; section : PXkbSectionPtr) : Boolean;
+        cdecl; external libX11 name 'XkbComputeSectionBounds';
+
+function XkbFindOverlayForKey (geom : PXkbGeometryPtr; wanted : PXkbSectionPtr; under : PChar) : PChar;
+        cdecl; external libX11 name 'XkbFindOverlayForKey';
+
+function XkbGetGeometry (dpy : PDisplay; xkb : PXkbDescPtr) : TStatus;
+        cdecl; external libX11 name 'XkbGetGeometry';
+
+function XkbGetNamedGeometry (dpy : PDisplay; xkb : PXkbDescPtr; name : TAtom) : TStatus;
+        cdecl; external libX11 name 'XkbGetNamedGeometry';
+
+
+{$ifdef XKB_IN_SERVER}
+function SrvXkbAddGeomKeyAlias (geom : PXkbGeometryPtr; alias : PChar; real : PChar) : PXkbKeyAliasPtr;
+        cdecl; external libX11 name 'XkbAddGeomKeyAlias';
+
+function SrvXkbAddGeomColor (geom : PXkbGeometryPtr; spec : PChar; pixel : Word) : PXkbColorPtr;
+        cdecl; external libX11 name 'XkbAddGeomColor';
+
+function SrvXkbAddGeomDoodad (geom : PXkbGeometryPtr; section : PXkbSectionPtr;
+                              name : TAtom)                                     : PXkbDoodadPtr;
+        cdecl; external libX11 name 'XkbAddGeomDoodad';
+
+function SrvXkbAddGeomKey (geom : PXkbGeometryPtr; alias : PChar; real : PChar) : PXkbKeyAliasPtr;
+        cdecl; external libX11 name 'XkbAddGeomKeyAlias';
+
+function SrvXkbAddGeomOutline (shape : PXkbShapePtr; sz_points : SmallInt) : PXkbOutlinePtr;
+        cdecl; external libX11 name 'XkbAddGeomOutline';
+
+function SrvXkbAddGeomOverlay (overlay : PXkbOverlayPtr; row   : PXkbOverlayRowPtr;
+                                                                                                                         over    : PChar;          under : PChar)              : PXkbOverlayKeyPtr;
+        cdecl; external libX11 name 'XkbAddGeomOverlayKey';
+
+function SrvXkbAddGeomOverlayRow (overlay : PXkbOverlayPtr; row_under : SmallInt;
+                               sz_keys : SmallInt)                              : PXkbOverlayRowPtr
+        cdecl; external libX11 name 'XkbAddGeomOverlayRow';
+
+function SrvXkbAddGeomOverlayKey (overlay : PXkbOverlayPtr; row   : PXkbOverlayRowPtr;
+                                                                                                                         over    : PChar;          under : PChar)              : PXkbOverlayKeyPtr;
+        cdecl; external libX11 name 'XkbAddGeomOverlayKey';
+
+function SrvXkbAddGeomProperty (geom : PXkbGeometryPtr; name : PChar; value : PChar) : PXkbPropertyPtr;
+        cdecl; external libX11 name 'XkbAddGeomProperty';
+
+function SrvXkbAddGeomRow (section : PXkbSectionPtr; sz_keys : SmallInt) : PXkbRowPtr;
+        cdecl; external libX11 name 'XkbAddGeomRow';
+
+function SrvXkbAddGeomSection (geom        : PXkbGeometryPtr; name       : TAtom;
+                               sz_rows     : SmallInt;                    sz_doodads : SmallInt;
+                                                                                                                   sz_overlays : SmallInt)                              : PXkbSectionPtr;
+        cdecl; external libX11 name 'XkbAddGeomSection';
+
+function SrvXkbAddGeomShape (geom : PXkbGeometryPtr; name : TAtom; sz_outlines : SmallInt) : PXkbShapePtr;
+        cdecl; external libX11 name 'XkbAddGeomShape';
+
+function SrvXkbAllocGeomKeyAliases (geom : PXkbGeometryPtr; nAliases : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomKeyAliases';
+
+function SrvXkbAllocGeomColors (geom : PXkbGeometryPtr; nColors : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomColors';
+
+function SrvXkbAllocGeomDoodads (geom : PXkbGeometryPtr; nDoodads : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomDoodads';
+
+function SrvXkbAllocGeomKeys (row : PXkbRowPtr; nKeys : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomKeys';
+
+function SrvXkbAllocGeomOutlines (shape : PXkbShapePtr; nOL : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomOutlines';
+
+function SrvXkbAllocGeomPoints (ol : PXkbOutlinePtr; nPts : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomPoints';
+
+function SrvXkbAllocGeomProps (geom : PXkbGeometryPtr; nProps : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomProps';
+
+function SrvXkbAllocGeomRows (section : PXkbSectionPtr; nRows : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomRows';
+
+function SrvXkbAllocGeomSectionDoodads (section : PXkbSectionPtr; nDoodads : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomSectionDoodads';
+
+function SrvXkbAllocGeomSections (geom : PXkbGeometryPtr; nSections : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomSections';
+
+function SrvXkbAllocGeomOverlays (section : PXkbSectionPtr; num_needed : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomOverlays';
+
+function SrvXkbAllocGeomOverlayRows (overlay : PXkbOverlayPtr; num_needed : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomOverlayRows';
+
+function SrvXkbAllocGeomOverlayKeys (row : PXkbOverlayRowPtr; num_needed : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomOverlayKeys';
+
+function SrvXkbAllocGeomShapes (geom : PXkbGeometryPtr; nShapes : SmallInt) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeomShapes';
+
+function SrvXkbAllocGeometry (xkb : PXkbDescPtr; sizes : PXkbGeometrySizesPtr) : TStatus;
+        cdecl; external libX11 name 'XkbAllocGeometry';
+
+procedure SrvXkbFreeGeomKeyAliases (geom  : PXkbGeometryPtr; first   : SmallInt;
+                                 count : SmallInt;        freeAll : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeomKeyAliases';
+
+procedure SrvXkbFreeGeomColors (geom  : PXkbGeometryPtr; first   : SmallInt;
+                                count : SmallInt;        freeAll : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeomColors';
+
+procedure SrvXkbFreeGeomDoodads (doodads : PXkbDoodadPtr; nDoodads : SmallInt; freeAll : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeomDoodads';
+
+procedure SrvXkbFreeGeomProperties (geom  : PXkbGeometryPtr; first   : SmallInt;
+                                 count : SmallInt;        freeAll : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeomProperties';
+
+procedure SrvXkbFreeGeomOverlayKeys (row   : PXkbOverlayRowPtr; first   : SmallInt;
+                                     count : SmallInt;          freeAll : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeomOverlayKeys';
+
+procedure SrvXkbFreeGeomOverlayRows (overlay : PXkbOverlayPtr; first   : SmallInt;
+                                  count   : SmallInt;       freeAll : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeomOverlayRows';
+
+procedure SrvXkbFreeGeomOverlays (section : PXkbSectionPtr; first   : SmallInt;
+                               count   : SmallInt;       freeAll : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeomOverlays';
+
+procedure SrvXkbFreeGeomKeys (row : PXkbRowPtr; first : SmallInt; count : SmallInt; freeAll : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeomKeys';
+
+procedure SrvXkbFreeGeomRows (section : PXkbSectionPtr; first   : SmallInt;
+                           count   : SmallInt;       freeAll : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeomRows';
+
+procedure SrvXkbFreeGeomSections (geom  : PXkbGeometryPtr; first   : SmallInt;
+                               count : SmallInt;        freeAll : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeomSections';
+
+procedure SrvXkbFreeGeomPoints (outline : PXkbOutlinePtr; first   : SmallInt;
+                             count   : SmallInt;       freeAll : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeomPoints';
+
+procedure SrvXkbFreeGeomOutlines (shape : PXkbShapePtr; first   : SmallInt;
+                               count : SmallInt;     freeAll : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeomOutlines';
+
+procedure SrvXkbFreeGeomShapes (geom  : PXkbGeometryPtr; first   : SmallInt;
+                             count : SmallInt;        freeAll : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeomShapes';
+
+procedure SrvXkbFreeGeometry (geom : PXkbGeometryPtr; which : Word; freeMap : Boolean);
+        cdecl; external libX11 name 'XkbFreeGeometry';
+{$endif}
+
+implementation
+uses xi;
+
+(************************************* xkb *************************************)
+function XkbLegalXILedClass (c : Cardinal) : LongBool;
+begin
+{#define XkbLegalXILedClass(c) (((c)==KbdFeedbackClass)||((c)==LedFeedbackClass)||
+                                ((c)==XkbDfltXIClass)||((c)==XkbAllXIClasses))}
+        Result := (c = KbdFeedbackClass) or (c = LedFeedbackClass) or
+            (c = XkbDfltXIClass)   or (c = XkbAllXIClasses);
+end;
+
+function XkbLegalXIBellClass (c : Cardinal) : LongBool;
+begin
+{#define XkbLegalXIBellClass(c) (((c)==KbdFeedbackClass)||((c)==BellFeedbackClass)||
+                                 ((c)==XkbDfltXIClass)||((c)==XkbAllXIClasses))}
+        Result := (c = KbdFeedbackClass) or (c = BellFeedbackClass) or
+            (c = XkbDfltXIClass)   or (c = XkbAllXIClasses);
+end;
+
+function XkbExplicitXIDevice (c : Cardinal) : LongBool;
+begin
+{#define XkbExplicitXIDevice(c) (((c)&(~0xff))==0)}
+        Result := (c and (not $ff)) = 0;
+end;
+
+function XkbExplicitXIClass (c : Cardinal) : LongBool;
+begin
+{#define XkbExplicitXIClass(c) (((c)&(~0xff))==0)}
+        Result := (c and (not $ff)) = 0;
+end;
+
+function XkbExplicitXIId (c : Cardinal) : LongBool;
+begin
+{#define XkbExplicitXIId(c) (((c)&(~0xff))==0)}
+        Result := (c and (not $ff)) = 0;
+end;
+
+function XkbSingleXIClass (c : Cardinal) : LongBool;
+begin
+{#define XkbSingleXIClass(c) ((((c)&(~0xff))==0)||((c)==XkbDfltXIClass))}
+        Result := ((c and (not $ff)) = 0) or (c = XkbDfltXIClass);
+end;
+
+function XkbSingleXIId (c : Cardinal) : LongBool;
+begin
+{#define XkbSingleXIId(c) ((((c)&(~0xff))==0)||((c)==XkbDfltXIId))}
+        Result := ((c and (not $ff)) = 0) or (c = XkbDfltXIId);
+end;
+
+function XkbBuildCoreState (m, g : Cardinal) : Cardinal;
+begin
+{#define XkbBuildCoreState(m,g) ((((g)&0x3)<<13)|((m)&0xff))}
+        Result := ((g and $3) shl 13) or (m and $ff);
+end;
+
+function XkbGroupForCoreState (s : Cardinal) : Cardinal;
+begin
+{#define XkbGroupForCoreState(s) (((s)>>13)&0x3)}
+        Result := (s shr 13) and $3;
+end;
+
+function XkbIsLegalGroup (g : Cardinal) : LongBool;
+begin
+{#define XkbIsLegalGroup(g) (((g)>=0)&&((g)<XkbNumKbdGroups))}
+        Result := (g >= 0) and (g < XkbNumKbdGroups);
+end;
+
+function XkbSA_ValOp (a : Cardinal) : Cardinal;
+begin
+{#define XkbSA_ValOp(a) ((a)&XkbSA_ValOpMask)}
+        Result := a and XkbSA_ValOpMask;
+end;
+
+function XkbSA_ValScale (a : Cardinal) : Cardinal;
+begin
+{#define XkbSA_ValScale(a) ((a)&XkbSA_ValScaleMask)}
+        Result := a and XkbSA_ValScaleMask;
+end;
+
+function XkbIsModAction (a : PXkbAnyAction) : LongBool;
+begin
+{#define XkbIsModAction(a) (((a)->type>=Xkb_SASetMods)&&((a)->type<=XkbSA_LockMods))}
+        Result := (a^._type >= XkbSA_SetMods) and (a^._type <= XkbSA_LockMods);
+end;
+
+function XkbIsGroupAction (a : PXkbAnyAction) : LongBool;
+begin
+{#define XkbIsGroupAction(a) (((a)->type>=XkbSA_SetGroup)&&((a)->type<=XkbSA_LockGroup))}
+        Result := (a^._type >= XkbSA_SetGroup) or (a^._type <= XkbSA_LockGroup);
+end;
+
+function XkbIsPtrAction (a : PXkbAnyAction) : LongBool;
+begin
+{#define XkbIsPtrAction(a) (((a)->type>=XkbSA_MovePtr)&&((a)->type<=XkbSA_SetPtrDflt))}
+        Result := (a^._type >= XkbSA_MovePtr) and (a^._type <= XkbSA_SetPtrDflt);
+end;
+
+function XkbIsLegalKeycode (const k : Cardinal) : LongBool;
+begin
+{#define        XkbIsLegalKeycode(k)    (((k)>=XkbMinLegalKeyCode)&&((k)<=XkbMaxLegalKeyCode))}
+        Result := (k >= XkbMinLegalKeyCode) and (k <= XkbMaxLegalKeyCode);
+end;
+
+function XkbShiftLevel (n : Byte) : Byte;
+begin
+{#define XkbShiftLevel(n) ((n)-1)}
+        Result := n -1;
+end;
+
+function XkbShiftLevelMask (n : Byte) : Byte;
+begin
+{#define XkbShiftLevelMask(n) (1<<((n)-1))}
+        Result := 1 shl (n - 1);
+end;
+
+(********************************** End of xkb **********************************)
+
+(************************************ xkbstr ************************************)
+function XkbCharToInt (v : Byte) : SmallInt;
+begin
+{#define XkbCharToInt(v) ((v)&0x80?(int)((v)|(~0xff)):(int)((v)&0x7f))}
+        if ((v and $80)<>0) then
+                Result := v or (not $ff)
+        else
+                Result := longint (v) and $7f;
+end;
+
+procedure XkbIntTo2Chars (i : word; var h, l : byte);
+begin
+{#define XkbIntTo2Chars(i,h,l) (((h)=((i>>8)&0xff)),((l)=((i)&0xff)))}
+        h := (i shr 8) and $ff;
+        l := i and $ff;
+end;
+
+function Xkb2CharsToInt (h, l : Byte) : SmallInt;
+begin
+{$IFDEF WORD64}
+        {$IFDEF UNSIGNEDBITFIELDS}
+                {$DEFINE BIT64}
+        {$ENDIF}
+{$ENDIF}
+{$IFDEF BIT64}
+{$UNDEF BIT64}
+{#define Xkb2CharsToInt(h,l) ((h)&0x80?(int)(((h)<<8)|(l)|(~0xffff)): (int)(((h)<<8)|(l)&0x7fff))}
+                if ((h = $80) <> 0) then
+                        Result := ((LongInt (h) shl 8) or l or (not $ffff))
+                else
+                        Result := ((LongInt (h) shl 8) or l and $7fff));
+{$ELSE}
+{#define Xkb2CharsToInt(h,l) ((short)(((h)<<8)|(l)))}
+                Result := (integer (h) shl 8) or l;
+{$ENDIF}
+end;
+
+function XkbModLocks (s : PXkbStatePtr) : Byte;
+begin
+{#define XkbModLocks(s) ((s)->locked_mods)}
+        Result := s^.locked_mods;
+end;
+
+function XkbStateMods (s : PXkbStatePtr) : Word;
+begin
+{#define XkbStateMods(s) ((s)->base_mods|(s)->latched_mods|XkbModLocks(s))}
+        Result := s^.base_mods or s^.latched_mods or XkbModLocks (s);
+end;
+
+function XkbGroupLock (s : PXkbStatePtr) : Byte;
+begin
+{#define XkbGroupLock(s) ((s)->locked_group)}
+        Result := s^.locked_group;
+end;
+
+function XkbStateGroup (s : PXkbStatePtr) : Word;
+begin
+{#define XkbStateGroup(s) ((s)->base_group+(s)->latched_group+XkbGroupLock(s))}
+        Result := S^.base_group + s^.latched_group + XkbGroupLock (s);
+end;
+
+function XkbStateFieldFromRec (s : PXkbStatePtr) : Cardinal;
+begin
+{#define XkbStateFieldFromRec(s) XkbBuildCoreState((s)->lookup_mods,(s)->group)}
+        Result := XkbBuildCoreState (s^.lookup_mods, s^.group);
+end;
+
+function XkbGrabStateFromRec  (s : PXkbStatePtr) : Cardinal;
+begin
+{#define XkbGrabStateFromRec(s) XkbBuildCoreState((s)->grab_mods,(s)->group)}
+        Result := XkbBuildCoreState (s^.grab_mods, s^.group);
+end;
+
+function XkbNumGroups (g : Word) : Word;
+begin
+{#define XkbNumGroups(g) ((g)&0x0f)}
+        Result := g and $0f;
+end;
+
+function XkbOutOfRangeGroupInfo (g : Word) : Word;
+begin
+{#define XkbOutOfRangeGroupInfo(g) ((g)&0xf0)}
+        Result := g and $f0;
+end;
+
+function XkbOutOfRangeGroupAction (g : Word) : Word;
+begin
+{#define XkbOutOfRangeGroupAction(g) ((g)&0xc0)}
+        Result := g and $c0;
+end;
+
+function XkbOutOfRangeGroupNumber (g : Word) : Word;
+begin
+{#define XkbOutOfRangeGroupNumber(g) (((g)&0x30)>>4)}
+        Result := (g and $30) shr 4;
+end;
+
+function XkbSetGroupInfo (g, w, n : Word) : Word;
+begin
+{#define XkbSetGroupInfo(g,w,n) (((w)&0xc0)|(((n)&3)<<4)|((g)&0x0f))}
+        Result := (w and $c0) or ((n and 3) shl 4) or (g and $0f);
+end;
+
+function XkbSetNumGroups (g, n : Word) : Word;
+begin
+{#define XkbSetNumGroups(g,n) (((g)&0xf0)|((n)&0x0f))}
+        Result := (g and $f0) or (n and $0f);
+end;
+
+function XkbModActionVMods (a : PXkbModAction) : SmallInt;
+begin
+{#define XkbModActionVMods(a) ((short)(((a)->vmods1<<8)|((a)->vmods2)))}
+        Result := (integer (a^.vmods1) shl 8) or a^.vmods2;
+end;
+
+procedure XkbSetModActionVMods (a : PXkbModAction; v : Byte);
+begin
+{#define XkbSetModActionVMods(a,v) (((a)->vmods1=(((v)>>8)&0xff)),(a)->vmods2=((v)&0xff))}
+        a^.vmods1 := (v shr 8) and $ff;
+        a^.vmods2 := v and $ff;
+end;
+
+function XkbSAGroup (a : PXkbGroupAction) : ShortInt;
+begin
+{#define XkbSAGroup(a) (XkbCharToInt((a)->group_XXX))}
+        Result := ShortInt(XkbCharToInt(a^.group_XXX));
+end;
+
+procedure XkbSASetGroup (a : PXkbGroupAction; g : ShortInt);
+begin
+{#define XkbSASetGroup(a,g) ((a)->group_XXX=(g))}
+        a^.group_XXX := g;
+end;
+
+function XkbPtrActionX (a : PXkbPtrAction) : Word;
+begin
+{#define XkbPtrActionX(a) (Xkb2CharsToInt((a)->high_XXX,(a)->low_XXX))}
+        Result := Word(Xkb2CharsToInt(a^.high_XXX,a^.low_XXX));
+end;
+
+function XkbPtrActionY (a : PXkbPtrAction) : Word;
+begin
+{#define XkbPtrActionY(a) (Xkb2CharsToInt((a)->high_YYY,(a)->low_YYY))}
+        Result := Word(Xkb2CharsToInt(a^.high_YYY,a^.low_YYY));
+end;
+
+procedure XkbSetPtrActionX (a : PXkbPtrAction; x : Byte);
+begin
+{#define XkbSetPtrActionX(a,x) (XkbIntTo2Chars(x,(a)->high_XXX,(a)->low_XXX))}
+        XkbIntTo2Chars(x, a^.high_XXX, a^.low_XXX);
+end;
+
+procedure XkbSetPtrActionY (a : PXkbPtrAction; y : Byte);
+begin
+{#define XkbSetPtrActionY(a,y) (XkbIntTo2Chars(y,(a)->high_YYY,(a)->low_YYY))}
+        XkbIntTo2Chars (y, a^.high_YYY, a^.low_YYY);
+end;
+
+function XkbSAPtrDfltValue (a : PXkbPtrDfltAction) : ShortInt;
+begin
+{#define XkbSAPtrDfltValue(a) (XkbCharToInt((a)->valueXXX))}
+        Result := ShortInt (XkbCharToInt(a^.valueXXX));
+end;
+
+procedure XkbSASetPtrDfltValue (a : PXkbPtrDfltAction; const c);
+begin
+{#define XkbSASetPtrDfltValue(a,c) ((a)->valueXXX= ((c)&0xff))}
+        a^.valueXXX := ShortInt (c) and $ff;
+end;
+
+function XkbSAScreen (a : PXkbSwitchScreenAction) : ShortInt;
+begin
+{#define XkbSAScreen(a) (XkbCharToInt((a)->screenXXX))}
+        Result := ShortInt (XkbCharToInt(a^.screenXXX));
+end;
+
+procedure XkbSASetScreen (a : PXkbSwitchScreenAction; const s);
+begin
+{#define XkbSASetScreen(a,s) ((a)->screenXXX= ((s)&0xff))}
+        a^.screenXXX := ShortInt (s) and $ff;
+end;
+
+procedure XkbActionSetCtrls (a : PXkbCtrlsAction; c : Byte);
+begin
+{#define XkbActionSetCtrls(a,c) (((a)->ctrls3=(((c)>>24)&0xff)),((a)->ctrls2=(((c)>>16)&0xff)),
+                                 ((a)->ctrls1=(((c)>>8)&0xff)),((a)->ctrls0=((c)&0xff)))        }
+        a^.ctrls3 := ((c shr  24) and $ff);
+        a^.ctrls2 := ((c shr  16) and $ff);
+        a^.ctrls1 := ((c shr   8) and $ff);
+        a^.ctrls0 :=  (c and $ff);
+end;
+
+function XkbActionCtrls (a : PXkbCtrlsAction) : Word;
+begin
+{#define XkbActionCtrls(a) ((((unsigned int)(a)->ctrls3)<<24)|(((unsigned int)(a)->ctrls2)<<16)|
+                            (((unsigned int)(a)->ctrls1)<<8)|((unsigned int)((a)->ctrls0)))      }
+        Result := (a^.ctrls3 shl 24) or
+                  (a^.ctrls2 shl 16) or
+                  (a^.ctrls1 shl  8) or
+                   a^.ctrls0;
+end;
+
+function XkbSARedirectVMods (a : PXkbRedirectKeyAction) : Word;
+begin
+{#define XkbSARedirectVMods(a) ((((unsigned int)(a)->vmods1)<<8)|((unsigned int)(a)->vmods0))}
+        Result := (a^.vmods1 shl 8) or
+                                                a^.vmods0;
+end;
+
+procedure XkbSARedirectSetVMods (a : PXkbRedirectKeyAction; m : Byte);
+begin
+{#define XkbSARedirectSetVMods(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),((a)->vmods_mask0=((m)&0xff)))}
+        a^.vmods_mask1 := (m shr 8) and $ff;
+        a^.vmods_mask0 :=  m or $ff;
+end;
+
+function XkbSARedirectVModsMask (a : PXkbRedirectKeyAction) : Word;
+begin
+{#define XkbSARedirectVModsMask(a) ((((unsigned int)(a)->vmods_mask1)<<8)|
+                                     ((unsigned int)(a)->vmods_mask0))}
+        Result := (a^.vmods_mask1 shl 8) or
+                   a^.vmods_mask0;
+end;
+
+procedure XkbSARedirectSetVModsMask (a : PXkbRedirectKeyAction; m : Byte);
+begin
+{#define XkbSARedirectSetVModsMask(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),((a)->vmods_mask0=((m)&0xff)))}
+        a^.vmods_mask1 := (m shr 8) and $ff;
+        a^.vmods_mask0 := (m and $ff);
+end;
+
+function XkbAX_AnyFeedback (c : PXkbControlsPtr) : Word;
+begin
+{#define XkbAX_AnyFeedback(c) ((c)->enabled_ctrls&XkbAccessXFeedbackMask)}
+        Result := c^.enabled_ctrls and XkbAccessXFeedbackMask;
+end;
+
+function XkbAX_NeedOption (c : PXkbControlsPtr; w : Word) : Word;
+begin
+{#define XkbAX_NeedOption(c,w) ((c)->ax_options&(w))}
+        Result := c^.ax_options and w;
+end;
+
+function XkbAX_NeedFeedback (c : PXkbControlsPtr; w : Word) : Boolean;
+begin
+{#define XkbAX_NeedFeedback(c,w) (XkbAX_AnyFeedback(c)&&XkbAX_NeedOption(c,w))}
+        Result := (XkbAX_AnyFeedback (c) > 0) and (XkbAX_NeedOption (c, w) > 0);
+end;
+
+function XkbSMKeyActionsPtr (m : PXkbServerMapPtr; k : Word) : PXkbAction;
+begin
+{#define XkbSMKeyActionsPtr(m,k) (&(m)->acts[(m)->key_acts[k]])}
+        Result := @m^.acts [m^.key_acts [k]];
+end;
+
+function XkbCMKeyGroupInfo (m : PXkbClientMapPtr; k : Word) : Byte;
+begin
+{#define XkbCMKeyGroupInfo(m,k) ((m)->key_sym_map[k].group_info)}
+        Result := m^.key_sym_map [k].group_info;
+end;
+
+function XkbCMKeyNumGroups (m : PXkbClientMapPtr; k : Word) : Byte;
+begin
+{#define XkbCMKeyNumGroups(m,k) (XkbNumGroups((m)->key_sym_map[k].group_info))}
+        Result := XkbNumGroups (m^.key_sym_map [k].group_info);
+end;
+
+function XkbCMKeyGroupWidth (m : PXkbClientMapPtr; k : Word; g : Byte) : Byte;
+begin
+{#define XkbCMKeyGroupWidth(m,k,g) (XkbCMKeyType(m,k,g)->num_levels)}
+        Result := XkbCMKeyType(m,k,g)^.num_levels;
+end;
+
+function XkbCMKeyGroupsWidth (m : PXkbClientMapPtr; K : Word) : Byte;
+begin
+{#define XkbCMKeyGroupsWidth(m,k) ((m)->key_sym_map[k].width)}
+        Result := m^.key_sym_map [k].width;
+end;
+
+function XkbCMKeyTypeIndex (m : PXkbClientMapPtr; k : Word; g : Byte) : Byte;
+begin
+{#define XkbCMKeyTypeIndex(m,k,g) ((m)->key_sym_map[k].kt_index[g&0x3])}
+        Result := m^.key_sym_map [k].kt_index [g and $3];
+end;
+
+function XkbCMKeyType (m : PXkbClientMapPtr; k : Word; g : Byte) : PXkbKeyTypePtr;
+begin
+{#define XkbCMKeyType(m,k,g) (&(m)->types[XkbCMKeyTypeIndex(m,k,g)])}
+        Result := @m^.types [XkbCMKeyTypeIndex(m,k,g)];
+end;
+
+function XkbCMKeyNumSyms (m : PXkbClientMapPtr; k : Word) : Word;
+begin
+{#define XkbCMKeyNumSyms(m,k) (XkbCMKeyGroupsWidth(m,k)*XkbCMKeyNumGroups(m,k))}
+        Result := XkbCMKeyGroupsWidth (m,k) or XkbCMKeyNumGroups(m,k);
+end;
+
+function XkbCMKeySymsOffset (m : PXkbClientMapPtr; k : Word) : Byte;
+begin
+{#define XkbCMKeySymsOffset(m,k) ((m)->key_sym_map[k].offset)}
+        Result := m^.key_sym_map [k].offset;
+end;
+
+function XkbCMKeySymsPtr (m : PXkbClientMapPtr; k : Word) : PKeySym;
+begin
+{#define XkbCMKeySymsPtr(m,k) (&(m)->syms[XkbCMKeySymsOffset(m,k)])}
+        Result := @m^.syms [XkbCMKeySymsOffset(m,k)];
+end;
+
+function XkbIM_IsAuto (i : PXkbIndicatorMapPtr) : Boolean;
+begin
+{#define XkbIM_IsAuto(i) ((((i)->flags&XkbIM_NoAutomatic)==0)&&(((i)->which_groups&&(i)->groups)||
+                           ((i)->which_mods&&(i)->mods.mask)||  ((i)->ctrls)))}
+        Result := ((i^.flags and XkbIM_NoAutomatic) = 0) and
+                   (((i^.which_groups > 0) and (i^.groups    > 0)) or
+                    ((i^.which_mods   > 0) and (i^.mods.mask > 0)) or
+                     (i^.ctrls        > 0));
+end;
+
+function XkbIM_InUse  (i : PXkbIndicatorMapPtr) : Boolean;
+begin
+{#define XkbIM_InUse(i) (((i)->flags)||((i)->which_groups)||((i)->which_mods)||((i)->ctrls)) }
+        Result := (i^.flags > 0) or (i^.which_groups > 0) or (i^.which_mods > 0) or (i^.ctrls > 0);
+end;
+
+function XkbKeyKeyTypeIndex (d : PXkbDescPtr; k : Word; g : Byte) : Byte;
+begin
+{#define XkbKeyKeyTypeIndex(d,k,g)      (XkbCMKeyTypeIndex((d)->map,k,g))}
+        Result := XkbCMKeyTypeIndex(d^.map, k, g);
+end;
+
+function XkbKeyKeyType (d : PXkbDescPtr; k : Word; g : Byte) : PXkbKeyTypePtr;
+begin
+{#define XkbKeyKeyType(d,k,g) (XkbCMKeyType((d)->map,k,g))}
+        Result := XkbCMKeyType(d^.map, k, g);
+end;
+
+function XkbKeyGroupWidth (d : PXkbDescPtr; k : Word; g : Byte) : Byte;
+begin
+{#define XkbKeyGroupWidth(d,k,g) (XkbCMKeyGroupWidth((d)->map,k,g))}
+        Result := XkbCMKeyGroupWidth(d^.map, k, g);
+end;
+
+function XkbKeyGroupsWidth (d : PXkbDescPtr; k : Word) : Byte;
+begin
+{#define XkbKeyGroupsWidth(d,k) (XkbCMKeyGroupsWidth((d)->map,k))}
+        Result := XkbCMKeyGroupsWidth (d^.map, k);
+end;
+
+function XkbKeyGroupInfo (d : PXkbDescPtr; k : Word) : Byte;
+begin
+{#define XkbKeyGroupInfo(d,k) (XkbCMKeyGroupInfo((d)->map,(k)))}
+        Result := XkbCMKeyGroupInfo (d^.map, k);
+end;
+
+function XkbKeyNumGroups (d : PXkbDescPtr; k : Word) : Byte;
+begin
+{#define XkbKeyNumGroups(d,k) (XkbCMKeyNumGroups((d)->map,(k)))}
+        Result := XkbCMKeyNumGroups(d^.map, k);
+end;
+
+function XkbKeyNumSyms (d : PXkbDescPtr; k : Word) : Word;
+begin
+{#define XkbKeyNumSyms(d,k) (XkbCMKeyNumSyms((d)->map,(k)))}
+        Result := XkbCMKeyNumSyms (d^.map, k);
+end;
+
+function XkbKeySymsPtr (d : PXkbDescPtr; k : Word) : PKeySym;
+begin
+{#define XkbKeySymsPtr(d,k) (XkbCMKeySymsPtr((d)->map,(k)))}
+        Result := XkbCMKeySymsPtr (d^.map, k);
+end;
+
+function XkbKeySym (d : PXkbDescPtr; k : Word; n : Word) : TKeySym;
+begin
+{#define XkbKeySym(d,k,n) (XkbKeySymsPtr(d,k)[n])}
+        Result := XkbKeySymsPtr(d, k) [n];
+end;
+
+function XkbKeySymEntry (d : PXkbDescPtr; k : Word; sl : Word; g : Byte) : TKeySym;
+begin
+{#define XkbKeySymEntry(d,k,sl,g) (XkbKeySym(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl))))}
+        Result := XkbKeySym (d, k, (XkbKeyGroupsWidth(d, k) * g) + sl);
+end;
+
+function XkbKeyAction (d : PXkbDescPtr; k : Word; n  : Word) : PXkbAction;
+begin
+{#define XkbKeyAction(d,k,n) (XkbKeyHasActions(d,k)?&XkbKeyActionsPtr(d,k)[n]:NULL)}
+        if (XkbKeyHasActions(d,k)) then
+                        Result := @TXkbAction(XkbKeyActionsPtr(d,k)[n]) //Buggy !!!
+        else
+                FillChar (Result, sizeof (TXkbAction), #0);
+end;
+
+function XkbKeyActionEntry (d : PXkbDescPtr; k : Word; sl : Word; g : Byte) : Byte;
+begin
+{#define XkbKeyActionEntry(d,k,sl,g) (XkbKeyHasActions(d,k) ?
+                                      XkbKeyAction(d, k, ((XkbKeyGroupsWidth(d, k) * (g))+(sl))):NULL)}
+        if (XkbKeyHasActions(d, k)) then
+                Result := (XkbKeyGroupsWidth(d, k) * g) + sl
+        else
+                Result := 0;
+end;
+
+function XkbKeyHasActions (d : PXkbDescPtr; k : Word) : Boolean;
+begin
+{#define XkbKeyHasActions(d,k) ((d)->server->key_acts[k]!=0)}
+        Result := (not (d^.server^.key_acts [k] = 0));
+end;
+
+function XkbKeyNumActions (d : PXkbDescPtr; k : Word) : Word;
+begin
+{#define XkbKeyNumActions(d,k) (XkbKeyHasActions(d,k)?XkbKeyNumSyms(d,k):1)}
+        if (XkbKeyHasActions(d,k)) then
+                Result := XkbKeyNumSyms(d,k)
+        else
+                Result := 1;
+end;
+
+function XkbKeyActionsPtr (d : PXkbDescPtr; k : Word) : PXkbAction;
+begin
+{#define XkbKeyActionsPtr(d,k) (XkbSMKeyActionsPtr((d)->server,k))}
+        Result := XkbSMKeyActionsPtr(d^.server, k);
+end;
+
+function XkbKeycodeInRange (d : PXkbDescPtr; k : Word) : Boolean;
+begin
+{#define XkbKeycodeInRange(d,k) (((k)>=(d)->min_key_code)&& ((k)<=(d)->max_key_code))}
+        Result := (k >= d^.min_key_code) and (k <= d^.max_key_code);
+end;
+
+function XkbNumKeys (d : PXkbDescPtr) : Byte;
+begin
+{#define XkbNumKeys(d) ((d)->max_key_code-(d)->min_key_code+1)}
+        Result := d^.max_key_code - d^.min_key_code + 1;
+end;
+
+function XkbXI_DevHasBtnActs (d : PXkbDeviceInfoPtr) : Boolean;
+begin
+{#define XkbXI_DevHasBtnActs(d) (((d)->num_btns>0)&&((d)->btn_acts!=NULL))}
+        Result := (d^.num_btns > 0) and (not (d^.btn_acts = nil));
+end;
+
+function XkbXI_LegalDevBtn (d : PXkbDeviceInfoPtr; b : Word) : Boolean;
+begin
+{#define XkbXI_LegalDevBtn(d,b) (XkbXI_DevHasBtnActs(d)&&((b)<(d)->num_btns))}
+        Result := XkbXI_DevHasBtnActs(d) and (b < d^.num_btns);
+end;
+
+function XkbXI_DevHasLeds (d : PXkbDeviceInfoPtr) : Boolean;
+begin
+{#define XkbXI_DevHasLeds(d) (((d)->num_leds>0)&&((d)->leds!=NULL))}
+        Result := (d^.num_leds > 0) and (not (d^.leds = nil));
+end;
+(******************************** end of xkbstr ********************************)
+(*********************************** xkbgeom ***********************************)
+
+function XkbBoundsWidth (b : PXkbBoundsPtr) : SmallInt;
+begin
+{#define XkbBoundsWidth(b) (((b)->x2)-((b)->x1))}
+        Result := b^.x2 - b^.x1;
+end;
+
+function XkbBoundsHeight (b : PXkbBoundsPtr) : SmallInt;
+begin
+{#define XkbBoundsHeight(b) (((b)->y2)-((b)->y1))}
+        Result := b^.y2 - b^.y1;
+end;
+
+function XkbOutlineIndex (s : PXkbShapePtr; o : PXkbOutlinePtr) : longint;
+begin
+{#define XkbOutlineIndex(s,o) ((int)((o)-&(s)->outlines[0]))}
+        Result := longint(o - @s^.outlines [0]);
+end;
+
+function XkbShapeDoodadColor (g : PXkbGeometryPtr; d : PXkbShapeDoodadPtr) : PXkbColorPtr;
+begin
+{#define XkbShapeDoodadColor(g,d) (&(g)->colors[(d)->color_ndx])}
+        Result := @(g^.colors [d^.color_ndx]);
+end;
+
+function XkbShapeDoodadShape (g : PXkbGeometryPtr; d : PXkbShapeDoodadPtr) : PXkbShapePtr;
+begin
+{#define XkbShapeDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx])}
+        Result := @g^.shapes [d^.shape_ndx];
+end;
+
+procedure XkbSetShapeDoodadColor (g : PXkbGeometryPtr; d : PXkbShapeDoodadPtr; c : PXkbColorPtr);
+begin
+{#define XkbSetShapeDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0])}
+        d^.color_ndx := c - @g^.colors [0];
+end;
+
+procedure XkbSetShapeDoodadShape (g : PXkbGeometryPtr; d : PXkbShapeDoodadPtr; s : PXkbShapePtr);
+begin
+{#define XkbSetShapeDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0])}
+        d^.shape_ndx := PXkbShapePtr(s) - @g^.shapes [0];
+end;
+
+function XkbTextDoodadColor (g : PXkbGeometryPtr; d : PXkbTextDoodadPtr) : PXkbColorPtr;
+begin
+{#define XkbTextDoodadColor(g,d) (&(g)->colors[(d)->color_ndx])}
+        Result := @g^.colors [d^.color_ndx];
+end;
+
+procedure XkbSetTextDoodadColor (g : PXkbGeometryPtr; d : PXkbTextDoodadPtr; c : PXkbColorPtr);
+begin
+{#define XkbSetTextDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0])}
+        d^.color_ndx := c - @g^.colors [0];
+end;
+
+function XkbIndicatorDoodadShape (g : PXkbGeometryPtr; d : PXkbIndicatorDoodadPtr) : PXkbShapeDoodadPtr;
+begin
+{#define XkbIndicatorDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx])}
+        Result := PXkbShapeDoodadPtr(@g^.shapes [d^.shape_ndx]);
+end;
+
+function XkbIndicatorDoodadOnColor (g : PXkbGeometryPtr; d : PXkbIndicatorDoodadPtr) : PXkbColorPtr;
+begin
+{#define XkbIndicatorDoodadOnColor(g,d) (&(g)->colors[(d)->on_color_ndx])}
+        Result := @g^.colors [d^.on_color_ndx];
+end;
+
+function XkbIndicatorDoodadOffColor (g : PXkbGeometryPtr; d : PXkbIndicatorDoodadPtr) : PXkbColorPtr;
+begin
+{#define XkbIndicatorDoodadOffColor(g,d) (&(g)->colors[(d)->off_color_ndx])}
+        Result := @g^.colors [d^.off_color_ndx];
+end;
+
+procedure XkbSetIndicatorDoodadOnColor (g : PXkbGeometryPtr; d : PXkbIndicatorDoodadPtr;
+                                        c : PXkbColorPtr);
+begin
+{#define XkbSetIndicatorDoodadOnColor(g,d,c) ((d)->on_color_ndx= (c)-&(g)->colors[0])}
+        d^.on_color_ndx := c - @g^.colors [0];
+end;
+
+procedure XkbSetIndicatorDoodadOffColor (g : PXkbGeometryPtr; d : PXkbIndicatorDoodadPtr;
+                                         c : PXkbColorPtr);
+begin
+{#define        XkbSetIndicatorDoodadOffColor(g,d,c) ((d)->off_color_ndx= (c)-&(g)->colors[0])}
+        d^.off_color_ndx := c - @g^.colors [0];
+end;
+
+procedure XkbSetIndicatorDoodadShape (g : PXkbGeometryPtr; d : PXkbIndicatorDoodadPtr;
+                                      s : PXkbShapeDoodadPtr);
+begin
+{#define XkbSetIndicatorDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0])}
+        d^.shape_ndx := PXkbShapePtr(s) - @g^.shapes [0];
+end;
+
+function XkbLogoDoodadColor (g : PXkbGeometryPtr; d : PXkbLogoDoodadPtr) : PXkbColorPtr;
+begin
+{#define XkbLogoDoodadColor(g,d) (&(g)->colors[(d)->color_ndx])}
+        Result := @g^.colors [d^.color_ndx];
+end;
+
+function XkbLogoDoodadShape (g : PXkbGeometryPtr; d : PXkbLogoDoodadPtr) : PXkbShapeDoodadPtr;
+begin
+{#define XkbLogoDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx])}
+        Result := PXkbShapeDoodadPtr(@g^.shapes [d^.shape_ndx]);
+end;
+
+procedure XkbSetLogoDoodadColor (g : PXkbGeometryPtr; d : PXkbLogoDoodadPtr; c : PXkbColorPtr);
+begin
+{#define XkbSetLogoDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0])}
+        d^.color_ndx := c - @g^.colors [0];
+end;
+
+procedure XkbSetLogoDoodadShape (g : PXkbGeometryPtr; d : PXkbLogoDoodadPtr; s : PXkbShapeDoodadPtr);
+begin
+{#define XkbSetLogoDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0])}
+        d^.shape_ndx := PXkbShapePtr(s) - @g^.shapes [0];
+end;
+
+function XkbKeyShape (g : PXkbGeometryPtr; k : PXkbKeyPtr) : PXkbShapeDoodadPtr;
+begin
+{#define XkbKeyShape(g,k) (&(g)->shapes[(k)->shape_ndx])}
+        Result := PXkbShapeDoodadPtr(@g^.shapes [k^.shape_ndx]);
+end;
+
+function XkbKeyColor (g : PXkbGeometryPtr; k : PXkbKeyPtr) : PXkbColorPtr;
+begin
+{#define XkbKeyColor(g,k) (&(g)->colors[(k)->color_ndx])}
+        Result := @g^.colors [k^.color_ndx];
+end;
+
+procedure XkbSetKeyShape (g : PXkbGeometryPtr; k : PXkbKeyPtr; s : PXkbShapeDoodadPtr);
+begin
+{#define XkbSetKeyShape(g,k,s) ((k)->shape_ndx= (s)-&(g)->shapes[0])}
+        k^.shape_ndx := PXkbShapePtr(s) - @g^.shapes [0];
+end;
+
+procedure XkbSetKeyColor (g : PXkbGeometryPtr; k : PXkbKeyPtr; c : PXkbColorPtr);
+begin
+{#define XkbSetKeyColor(g,k,c) ((k)->color_ndx= (c)-&(g)->colors[0])}
+        k^.color_ndx := c - @g^.colors [0];
+end;
+
+function XkbGeomColorIndex (g : PXkbGeometryPtr; c : PXkbColorPtr) : longint;
+begin
+{#define XkbGeomColorIndex(g,c) ((int)((c)-&(g)->colors[0]))}
+        Result := longint (c - @g^.colors [0]);
+end;
+(******************************** end of xkbgeom *******************************)
+
+end.

+ 827 - 0
packages/x11/src/xkblib.pp

@@ -0,0 +1,827 @@
+{ $Xorg: XKBlib.h,v 1.6 2000/08/17 19:45:03 cpqbld Exp $
+************************************************************
+Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be
+used in advertising or publicity pertaining to distribution
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+ $XFree86: xc/lib/X11/XKBlib.h,v 3.3 2001/08/01 00:44:38 tsi Exp $
+
+ Pascal Convertion was made by Ido Kannner - [email protected]
+
+Thanks:
+         I want to thanks to oliebol for putting up with all of the problems that was found
+         while translating this code. ;)
+
+         I want to thanks #fpc channel in freenode irc, for helping me, and to put up with my
+         wierd questions ;)
+
+         Thanks for mmc in #xlib on freenode irc And so for the channel itself for the helping me to
+         understanding some of the problems I had converting this headers and pointing me to resources
+         that helped translating this headers.
+
+ Ido
+
+History:
+        2004/10/15        - Fixed a bug of accessing second based records by removing "paced record" and
+                            chnaged it to "reocrd" only.
+        2004/10/10        - Added to TXkbGetAtomNameFunc and TXkbInternAtomFunc the cdecl call.
+        2004/10/06 - 09   - Convertion from the c header of XKBlib.h
+
+}
+{$PACKRECORDS C}
+{$MODE OBJFPC} {$MACRO ON} {$DEFINE MACRO}
+
+unit xkblib;
+
+interface
+uses X, Xlib, XKB;
+
+type
+        PXkbAnyEvent = ^TXkbAnyEvent;
+        TXkbAnyEvent = record
+                        _type      : Smallint;   // XkbAnyEvent
+                        serial     : Longword;   // # of last req processed by server
+                        send_event : Boolean;    // is this from a SendEvent request?
+                        display    : PDisplay;   // Display the event was read from
+                        time       : TTime;      // milliseconds;
+                        xkb_type   : Smallint;   // XKB event minor code
+                        device     : Word;       // device ID
+                       end;
+
+type
+        PXkbNewKeyboardNotifyEvent = ^TXkbNewKeyboardNotifyEvent;
+        TXkbNewKeyboardNotifyEvent = record
+                                      _type            : Smallint;   // XkbAnyEvent
+                                      serial           : Longword;   // of last req processed by server
+                                      send_event       : Boolean;    // is this from a SendEvent request?
+                                      display          : PDisplay;   // Display the event was read from
+                                      time             : TTime;      // milliseconds
+                                      xkb_type         : Smallint;   // XkbNewKeyboardNotify
+                                      device           : Smallint;   // device ID
+                                      old_device       : Smallint;   // device ID of previous keyboard
+                                      min_key_code     : Smallint;   // minimum key code
+                                      max_key_code     : Smallint;   // maximum key code
+                                      old_min_key_code : Smallint;   // min key code of previous kbd
+                                      old_max_key_code : Smallint;   // max key code of previous kbd
+                                      changed          : Word;       // changed aspects of the keyboard
+                                      req_major        : Shortint;   // major and minor opcode of req
+                                      req_minor        : Shortint;   // that caused change, if applicable
+                                     end;
+
+type
+        PXkbMapNotifyEvent = ^TXkbMapNotifyEvent;
+        TXkbMapNotifyEvent = record
+                              _type              : Smallint;  // XkbAnyEvent
+                              serial             : Longword;  // of last req processed by server
+                              send_event         : Boolean;   // is this from a SendEvent request
+                              display            : PDisplay;  // Display the event was read from
+                              time               : TTime;     // milliseconds
+                              xkb_type           : Smallint;  // XkbMapNotify
+                              device             : Smallint;  // device ID
+                              changed            : Word;      // fields which have been changed
+                              flags              : Word;      // reserved
+                              first_type         : Smallint;  // first changed key type
+                              num_types          : Smallint;  // number of changed key types
+                              min_key_code       : TKeyCode;
+                              max_key_code       : TKeyCode;
+                              first_key_sym      : TKeyCode;
+                              first_key_act      : TKeyCode;
+                              first_key_behavior : TKeyCode;
+                              first_key_explicit : TKeyCode;
+                              first_modmap_key   : TKeyCode;
+                              first_vmodmap_key  : TKeyCode;
+                              num_key_syms       : Smallint;
+                              num_key_acts       : Smallint;
+                              num_key_behaviors  : Smallint;
+                              num_key_explicit   : Smallint;
+                              num_modmap_keys    : Smallint;
+                              num_vmodmap_keys   : Smallint;
+                              vmods              : Word;      // mask of changed virtual mods
+                             end;
+
+type
+        PXkbStateNotifyEvent = ^TXkbStateNotifyEvent;
+        TXkbStateNotifyEvent = record
+                                _type              : Smallint;   // XkbAnyEvent
+                                serial             : Longword;   // # of last req processed by server
+                                send_event         : Boolean;    // is this from a SendEvent request?
+                                display            : PDisplay;   // Display the event was read from
+                                time               : TTime;      // milliseconds
+                                xkb_type           : Smallint;   // XkbStateNotify
+                                device             : Smallint;   // device ID
+                                changed            : Word;       // mask of changed state components
+                                group              : Smallint;   // keyboard group
+                                base_group         : Smallint;   // base keyboard group
+                                latched_group      : Smallint;   // latched keyboard group
+                                locked_group       : Smallint;   // locked keyboard group
+                                mods               : Word;       // modifier state
+                                base_mods          : Word;       // base modifier state
+                                latched_mods       : Word;       // latched modifiers
+                                locked_mods        : Word;       // locked modifiers
+                                compat_state       : Smallint;   // compatibility state
+                                grab_mods          : Byte;       // mods used for grabs
+                                compat_grab_mods   : Byte;       // grab mods for non-XKB clients
+                                lookup_mods        : Byte;       // mods sent to clients
+                                compat_lookup_mods : Byte;       // mods sent to non-XKB clients
+                                ptr_buttons        : Smallint;   // pointer button state
+                                keycode            : TKeyCode;   // keycode that caused the change
+                                event_type         : Shortint;   // KeyPress or KeyRelease
+                                req_major          : Shortint;   // Major opcode of request
+                                req_minor          : Shortint;   // Minor opcode of request
+                               end;
+type
+        PXkbControlsNotifyEvent = ^TXkbControlsNotifyEvent;
+        TXkbControlsNotifyEvent = record
+                                   _type                : Smallint;  // XkbAnyEvent
+                                   serial               : Longword;  // of last req processed by server
+                                   send_event           : Boolean;   // is this from a SendEvent request?
+                                   display              : PDisplay;  // Display the event was read from
+                                   time                 : TTime;     // milliseconds
+                                   xkb_type             : Smallint;  // XkbControlsNotify
+                                   device               : Smallint;  // device ID
+                                   changed_ctrls        : Word;      // controls with changed sub-values
+                                   enabled_ctrls        : Word;      // controls currently enabled
+                                   enabled_ctrl_changes : Word;      // controls just {en,dis}abled
+                                   num_groups           : Smallint;  // total groups on keyboard
+                                   keycode              : TKeyCode;  // key that caused change or 0
+                                   event_type           : Byte;      // type of event that caused change
+                                   req_major            : Byte;      // if keycode==0, major and minor
+                                   req_minor            : Byte;      // opcode of req that caused change
+                                  end;
+
+type
+        PXkbIndicatorNotifyEvent = ^TXkbIndicatorNotifyEvent;
+        TXkbIndicatorNotifyEvent = record
+                                    _type      : Smallint;  // XkbAnyEvent
+                                    serial     : Longword;  // of last req processed by server
+                                    send_event : Boolean;   // is this from a SendEvent request?
+                                    display    : PDisplay;  // Display the event was read from
+                                    time       : TTime;     // milliseconds
+                                    xkb_type   : Smallint;  // XkbIndicatorNotify
+                                    device     : Smallint;  // device
+                                    changed    : Word;      // indicators with new state or map
+                                    state      : Word;      // current state of all indicators
+                                   end;
+
+type
+        PXkbNamesNotifyEvent = ^TXkbNamesNotifyEvent;
+        TXkbNamesNotifyEvent = record
+                                _type              : Smallint;   // XkbAnyEvent
+                                serial             : Longword;   // of last req processed by server
+                                send_event         : Boolean;    // is this from a SendEvent request?
+                                display            : PDisplay;   // Display the event was read from
+                                time               : TTime;      // milliseconds
+                                xkb_type           : Smallint;   // XkbNamesNotify
+                                device             : Smallint;   // device ID
+                                changed            : Longword;   // names that have changed
+                                first_type         : Smallint;   // first key type with new name
+                                num_types          : Smallint;   // number of key types with new names
+                                first_lvl          : Smallint;   // first key type new new level names
+                                num_lvls           : Smallint;   // # of key types w/new level names
+                                num_aliases        : Smallint;   // total number of key aliases
+                                num_radio_groups   : Smallint;   // total number of radio groups
+                                changed_vmods      : Word;       // virtual modifiers with new names
+                                changed_groups     : Word;       // groups with new names
+                                changed_indicators : Word;       // indicators with new names
+                                first_key          : Smallint;   // first key with new name
+                                num_keys           : Smallint;   // number of keys with new names
+                               end;
+
+type
+        PXkbCompatMapNotifyEvent = ^TXkbCompatMapNotifyEvent;
+        TXkbCompatMapNotifyEvent = record
+                                    _type          : Smallint;  // XkbAnyEvent
+                                    serial         : Longword;  // of last req processed by server
+                                    send_event     : Boolean;   // is this from a SendEvent request?
+                                    display        : PDisplay;  // Display the event was read from
+                                    time           : TTime;     // milliseconds
+                                    xkb_type       : Smallint;  // XkbCompatMapNotify
+                                    device         : Smallint;  // device ID
+                                    changed_groups : Word;      // groups with new compat maps
+                                    first_si       : Smallint;  // first new symbol interp
+                                    num_si         : Smallint;  // number of new symbol interps
+                                    num_total_si   : Smallint;  // total # of symbol interps
+                                   end;
+
+type
+        PXkbBellNotifyEvent = ^TXkbBellNotifyEvent;
+        TXkbBellNotifyEvent = record
+                               _type      : Smallint;  // XkbAnyEvent
+                               serial     : Longword;  // of last req processed by server
+                               send_event : Boolean;   // is this from a SendEvent request?
+                               display    : PDisplay;  // Display the event was read from
+                               time       : TTime;     // milliseconds
+                               xkb_type   : Smallint;  // XkbBellNotify
+                               device     : Smallint;  // device ID
+                               percent    : Smallint;  // requested volume as a % of maximum
+                               pitch      : Smallint;  // requested pitch in Hz
+                               duration   : Smallint;  // requested duration in useconds
+                               bell_class : Smallint;  // (input extension) feedback class
+                               bell_id    : Smallint;  // (input extension) ID of feedback
+                               name       : TAtom;     // "name" of requested bell
+                               window     : TWindow;   // window associated with event
+                               event_only : Boolean;   // "event only" requested
+                              end;
+
+type
+        PXkbActionMessageEvent = ^TXkbActionMessageEvent;
+        TXkbActionMessageEvent = record
+                                  _type             : Smallint;  // XkbAnyEvent
+                                  serial            : Longword;  // of last req processed by server
+                                  send_event        : Boolean;   // is this from a SendEvent request?
+                                  display           : PDisplay;  // Display the event was read from
+                                  time              : TTime;     // milliseconds
+                                  xkb_type          : Smallint;  // XkbActionMessage
+                                  device            : Smallint;  // device ID
+                                  keycode           : TKeyCode;  // key that generated the event
+                                  press             : Boolean;   // true if act caused by key press
+                                  key_event_follows : Boolean;   // true if key event also generated
+                                  group             : Smallint;  // effective group
+                                  mods              : Word;      // effective mods
+                                  message           : array [0..XkbActionMessageLength] of Char;
+                                                           // message -- leave space for NUL
+                                 end;
+
+type
+        PXkbAccessXNotifyEvent = ^TXkbAccessXNotifyEvent;
+        TXkbAccessXNotifyEvent = record
+                                  _type          : Smallint;  // XkbAnyEvent
+                                  serial         : Longword;  // of last req processed by server
+                                  send_event     : Boolean;   // is this from a SendEvent request?
+                                  display        : PDisplay;  // Display the event was read from
+                                  time           : TTime;     // milliseconds
+                                  xkb_type       : Smallint;  // XkbAccessXNotify
+                                  device         : Smallint;  // device ID
+                                  detail         : Smallint;  // XkbAXN_*
+                                  keycode        : Smallint;  // key of event
+                                  sk_delay       : Smallint;  // current slow keys delay
+                                  debounce_delay : Smallint;  // current debounce delay
+                                 end;
+
+type
+        PXkbExtensionDeviceNotifyEvent = ^TXkbExtensionDeviceNotifyEvent;
+        TXkbExtensionDeviceNotifyEvent = record
+                                          _type          : Smallint;  // XkbAnyEvent
+                                          serial         : Longword;  // of last req processed by server
+                                          send_event     : Boolean;   // is this from a SendEvent request?
+                                          display        : PDisplay;  // Display the event was read from
+                                          time           : TTime;     // milliseconds
+                                          xkb_type       : Smallint;  // XkbExtensionDeviceNotify
+                                          device         : Smallint;  // device ID
+                                          reason         : Word;      // reason for the event
+                                          supported      : Word;      // mask of supported features
+                                          unsupported    : Word;      // mask of unsupported features
+                                                                // that some app tried to use
+                                          first_btn      : Smallint;  // first button that changed
+                                          num_btns       : Smallint;  // range of buttons changed
+                                          leds_defined   : Word;      // indicators with names or maps
+                                          led_state      : Word;      // current state of the indicators
+                                          led_class      : Smallint;  // feedback class for led changes
+                                          led_id         : Smallint;  // feedback id for led changes
+                                         end;
+
+type
+        PXkbEvent = ^TXkbEvent;
+        TXkbEvent = record
+                     _type       : Smallint;
+                     any         : TXkbAnyEvent;
+                     new_kbd     : TXkbNewKeyboardNotifyEvent;
+                     map         : TXkbMapNotifyEvent;
+                     state       : TXkbStateNotifyEvent;
+                     ctrls       : TXkbControlsNotifyEvent;
+                     indicators  : TXkbIndicatorNotifyEvent;
+                     names       : TXkbNamesNotifyEvent;
+                     compat      : TXkbCompatMapNotifyEvent;
+                     bell        : TXkbBellNotifyEvent;
+                     message     : TXkbActionMessageEvent;
+                     accessx     : TXkbAccessXNotifyEvent;
+                     device      : TXkbExtensionDeviceNotifyEvent;
+                     core        : TXEvent;
+                    end;
+
+type
+//typedef struct        _XkbKbdDpyState XkbKbdDpyStateRec,*XkbKbdDpyStatePtr;
+        PXkbKbdDpyStatePtr = ^TXkbKbdDpyStateRec;
+        TXkbKbdDpyStateRec = record
+                             end;
+
+        { XkbOpenDisplay error codes }
+const
+        XkbOD_Success           = 0;
+        XkbOD_BadLibraryVersion = 1;
+        XkbOD_ConnectionRefused = 2;
+        XkbOD_NonXkbServer      = 3;
+        XkbOD_BadServerVersion  = 4;
+
+        { Values for XlibFlags }
+const
+        XkbLC_ForceLatin1Lookup         = 1 shl  0;
+        XkbLC_ConsumeLookupMods         = 1 shl  1;
+        XkbLC_AlwaysConsumeShiftAndLock = 1 shl  2;
+        XkbLC_IgnoreNewKeyboards        = 1 shl  3;
+        XkbLC_ControlFallback           = 1 shl  4;
+        XkbLC_ConsumeKeysOnComposeFail  = 1 shl 29;
+        XkbLC_ComposeLED                = 1 shl 30;
+        XkbLC_BeepOnComposeFail         = 1 shl 31;
+
+        XkbLC_AllComposeControls        = $C0000000;
+        XkbLC_AllControls               = $C000001F;
+
+function XkbIgnoreExtension (ignore : Boolean) : Boolean;
+        cdecl; external libX11 name 'XkbIgnoreExtension';
+
+function XkbOpenDisplay (name : PChar; ev_rtrn, err_rtrn,
+                         major_rtrn, minor_rtrn, reason : PSmallint) : PDisplay;
+        cdecl; external libX11 name 'XkbOpenDisplay';
+
+function XkbQueryExtension (dpy : PDisplay; opcodeReturn, eventBaseReturn,
+                            errorBaseReturn, majorRtrn, minorRtrn: PSmallint) : Boolean;
+        cdecl; external libX11 name 'XkbQueryExtension';
+
+function XkbUseExtension (dpy : PDisplay; major_rtrn, minor_rtrn : PSmallint) : Boolean;
+        cdecl; external libX11 name 'XkbUseExtension';
+
+function XkbLibraryVersion (libMajorRtrn, libMinorRtrn : PSmallint) : Boolean;
+        cdecl; external libX11 name 'XkbLibraryVersion';
+
+function XkbSetXlibControls (dpy : PDisplay; affect, values : Word) : Word;
+        cdecl; external libX11 name 'XkbSetXlibControls';
+
+function XkbGetXlibControls (dpy : PDisplay) : Word;
+        cdecl; external libX11 name 'XkbGetXlibControls';
+
+type
+        TXkbInternAtomFunc = function (dpy : PDisplay; name : PChar; only_if_exists : Boolean) : TAtom; cdecl;
+
+type
+        TXkbGetAtomNameFunc = function (dpy : PDisplay; atom : TAtom) : PChar; cdecl;
+
+procedure XkbSetAtomFuncs (getAtom : TXkbInternAtomFunc; getName : TXkbGetAtomNameFunc);
+        cdecl; external libX11 name 'XkbSetAtomFuncs';
+
+function XkbKeycodeToKeysym (dpy : PDisplay;
+                           {$IFDEF NeedWidePrototypes}
+                             kc  : Word;
+                           {$ELSE}
+                             kc  : TKeyCode;
+                           {$ENDIF}
+                             group, level : Smallint) : TKeySym;
+        cdecl; external libX11 name 'XkbKeycodeToKeysym';
+
+function XkbKeysymToModifiers (dpy : PDisplay; ks : TKeySym) : Word;
+        cdecl; external libX11 name 'XkbKeysymToModifiers';
+
+function XkbLookupKeySym (dpy               : PDisplay; keycode       : TKeyCode; modifiers,
+                           modifiers_return : Word;     keysym_return : PKeySym)             : Boolean;
+        cdecl; external libX11 name 'XkbLookupKeySym';
+
+function XkbLookupKeyBinding (dpy    : PDisplay; sym_rtrn : TKeySym;  mods       : Word;
+                              buffer : PChar;    nbytes   : Smallint; extra_rtrn : PSmallint) : Smallint;
+        cdecl; external libX11 name 'XkbLookupKeyBinding';
+
+function XkbTranslateKeyCode (xkb              : PXkbDescPtr; keycode       : TKeyCode; modifiers,
+                              modifiers_return : Word;        keysym_return : PKeySym)            : Boolean;
+        cdecl; external libX11 name 'XkbTranslateKeyCode';
+
+function XkbTranslateKeySym (dpy    : PDisplay; sym_return : TKeySym;  modifiers  : Word;
+                             buffer : PChar;    nbytes     : Smallint; extra_rtrn : PSmallint) : Smallint;
+        cdecl; external libX11 name 'XkbTranslateKeySym';
+
+function XkbSetAutoRepeatRate (dpy : PDisplay; deviceSpec, delay, interval : Word) : Boolean;
+        cdecl; external libX11 name 'XkbSetAutoRepeatRate';
+
+function XkbGetAutoRepeatRate (dpy : PDisplay; deviceSpec : Word; delayRtrn, intervalRtrn : PWord) : Boolean;
+        cdecl; external libX11 name 'XkbGetAutoRepeatRate';
+
+function XkbChangeEnabledControls (dpy : PDisplay; deviceSpec, affect, values : Word) : Boolean;
+        cdecl; external libX11 name 'XkbChangeEnabledControls';
+
+function XkbDeviceBell (dpy : PDisplay; win : TWindow; deviceSpec,
+                        bellClass, bellID, percent : Smallint; name : TAtom) : Boolean;
+        cdecl; external libX11 name 'XkbDeviceBell';
+
+function XkbForceDeviceBell (dpy : PDisplay; deviceSpec, bellClass, bellID, percent : Smallint) : Boolean;
+        cdecl; external libX11 name 'XkbForceDeviceBell';
+
+function XkbDeviceBellEvent (dpy : PDisplay; win : TWindow; deviceSpec,
+                             bellClass, bellID, percent : Smallint; name : TAtom) : Boolean;
+        cdecl; external libX11 name 'XkbDeviceBellEvent';
+
+function XkbBell (dpy : PDisplay; win : TWindow; percent : Smallint; name : TAtom) : Boolean;
+        cdecl; external libX11 name 'XkbBell';
+
+function XkbForceBell (dpy : PDisplay; percent : Smallint) : Boolean;
+        cdecl; external libX11 name 'XkbForceBell';
+
+function XkbBellEvent (dpy : PDisplay; win : TWindow; percent : Smallint; name : TAtom) : Boolean;
+        cdecl; external libX11 name 'XkbBellEvent';
+
+function XkbSelectEvents (dpy : PDisplay; deviceID, affect, values : Word) : Boolean;
+        cdecl; external libX11 name 'XkbSelectEvents';
+
+function XkbSelectEventDetails (dpy : PDisplay; deviceID, eventType : Word;
+                                affect, details : Longword) : Boolean;
+        cdecl; external libX11 name 'XkbSelectEventDetails';
+
+procedure XkbNoteMapChanges (old : PXkbMapChangesPtr; new : PXkbMapNotifyEvent; wanted : Word);
+        cdecl; external libX11 name 'XkbNoteMapChanges';
+
+procedure XkbNoteNameChanges (old : PXkbNameChangesPtr; new : PXkbNamesNotifyEvent; wanted : Word);
+        cdecl; external libX11 name 'XkbNoteNameChanges';
+
+function XkbGetIndicatorState (dpy : PDisplay; deviceSpec : Word; pStateRtrn : PWord) : TStatus;
+        cdecl; external libX11 name 'XkbGetIndicatorState';
+
+function XkbGetDeviceIndicatorState (dpy   : PDisplay; deviceSpec, ledClass,
+                                     ledID : Word;     pStateRtrn : PWord)   : TStatus;
+        cdecl; external libX11 name 'XkbGetDeviceIndicatorState';
+
+function XkbGetIndicatorMap (dpy : PDisplay; which : Longword; desc : PXkbDescPtr) : TStatus;
+        cdecl; external libX11 name 'XkbGetIndicatorMap';
+
+function XkbSetIndicatorMap (dpy : PDisplay; which : Longword; desc : PXkbDescPtr) : Boolean;
+        cdecl; external libX11 name 'XkbSetIndicatorMap';
+
+procedure XkbNoteIndicatorMapChanges   (o, n : PXkbIndicatorChangesPtr; w : Word);
+procedure XkbNoteIndicatorStateChanges (o, n : PXkbIndicatorChangesPtr; w : Word);
+
+function  XkbGetIndicatorMapChanges    (d : PDisplay; x : PXkbDescPtr;
+                                        c : PXkbIndicatorChangesPtr) : TStatus;
+
+function  XkbChangeIndicatorMaps       (d : PDisplay; x : PXkbDescPtr;
+                                        c : PXkbIndicatorChangesPtr) : Boolean;
+
+function XkbGetNamedIndicator (dpy        : PDisplay; name     : TAtom; pNdxRtrn : PSmallint;
+                               pStateRtrn : PBoolean; pMapRtrn : PXkbIndicatorMapPtr;
+                                                                                                                         pRealRtrn  : PBoolean)                                  : Boolean;
+        cdecl; external libX11 name 'XkbGetNamedIndicator';
+
+function XkbGetNamedDeviceIndicator (dpy      : PDisplay; deviceSpec, ledClass, ledID : Word;
+                                     name     : TAtom;    pNdxRtrn : PSmallint; pStateRtrn : PBoolean;
+                                                                                                                                                 pMapRtrn : PXkbIndicatorMapPtr; pRealRtrn  : PBoolean) : Boolean;
+        cdecl; external libX11 name 'XkbGetNamedDeviceIndicator';
+
+function XkbSetNamedIndicator (dpy : PDisplay; name : TAtom; changeState,
+                               state, createNewMap : Boolean; pMap : PXkbIndicatorMapPtr) : Boolean;
+        cdecl; external libX11 name 'XkbSetNamedIndicator';
+
+function XkbSetNamedDeviceIndicator (dpy  : PDisplay; deviceSpec, ledClass, ledID : Word;
+                                                                                                                                                 name : TAtom; changeState, state, createNewMap : Boolean;
+                                                                                                                                                 pMap : PXkbIndicatorMapPtr) : Boolean;
+        cdecl; external libX11 name 'XkbSetNamedDeviceIndicator';
+
+function XkbLockModifiers (dpy : PDisplay; deviceSpec, affect, values : Word) : Boolean;
+        cdecl; external libX11 name 'XkbLockModifiers';
+
+function XkbLatchModifiers (dpy : PDisplay; deviceSpec, affect, values : Word) : Boolean;
+        cdecl; external libX11 name 'XkbLatchModifiers';
+
+function XkbLockGroup (dpy : PDisplay; deviceSpec, group : Word) : Boolean;
+        cdecl; external libX11 name 'XkbLockGroup';
+
+function XkbLatchGroup (dpy : PDisplay; deviceSpec, group : Word) : Boolean;
+        cdecl; external libX11 name 'XkbLatchGroup';
+
+function XkbSetServerInternalMods (dpy : PDisplay; deviceSpec, affectReal,
+                                   realValues, affectVirtual, virtualValues : Word) : Boolean;
+        cdecl; external libX11 name 'XkbSetServerInternalMods';
+
+function XkbSetIgnoreLockMods (dpy : PDisplay; deviceSpec, affectReal,
+                                   realValues, affectVirtual, virtualValues : Word) : Boolean;
+        cdecl; external libX11 name 'XkbSetIgnoreLockMods';
+
+function XkbVirtualModsToReal (dpy : PDisplay; virtual_mask : Word; mask_rtrn : PWord) : Boolean;
+        cdecl; external libX11 name 'XkbVirtualModsToReal';
+
+function XkbComputeEffectiveMap (xkb : PXkbDescPtr; _type : PXkbKeyTypePtr; map_rtrn : PByte) : Boolean;
+        cdecl; external libX11 name 'XkbComputeEffectiveMap';
+
+function XkbInitCanonicalKeyTypes (xkb : PXkbDescPtr; which : Word; keypadVMod : Smallint) : TStatus;
+        cdecl; external libX11 name 'XkbInitCanonicalKeyTypes';
+
+function XkbAllocKeyboard : PXkbDescPtr;
+        cdecl; external libX11 name 'XkbAllocKeyboard';
+
+procedure XkbFreeKeyboard (xkb : PXkbDescPtr; which : Word; freeDesc : Boolean);
+        cdecl; external libX11 name 'XkbFreeKeyboard';
+
+function XkbAllocClientMap (xkb : PXkbDescPtr; which, nTypes : Word) : TStatus;
+        cdecl; external libX11 name 'XkbAllocClientMap';
+
+function XkbAllocServerMap (xkb : PXkbDescPtr; which, nActions : Word) : TStatus;
+        cdecl; external libX11 name 'XkbAllocServerMap';
+
+procedure XkbFreeClientMap (xkb : PXkbDescPtr; what : Word; freeMap : Boolean);
+        cdecl; external libX11 name 'XkbFreeClientMap';
+
+procedure XkbFreeServerMap (xkb : PXkbDescPtr; what : Word; freeMap : Boolean);
+        cdecl; external libX11 name 'XkbFreeServerMap';
+
+function XkbAddKeyType (xkb           : PXkbDescPtr; name     : TAtom; map_count : Smallint;
+                        want_preserve : Boolean;     num_lvls : Smallint) : PXkbKeyTypePtr;
+        cdecl; external libX11 name 'XkbAddKeyType';
+
+function XkbAllocIndicatorMaps (xkb : PXkbDescPtr) : TStatus;
+        cdecl; external libX11 name 'XkbAllocIndicatorMaps';
+
+procedure XkbFreeIndicatorMaps (xkb : PXkbDescPtr);
+        cdecl; external libX11 name 'XkbFreeIndicatorMaps';
+
+function XkbGetMap (dpy : PDisplay; which, deviceSpec : Word) : PXkbDescPtr;
+        cdecl; external libX11 name 'XkbGetMap';
+
+function XkbGetUpdatedMap (dpy : PDisplay; which : Word; desc : PXkbDescPtr) : TStatus;
+        cdecl; external libX11 name 'XkbGetUpdatedMap';
+
+function XkbGetMapChanges (dpy : PDisplay; xkb : PXkbDescPtr; changes : PXkbMapChangesPtr) : TStatus;
+        cdecl; external libX11 name 'XkbGetMapChanges';
+
+function XkbRefreshKeyboardMapping (event : PXkbMapNotifyEvent) : TStatus;
+        cdecl; external libX11 name 'XkbRefreshKeyboardMapping';
+
+function XkbGetKeyTypes (dpy : PDisplay; first, num : Word; xkb : PXkbDescPtr) : TStatus;
+        cdecl; external libX11 name 'XkbGetKeyTypes';
+
+function XkbGetKeySyms (dpy : PDisplay; first, num : Word; xkb : PXkbDescPtr) : TStatus;
+        cdecl; external libX11 name 'XkbGetKeySyms';
+
+function XkbGetKeyActions (dpy : PDisplay; first, num : Word; xkb : PXkbDescPtr) : TStatus;
+        cdecl; external libX11 name 'XkbGetKeyActions';
+
+function XkbGetKeyBehaviors (dpy : PDisplay; firstKey, nKeys : Word; desc : PXkbDescPtr) : TStatus;
+        cdecl; external libX11 name 'XkbGetKeyBehaviors';
+
+function XkbGetVirtualMods (dpy : PDisplay; which : Word; desc : PXkbDescPtr) : TStatus;
+        cdecl; external libX11 name 'XkbGetVirtualMods';
+
+function XkbGetKeyExplicitComponents (dpy : PDisplay; firstKey, nKeys : Word; desc : PXkbDescPtr) : TStatus;
+        cdecl; external libX11 name 'XkbGetKeyExplicitComponents';
+
+function XkbGetKeyModifierMap (dpy : PDisplay; firstKey, nKeys : Word; desc : PXkbDescPtr) : TStatus;
+        cdecl; external libX11 name 'XkbGetKeyModifierMap';
+
+function XkbAllocControls (xkb : PXkbDescPtr; which : Word) : TStatus;
+        cdecl; external libX11 name 'XkbAllocControls';
+
+procedure XkbFreeControls (xkb : PXkbDescPtr; which : Word; freeMap : Boolean);
+        cdecl; external libX11 name 'XkbFreeControls';
+
+function XkbGetControls (dpy : PDisplay; which : Longword; desc : PXkbDescPtr) : TStatus;
+        cdecl; external libX11 name 'XkbGetControls';
+
+function XkbSetControls (dpy : PDisplay; which : Longword; desc : PXkbDescPtr) : Boolean;
+        cdecl; external libX11 name 'XkbSetControls';
+
+procedure XkbNoteControlsChanges (old    : PXkbControlsChangesPtr; new : PXkbControlsNotifyEvent;
+                                                                                                                                  wanted : Word);
+        cdecl; external libX11 name 'XkbNoteControlsChanges';
+
+function XkbGetControlsChanges (d : PDisplay; x : PXkbDescPtr; c : PXkbControlsChangesPtr) : TStatus;
+function XkbChangeControls     (d : PDisplay; x : PXkbDescPtr; c : PXkbControlsChangesPtr) : Boolean;
+
+function XkbAllocCompatMap (xkb : PXkbDescPtr; which, nInterpret : Word) : TStatus;
+        cdecl; external libX11 name 'XkbAllocCompatMap';
+
+procedure XkbFreeCompatMap (xkib : PXkbDescPtr; which : Word; freeMap : Boolean);
+        cdecl; external libX11 name 'XkbFreeCompatMap';
+
+function XkbGetCompatMap (dpy : PDisplay;  which : Word; xkb : PXkbDescPtr) : TStatus;
+        cdecl; external libX11 name 'XkbGetCompatMap';
+
+function XkbSetCompatMap (dpy : PDisplay;    which         : Word;
+                          xkb : PXkbDescPtr; updateActions : Boolean) : Boolean;
+        cdecl; external libX11 name 'XkbSetCompatMap';
+
+function XkbAddSymInterpret (xkb       : PXkbDescPtr; si      : PXkbSymInterpretPtr;
+                             updateMap : Boolean;     changes : PXkbChangesPtr) : PXkbSymInterpretPtr;
+        cdecl; external libX11 name 'XkbAddSymInterpret';
+
+function XkbAllocNames (xkb : PXkbDescPtr; which : Word; nTotalRG, nTotalAliases : Smallint) : TStatus;
+        cdecl; external libX11 name 'XkbAllocNames';
+
+function XkbGetNames (dpy : PDisplay; which : Word; desc : PXkbDescPtr) : TStatus;
+        cdecl; external libX11 name 'XkbGetNames';
+
+function XkbSetNames (dpy : PDisplay; which, firstType, nTypes : Word; desc : PXkbDescPtr) : Boolean;
+        cdecl; external libX11 name 'XkbSetNames';
+
+function XkbChangeNames (dpy : PDisplay; xkb : PXkbDescPtr; changes : PXkbNameChangesPtr) : Boolean;
+        cdecl; external libX11 name 'XkbChangeNames';
+
+procedure XkbFreeNames (xkb : PXkbDescPtr; which : Word; freeMap : Boolean);
+        cdecl; external libX11 name 'XkbFreeNames';
+
+function XkbGetState(dpy : PDisplay; deviceSpec : Word; rtrnState : PXkbStatePtr) : TStatus;
+        cdecl; external libX11 name 'XkbGetState';
+
+function XkbSetMap (dpy : PDisplay; which : Word; desc : PXkbDescPtr) : Boolean;
+        cdecl; external libX11 name 'XkbSetMap';
+
+function XkbChangeMap (dpy : PDisplay; desc : PXkbDescPtr; changes : PXkbMapChangesPtr) : Boolean;
+        cdecl; external libX11 name 'XkbChangeMap';
+
+function XkbSetDetectableAutoRepeat (dpy : PDisplay; detectable : Boolean; supported : PBoolean) : Boolean;
+        cdecl; external libX11 name 'XkbSetDetectableAutoRepeat';
+
+function XkbGetDetectableAutoRepeat (dpy : PDisplay; supported : PBoolean) : Boolean;
+        cdecl; external libX11 name 'XkbGetDetectableAutoRepeat';
+
+function XkbSetAutoResetControls (dpy : PDisplay; changes : Word;
+                                  auto_ctrls, auto_values : PWord) : Boolean;
+        cdecl; external libX11 name 'XkbSetAutoResetControls';
+
+function XkbGetAutoResetControls (dpy : PDisplay; auto_ctrls, auto_ctrl_values : PWord) : Boolean;
+        cdecl; external libX11 name 'XkbGetAutoResetControls';
+
+function XkbSetPerClientControls (dpy : PDisplay; change : Word; values : PWord) : Boolean;
+        cdecl; external libX11 name 'XkbSetPerClientControls';
+
+function XkbGetPerClientControls (dpy : PDisplay; ctrls : PWord) : Boolean;
+        cdecl; external libX11 name 'XkbGetPerClientControls';
+
+function XkbCopyKeyType (from, into : PXkbKeyTypePtr) : TStatus;
+        cdecl; external libX11 name 'XkbCopyKeyType';
+
+function XkbCopyKeyTypes (from, into : PXkbKeyTypePtr; num_types : Smallint) : TStatus;
+        cdecl; external libX11 name 'XkbCopyKeyTypes';
+
+function XkbResizeKeyType (xkb : PXkbDescPtr; type_ndx, map_count : Smallint;
+                           want_preserve : Boolean;  new_num_lvls : Smallint) : TStatus;
+        cdecl; external libX11 name 'XkbResizeKeyType';
+
+function XkbResizeKeySyms (desc : PXkbDescPtr; forKey, symsNeeded : Smallint) : PKeySym;
+        cdecl; external libX11 name 'XkbResizeKeySyms';
+
+function XkbResizeKeyActions (desc : PXkbDescPtr; forKey, actsNeeded : Smallint) : PXkbAction;
+        cdecl; external libX11 name 'XkbResizeKeyActions';
+
+function XkbChangeTypesOfKey (xkb    : PXkbDescPtr; key, num_groups : Smallint;
+                              groups : Word; newTypes : PSmallint; pChanges : PXkbMapChangesPtr) : TStatus;
+        cdecl; external libX11 name 'XkbChangeTypesOfKey';
+
+(***====================================================================***)
+
+function XkbListComponents (dpy   : PDisplay; deviceSpec : Word;
+                            ptrns : PXkbComponentNamesPtr; max_inout : PSmallint) : PXkbComponentListPtr;
+        cdecl; external libX11 name 'XkbListComponents';
+
+procedure XkbFreeComponentList (list : PXkbComponentListPtr);
+        cdecl; external libX11 name 'XkbFreeComponentList';
+
+function XkbGetKeyboard (dpy : PDisplay; which, deviceSpec : Word) : PXkbDescPtr;
+        cdecl; external libX11 name 'XkbGetKeyboard';
+
+function XkbGetKeyboardByName (dpy : PDisplay; deviceSpec : Word; names : PXkbComponentNamesPtr;
+                                     want, need : Word; load : Boolean) : PXkbDescPtr;
+        cdecl; external libX11 name 'XkbGetKeyboardByName';
+
+(***====================================================================***)
+
+function XkbKeyTypesForCoreSymbols (                                   // returns # of groups
+                                    xkb           : PXkbDescPtr;       // keyboard device
+                                    map_width     : Smallint;          // keyboard device
+                                                                                                                                                core_syms     : PKeySym;           // always mapWidth symbols
+                                                                                                                                                protected     : Word;              // explicit key types
+                                                                                                                                                types_inout   : PSmallint;         // always four type indices
+                                                                                                                                                xkb_syms_rtrn : PKeySym            // must have enough space
+                                                                                                                                         ) : Smallint;
+        cdecl; external libX11 name 'XkbKeyTypesForCoreSymbols';
+
+function XkbApplyCompatMapToKey (                                      // False only on error
+                                 xkb     : PXkbDescPtr;                // keymap to be edited
+                                                                                                                                 key     : TKeyCode;                   // key to be updated
+                                                                                                                                 changes : PXkbChangesPtr              // resulting changes to map
+                                                                                                                                ) : Boolean;
+        cdecl; external libX11 name 'XkbApplyCompatMapToKey';
+
+function XkbUpdateMapFromCore (                                        //False only on error
+                               xkb          : PXkbDescPtr;             // XKB keyboard to be edited
+                                                                                                                         first_key    : TKeyCode;                // first changed key
+                                                                                                                         num_keys,                               // number of changed keys
+                                                                                                                         map_width    : Smallint;                // width of core keymap
+                                                                                                                         core_keysyms : PKeySym;                 // symbols from core keymap
+                                                                                                                         changes      : PXkbChangesPtr           // resulting changes
+                                                                                                                        ) : Boolean;
+        cdecl; external libX11 name 'XkbUpdateMapFromCore';
+
+(***====================================================================***)
+
+function XkbAddDeviceLedInfo (devi : PXkbDeviceInfoPtr; ledClass, ledId : Word) : PXkbDeviceLedInfoPtr;
+        cdecl; external libX11 name 'XkbAddDeviceLedInfo';
+
+function XkbResizeDeviceButtonActions (devi : PXkbDeviceInfoPtr; newTotal : Word) : TStatus;
+        cdecl; external libX11 name 'XkbResizeDeviceButtonActions';
+
+function XkbAllocDeviceInfo (deviceSpec, nButtons, szLeds : Word) : PXkbDeviceInfoPtr;
+        cdecl; external libX11 name 'XkbAllocDeviceInfo';
+
+procedure XkbFreeDeviceInfo (devi : PXkbDeviceInfoPtr; which : Word; freeDevI : Boolean);
+        cdecl; external libX11 name 'XkbFreeDeviceInfo';
+
+procedure XkbNoteDeviceChanges (old    : PXkbDeviceChangesPtr; new : PXkbExtensionDeviceNotifyEvent;
+                                wanted : Word);
+        cdecl; external libX11 name 'XkbNoteDeviceChanges';
+
+function XkbGetDeviceInfo (dpy : PDisplay; which, deviceSpec, ledClass, ledID : Word) : PXkbDeviceInfoPtr;
+        cdecl; external libX11 name 'XkbGetDeviceInfo';
+
+function XkbGetDeviceInfoChanges (dpy : PDisplay; devi : PXkbDeviceInfoPtr;
+                                  changes : PXkbDeviceChangesPtr)           : TStatus;
+        cdecl; external libX11 name 'XkbGetDeviceInfoChanges';
+
+function XkbGetDeviceButtonActions (dpy : PDisplay; devi : PXkbDeviceInfoPtr; all : Boolean;
+                                    first, nBtns : Word)                                     : TStatus;
+        cdecl; external libX11 name 'XkbGetDeviceButtonActions';
+
+function XkbGetDeviceLedInfo (dpy : PDisplay; devi : PXkbDeviceInfoPtr;
+                              ledClass, ledId, which : Word)            : TStatus;
+        cdecl; external libX11 name 'XkbGetDeviceLedInfo';
+
+function XkbSetDeviceInfo (dpy : PDisplay; which : Word; devi : PXkbDeviceInfoPtr) : Boolean;
+        cdecl; external libX11 name 'XkbSetDeviceInfo';
+
+function XkbChangeDeviceInfo (dpy : PDisplay; desc : PXkbDeviceInfoPtr;
+                              changes : PXkbDeviceChangesPtr)            : Boolean;
+        cdecl; external libX11 name 'XkbChangeDeviceInfo';
+
+function XkbSetDeviceLedInfo (dpy : PDisplay; devi : PXkbDeviceInfoPtr;
+                              ledClass, ledID, which : Word)             : Boolean;
+        cdecl; external libX11 name 'XkbSetDeviceLedInfo';
+
+function XkbSetDeviceButtonActions (dpy : PDisplay; devi : PXkbDeviceInfoPtr;
+                                    first, nBtns : Word)                 : Boolean;
+        cdecl; external libX11 name 'XkbSetDeviceButtonActions';
+
+(***====================================================================***)
+
+function XkbToControl (c : Byte) : Byte;
+        cdecl; external libX11 name 'XkbToControl';
+
+(***====================================================================***)
+
+function XkbSetDebuggingFlags (dpy : PDisplay; mask, flags : Word; msg : PChar;
+                               ctrls_mask, ctrls, rtrn_flags, rtrn_ctrls : Word) : Boolean;
+        cdecl; external libX11 name 'XkbSetDebuggingFlags';
+
+function XkbApplyVirtualModChanges (xkb : PXkbDescPtr; changed : Word; changes : PXkbChangesPtr) : Boolean;
+        cdecl; external libX11 name 'XkbApplyVirtualModChanges';
+
+implementation
+
+procedure XkbNoteIndicatorMapChanges (o, n : PXkbIndicatorChangesPtr; w : Word);
+begin
+{#define XkbNoteIndicatorMapChanges(o,n,w) ((o)->map_changes|=((n)->map_changes&(w)))}
+        o^.map_changes := o^.map_changes or (n^.map_changes and w);
+end;
+
+procedure XkbNoteIndicatorStateChanges (o, n : PXkbIndicatorChangesPtr; w : Word);
+begin
+{#define XkbNoteIndicatorStateChanges(o,n,w) ((o)->state_changes|=((n)->state_changes&(w)))}
+        o^.state_changes := o^.state_changes or (n^.state_changes and w);
+end;
+
+function XkbGetIndicatorMapChanges (d : PDisplay; x : PXkbDescPtr; c : PXkbIndicatorChangesPtr) : TStatus;
+begin
+{#define XkbGetIndicatorMapChanges(d,x,c) (XkbGetIndicatorMap((d),(c)->map_changes,x)}
+        Result := XkbGetIndicatorMap (d, c^.map_changes, x);
+end;
+
+function XkbChangeIndicatorMaps (d : PDisplay; x : PXkbDescPtr; c : PXkbIndicatorChangesPtr) : Boolean;
+begin
+{#define XkbChangeIndicatorMaps(d,x,c) (XkbSetIndicatorMap((d),(c)->map_changes,x))}
+        Result := XkbSetIndicatorMap (d, c^.map_changes, x);
+end;
+
+function XkbGetControlsChanges (d : PDisplay; x : PXkbDescPtr; c : PXkbControlsChangesPtr) : TStatus;
+begin
+{#define XkbGetControlsChanges(d,x,c) XkbGetControls(d,(c)->changed_ctrls,x)}
+        Result := XkbGetControls (d, c^.changed_ctrls, x);
+end;
+
+function XkbChangeControls (d : PDisplay; x : PXkbDescPtr; c : PXkbControlsChangesPtr) : Boolean;
+begin
+{#define XkbChangeControls(d,x,c) XkbSetControls(d,(c)->changed_ctrls,x)}
+        Result := XkbSetControls (d, c^.changed_ctrls, x);
+end;
+
+end.

+ 2077 - 0
packages/x11/src/xlib.pp

@@ -0,0 +1,2077 @@
+unit xlib;
+interface
+{$mode objfpc}
+uses
+  ctypes,x;
+{$define MACROS}
+
+{$ifndef os2}
+  {$LinkLib c}
+  {$LinkLib X11}
+const
+  libX11='X11';
+{$else}
+const
+  libX11='X11';
+{$endif}
+
+type
+  PPcint = ^Pcint;
+  PPcuchar = ^Pcuchar;
+{
+  Automatically converted by H2Pas 0.99.15 from xlib.h
+  The following command line parameters were used:
+    -p
+    -T
+    -S
+    -d
+    -c
+    xlib.h
+}
+
+{$PACKRECORDS C}
+
+
+const
+   XlibSpecificationRelease = 6;
+type
+
+   PXPointer = ^TXPointer;
+   TXPointer = ^char;
+   PBool = ^TBool;
+   TBool = longbool; {cint?}
+   PStatus = ^TStatus;
+   TStatus = cint;
+
+const
+   QueuedAlready = 0;
+   QueuedAfterReading = 1;
+   QueuedAfterFlush = 2;
+
+type
+
+   PPXExtData = ^PXExtData;
+   PXExtData = ^TXExtData;
+   TXExtData = record
+        number : cint;
+        next : PXExtData;
+        free_private : function (extension:PXExtData):cint;cdecl;
+        private_data : TXPointer;
+     end;
+
+   PXExtCodes = ^TXExtCodes;
+   TXExtCodes = record
+        extension : cint;
+        major_opcode : cint;
+        first_event : cint;
+        first_error : cint;
+     end;
+
+   PXPixmapFormatValues = ^TXPixmapFormatValues;
+   TXPixmapFormatValues = record
+        depth : cint;
+        bits_per_pixel : cint;
+        scanline_pad : cint;
+     end;
+
+   PXGCValues = ^TXGCValues;
+   TXGCValues = record
+        _function : cint;
+        plane_mask : culong;
+        foreground : culong;
+        background : culong;
+        line_width : cint;
+        line_style : cint;
+        cap_style : cint;
+        join_style : cint;
+        fill_style : cint;
+        fill_rule : cint;
+        arc_mode : cint;
+        tile : TPixmap;
+        stipple : TPixmap;
+        ts_x_origin : cint;
+        ts_y_origin : cint;
+        font : TFont;
+        subwindow_mode : cint;
+        graphics_exposures : TBool;
+        clip_x_origin : cint;
+        clip_y_origin : cint;
+        clip_mask : TPixmap;
+        dash_offset : cint;
+        dashes : cchar;
+     end;
+
+   PXGC = ^TXGC;
+   TXGC = record
+     end;
+   TGC = PXGC;
+   PGC = ^TGC;
+
+   PVisual = ^TVisual;
+   TVisual = record
+        ext_data : PXExtData;
+        visualid : TVisualID;
+        c_class : cint;
+        red_mask, green_mask, blue_mask : culong;
+        bits_per_rgb : cint;
+        map_entries : cint;
+     end;
+
+   PDepth = ^TDepth;
+   TDepth = record
+        depth : cint;
+        nvisuals : cint;
+        visuals : PVisual;
+     end;
+   PXDisplay = ^TXDisplay;
+   TXDisplay = record
+     end;
+
+
+   PScreen = ^TScreen;
+   TScreen = record
+        ext_data : PXExtData;
+        display : PXDisplay;
+        root : TWindow;
+        width, height : cint;
+        mwidth, mheight : cint;
+        ndepths : cint;
+        depths : PDepth;
+        root_depth : cint;
+        root_visual : PVisual;
+        default_gc : TGC;
+        cmap : TColormap;
+        white_pixel : culong;
+        black_pixel : culong;
+        max_maps, min_maps : cint;
+        backing_store : cint;
+        save_unders : TBool;
+        root_input_mask : clong;
+     end;
+
+   PScreenFormat = ^TScreenFormat;
+   TScreenFormat = record
+        ext_data : PXExtData;
+        depth : cint;
+        bits_per_pixel : cint;
+        scanline_pad : cint;
+     end;
+
+   PXSetWindowAttributes = ^TXSetWindowAttributes;
+   TXSetWindowAttributes = record
+        background_pixmap : TPixmap;
+        background_pixel : culong;
+        border_pixmap : TPixmap;
+        border_pixel : culong;
+        bit_gravity : cint;
+        win_gravity : cint;
+        backing_store : cint;
+        backing_planes : culong;
+        backing_pixel : culong;
+        save_under : TBool;
+        event_mask : clong;
+        do_not_propagate_mask : clong;
+        override_redirect : TBool;
+        colormap : TColormap;
+        cursor : TCursor;
+     end;
+
+   PXWindowAttributes = ^TXWindowAttributes;
+   TXWindowAttributes = record
+        x, y : cint;
+        width, height : cint;
+        border_width : cint;
+        depth : cint;
+        visual : PVisual;
+        root : TWindow;
+        c_class : cint;
+        bit_gravity : cint;
+        win_gravity : cint;
+        backing_store : cint;
+        backing_planes : culong;
+        backing_pixel : culong;
+        save_under : TBool;
+        colormap : TColormap;
+        map_installed : TBool;
+        map_state : cint;
+        all_event_masks : clong;
+        your_event_mask : clong;
+        do_not_propagate_mask : clong;
+        override_redirect : TBool;
+        screen : PScreen;
+     end;
+
+   PXHostAddress = ^TXHostAddress;
+   TXHostAddress = record
+        family : cint;
+        length : cint;
+        address : Pchar;
+     end;
+
+   PXServerInterpretedAddress = ^TXServerInterpretedAddress;
+   TXServerInterpretedAddress = record
+        typelength : cint;
+        valuelength : cint;
+        _type : Pchar;
+        value : Pchar;
+     end;
+
+   PXImage = ^TXImage;
+   TXImage = record
+        width, height : cint;
+        xoffset : cint;
+        format : cint;
+        data : Pchar;
+        byte_order : cint;
+        bitmap_unit : cint;
+        bitmap_bit_order : cint;
+        bitmap_pad : cint;
+        depth : cint;
+        bytes_per_line : cint;
+        bits_per_pixel : cint;
+        red_mask : culong;
+        green_mask : culong;
+        blue_mask : culong;
+        obdata : TXPointer;
+        f : record
+             create_image : function (para1:PXDisplay; para2:PVisual; para3:cuint; para4:cint; para5:cint;
+                          para6:Pchar; para7:cuint; para8:cuint; para9:cint; para10:cint):PXImage;cdecl;
+             destroy_image : function (para1:PXImage):cint;cdecl;
+             get_pixel : function (para1:PXImage; para2:cint; para3:cint):culong;cdecl;
+             put_pixel : function (para1:PXImage; para2:cint; para3:cint; para4:culong):cint;cdecl;
+             sub_image : function (para1:PXImage; para2:cint; para3:cint; para4:cuint; para5:cuint):PXImage;cdecl;
+             add_pixel : function (para1:PXImage; para2:clong):cint;cdecl;
+          end;
+     end;
+
+   PXWindowChanges = ^TXWindowChanges;
+   TXWindowChanges = record
+        x, y : cint;
+        width, height : cint;
+        border_width : cint;
+        sibling : TWindow;
+        stack_mode : cint;
+     end;
+
+   PXColor = ^TXColor;
+   TXColor = record
+        pixel : culong;
+        red, green, blue : cushort;
+        flags : cchar;
+        pad : cchar;
+     end;
+
+   PXSegment = ^TXSegment;
+   TXSegment = record
+        x1, y1, x2, y2 : cshort;
+     end;
+
+   PXPoint = ^TXPoint;
+   TXPoint = record
+        x, y : cshort;
+     end;
+
+   PXRectangle = ^TXRectangle;
+   TXRectangle = record
+        x, y : cshort;
+        width, height : cushort;
+     end;
+
+   PXArc = ^TXArc;
+   TXArc = record
+        x, y : cshort;
+        width, height : cushort;
+        angle1, angle2 : cshort;
+     end;
+
+   PXKeyboardControl = ^TXKeyboardControl;
+   TXKeyboardControl = record
+        key_click_percent : cint;
+        bell_percent : cint;
+        bell_pitch : cint;
+        bell_duration : cint;
+        led : cint;
+        led_mode : cint;
+        key : cint;
+        auto_repeat_mode : cint;
+     end;
+
+   PXKeyboardState = ^TXKeyboardState;
+   TXKeyboardState = record
+        key_click_percent : cint;
+        bell_percent : cint;
+        bell_pitch, bell_duration : cuint;
+        led_mask : culong;
+        global_auto_repeat : cint;
+        auto_repeats : array[0..31] of cchar;
+     end;
+
+   PXTimeCoord = ^TXTimeCoord;
+   TXTimeCoord = record
+        time : TTime;
+        x, y : cshort;
+     end;
+
+   PXModifierKeymap = ^TXModifierKeymap;
+   TXModifierKeymap = record
+        max_keypermod : cint;
+        modifiermap : PKeyCode;
+     end;
+
+   PDisplay = ^TDisplay;
+   TDisplay = TXDisplay;
+
+   PXPrivate = ^TXPrivate;
+   TXPrivate = record
+     end;
+
+   PXrmHashBucketRec = ^TXrmHashBucketRec;
+   TXrmHashBucketRec = record
+     end;
+
+
+   PXPrivDisplay = ^TXPrivDisplay;
+   TXPrivDisplay = record
+        ext_data : PXExtData;
+        private1 : PXPrivate;
+        fd : cint;
+        private2 : cint;
+        proto_major_version : cint;
+        proto_minor_version : cint;
+        vendor : Pchar;
+        private3 : TXID;
+        private4 : TXID;
+        private5 : TXID;
+        private6 : cint;
+        resource_alloc : function (para1:PXDisplay):TXID;cdecl;
+        byte_order : cint;
+        bitmap_unit : cint;
+        bitmap_pad : cint;
+        bitmap_bit_order : cint;
+        nformats : cint;
+        pixmap_format : PScreenFormat;
+        private8 : cint;
+        release : cint;
+        private9, private10 : PXPrivate;
+        qlen : cint;
+        last_request_read : culong;
+        request : culong;
+        private11 : TXPointer;
+        private12 : TXPointer;
+        private13 : TXPointer;
+        private14 : TXPointer;
+        max_request_size : cunsigned;
+        db : PXrmHashBucketRec;
+        private15 : function (para1:PXDisplay):cint;cdecl;
+        display_name : Pchar;
+        default_screen : cint;
+        nscreens : cint;
+        screens : PScreen;
+        motion_buffer : culong;
+        private16 : culong;
+        min_keycode : cint;
+        max_keycode : cint;
+        private17 : TXPointer;
+        private18 : TXPointer;
+        private19 : cint;
+        xdefaults : Pchar;
+     end;
+
+   PXKeyEvent = ^TXKeyEvent;
+   TXKeyEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        window : TWindow;
+        root : TWindow;
+        subwindow : TWindow;
+        time : TTime;
+        x, y : cint;
+        x_root, y_root : cint;
+        state : cuint;
+        keycode : cuint;
+        same_screen : TBool;
+     end;
+
+   PXKeyPressedEvent = ^TXKeyPressedEvent;
+   TXKeyPressedEvent = TXKeyEvent;
+
+   PXKeyReleasedEvent = ^TXKeyReleasedEvent;
+   TXKeyReleasedEvent = TXKeyEvent;
+
+   PXButtonEvent = ^TXButtonEvent;
+   TXButtonEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        window : TWindow;
+        root : TWindow;
+        subwindow : TWindow;
+        time : TTime;
+        x, y : cint;
+        x_root, y_root : cint;
+        state : cuint;
+        button : cuint;
+        same_screen : TBool;
+     end;
+
+   PXButtonPressedEvent = ^TXButtonPressedEvent;
+   TXButtonPressedEvent = TXButtonEvent;
+
+   PXButtonReleasedEvent = ^TXButtonReleasedEvent;
+   TXButtonReleasedEvent = TXButtonEvent;
+
+   PXMotionEvent = ^TXMotionEvent;
+   TXMotionEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        window : TWindow;
+        root : TWindow;
+        subwindow : TWindow;
+        time : TTime;
+        x, y : cint;
+        x_root, y_root : cint;
+        state : cuint;
+        is_hint : cchar;
+        same_screen : TBool;
+     end;
+
+   PXPointerMovedEvent = ^TXPointerMovedEvent;
+   TXPointerMovedEvent = TXMotionEvent;
+
+   PXCrossingEvent = ^TXCrossingEvent;
+   TXCrossingEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        window : TWindow;
+        root : TWindow;
+        subwindow : TWindow;
+        time : TTime;
+        x, y : cint;
+        x_root, y_root : cint;
+        mode : cint;
+        detail : cint;
+        same_screen : TBool;
+        focus : TBool;
+        state : cuint;
+     end;
+
+   PXEnterWindowEvent = ^TXEnterWindowEvent;
+   TXEnterWindowEvent = TXCrossingEvent;
+
+   PXLeaveWindowEvent = ^TXLeaveWindowEvent;
+   TXLeaveWindowEvent = TXCrossingEvent;
+
+   PXFocusChangeEvent = ^TXFocusChangeEvent;
+   TXFocusChangeEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        window : TWindow;
+        mode : cint;
+        detail : cint;
+     end;
+
+   PXFocusInEvent = ^TXFocusInEvent;
+   TXFocusInEvent = TXFocusChangeEvent;
+
+   PXFocusOutEvent = ^TXFocusOutEvent;
+   TXFocusOutEvent = TXFocusChangeEvent;
+
+   PXKeymapEvent = ^TXKeymapEvent;
+   TXKeymapEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        window : TWindow;
+        key_vector : array[0..31] of cchar;
+     end;
+
+   PXExposeEvent = ^TXExposeEvent;
+   TXExposeEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        window : TWindow;
+        x, y : cint;
+        width, height : cint;
+        count : cint;
+     end;
+
+   PXGraphicsExposeEvent = ^TXGraphicsExposeEvent;
+   TXGraphicsExposeEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        drawable : TDrawable;
+        x, y : cint;
+        width, height : cint;
+        count : cint;
+        major_code : cint;
+        minor_code : cint;
+     end;
+
+   PXNoExposeEvent = ^TXNoExposeEvent;
+   TXNoExposeEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        drawable : TDrawable;
+        major_code : cint;
+        minor_code : cint;
+     end;
+
+   PXVisibilityEvent = ^TXVisibilityEvent;
+   TXVisibilityEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        window : TWindow;
+        state : cint;
+     end;
+
+   PXCreateWindowEvent = ^TXCreateWindowEvent;
+   TXCreateWindowEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        parent : TWindow;
+        window : TWindow;
+        x, y : cint;
+        width, height : cint;
+        border_width : cint;
+        override_redirect : TBool;
+     end;
+
+   PXDestroyWindowEvent = ^TXDestroyWindowEvent;
+   TXDestroyWindowEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        event : TWindow;
+        window : TWindow;
+     end;
+
+   PXUnmapEvent = ^TXUnmapEvent;
+   TXUnmapEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        event : TWindow;
+        window : TWindow;
+        from_configure : TBool;
+     end;
+
+   PXMapEvent = ^TXMapEvent;
+   TXMapEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        event : TWindow;
+        window : TWindow;
+        override_redirect : TBool;
+     end;
+
+   PXMapRequestEvent = ^TXMapRequestEvent;
+   TXMapRequestEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        parent : TWindow;
+        window : TWindow;
+     end;
+
+   PXReparentEvent = ^TXReparentEvent;
+   TXReparentEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        event : TWindow;
+        window : TWindow;
+        parent : TWindow;
+        x, y : cint;
+        override_redirect : TBool;
+     end;
+
+   PXConfigureEvent = ^TXConfigureEvent;
+   TXConfigureEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        event : TWindow;
+        window : TWindow;
+        x, y : cint;
+        width, height : cint;
+        border_width : cint;
+        above : TWindow;
+        override_redirect : TBool;
+     end;
+
+   PXGravityEvent = ^TXGravityEvent;
+   TXGravityEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        event : TWindow;
+        window : TWindow;
+        x, y : cint;
+     end;
+
+   PXResizeRequestEvent = ^TXResizeRequestEvent;
+   TXResizeRequestEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        window : TWindow;
+        width, height : cint;
+     end;
+
+   PXConfigureRequestEvent = ^TXConfigureRequestEvent;
+   TXConfigureRequestEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        parent : TWindow;
+        window : TWindow;
+        x, y : cint;
+        width, height : cint;
+        border_width : cint;
+        above : TWindow;
+        detail : cint;
+        value_mask : culong;
+     end;
+
+   PXCirculateEvent = ^TXCirculateEvent;
+   TXCirculateEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        event : TWindow;
+        window : TWindow;
+        place : cint;
+     end;
+
+   PXCirculateRequestEvent = ^TXCirculateRequestEvent;
+   TXCirculateRequestEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        parent : TWindow;
+        window : TWindow;
+        place : cint;
+     end;
+
+   PXPropertyEvent = ^TXPropertyEvent;
+   TXPropertyEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        window : TWindow;
+        atom : TAtom;
+        time : TTime;
+        state : cint;
+     end;
+
+   PXSelectionClearEvent = ^TXSelectionClearEvent;
+   TXSelectionClearEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        window : TWindow;
+        selection : TAtom;
+        time : TTime;
+     end;
+
+   PXSelectionRequestEvent = ^TXSelectionRequestEvent;
+   TXSelectionRequestEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        owner : TWindow;
+        requestor : TWindow;
+        selection : TAtom;
+        target : TAtom;
+        _property : TAtom;
+        time : TTime;
+     end;
+
+   PXSelectionEvent = ^TXSelectionEvent;
+   TXSelectionEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        requestor : TWindow;
+        selection : TAtom;
+        target : TAtom;
+        _property : TAtom;
+        time : TTime;
+     end;
+
+   PXColormapEvent = ^TXColormapEvent;
+   TXColormapEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        window : TWindow;
+        colormap : TColormap;
+        c_new : TBool;
+        state : cint;
+     end;
+
+   PXClientMessageEvent = ^TXClientMessageEvent;
+   TXClientMessageEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        window : TWindow;
+        message_type : TAtom;
+        format : cint;
+        data : record
+            case longint of
+               0 : ( b : array[0..19] of cchar );
+               1 : ( s : array[0..9] of cshort );
+               2 : ( l : array[0..4] of clong );
+            end;
+     end;
+
+   PXMappingEvent = ^TXMappingEvent;
+   TXMappingEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        window : TWindow;
+        request : cint;
+        first_keycode : cint;
+        count : cint;
+     end;
+
+   PXErrorEvent = ^TXErrorEvent;
+   TXErrorEvent = record
+        _type : cint;
+        display : PDisplay;
+        resourceid : TXID;
+        serial : culong;
+        error_code : cuchar;
+        request_code : cuchar;
+        minor_code : cuchar;
+     end;
+
+   PXAnyEvent = ^TXAnyEvent;
+   TXAnyEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        window : TWindow;
+     end;
+
+   PXEvent = ^TXEvent;
+   TXEvent = record
+       case longint of
+          0 : ( _type : cint );
+          1 : ( xany : TXAnyEvent );
+          2 : ( xkey : TXKeyEvent );
+          3 : ( xbutton : TXButtonEvent );
+          4 : ( xmotion : TXMotionEvent );
+          5 : ( xcrossing : TXCrossingEvent );
+          6 : ( xfocus : TXFocusChangeEvent );
+          7 : ( xexpose : TXExposeEvent );
+          8 : ( xgraphicsexpose : TXGraphicsExposeEvent );
+          9 : ( xnoexpose : TXNoExposeEvent );
+          10 : ( xvisibility : TXVisibilityEvent );
+          11 : ( xcreatewindow : TXCreateWindowEvent );
+          12 : ( xdestroywindow : TXDestroyWindowEvent );
+          13 : ( xunmap : TXUnmapEvent );
+          14 : ( xmap : TXMapEvent );
+          15 : ( xmaprequest : TXMapRequestEvent );
+          16 : ( xreparent : TXReparentEvent );
+          17 : ( xconfigure : TXConfigureEvent );
+          18 : ( xgravity : TXGravityEvent );
+          19 : ( xresizerequest : TXResizeRequestEvent );
+          20 : ( xconfigurerequest : TXConfigureRequestEvent );
+          21 : ( xcirculate : TXCirculateEvent );
+          22 : ( xcirculaterequest : TXCirculateRequestEvent );
+          23 : ( xproperty : TXPropertyEvent );
+          24 : ( xselectionclear : TXSelectionClearEvent );
+          25 : ( xselectionrequest : TXSelectionRequestEvent );
+          26 : ( xselection : TXSelectionEvent );
+          27 : ( xcolormap : TXColormapEvent );
+          28 : ( xclient : TXClientMessageEvent );
+          29 : ( xmapping : TXMappingEvent );
+          30 : ( xerror : TXErrorEvent );
+          31 : ( xkeymap : TXKeymapEvent );
+          32 : ( pad : array[0..23] of clong );
+       end;
+
+type
+
+   PXCharStruct = ^TXCharStruct;
+   TXCharStruct = record
+        lbearing : cshort;
+        rbearing : cshort;
+        width : cshort;
+        ascent : cshort;
+        descent : cshort;
+        attributes : cushort;
+     end;
+
+   PXFontProp = ^TXFontProp;
+   TXFontProp = record
+        name : TAtom;
+        card32 : culong;
+     end;
+
+   PPPXFontStruct = ^PPXFontStruct;
+   PPXFontStruct = ^PXFontStruct;
+   PXFontStruct = ^TXFontStruct;
+   TXFontStruct = record
+        ext_data : PXExtData;
+        fid : TFont;
+        direction : cunsigned;
+        min_char_or_byte2 : cunsigned;
+        max_char_or_byte2 : cunsigned;
+        min_byte1 : cunsigned;
+        max_byte1 : cunsigned;
+        all_chars_exist : TBool;
+        default_char : cunsigned;
+        n_properties : cint;
+        properties : PXFontProp;
+        min_bounds : TXCharStruct;
+        max_bounds : TXCharStruct;
+        per_char : PXCharStruct;
+        ascent : cint;
+        descent : cint;
+     end;
+
+   PXTextItem = ^TXTextItem;
+   TXTextItem = record
+        chars : Pchar;
+        nchars : cint;
+        delta : cint;
+        font : TFont;
+     end;
+
+   PXChar2b = ^TXChar2b;
+   TXChar2b = record
+        byte1 : cuchar;
+        byte2 : cuchar;
+     end;
+
+   PXTextItem16 = ^TXTextItem16;
+   TXTextItem16 = record
+        chars : PXChar2b;
+        nchars : cint;
+        delta : cint;
+        font : TFont;
+     end;
+
+   PXEDataObject = ^TXEDataObject;
+   TXEDataObject = record
+       case longint of
+          0 : ( display : PDisplay );
+          1 : ( gc : TGC );
+          2 : ( visual : PVisual );
+          3 : ( screen : PScreen );
+          4 : ( pixmap_format : PScreenFormat );
+          5 : ( font : PXFontStruct );
+       end;
+
+   PXFontSetExtents = ^TXFontSetExtents;
+   TXFontSetExtents = record
+        max_ink_extent : TXRectangle;
+        max_logical_extent : TXRectangle;
+     end;
+
+   PXOM = ^TXOM;
+   TXOM = record
+     end;
+
+   PXOC = ^TXOC;
+   TXOC = record
+     end;
+   TXFontSet = PXOC;
+   PXFontSet = ^TXFontSet;
+
+   PXmbTextItem = ^TXmbTextItem;
+   TXmbTextItem = record
+        chars : Pchar;
+        nchars : cint;
+        delta : cint;
+        font_set : TXFontSet;
+     end;
+
+   PXwcTextItem = ^TXwcTextItem;
+   TXwcTextItem = record
+        chars : PWideChar; {wchar_t*}
+        nchars : cint;
+        delta : cint;
+        font_set : TXFontSet;
+     end;
+
+const
+   XNRequiredCharSet = 'requiredCharSet';
+   XNQueryOrientation = 'queryOrientation';
+   XNBaseFontName = 'baseFontName';
+   XNOMAutomatic = 'omAutomatic';
+   XNMissingCharSet = 'missingCharSet';
+   XNDefaultString = 'defaultString';
+   XNOrientation = 'orientation';
+   XNDirectionalDependentDrawing = 'directionalDependentDrawing';
+   XNContextualDrawing = 'contextualDrawing';
+   XNFontInfo = 'fontInfo';
+type
+
+   PXOMCharSetList = ^TXOMCharSetList;
+   TXOMCharSetList = record
+        charset_count : cint;
+        charset_list : PPChar;
+     end;
+
+   PXOrientation = ^TXOrientation;
+   TXOrientation = (XOMOrientation_LTR_TTB,XOMOrientation_RTL_TTB,
+     XOMOrientation_TTB_LTR,XOMOrientation_TTB_RTL,
+     XOMOrientation_Context);
+
+   PXOMOrientation = ^TXOMOrientation;
+   TXOMOrientation = record
+        num_orientation : cint;
+        orientation : PXOrientation;
+     end;
+
+   PXOMFontInfo = ^TXOMFontInfo;
+   TXOMFontInfo = record
+        num_font : cint;
+        font_struct_list : ^PXFontStruct;
+        font_name_list : PPChar;
+     end;
+
+   PXIM = ^TXIM;
+   TXIM = record
+     end;
+
+   PXIC = ^TXIC;
+   TXIC = record
+     end;
+
+   TXIMProc = procedure (para1:TXIM; para2:TXPointer; para3:TXPointer);cdecl;
+
+   TXICProc = function (para1:TXIC; para2:TXPointer; para3:TXPointer):TBool;cdecl;
+
+   TXIDProc = procedure (para1:PDisplay; para2:TXPointer; para3:TXPointer);cdecl;
+
+   PXIMStyle = ^TXIMStyle;
+   TXIMStyle = culong;
+
+   PXIMStyles = ^TXIMStyles;
+   TXIMStyles = record
+        count_styles : cushort;
+        supported_styles : PXIMStyle;
+     end;
+
+const
+   XIMPreeditArea = $0001;
+   XIMPreeditCallbacks = $0002;
+   XIMPreeditPosition = $0004;
+   XIMPreeditNothing = $0008;
+   XIMPreeditNone = $0010;
+   XIMStatusArea = $0100;
+   XIMStatusCallbacks = $0200;
+   XIMStatusNothing = $0400;
+   XIMStatusNone = $0800;
+   XNVaNestedList = 'XNVaNestedList';
+   XNQueryInputStyle = 'queryInputStyle';
+   XNClientWindow = 'clientWindow';
+   XNInputStyle = 'inputStyle';
+   XNFocusWindow = 'focusWindow';
+   XNResourceName = 'resourceName';
+   XNResourceClass = 'resourceClass';
+   XNGeometryCallback = 'geometryCallback';
+   XNDestroyCallback = 'destroyCallback';
+   XNFilterEvents = 'filterEvents';
+   XNPreeditStartCallback = 'preeditStartCallback';
+   XNPreeditDoneCallback = 'preeditDoneCallback';
+   XNPreeditDrawCallback = 'preeditDrawCallback';
+   XNPreeditCaretCallback = 'preeditCaretCallback';
+   XNPreeditStateNotifyCallback = 'preeditStateNotifyCallback';
+   XNPreeditAttributes = 'preeditAttributes';
+   XNStatusStartCallback = 'statusStartCallback';
+   XNStatusDoneCallback = 'statusDoneCallback';
+   XNStatusDrawCallback = 'statusDrawCallback';
+   XNStatusAttributes = 'statusAttributes';
+   XNArea = 'area';
+   XNAreaNeeded = 'areaNeeded';
+   XNSpotLocation = 'spotLocation';
+   XNColormap = 'colorMap';
+   XNStdColormap = 'stdColorMap';
+   XNForeground = 'foreground';
+   XNBackground = 'background';
+   XNBackgroundPixmap = 'backgroundPixmap';
+   XNFontSet = 'fontSet';
+   XNLineSpace = 'lineSpace';
+   XNCursor = 'cursor';
+   XNQueryIMValuesList = 'queryIMValuesList';
+   XNQueryICValuesList = 'queryICValuesList';
+   XNVisiblePosition = 'visiblePosition';
+   XNR6PreeditCallback = 'r6PreeditCallback';
+   XNStringConversionCallback = 'stringConversionCallback';
+   XNStringConversion = 'stringConversion';
+   XNResetState = 'resetState';
+   XNHotKey = 'hotKey';
+   XNHotKeyState = 'hotKeyState';
+   XNPreeditState = 'preeditState';
+   XNSeparatorofNestedList = 'separatorofNestedList';
+   XBufferOverflow = -(1);
+   XLookupNone = 1;
+   XLookupChars = 2;
+   XLookupKeySymVal = 3;
+   XLookupBoth = 4;
+type
+
+   PXVaNestedList = ^TXVaNestedList;
+   TXVaNestedList = pointer;
+
+   PXIMCallback = ^TXIMCallback;
+   TXIMCallback = record
+        client_data : TXPointer;
+        callback : TXIMProc;
+     end;
+
+   PXICCallback = ^TXICCallback;
+   TXICCallback = record
+        client_data : TXPointer;
+        callback : TXICProc;
+     end;
+
+   PXIMFeedback = ^TXIMFeedback;
+   TXIMFeedback = culong;
+
+const
+   XIMReverse = 1;
+   XIMUnderline = 1 shl 1;
+   XIMHighlight = 1 shl 2;
+   XIMPrimary = 1 shl 5;
+   XIMSecondary = 1 shl 6;
+   XIMTertiary = 1 shl 7;
+   XIMVisibleToForward = 1 shl 8;
+   XIMVisibleToBackword = 1 shl 9;
+   XIMVisibleToCenter = 1 shl 10;
+type
+
+   PXIMText = ^TXIMText;
+   TXIMText = record
+        length : cushort;
+        feedback : PXIMFeedback;
+        encoding_is_wchar : TBool;
+        _string : record
+            case longint of
+               0 : ( multi_byte : Pchar );
+               1 : ( wide_char : PWideChar ); {wchar_t*}
+            end;
+     end;
+
+   PXIMPreeditState = ^TXIMPreeditState;
+   TXIMPreeditState = culong;
+
+const
+   XIMPreeditUnKnown = 0;
+   XIMPreeditEnable = 1;
+   XIMPreeditDisable = 1 shl 1;
+type
+
+   PXIMPreeditStateNotifyCallbackStruct = ^TXIMPreeditStateNotifyCallbackStruct;
+   TXIMPreeditStateNotifyCallbackStruct = record
+        state : TXIMPreeditState;
+     end;
+
+   PXIMResetState = ^TXIMResetState;
+   TXIMResetState = culong;
+
+const
+   XIMInitialState = 1;
+   XIMPreserveState = 1 shl 1;
+type
+
+   PXIMStringConversionFeedback = ^TXIMStringConversionFeedback;
+   TXIMStringConversionFeedback = culong;
+
+const
+   XIMStringConversionLeftEdge = $00000001;
+   XIMStringConversionRightEdge = $00000002;
+   XIMStringConversionTopEdge = $00000004;
+   XIMStringConversionBottomEdge = $00000008;
+   XIMStringConversionConcealed = $00000010;
+   XIMStringConversionWrapped = $00000020;
+type
+
+   PXIMStringConversionText = ^TXIMStringConversionText;
+   TXIMStringConversionText = record
+        length : cushort;
+        feedback : PXIMStringConversionFeedback;
+        encoding_is_wchar : TBool;
+        _string : record
+            case longint of
+               0 : ( mbs : Pchar );
+               1 : ( wcs : PWideChar ); {wchar_t*}
+            end;
+     end;
+
+   PXIMStringConversionPosition = ^TXIMStringConversionPosition;
+   TXIMStringConversionPosition = cushort;
+
+   PXIMStringConversionType = ^TXIMStringConversionType;
+   TXIMStringConversionType = cushort;
+
+const
+   XIMStringConversionBuffer = $0001;
+   XIMStringConversionLine = $0002;
+   XIMStringConversionWord = $0003;
+   XIMStringConversionChar = $0004;
+type
+
+   PXIMStringConversionOperation = ^TXIMStringConversionOperation;
+   TXIMStringConversionOperation = cushort;
+
+const
+   XIMStringConversionSubstitution = $0001;
+   XIMStringConversionRetrieval = $0002;
+type
+
+   PXIMCaretDirection = ^TXIMCaretDirection;
+   TXIMCaretDirection = (XIMForwardChar,XIMBackwardChar,XIMForwardWord,
+     XIMBackwardWord,XIMCaretUp,XIMCaretDown,
+     XIMNextLine,XIMPreviousLine,XIMLineStart,
+     XIMLineEnd,XIMAbsolutePosition,XIMDontChange
+     );
+
+   PXIMStringConversionCallbackStruct = ^TXIMStringConversionCallbackStruct;
+   TXIMStringConversionCallbackStruct = record
+        position : TXIMStringConversionPosition;
+        direction : TXIMCaretDirection;
+        operation : TXIMStringConversionOperation;
+        factor : cushort;
+        text : PXIMStringConversionText;
+     end;
+
+   PXIMPreeditDrawCallbackStruct = ^TXIMPreeditDrawCallbackStruct;
+   TXIMPreeditDrawCallbackStruct = record
+        caret : cint;
+        chg_first : cint;
+        chg_length : cint;
+        text : PXIMText;
+     end;
+
+   PXIMCaretStyle = ^TXIMCaretStyle;
+   TXIMCaretStyle = (XIMIsInvisible,XIMIsPrimary,XIMIsSecondary
+     );
+
+   PXIMPreeditCaretCallbackStruct = ^TXIMPreeditCaretCallbackStruct;
+   TXIMPreeditCaretCallbackStruct = record
+        position : cint;
+        direction : TXIMCaretDirection;
+        style : TXIMCaretStyle;
+     end;
+
+   PXIMStatusDataType = ^TXIMStatusDataType;
+   TXIMStatusDataType = (XIMTextType,XIMBitmapType);
+
+   PXIMStatusDrawCallbackStruct = ^TXIMStatusDrawCallbackStruct;
+   TXIMStatusDrawCallbackStruct = record
+        _type : TXIMStatusDataType;
+        data : record
+            case longint of
+               0 : ( text : PXIMText );
+               1 : ( bitmap : TPixmap );
+            end;
+     end;
+
+   PXIMHotKeyTrigger = ^TXIMHotKeyTrigger;
+   TXIMHotKeyTrigger = record
+        keysym : TKeySym;
+        modifier : cint;
+        modifier_mask : cint;
+     end;
+
+   PXIMHotKeyTriggers = ^TXIMHotKeyTriggers;
+   TXIMHotKeyTriggers = record
+        num_hot_key : cint;
+        key : PXIMHotKeyTrigger;
+     end;
+
+   PXIMHotKeyState = ^TXIMHotKeyState;
+   TXIMHotKeyState = culong;
+
+const
+   XIMHotKeyStateON = $0001;
+   XIMHotKeyStateOFF = $0002;
+type
+
+   PXIMValuesList = ^TXIMValuesList;
+   TXIMValuesList = record
+        count_values : cushort;
+        supported_values : PPChar;
+     end;
+{$ifndef os2}
+  var
+     _Xdebug : cint;cvar;external;
+{$endif}
+type
+  funcdisp = function(display:PDisplay):cint;cdecl;
+  funcifevent = function(display:PDisplay; event:PXEvent; p : TXPointer):TBool;cdecl;
+  chararr32 = array[0..31] of char;
+
+const
+  AllPlanes : culong = culong(not 0);
+
+function XLoadQueryFont(para1:PDisplay; para2:Pchar):PXFontStruct;cdecl;external libX11;
+function XQueryFont(para1:PDisplay; para2:TXID):PXFontStruct;cdecl;external libX11;
+function XGetMotionEvents(para1:PDisplay; para2:TWindow; para3:TTime; para4:TTime; para5:Pcint):PXTimeCoord;cdecl;external libX11;
+function XDeleteModifiermapEntry(para1:PXModifierKeymap; para2:TKeyCode; para3:cint):PXModifierKeymap;cdecl;external libX11;
+function XGetModifierMapping(para1:PDisplay):PXModifierKeymap;cdecl;external libX11;
+function XInsertModifiermapEntry(para1:PXModifierKeymap; para2:TKeyCode; para3:cint):PXModifierKeymap;cdecl;external libX11;
+function XNewModifiermap(para1:cint):PXModifierKeymap;cdecl;external libX11;
+function XCreateImage(para1:PDisplay; para2:PVisual; para3:cuint; para4:cint; para5:cint;
+           para6:Pchar; para7:cuint; para8:cuint; para9:cint; para10:cint):PXImage;cdecl;external libX11;
+function XInitImage(para1:PXImage):TStatus;cdecl;external libX11;
+function XGetImage(para1:PDisplay; para2:TDrawable; para3:cint; para4:cint; para5:cuint;
+           para6:cuint; para7:culong; para8:cint):PXImage;cdecl;external libX11;
+function XGetSubImage(para1:PDisplay; para2:TDrawable; para3:cint; para4:cint; para5:cuint;
+           para6:cuint; para7:culong; para8:cint; para9:PXImage; para10:cint;
+           para11:cint):PXImage;cdecl;external libX11;
+function XOpenDisplay(para1:Pchar):PDisplay;cdecl;external libX11;
+procedure XrmInitialize;cdecl;external libX11;
+function XFetchBytes(para1:PDisplay; para2:Pcint):Pchar;cdecl;external libX11;
+function XFetchBuffer(para1:PDisplay; para2:Pcint; para3:cint):Pchar;cdecl;external libX11;
+function XGetAtomName(para1:PDisplay; para2:TAtom):Pchar;cdecl;external libX11;
+function XGetAtomNames(para1:PDisplay; para2:PAtom; para3:cint; para4:PPchar):TStatus;cdecl;external libX11;
+function XGetDefault(para1:PDisplay; para2:Pchar; para3:Pchar):Pchar;cdecl;external libX11;
+function XDisplayName(para1:Pchar):Pchar;cdecl;external libX11;
+function XKeysymToString(para1:TKeySym):Pchar;cdecl;external libX11;
+function XSynchronize(para1:PDisplay; para2:TBool):funcdisp;cdecl;external libX11;
+function XSetAfterFunction(para1:PDisplay; para2:funcdisp):funcdisp;cdecl;external libX11;
+function XInternAtom(para1:PDisplay; para2:Pchar; para3:TBool):TAtom;cdecl;external libX11;
+function XInternAtoms(para1:PDisplay; para2:PPchar; para3:cint; para4:TBool; para5:PAtom):TStatus;cdecl;external libX11;
+function XCopyColormapAndFree(para1:PDisplay; para2:TColormap):TColormap;cdecl;external libX11;
+function XCreateColormap(para1:PDisplay; para2:TWindow; para3:PVisual; para4:cint):TColormap;cdecl;external libX11;
+function XCreatePixmapCursor(para1:PDisplay; para2:TPixmap; para3:TPixmap; para4:PXColor; para5:PXColor;
+           para6:cuint; para7:cuint):TCursor;cdecl;external libX11;
+function XCreateGlyphCursor(para1:PDisplay; para2:TFont; para3:TFont; para4:cuint; para5:cuint;
+           para6:PXColor; para7:PXColor):TCursor;cdecl;external libX11;
+function XCreateFontCursor(para1:PDisplay; para2:cuint):TCursor;cdecl;external libX11;
+function XLoadFont(para1:PDisplay; para2:Pchar):TFont;cdecl;external libX11;
+function XCreateGC(para1:PDisplay; para2:TDrawable; para3:culong; para4:PXGCValues):TGC;cdecl;external libX11;
+function XGContextFromGC(para1:TGC):TGContext;cdecl;external libX11;
+procedure XFlushGC(para1:PDisplay; para2:TGC);cdecl;external libX11;
+function XCreatePixmap(para1:PDisplay; para2:TDrawable; para3:cuint; para4:cuint; para5:cuint):TPixmap;cdecl;external libX11;
+function XCreateBitmapFromData(para1:PDisplay; para2:TDrawable; para3:Pchar; para4:cuint; para5:cuint):TPixmap;cdecl;external libX11;
+function XCreatePixmapFromBitmapData(para1:PDisplay; para2:TDrawable; para3:Pchar; para4:cuint; para5:cuint;
+           para6:culong; para7:culong; para8:cuint):TPixmap;cdecl;external libX11;
+function XCreateSimpleWindow(para1:PDisplay; para2:TWindow; para3:cint; para4:cint; para5:cuint;
+           para6:cuint; para7:cuint; para8:culong; para9:culong):TWindow;cdecl;external libX11;
+function XGetSelectionOwner(para1:PDisplay; para2:TAtom):TWindow;cdecl;external libX11;
+function XCreateWindow(para1:PDisplay; para2:TWindow; para3:cint; para4:cint; para5:cuint;
+           para6:cuint; para7:cuint; para8:cint; para9:cuint; para10:PVisual;
+           para11:culong; para12:PXSetWindowAttributes):TWindow;cdecl;external libX11;
+function XListInstalledColormaps(para1:PDisplay; para2:TWindow; para3:Pcint):PColormap;cdecl;external libX11;
+function XListFonts(para1:PDisplay; para2:Pchar; para3:cint; para4:Pcint):PPChar;cdecl;external libX11;
+function XListFontsWithInfo(para1:PDisplay; para2:Pchar; para3:cint; para4:Pcint; para5:PPXFontStruct):PPChar;cdecl;external libX11;
+function XGetFontPath(para1:PDisplay; para2:Pcint):PPChar;cdecl;external libX11;
+function XListExtensions(para1:PDisplay; para2:Pcint):PPChar;cdecl;external libX11;
+function XListProperties(para1:PDisplay; para2:TWindow; para3:Pcint):PAtom;cdecl;external libX11;
+function XListHosts(para1:PDisplay; para2:Pcint; para3:PBool):PXHostAddress;cdecl;external libX11;
+function XKeycodeToKeysym(para1:PDisplay; para2:TKeyCode; para3:cint):TKeySym;cdecl;external libX11;
+function XLookupKeysym(para1:PXKeyEvent; para2:cint):TKeySym;cdecl;external libX11;
+function XGetKeyboardMapping(para1:PDisplay; para2:TKeyCode; para3:cint; para4:Pcint):PKeySym;cdecl;external libX11;
+function XStringToKeysym(para1:Pchar):TKeySym;cdecl;external libX11;
+function XMaxRequestSize(para1:PDisplay):clong;cdecl;external libX11;
+function XExtendedMaxRequestSize(para1:PDisplay):clong;cdecl;external libX11;
+function XResourceManagerString(para1:PDisplay):Pchar;cdecl;external libX11;
+function XScreenResourceString(para1:PScreen):Pchar;cdecl;external libX11;
+function XDisplayMotionBufferSize(para1:PDisplay):culong;cdecl;external libX11;
+function XVisualIDFromVisual(para1:PVisual):TVisualID;cdecl;external libX11;
+function XInitThreads:TStatus;cdecl;external libX11;
+procedure XLockDisplay(para1:PDisplay);cdecl;external libX11;
+procedure XUnlockDisplay(para1:PDisplay);cdecl;external libX11;
+function XInitExtension(para1:PDisplay; para2:Pchar):PXExtCodes;cdecl;external libX11;
+function XAddExtension(para1:PDisplay):PXExtCodes;cdecl;external libX11;
+function XFindOnExtensionList(para1:PPXExtData; para2:cint):PXExtData;cdecl;external libX11;
+function XEHeadOfExtensionList(para1:TXEDataObject):PPXExtData;cdecl;external libX11;
+function XRootWindow(para1:PDisplay; para2:cint):TWindow;cdecl;external libX11;
+function XDefaultRootWindow(para1:PDisplay):TWindow;cdecl;external libX11;
+function XRootWindowOfScreen(para1:PScreen):TWindow;cdecl;external libX11;
+function XDefaultVisual(para1:PDisplay; para2:cint):PVisual;cdecl;external libX11;
+function XDefaultVisualOfScreen(para1:PScreen):PVisual;cdecl;external libX11;
+function XDefaultGC(para1:PDisplay; para2:cint):TGC;cdecl;external libX11;
+function XDefaultGCOfScreen(para1:PScreen):TGC;cdecl;external libX11;
+function XBlackPixel(para1:PDisplay; para2:cint):culong;cdecl;external libX11;
+function XWhitePixel(para1:PDisplay; para2:cint):culong;cdecl;external libX11;
+function XAllPlanes:culong;cdecl;external libX11;
+function XBlackPixelOfScreen(para1:PScreen):culong;cdecl;external libX11;
+function XWhitePixelOfScreen(para1:PScreen):culong;cdecl;external libX11;
+function XNextRequest(para1:PDisplay):culong;cdecl;external libX11;
+function XLastKnownRequestProcessed(para1:PDisplay):culong;cdecl;external libX11;
+function XServerVendor(para1:PDisplay):Pchar;cdecl;external libX11;
+function XDisplayString(para1:PDisplay):Pchar;cdecl;external libX11;
+function XDefaultColormap(para1:PDisplay; para2:cint):TColormap;cdecl;external libX11;
+function XDefaultColormapOfScreen(para1:PScreen):TColormap;cdecl;external libX11;
+function XDisplayOfScreen(para1:PScreen):PDisplay;cdecl;external libX11;
+function XScreenOfDisplay(para1:PDisplay; para2:cint):PScreen;cdecl;external libX11;
+function XDefaultScreenOfDisplay(para1:PDisplay):PScreen;cdecl;external libX11;
+function XEventMaskOfScreen(para1:PScreen):clong;cdecl;external libX11;
+function XScreenNumberOfScreen(para1:PScreen):cint;cdecl;external libX11;
+type
+
+   TXErrorHandler = function (para1:PDisplay; para2:PXErrorEvent):cint;cdecl;
+
+function XSetErrorHandler(para1:TXErrorHandler):TXErrorHandler;cdecl;external libX11;
+type
+
+   TXIOErrorHandler = function (para1:PDisplay):cint;cdecl;
+
+function XSetIOErrorHandler(para1:TXIOErrorHandler):TXIOErrorHandler;cdecl;external libX11;
+function XListPixmapFormats(para1:PDisplay; para2:Pcint):PXPixmapFormatValues;cdecl;external libX11;
+function XListDepths(para1:PDisplay; para2:cint; para3:Pcint):Pcint;cdecl;external libX11;
+function XReconfigureWMWindow(para1:PDisplay; para2:TWindow; para3:cint; para4:cuint; para5:PXWindowChanges):TStatus;cdecl;external libX11;
+function XGetWMProtocols(para1:PDisplay; para2:TWindow; para3:PPAtom; para4:Pcint):TStatus;cdecl;external libX11;
+function XSetWMProtocols(para1:PDisplay; para2:TWindow; para3:PAtom; para4:cint):TStatus;cdecl;external libX11;
+function XIconifyWindow(para1:PDisplay; para2:TWindow; para3:cint):TStatus;cdecl;external libX11;
+function XWithdrawWindow(para1:PDisplay; para2:TWindow; para3:cint):TStatus;cdecl;external libX11;
+function XGetCommand(para1:PDisplay; para2:TWindow; para3:PPPchar; para4:Pcint):TStatus;cdecl;external libX11;
+function XGetWMColormapWindows(para1:PDisplay; para2:TWindow; para3:PPWindow; para4:Pcint):TStatus;cdecl;external libX11;
+function XSetWMColormapWindows(para1:PDisplay; para2:TWindow; para3:PWindow; para4:cint):TStatus;cdecl;external libX11;
+procedure XFreeStringList(para1:PPchar);cdecl;external libX11;
+function XSetTransientForHint(para1:PDisplay; para2:TWindow; para3:TWindow):cint;cdecl;external libX11;
+function XActivateScreenSaver(para1:PDisplay):cint;cdecl;external libX11;
+function XAddHost(para1:PDisplay; para2:PXHostAddress):cint;cdecl;external libX11;
+function XAddHosts(para1:PDisplay; para2:PXHostAddress; para3:cint):cint;cdecl;external libX11;
+function XAddToExtensionList(para1:PPXExtData; para2:PXExtData):cint;cdecl;external libX11;
+function XAddToSaveSet(para1:PDisplay; para2:TWindow):cint;cdecl;external libX11;
+function XAllocColor(para1:PDisplay; para2:TColormap; para3:PXColor):TStatus;cdecl;external libX11;
+function XAllocColorCells(para1:PDisplay; para2:TColormap; para3:TBool; para4:Pculong; para5:cuint;
+           para6:Pculong; para7:cuint):TStatus;cdecl;external libX11;
+function XAllocColorPlanes(para1:PDisplay; para2:TColormap; para3:TBool; para4:Pculong; para5:cint;
+           para6:cint; para7:cint; para8:cint; para9:Pculong; para10:Pculong;
+           para11:Pculong):TStatus;cdecl;external libX11;
+function XAllocNamedColor(para1:PDisplay; para2:TColormap; para3:Pchar; para4:PXColor; para5:PXColor):TStatus;cdecl;external libX11;
+function XAllowEvents(para1:PDisplay; para2:cint; para3:TTime):cint;cdecl;external libX11;
+function XAutoRepeatOff(para1:PDisplay):cint;cdecl;external libX11;
+function XAutoRepeatOn(para1:PDisplay):cint;cdecl;external libX11;
+function XBell(para1:PDisplay; para2:cint):cint;cdecl;external libX11;
+function XBitmapBitOrder(para1:PDisplay):cint;cdecl;external libX11;
+function XBitmapPad(para1:PDisplay):cint;cdecl;external libX11;
+function XBitmapUnit(para1:PDisplay):cint;cdecl;external libX11;
+function XCellsOfScreen(para1:PScreen):cint;cdecl;external libX11;
+function XChangeActivePointerGrab(para1:PDisplay; para2:cuint; para3:TCursor; para4:TTime):cint;cdecl;external libX11;
+function XChangeGC(para1:PDisplay; para2:TGC; para3:culong; para4:PXGCValues):cint;cdecl;external libX11;
+function XChangeKeyboardControl(para1:PDisplay; para2:culong; para3:PXKeyboardControl):cint;cdecl;external libX11;
+function XChangeKeyboardMapping(para1:PDisplay; para2:cint; para3:cint; para4:PKeySym; para5:cint):cint;cdecl;external libX11;
+function XChangePointerControl(para1:PDisplay; para2:TBool; para3:TBool; para4:cint; para5:cint;
+           para6:cint):cint;cdecl;external libX11;
+function XChangeProperty(para1:PDisplay; para2:TWindow; para3:TAtom; para4:TAtom; para5:cint;
+           para6:cint; para7:Pcuchar; para8:cint):cint;cdecl;external libX11;
+function XChangeSaveSet(para1:PDisplay; para2:TWindow; para3:cint):cint;cdecl;external libX11;
+function XChangeWindowAttributes(para1:PDisplay; para2:TWindow; para3:culong; para4:PXSetWindowAttributes):cint;cdecl;external libX11;
+function XCheckIfEvent(para1:PDisplay; para2:PXEvent; para3:funcifevent; para4:TXPointer):TBool;cdecl;external libX11;
+function XCheckMaskEvent(para1:PDisplay; para2:clong; para3:PXEvent):TBool;cdecl;external libX11;
+function XCheckTypedEvent(para1:PDisplay; para2:cint; para3:PXEvent):TBool;cdecl;external libX11;
+function XCheckTypedWindowEvent(para1:PDisplay; para2:TWindow; para3:cint; para4:PXEvent):TBool;cdecl;external libX11;
+function XCheckWindowEvent(para1:PDisplay; para2:TWindow; para3:clong; para4:PXEvent):TBool;cdecl;external libX11;
+function XCirculateSubwindows(para1:PDisplay; para2:TWindow; para3:cint):cint;cdecl;external libX11;
+function XCirculateSubwindowsDown(para1:PDisplay; para2:TWindow):cint;cdecl;external libX11;
+function XCirculateSubwindowsUp(para1:PDisplay; para2:TWindow):cint;cdecl;external libX11;
+function XClearArea(para1:PDisplay; para2:TWindow; para3:cint; para4:cint; para5:cuint;
+           para6:cuint; para7:TBool):cint;cdecl;external libX11;
+function XClearWindow(para1:PDisplay; para2:TWindow):cint;cdecl;external libX11;
+function XCloseDisplay(para1:PDisplay):cint;cdecl;external libX11;
+function XConfigureWindow(para1:PDisplay; para2:TWindow; para3:cuint; para4:PXWindowChanges):cint;cdecl;external libX11;
+function XConnectionNumber(para1:PDisplay):cint;cdecl;external libX11;
+function XConvertSelection(para1:PDisplay; para2:TAtom; para3:TAtom; para4:TAtom; para5:TWindow;
+           para6:TTime):cint;cdecl;external libX11;
+function XCopyArea(para1:PDisplay; para2:TDrawable; para3:TDrawable; para4:TGC; para5:cint;
+           para6:cint; para7:cuint; para8:cuint; para9:cint; para10:cint):cint;cdecl;external libX11;
+function XCopyGC(para1:PDisplay; para2:TGC; para3:culong; para4:TGC):cint;cdecl;external libX11;
+function XCopyPlane(para1:PDisplay; para2:TDrawable; para3:TDrawable; para4:TGC; para5:cint;
+           para6:cint; para7:cuint; para8:cuint; para9:cint; para10:cint;
+           para11:culong):cint;cdecl;external libX11;
+function XDefaultDepth(para1:PDisplay; para2:cint):cint;cdecl;external libX11;
+function XDefaultDepthOfScreen(para1:PScreen):cint;cdecl;external libX11;
+function XDefaultScreen(para1:PDisplay):cint;cdecl;external libX11;
+function XDefineCursor(para1:PDisplay; para2:TWindow; para3:TCursor):cint;cdecl;external libX11;
+function XDeleteProperty(para1:PDisplay; para2:TWindow; para3:TAtom):cint;cdecl;external libX11;
+function XDestroyWindow(para1:PDisplay; para2:TWindow):cint;cdecl;external libX11;
+function XDestroySubwindows(para1:PDisplay; para2:TWindow):cint;cdecl;external libX11;
+function XDoesBackingStore(para1:PScreen):cint;cdecl;external libX11;
+function XDoesSaveUnders(para1:PScreen):TBool;cdecl;external libX11;
+function XDisableAccessControl(para1:PDisplay):cint;cdecl;external libX11;
+function XDisplayCells(para1:PDisplay; para2:cint):cint;cdecl;external libX11;
+function XDisplayHeight(para1:PDisplay; para2:cint):cint;cdecl;external libX11;
+function XDisplayHeightMM(para1:PDisplay; para2:cint):cint;cdecl;external libX11;
+function XDisplayKeycodes(para1:PDisplay; para2:Pcint; para3:Pcint):cint;cdecl;external libX11;
+function XDisplayPlanes(para1:PDisplay; para2:cint):cint;cdecl;external libX11;
+function XDisplayWidth(para1:PDisplay; para2:cint):cint;cdecl;external libX11;
+function XDisplayWidthMM(para1:PDisplay; para2:cint):cint;cdecl;external libX11;
+function XDrawArc(para1:PDisplay; para2:TDrawable; para3:TGC; para4:cint; para5:cint;
+           para6:cuint; para7:cuint; para8:cint; para9:cint):cint;cdecl;external libX11;
+function XDrawArcs(para1:PDisplay; para2:TDrawable; para3:TGC; para4:PXArc; para5:cint):cint;cdecl;external libX11;
+function XDrawImageString(para1:PDisplay; para2:TDrawable; para3:TGC; para4:cint; para5:cint;
+           para6:Pchar; para7:cint):cint;cdecl;external libX11;
+function XDrawImageString16(para1:PDisplay; para2:TDrawable; para3:TGC; para4:cint; para5:cint;
+           para6:PXChar2b; para7:cint):cint;cdecl;external libX11;
+function XDrawLine(para1:PDisplay; para2:TDrawable; para3:TGC; para4:cint; para5:cint;
+           para6:cint; para7:cint):cint;cdecl;external libX11;
+function XDrawLines(para1:PDisplay; para2:TDrawable; para3:TGC; para4:PXPoint; para5:cint;
+           para6:cint):cint;cdecl;external libX11;
+function XDrawPoint(para1:PDisplay; para2:TDrawable; para3:TGC; para4:cint; para5:cint):cint;cdecl;external libX11;
+function XDrawPoints(para1:PDisplay; para2:TDrawable; para3:TGC; para4:PXPoint; para5:cint;
+           para6:cint):cint;cdecl;external libX11;
+function XDrawRectangle(para1:PDisplay; para2:TDrawable; para3:TGC; para4:cint; para5:cint;
+           para6:cuint; para7:cuint):cint;cdecl;external libX11;
+function XDrawRectangles(para1:PDisplay; para2:TDrawable; para3:TGC; para4:PXRectangle; para5:cint):cint;cdecl;external libX11;
+function XDrawSegments(para1:PDisplay; para2:TDrawable; para3:TGC; para4:PXSegment; para5:cint):cint;cdecl;external libX11;
+function XDrawString(para1:PDisplay; para2:TDrawable; para3:TGC; para4:cint; para5:cint;
+           para6:Pchar; para7:cint):cint;cdecl;external libX11;
+function XDrawString16(para1:PDisplay; para2:TDrawable; para3:TGC; para4:cint; para5:cint;
+           para6:PXChar2b; para7:cint):cint;cdecl;external libX11;
+function XDrawText(para1:PDisplay; para2:TDrawable; para3:TGC; para4:cint; para5:cint;
+           para6:PXTextItem; para7:cint):cint;cdecl;external libX11;
+function XDrawText16(para1:PDisplay; para2:TDrawable; para3:TGC; para4:cint; para5:cint;
+           para6:PXTextItem16; para7:cint):cint;cdecl;external libX11;
+function XEnableAccessControl(para1:PDisplay):cint;cdecl;external libX11;
+function XEventsQueued(para1:PDisplay; para2:cint):cint;cdecl;external libX11;
+function XFetchName(para1:PDisplay; para2:TWindow; para3:PPchar):TStatus;cdecl;external libX11;
+function XFillArc(para1:PDisplay; para2:TDrawable; para3:TGC; para4:cint; para5:cint;
+           para6:cuint; para7:cuint; para8:cint; para9:cint):cint;cdecl;external libX11;
+function XFillArcs(para1:PDisplay; para2:TDrawable; para3:TGC; para4:PXArc; para5:cint):cint;cdecl;external libX11;
+function XFillPolygon(para1:PDisplay; para2:TDrawable; para3:TGC; para4:PXPoint; para5:cint;
+           para6:cint; para7:cint):cint;cdecl;external libX11;
+function XFillRectangle(para1:PDisplay; para2:TDrawable; para3:TGC; para4:cint; para5:cint;
+           para6:cuint; para7:cuint):cint;cdecl;external libX11;
+function XFillRectangles(para1:PDisplay; para2:TDrawable; para3:TGC; para4:PXRectangle; para5:cint):cint;cdecl;external libX11;
+function XFlush(para1:PDisplay):cint;cdecl;external libX11;
+function XForceScreenSaver(para1:PDisplay; para2:cint):cint;cdecl;external libX11;
+function XFree(para1:pointer):cint;cdecl;external libX11;
+function XFreeColormap(para1:PDisplay; para2:TColormap):cint;cdecl;external libX11;
+function XFreeColors(para1:PDisplay; para2:TColormap; para3:Pculong; para4:cint; para5:culong):cint;cdecl;external libX11;
+function XFreeCursor(para1:PDisplay; para2:TCursor):cint;cdecl;external libX11;
+function XFreeExtensionList(para1:PPchar):cint;cdecl;external libX11;
+function XFreeFont(para1:PDisplay; para2:PXFontStruct):cint;cdecl;external libX11;
+function XFreeFontInfo(para1:PPchar; para2:PXFontStruct; para3:cint):cint;cdecl;external libX11;
+function XFreeFontNames(para1:PPchar):cint;cdecl;external libX11;
+function XFreeFontPath(para1:PPchar):cint;cdecl;external libX11;
+function XFreeGC(para1:PDisplay; para2:TGC):cint;cdecl;external libX11;
+function XFreeModifiermap(para1:PXModifierKeymap):cint;cdecl;external libX11;
+function XFreePixmap(para1:PDisplay; para2:TPixmap):cint;cdecl;external libX11;
+function XGeometry(para1:PDisplay; para2:cint; para3:Pchar; para4:Pchar; para5:cuint;
+           para6:cuint; para7:cuint; para8:cint; para9:cint; para10:Pcint;
+           para11:Pcint; para12:Pcint; para13:Pcint):cint;cdecl;external libX11;
+function XGetErrorDatabaseText(para1:PDisplay; para2:Pchar; para3:Pchar; para4:Pchar; para5:Pchar;
+           para6:cint):cint;cdecl;external libX11;
+function XGetErrorText(para1:PDisplay; para2:cint; para3:Pchar; para4:cint):cint;cdecl;external libX11;
+function XGetFontProperty(para1:PXFontStruct; para2:TAtom; para3:Pculong):TBool;cdecl;external libX11;
+function XGetGCValues(para1:PDisplay; para2:TGC; para3:culong; para4:PXGCValues):TStatus;cdecl;external libX11;
+function XGetGeometry(para1:PDisplay; para2:TDrawable; para3:PWindow; para4:Pcint; para5:Pcint;
+           para6:Pcuint; para7:Pcuint; para8:Pcuint; para9:Pcuint):TStatus;cdecl;external libX11;
+function XGetIconName(para1:PDisplay; para2:TWindow; para3:PPchar):TStatus;cdecl;external libX11;
+function XGetInputFocus(para1:PDisplay; para2:PWindow; para3:Pcint):cint;cdecl;external libX11;
+function XGetKeyboardControl(para1:PDisplay; para2:PXKeyboardState):cint;cdecl;external libX11;
+function XGetPointerControl(para1:PDisplay; para2:Pcint; para3:Pcint; para4:Pcint):cint;cdecl;external libX11;
+function XGetPointerMapping(para1:PDisplay; para2:Pcuchar; para3:cint):cint;cdecl;external libX11;
+function XGetScreenSaver(para1:PDisplay; para2:Pcint; para3:Pcint; para4:Pcint; para5:Pcint):cint;cdecl;external libX11;
+function XGetTransientForHint(para1:PDisplay; para2:TWindow; para3:PWindow):TStatus;cdecl;external libX11;
+function XGetWindowProperty(para1:PDisplay; para2:TWindow; para3:TAtom; para4:clong; para5:clong;
+           para6:TBool; para7:TAtom; para8:PAtom; para9:Pcint; para10:Pculong;
+           para11:Pculong; para12:PPcuchar):cint;cdecl;external libX11;
+function XGetWindowAttributes(para1:PDisplay; para2:TWindow; para3:PXWindowAttributes):TStatus;cdecl;external libX11;
+function XGrabButton(para1:PDisplay; para2:cuint; para3:cuint; para4:TWindow; para5:TBool;
+           para6:cuint; para7:cint; para8:cint; para9:TWindow; para10:TCursor):cint;cdecl;external libX11;
+function XGrabKey(para1:PDisplay; para2:cint; para3:cuint; para4:TWindow; para5:TBool;
+           para6:cint; para7:cint):cint;cdecl;external libX11;
+function XGrabKeyboard(para1:PDisplay; para2:TWindow; para3:TBool; para4:cint; para5:cint;
+           para6:TTime):cint;cdecl;external libX11;
+function XGrabPointer(para1:PDisplay; para2:TWindow; para3:TBool; para4:cuint; para5:cint;
+           para6:cint; para7:TWindow; para8:TCursor; para9:TTime):cint;cdecl;external libX11;
+function XGrabServer(para1:PDisplay):cint;cdecl;external libX11;
+function XHeightMMOfScreen(para1:PScreen):cint;cdecl;external libX11;
+function XHeightOfScreen(para1:PScreen):cint;cdecl;external libX11;
+function XIfEvent(para1:PDisplay; para2:PXEvent; para3:funcifevent; para4:TXPointer):cint;cdecl;external libX11;
+function XImageByteOrder(para1:PDisplay):cint;cdecl;external libX11;
+function XInstallColormap(para1:PDisplay; para2:TColormap):cint;cdecl;external libX11;
+function XKeysymToKeycode(para1:PDisplay; para2:TKeySym):TKeyCode;cdecl;external libX11;
+function XKillClient(para1:PDisplay; para2:TXID):cint;cdecl;external libX11;
+function XLookupColor(para1:PDisplay; para2:TColormap; para3:Pchar; para4:PXColor; para5:PXColor):TStatus;cdecl;external libX11;
+function XLowerWindow(para1:PDisplay; para2:TWindow):cint;cdecl;external libX11;
+function XMapRaised(para1:PDisplay; para2:TWindow):cint;cdecl;external libX11;
+function XMapSubwindows(para1:PDisplay; para2:TWindow):cint;cdecl;external libX11;
+function XMapWindow(para1:PDisplay; para2:TWindow):cint;cdecl;external libX11;
+function XMaskEvent(para1:PDisplay; para2:clong; para3:PXEvent):cint;cdecl;external libX11;
+function XMaxCmapsOfScreen(para1:PScreen):cint;cdecl;external libX11;
+function XMinCmapsOfScreen(para1:PScreen):cint;cdecl;external libX11;
+function XMoveResizeWindow(para1:PDisplay; para2:TWindow; para3:cint; para4:cint; para5:cuint;
+           para6:cuint):cint;cdecl;external libX11;
+function XMoveWindow(para1:PDisplay; para2:TWindow; para3:cint; para4:cint):cint;cdecl;external libX11;
+function XNextEvent(para1:PDisplay; para2:PXEvent):cint;cdecl;external libX11;
+function XNoOp(para1:PDisplay):cint;cdecl;external libX11;
+function XParseColor(para1:PDisplay; para2:TColormap; para3:Pchar; para4:PXColor):TStatus;cdecl;external libX11;
+function XParseGeometry(para1:Pchar; para2:Pcint; para3:Pcint; para4:Pcuint; para5:Pcuint):cint;cdecl;external libX11;
+function XPeekEvent(para1:PDisplay; para2:PXEvent):cint;cdecl;external libX11;
+function XPeekIfEvent(para1:PDisplay; para2:PXEvent; para3:funcifevent; para4:TXPointer):cint;cdecl;external libX11;
+function XPending(para1:PDisplay):cint;cdecl;external libX11;
+function XPlanesOfScreen(para1:PScreen):cint;cdecl;external libX11;
+function XProtocolRevision(para1:PDisplay):cint;cdecl;external libX11;
+function XProtocolVersion(para1:PDisplay):cint;cdecl;external libX11;
+function XPutBackEvent(para1:PDisplay; para2:PXEvent):cint;cdecl;external libX11;
+function XPutImage(para1:PDisplay; para2:TDrawable; para3:TGC; para4:PXImage; para5:cint;
+           para6:cint; para7:cint; para8:cint; para9:cuint; para10:cuint):cint;cdecl;external libX11;
+function XQLength(para1:PDisplay):cint;cdecl;external libX11;
+function XQueryBestCursor(para1:PDisplay; para2:TDrawable; para3:cuint; para4:cuint; para5:Pcuint;
+           para6:Pcuint):TStatus;cdecl;external libX11;
+function XQueryBestSize(para1:PDisplay; para2:cint; para3:TDrawable; para4:cuint; para5:cuint;
+           para6:Pcuint; para7:Pcuint):TStatus;cdecl;external libX11;
+function XQueryBestStipple(para1:PDisplay; para2:TDrawable; para3:cuint; para4:cuint; para5:Pcuint;
+           para6:Pcuint):TStatus;cdecl;external libX11;
+function XQueryBestTile(para1:PDisplay; para2:TDrawable; para3:cuint; para4:cuint; para5:Pcuint;
+           para6:Pcuint):TStatus;cdecl;external libX11;
+function XQueryColor(para1:PDisplay; para2:TColormap; para3:PXColor):cint;cdecl;external libX11;
+function XQueryColors(para1:PDisplay; para2:TColormap; para3:PXColor; para4:cint):cint;cdecl;external libX11;
+function XQueryExtension(para1:PDisplay; para2:Pchar; para3:Pcint; para4:Pcint; para5:Pcint):TBool;cdecl;external libX11;
+{?}
+function XQueryKeymap(para1:PDisplay; para2:chararr32):cint;cdecl;external libX11;
+function XQueryPointer(para1:PDisplay; para2:TWindow; para3:PWindow; para4:PWindow; para5:Pcint;
+           para6:Pcint; para7:Pcint; para8:Pcint; para9:Pcuint):TBool;cdecl;external libX11;
+function XQueryTextExtents(para1:PDisplay; para2:TXID; para3:Pchar; para4:cint; para5:Pcint;
+           para6:Pcint; para7:Pcint; para8:PXCharStruct):cint;cdecl;external libX11;
+function XQueryTextExtents16(para1:PDisplay; para2:TXID; para3:PXChar2b; para4:cint; para5:Pcint;
+           para6:Pcint; para7:Pcint; para8:PXCharStruct):cint;cdecl;external libX11;
+function XQueryTree(para1:PDisplay; para2:TWindow; para3:PWindow; para4:PWindow; para5:PPWindow;
+           para6:Pcuint):TStatus;cdecl;external libX11;
+function XRaiseWindow(para1:PDisplay; para2:TWindow):cint;cdecl;external libX11;
+function XReadBitmapFile(para1:PDisplay; para2:TDrawable; para3:Pchar; para4:Pcuint; para5:Pcuint;
+           para6:PPixmap; para7:Pcint; para8:Pcint):cint;cdecl;external libX11;
+function XReadBitmapFileData(para1:Pchar; para2:Pcuint; para3:Pcuint; para4:PPcuchar; para5:Pcint;
+           para6:Pcint):cint;cdecl;external libX11;
+function XRebindKeysym(para1:PDisplay; para2:TKeySym; para3:PKeySym; para4:cint; para5:Pcuchar;
+           para6:cint):cint;cdecl;external libX11;
+function XRecolorCursor(para1:PDisplay; para2:TCursor; para3:PXColor; para4:PXColor):cint;cdecl;external libX11;
+function XRefreshKeyboardMapping(para1:PXMappingEvent):cint;cdecl;external libX11;
+function XRemoveFromSaveSet(para1:PDisplay; para2:TWindow):cint;cdecl;external libX11;
+function XRemoveHost(para1:PDisplay; para2:PXHostAddress):cint;cdecl;external libX11;
+function XRemoveHosts(para1:PDisplay; para2:PXHostAddress; para3:cint):cint;cdecl;external libX11;
+function XReparentWindow(para1:PDisplay; para2:TWindow; para3:TWindow; para4:cint; para5:cint):cint;cdecl;external libX11;
+function XResetScreenSaver(para1:PDisplay):cint;cdecl;external libX11;
+function XResizeWindow(para1:PDisplay; para2:TWindow; para3:cuint; para4:cuint):cint;cdecl;external libX11;
+function XRestackWindows(para1:PDisplay; para2:PWindow; para3:cint):cint;cdecl;external libX11;
+function XRotateBuffers(para1:PDisplay; para2:cint):cint;cdecl;external libX11;
+function XRotateWindowProperties(para1:PDisplay; para2:TWindow; para3:PAtom; para4:cint; para5:cint):cint;cdecl;external libX11;
+function XScreenCount(para1:PDisplay):cint;cdecl;external libX11;
+function XSelectInput(para1:PDisplay; para2:TWindow; para3:clong):cint;cdecl;external libX11;
+function XSendEvent(para1:PDisplay; para2:TWindow; para3:TBool; para4:clong; para5:PXEvent):TStatus;cdecl;external libX11;
+function XSetAccessControl(para1:PDisplay; para2:cint):cint;cdecl;external libX11;
+function XSetArcMode(para1:PDisplay; para2:TGC; para3:cint):cint;cdecl;external libX11;
+function XSetBackground(para1:PDisplay; para2:TGC; para3:culong):cint;cdecl;external libX11;
+function XSetClipMask(para1:PDisplay; para2:TGC; para3:TPixmap):cint;cdecl;external libX11;
+function XSetClipOrigin(para1:PDisplay; para2:TGC; para3:cint; para4:cint):cint;cdecl;external libX11;
+function XSetClipRectangles(para1:PDisplay; para2:TGC; para3:cint; para4:cint; para5:PXRectangle;
+           para6:cint; para7:cint):cint;cdecl;external libX11;
+function XSetCloseDownMode(para1:PDisplay; para2:cint):cint;cdecl;external libX11;
+function XSetCommand(para1:PDisplay; para2:TWindow; para3:PPchar; para4:cint):cint;cdecl;external libX11;
+function XSetDashes(para1:PDisplay; para2:TGC; para3:cint; para4:Pchar; para5:cint):cint;cdecl;external libX11;
+function XSetFillRule(para1:PDisplay; para2:TGC; para3:cint):cint;cdecl;external libX11;
+function XSetFillStyle(para1:PDisplay; para2:TGC; para3:cint):cint;cdecl;external libX11;
+function XSetFont(para1:PDisplay; para2:TGC; para3:TFont):cint;cdecl;external libX11;
+function XSetFontPath(para1:PDisplay; para2:PPchar; para3:cint):cint;cdecl;external libX11;
+function XSetForeground(para1:PDisplay; para2:TGC; para3:culong):cint;cdecl;external libX11;
+function XSetFunction(para1:PDisplay; para2:TGC; para3:cint):cint;cdecl;external libX11;
+function XSetGraphicsExposures(para1:PDisplay; para2:TGC; para3:TBool):cint;cdecl;external libX11;
+function XSetIconName(para1:PDisplay; para2:TWindow; para3:Pchar):cint;cdecl;external libX11;
+function XSetInputFocus(para1:PDisplay; para2:TWindow; para3:cint; para4:TTime):cint;cdecl;external libX11;
+function XSetLineAttributes(para1:PDisplay; para2:TGC; para3:cuint; para4:cint; para5:cint;
+           para6:cint):cint;cdecl;external libX11;
+function XSetModifierMapping(para1:PDisplay; para2:PXModifierKeymap):cint;cdecl;external libX11;
+function XSetPlaneMask(para1:PDisplay; para2:TGC; para3:culong):cint;cdecl;external libX11;
+function XSetPointerMapping(para1:PDisplay; para2:Pcuchar; para3:cint):cint;cdecl;external libX11;
+function XSetScreenSaver(para1:PDisplay; para2:cint; para3:cint; para4:cint; para5:cint):cint;cdecl;external libX11;
+function XSetSelectionOwner(para1:PDisplay; para2:TAtom; para3:TWindow; para4:TTime):cint;cdecl;external libX11;
+function XSetState(para1:PDisplay; para2:TGC; para3:culong; para4:culong; para5:cint;
+           para6:culong):cint;cdecl;external libX11;
+function XSetStipple(para1:PDisplay; para2:TGC; para3:TPixmap):cint;cdecl;external libX11;
+function XSetSubwindowMode(para1:PDisplay; para2:TGC; para3:cint):cint;cdecl;external libX11;
+function XSetTSOrigin(para1:PDisplay; para2:TGC; para3:cint; para4:cint):cint;cdecl;external libX11;
+function XSetTile(para1:PDisplay; para2:TGC; para3:TPixmap):cint;cdecl;external libX11;
+function XSetWindowBackground(para1:PDisplay; para2:TWindow; para3:culong):cint;cdecl;external libX11;
+function XSetWindowBackgroundPixmap(para1:PDisplay; para2:TWindow; para3:TPixmap):cint;cdecl;external libX11;
+function XSetWindowBorder(para1:PDisplay; para2:TWindow; para3:culong):cint;cdecl;external libX11;
+function XSetWindowBorderPixmap(para1:PDisplay; para2:TWindow; para3:TPixmap):cint;cdecl;external libX11;
+function XSetWindowBorderWidth(para1:PDisplay; para2:TWindow; para3:cuint):cint;cdecl;external libX11;
+function XSetWindowColormap(para1:PDisplay; para2:TWindow; para3:TColormap):cint;cdecl;external libX11;
+function XStoreBuffer(para1:PDisplay; para2:Pchar; para3:cint; para4:cint):cint;cdecl;external libX11;
+function XStoreBytes(para1:PDisplay; para2:Pchar; para3:cint):cint;cdecl;external libX11;
+function XStoreColor(para1:PDisplay; para2:TColormap; para3:PXColor):cint;cdecl;external libX11;
+function XStoreColors(para1:PDisplay; para2:TColormap; para3:PXColor; para4:cint):cint;cdecl;external libX11;
+function XStoreName(para1:PDisplay; para2:TWindow; para3:Pchar):cint;cdecl;external libX11;
+function XStoreNamedColor(para1:PDisplay; para2:TColormap; para3:Pchar; para4:culong; para5:cint):cint;cdecl;external libX11;
+function XSync(para1:PDisplay; para2:TBool):cint;cdecl;external libX11;
+function XTextExtents(para1:PXFontStruct; para2:Pchar; para3:cint; para4:Pcint; para5:Pcint;
+           para6:Pcint; para7:PXCharStruct):cint;cdecl;external libX11;
+function XTextExtents16(para1:PXFontStruct; para2:PXChar2b; para3:cint; para4:Pcint; para5:Pcint;
+           para6:Pcint; para7:PXCharStruct):cint;cdecl;external libX11;
+function XTextWidth(para1:PXFontStruct; para2:Pchar; para3:cint):cint;cdecl;external libX11;
+function XTextWidth16(para1:PXFontStruct; para2:PXChar2b; para3:cint):cint;cdecl;external libX11;
+function XTranslateCoordinates(para1:PDisplay; para2:TWindow; para3:TWindow; para4:cint; para5:cint;
+           para6:Pcint; para7:Pcint; para8:PWindow):TBool;cdecl;external libX11;
+function XUndefineCursor(para1:PDisplay; para2:TWindow):cint;cdecl;external libX11;
+function XUngrabButton(para1:PDisplay; para2:cuint; para3:cuint; para4:TWindow):cint;cdecl;external libX11;
+function XUngrabKey(para1:PDisplay; para2:cint; para3:cuint; para4:TWindow):cint;cdecl;external libX11;
+function XUngrabKeyboard(para1:PDisplay; para2:TTime):cint;cdecl;external libX11;
+function XUngrabPointer(para1:PDisplay; para2:TTime):cint;cdecl;external libX11;
+function XUngrabServer(para1:PDisplay):cint;cdecl;external libX11;
+function XUninstallColormap(para1:PDisplay; para2:TColormap):cint;cdecl;external libX11;
+function XUnloadFont(para1:PDisplay; para2:TFont):cint;cdecl;external libX11;
+function XUnmapSubwindows(para1:PDisplay; para2:TWindow):cint;cdecl;external libX11;
+function XUnmapWindow(para1:PDisplay; para2:TWindow):cint;cdecl;external libX11;
+function XVendorRelease(para1:PDisplay):cint;cdecl;external libX11;
+function XWarpPointer(para1:PDisplay; para2:TWindow; para3:TWindow; para4:cint; para5:cint;
+           para6:cuint; para7:cuint; para8:cint; para9:cint):cint;cdecl;external libX11;
+function XWidthMMOfScreen(para1:PScreen):cint;cdecl;external libX11;
+function XWidthOfScreen(para1:PScreen):cint;cdecl;external libX11;
+function XWindowEvent(para1:PDisplay; para2:TWindow; para3:clong; para4:PXEvent):cint;cdecl;external libX11;
+function XWriteBitmapFile(para1:PDisplay; para2:Pchar; para3:TPixmap; para4:cuint; para5:cuint;
+           para6:cint; para7:cint):cint;cdecl;external libX11;
+function XSupportsLocale:TBool;cdecl;external libX11;
+function XSetLocaleModifiers(para1:Pchar):Pchar;cdecl;external libX11;
+function XOpenOM(para1:PDisplay; para2:PXrmHashBucketRec; para3:Pchar; para4:Pchar):TXOM;cdecl;external libX11;
+function XCloseOM(para1:TXOM):TStatus;cdecl;external libX11;
+function XSetOMValues(para1:TXOM; dotdotdot:array of const):Pchar;cdecl;external libX11;
+function XGetOMValues(para1:TXOM; dotdotdot:array of const):Pchar;cdecl;external libX11;
+function XDisplayOfOM(para1:TXOM):PDisplay;cdecl;external libX11;
+function XLocaleOfOM(para1:TXOM):Pchar;cdecl;external libX11;
+function XCreateOC(para1:TXOM; dotdotdot:array of const):TXOC;cdecl;external libX11;
+procedure XDestroyOC(para1:TXOC);cdecl;external libX11;
+function XOMOfOC(para1:TXOC):TXOM;cdecl;external libX11;
+function XSetOCValues(para1:TXOC; dotdotdot:array of const):Pchar;cdecl;external libX11;
+function XGetOCValues(para1:TXOC; dotdotdot:array of const):Pchar;cdecl;external libX11;
+function XCreateFontSet(para1:PDisplay; para2:Pchar; para3:PPPchar; para4:Pcint; para5:PPchar):TXFontSet;cdecl;external libX11;
+procedure XFreeFontSet(para1:PDisplay; para2:TXFontSet);cdecl;external libX11;
+function XFontsOfFontSet(para1:TXFontSet; para2:PPPXFontStruct; para3:PPPchar):cint;cdecl;external libX11;
+function XBaseFontNameListOfFontSet(para1:TXFontSet):Pchar;cdecl;external libX11;
+function XLocaleOfFontSet(para1:TXFontSet):Pchar;cdecl;external libX11;
+function XContextDependentDrawing(para1:TXFontSet):TBool;cdecl;external libX11;
+function XDirectionalDependentDrawing(para1:TXFontSet):TBool;cdecl;external libX11;
+function XContextualDrawing(para1:TXFontSet):TBool;cdecl;external libX11;
+function XExtentsOfFontSet(para1:TXFontSet):PXFontSetExtents;cdecl;external libX11;
+function XmbTextEscapement(para1:TXFontSet; para2:Pchar; para3:cint):cint;cdecl;external libX11;
+function XwcTextEscapement(para1:TXFontSet; para2:PWideChar; para3:cint):cint;cdecl;external libX11;
+function Xutf8TextEscapement(para1:TXFontSet; para2:Pchar; para3:cint):cint;cdecl;external libX11;
+function XmbTextExtents(para1:TXFontSet; para2:Pchar; para3:cint; para4:PXRectangle; para5:PXRectangle):cint;cdecl;external libX11;
+function XwcTextExtents(para1:TXFontSet; para2:PWideChar; para3:cint; para4:PXRectangle; para5:PXRectangle):cint;cdecl;external libX11;
+function Xutf8TextExtents(para1:TXFontSet; para2:Pchar; para3:cint; para4:PXRectangle; para5:PXRectangle):cint;cdecl;external libX11;
+function XmbTextPerCharExtents(para1:TXFontSet; para2:Pchar; para3:cint; para4:PXRectangle; para5:PXRectangle;
+           para6:cint; para7:Pcint; para8:PXRectangle; para9:PXRectangle):TStatus;cdecl;external libX11;
+function XwcTextPerCharExtents(para1:TXFontSet; para2:PWideChar; para3:cint; para4:PXRectangle; para5:PXRectangle;
+           para6:cint; para7:Pcint; para8:PXRectangle; para9:PXRectangle):TStatus;cdecl;external libX11;
+function Xutf8TextPerCharExtents(para1:TXFontSet; para2:Pchar; para3:cint; para4:PXRectangle; para5:PXRectangle;
+           para6:cint; para7:Pcint; para8:PXRectangle; para9:PXRectangle):TStatus;cdecl;external libX11;
+procedure XmbDrawText(para1:PDisplay; para2:TDrawable; para3:TGC; para4:cint; para5:cint;
+            para6:PXmbTextItem; para7:cint);cdecl;external libX11;
+procedure XwcDrawText(para1:PDisplay; para2:TDrawable; para3:TGC; para4:cint; para5:cint;
+            para6:PXwcTextItem; para7:cint);cdecl;external libX11;
+procedure Xutf8DrawText(para1:PDisplay; para2:TDrawable; para3:TGC; para4:cint; para5:cint;
+            para6:PXmbTextItem; para7:cint);cdecl;external libX11;
+procedure XmbDrawString(para1:PDisplay; para2:TDrawable; para3:TXFontSet; para4:TGC; para5:cint;
+            para6:cint; para7:Pchar; para8:cint);cdecl;external libX11;
+procedure XwcDrawString(para1:PDisplay; para2:TDrawable; para3:TXFontSet; para4:TGC; para5:cint;
+            para6:cint; para7:PWideChar; para8:cint);cdecl;external libX11;
+procedure Xutf8DrawString(para1:PDisplay; para2:TDrawable; para3:TXFontSet; para4:TGC; para5:cint;
+            para6:cint; para7:Pchar; para8:cint);cdecl;external libX11;
+procedure XmbDrawImageString(para1:PDisplay; para2:TDrawable; para3:TXFontSet; para4:TGC; para5:cint;
+            para6:cint; para7:Pchar; para8:cint);cdecl;external libX11;
+procedure XwcDrawImageString(para1:PDisplay; para2:TDrawable; para3:TXFontSet; para4:TGC; para5:cint;
+            para6:cint; para7:PWideChar; para8:cint);cdecl;external libX11;
+procedure Xutf8DrawImageString(para1:PDisplay; para2:TDrawable; para3:TXFontSet; para4:TGC; para5:cint;
+            para6:cint; para7:Pchar; para8:cint);cdecl;external libX11;
+function XOpenIM(para1:PDisplay; para2:PXrmHashBucketRec; para3:Pchar; para4:Pchar):TXIM;cdecl;external libX11;
+function XCloseIM(para1:TXIM):TStatus;cdecl;external libX11;
+function XGetIMValues(para1:TXIM; dotdotdot:array of const):Pchar;cdecl;external libX11;
+function XSetIMValues(para1:TXIM; dotdotdot:array of const):Pchar;cdecl;external libX11;
+function XDisplayOfIM(para1:TXIM):PDisplay;cdecl;external libX11;
+function XLocaleOfIM(para1:TXIM):Pchar;cdecl;external libX11;
+function XCreateIC(para1:TXIM; dotdotdot:array of const):TXIC;cdecl;external libX11;
+procedure XDestroyIC(para1:TXIC);cdecl;external libX11;
+procedure XSetICFocus(para1:TXIC);cdecl;external libX11;
+procedure XUnsetICFocus(para1:TXIC);cdecl;external libX11;
+function XwcResetIC(para1:TXIC):PWideChar;cdecl;external libX11;
+function XmbResetIC(para1:TXIC):Pchar;cdecl;external libX11;
+function Xutf8ResetIC(para1:TXIC):Pchar;cdecl;external libX11;
+function XSetICValues(para1:TXIC; dotdotdot:array of const):Pchar;cdecl;external libX11;
+function XGetICValues(para1:TXIC; dotdotdot:array of const):Pchar;cdecl;external libX11;
+function XIMOfIC(para1:TXIC):TXIM;cdecl;external libX11;
+function XFilterEvent(para1:PXEvent; para2:TWindow):TBool;cdecl;external libX11;
+function XmbLookupString(para1:TXIC; para2:PXKeyPressedEvent; para3:Pchar; para4:cint; para5:PKeySym;
+           para6:PStatus):cint;cdecl;external libX11;
+function XwcLookupString(para1:TXIC; para2:PXKeyPressedEvent; para3:PWideChar; para4:cint; para5:PKeySym;
+           para6:PStatus):cint;cdecl;external libX11;
+function Xutf8LookupString(para1:TXIC; para2:PXKeyPressedEvent; para3:Pchar; para4:cint; para5:PKeySym;
+           para6:PStatus):cint;cdecl;external libX11;
+function XVaCreateNestedList(unused:cint; dotdotdot:array of const):TXVaNestedList;cdecl;external libX11;
+function XRegisterIMInstantiateCallback(para1:PDisplay; para2:PXrmHashBucketRec; para3:Pchar; para4:Pchar; para5:TXIDProc;
+           para6:TXPointer):TBool;cdecl;external libX11;
+function XUnregisterIMInstantiateCallback(para1:PDisplay; para2:PXrmHashBucketRec; para3:Pchar; para4:Pchar; para5:TXIDProc;
+           para6:TXPointer):TBool;cdecl;external libX11;
+type
+   TXConnectionWatchProc = procedure (para1:PDisplay; para2:TXPointer; para3:cint; para4:TBool; para5:PXPointer);cdecl;
+
+function XInternalConnectionNumbers(para1:PDisplay; para2:PPcint; para3:Pcint):TStatus;cdecl;external libX11;
+procedure XProcessInternalConnection(para1:PDisplay; para2:cint);cdecl;external libX11;
+function XAddConnectionWatch(para1:PDisplay; para2:TXConnectionWatchProc; para3:TXPointer):TStatus;cdecl;external libX11;
+procedure XRemoveConnectionWatch(para1:PDisplay; para2:TXConnectionWatchProc; para3:TXPointer);cdecl;external libX11;
+procedure XSetAuthorization(para1:Pchar; para2:cint; para3:Pchar; para4:cint);cdecl;external libX11;
+
+{
+  _Xmbtowc?
+  _Xwctomb?
+}
+
+{$ifdef MACROS}
+function ConnectionNumber(dpy : PDisplay) : cint;
+function RootWindow(dpy : PDisplay; scr : cint) : TWindow;
+function DefaultScreen(dpy : PDisplay) : cint;
+function DefaultRootWindow(dpy : PDisplay) : TWindow;
+function DefaultVisual(dpy : PDisplay; scr : cint) : PVisual;
+function DefaultGC(dpy : PDisplay; scr : cint) : TGC;
+function BlackPixel(dpy : PDisplay; scr : cint) : culong;
+function WhitePixel(dpy : PDisplay; scr : cint) : culong;
+function QLength(dpy : PDisplay) : cint;
+function DisplayWidth(dpy : PDisplay; scr : cint) : cint;
+function DisplayHeight(dpy : PDisplay; scr : cint) : cint;
+function DisplayWidthMM(dpy : PDisplay; scr : cint) : cint;
+function DisplayHeightMM(dpy : PDisplay; scr : cint) : cint;
+function DisplayPlanes(dpy : PDisplay; scr : cint) : cint;
+function DisplayCells(dpy : PDisplay; scr : cint) : cint;
+function ScreenCount(dpy : PDisplay) : cint;
+function ServerVendor(dpy : PDisplay) : Pchar;
+function ProtocolVersion(dpy : PDisplay) : cint;
+function ProtocolRevision(dpy : PDisplay) : cint;
+function VendorRelease(dpy : PDisplay) : cint;
+function DisplayString(dpy : PDisplay) : Pchar;
+function DefaultDepth(dpy : PDisplay; scr : cint) : cint;
+function DefaultColormap(dpy : PDisplay; scr : cint) : TColormap;
+function BitmapUnit(dpy : PDisplay) : cint;
+function BitmapBitOrder(dpy : PDisplay) : cint;
+function BitmapPad(dpy : PDisplay) : cint;
+function ImageByteOrder(dpy : PDisplay) : cint;
+function NextRequest(dpy : PDisplay) : culong;
+function LastKnownRequestProcessed(dpy : PDisplay) : culong;
+function ScreenOfDisplay(dpy : PDisplay; scr : cint) : PScreen;
+function DefaultScreenOfDisplay(dpy : PDisplay) : PScreen;
+function DisplayOfScreen(s : PScreen) : PDisplay;
+function RootWindowOfScreen(s : PScreen) : TWindow;
+function BlackPixelOfScreen(s : PScreen) : culong;
+function WhitePixelOfScreen(s : PScreen) : culong;
+function DefaultColormapOfScreen(s : PScreen) : TColormap;
+function DefaultDepthOfScreen(s : PScreen) : cint;
+function DefaultGCOfScreen(s : PScreen) : TGC;
+function DefaultVisualOfScreen(s : PScreen) : PVisual;
+function WidthOfScreen(s : PScreen) : cint;
+function HeightOfScreen(s : PScreen) : cint;
+function WidthMMOfScreen(s : PScreen) : cint;
+function HeightMMOfScreen(s : PScreen) : cint;
+function PlanesOfScreen(s : PScreen) : cint;
+function CellsOfScreen(s : PScreen) : cint;
+function MinCmapsOfScreen(s : PScreen) : cint;
+function MaxCmapsOfScreen(s : PScreen) : cint;
+function DoesSaveUnders(s : PScreen) : TBool;
+function DoesBackingStore(s : PScreen) : cint;
+function EventMaskOfScreen(s : PScreen) : clong;
+function XAllocID(dpy : PDisplay) : TXID;
+{$endif MACROS}
+
+implementation
+
+{$ifdef MACROS}
+function ConnectionNumber(dpy : PDisplay) : cint;
+begin
+   ConnectionNumber:=(PXPrivDisplay(dpy))^.fd;
+end;
+
+function RootWindow(dpy : PDisplay; scr : cint) : TWindow;
+begin
+   RootWindow:=(ScreenOfDisplay(dpy,scr))^.root;
+end;
+
+function DefaultScreen(dpy : PDisplay) : cint;
+begin
+   DefaultScreen:=(PXPrivDisplay(dpy))^.default_screen;
+end;
+
+function DefaultRootWindow(dpy : PDisplay) : TWindow;
+begin
+   DefaultRootWindow:=(ScreenOfDisplay(dpy,DefaultScreen(dpy)))^.root;
+end;
+
+function DefaultVisual(dpy : PDisplay; scr : cint) : PVisual;
+begin
+   DefaultVisual:=(ScreenOfDisplay(dpy,scr))^.root_visual;
+end;
+
+function DefaultGC(dpy : PDisplay; scr : cint) : TGC;
+begin
+   DefaultGC:=(ScreenOfDisplay(dpy,scr))^.default_gc;
+end;
+
+function BlackPixel(dpy : PDisplay; scr : cint) : culong;
+begin
+   BlackPixel:=(ScreenOfDisplay(dpy,scr))^.black_pixel;
+end;
+
+function WhitePixel(dpy : PDisplay; scr : cint) : culong;
+begin
+   WhitePixel:=(ScreenOfDisplay(dpy,scr))^.white_pixel;
+end;
+
+function QLength(dpy : PDisplay) : cint;
+begin
+   QLength:=(PXPrivDisplay(dpy))^.qlen;
+end;
+
+function DisplayWidth(dpy : PDisplay; scr : cint) : cint;
+begin
+   DisplayWidth:=(ScreenOfDisplay(dpy,scr))^.width;
+end;
+
+function DisplayHeight(dpy : PDisplay; scr : cint) : cint;
+begin
+   DisplayHeight:=(ScreenOfDisplay(dpy,scr))^.height;
+end;
+
+function DisplayWidthMM(dpy : PDisplay; scr : cint) : cint;
+begin
+   DisplayWidthMM:=(ScreenOfDisplay(dpy,scr))^.mwidth;
+end;
+
+function DisplayHeightMM(dpy : PDisplay; scr : cint) : cint;
+begin
+   DisplayHeightMM:=(ScreenOfDisplay(dpy,scr))^.mheight;
+end;
+
+function DisplayPlanes(dpy : PDisplay; scr : cint) : cint;
+begin
+   DisplayPlanes:=(ScreenOfDisplay(dpy,scr))^.root_depth;
+end;
+
+function DisplayCells(dpy : PDisplay; scr : cint) : cint;
+begin
+   DisplayCells:=(DefaultVisual(dpy,scr))^.map_entries;
+end;
+
+function ScreenCount(dpy : PDisplay) : cint;
+begin
+   ScreenCount:=(PXPrivDisplay(dpy))^.nscreens;
+end;
+
+function ServerVendor(dpy : PDisplay) : Pchar;
+begin
+   ServerVendor:=(PXPrivDisplay(dpy))^.vendor;
+end;
+
+function ProtocolVersion(dpy : PDisplay) : cint;
+begin
+   ProtocolVersion:=(PXPrivDisplay(dpy))^.proto_major_version;
+end;
+
+function ProtocolRevision(dpy : PDisplay) : cint;
+begin
+   ProtocolRevision:=(PXPrivDisplay(dpy))^.proto_minor_version;
+end;
+
+function VendorRelease(dpy : PDisplay) : cint;
+begin
+   VendorRelease:=(PXPrivDisplay(dpy))^.release;
+end;
+
+function DisplayString(dpy : PDisplay) : Pchar;
+begin
+   DisplayString:=(PXPrivDisplay(dpy))^.display_name;
+end;
+
+function DefaultDepth(dpy : PDisplay; scr : cint) : cint;
+begin
+   DefaultDepth:=(ScreenOfDisplay(dpy,scr))^.root_depth;
+end;
+
+function DefaultColormap(dpy : PDisplay; scr : cint) : TColormap;
+begin
+   DefaultColormap:=(ScreenOfDisplay(dpy,scr))^.cmap;
+end;
+
+function BitmapUnit(dpy : PDisplay) : cint;
+begin
+   BitmapUnit:=(PXPrivDisplay(dpy))^.bitmap_unit;
+end;
+
+function BitmapBitOrder(dpy : PDisplay) : cint;
+begin
+   BitmapBitOrder:=(PXPrivDisplay(dpy))^.bitmap_bit_order;
+end;
+
+function BitmapPad(dpy : PDisplay) : cint;
+begin
+   BitmapPad:=(PXPrivDisplay(dpy))^.bitmap_pad;
+end;
+
+function ImageByteOrder(dpy : PDisplay) : cint;
+begin
+   ImageByteOrder:=(PXPrivDisplay(dpy))^.byte_order;
+end;
+
+function NextRequest(dpy : PDisplay) : culong;
+begin
+   NextRequest:=((PXPrivDisplay(dpy))^.request) + 1;
+end;
+
+function LastKnownRequestProcessed(dpy : PDisplay) : culong;
+begin
+   LastKnownRequestProcessed:=(PXPrivDisplay(dpy))^.last_request_read;
+end;
+
+function ScreenOfDisplay(dpy : PDisplay; scr : cint) : PScreen;
+begin
+   ScreenOfDisplay:=@(((PXPrivDisplay(dpy))^.screens)[scr]);
+end;
+
+function DefaultScreenOfDisplay(dpy : PDisplay) : PScreen;
+begin
+   DefaultScreenOfDisplay:=ScreenOfDisplay(dpy,DefaultScreen(dpy));
+end;
+
+function DisplayOfScreen(s : PScreen) : PDisplay;
+begin
+   DisplayOfScreen:=s^.display;
+end;
+
+function RootWindowOfScreen(s : PScreen) : TWindow;
+begin
+   RootWindowOfScreen:=s^.root;
+end;
+
+function BlackPixelOfScreen(s : PScreen) : culong;
+begin
+   BlackPixelOfScreen:=s^.black_pixel;
+end;
+
+function WhitePixelOfScreen(s : PScreen) : culong;
+begin
+   WhitePixelOfScreen:=s^.white_pixel;
+end;
+
+function DefaultColormapOfScreen(s : PScreen) : TColormap;
+begin
+   DefaultColormapOfScreen:=s^.cmap;
+end;
+
+function DefaultDepthOfScreen(s : PScreen) : cint;
+begin
+   DefaultDepthOfScreen:=s^.root_depth;
+end;
+
+function DefaultGCOfScreen(s : PScreen) : TGC;
+begin
+   DefaultGCOfScreen:=s^.default_gc;
+end;
+
+function DefaultVisualOfScreen(s : PScreen) : PVisual;
+begin
+   DefaultVisualOfScreen:=s^.root_visual;
+end;
+
+function WidthOfScreen(s : PScreen) : cint;
+begin
+   WidthOfScreen:=s^.width;
+end;
+
+function HeightOfScreen(s : PScreen) : cint;
+begin
+   HeightOfScreen:=s^.height;
+end;
+
+function WidthMMOfScreen(s : PScreen) : cint;
+begin
+   WidthMMOfScreen:=s^.mwidth;
+end;
+
+function HeightMMOfScreen(s : PScreen) : cint;
+begin
+   HeightMMOfScreen:=s^.mheight;
+end;
+
+function PlanesOfScreen(s : PScreen) : cint;
+begin
+   PlanesOfScreen:=s^.root_depth;
+end;
+
+function CellsOfScreen(s : PScreen) : cint;
+begin
+   CellsOfScreen:=(DefaultVisualOfScreen(s))^.map_entries;
+end;
+
+function MinCmapsOfScreen(s : PScreen) : cint;
+begin
+   MinCmapsOfScreen:=s^.min_maps;
+end;
+
+function MaxCmapsOfScreen(s : PScreen) : cint;
+begin
+   MaxCmapsOfScreen:=s^.max_maps;
+end;
+
+function DoesSaveUnders(s : PScreen) : TBool;
+begin
+   DoesSaveUnders:=s^.save_unders;
+end;
+
+function DoesBackingStore(s : PScreen) : cint;
+begin
+   DoesBackingStore:=s^.backing_store;
+end;
+
+function EventMaskOfScreen(s : PScreen) : clong;
+begin
+   EventMaskOfScreen:=s^.root_input_mask;
+end;
+
+function XAllocID(dpy : PDisplay) : TXID;
+begin
+   XAllocID:=(PXPrivDisplay(dpy))^.resource_alloc(dpy);
+end;
+{$endif MACROS}
+
+
+end.

+ 200 - 0
packages/x11/src/xrandr.pp

@@ -0,0 +1,200 @@
+{
+  $XFree86: xc/lib/Xrandr/Xrandr.h,v 1.9 2002/09/29 23:39:44 keithp Exp $
+ 
+  Copyright (C) 2000 Compaq Computer Corporation, Inc.
+  Copyright (C) 2002 Hewlett-Packard Company, 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 Compaq not be used in advertising or
+  publicity pertaining to distribution of the software without specific,
+  written prior permission.  HP makes no representations about the
+  suitability of this software for any purpose.  It is provided "as is"
+  without express or implied warranty.
+ 
+  HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL COMPAQ
+  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.
+ 
+  Author:  Jim Gettys, HP Labs, HP.
+}
+
+unit xrandr;
+
+interface
+
+{$PACKRECORDS c}
+
+uses
+  ctypes, x, xlib;
+
+const
+  libXrandr = 'Xrandr';
+
+{$I randr.inc}
+
+type
+  PXRRScreenSize = ^TXRRScreenSize;
+  TXRRScreenSize = record
+    width, height : cint;
+    mwidth, mheight : cint;
+  end;
+
+{
+   Events.
+}
+
+  TXRRScreenChangeNotifyEvent = record
+    _type : cint;                 { event base }
+    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;             { window which selected for this event }
+    root : TWindow;               { Root window for changed screen }
+    timestamp : TTime;            { when the screen change occurred }
+    config_timestamp : TTime;     { when the last configuration change }
+    size_index : TSizeID;
+    subpixel_order : TSubpixelOrder;
+    rotation : TRotation;
+    width : cint;
+    height : cint;
+    mwidth : cint;
+    mheight : cint;
+  end;
+
+
+{ internal representation is private to the library }
+  PXRRScreenConfiguration = ^TXRRScreenConfiguration;
+  TXRRScreenConfiguration = record end;
+
+function XRRQueryExtension(
+  dpy : PDisplay;
+  event_basep,
+  error_basep : Pcint) : TBool; cdecl; external libXrandr;
+
+function XRRQueryVersion(
+  dpy : PDisplay;
+  major_versionp : Pcint;
+  minor_versionp : Pcint) : TStatus; cdecl; external libXrandr;
+
+function XRRGetScreenInfo(
+  dpy : PDisplay;
+  draw : TDrawable) : PXRRScreenConfiguration; cdecl; external libXrandr;
+
+procedure XRRFreeScreenConfigInfo(
+  config : PXRRScreenConfiguration); cdecl; external libXrandr;
+
+{
+  Note that screen configuration changes are only permitted if the client can
+  prove it has up to date configuration information.  We are trying to
+  insist that it become possible for screens to change dynamically, so
+  we want to ensure the client knows what it is talking about when requesting
+  changes.
+}
+function XRRSetScreenConfig(
+  dpy : PDisplay;
+  config : PXRRScreenConfiguration;
+  draw : TDrawable;
+  size_index : cint;
+  rotation : TRotation;
+  timestamp : TTime) : TStatus; cdecl; external libXrandr;
+
+{ added in v1.1, sorry for the lame name }
+function XRRSetScreenConfigAndRate(
+  dpy : PDisplay;
+  config : PXRRScreenConfiguration;
+  draw : TDrawable;
+  size_index : cint;
+  rotation : TRotation;
+  rate : cshort;
+  timestamp : TTime) : TStatus; cdecl; external libXrandr;
+
+
+function XRRConfigRotations(
+  config : PXRRScreenConfiguration;
+  current_rotation : PRotation) : TRotation; cdecl; external libXrandr;
+
+function XRRConfigTimes(
+  config : PXRRScreenConfiguration;
+  config_timestamp : PTime) : TTime; cdecl; external libXrandr;
+
+function XRRConfigSizes(
+  config : PXRRScreenConfiguration;
+  nsizes : Pcint) : PXRRScreenSize; cdecl; external libXrandr;
+
+function XRRConfigRates(
+  config : PXRRScreenConfiguration;
+  sizeID : cint;
+  nrates : Pcint) : Pcshort; cdecl; external libXrandr;
+
+function XRRConfigCurrentConfiguration(
+  config : PXRRScreenConfiguration;
+  rotation : PRotation) : TSizeID; cdecl; external libXrandr;
+
+function XRRConfigCurrentRate(
+  config : PXRRScreenConfiguration) : cshort; cdecl; external libXrandr;
+
+function XRRRootToScreen(
+  dpy : PDisplay;
+  root : TWindow) : cint; cdecl; external libXrandr;
+
+{
+  returns the screen configuration for the specified screen; does a lazy
+  evalution to delay getting the information, and caches the result.
+  These routines should be used in preference to XRRGetScreenInfo
+  to avoid unneeded round trips to the X server.  These are new
+  in protocol version 0.1.
+}
+
+
+function XRRScreenConfig(
+  dpy : PDisplay;
+  screen : cint) : PXRRScreenConfiguration; cdecl; external libXrandr;
+function XRRConfig(
+  screen : PScreen) : PXRRScreenConfiguration; cdecl; external libXrandr;
+procedure XRRSelectInput(
+  dpy : PDisplay;
+  window : TWindow;
+  mask : cint); cdecl; external libXrandr;
+
+{
+  the following are always safe to call, even if RandR is not implemented 
+  on a screen 
+}
+
+
+function XRRRotations(
+  dpy : PDisplay;
+  screen : cint;
+  current_rotation : PRotation) : TRotation; cdecl; external libXrandr;
+function XRRSizes(
+  dpy : PDisplay;
+  screen : cint;
+  nsizes : Pcint) : PXRRScreenSize; cdecl; external libXrandr;
+function XRRRates(
+  dpy : PDisplay;
+  screen : cint;
+  sizeID : cint;
+  nrates : Pcint) : Pcshort; cdecl; external libXrandr;
+function XRRTimes(
+  dpy : PDisplay;
+  screen : cint;
+  config_timestamp : PTime) : TTime; cdecl; external libXrandr;
+
+
+{
+  intended to take RRScreenChangeNotify,  or 
+  ConfigureNotify (on the root window)
+  returns 1 if it is an event type it understands, 0 if not
+}
+function XRRUpdateConfiguration(
+  event : PXEvent) : cint; cdecl; external libXrandr;
+
+implementation
+
+end.

+ 233 - 0
packages/x11/src/xrender.pp

@@ -0,0 +1,233 @@
+unit xrender;
+interface
+uses
+  x,xlib;
+
+{$ifndef os2}
+  {$LinkLib c}
+  {$LinkLib X11}
+const
+  libX11='X11';
+{$else}
+const
+  libX11='X11';
+{$endif}
+
+{
+  Automatically converted by H2Pas 0.99.15 from xrender.h
+  The following command line parameters were used:
+    -p
+    -T
+    -S
+    -d
+    -c
+    xrender.h
+}
+
+{$PACKRECORDS C}
+
+type
+
+   PGlyph = ^TGlyph;
+   TGlyph = dword;
+
+   PGlyphSet = ^TGlyphSet;
+   TGlyphSet = dword;
+
+   PPicture = ^TPicture;
+   TPicture = dword;
+
+   PPictFormat = ^TPictFormat;
+   TPictFormat = dword;
+
+const
+   RENDER_NAME = 'RENDER';
+   RENDER_MAJOR = 0;
+   RENDER_MINOR = 0;
+   X_RenderQueryVersion = 0;
+   X_RenderQueryPictFormats = 1;
+   X_RenderQueryPictIndexValues = 2;
+   X_RenderQueryDithers = 3;
+   X_RenderCreatePicture = 4;
+   X_RenderChangePicture = 5;
+   X_RenderSetPictureClipRectangles = 6;
+   X_RenderFreePicture = 7;
+   X_RenderComposite = 8;
+   X_RenderScale = 9;
+   X_RenderTrapezoids = 10;
+   X_RenderTriangles = 11;
+   X_RenderTriStrip = 12;
+   X_RenderTriFan = 13;
+   X_RenderColorTrapezoids = 14;
+   X_RenderColorTriangles = 15;
+   X_RenderTransform = 16;
+   X_RenderCreateGlyphSet = 17;
+   X_RenderReferenceGlyphSet = 18;
+   X_RenderFreeGlyphSet = 19;
+   X_RenderAddGlyphs = 20;
+   X_RenderAddGlyphsFromPicture = 21;
+   X_RenderFreeGlyphs = 22;
+   X_RenderCompositeGlyphs8 = 23;
+   X_RenderCompositeGlyphs16 = 24;
+   X_RenderCompositeGlyphs32 = 25;
+   BadPictFormat = 0;
+   BadPicture = 1;
+   BadPictOp = 2;
+   BadGlyphSet = 3;
+   BadGlyph = 4;
+   RenderNumberErrors = BadGlyph + 1;
+   PictTypeIndexed = 0;
+   PictTypeDirect = 1;
+   PictOpClear = 0;
+   PictOpSrc = 1;
+   PictOpDst = 2;
+   PictOpOver = 3;
+   PictOpOverReverse = 4;
+   PictOpIn = 5;
+   PictOpInReverse = 6;
+   PictOpOut = 7;
+   PictOpOutReverse = 8;
+   PictOpAtop = 9;
+   PictOpAtopReverse = 10;
+   PictOpXor = 11;
+   PictOpAdd = 12;
+   PictOpSaturate = 13;
+   PictOpMaximum = 13;
+   PolyEdgeSharp = 0;
+   PolyEdgeSmooth = 1;
+   PolyModePrecise = 0;
+   PolyModeImprecise = 1;
+   CPRepeat = 1 shl 0;
+   CPAlphaMap = 1 shl 1;
+   CPAlphaXOrigin = 1 shl 2;
+   CPAlphaYOrigin = 1 shl 3;
+   CPClipXOrigin = 1 shl 4;
+   CPClipYOrigin = 1 shl 5;
+   CPClipMask = 1 shl 6;
+   CPGraphicsExposure = 1 shl 7;
+   CPSubwindowMode = 1 shl 8;
+   CPPolyEdge = 1 shl 9;
+   CPPolyMode = 1 shl 10;
+   CPDither = 1 shl 11;
+   CPLastBit = 11;
+type
+
+   PXRenderDirectFormat = ^TXRenderDirectFormat;
+   TXRenderDirectFormat = record
+        red : smallint;
+        redMask : smallint;
+        green : smallint;
+        greenMask : smallint;
+        blue : smallint;
+        blueMask : smallint;
+        alpha : smallint;
+        alphaMask : smallint;
+     end;
+
+   PXRenderPictFormat = ^TXRenderPictFormat;
+   TXRenderPictFormat = record
+        id : TPictFormat;
+        _type : longint;
+        depth : longint;
+        direct : TXRenderDirectFormat;
+        colormap : TColormap;
+     end;
+
+const
+   PictFormatID = 1 shl 0;
+   PictFormatType = 1 shl 1;
+   PictFormatDepth = 1 shl 2;
+   PictFormatRed = 1 shl 3;
+   PictFormatRedMask = 1 shl 4;
+   PictFormatGreen = 1 shl 5;
+   PictFormatGreenMask = 1 shl 6;
+   PictFormatBlue = 1 shl 7;
+   PictFormatBlueMask = 1 shl 8;
+   PictFormatAlpha = 1 shl 9;
+   PictFormatAlphaMask = 1 shl 10;
+   PictFormatColormap = 1 shl 11;
+type
+
+   PXRenderVisual = ^TXRenderVisual;
+   TXRenderVisual = record
+        visual : PVisual;
+        format : PXRenderPictFormat;
+     end;
+
+   PXRenderDepth = ^TXRenderDepth;
+   TXRenderDepth = record
+        depth : longint;
+        nvisuals : longint;
+        visuals : PXRenderVisual;
+     end;
+
+   PXRenderScreen = ^TXRenderScreen;
+   TXRenderScreen = record
+        depths : PXRenderDepth;
+        ndepths : longint;
+        fallback : PXRenderPictFormat;
+     end;
+
+   PXRenderInfo = ^TXRenderInfo;
+   TXRenderInfo = record
+        format : PXRenderPictFormat;
+        nformat : longint;
+        screen : PXRenderScreen;
+        nscreen : longint;
+        depth : PXRenderDepth;
+        ndepth : longint;
+        visual : PXRenderVisual;
+        nvisual : longint;
+     end;
+
+   PXRenderPictureAttributes = ^TXRenderPictureAttributes;
+   TXRenderPictureAttributes = record
+        _repeat : TBool;
+        alpha_map : TPicture;
+        alpha_x_origin : longint;
+        alpha_y_origin : longint;
+        clip_x_origin : longint;
+        clip_y_origin : longint;
+        clip_mask : TPixmap;
+        graphics_exposures : TBool;
+        subwindow_mode : longint;
+        poly_edge : longint;
+        poly_mode : longint;
+        dither : TAtom;
+     end;
+
+   PXGlyphInfo = ^TXGlyphInfo;
+   TXGlyphInfo = record
+        width : word;
+        height : word;
+        x : smallint;
+        y : smallint;
+        xOff : smallint;
+        yOff : smallint;
+     end;
+
+function XRenderQueryExtension(dpy:PDisplay; event_basep:Plongint; error_basep:Plongint):TBool;cdecl;external libX11;
+function XRenderQueryVersion(dpy:PDisplay; major_versionp:Plongint; minor_versionp:Plongint):TStatus;cdecl;external libX11;
+function XRenderQueryFormats(dpy:PDisplay):TStatus;cdecl;external libX11;
+function XRenderFindVisualFormat(dpy:PDisplay; visual:PVisual):PXRenderPictFormat;cdecl;external libX11;
+function XRenderFindFormat(dpy:PDisplay; mask:dword; template:PXRenderPictFormat; count:longint):PXRenderPictFormat;cdecl;external libX11;
+function XRenderCreatePicture(dpy:PDisplay; drawable:TDrawable; format:PXRenderPictFormat; valuemask:dword; attributes:PXRenderPictureAttributes):TPicture;cdecl;external libX11;
+procedure XRenderChangePicture(dpy:PDisplay; picture:TPicture; valuemask:dword; attributes:PXRenderPictureAttributes);cdecl;external libX11;
+procedure XRenderFreePicture(dpy:PDisplay; picture:TPicture);cdecl;external libX11;
+procedure XRenderComposite(dpy:PDisplay; op:longint; src:TPicture; mask:TPicture; dst:TPicture;
+            src_x:longint; src_y:longint; mask_x:longint; mask_y:longint; dst_x:longint;
+            dst_y:longint; width:dword; height:dword);cdecl;external libX11;
+function XRenderCreateGlyphSet(dpy:PDisplay; format:PXRenderPictFormat):TGlyphSet;cdecl;external libX11;
+function XRenderReferenceGlyphSet(dpy:PDisplay; existing:TGlyphSet):TGlyphSet;cdecl;external libX11;
+procedure XRenderFreeGlyphSet(dpy:PDisplay; glyphset:TGlyphSet);cdecl;external libX11;
+procedure XRenderAddGlyphs(dpy:PDisplay; glyphset:TGlyphSet; gids:PGlyph; glyphs:PXGlyphInfo; nglyphs:longint;
+            images:Pchar; nbyte_images:longint);cdecl;external libX11;
+procedure XRenderFreeGlyphs(dpy:PDisplay; glyphset:TGlyphSet; gids:PGlyph; nglyphs:longint);cdecl;external libX11;
+procedure XRenderCompositeString8(dpy:PDisplay; op:longint; src:TPicture; dst:TPicture; maskFormat:PXRenderPictFormat;
+            glyphset:TGlyphSet; xSrc:longint; ySrc:longint; xDst:longint; yDst:longint;
+            _string:Pchar; nchar:longint);cdecl;external libX11;
+
+implementation
+
+
+end.

+ 231 - 0
packages/x11/src/xresource.pp

@@ -0,0 +1,231 @@
+unit xresource; {$DEFINE MACRO}
+interface
+uses
+  x,xlib {$IFDEF MACROS}, strings{$ENDIF};
+
+{$ifndef os2}
+  {$LinkLib c}
+  {$LinkLib X11}
+const
+  libX11='X11';
+{$else}
+const
+  libX11='X11';
+{$endif}
+
+{
+  Automatically converted by H2Pas 0.99.15 from xresource.h
+  The following command line parameters were used:
+    -p
+    -T
+    -S
+    -d
+    -c
+    xresource.h
+}
+
+{$PACKRECORDS C}
+
+
+function Xpermalloc(para1:dword):Pchar;cdecl;external libX11;
+type
+
+   PXrmQuark = ^TXrmQuark;
+   TXrmQuark = longint;
+   TXrmQuarkList = PXrmQuark;
+   PXrmQuarkList = ^TXrmQuarkList;
+function NULLQUARK : TXrmQuark;
+
+type
+
+   PXrmString = ^TXrmString;
+   TXrmString = ^char;
+
+function NULLSTRING : TXrmString;
+
+function XrmStringToQuark(para1:Pchar):TXrmQuark;cdecl;external libX11;
+function XrmPermStringToQuark(para1:Pchar):TXrmQuark;cdecl;external libX11;
+function XrmQuarkToString(para1:TXrmQuark):TXrmString;cdecl;external libX11;
+function XrmUniqueQuark:TXrmQuark;cdecl;external libX11;
+{$ifdef MACROS}
+function XrmStringsEqual(a1,a2 : pchar) : boolean;
+{$endif MACROS}
+
+type
+
+   PXrmBinding = ^TXrmBinding;
+   TXrmBinding = (XrmBindTightly,XrmBindLoosely);
+   TXrmBindingList = PXrmBinding;
+   PXrmBindingList = ^TXrmBindingList;
+
+procedure XrmStringToQuarkList(para1:Pchar; para2:TXrmQuarkList);cdecl;external libX11;
+procedure XrmStringToBindingQuarkList(para1:Pchar; para2:TXrmBindingList; para3:TXrmQuarkList);cdecl;external libX11;
+type
+
+   PXrmName = ^TXrmName;
+   TXrmName = TXrmQuark;
+
+   PXrmNameList = ^TXrmNameList;
+   TXrmNameList = TXrmQuarkList;
+{$ifdef MACROS}
+function XrmNameToString(name : longint) : TXrmString;
+
+function XrmStringToName(_string : Pchar) : longint;
+
+procedure XrmStringToNameList(str:Pchar; name : PXrmQuark);
+{$endif MACROS}
+
+type
+
+   PXrmClass = ^TXrmClass;
+   TXrmClass = TXrmQuark;
+
+   PXrmClassList = ^TXrmClassList;
+   TXrmClassList = TXrmQuarkList;
+{$ifdef MACROS}
+function XrmClassToString(c_class : longint) : TXrmString;
+
+function XrmStringToClass(c_class : Pchar) : longint;
+
+procedure XrmStringToClassList(str:Pchar; c_class : PXrmQuark);
+{$endif MACROS}
+type
+
+   PXrmRepresentation = ^TXrmRepresentation;
+   TXrmRepresentation = TXrmQuark;
+{$ifdef MACROS}
+function XrmStringToRepresentation(_string : Pchar) : longint;
+
+function XrmRepresentationToString(_type : longint) : TXrmString;
+{$endif MACROS}
+
+type
+
+   PXrmValue = ^TXrmValue;
+   TXrmValue = record
+        size : dword;
+        addr : TXPointer;
+     end;
+   TXrmValuePtr = PXrmValue;
+   PXrmValuePtr = ^TXrmValuePtr;
+
+   PXrmHashBucketRec = ^TXrmHashBucketRec;
+   TXrmHashBucketRec = record
+     end;
+   TXrmHashBucket = PXrmHashBucketRec;
+   PXrmHashBucket = ^TXrmHashBucket;
+
+   PXrmHashTable = ^TXrmHashTable;
+   TXrmHashTable = ^TXrmHashBucket;
+
+   TXrmDatabase = PXrmHashBucketRec;
+   PXrmDatabase = ^TXrmDatabase;
+
+procedure XrmDestroyDatabase(para1:TXrmDatabase);cdecl;external libX11;
+procedure XrmQPutResource(para1:PXrmDatabase; para2:TXrmBindingList; para3:TXrmQuarkList; para4:TXrmRepresentation; para5:PXrmValue);cdecl;external libX11;
+procedure XrmPutResource(para1:PXrmDatabase; para2:Pchar; para3:Pchar; para4:PXrmValue);cdecl;external libX11;
+procedure XrmQPutStringResource(para1:PXrmDatabase; para2:TXrmBindingList; para3:TXrmQuarkList; para4:Pchar);cdecl;external libX11;
+procedure XrmPutStringResource(para1:PXrmDatabase; para2:Pchar; para3:Pchar);cdecl;external libX11;
+procedure XrmPutLineResource(para1:PXrmDatabase; para2:Pchar);cdecl;external libX11;
+function XrmQGetResource(para1:TXrmDatabase; para2:TXrmNameList; para3:TXrmClassList; para4:PXrmRepresentation; para5:PXrmValue):TBool;cdecl;external libX11;
+function XrmGetResource(para1:TXrmDatabase; para2:Pchar; para3:Pchar; para4:PPchar; para5:PXrmValue):TBool;cdecl;external libX11;
+{ There is no definition of TXrmSearchList }
+{function XrmQGetSearchList(para1:TXrmDatabase; para2:TXrmNameList; para3:TXrmClassList; para4:TXrmSearchList; para5:longint):TBool;cdecl;external libX11;
+function XrmQGetSearchResource(para1:TXrmSearchList; para2:TXrmName; para3:TXrmClass; para4:PXrmRepresentation; para5:PXrmValue):TBool;cdecl;external libX11;}
+procedure XrmSetDatabase(para1:PDisplay; para2:TXrmDatabase);cdecl;external libX11;
+function XrmGetDatabase(para1:PDisplay):TXrmDatabase;cdecl;external libX11;
+function XrmGetFileDatabase(para1:Pchar):TXrmDatabase;cdecl;external libX11;
+function XrmCombineFileDatabase(para1:Pchar; para2:PXrmDatabase; para3:TBool):TStatus;cdecl;external libX11;
+function XrmGetStringDatabase(para1:Pchar):TXrmDatabase;cdecl;external libX11;
+procedure XrmPutFileDatabase(para1:TXrmDatabase; para2:Pchar);cdecl;external libX11;
+procedure XrmMergeDatabases(para1:TXrmDatabase; para2:PXrmDatabase);cdecl;external libX11;
+procedure XrmCombineDatabase(para1:TXrmDatabase; para2:PXrmDatabase; para3:TBool);cdecl;external libX11;
+
+const
+   XrmEnumAllLevels = 0;
+   XrmEnumOneLevel = 1;
+type
+  funcbool=function :TBool;
+function XrmEnumerateDatabase(para1:TXrmDatabase; para2:TXrmNameList; para3:TXrmClassList; para4:longint; para5:funcbool;
+           para6:TXPointer):TBool;cdecl;external libX11;
+function XrmLocaleOfDatabase(para1:TXrmDatabase):Pchar;cdecl;external libX11;
+type
+
+   PXrmOptionKind = ^TXrmOptionKind;
+   TXrmOptionKind = (XrmoptionNoArg,XrmoptionIsArg,XrmoptionStickyArg,
+     XrmoptionSepArg,XrmoptionResArg,XrmoptionSkipArg,
+     XrmoptionSkipLine,XrmoptionSkipNArgs);
+
+   PXrmOptionDescRec = ^TXrmOptionDescRec;
+   TXrmOptionDescRec = record
+        option : Pchar;
+        specifier : Pchar;
+        argKind : TXrmOptionKind;
+        value : TXPointer;
+     end;
+   TXrmOptionDescList = PXrmOptionDescRec;
+   PXrmOptionDescList = ^TXrmOptionDescList;
+
+procedure XrmParseCommand(para1:PXrmDatabase; para2:TXrmOptionDescList; para3:longint; para4:Pchar; para5:Plongint;
+            para6:PPchar);cdecl;external libX11;
+
+implementation
+
+function NULLQUARK : TXrmQuark;
+  begin
+     NULLQUARK:=TXrmQuark(0);
+  end;
+
+function NULLSTRING : TXrmString;
+  begin
+     NULLSTRING:=TXrmString(0);
+  end;
+
+{$ifdef MACROS}
+function XrmStringsEqual(a1,a2 : pchar) : boolean;
+begin
+   XrmStringsEqual:=(strcomp(a1,a2)) = 0;
+end;
+
+function XrmNameToString(name : longint) : TXrmString;
+begin
+   XrmNameToString:=XrmQuarkToString(name);
+end;
+
+function XrmStringToName(_string : Pchar) : longint;
+begin
+   XrmStringToName:=XrmStringToQuark(_string);
+end;
+
+procedure XrmStringToNameList(str:Pchar; name : PXrmQuark);
+begin
+   XrmStringToQuarkList(str,name);
+end;
+
+function XrmClassToString(c_class : longint) : TXrmString;
+begin
+   XrmClassToString:=XrmQuarkToString(c_class);
+end;
+
+function XrmStringToClass(c_class : Pchar) : longint;
+begin
+   XrmStringToClass:=XrmStringToQuark(c_class);
+end;
+
+procedure XrmStringToClassList(str:Pchar; c_class : PXrmQuark);
+begin
+   XrmStringToQuarkList(str,c_class);
+end;
+
+function XrmStringToRepresentation(_string : Pchar) : longint;
+begin
+   XrmStringToRepresentation:=XrmStringToQuark(_string);
+end;
+
+function XrmRepresentationToString(_type : longint) : TXrmString;
+begin
+   XrmRepresentationToString:=XrmQuarkToString(_type);
+end;
+{$endif MACROS}
+
+end.

+ 87 - 0
packages/x11/src/xshm.pp

@@ -0,0 +1,87 @@
+unit xshm;
+interface
+uses
+  ctypes,x,xlib;
+
+{$ifndef os2}
+  {$LinkLib c}
+  {$LinkLib X11}
+  {$LinkLib Xext}
+const
+  libX11='X11';
+{$else}
+const
+  libX11='X11';
+{$endif}
+
+{
+  Automatically converted by H2Pas 0.99.15 from xshm.h
+  The following command line parameters were used:
+    -p
+    -T
+    -S
+    -d
+    -c
+    xshm.h
+}
+
+{$PACKRECORDS C}
+
+
+const
+   X_ShmQueryVersion = 0;
+   X_ShmAttach = 1;
+   X_ShmDetach = 2;
+   X_ShmPutImage = 3;
+   X_ShmGetImage = 4;
+   X_ShmCreatePixmap = 5;
+   ShmCompletion = 0;
+   ShmNumberEvents = ShmCompletion + 1;
+   BadShmSeg = 0;
+   ShmNumberErrors = BadShmSeg + 1;
+type
+
+   PShmSeg = ^TShmSeg;
+   TShmSeg = culong;
+
+   PXShmCompletionEvent = ^TXShmCompletionEvent;
+   TXShmCompletionEvent = record
+        _type : cint;
+        serial : culong;
+        send_event : TBool;
+        display : PDisplay;
+        drawable : TDrawable;
+        major_code : cint;
+        minor_code : cint;
+        shmseg : TShmSeg;
+        offset : culong;
+     end;
+
+   PXShmSegmentInfo = ^TXShmSegmentInfo;
+   TXShmSegmentInfo = record
+        shmseg : TShmSeg;
+        shmid : cint;
+        shmaddr : Pchar;
+        readOnly : TBool;
+     end;
+
+function XShmQueryExtension(para1:PDisplay):TBool;cdecl;external libX11;
+function XShmGetEventBase(para1:PDisplay):cint;cdecl;external libX11;
+function XShmQueryVersion(para1:PDisplay; para2:Pcint; para3:Pcint; para4:PBool):TBool;cdecl;external libX11;
+function XShmPixmapFormat(para1:PDisplay):cint;cdecl;external libX11;
+function XShmAttach(para1:PDisplay; para2:PXShmSegmentInfo):TStatus;cdecl;external libX11;
+function XShmDetach(para1:PDisplay; para2:PXShmSegmentInfo):TStatus;cdecl;external libX11;
+function XShmPutImage(para1:PDisplay; para2:TDrawable; para3:TGC; para4:PXImage; para5:cint;
+           para6:cint; para7:cint; para8:cint; para9:cuint; para10:cuint;
+           para11:TBool):TStatus;cdecl;external libX11;
+function XShmGetImage(para1:PDisplay; para2:TDrawable; para3:PXImage; para4:cint; para5:cint;
+           para6:culong):TStatus;cdecl;external libX11;
+function XShmCreateImage(para1:PDisplay; para2:PVisual; para3:cuint; para4:cint; para5:Pchar;
+           para6:PXShmSegmentInfo; para7:cuint; para8:cuint):PXImage;cdecl;external libX11;
+function XShmCreatePixmap(para1:PDisplay; para2:TDrawable; para3:Pchar; para4:PXShmSegmentInfo; para5:cuint;
+           para6:cuint; para7:cuint):TPixmap;cdecl;external libX11;
+
+implementation
+
+
+end.

+ 386 - 0
packages/x11/src/xutil.pp

@@ -0,0 +1,386 @@
+unit xutil;
+interface
+uses
+  ctypes,x,xlib,keysym;
+
+{$define MACROS}
+
+{$ifndef os2}
+  {$LinkLib c}
+  {$LinkLib X11}
+const
+  libX11='X11';
+{$else}
+const
+  libX11='X11';
+{$endif}
+
+{
+  Automatically converted by H2Pas 0.99.15 from xutil.h
+  The following command line parameters were used:
+    -p
+    -T
+    -S
+    -d
+    -c
+    xutil.h
+}
+
+{$PACKRECORDS C}
+
+const
+   NoValue = $0000;
+   XValue = $0001;
+   YValue = $0002;
+   WidthValue = $0004;
+   HeightValue = $0008;
+   AllValues = $000F;
+   XNegative = $0010;
+   YNegative = $0020;
+type
+
+   PXSizeHints = ^TXSizeHints;
+   TXSizeHints = record
+        flags : clong;
+        x, y : cint;
+        width, height : cint;
+        min_width, min_height : cint;
+        max_width, max_height : cint;
+        width_inc, height_inc : cint;
+        min_aspect, max_aspect : record
+             x : cint;
+             y : cint;
+          end;
+        base_width, base_height : cint;
+        win_gravity : cint;
+     end;
+
+const
+   USPosition = 1 shl 0;
+   USSize = 1 shl 1;
+   PPosition = 1 shl 2;
+   PSize = 1 shl 3;
+   PMinSize = 1 shl 4;
+   PMaxSize = 1 shl 5;
+   PResizeInc = 1 shl 6;
+   PAspect = 1 shl 7;
+   PBaseSize = 1 shl 8;
+   PWinGravity = 1 shl 9;
+   PAllHints = PPosition or PSize or PMinSize or PMaxSize or PResizeInc or PAspect;
+type
+
+   PXWMHints = ^TXWMHints;
+   TXWMHints = record
+        flags : clong;
+        input : TBool;
+        initial_state : cint;
+        icon_pixmap : TPixmap;
+        icon_window : TWindow;
+        icon_x, icon_y : cint;
+        icon_mask : TPixmap;
+        window_group : TXID;
+     end;
+
+const
+   InputHint = 1 shl 0;
+   StateHint = 1 shl 1;
+   IconPixmapHint = 1 shl 2;
+   IconWindowHint = 1 shl 3;
+   IconPositionHint = 1 shl 4;
+   IconMaskHint = 1 shl 5;
+   WindowGroupHint = 1 shl 6;
+   AllHints = InputHint or StateHint or IconPixmapHint or IconWindowHint or IconPositionHint or IconMaskHint or WindowGroupHint;
+   XUrgencyHint = 1 shl 8;
+   WithdrawnState = 0;
+   NormalState = 1;
+   IconicState = 3;
+   DontCareState = 0;
+   ZoomState = 2;
+   InactiveState = 4;
+type
+
+   PXTextProperty = ^TXTextProperty;
+   TXTextProperty = record
+        value : pcuchar;
+        encoding : TAtom;
+        format : cint;
+        nitems : culong;
+     end;
+
+const
+   XNoMemory = -1;
+   XLocaleNotSupported = -2;
+   XConverterNotFound = -3;
+type
+
+   PXICCEncodingStyle = ^TXICCEncodingStyle;
+   TXICCEncodingStyle = (XStringStyle,XCompoundTextStyle,XTextStyle,
+     XStdICCTextStyle,XUTF8StringStyle);
+
+   PPXIconSize = ^PXIconSize;
+   PXIconSize = ^TXIconSize;
+   TXIconSize = record
+        min_width, min_height : cint;
+        max_width, max_height : cint;
+        width_inc, height_inc : cint;
+     end;
+
+   PXClassHint = ^TXClassHint;
+   TXClassHint = record
+        res_name : Pchar;
+        res_class : Pchar;
+     end;
+
+type
+
+   PXComposeStatus = ^TXComposeStatus;
+   TXComposeStatus = record
+        compose_ptr : TXPointer;
+        chars_matched : cint;
+     end;
+
+type
+
+   PXRegion = ^TXRegion;
+   TXRegion = record
+     end;
+   TRegion = PXRegion;
+   PRegion = ^TRegion;
+
+const
+   RectangleOut = 0;
+   RectangleIn = 1;
+   RectanglePart = 2;
+type
+
+   PXVisualInfo = ^TXVisualInfo;
+   TXVisualInfo = record
+        visual : PVisual;
+        visualid : TVisualID;
+        screen : cint;
+        depth : cint;
+        _class : cint;
+        red_mask : culong;
+        green_mask : culong;
+        blue_mask : culong;
+        colormap_size : cint;
+        bits_per_rgb : cint;
+     end;
+
+const
+   VisualNoMask = $0;
+   VisualIDMask = $1;
+   VisualScreenMask = $2;
+   VisualDepthMask = $4;
+   VisualClassMask = $8;
+   VisualRedMaskMask = $10;
+   VisualGreenMaskMask = $20;
+   VisualBlueMaskMask = $40;
+   VisualColormapSizeMask = $80;
+   VisualBitsPerRGBMask = $100;
+   VisualAllMask = $1FF;
+type
+
+   PPXStandardColormap = ^PXStandardColormap;
+   PXStandardColormap = ^TXStandardColormap;
+   TXStandardColormap = record
+        colormap : TColormap;
+        red_max : culong;
+        red_mult : culong;
+        green_max : culong;
+        green_mult : culong;
+        blue_max : culong;
+        blue_mult : culong;
+        base_pixel : culong;
+        visualid : TVisualID;
+        killid : TXID;
+     end;
+
+const
+   BitmapSuccess = 0;
+   BitmapOpenFailed = 1;
+   BitmapFileInvalid = 2;
+   BitmapNoMemory = 3;
+   XCSUCCESS = 0;
+   XCNOMEM = 1;
+   XCNOENT = 2;
+   ReleaseByFreeingColormap : TXID = TXID(1);
+
+type
+   PXContext = ^TXContext;
+   TXContext = cint;
+
+function XAllocClassHint:PXClassHint;cdecl;external libX11;
+function XAllocIconSize:PXIconSize;cdecl;external libX11;
+function XAllocSizeHints:PXSizeHints;cdecl;external libX11;
+function XAllocStandardColormap:PXStandardColormap;cdecl;external libX11;
+function XAllocWMHints:PXWMHints;cdecl;external libX11;
+function XClipBox(para1:TRegion; para2:PXRectangle):cint;cdecl;external libX11;
+function XCreateRegion:TRegion;cdecl;external libX11;
+function XDefaultString:Pchar;cdecl;external libX11;
+function XDeleteContext(para1:PDisplay; para2:TXID; para3:TXContext):cint;cdecl;external libX11;
+function XDestroyRegion(para1:TRegion):cint;cdecl;external libX11;
+function XEmptyRegion(para1:TRegion):cint;cdecl;external libX11;
+function XEqualRegion(para1:TRegion; para2:TRegion):cint;cdecl;external libX11;
+function XFindContext(para1:PDisplay; para2:TXID; para3:TXContext; para4:PXPointer):cint;cdecl;external libX11;
+function XGetClassHint(para1:PDisplay; para2:TWindow; para3:PXClassHint):TStatus;cdecl;external libX11;
+function XGetIconSizes(para1:PDisplay; para2:TWindow; para3:PPXIconSize; para4:Pcint):TStatus;cdecl;external libX11;
+function XGetNormalHints(para1:PDisplay; para2:TWindow; para3:PXSizeHints):TStatus;cdecl;external libX11;
+function XGetRGBColormaps(para1:PDisplay; para2:TWindow; para3:PPXStandardColormap; para4:Pcint; para5:TAtom):TStatus;cdecl;external libX11;
+function XGetSizeHints(para1:PDisplay; para2:TWindow; para3:PXSizeHints; para4:TAtom):TStatus;cdecl;external libX11;
+function XGetStandardColormap(para1:PDisplay; para2:TWindow; para3:PXStandardColormap; para4:TAtom):TStatus;cdecl;external libX11;
+function XGetTextProperty(para1:PDisplay; para2:TWindow; para3:PXTextProperty; para4:TAtom):TStatus;cdecl;external libX11;
+function XGetVisualInfo(para1:PDisplay; para2:clong; para3:PXVisualInfo; para4:Pcint):PXVisualInfo;cdecl;external libX11;
+function XGetWMClientMachine(para1:PDisplay; para2:TWindow; para3:PXTextProperty):TStatus;cdecl;external libX11;
+function XGetWMHints(para1:PDisplay; para2:TWindow):PXWMHints;cdecl;external libX11;
+function XGetWMIconName(para1:PDisplay; para2:TWindow; para3:PXTextProperty):TStatus;cdecl;external libX11;
+function XGetWMName(para1:PDisplay; para2:TWindow; para3:PXTextProperty):TStatus;cdecl;external libX11;
+function XGetWMNormalHints(para1:PDisplay; para2:TWindow; para3:PXSizeHints; para4:Pclong):TStatus;cdecl;external libX11;
+function XGetWMSizeHints(para1:PDisplay; para2:TWindow; para3:PXSizeHints; para4:Pclong; para5:TAtom):TStatus;cdecl;external libX11;
+function XGetZoomHints(para1:PDisplay; para2:TWindow; para3:PXSizeHints):TStatus;cdecl;external libX11;
+function XIntersectRegion(para1:TRegion; para2:TRegion; para3:TRegion):cint;cdecl;external libX11;
+procedure XConvertCase(para1:TKeySym; para2:PKeySym; para3:PKeySym);cdecl;external libX11;
+function XLookupString(para1:PXKeyEvent; para2:Pchar; para3:cint; para4:PKeySym; para5:PXComposeStatus):cint;cdecl;external libX11;
+function XMatchVisualInfo(para1:PDisplay; para2:cint; para3:cint; para4:cint; para5:PXVisualInfo):TStatus;cdecl;external libX11;
+function XOffsetRegion(para1:TRegion; para2:cint; para3:cint):cint;cdecl;external libX11;
+function XPointInRegion(para1:TRegion; para2:cint; para3:cint):TBool;cdecl;external libX11;
+function XPolygonRegion(para1:PXPoint; para2:cint; para3:cint):TRegion;cdecl;external libX11;
+function XRectInRegion(para1:TRegion; para2:cint; para3:cint; para4:cuint; para5:cuint):cint;cdecl;external libX11;
+function XSaveContext(para1:PDisplay; para2:TXID; para3:TXContext; para4:Pchar):cint;cdecl;external libX11;
+function XSetClassHint(para1:PDisplay; para2:TWindow; para3:PXClassHint):cint;cdecl;external libX11;
+function XSetIconSizes(para1:PDisplay; para2:TWindow; para3:PXIconSize; para4:cint):cint;cdecl;external libX11;
+function XSetNormalHints(para1:PDisplay; para2:TWindow; para3:PXSizeHints):cint;cdecl;external libX11;
+procedure XSetRGBColormaps(para1:PDisplay; para2:TWindow; para3:PXStandardColormap; para4:cint; para5:TAtom);cdecl;external libX11;
+function XSetSizeHints(para1:PDisplay; para2:TWindow; para3:PXSizeHints; para4:TAtom):cint;cdecl;external libX11;
+function XSetStandardProperties(para1:PDisplay; para2:TWindow; para3:Pchar; para4:Pchar; para5:TPixmap;
+           para6:PPchar; para7:cint; para8:PXSizeHints):cint;cdecl;external libX11;
+procedure XSetTextProperty(para1:PDisplay; para2:TWindow; para3:PXTextProperty; para4:TAtom);cdecl;external libX11;
+procedure XSetWMClientMachine(para1:PDisplay; para2:TWindow; para3:PXTextProperty);cdecl;external libX11;
+function XSetWMHints(para1:PDisplay; para2:TWindow; para3:PXWMHints):cint;cdecl;external libX11;
+procedure XSetWMIconName(para1:PDisplay; para2:TWindow; para3:PXTextProperty);cdecl;external libX11;
+procedure XSetWMName(para1:PDisplay; para2:TWindow; para3:PXTextProperty);cdecl;external libX11;
+procedure XSetWMNormalHints(para1:PDisplay; para2:TWindow; para3:PXSizeHints);cdecl;external libX11;
+procedure XSetWMProperties(para1:PDisplay; para2:TWindow; para3:PXTextProperty; para4:PXTextProperty; para5:PPchar;
+            para6:cint; para7:PXSizeHints; para8:PXWMHints; para9:PXClassHint);cdecl;external libX11;
+procedure XmbSetWMProperties(para1:PDisplay; para2:TWindow; para3:Pchar; para4:Pchar; para5:PPchar;
+            para6:cint; para7:PXSizeHints; para8:PXWMHints; para9:PXClassHint);cdecl;external libX11;
+procedure Xutf8SetWMProperties(para1:PDisplay; para2:TWindow; para3:Pchar; para4:Pchar; para5:PPchar;
+            para6:cint; para7:PXSizeHints; para8:PXWMHints; para9:PXClassHint);cdecl;external libX11;
+procedure XSetWMSizeHints(para1:PDisplay; para2:TWindow; para3:PXSizeHints; para4:TAtom);cdecl;external libX11;
+function XSetRegion(para1:PDisplay; para2:TGC; para3:TRegion):cint;cdecl;external libX11;
+procedure XSetStandardColormap(para1:PDisplay; para2:TWindow; para3:PXStandardColormap; para4:TAtom);cdecl;external libX11;
+function XSetZoomHints(para1:PDisplay; para2:TWindow; para3:PXSizeHints):cint;cdecl;external libX11;
+function XShrinkRegion(para1:TRegion; para2:cint; para3:cint):cint;cdecl;external libX11;
+function XStringListToTextProperty(para1:PPchar; para2:cint; para3:PXTextProperty):TStatus;cdecl;external libX11;
+function XSubtractRegion(para1:TRegion; para2:TRegion; para3:TRegion):cint;cdecl;external libX11;
+function XmbTextListToTextProperty(para1:PDisplay; para2:PPchar; para3:cint; para4:TXICCEncodingStyle; para5:PXTextProperty):cint;cdecl;external libX11;
+function XwcTextListToTextProperty(para1:PDisplay; para2:PPWideChar; para3:cint; para4:TXICCEncodingStyle; para5:PXTextProperty):cint;cdecl;external libX11;
+function Xutf8TextListToTextProperty(para1:PDisplay; para2:PPchar; para3:cint; para4:TXICCEncodingStyle; para5:PXTextProperty):cint;cdecl;external libX11;
+procedure XwcFreeStringList(para1:PPWideChar);cdecl;external libX11;
+function XTextPropertyToStringList(para1:PXTextProperty; para2:PPPchar; para3:Pcint):TStatus;cdecl;external libX11;
+function XmbTextPropertyToTextList(para1:PDisplay; para2:PXTextProperty; para3:PPPchar; para4:Pcint):cint;cdecl;external libX11;
+function XwcTextPropertyToTextList(para1:PDisplay; para2:PXTextProperty; para3:PPPWideChar; para4:Pcint):cint;cdecl;external libX11;
+function Xutf8TextPropertyToTextList(para1:PDisplay; para2:PXTextProperty; para3:PPPchar; para4:Pcint):cint;cdecl;external libX11;
+function XUnionRectWithRegion(para1:PXRectangle; para2:TRegion; para3:TRegion):cint;cdecl;external libX11;
+function XUnionRegion(para1:TRegion; para2:TRegion; para3:TRegion):cint;cdecl;external libX11;
+function XWMGeometry(para1:PDisplay; para2:cint; para3:Pchar; para4:Pchar; para5:cuint;
+           para6:PXSizeHints; para7:Pcint; para8:Pcint; para9:Pcint; para10:Pcint;
+           para11:Pcint):cint;cdecl;external libX11;
+function XXorRegion(para1:TRegion; para2:TRegion; para3:TRegion):cint;cdecl;external libX11;
+
+{$ifdef MACROS}
+function XDestroyImage(ximage : PXImage) : cint;
+function XGetPixel(ximage : PXImage; x, y : cint) : culong;
+function XPutPixel(ximage : PXImage; x, y : cint; pixel : culong) : cint;
+function XSubImage(ximage : PXImage; x, y : cint; width, height : cuint) : PXImage;
+function XAddPixel(ximage : PXImage; value : clong) : cint;
+function IsKeypadKey(keysym : TKeySym) : Boolean;
+function IsPrivateKeypadKey(keysym : TKeySym) : Boolean;
+function IsCursorKey(keysym : TKeySym) : Boolean;
+function IsPFKey(keysym : TKeySym) : Boolean;
+function IsFunctionKey(keysym : TKeySym) : Boolean;
+function IsMiscFunctionKey(keysym : TKeySym) : Boolean;
+function IsModifierKey(keysym : TKeySym) : Boolean;
+{function XUniqueContext : TXContext;
+function XStringToContext(_string : Pchar) : TXContext;}
+{$endif MACROS}
+
+implementation
+
+{$ifdef MACROS}
+
+function XDestroyImage(ximage : PXImage) : cint;
+
+begin
+  XDestroyImage := ximage^.f.destroy_image(ximage);
+end;
+
+function XGetPixel(ximage : PXImage; x, y : cint) : culong;
+begin
+   XGetPixel:=ximage^.f.get_pixel(ximage, x, y);
+end;
+
+function XPutPixel(ximage : PXImage; x, y : cint; pixel : culong) : cint;
+begin
+   XPutPixel:=ximage^.f.put_pixel(ximage, x, y, pixel);
+end;
+
+function XSubImage(ximage : PXImage; x, y : cint; width, height : cuint) : PXImage;
+begin
+   XSubImage:=ximage^.f.sub_image(ximage, x, y, width, height);
+end;
+
+function XAddPixel(ximage : PXImage; value : clong) : cint;
+begin
+   XAddPixel:=ximage^.f.add_pixel(ximage, value);
+end;
+
+function IsKeypadKey(keysym : TKeySym) : Boolean;
+begin
+   IsKeypadKey:=(keysym >= XK_KP_Space) and (keysym <= XK_KP_Equal);
+end;
+
+function IsPrivateKeypadKey(keysym : TKeySym) : Boolean;
+begin
+   IsPrivateKeypadKey:=(keysym >= $11000000) and (keysym <= $1100FFFF);
+end;
+
+function IsCursorKey(keysym : TKeySym) : Boolean;
+begin
+   IsCursorKey:=(keysym >= XK_Home) and (keysym < XK_Select);
+end;
+
+function IsPFKey(keysym : TKeySym) : Boolean;
+begin
+   IsPFKey:=(keysym >= XK_KP_F1) and (keysym <= XK_KP_F4);
+end;
+
+function IsFunctionKey(keysym : TKeySym) : Boolean;
+begin
+   IsFunctionKey:=(keysym >= XK_F1) and (keysym <= XK_F35);
+end;
+
+function IsMiscFunctionKey(keysym : TKeySym) : Boolean;
+begin
+   IsMiscFunctionKey:=(keysym >= XK_Select) and (keysym <= XK_Break);
+end;
+
+function IsModifierKey(keysym : TKeySym) : Boolean;
+begin
+  IsModifierKey := ((keysym >= XK_Shift_L) And (keysym <= XK_Hyper_R)) Or
+                   (keysym = XK_Mode_switch) Or (keysym = XK_Num_Lock);
+end;
+
+{...needs xresource
+function XUniqueContext : TXContext;
+begin
+   XUniqueContext:=TXContext(XrmUniqueQuark);
+end;
+
+function XStringToContext(_string : Pchar) : TXContext;
+begin
+   XStringToContext:=TXContext(XrmStringToQuark(_string));
+end;}
+{$endif MACROS}
+
+end.

+ 118 - 0
packages/x11/src/xv.pp

@@ -0,0 +1,118 @@
+{***********************************************************
+Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
+and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
+
+                        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 names of Digital or MIT not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************}
+{ $XFree86: xc/include/extensions/Xv.h,v 1.3 1999/05/23 06:33:22 dawes Exp $ }
+
+unit xv;
+
+interface
+
+{$PACKRECORDS c}
+
+uses
+  x;
+
+const
+  XvName = 'XVideo';
+  XvVersion = 2;
+  XvRevision = 2;
+
+{ Symbols }
+type
+  TXvPortID = TXID;
+  TXvEncodingID = TXID;
+
+const
+  XvNone = 0;
+
+  XvInput       = 0;
+  XvOutput      = 1;
+
+  XvInputMask   = 1 shl XvInput;
+  XvOutputMask  = 1 shl XvOutput;
+  XvVideoMask   = $00000004;
+  XvStillMask   = $00000008;
+  XvImageMask   = $00000010;
+
+{ These two are not client viewable }
+  XvPixmapMask  = $00010000;
+  XvWindowMask  = $00020000;
+
+
+  XvGettable    = $01;
+  XvSettable    = $02;
+
+  XvRGB         = 0;
+  XvYUV         = 1;
+
+  XvPacked      = 0;
+  XvPlanar      = 1;
+
+  XvTopToBottom = 0;
+  XvBottomToTop = 1;
+
+
+{ Events }
+
+  XvVideoNotify = 0;
+  XvPortNotify  = 1;
+  XvNumEvents   = 2;
+
+{ Video Notify Reasons }
+
+  XvStarted    = 0;
+  XvStopped    = 1;
+  XvBusy       = 2;
+  XvPreempted  = 3;
+  XvHardError  = 4;
+  XvLastReason = 4;
+
+  XvNumReasons = XvLastReason + 1;
+
+  XvStartedMask   = 1 shl XvStarted;
+  XvStoppedMask   = 1 shl XvStopped;
+  XvBusyMask      = 1 shl XvBusy;
+  XvPreemptedMask = 1 shl XvPreempted;
+  XvHardErrorMask = 1 shl XvHardError;
+
+  XvAnyReasonMask = (1 shl XvNumReasons) - 1;
+  XvNoReasonMask  = 0;
+
+{ Errors }
+
+  XvBadPort     = 0;
+  XvBadEncoding = 1;
+  XvBadControl  = 2;
+  XvNumErrors   = 3;
+
+{ Status }
+
+  XvBadExtension   = 1;
+  XvAlreadyGrabbed = 2;
+  XvInvalidTime    = 3;
+  XvBadReply       = 4;
+  XvBadAlloc       = 5;
+
+implementation
+
+end.

+ 408 - 0
packages/x11/src/xvlib.pp

@@ -0,0 +1,408 @@
+{***********************************************************
+Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
+and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
+
+                        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 names of Digital or MIT not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************}
+{ $XFree86: xc/include/extensions/Xvlib.h,v 1.3 1999/12/11 19:28:48 mvojkovi Exp $ }
+
+{*
+** File: 
+**
+**   Xvlib.h --- Xv library public header file
+**
+** Author: 
+**
+**   David Carver (Digital Workstation Engineering/Project Athena)
+**
+** Revisions:
+**
+**   26.06.91 Carver
+**     - changed XvFreeAdaptors to XvFreeAdaptorInfo
+**     - changed XvFreeEncodings to XvFreeEncodingInfo
+**
+**   11.06.91 Carver
+**     - changed SetPortControl to SetPortAttribute
+**     - changed GetPortControl to GetPortAttribute
+**     - changed QueryBestSize
+**
+**   05.15.91 Carver
+**     - version 2.0 upgrade
+**
+**   01.24.91 Carver
+**     - version 1.4 upgrade
+**
+*}
+
+unit xvlib;
+
+interface
+
+uses
+  ctypes, x, xlib, xshm, xv;
+
+{$PACKRECORDS c}
+
+const
+  libXv='Xv';
+
+type
+  PXvRational = ^TXvRational;
+  TXvRational = record
+    numerator : cint;
+    denominator : cint;
+  end;
+
+  PXvAttribute = ^TXvAttribute;
+  TXvAttribute = record
+    flags : cint; { XvGettable, XvSettable }
+    min_value : cint;
+    max_value : cint;
+    name : pchar;
+  end;
+
+  PPXvEncodingInfo = ^PXvEncodingInfo;
+  PXvEncodingInfo = ^TXvEncodingInfo;
+  TXvEncodingInfo = record
+    encoding_id : TXvEncodingID;
+    name : pchar;
+    width : culong;
+    height : culong;
+    rate : TXvRational;
+    num_encodings : culong;
+  end;
+
+  PXvFormat = ^TXvFormat;
+  TXvFormat = record
+    depth : cchar;
+    visual_id : culong;
+  end;
+
+  PPXvAdaptorInfo = ^PXvAdaptorInfo;
+  PXvAdaptorInfo = ^TXvAdaptorInfo;
+  TXvAdaptorInfo = record
+    base_id : TXvPortID;
+    num_ports : culong;
+    _type : cchar;
+    name : pchar;
+    num_formats : culong;
+    formats : PXvFormat;
+    num_adaptors : culong;
+  end;
+
+  PXvVideoNotifyEvent = ^TXvVideoNotifyEvent;
+  TXvVideoNotifyEvent = 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 }
+    drawable : TDrawable; { drawable }
+    reason : culong;      { what generated this event }
+    port_id : TXvPortID;  { what port }
+    time : TTime;         { milliseconds }
+  end;
+
+  PXvPortNotifyEvent = ^TXvPortNotifyEvent;
+  TXvPortNotifyEvent = 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 }
+    port_id : TXvPortID; { what port }
+    time : TTime;        { milliseconds }
+    attribute : TAtom;   { atom that identifies attribute }
+    value : clong;       { value of attribute }
+  end;
+
+  PXvEvent = ^TXvEvent;
+  TXvEvent = record
+    case longint of
+      0 : (
+            _type : cint;
+	  );
+      1 : (
+            xvvideo : TXvVideoNotifyEvent;
+          );
+      2 : (
+            xvport : TXvPortNotifyEvent;
+          );
+      3 : (
+            pad : array[0..23] of clong;
+          );
+  end;
+
+  PXvImageFormatValues = ^TXvImageFormatValues;
+  TXvImageFormatValues = record
+    id : cint;                    { Unique descriptor for the format }
+    _type : cint;                 { XvRGB, XvYUV }
+    byte_order : cint;            { LSBFirst, MSBFirst }
+    guid : array[0..15] of cchar; { Globally Unique IDentifier }
+    bits_per_pixel : cint;
+    format : cint;                { XvPacked, XvPlanar }
+    num_planes : cint;
+
+  { for RGB formats only }
+    depth : cint;
+    red_mask : cuint;
+    green_mask : cuint;
+    blue_mask : cuint;
+
+  { for YUV formats only }
+    y_sample_bits : cuint;
+    u_sample_bits : cuint;
+    v_sample_bits : cuint;
+    horz_y_period : cuint;
+    horz_u_period : cuint;
+    horz_v_period : cuint;
+    vert_y_period : cuint;
+    vert_u_period : cuint;
+    vert_v_period : cuint;
+    component_order : array[0..31] of char; { eg. UYVY }
+    scanline_order : cint;                  { XvTopToBottom, XvBottomToTop }
+  end;
+
+  PXvImage = ^TXvImage;
+  TXvImage = record
+    id : cint;
+    width, height : cint;
+    data_size : cint;              { bytes }
+    num_planes : cint;
+    pitches : pcint;               { bytes }
+    offsets : pcint;               { bytes }
+    data : pcchar;
+    obdata : TXPointer;
+  end;
+
+function XvQueryExtension(
+  display : PDisplay;
+  p_version,
+  p_revision,
+  p_requestBase,
+  p_eventBase,
+  p_errorBase : pcuint
+) : cint; cdecl; external libXv;
+
+function XvQueryAdaptors(
+  display : PDisplay;
+  window : TWindow;
+  p_nAdaptors : pcuint;
+  p_pAdaptors : PPXvAdaptorInfo
+) : cint; cdecl; external libXv;
+
+function XvQueryEncodings(
+  display : PDisplay;
+  port : TXvPortID;
+  p_nEncoding : pcuint;
+  p_pEncoding : PPXvEncodingInfo
+) : cint; cdecl; external libXv;
+
+function XvPutVideo(
+  display : PDisplay;
+  port : TXvPortID;
+  d : TDrawable;
+  gc : TGC;
+  vx,
+  vy : cint;
+  vw,
+  vh : cuint;
+  dx,
+  dy : cint;
+  dw,
+  dh : cuint
+) : cint; cdecl; external libXv;
+
+function XvPutStill(
+  display : PDisplay;
+  port : TXvPortID;
+  d : TDrawable;
+  gc : TGC;
+  vx,
+  vy : cint;
+  vw,
+  vh : cuint;
+  dx,
+  dy : cint;
+  dw,
+  dh : cuint
+) : cint; cdecl; external libXv;
+
+function XvGetVideo(
+  display : PDisplay;
+  port : TXvPortID;
+  d : TDrawable;
+  gc : TGC;
+  vx,
+  vy : cint;
+  vw,
+  vh : cuint;
+  dx,
+  dy : cint;
+  dw,
+  dh : cuint
+) : cint; cdecl; external libXv;
+
+function XvGetStill(
+  display : PDisplay;
+  port : TXvPortID;
+  d : TDrawable;
+  gc : TGC;
+  vx,
+  vy : cint;
+  vw,
+  vh : cuint;
+  dx,
+  dy : cint;
+  dw,
+  dh : cuint
+) : cint; cdecl; external libXv;
+
+function XvStopVideo(
+  display : PDisplay;
+  port : TXvPortID;
+  drawable : TDrawable
+) : cint; cdecl; external libXv;
+
+function XvGrabPort(
+  display : PDisplay;
+  port : TXvPortID;
+  time : TTime
+) : cint; cdecl; external libXv;
+
+function XvUngrabPort(
+  display : PDisplay;
+  port : TXvPortID;
+  time : TTime
+) : cint; cdecl; external libXv;
+
+function XvSelectVideoNotify(
+  display : PDisplay;
+  drawable : TDrawable;
+  onoff : TBool
+) : cint; cdecl; external libXv;
+
+function XvSelectPortNotify(
+  display : PDisplay;
+  port : TXvPortID;
+  onoff : TBool
+) : cint; cdecl; external libXv;
+
+function XvSetPortAttribute(
+  display : PDisplay;
+  port : TXvPortID;
+  attribute : TAtom;
+  value : cint
+) : cint; cdecl; external libXv;
+
+function XvGetPortAttribute(
+  display : PDisplay;
+  port : TXvPortID;
+  attribute : TAtom;
+  p_value : pcint
+) : cint; cdecl; external libXv;
+
+function XvQueryBestSize(
+  display : PDisplay;
+  port : TXvPortID;
+  motion : TBool;
+  vid_w,
+  vid_h,
+  drw_w,
+  drw_h : cuint;
+  p_actual_width,
+  p_actual_height : pcuint
+) : cint; cdecl; external libXv;
+
+function XvQueryPortAttributes(
+  display : PDisplay;
+  port : TXvPortID;
+  number : pcint
+) : PXvAttribute; cdecl; external libXv;
+
+
+procedure XvFreeAdaptorInfo(
+  adaptors : PXvAdaptorInfo
+); cdecl; external libXv;
+
+procedure XvFreeEncodingInfo(
+  encodings : PXvEncodingInfo
+); cdecl; external libXv;
+
+
+function XvListImageFormats (
+  display : PDisplay;
+  port_id : TXvPortID;
+  count_return : pcint
+) : PXvImageFormatValues; cdecl; external libXv;
+
+function XvCreateImage (
+  display : PDisplay;
+  port : TXvPortID;
+  id : cint;
+  data : pcchar;
+  width,
+  height : cint
+) : PXvImage; cdecl; external libXv;
+
+function XvPutImage (
+  display : PDisplay;
+  id : TXvPortID;
+  d : TDrawable;
+  gc : TGC;
+  image : PXvImage;
+  src_x,
+  src_y : cint;
+  src_w,
+  src_h : cuint;
+  dest_x,
+  dest_y : cint;
+  dest_w,
+  dest_h : cuint
+) : cint; cdecl; external libXv;
+
+function XvShmPutImage (
+  display : PDisplay;
+  id : TXvPortID;
+  d : TDrawable;
+  gc : TGC;
+  image : PXvImage;
+  src_x,
+  src_y : cint;
+  src_w,
+  src_h : cuint;
+  dest_x,
+  dest_y : cint;
+  dest_w,
+  dest_h : cuint;
+  send_event : TBool
+) : cint; cdecl; external libXv;
+
+function XvShmCreateImage(
+  display : PDisplay;
+  port : TXvPortID;
+  id : cint;
+  data : pcchar;
+  width,
+  height : cint;
+  shminfo : PXShmSegmentInfo
+) : PXvImage; cdecl; external libXv;
+
+implementation
+
+end.