*** empty log message ***
authorroot <root>
Tue, 17 Jan 2006 09:07:05 +0000 (09:07 +0000)
committerroot <root>
Tue, 17 Jan 2006 09:07:05 +0000 (09:07 +0000)
26 files changed:
W11/Makefile.in [deleted file]
W11/Makefile.xpm [deleted file]
W11/X11/Intrinsic.h [deleted file]
W11/X11/Xatom.h [deleted file]
W11/X11/Xlib.h [deleted file]
W11/X11/Xlocale.h [deleted file]
W11/X11/Xmd.h [deleted file]
W11/X11/Xutil.h [deleted file]
W11/X11/cursorfont.h [deleted file]
W11/X11/keysym.h [deleted file]
W11/X11/keysymdef.h [deleted file]
W11/w32/Makefile [deleted file]
W11/w32/event.c [deleted file]
W11/w32/ntdef.h [deleted file]
W11/w32/ntutil.c [deleted file]
W11/w32/xlib.c [deleted file]
W11/wrap/Makefile [deleted file]
W11/wrap/mkproxy.pl [deleted file]
W11/wrap/rxtv.ico [deleted file]
W11/wrap/rxvt.ico [deleted file]
W11/wrap/rxvt.rc [deleted file]
W11/wrap/wrap.c [deleted file]
W11/wrap/wrap.h [deleted file]
W11/wrap/xwrappers.gen [deleted file]
autoconf/config.h.in
configure

diff --git a/W11/Makefile.in b/W11/Makefile.in
deleted file mode 100644 (file)
index f8cea8e..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-
-DATE=@DATE@
-VERSION=@VERSION@
-RXVTNAME=@RXVTNAME@
-SHELL = /bin/sh
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-bindir = @bindir@
-libdir = @libdir@
-includedir = @includedir@
-man1dir = @mandir@/man1
-man1ext = 1
-man3dir = @mandir@/man3
-man3ext = 3
-man7dir = @mandir@/man7
-man7ext = 7
-CC = @CC@
-CXX = @CXX@
-CPP = @CPP@
-MV = @MV@
-RM = @RM@
-RMF = @RM@ -f
-CP = @CP@
-LN = @LN@
-SED = @SED@
-AWK = @AWK@
-ECHO = @ECHO@
-CMP = @CMP@
-TBL = @TBL@
-PERL = @PERL@
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL@ -m 755
-INSTALL_DATA = @INSTALL@ -m 644
-CXXFLAGS = @CXXFLAGS@ 
-CPPFLAGS = @CPPFLAGS@ @XPM_CPPFLAGS@
-LDFLAGS = @LDFLAGS@
-DEFS = @DEFS@
-LIBS = @LIBS@
-DINCLUDE = @DINCLUDE@
-DLIB = @DLIB@
-XINC = @X_CFLAGS@ @XPM_CFLAGS@
-XLIB = @X_LIBS@ @XPM_LIBS@ -lX11 @X_EXTRA_LIBS@
-COMPILE = $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) $(DEBUG) $(DINCLUDE) $(XINC) -I$(basedir) -I$(srcdir) -I.
-LINK = @LINKER@ $(LDFLAGS)
-
-srcdir =       @srcdir@
-VPATH =                @srcdir@
-.PATH:         @srcdir@
-
-top_builddir = ..
-basedir = ..
-thisdir = W11
-XPMDIR=xpm-3.4k
-MKDIR = @top_srcdir@/autoconf/mkinstalldirs
-
-first_rule: all
-
-all allbin alldoc:
-       -mkdir lib
-       cd wrap; make $@
-       cd w32; make $@
-       if test -d $(XPMDIR); then make -f Makefile.xpm; fi
-
-tags clean:
-       cd wrap; make $@
-       cd w32; make $@
-       if test -d $(XPMDIR); then make -f Makefile.xpm $@; fi
-
-realclean: clean
-
-cleandir: realclean
-
-install:
-       $(INSTALL_PROGRAM) lib/libW11.dll $(bindir)/libW11.dll
-
-#
-# Distribution variables
-#
-
-DIST = Makefile.in Makefile.xpm
-DISTX11 = X11/Intrinsic.h X11/Xatom.h X11/Xlib.h X11/Xlocale.h X11/Xmd.h \
-       X11/Xutil.h X11/cursorfont.h X11/keysym.h X11/keysymdef.h
-DISTw32 = w32/Makefile w32/event.c w32/ntdef.h w32/ntutil.c w32/xlib.c
-DISTwrap = wrap/Makefile wrap/mkproxy.pl wrap/rxtv.ico wrap/rxvt.ico \
-       wrap/rxvt.rc wrap/wrap.c wrap/wrap.h wrap/xwrappers.gen
-
-distclean: realclean
-       if test $(srcdir) = .; then $(MAKE) realclean; fi
-       (cd $(srcdir); $(RMF) Makefile)
-
-distdirs:
-       mkdir $(basedir)/../$(VERNAME)/$(thisdir)
-       mkdir $(basedir)/../$(VERNAME)/$(thisdir)/X11
-       mkdir $(basedir)/../$(VERNAME)/$(thisdir)/w32
-       mkdir $(basedir)/../$(VERNAME)/$(thisdir)/wrap
-
-distcopy:
-       $(CP) -p $(DIST) $(basedir)/../$(VERNAME)/$(thisdir)
-       $(CP) -p $(DISTX11) $(basedir)/../$(VERNAME)/$(thisdir)/X11
-       $(CP) -p $(DISTw32) $(basedir)/../$(VERNAME)/$(thisdir)/w32
-       $(CP) -p $(DISTwrap) $(basedir)/../$(VERNAME)/$(thisdir)/wrap
diff --git a/W11/Makefile.xpm b/W11/Makefile.xpm
deleted file mode 100644 (file)
index 4da06a5..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-first_rule: all
-
-all allbin alldoc:
-       -mkdir lib
-       cd xpm-3.4k/lib; make -f Makefile.noX CC=gcc INCLUDES=-I../.. DESTLIBDIR=../../lib DESTINCLUDEDIR=../../X11 all install
-
-tags clean:
-       cd xpm-3.4k/lib; make -f Makefile.noX $@
diff --git a/W11/X11/Intrinsic.h b/W11/X11/Intrinsic.h
deleted file mode 100644 (file)
index 7d6a67a..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#include <X11/xlib.h>
-
diff --git a/W11/X11/Xatom.h b/W11/X11/Xatom.h
deleted file mode 100644 (file)
index 485a423..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-#ifndef XATOM_H
-#define XATOM_H 1
-
-/* THIS IS A GENERATED FILE
- *
- * Do not change!  Changing this file implies a protocol change!
- */
-
-#define XA_PRIMARY ((Atom) 1)
-#define XA_SECONDARY ((Atom) 2)
-#define XA_ARC ((Atom) 3)
-#define XA_ATOM ((Atom) 4)
-#define XA_BITMAP ((Atom) 5)
-#define XA_CARDINAL ((Atom) 6)
-#define XA_COLORMAP ((Atom) 7)
-#define XA_CURSOR ((Atom) 8)
-#define XA_CUT_BUFFER0 ((Atom) 9)
-#define XA_CUT_BUFFER1 ((Atom) 10)
-#define XA_CUT_BUFFER2 ((Atom) 11)
-#define XA_CUT_BUFFER3 ((Atom) 12)
-#define XA_CUT_BUFFER4 ((Atom) 13)
-#define XA_CUT_BUFFER5 ((Atom) 14)
-#define XA_CUT_BUFFER6 ((Atom) 15)
-#define XA_CUT_BUFFER7 ((Atom) 16)
-#define XA_DRAWABLE ((Atom) 17)
-#define XA_FONT ((Atom) 18)
-#define XA_INTEGER ((Atom) 19)
-#define XA_PIXMAP ((Atom) 20)
-#define XA_POINT ((Atom) 21)
-#define XA_RECTANGLE ((Atom) 22)
-#define XA_RESOURCE_MANAGER ((Atom) 23)
-#define XA_RGB_COLOR_MAP ((Atom) 24)
-#define XA_RGB_BEST_MAP ((Atom) 25)
-#define XA_RGB_BLUE_MAP ((Atom) 26)
-#define XA_RGB_DEFAULT_MAP ((Atom) 27)
-#define XA_RGB_GRAY_MAP ((Atom) 28)
-#define XA_RGB_GREEN_MAP ((Atom) 29)
-#define XA_RGB_RED_MAP ((Atom) 30)
-#define XA_STRING ((Atom) 31)
-#define XA_VISUALID ((Atom) 32)
-#define XA_WINDOW ((Atom) 33)
-#define XA_WM_COMMAND ((Atom) 34)
-#define XA_WM_HINTS ((Atom) 35)
-#define XA_WM_CLIENT_MACHINE ((Atom) 36)
-#define XA_WM_ICON_NAME ((Atom) 37)
-#define XA_WM_ICON_SIZE ((Atom) 38)
-#define XA_WM_NAME ((Atom) 39)
-#define XA_WM_NORMAL_HINTS ((Atom) 40)
-#define XA_WM_SIZE_HINTS ((Atom) 41)
-#define XA_WM_ZOOM_HINTS ((Atom) 42)
-#define XA_MIN_SPACE ((Atom) 43)
-#define XA_NORM_SPACE ((Atom) 44)
-#define XA_MAX_SPACE ((Atom) 45)
-#define XA_END_SPACE ((Atom) 46)
-#define XA_SUPERSCRIPT_X ((Atom) 47)
-#define XA_SUPERSCRIPT_Y ((Atom) 48)
-#define XA_SUBSCRIPT_X ((Atom) 49)
-#define XA_SUBSCRIPT_Y ((Atom) 50)
-#define XA_UNDERLINE_POSITION ((Atom) 51)
-#define XA_UNDERLINE_THICKNESS ((Atom) 52)
-#define XA_STRIKEOUT_ASCENT ((Atom) 53)
-#define XA_STRIKEOUT_DESCENT ((Atom) 54)
-#define XA_ITALIC_ANGLE ((Atom) 55)
-#define XA_X_HEIGHT ((Atom) 56)
-#define XA_QUAD_WIDTH ((Atom) 57)
-#define XA_WEIGHT ((Atom) 58)
-#define XA_POINT_SIZE ((Atom) 59)
-#define XA_RESOLUTION ((Atom) 60)
-#define XA_COPYRIGHT ((Atom) 61)
-#define XA_NOTICE ((Atom) 62)
-#define XA_FONT_NAME ((Atom) 63)
-#define XA_FAMILY_NAME ((Atom) 64)
-#define XA_FULL_NAME ((Atom) 65)
-#define XA_CAP_HEIGHT ((Atom) 66)
-#define XA_WM_CLASS ((Atom) 67)
-#define XA_WM_TRANSIENT_FOR ((Atom) 68)
-
-#define XA_LAST_PREDEFINED ((Atom) 68)
-#endif /* XATOM_H */
diff --git a/W11/X11/Xlib.h b/W11/X11/Xlib.h
deleted file mode 100644 (file)
index d512816..0000000
+++ /dev/null
@@ -1,2246 +0,0 @@
-/* 
-
-Copyright 1985, 1986, 1987, 1991, 1998  The Open Group
-
-All Rights Reserved.
-
-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.
-
-*/
-
-#ifndef __XLIB_H
-#define __XLIB_H
-
-/* typedef struct _XrmHashBucketRec; */
-typedef unsigned long Atom;
-typedef unsigned long Time;
-typedef unsigned long XID;
-
-#ifndef Bool
-#define Bool int
-#endif
-
-typedef int BoolDef;
-
-typedef XID Window;
-typedef XID Drawable;
-typedef XID Font;
-typedef XID Pixmap;
-typedef XID Cursor;
-typedef XID Colormap;
-typedef XID KeySym;
-typedef XID GContext;
-
-typedef unsigned char KeyCode;
-
-typedef char *XPointer;
-typedef unsigned long VisualID;
-
-#define PIXEL_ALREADY_TYPEDEFED
-typedef unsigned long Pixel;
-
-#define XDestroyImage(ximage) \
-       ((*((ximage)->f.destroy_image))((ximage)))
-#define XPutPixel(ximage, x, y, pixel) \
-       ((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel)))
-
-#define AllPlanes              ((unsigned long)~0L)
-#define ScreenOfDisplay(dpy, scr)(&((_XPrivDisplay)dpy)->screens[scr])
-#define DefaultVisual(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_visual)
-#define DefaultDepth(dpy, scr)         (ScreenOfDisplay(dpy,scr)->root_depth)
-#define DefaultColormap(dpy, scr)(ScreenOfDisplay(dpy,scr)->cmap)
-#define DefaultScreen(dpy)     (((_XPrivDisplay)dpy)->default_screen)
-#define BlackPixel(dpy, scr)   (ScreenOfDisplay(dpy,scr)->black_pixel)
-#define WhitePixel(dpy, scr)   (ScreenOfDisplay(dpy,scr)->white_pixel)
-#define RootWindow(dpy, scr)   (ScreenOfDisplay(dpy,scr)->root)
-#define DefaultRootWindow(dpy)         (ScreenOfDisplay(dpy,DefaultScreen(dpy))->root)
-#define DisplayWidth(dpy, scr)         (ScreenOfDisplay(dpy,scr)->width)
-#define DisplayHeight(dpy, scr) (ScreenOfDisplay(dpy,scr)->height)
-
-#ifndef None
-#define None                 0L        /* universal null resource or null atom */
-#endif
-
-#define ParentRelative       1L        
-#define CopyFromParent       0L        
-#define PointerWindow        0L        /* destination window in SendEvent */
-#define InputFocus           1L        /* destination window in SendEvent */
-#define PointerRoot          1L        /* focus window in SetInputFocus */
-#define AnyPropertyType      0L        /* special Atom, passed to GetProperty */
-#define AnyKey              0L /* special Key Code, passed to GrabKey */
-#define AnyButton            0L        /* special Button Code, passed to GrabButton */
-#define AllTemporary         0L        /* special Resource ID passed to KillClient */
-#define CurrentTime          0L        /* special Time */
-#define NoSymbol            0L /* special KeySym */
-#define NoEventMask                    0L
-#define KeyPressMask                   (1L<<0)  
-#define KeyReleaseMask                 (1L<<1)  
-#define ButtonPressMask                        (1L<<2)  
-#define ButtonReleaseMask              (1L<<3)  
-#define EnterWindowMask                        (1L<<4)  
-#define LeaveWindowMask                        (1L<<5)  
-#define PointerMotionMask              (1L<<6)  
-#define PointerMotionHintMask          (1L<<7)  
-#define Button1MotionMask              (1L<<8)  
-#define Button2MotionMask              (1L<<9)  
-#define Button3MotionMask              (1L<<10) 
-#define Button4MotionMask              (1L<<11) 
-#define Button5MotionMask              (1L<<12) 
-#define ButtonMotionMask               (1L<<13) 
-#define KeymapStateMask                        (1L<<14)
-#define ExposureMask                   (1L<<15) 
-#define VisibilityChangeMask           (1L<<16) 
-#define StructureNotifyMask            (1L<<17) 
-#define ResizeRedirectMask             (1L<<18) 
-#define SubstructureNotifyMask         (1L<<19) 
-#define SubstructureRedirectMask       (1L<<20) 
-#define FocusChangeMask                        (1L<<21) 
-#define PropertyChangeMask             (1L<<22) 
-#define ColormapChangeMask             (1L<<23) 
-#define OwnerGrabButtonMask            (1L<<24) 
-#define KeyPress               2
-#define KeyRelease             3
-#define ButtonPress            4
-#define ButtonRelease          5
-#define MotionNotify           6
-#define EnterNotify            7
-#define LeaveNotify            8
-#define FocusIn                        9
-#define FocusOut               10
-#define KeymapNotify           11
-#define Expose                 12
-#define GraphicsExpose         13
-#define NoExpose               14
-#define VisibilityNotify       15
-#define CreateNotify           16
-#define DestroyNotify          17
-#define UnmapNotify            18
-#define MapNotify              19
-#define MapRequest             20
-#define ReparentNotify         21
-#define ConfigureNotify                22
-#define ConfigureRequest       23
-#define GravityNotify          24
-#define ResizeRequest          25
-#define CirculateNotify                26
-#define CirculateRequest       27
-#define PropertyNotify         28
-#define SelectionClear         29
-#define SelectionRequest       30
-#define SelectionNotify                31
-#define ColormapNotify         32
-#define ClientMessage          33
-#define MappingNotify          34
-#define LASTEvent              35      /* must be bigger than any event # */
-#define ShiftMask              (1<<0)
-#define LockMask               (1<<1)
-#define ControlMask            (1<<2)
-#define Mod1Mask               (1<<3)
-#define Mod2Mask               (1<<4)
-#define Mod3Mask               (1<<5)
-#define Mod4Mask               (1<<6)
-#define Mod5Mask               (1<<7)
-#define ShiftMapIndex          0
-#define LockMapIndex           1
-#define ControlMapIndex                2
-#define Mod1MapIndex           3
-#define Mod2MapIndex           4
-#define Mod3MapIndex           5
-#define Mod4MapIndex           6
-#define Mod5MapIndex           7
-#define Button1Mask            (1<<8)
-#define Button2Mask            (1<<9)
-#define Button3Mask            (1<<10)
-#define Button4Mask            (1<<11)
-#define Button5Mask            (1<<12)
-#define AnyModifier            (1<<15)  /* used in GrabButton, GrabKey */
-#define Button1                        1
-#define Button2                        2
-#define Button3                        3
-#define Button4                        4
-#define Button5                        5
-#define NotifyNormal           0
-#define NotifyGrab             1
-#define NotifyUngrab           2
-#define NotifyWhileGrabbed     3
-#define NotifyHint             1       /* for MotionNotify events */
-#define NotifyAncestor         0
-#define NotifyVirtual          1
-#define NotifyInferior         2
-#define NotifyNonlinear                3
-#define NotifyNonlinearVirtual 4
-#define NotifyPointer          5
-#define NotifyPointerRoot      6
-#define NotifyDetailNone       7
-#define VisibilityUnobscured           0
-#define VisibilityPartiallyObscured    1
-#define VisibilityFullyObscured                2
-#define PlaceOnTop             0
-#define PlaceOnBottom          1
-#define FamilyInternet         0
-#define FamilyDECnet           1
-#define FamilyChaos            2
-#define PropertyNewValue       0
-#define PropertyDelete         1
-#define ColormapUninstalled    0
-#define ColormapInstalled      1
-#define GrabModeSync           0
-#define GrabModeAsync          1
-#define GrabSuccess            0
-#define AlreadyGrabbed         1
-#define GrabInvalidTime                2
-#define GrabNotViewable                3
-#define GrabFrozen             4
-#define AsyncPointer           0
-#define SyncPointer            1
-#define ReplayPointer          2
-#define AsyncKeyboard          3
-#define SyncKeyboard           4
-#define ReplayKeyboard         5
-#define AsyncBoth              6
-#define SyncBoth               7
-#define RevertToNone           (int)None
-#define RevertToPointerRoot    (int)PointerRoot
-#define RevertToParent         2
-#define Success                   0    /* everything's okay */
-#define BadRequest        1    /* bad request code */
-#define BadValue          2    /* int parameter out of range */
-#define BadWindow         3    /* parameter not a Window */
-#define BadPixmap         4    /* parameter not a Pixmap */
-#define BadAtom                   5    /* parameter not an Atom */
-#define BadCursor         6    /* parameter not a Cursor */
-#define BadFont                   7    /* parameter not a Font */
-#define BadMatch          8    /* parameter mismatch */
-#define BadDrawable       9    /* parameter not a Pixmap or Window */
-#define BadAccess        10   
-#define BadAlloc         11    /* insufficient resources */
-#define BadColor         12    /* no such colormap */
-#define BadGC            13    /* parameter not a GC */
-#define BadIDChoice      14    /* choice not in range or already used */
-#define BadName                  15    /* font or color name doesn't exist */
-#define BadLength        16    /* Request length incorrect */
-#define BadImplementation 17   /* server is defective */
-#define FirstExtensionError    128
-#define LastExtensionError     255
-#define InputOutput            1
-#define InputOnly              2
-#define CWBackPixmap           (1L<<0)
-#define CWBackPixel            (1L<<1)
-#define CWBorderPixmap         (1L<<2)
-#define CWBorderPixel           (1L<<3)
-#define CWBitGravity           (1L<<4)
-#define CWWinGravity           (1L<<5)
-#define CWBackingStore          (1L<<6)
-#define CWBackingPlanes                (1L<<7)
-#define CWBackingPixel         (1L<<8)
-#define CWOverrideRedirect     (1L<<9)
-#define CWSaveUnder            (1L<<10)
-#define CWEventMask            (1L<<11)
-#define CWDontPropagate                (1L<<12)
-#define CWColormap             (1L<<13)
-#define CWCursor               (1L<<14)
-#define CWX                    (1<<0)
-#define CWY                    (1<<1)
-#define CWWidth                        (1<<2)
-#define CWHeight               (1<<3)
-#define CWBorderWidth          (1<<4)
-#define CWSibling              (1<<5)
-#define CWStackMode            (1<<6)
-#define ForgetGravity          0
-#define NorthWestGravity       1
-#define NorthGravity           2
-#define NorthEastGravity       3
-#define WestGravity            4
-#define CenterGravity          5
-#define EastGravity            6
-#define SouthWestGravity       7
-#define SouthGravity           8
-#define SouthEastGravity       9
-#define StaticGravity          10
-#define UnmapGravity           0
-#define NotUseful               0
-#define WhenMapped              1
-#define Always                  2
-#define IsUnmapped             0
-#define IsUnviewable           1
-#define IsViewable             2
-#define SetModeInsert           0
-#define SetModeDelete           1
-#define DestroyAll              0
-#define RetainPermanent         1
-#define RetainTemporary         2
-#define Above                   0
-#define Below                   1
-#define TopIf                   2
-#define BottomIf                3
-#define Opposite                4
-#define RaiseLowest             0
-#define LowerHighest            1
-#define PropModeReplace         0
-#define PropModePrepend         1
-#define PropModeAppend          2
-#define        GXclear                 0x0             /* 0 */
-#define GXand                  0x1             /* src AND dst */
-#define GXandReverse           0x2             /* src AND NOT dst */
-#define GXcopy                 0x3             /* src */
-#define GXandInverted          0x4             /* NOT src AND dst */
-#define        GXnoop                  0x5             /* dst */
-#define GXxor                  0x6             /* src XOR dst */
-#define GXor                   0x7             /* src OR dst */
-#define GXnor                  0x8             /* NOT src AND NOT dst */
-#define GXequiv                        0x9             /* NOT src XOR dst */
-#define GXinvert               0xa             /* NOT dst */
-#define GXorReverse            0xb             /* src OR NOT dst */
-#define GXcopyInverted         0xc             /* NOT src */
-#define GXorInverted           0xd             /* NOT src OR dst */
-#define GXnand                 0xe             /* NOT src OR NOT dst */
-#define GXset                  0xf             /* 1 */
-#define LineSolid              0
-#define LineOnOffDash          1
-#define LineDoubleDash         2
-#define CapNotLast             0
-#define CapButt                        1
-#define CapRound               2
-#define CapProjecting          3
-#define JoinMiter              0
-#define JoinRound              1
-#define JoinBevel              2
-#define FillSolid              0
-#define FillTiled              1
-#define FillStippled           2
-#define FillOpaqueStippled     3
-#define EvenOddRule            0
-#define WindingRule            1
-#define ClipByChildren         0
-#define IncludeInferiors       1
-#define Unsorted               0
-#define YSorted                        1
-#define YXSorted               2
-#define YXBanded               3
-#define CoordModeOrigin                0       /* relative to the origin */
-#define CoordModePrevious       1      /* relative to previous point */
-#define Complex                        0       /* paths may intersect */
-#define Nonconvex              1       /* no paths intersect, but not convex */
-#define Convex                 2       /* wholly convex */
-#define ArcChord               0       /* join endpoints of arc */
-#define ArcPieSlice            1       /* join endpoints to center of arc */
-#define GCFunction              (1L<<0)
-#define GCPlaneMask             (1L<<1)
-#define GCForeground            (1L<<2)
-#define GCBackground            (1L<<3)
-#define GCLineWidth             (1L<<4)
-#define GCLineStyle             (1L<<5)
-#define GCCapStyle              (1L<<6)
-#define GCJoinStyle            (1L<<7)
-#define GCFillStyle            (1L<<8)
-#define GCFillRule             (1L<<9) 
-#define GCTile                 (1L<<10)
-#define GCStipple              (1L<<11)
-#define GCTileStipXOrigin      (1L<<12)
-#define GCTileStipYOrigin      (1L<<13)
-#define GCFont                         (1L<<14)
-#define GCSubwindowMode                (1L<<15)
-#define GCGraphicsExposures     (1L<<16)
-#define GCClipXOrigin          (1L<<17)
-#define GCClipYOrigin          (1L<<18)
-#define GCClipMask             (1L<<19)
-#define GCDashOffset           (1L<<20)
-#define GCDashList             (1L<<21)
-#define GCArcMode              (1L<<22)
-#define GCLastBit              22
-#define FontLeftToRight                0
-#define FontRightToLeft                1
-#define FontChange             255
-#define XYBitmap               0       /* depth 1, XYFormat */
-#define XYPixmap               1       /* depth == drawable depth */
-#define ZPixmap                        2       /* depth == drawable depth */
-#define AllocNone              0       /* create map with no entries */
-#define AllocAll               1       /* allocate entire map writeable */
-#define DoRed                  (1<<0)
-#define DoGreen                        (1<<1)
-#define DoBlue                 (1<<2)
-#define CursorShape            0       /* largest size that can be displayed */
-#define TileShape              1       /* size tiled fastest */
-#define StippleShape           2       /* size stippled fastest */
-#define AutoRepeatModeOff      0
-#define AutoRepeatModeOn       1
-#define AutoRepeatModeDefault  2
-#define LedModeOff             0
-#define LedModeOn              1
-#define KBKeyClickPercent      (1L<<0)
-#define KBBellPercent          (1L<<1)
-#define KBBellPitch            (1L<<2)
-#define KBBellDuration         (1L<<3)
-#define KBLed                  (1L<<4)
-#define KBLedMode              (1L<<5)
-#define KBKey                  (1L<<6)
-#define KBAutoRepeatMode       (1L<<7)
-#define MappingSuccess         0
-#define MappingBusy            1
-#define MappingFailed          2
-#define MappingModifier                0
-#define MappingKeyboard                1
-#define MappingPointer         2
-#define DontPreferBlanking     0
-#define PreferBlanking         1
-#define DefaultBlanking                2
-#define DisableScreenSaver     0
-#define DisableScreenInterval  0
-#define DontAllowExposures     0
-#define AllowExposures         1
-#define DefaultExposures       2
-#define ScreenSaverReset 0
-#define ScreenSaverActive 1
-#define HostInsert             0
-#define HostDelete             1
-#define EnableAccess           1      
-#define DisableAccess          0
-#define StaticGray             0
-#define GrayScale              1
-#define StaticColor            2
-#define PseudoColor            3
-#define TrueColor              4
-#define DirectColor            5
-#define LSBFirst               0
-#define MSBFirst               1
-
-#define True 1
-#define False 0
-
-#define XK_Alt_L               0xFFE9  /* Left alt */
-
-#define XK_BackSpace           0xFF08  /* back space, back char */
-#define XK_Tab                 0xFF09
-#define XK_Linefeed            0xFF0A  /* Linefeed, LF */
-#define XK_Clear               0xFF0B
-#define XK_Return              0xFF0D  /* Return, enter */
-#define XK_Pause               0xFF13  /* Pause, hold */
-#define XK_Scroll_Lock         0xFF14
-#define XK_Sys_Req             0xFF15
-#define XK_Escape              0xFF1B
-#define XK_Delete              0xFFFF  /* Delete, rubout */
-
-#define XK_Home                        0xFF50
-#define XK_Left                        0xFF51  /* Move left, left arrow */
-#define XK_Up                  0xFF52  /* Move up, up arrow */
-#define XK_Right               0xFF53  /* Move right, right arrow */
-#define XK_Down                        0xFF54  /* Move down, down arrow */
-#define XK_Prior               0xFF55  /* Prior, previous */
-#define XK_Page_Up             0xFF55
-#define XK_Next                        0xFF56  /* Next */
-#define XK_Page_Down           0xFF56
-#define XK_End                 0xFF57  /* EOL */
-#define XK_Begin               0xFF58  /* BOL */
-
-#define XK_Select              0xFF60  /* Select, mark */
-#define XK_Print               0xFF61
-#define XK_Execute             0xFF62  /* Execute, run, do */
-#define XK_Insert              0xFF63  /* Insert, insert here */
-#define XK_Undo                        0xFF65  /* Undo, oops */
-#define XK_Redo                        0xFF66  /* redo, again */
-#define XK_Menu                        0xFF67
-#define XK_Find                        0xFF68  /* Find, search */
-#define XK_Cancel              0xFF69  /* Cancel, stop, abort, exit */
-#define XK_Help                        0xFF6A  /* Help */
-#define XK_Break               0xFF6B
-#define XK_Mode_switch         0xFF7E  /* Character set switch */
-#define XK_script_switch        0xFF7E  /* Alias for mode_switch */
-#define XK_Num_Lock            0xFF7F
-
-#define XK_F1                  0xFFBE
-#define XK_F2                  0xFFBF
-#define XK_F3                  0xFFC0
-#define XK_F4                  0xFFC1
-#define XK_F5                  0xFFC2
-#define XK_F6                  0xFFC3
-#define XK_F7                  0xFFC4
-#define XK_F8                  0xFFC5
-#define XK_F9                  0xFFC6
-#define XK_F10                 0xFFC7
-#define XK_F11                 0xFFC8
-#define XK_L1                  0xFFC8
-#define XK_F12                 0xFFC9
-
-#define VisualNoMask           0x0
-#define VisualIDMask           0x1
-#define VisualScreenMask       0x2
-#define VisualDepthMask                0x4
-#define VisualClassMask                0x8
-#define VisualRedMaskMask      0x10
-#define VisualGreenMaskMask    0x20
-#define VisualBlueMaskMask     0x40
-#define VisualColormapSizeMask 0x80
-#define VisualBitsPerRGBMask   0x100
-#define VisualAllMask          0x1FF
-
-#define USPosition     (1L << 0) /* user specified x, y */
-#define USSize         (1L << 1) /* user specified width, height */
-
-#define PPosition      (1L << 2) /* program specified position */
-#define PSize          (1L << 3) /* program specified size */
-#define PMinSize       (1L << 4) /* program specified minimum size */
-#define PMaxSize       (1L << 5) /* program specified maximum size */
-#define PResizeInc     (1L << 6) /* program specified resize increments */
-#define PAspect                (1L << 7) /* program specified min and max aspect ratios */
-#define PBaseSize      (1L << 8) /* program specified base for incrementing */
-#define PWinGravity    (1L << 9) /* program specified window gravity */
-
-#define NoValue                0x0000
-#define XValue         0x0001
-#define YValue         0x0002
-#define WidthValue     0x0004
-#define HeightValue    0x0008
-#define AllValues      0x000F
-#define XNegative      0x0010
-#define YNegative      0x0020
-
-#define XNoMemory -1
-#define XLocaleNotSupported -2
-#define XConverterNotFound -3
-
-#define LC_CTYPE 2
-
-/* used by rxvt/src/main.c */
-#define NormalState 1
-#define IconicState 3
-#define InputHint (1L << 0)
-#define StateHint (1L << 1)
-#define IconWindowHint (1L << 3)
-#define WindowGroupHint (1L << 6)
-#define XC_left_ptr 68
-#define XC_xterm 152
-
-typedef struct _XRegion *Region;
-typedef struct _XOC *XOC, *XFontSet;
-
-typedef struct _XExtData {
-       int number;             /* number returned by XRegisterExtension */
-       struct _XExtData *next; /* next item on list of data for structure */
-       int (*free_private)(    /* called to free private storage */
-       struct _XExtData *extension
-       );
-       XPointer private_data;  /* data private to this extension. */
-} XExtData;
-
-typedef struct {               /* public to extension, cannot be changed */
-       int extension;          /* extension number */
-       int major_opcode;       /* major op-code assigned by server */
-       int first_event;        /* first event number for the extension */
-       int first_error;        /* first error number for the extension */
-} XExtCodes;
-
-typedef struct {
-       XExtData *ext_data;     /* hook for extension to hang data */
-       VisualID visualid;      /* visual id of this visual */
-#if defined(__cplusplus) || defined(c_plusplus)
-       int c_class;            /* C++ class of screen (monochrome, etc.) */
-#else
-       int class;              /* class of screen (monochrome, etc.) */
-#endif
-       unsigned long red_mask, green_mask, blue_mask;  /* mask values */
-       int bits_per_rgb;       /* log base 2 of distinct color values */
-       int map_entries;        /* color map entries */
-} Visual;
-
-typedef struct {
-       int depth;              /* this depth (Z) of the depth */
-       int nvisuals;           /* number of Visual types at this depth */
-       Visual *visuals;        /* list of visuals possible at this depth */
-} Depth;
-
-typedef struct {
-       int function;           /* logical operation */
-       unsigned long plane_mask;/* plane mask */
-       unsigned long foreground;/* foreground pixel */
-       unsigned long background;/* background pixel */
-       int line_width;         /* line width */
-       int line_style;         /* LineSolid, LineOnOffDash, LineDoubleDash */
-       int cap_style;          /* CapNotLast, CapButt, 
-                                  CapRound, CapProjecting */
-       int join_style;         /* JoinMiter, JoinRound, JoinBevel */
-       int fill_style;         /* FillSolid, FillTiled, 
-                                  FillStippled, FillOpaeueStippled */
-       int fill_rule;          /* EvenOddRule, WindingRule */
-       int arc_mode;           /* ArcChord, ArcPieSlice */
-       Pixmap tile;            /* tile pixmap for tiling operations */
-       Pixmap stipple;         /* stipple 1 plane pixmap for stipping */
-       int ts_x_origin;        /* offset for tile or stipple operations */
-       int ts_y_origin;
-        Font font;             /* default text font for text operations */
-       int subwindow_mode;     /* ClipByChildren, IncludeInferiors */
-       BoolDef graphics_exposures;/* boolean, should exposures be generated */
-       int clip_x_origin;      /* origin for clipping */
-       int clip_y_origin;
-       Pixmap clip_mask;       /* bitmap clipping; other calls for rects */
-       int dash_offset;        /* patterned/dashed line information */
-       char dashes;
-} XGCValues;
-
-typedef struct _XGC
-{
-    XExtData *ext_data;        /* hook for extension to hang data */
-    GContext gid;      /* protocol ID for graphics context */
-       int rects;
-       int dashes;
-       XGCValues values;
-       int dirty;
-} *GC;
-
-typedef struct {
-       XExtData *ext_data;     /* hook for extension to hang data */
-       struct _XDisplay *display;/* back pointer to display structure */
-       Window root;            /* Root window id. */
-       int width, height;      /* width and height of screen */
-       int mwidth, mheight;    /* width and height of  in millimeters */
-       int ndepths;            /* number of depths possible */
-       Depth *depths;          /* list of allowable depths on the screen */
-       int root_depth;         /* bits per pixel */
-       Visual *root_visual;    /* root visual */
-       GC default_gc;          /* GC for the root root visual */
-       Colormap cmap;          /* default color map */
-       unsigned long white_pixel;
-       unsigned long black_pixel;      /* White and Black pixel values */
-       int max_maps, min_maps; /* max and min color maps */
-       int backing_store;      /* Never, WhenMapped, Always */
-       BoolDef save_unders;    
-       long root_input_mask;   /* initial root input mask */
-} Screen;
-
-typedef struct {
-       XExtData *ext_data;     /* hook for extension to hang data */
-       int depth;              /* depth of this image format */
-       int bits_per_pixel;     /* bits/pixel at this depth */
-       int scanline_pad;       /* scanline must padded to this multiple */
-} ScreenFormat;
-
-typedef struct _XDisplay
-{
-       XExtData *ext_data;     /* hook for extension to hang data */
-       struct _XPrivate *private1;
-       int fd;                 /* Network socket. */
-       int private2;
-       int proto_major_version;/* major version of server's X protocol */
-       int proto_minor_version;/* minor version of servers X protocol */
-       char *vendor;           /* vendor of the server hardware */
-       XID private3;
-       XID private4;
-       XID private5;
-       int private6;
-       XID (*resource_alloc)(  /* allocator function */
-               struct _XDisplay*
-       );
-       int byte_order;         /* screen byte order, LSBFirst, MSBFirst */
-       int bitmap_unit;        /* padding and data requirements */
-       int bitmap_pad;         /* padding requirements on bitmaps */
-       int bitmap_bit_order;   /* LeastSignificant or MostSignificant */
-       int nformats;           /* number of pixmap formats in list */
-       ScreenFormat *pixmap_format;    /* pixmap format list */
-       int private8;
-       int release;            /* release of the server */
-       struct _XPrivate *private9, *private10;
-       int qlen;               /* Length of input event queue */
-       unsigned long last_request_read; /* seq number of last event read */
-       unsigned long request;  /* sequence number of last request. */
-       XPointer private11;
-       XPointer private12;
-       XPointer private13;
-       XPointer private14;
-       unsigned max_request_size; /* maximum number 32 bit words in request*/
-       struct _XrmHashBucketRec *db;
-       int (*private15)(
-               struct _XDisplay*
-               );
-       char *display_name;     /* "host:display" string used on this connect*/
-       int default_screen;     /* default screen for operations */
-       int nscreens;           /* number of screens on this server*/
-       Screen *screens;        /* pointer to list of screens */
-       unsigned long motion_buffer;    /* size of motion buffer */
-       unsigned long private16;
-       int min_keycode;        /* minimum defined keycode */
-       int max_keycode;        /* maximum defined keycode */
-       XPointer private17;
-       XPointer private18;
-       int private19;
-       char *xdefaults;        /* contents of defaults from server */
-       /* there is more to this structure, but it is private to Xlib */
-}
-Display, *_XPrivDisplay;
-
-typedef int StatusDef;
-
-typedef struct {               /* normal 16 bit characters are two bytes */
-    unsigned char byte1;
-    unsigned char byte2;
-} XChar2b;
-
-typedef struct {
-    short      lbearing;       /* origin to left edge of raster */
-    short      rbearing;       /* origin to right edge of raster */
-    short      width;          /* advance to next char's origin */
-    short      ascent;         /* baseline to top edge of raster */
-    short      descent;        /* baseline to bottom edge of raster */
-    unsigned short attributes; /* per char flags (not predefined) */
-} XCharStruct;
-
-typedef struct {
-       char *res_name;
-       char *res_class;
-} XClassHint;
-
-typedef struct {
-       unsigned long pixel;
-       unsigned short red, green, blue;
-       char flags;  /* do_red, do_green, do_blue */
-       char pad;
-} XColor;
-
-typedef struct _XComposeStatus {
-    XPointer compose_ptr;      /* state table pointer */
-    int chars_matched;         /* match state */
-} XComposeStatus;
-
-/* events --- goes on for a bit */
-typedef struct {
-       int type;               /* of event */
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Window window;          /* "event" window it is reported relative to */
-       Window root;            /* root window that the event occurred on */
-       Window subwindow;       /* child window */
-       Time time;              /* milliseconds */
-       int x, y;               /* pointer x, y coordinates in event window */
-       int x_root, y_root;     /* coordinates relative to root */
-       unsigned int state;     /* key or button mask */
-       unsigned int keycode;   /* detail */
-       BoolDef same_screen;    /* same screen flag */
-} XKeyEvent;
-
-typedef XKeyEvent XKeyPressedEvent;
-typedef XKeyEvent XKeyReleasedEvent;
-
-typedef struct {
-       int type;               /* of event */
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Window window;          /* "event" window it is reported relative to */
-       Window root;            /* root window that the event occurred on */
-       Window subwindow;       /* child window */
-       Time time;              /* milliseconds */
-       int x, y;               /* pointer x, y coordinates in event window */
-       int x_root, y_root;     /* coordinates relative to root */
-       unsigned int state;     /* key or button mask */
-       unsigned int button;    /* detail */
-       BoolDef same_screen;    /* same screen flag */
-} XButtonEvent;
-typedef XButtonEvent XButtonPressedEvent;
-typedef XButtonEvent XButtonReleasedEvent;
-
-typedef struct {
-       int type;               /* of event */
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Window window;          /* "event" window reported relative to */
-       Window root;            /* root window that the event occurred on */
-       Window subwindow;       /* child window */
-       Time time;              /* milliseconds */
-       int x, y;               /* pointer x, y coordinates in event window */
-       int x_root, y_root;     /* coordinates relative to root */
-       unsigned int state;     /* key or button mask */
-       char is_hint;           /* detail */
-       BoolDef same_screen;    /* same screen flag */
-} XMotionEvent;
-typedef XMotionEvent XPointerMovedEvent;
-
-typedef struct {
-       int type;               /* of event */
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Window window;          /* "event" window reported relative to */
-       Window root;            /* root window that the event occurred on */
-       Window subwindow;       /* child window */
-       Time time;              /* milliseconds */
-       int x, y;               /* pointer x, y coordinates in event window */
-       int x_root, y_root;     /* coordinates relative to root */
-       int mode;               /* NotifyNormal, NotifyGrab, NotifyUngrab */
-       int detail;
-       /*
-        * NotifyAncestor, NotifyVirtual, NotifyInferior, 
-        * NotifyNonlinear,NotifyNonlinearVirtual
-        */
-       BoolDef same_screen;    /* same screen flag */
-       BoolDef focus;          /* boolean focus */
-       unsigned int state;     /* key or button mask */
-} XCrossingEvent;
-typedef XCrossingEvent XEnterWindowEvent;
-typedef XCrossingEvent XLeaveWindowEvent;
-
-typedef struct {
-       int type;               /* FocusIn or FocusOut */
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Window window;          /* window of event */
-       int mode;               /* NotifyNormal, NotifyGrab, NotifyUngrab */
-       int detail;
-       /*
-        * NotifyAncestor, NotifyVirtual, NotifyInferior, 
-        * NotifyNonlinear,NotifyNonlinearVirtual, NotifyPointer,
-        * NotifyPointerRoot, NotifyDetailNone 
-        */
-} XFocusChangeEvent;
-typedef XFocusChangeEvent XFocusInEvent;
-typedef XFocusChangeEvent XFocusOutEvent;
-
-/* generated on EnterWindow and FocusIn  when KeyMapState selected */
-typedef struct {
-       int type;
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Window window;
-       char key_vector[32];
-} XKeymapEvent;        
-
-typedef struct {
-       int type;
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Window window;
-       int x, y;
-       int width, height;
-       int count;              /* if non-zero, at least this many more */
-} XExposeEvent;
-
-typedef struct {
-       int type;
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Drawable drawable;
-       int x, y;
-       int width, height;
-       int count;              /* if non-zero, at least this many more */
-       int major_code;         /* core is CopyArea or CopyPlane */
-       int minor_code;         /* not defined in the core */
-} XGraphicsExposeEvent;
-
-typedef struct {
-       int type;
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Drawable drawable;
-       int major_code;         /* core is CopyArea or CopyPlane */
-       int minor_code;         /* not defined in the core */
-} XNoExposeEvent;
-
-typedef struct {
-       int type;
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Window window;
-       int state;              /* Visibility state */
-} XVisibilityEvent;
-
-typedef struct {
-       int type;
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Window parent;          /* parent of the window */
-       Window window;          /* window id of window created */
-       int x, y;               /* window location */
-       int width, height;      /* size of window */
-       int border_width;       /* border width */
-       BoolDef override_redirect;      /* creation should be overridden */
-} XCreateWindowEvent;
-
-typedef struct {
-       int type;
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Window event;
-       Window window;
-} XDestroyWindowEvent;
-
-typedef struct {
-       int type;
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Window event;
-       Window window;
-       BoolDef from_configure;
-} XUnmapEvent;
-
-typedef struct {
-       int type;
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Window event;
-       Window window;
-       BoolDef override_redirect;      /* boolean, is override set... */
-} XMapEvent;
-
-typedef struct {
-       int type;
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Window parent;
-       Window window;
-} XMapRequestEvent;
-
-typedef struct {
-       int type;
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Window event;
-       Window window;
-       Window parent;
-       int x, y;
-       BoolDef override_redirect;
-} XReparentEvent;
-
-typedef struct {
-       int type;
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Window event;
-       Window window;
-       int x, y;
-       int width, height;
-       int border_width;
-       Window above;
-       BoolDef override_redirect;
-} XConfigureEvent;
-
-typedef struct {
-       int type;
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Window event;
-       Window window;
-       int x, y;
-} XGravityEvent;
-
-typedef struct {
-       int type;
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Window window;
-       int width, height;
-} XResizeRequestEvent;
-
-typedef struct {
-       int type;
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Window parent;
-       Window window;
-       int x, y;
-       int width, height;
-       int border_width;
-       Window above;
-       int detail;             /* Above, Below, TopIf, BottomIf, Opposite */
-       unsigned long value_mask;
-} XConfigureRequestEvent;
-
-typedef struct {
-       int type;
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Window event;
-       Window window;
-       int place;              /* PlaceOnTop, PlaceOnBottom */
-} XCirculateEvent;
-
-typedef struct {
-       int type;
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Window parent;
-       Window window;
-       int place;              /* PlaceOnTop, PlaceOnBottom */
-} XCirculateRequestEvent;
-
-typedef struct {
-       int type;
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Window window;
-       Atom atom;
-       Time time;
-       int state;              /* NewValue, Deleted */
-} XPropertyEvent;
-
-typedef struct {
-       int type;
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Window window;
-       Atom selection;
-       Time time;
-} XSelectionClearEvent;
-
-typedef struct {
-       int type;
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Window owner;
-       Window requestor;
-       Atom selection;
-       Atom target;
-       Atom property;
-       Time time;
-} XSelectionRequestEvent;
-
-typedef struct {
-       int type;
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Window requestor;
-       Atom selection;
-       Atom target;
-       Atom property;          /* ATOM or None */
-       Time time;
-} XSelectionEvent;
-
-typedef struct {
-       int type;
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Window window;
-       Colormap colormap;      /* COLORMAP or None */
-#if defined(__cplusplus) || defined(c_plusplus)
-       BoolDef c_new;          /* C++ */
-#else
-       BoolDef new;
-#endif
-       int state;              /* ColormapInstalled, ColormapUninstalled */
-} XColormapEvent;
-
-typedef struct {
-       int type;
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Window window;
-       Atom message_type;
-       int format;
-       union {
-               char b[20];
-               short s[10];
-               long l[5];
-               } data;
-} XClientMessageEvent;
-
-typedef struct {
-       int type;
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;       /* Display the event was read from */
-       Window window;          /* unused */
-       int request;            /* one of MappingModifier, MappingKeyboard,
-                                  MappingPointer */
-       int first_keycode;      /* first keycode */
-       int count;              /* defines range of change w. first_keycode*/
-} XMappingEvent;
-
-typedef struct {
-       int type;
-       Display *display;       /* Display the event was read from */
-       XID resourceid;         /* resource id */
-       unsigned long serial;   /* serial number of failed request */
-       unsigned char error_code;       /* error code of failed request */
-       unsigned char request_code;     /* Major op-code of failed request */
-       unsigned char minor_code;       /* Minor op-code of failed request */
-} XErrorEvent;
-
-typedef struct {
-       int type;
-       unsigned long serial;   /* # of last request processed by server */
-       BoolDef send_event;     /* true if this came from a SendEvent request */
-       Display *display;/* Display the event was read from */
-       Window window;  /* window on which event was requested in event mask */
-} XAnyEvent;
-
-/*
- * this union is defined so Xlib can always use the same sized
- * event structure internally, to avoid memory fragmentation.
- */
-typedef union _XEvent {
-        int type;              /* must not be changed; first element */
-       XAnyEvent xany;
-       XKeyEvent xkey;
-       XButtonEvent xbutton;
-       XMotionEvent xmotion;
-       XCrossingEvent xcrossing;
-       XFocusChangeEvent xfocus;
-       XExposeEvent xexpose;
-       XGraphicsExposeEvent xgraphicsexpose;
-       XNoExposeEvent xnoexpose;
-       XVisibilityEvent xvisibility;
-       XCreateWindowEvent xcreatewindow;
-       XDestroyWindowEvent xdestroywindow;
-       XUnmapEvent xunmap;
-       XMapEvent xmap;
-       XMapRequestEvent xmaprequest;
-       XReparentEvent xreparent;
-       XConfigureEvent xconfigure;
-       XGravityEvent xgravity;
-       XResizeRequestEvent xresizerequest;
-       XConfigureRequestEvent xconfigurerequest;
-       XCirculateEvent xcirculate;
-       XCirculateRequestEvent xcirculaterequest;
-       XPropertyEvent xproperty;
-       XSelectionClearEvent xselectionclear;
-       XSelectionRequestEvent xselectionrequest;
-       XSelectionEvent xselection;
-       XColormapEvent xcolormap;
-       XClientMessageEvent xclient;
-       XMappingEvent xmapping;
-       XErrorEvent xerror;
-       XKeymapEvent xkeymap;
-       long pad[24];
-} XEvent;
-
-typedef int (*XErrorHandler) (     /* WARNING, this type not in Xlib spec */
-    Display*           /* display */,
-    XErrorEvent*       /* error_event */
-);
-
-
-typedef struct {
-    Atom name;
-    unsigned long card32;
-} XFontProp;
-
-typedef struct {
-    XExtData   *ext_data;      /* hook for extension to hang data */
-    Font        fid;            /* Font id for this font */
-    unsigned   direction;      /* hint about direction the font is painted */
-    unsigned   min_char_or_byte2;/* first character */
-    unsigned   max_char_or_byte2;/* last character */
-    unsigned   min_byte1;      /* first row that exists */
-    unsigned   max_byte1;      /* last row that exists */
-    BoolDef all_chars_exist;/* flag if all characters have non-zero size*/
-    unsigned   default_char;   /* char to print for undefined character */
-    int         n_properties;   /* how many properties there are */
-    XFontProp  *properties;    /* pointer to array of additional properties*/
-    XCharStruct        min_bounds;     /* minimum bounds over all existing char*/
-    XCharStruct        max_bounds;     /* maximum bounds over all existing char*/
-    XCharStruct        *per_char;      /* first_char to last_char information */
-    int                ascent;         /* log. extent above baseline for spacing */
-    int                descent;        /* log. descent below baseline for spacing */
-} XFontStruct;
-
-typedef enum {
-    XStringStyle,              /* STRING */
-    XCompoundTextStyle,                /* COMPOUND_TEXT */
-    XTextStyle,                        /* text in owner's encoding (current locale)*/
-    XStdICCTextStyle,          /* STRING, else COMPOUND_TEXT */
-    XUTF8StringStyle           /* UTF8_STRING */
-} XICCEncodingStyle;
-
-typedef struct _XIM *XIM;
-typedef struct _XIC *XIC;
-
-/*
- * Data structure for "image" data, used by image manipulation routines.
- */
-typedef struct _XImage {
-    int width, height;         /* size of image */
-    int xoffset;               /* number of pixels offset in X direction */
-    int format;                        /* XYBitmap, XYPixmap, ZPixmap */
-    char *data;                        /* pointer to image data */
-    int byte_order;            /* data byte order, LSBFirst, MSBFirst */
-    int bitmap_unit;           /* quant. of scanline 8, 16, 32 */
-    int bitmap_bit_order;      /* LSBFirst, MSBFirst */
-    int bitmap_pad;            /* 8, 16, 32 either XY or ZPixmap */
-    int depth;                 /* depth of image */
-    int bytes_per_line;                /* accelarator to next line */
-    int bits_per_pixel;                /* bits per pixel (ZPixmap) */
-    unsigned long red_mask;    /* bits in z arrangment */
-    unsigned long green_mask;
-    unsigned long blue_mask;
-    XPointer obdata;           /* hook for the object routines to hang on */
-    struct funcs {             /* image manipulation routines */
-       struct _XImage *(*create_image)(
-               struct _XDisplay* /* display */,
-               Visual*         /* visual */,
-               unsigned int    /* depth */,
-               int             /* format */,
-               int             /* offset */,
-               char*           /* data */,
-               unsigned int    /* width */,
-               unsigned int    /* height */,
-               int             /* bitmap_pad */,
-               int             /* bytes_per_line */);
-       int (*destroy_image)        (struct _XImage *);
-       unsigned long (*get_pixel)  (struct _XImage *, int, int);
-       int (*put_pixel)            (struct _XImage *, int, int, unsigned long);
-       struct _XImage *(*sub_image)(struct _XImage *, int, int, unsigned int, unsigned int);
-       int (*add_pixel)            (struct _XImage *, long);
-       } f;
-} XImage;
-
-typedef struct {
-       int max_keypermod;      /* The server's max # of keys per modifier */
-       KeyCode *modifiermap;   /* An 8 by max_keypermod array of modifiers */
-} XModifierKeymap;
-
-typedef struct {
-    short x, y;
-} XPoint;
-
-typedef struct {
-    short x, y;
-    unsigned short width, height;
-} XRectangle;
-
-typedef struct {
-    short x1, y1, x2, y2;
-} XSegment;
-
-typedef struct {
-    Pixmap background_pixmap;  /* background or None or ParentRelative */
-    unsigned long background_pixel;    /* background pixel */
-    Pixmap border_pixmap;      /* border of the window */
-    unsigned long border_pixel;        /* border pixel value */
-    int bit_gravity;           /* one of bit gravity values */
-    int win_gravity;           /* one of the window gravity values */
-    int backing_store;         /* NotUseful, WhenMapped, Always */
-    unsigned long backing_planes;/* planes to be preseved if possible */
-    unsigned long backing_pixel;/* value to use in restoring planes */
-    BoolDef save_under;                /* should bits under be saved? (popups) */
-    long event_mask;           /* set of events that should be saved */
-    long do_not_propagate_mask;        /* set of events that should not propagate */
-    BoolDef override_redirect; /* boolean value for override-redirect */
-    Colormap colormap;         /* color map to be associated with window */
-    Cursor cursor;             /* cursor to be displayed (or None) */
-} XSetWindowAttributes;
-
-typedef struct {
-       long flags;     /* marks which fields in this structure are defined */
-       int x, y;               /* obsolete for new window mgrs, but clients */
-       int width, height;      /* should set so old wm's don't mess up */
-       int min_width, min_height;
-       int max_width, max_height;
-       int width_inc, height_inc;
-       struct {
-               int x;  /* numerator */
-               int y;  /* denominator */
-       } min_aspect, max_aspect;
-       int base_width, base_height;            /* added by ICCCM version 1 */
-       int win_gravity;                        /* added by ICCCM version 1 */
-} XSizeHints;
-
-typedef struct {
-       Colormap colormap;
-       unsigned long red_max;
-       unsigned long red_mult;
-       unsigned long green_max;
-       unsigned long green_mult;
-       unsigned long blue_max;
-       unsigned long blue_mult;
-       unsigned long base_pixel;
-       VisualID visualid;              /* added by ICCCM version 1 */
-       XID killid;                     /* added by ICCCM version 1 */
-} XStandardColormap;
-
-typedef struct {
-    unsigned char *value;              /* same as Property routines */
-    Atom encoding;                     /* prop type */
-    int format;                                /* prop data format: 8, 16, or 32 */
-    unsigned long nitems;              /* number of data items in value */
-} XTextProperty;
-
-typedef struct {
-  Visual *visual;
-  VisualID visualid;
-  int screen;
-  int depth;
-#if defined(__cplusplus) || defined(c_plusplus)
-  int c_class;                                 /* C++ */
-#else
-  int class;
-#endif
-  unsigned long red_mask;
-  unsigned long green_mask;
-  unsigned long blue_mask;
-  int colormap_size;
-  int bits_per_rgb;
-} XVisualInfo;
-
-typedef struct {
-       long flags;     /* marks which fields in this structure are defined */
-       BoolDef input;  /* does this application rely on the window manager to
-                       get keyboard input? */
-       int initial_state;      /* see below */
-       Pixmap icon_pixmap;     /* pixmap to be used as icon */
-       Window icon_window;     /* window to be used as icon */
-       int icon_x, icon_y;     /* initial position of icon */
-       Pixmap icon_mask;       /* icon mask bitmap */
-       XID window_group;       /* id of related window group */
-       /* this structure may be extended in the future */
-} XWMHints;
-
-typedef struct {
-    int x, y;                  /* location of window */
-    int width, height;         /* width and height of window */
-    int border_width;          /* border width of window */
-    int depth;                 /* depth of window */
-    Visual *visual;            /* the associated visual structure */
-    Window root;               /* root of screen containing window */
-#if defined(__cplusplus) || defined(c_plusplus)
-    int c_class;               /* C++ InputOutput, InputOnly*/
-#else
-    int class;                 /* InputOutput, InputOnly*/
-#endif
-    int bit_gravity;           /* one of bit gravity values */
-    int win_gravity;           /* one of the window gravity values */
-    int backing_store;         /* NotUseful, WhenMapped, Always */
-    unsigned long backing_planes;/* planes to be preserved if possible */
-    unsigned long backing_pixel;/* value to be used when restoring planes */
-    BoolDef save_under;                /* boolean, should bits under be saved? */
-    Colormap colormap;         /* color map to be associated with window */
-    BoolDef map_installed;             /* boolean, is color map currently installed*/
-    int map_state;             /* IsUnmapped, IsUnviewable, IsViewable */
-    long all_event_masks;      /* set of events all people have interest in*/
-    long your_event_mask;      /* my event mask */
-    long do_not_propagate_mask; /* set of events that should not propagate */
-    BoolDef override_redirect; /* boolean value for override-redirect */
-    Screen *screen;            /* back pointer to correct screen */
-} XWindowAttributes;
-
-struct _XrmHashBucketRec;
-
-/* needed for xdefaults.c */
-typedef struct _XrmHashBucketRec *XrmDatabase;
-typedef enum {XrmBindTightly, XrmBindLoosely} XrmBinding, *XrmBindingList;
-typedef int       XrmQuark, *XrmQuarkList;
-#define NULLQUARK ((XrmQuark) 0)
-typedef XrmQuark     XrmRepresentation;
-typedef struct {
-    unsigned int    size;
-    XPointer       addr;
-} XrmValue, *XrmValuePtr;
-
-/* extend for defining an event callback */
-#define USING_W11LIB
-typedef void (proto_W11EventHandler)(XEvent *ev);
-void W11AddEventHandler(Display *display, proto_W11EventHandler *ev);
-
-/* functions */
-
-Display *XOpenDisplay(const char *name);
-
-int XCloseDisplay(Display *display);
-
-char *XDisplayString(Display *display);
-
-int XSync(Display *display,int discard);
-
-int XFlush(Display *display);
-
-XVisualInfo *XGetVisualInfo(
-                           Display *display,
-                           long vinm,
-                           XVisualInfo *vint,
-                           int *n);
-
-StatusDef XMatchVisualInfo(
-    Display*           display,
-    int                        screen,
-    int                        depth,
-    int                        class,
-    XVisualInfo*       vinfo_return);
-
-int XClearWindow(Display *display, Window w);
-
-Window XCreateSimpleWindow(
-                   Display *display,
-                   Window  parent,
-                   int     x, 
-                   int y,
-                   unsigned int brd,
-                   unsigned int w,
-                   unsigned int h,
-                   unsigned long bg, 
-                   unsigned long brd_col);
-
-Window XCreateWindow(
-             Display *display,
-             Window  parent,
-             int x,
-             int y,
-             unsigned int width,
-             unsigned int height,
-             unsigned int bw,
-             int depth,
-             unsigned int class,
-             Visual *visual,
-             unsigned long valuemask,
-             XSetWindowAttributes *attr);
-
-int XDestroyWindow(
-              Display *display,
-              Window w);
-
-StatusDef XGetGeometry(
-            Display *display,
-            Drawable w,
-            Window *root,
-            int *x,
-            int *y,
-            unsigned int *width,
-            unsigned int *height,
-            unsigned int *bw,
-            unsigned int *depth);
-
-StatusDef XGetWindowAttributes(Display *display,
-                    Window w,
-                    XWindowAttributes *wattr);
-
-int XSelectInput(Display *display,
-            Window  window,
-            long    mask);
-
-int XMapWindow(Display *display,
-          Window window);
-
-int XIconifyWindow(Display *display,
-              Window w,
-              int screen_number);
-GC XCreateGC(
-         Display *display,
-         Drawable window,
-         unsigned long mask,
-         XGCValues *gc_values);
-
-int XFreeGC(
-       Display *display,
-       GC gc);
-
-int XSetForeground(
-              Display *display,
-              GC gc,
-              unsigned long    color);
-int XDrawString(Display *display, 
-           Drawable window,
-           GC gc, 
-           int x, 
-           int y, 
-           const char* str, 
-           int len);
-int XDrawString16(Display *display, 
-             Drawable window,
-             GC gc, int x, int y,
-             const XChar2b* str,
-             int len);
-
-int XDrawImageString(
-       Display* display,
-       Drawable d,
-       GC gc,
-       int x,
-       int y,
-       const char* string,
-       int length);
-
-int XDrawImageString16(Display *display, 
-                  Drawable window,
-                  GC gc, int x, int y,
-                  const XChar2b* str,
-                  int len);
-
-int XFillRectangle(
-              Display *display,
-              Drawable window,
-              GC gc,
-              int x, int y,
-              unsigned int w, unsigned int h);
-int XClearArea(
-          Display *display,
-          Window w,
-          int x, int y,
-          unsigned int width, unsigned int height,
-          BoolDef exposures);
-
-Region XCreateRegion();
-
-int XClipBox(
-        Region hrgn,
-        XRectangle *rect);
-
-int XSetRegion(
-          Display *display,
-          GC gc,
-          Region hrgn);
-
-int XDestroyRegion(Region hrgn);
-
-int XUnionRectWithRegion(XRectangle *rect,
-                    Region hrgnsrc,
-                    Region hrgndest);
-int XDrawArc(
-        Display *display,
-        Drawable w,
-        GC gc,
-        int x, int y,
-        unsigned int width,unsigned int height,
-        int a1, int a2);
-
-int XFillArc(
-        Display *display,
-        Drawable w,
-        GC gc,
-        int x, int y,
-        unsigned int width,unsigned height,
-        int a1, int a2);
-
-int XFillPolygon(
-            Display *display,
-            Drawable w,
-            GC gc,
-            XPoint *points,
-            int nps, int shape, int mode);
-
-int XDrawLine(
-         Display *display,
-         Drawable w,
-         GC gc,
-         int x1,int y1, int x2,int y2);
-
-int XDrawLines(
-          Display *display,
-          Drawable w,
-          GC gc,
-          XPoint *points,
-          int nps,int mode);
-
-int XDrawPoints(
-           Display *display,
-           Drawable w,
-           GC gc,
-           XPoint *points,
-           int nps, int mode);
-
-int XDrawPoint(
-          Display *display,
-          Drawable w,
-          GC gc,
-          int x, int y);
-int XDrawRectangle(
-              Display *display,
-              Drawable w,
-              GC gc,
-              int x, int y,
-              unsigned int width, unsigned int height);
-
-int XDrawSegments(
-             Display *display,
-             Drawable w,
-             GC gc,
-             XSegment *segs,
-             int nsegs);
-
-Pixmap XCreatePixmap(
-             Display *display,
-             Drawable drawable,
-             unsigned int width, unsigned int height,
-             unsigned int depth);
-
-Pixmap XCreateBitmapFromData(Display *display,
-                     Drawable drawable, const char *data,
-                     unsigned int width, unsigned int height);
-int XFreePixmap(
-        Display *display,
-        Pixmap pixmap);
-
-int XCopyArea(
-         Display *display,
-         Drawable src,
-         Drawable dest,
-         GC gc,
-         int src_x, int src_y,
-         unsigned int width, unsigned int height,
-         int dest_x, int dest_y);
-
-XImage *XGetImage(
-                 Display *display,
-                 Drawable drawable,
-                 int x, int y,
-                 unsigned int width, unsigned int height,
-                 unsigned long plane_mask,
-                 int format);
-
-XImage *XCreateImage(
-            Display *display,
-            Visual *visual,
-            unsigned int depth,
-            int format,
-            int offset,
-            char *data,
-            unsigned int width, unsigned int height,
-            int bitmap_pad, int bytes_per_line);
-int XPutImage(
-         Display *display,
-         Drawable w,
-         GC gc,
-         XImage *image,
-         int sx,int sy,int dx,int dy,
-         unsigned int width,unsigned int height);
-
-int XSetWindowBackground(
-                    Display *display,
-                    Window w,
-                    unsigned long bg);
-
-int XSetWindowBackgroundPixmap(
-                          Display *display,
-                          Window w,
-                          Pixmap background_tile);
-
-int XSetFillStyle(
-             Display *display,
-             GC gc,
-             int fs);
-
-int XSetDashes(Display *display,
-          GC gc, int dash_offset,
-          const char * dash_list,
-          int n);
-
-int XChangeWindowAttributes(
-                       Display *display,
-                       Window w,
-                       unsigned long vmask,
-                       XSetWindowAttributes *attr);
-
-int XLowerWindow(Display *display,
-            Window w);
-
-int XMapRaised(
-          Display *display,
-          Window w);
-
-int
-XMapSubwindows(
-              Display *display,
-              Window w);
-
-StatusDef
-XQueryTree(
-          Display *display,
-          Window w,
-          Window* root,
-          Window* parent,
-          Window** ch,
-          unsigned int *n);
-int
-XRaiseWindow(
-            Display *display,
-            Window w);
-
-Window
-XRootWindow(
-           Display *display,
-           int scr);
-Window
-XRootWindowOfScreen(Screen *scr);
-
-BoolDef XTranslateCoordinates(
-                     Display *display,
-                     Window sw, Window dw,
-                     int sx, int sy, int *dx, int *dy,
-                     Window *ch);
-
-int
-XUnmapWindow(Display *display,
-            Window w);
-int
-XCopyGC(
-       Display *display,
-       GC sgc,
-       unsigned long vmask,
-       GC dgc);
-int
-XSetClipMask(
-            Display *display,
-            GC gc,
-            Pixmap cmask);
-
-int
-XSetClipRectangles(
-                  Display *display,
-                  GC gc,
-                  int clx, int cly,
-                  XRectangle *rs,
-                  int n, int order);
-int
-XSetFunction(
-            Display *display,
-            GC gc,
-            int fn);
-int
-XSetLineAttributes(
-                  Display *display,
-                  GC gc,
-                  unsigned int lw,
-                  int ls, int cs, int js);
-int
-XSetPlaneMask(
-             Display *display,
-             GC gc,
-             unsigned long pmask);
-int XSetTile(
-            Display *display,
-            GC gc,
-            Pixmap tile);
-StatusDef
-XAllocColorCells(
-                Display *display,
-                Colormap cmap,
-                BoolDef cont,
-                unsigned long *pmasks,
-                unsigned int np,
-                unsigned long *pixels,
-                unsigned int nc);
-StatusDef
-XAllocColorPlanes(
-                 Display *display,
-                 Colormap cmap,
-                 BoolDef cont,
-                 unsigned long *pixels,
-                 int nc,
-                 int nr,int ng,int nb,
-                 unsigned long *rmask,
-                 unsigned long *gmask,
-                 unsigned long *bmask);
-StatusDef
-XAllocNamedColor(Display *display,
-                Colormap cmap, const char *cname,
-                XColor *cell, XColor *rgb);
-Colormap
-XCreateColormap(
-               Display *display,
-               Window w,
-               Visual *visual,
-               int alloc);
-StatusDef
-XGetStandardColormap(
-                    Display *display,
-                    Window w,
-                    XStandardColormap *cmapinf,
-                    Atom prop);
-StatusDef
-XAllocColor(
-           Display *display,
-           Colormap cmap,
-           XColor *xc);
-int
-XQueryColor(
-           Display *display,
-           Colormap cmap,
-           XColor *cell);
-int
-XQueryColors(
-            Display *display,
-            Colormap cmap,
-            XColor *cells,
-            int nc);
-int
-XStoreColor(
-           Display *display,
-           Colormap cmap,
-           XColor *cell);
-int
-XStoreColors(
-            Display *display,
-            Colormap cmap,
-            XColor *cells,
-            int nc);
-char **
-XGetFontPath(
-            Display *display,
-            int *nps);
-BoolDef XGetFontProperty(
-                XFontStruct *fstruct,
-                Atom atom,
-                unsigned long *val);
-
-XFontStruct *
-XLoadQueryFont(Display *display, const char *name);
-
-XFontStruct *
-XQueryFont(
-          Display *display,
-          XID     font_id);
-
-KeySym
-XKeycodeToKeysym(
-                Display *display,
-                unsigned int keycode,
-                int     index);
-
-KeyCode
-XKeysymToKeycode(
-                Display *display,
-                KeySym keysym);
-
-KeySym
-XStringToKeysym(const char *str);
-
-XModifierKeymap *
-XGetModifierMapping(Display *display);
-
-int
-XFreeModifiermap(XModifierKeymap *modmap);
-
-int
-XSetFont(
-        Display *display,
-        GC gc,
-        Font font);
-int
-XSetFontPath(
-            Display *display,
-            char **dirs,
-            int nd);
-int
-XTextExtents(
-            XFontStruct *fstruct,
-            const char *str,
-            int nc,
-            int *dir,int *ascent,int *descent,
-            XCharStruct *overall);
-int
-XTextExtents16(
-              XFontStruct *fstruct,
-              const XChar2b *str,
-              int nc,
-              int *dir, int *ascent, int *descent,
-              XCharStruct *overall);
-
-int
-XTextWidth(
-          XFontStruct *fstruct,
-          const char *str,
-          int co);
-int
-XTextWidth16(
-            XFontStruct *fstruct,
-            const XChar2b *str,
-            int co);
-int
-XGetErrorDatabaseText(
-                     Display *display,
-                     const char *name, const char *msg,
-                     const char *defstr,
-                     char *buf,
-                     int len);
-
-int
-XGetErrorText(
-             Display *display,
-             int code,
-             char *buf,
-             int len);
-
-XErrorHandler
-XSetErrorHandler(XErrorHandler handler);
-
-int
-XDefaultScreen(Display *display);
-
-Visual *
-XDefaultVisual(
-              Display *display,
-              int screen);
-
-int
-XDefaultDepth(
-             Display *display,
-             int screen);
-
-Colormap
-XDefaultColormap(
-                Display *display,
-                int screen);
-Screen *
-XScreenOfDisplay(
-                Display *display,
-                int scr);
-Cursor
-XCreateFontCursor(
-                 Display *display,
-                 unsigned int shape);
-int
-XRecolorCursor(
-              Display *display,
-              Cursor cursor,
-              XColor *fg,XColor *bg);
-
-int
-XWarpPointer(
-            Display *display,
-            Window sw,Window dw,
-            int sx,int sy,
-            unsigned int swidth,unsigned int sheight,
-            int dx, int dy);
-int
-XBell(
-      Display *display,
-      int pc);
-
-int
-XGetInputFocus(
-              Display *display,
-              Window *focus,
-              int *revto);
-int
-XSetInputFocus(
-              Display *display,
-              Window focus,
-              int revto,
-              Time time);
-int
-XLookupString(
-             XKeyEvent *event,
-             char *buf,
-             int nbytes,
-             KeySym *keysym,
-             XComposeStatus *status);
-
-int
-XRefreshKeyboardMapping(XMappingEvent *event);
-
-int
-XSetClassHint(
-             Display *display,
-             Window w,
-             XClassHint *chints);
-int
-XSetNormalHints(
-               Display *display,
-               Window w,
-               XSizeHints *hints);
-
-int
-XSetWMHints(
-           Display *display,
-           Window w,
-           XWMHints *wmhints);
-StatusDef
-XSetWMProtocols(
-               Display *display,
-               Window w,
-               Atom *prots,
-               int co);
-int
-XStoreName(Display *display,
-          Window w,
-          const char *wname);
-StatusDef
-XFetchName(
-    Display *display,
-    Window w,
-    char **window_name_return);
-
-int
-XDoesBackingStore(Screen *scr);
-
-XExtCodes *
-XInitExtension(Display *display,
-              const char *name);
-int
-XFree(void *data);
-
-char *
-XServerVendor(Display *display);
-
-int
-XSetIconName(Display *display,
-            Window w,
-            const char *iname);
-int
-XGetIconName(
-            Display *display,
-            Window w,
-            char **iname);
-int
-XSetSelectionOwner(
-                  Display* display,
-                  Atom sel,
-                  Window owner,
-                  Time time);
-Window
-XGetSelectionOwner(
-                  Display* display,
-                  Atom selection);
-
-int
-XConvertSelection(
-                 Display *display,
-                 Atom sel, Atom target, Atom prop,
-                 Window req,
-                 Time time);
-BoolDef XCheckTypedEvent(
-                Display *display,
-                int ev,
-                XEvent *rep);
-BoolDef XCheckWindowEvent(
-                 Display *display,
-                 Window w,
-                 long emask,
-                 XEvent *ev);
-int
-XPending(Display *display);
-
-int
-XPutBackEvent(Display *display,
-             XEvent *event);
-
-StatusDef
-XSendEvent(
-          Display *display,
-          Window w,
-          BoolDef prop,
-          long emask,
-          XEvent *event);
-
-BoolDef XCheckTypedWindowEvent(
-       Display* display,
-       Window w,
-       int event_type,
-       XEvent* event_return);
-int
-XWindowEvent(
-            Display *display,
-            Window w,
-            long emask,
-            XEvent *rep);
-
-int
-XNextEvent(
-          Display *display,
-          XEvent  *event);
-
-Atom
-XInternAtom(
-           Display *display,
-           const char *property_name,
-           BoolDef only_if_exists);
-char *
-XGetAtomName(
-            Display *display,
-            Atom atom);
-
-int
-XChangeProperty(
-       Display *display,
-       Window window,
-       Atom property,
-       Atom type,
-       int format,
-       int mode,
-       const unsigned char *data,
-       int nelements);
-
-int
-XGetWindowProperty(
-                  Display *display,
-                  Window window,
-                  Atom property,
-                  long long_offset,
-                  long long_length,
-                  BoolDef delete,
-                  Atom req_type,
-                  Atom *actual_type_return,
-                  int *actual_format_return,
-                  unsigned long *nitems_return,
-                  unsigned long *bytes_after_return,
-                  unsigned char **prop_return);
-
-char **
-XListExtensions(
-               Display *display,
-               int *ret_num);
-
-int XFreeExtensionList(char **list);
-
-int
-XChangeGC(
-       Display* display,
-       GC gc,
-       unsigned long mask,
-       XGCValues* gc_values);
-
-int
-XConnectionNumber(Display* display);
-
-int
-XFreeFont(Display* display,XFontStruct* font_struct);
-
-char *
-XSetLocaleModifiers(const char* modifier_list);
-
-XIM
-XOpenIM(
-       Display* dpy,
-       struct _XrmHashBucketRec* rdb,
-       char* res_name,
-       char* res_class);
-
-char *
-XGetIMValues(XIM im , ...);
-
-XIC XCreateIC(XIM im , ...);
-
-StatusDef
-XCloseIM(XIM im);
-
-BoolDef XFilterEvent(XEvent* event,Window window);
-
-char *
-XrmQuarkToString(void *quark);
-
-int
-XmbLookupString(
-       XIC ic,
-       XKeyPressedEvent* event,
-       char* buffer_return,
-       int bytes_buffer,
-       KeySym* keysym_return,
-       StatusDef* status_return);
-int
-XmbTextPropertyToTextList(
-       Display *display,
-       XTextProperty *text_prop,
-       char ***list_return,
-       int *count_return);
-
-void
-XFreeStringList(char **list);
-
-int XmbTextListToTextProperty(
-        Display *display,
-        char **list,
-        int count,
-        XICCEncodingStyle style,
-        XTextProperty *text_prop_return);
-
-void
-XSetICFocus(XIC ic);
-
-void
-XUnsetICFocus(XIC ic);
-
-BoolDef XQueryPointer(
-       Display* display,
-       Window w,
-       Window* root_return,
-       Window* child_return,
-       int* root_x_return,
-       int* root_y_return,
-       int* win_x_return,
-       int* win_y_return,
-       unsigned int* mask_return);
-
-int XParseGeometry(
-       const char* string,
-       int* x,
-       int* y,
-       unsigned int* width,
-       unsigned int* height);
-
-int XResizeWindow(
-       Display* display,
-       Window w,
-       unsigned int width,
-       unsigned int height);
-
-void XSetWMNormalHints(Display* display,Window w,XSizeHints* hints);
-
-void XSetWMProperties(
-       Display* display,
-       Window w,
-       XTextProperty* window_name,
-       XTextProperty* icon_name,
-       char** argv,
-       int argc,
-       XSizeHints* normal_hints,
-       XWMHints* wm_hints,
-       XClassHint* class_hints);
-
-int XDefineCursor(Display* display,Window w,Cursor cursor);
-
-int XMoveResizeWindow(
-       Display* display,
-       Window w,
-       int x,
-       int y,
-       unsigned int width,
-       unsigned int height);
-
-int XMoveWindow(
-       Display* display,
-       Window w,
-       int x,
-       int y);
-
-StatusDef
-XParseColor(
-    Display *display,
-    Colormap map,
-    const char* spec,
-    XColor *colorPtr);
-
-int
-XFreeColors(Display *display,
-           Colormap cmap,
-           unsigned long pixels[],
-           int npixels,
-           unsigned long planes);
-int
-XGrabServer(Display *display);
-
-int
-XUngrabServer(Display *display);
-
-
-#endif
diff --git a/W11/X11/Xlocale.h b/W11/X11/Xlocale.h
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/W11/X11/Xmd.h b/W11/X11/Xmd.h
deleted file mode 100644 (file)
index b300fe7..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef XMD_H
-#define XMD_H 1
-
-/*
- * Machine dependent declarations
- */
-
-typedef unsigned int CARD32;
-
-#endif /* XMD_H */
diff --git a/W11/X11/Xutil.h b/W11/X11/Xutil.h
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/W11/X11/cursorfont.h b/W11/X11/cursorfont.h
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/W11/X11/keysym.h b/W11/X11/keysym.h
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/W11/X11/keysymdef.h b/W11/X11/keysymdef.h
deleted file mode 100644 (file)
index c005331..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-
-#define XK_Meta_L              0xFFE7  /* Left meta */
-#define XK_Meta_R              0xFFE8  /* Right meta */
-#define XK_Alt_R               0xFFEA  /* Right alt */
-#define XK_Super_L             0xFFEB  /* Left super */
-#define XK_Super_R             0xFFEC  /* Right super */
-#define XK_Hyper_L             0xFFED  /* Left hyper */
-#define XK_Hyper_R             0xFFEE  /* Right hyper */
-
-#define XK_KP_Space            0xFF80  /* space */
-#define XK_KP_Tab              0xFF89
-#define XK_KP_Enter            0xFF8D  /* enter */
-#define XK_KP_F1               0xFF91  /* PF1, KP_A, ... */
-#define XK_KP_F2               0xFF92
-#define XK_KP_F3               0xFF93
-#define XK_KP_F4               0xFF94
-#define XK_KP_Home             0xFF95
-#define XK_KP_Left             0xFF96
-#define XK_KP_Up               0xFF97
-#define XK_KP_Right            0xFF98
-#define XK_KP_Down             0xFF99
-#define XK_KP_Prior            0xFF9A
-#define XK_KP_Page_Up          0xFF9A
-#define XK_KP_Next             0xFF9B
-#define XK_KP_Page_Down                0xFF9B
-#define XK_KP_End              0xFF9C
-#define XK_KP_Begin            0xFF9D
-#define XK_KP_Insert           0xFF9E
-#define XK_KP_Delete           0xFF9F
-#define XK_KP_Equal            0xFFBD  /* equals */
-#define XK_KP_Multiply         0xFFAA
-#define XK_KP_Add              0xFFAB
-#define XK_KP_Separator                0xFFAC  /* separator, often comma */
-#define XK_KP_Subtract         0xFFAD
-#define XK_KP_Decimal          0xFFAE
-#define XK_KP_Divide           0xFFAF
-#define XK_minus               0x02d
-
-#define XK_KP_0                        0xFFB0
-#define XK_KP_1                        0xFFB1
-#define XK_KP_2                        0xFFB2
-#define XK_KP_3                        0xFFB3
-#define XK_KP_4                        0xFFB4
-#define XK_KP_5                        0xFFB5
-#define XK_KP_6                        0xFFB6
-#define XK_KP_7                        0xFFB7
-#define XK_KP_8                        0xFFB8
-#define XK_KP_9                        0xFFB9
-
-#define XK_L1                  0xFFC8
-#define XK_L2                  0xFFC9
-#define XK_F13                 0xFFCA
-#define XK_L3                  0xFFCA
-#define XK_F14                 0xFFCB
-#define XK_L4                  0xFFCB
-#define XK_F15                 0xFFCC
-#define XK_L5                  0xFFCC
-#define XK_F16                 0xFFCD
-#define XK_L6                  0xFFCD
-#define XK_F17                 0xFFCE
-#define XK_L7                  0xFFCE
-#define XK_F18                 0xFFCF
-#define XK_L8                  0xFFCF
-#define XK_F19                 0xFFD0
-#define XK_L9                  0xFFD0
-#define XK_F20                 0xFFD1
-#define XK_L10                 0xFFD1
-#define XK_F21                 0xFFD2
-#define XK_R1                  0xFFD2
-#define XK_F22                 0xFFD3
-#define XK_R2                  0xFFD3
-#define XK_F23                 0xFFD4
-#define XK_R3                  0xFFD4
-#define XK_F24                 0xFFD5
-#define XK_R4                  0xFFD5
-#define XK_F25                 0xFFD6
-#define XK_R5                  0xFFD6
-#define XK_F26                 0xFFD7
-#define XK_R6                  0xFFD7
-#define XK_F27                 0xFFD8
-#define XK_R7                  0xFFD8
-#define XK_F28                 0xFFD9
-#define XK_R8                  0xFFD9
-#define XK_F29                 0xFFDA
-#define XK_R9                  0xFFDA
-#define XK_F30                 0xFFDB
-#define XK_R10                 0xFFDB
-#define XK_F31                 0xFFDC
-#define XK_R11                 0xFFDC
-#define XK_F32                 0xFFDD
-#define XK_R12                 0xFFDD
-#define XK_F33                 0xFFDE
-#define XK_R13                 0xFFDE
-#define XK_F34                 0xFFDF
-#define XK_R14                 0xFFDF
-#define XK_F35                 0xFFE0
-#define XK_R15                 0xFFE0
diff --git a/W11/w32/Makefile b/W11/w32/Makefile
deleted file mode 100644 (file)
index 1a82bbb..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-
-CFLAGS=-O
-
-first_rule: all
-
-all allbin: ../lib/libW11.dll
-
-alldoc tags:
-
-../lib/libW11.dll: xlib.o ntutil.o event.o
-       dllwrap --export-all-symbols -o ../lib/libW11.dll xlib.o ntutil.o event.o -mwindows
-
-xlib.o: xlib.c ntdef.h
-       gcc -c xlib.c ${CFLAGS} -I.. -mwin32
-
-ntutil.o: ntutil.c ntdef.h
-       gcc -c ntutil.c ${CFLAGS} -I.. -mwin32
-
-event.o: event.c ntdef.h
-       gcc -c event.c ${CFLAGS} -I.. -mwin32
-
-debug:
-       gcc -c xlib.c -g -I.. -mwin32
-       gcc -c event.c -g -I.. -mwin32
-       gcc -c ntutil.c -g -I.. -mwin32
-
-clean:
-       -rm ../lib/libW11.dll xlib.o ntutil.o event.o
diff --git a/W11/w32/event.c b/W11/w32/event.c
deleted file mode 100644 (file)
index f8f66e8..0000000
+++ /dev/null
@@ -1,944 +0,0 @@
-
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <X11/keysymdef.h>
-#include "ntdef.h"
-
-/* a crude method to avoid losing the selection when
-   calling EmptyClipboard, which is necessary to do
-   every time the selection content changes, otherwise
-   windows apps use a cached copy of the selection */
-static volatile int destroyClipboardCatcher = 0;
-static NT_window *NT_CWIN = NULL;
-void
-catchNextDestroyClipboard()
-{
-    destroyClipboardCatcher=1;
-}
-
-typedef struct WinEvent_
-{
-    NT_window *window;
-    UINT message;
-    UINT wParam;
-    LONG lParam;
-} WinEvent;
-
-#define W11_QSIZE 100
-typedef struct WinEventQ_
-{
-    int num;
-    int avail;
-    int next;
-    int count;
-    int dispatch;
-    proto_W11EventHandler *handler;
-    WinEvent list[W11_QSIZE];
-} WinEventQ;
-
-static WinEventQ *wineventq = NULL;
-
-void
-initQ() {
-    int i;
-    WinEventQ *q = (WinEventQ *)allocateMemory(sizeof(WinEventQ));
-    q->num=W11_QSIZE-1;
-    q->avail=0;
-    q->next=0;
-    q->count=0;
-    q->dispatch=0;
-    q->handler=NULL;
-    for (i=0; i<W11_QSIZE; i++) {
-       q->list[i].message=0;
-       q->list[i].window = NULL;
-    }
-    wineventq = q;
-}
-
-static int
-getQdEvent(WinEventQ *q, XEvent *ev)
-{
-    WinEvent we;
-    if (q->count<=0) {
-       cjh_printf("Queue is empty\n");
-       return 0;
-    }
-    we = q->list[q->next];
-    WinEventToXEvent(&we,ev);
-    q->next++;
-    q->count--;
-    if (q->next>q->num) q->next=0;     
-    return 1;
-}
-
-static void
-QSendEvent(WinEventQ *q) 
-{
-    XEvent e;
-    if (q->handler != NULL) {
-       if (getQdEvent(q,&e)) (q->handler)(&e);
-    }
-}
-
-static int
-QEvent(WinEventQ *q, NT_window *window,UINT message,UINT wParam,LONG lParam)
-{
-    q->list[q->avail].window=window;
-    q->list[q->avail].message=message;
-    q->list[q->avail].wParam=wParam;
-    q->list[q->avail].lParam=lParam;
-    q->avail++; q->count++;
-    if (q->avail>q->num) q->avail=0;
-    if (q->dispatch) QSendEvent(q);
-    return 1;
-}
-
-
-/* Allow application to install an event handler call back.
-   This will make some actions such as moving the window work
-   better.
-
-   The event handler should look like:
-   void process_xevent(XEvent *ev) { }
-
-   To install it:
-   W11AddEventHandler(display,process_xevent);
-
-   The specific problem is that calling DefWindowProc()
-   in response to a WM_SYSCOMMAND will cause windows to run its
-   own event loop waiting for the mouse up event.  The application
-   therefore cannot rely on it's main event loop to get run for
-   each event.  Without running multiple threads, or setjmp, there
-   is little recourse for alerting the application in the
-   traditional X manner to Expose events while the window is
-   being moved.
-*/
-
-void W11AddEventHandler(Display *d, proto_W11EventHandler *ev) 
-{
-    wineventq->handler = ev;
-}
-
-
-static void
-doTranslateMessage(MSG *m)
-{
-       if ((m->message == WM_KEYDOWN) && 
-           ((m->wParam == VK_BACK) ||
-            (((m->wParam == VK_ADD) || (m->wParam == VK_SUBTRACT)) &&
-             (GetKeyState(VK_SHIFT) & 0x8000)))) return;
-       if ((m->message == WM_SYSKEYDOWN) && (m->wParam == VK_F10))
-       {
-           m->message = WM_KEYDOWN;
-           return;
-       }
-       TranslateMessage(m);
-}
-
-static LONG
-NT_default(HWND hWnd,UINT message,UINT wParam,LONG lParam)
-{
-    return DefWindowProc(hWnd, message, wParam, lParam);
-}
-
-static void
-NT_wakeup(HWND hWnd) 
-{
-    PostMessage(hWnd,USR_WakeUp,0,0L);
-}
-
-/*****************************************************************\
-
-       Function: MainWndProc
-       Inputs:   Window handle, message, message parameters.
-
-       Comments: This is called when messages are sent to the application
-                 but not to the application's message queue.  If an
-                 event can be processed, it is done here.  The equivalent
-                 XEvent is filled out in l_event, which is picked up
-                 in the X event routines.  Some events are not received
-                 from Windows, eg Enter/LeaveNotify, so these are made
-                 up as required.
-
-       Caution:  The application does not see HWND, but Window.
-
-\*****************************************************************/
-
-/* queued messages
-   WM_KEYDOWN
-   WM_KEYUP
-   WM_CHAR
-   WM_MOUSEMOVE
-   WM_BUTTONxx
-   WM_TIMER
-   WM_PAINT
-   WM_QUIT
-   */
-
-LONG NT_handleMsg(
-    HWND hWnd,           /* window handle                   */
-    UINT message,                /* type of message                 */
-    UINT wParam,                 /* additional information          */
-    LONG lParam)                 /* additional information          */
-{
-    RECT rect;
-    WINDOWPOS *posStruct;
-    unsigned long int st=0L;
-    NT_window *window;
-    long mask;
-    PAINTSTRUCT paintStruct;
-
-    /* if (message == WM_CLOSE) exit(0); */
-       
-    window = NT_find_window_from_id(hWnd);
-    if (window == NULL) return  (NT_default(hWnd, message, wParam, lParam));
-
-    mask = window->mask;
-       
-    switch (message) {
-       /* we'll handle these, later */
-       case WM_KILLFOCUS:
-           QEvent(wineventq,window,message,wParam,lParam);
-           NT_wakeup(hWnd);
-           break;
-       case WM_SETFOCUS:
-       case WM_QUIT:
-       case WM_CLOSE:
-       case WM_DESTROY:
-       case WM_SYSCHAR: /* alt-keys go here */
-       case WM_CHAR:
-       case WM_LBUTTONDBLCLK:
-       case WM_MBUTTONDBLCLK:
-       case WM_RBUTTONDBLCLK:
-       case USR_MapNotify:
-       case USR_EnterNotify:
-       case WM_MOVE:
-#if defined(WIN9X)
-       case WM_SIZING:
-#endif                 
-       case WM_SIZE:                   
-           QEvent(wineventq,window,message,wParam,lParam);
-           break;
-       case WM_DESTROYCLIPBOARD:
-           if (destroyClipboardCatcher)
-               destroyClipboardCatcher=0;
-           else {
-               QEvent(wineventq,window,message,wParam,lParam);
-               NT_wakeup(hWnd);
-            }
-           break;
-       case WM_PAINT:
-           BeginPaint(hWnd,&paintStruct);
-           FillRect(paintStruct.hdc, &paintStruct.rcPaint,window->bg);
-           QEvent(wineventq,window,message,
-                  (((paintStruct.rcPaint.right-paintStruct.rcPaint.left)&0xffff) |
-                   (((paintStruct.rcPaint.bottom-paintStruct.rcPaint.top)&0xffff)<<16)),
-                  (((paintStruct.rcPaint.left)&0xffff) | (((paintStruct.rcPaint.top)&0xffff)<<16)));
-
-           EndPaint(hWnd,&paintStruct);
-           break;
-           /* capture the mouse on button down to emulate x */
-       case WM_LBUTTONDOWN:
-       case WM_MBUTTONDOWN:
-       case WM_RBUTTONDOWN:
-           SetCapture(hWnd);
-           QEvent(wineventq,window,message,wParam,lParam);
-           break;
-       case WM_MBUTTONUP:
-       case WM_LBUTTONUP:
-       case WM_RBUTTONUP:
-           ReleaseCapture();
-           QEvent(wineventq,window,message,wParam,lParam);
-           break;
-       case WM_MOUSEMOVE:
-           if ((mask&PointerMotionMask) ||
-               ((mask&Button1MotionMask)&& (wParam&MK_LBUTTON)) ||
-               ((mask&Button2MotionMask)&& (wParam&MK_MBUTTON)) ||
-               ((mask&Button3MotionMask)&& (wParam&MK_RBUTTON)) ||
-               ((mask&ButtonMotionMask)&&((wParam&(MK_LBUTTON|MK_MBUTTON|MK_RBUTTON))))
-               )
-               QEvent(wineventq,window,message,wParam,lParam);
-           else
-               return (NT_default(hWnd, message, wParam, lParam));
-           break;
-       case WM_MOUSEWHEEL:
-           /* this event only seems to go to the top most window.
-              see if child windows accept it. */
-           window = NT_find_child(window,ButtonPressMask|Button2MotionMask|Button3MotionMask,
-                                  ButtonPressMask|Button3MotionMask );
-           if (window && ((window->mask)&ButtonPressMask)) 
-               QEvent(wineventq,window,message,wParam,lParam);
-           else
-               return (NT_default(hWnd, message, wParam, lParam));
-           break;
-       case WM_ERASEBKGND:
-           /* don't erase the background */
-           return 1;
-           break;
-       case WM_SYSCOMMAND:
-           wineventq->dispatch++;
-           NT_default(hWnd, message, wParam, lParam);
-           wineventq->dispatch--;
-           break;
-       case WM_KEYDOWN:
-           switch (wParam)
-           {
-               case VK_CANCEL:
-               case VK_CLEAR:
-               case VK_PAUSE:
-               case VK_PRIOR:
-               case VK_NEXT:
-               case VK_END:
-               case VK_HOME:
-               case VK_LEFT:
-               case VK_UP:
-               case VK_RIGHT:
-               case VK_DOWN:
-               case VK_SELECT:
-               case VK_PRINT:
-               case VK_EXECUTE:
-               case VK_INSERT:
-               case VK_DELETE:
-               case VK_HELP:
-               case VK_NUMLOCK:
-               case VK_SCROLL:
-               case VK_BACK:
-                case VK_F1:
-                case VK_F2:
-                case VK_F3:
-                case VK_F4:
-                case VK_F5:
-                case VK_F6:
-                case VK_F7:
-                case VK_F8:
-                case VK_F9:
-                case VK_F10:
-                case VK_F11:
-               case VK_F12:
-               case VK_ADD:
-               case VK_SUBTRACT:
-                   QEvent(wineventq,window,message,wParam,lParam);
-                   break;
-               default:
-                   return  (NT_default(hWnd, message, wParam, lParam));
-                   break;
-                                       
-           }
-           break;
-       default:                          /* Passes it on if unproccessed    */
-           return (NT_default(hWnd, message, wParam, lParam));
-    }
-    return 0L;
-}
-
-/*****************************************************************\
-
-       Function: NT_get_state
-       Inputs: 
-
-       Comments: Get the keyboard state
-
-\*****************************************************************/
-
-static unsigned int
-NT_get_state()
-{
-       unsigned int state = 0;
-       if (GetKeyState(VK_SHIFT)   & 0x8000) state |= ShiftMask;
-       if (GetKeyState(VK_CONTROL) & 0x8000)
-       {
-               if (!(GetKeyState(VK_MENU) & 0x8000)) 
-                       state |= ControlMask;
-       }
-       else if (GetKeyState(VK_MENU)    & 0x8000)
-               state |= Mod1Mask;
-       if (GetKeyState(VK_CAPITAL) & 0x0001) state |= LockMask;
-       if (GetKeyState(VK_NUMLOCK) & 0x0001) state |= Mod5Mask;
-       if (GetKeyState(VK_SCROLL)  & 0x0001) state |= Mod3Mask;
-       if (GetKeyState(VK_LBUTTON) & 0x8000) state |= Button1Mask;
-       if (GetKeyState(VK_MBUTTON) & 0x8000) state |= Button2Mask;
-       if (GetKeyState(VK_RBUTTON) & 0x8000) state |= Button3Mask;
-       return state;
-}
-
-int
-WinEventToXEvent(
-    WinEvent *we,
-    XEvent *event)
-{
-    POINT pt;
-    RECT rect;
-    unsigned long int st=0L;
-    UINT key;
-    HWND hWnd;
-    UINT wParam;
-    LONG lParam;
-    NT_window *window;
-       
-    do {               
-       if (event==NULL) break;
-       if (we == NULL) break;
-
-       window = we->window;
-       wParam = we->wParam;
-       lParam = we->lParam;
-               
-       event->type=-1;
-       event->xbutton.subwindow = None;
-       hWnd = window->w;
-               
-       switch (we->message) {
-           case WM_SETFOCUS:
-               event->type=FocusIn;
-               event->xfocus.window=(Window)window;
-               break;
-           case WM_KILLFOCUS:
-               event->type=FocusOut;
-               event->xfocus.window=(Window)window;
-               break;  
-                               /*      case WM_ERASEBKGND: */
-           case WM_PAINT:
-               event->type=Expose;
-               event->xexpose.x=LOWORD(lParam); /* right */
-               event->xexpose.y=HIWORD(lParam); /* top */
-               event->xexpose.width=LOWORD(wParam);
-               event->xexpose.height=HIWORD(wParam);
-               event->xexpose.count=0;
-               event->xexpose.window=(Window)window;
-               break;
-           case WM_LBUTTONDOWN:
-           case WM_LBUTTONDBLCLK:
-               event->type = ButtonPress;
-               event->xbutton.x = LOWORD (lParam);
-               event->xbutton.y = HIWORD (lParam);
-               if ( wParam & MK_SHIFT )
-                   event->xbutton.button=Button2;
-               else
-                   event->xbutton.button=Button1;
-               event->xbutton.window = (Window)window;
-               event->xbutton.time=GetTickCount();
-               break;
-           case WM_LBUTTONUP:
-               event->type=ButtonRelease;
-               event->xbutton.x=LOWORD(lParam);
-               event->xbutton.y=HIWORD (lParam);
-               if ( wParam & MK_SHIFT )
-                   event->xbutton.button=Button2;
-               else
-                   event->xbutton.button=Button1;
-               event->xbutton.window=(Window)window;
-               event->xbutton.time=GetTickCount();
-               break;
-           case WM_MBUTTONDOWN:
-           case WM_MBUTTONDBLCLK:
-               event->type=ButtonPress;
-               event->xbutton.x=LOWORD(lParam);
-               event->xbutton.y=HIWORD (lParam);
-               event->xbutton.button=Button2;
-               event->xbutton.window=(Window)window;
-               event->xbutton.time=GetTickCount();
-               break;
-           case WM_MBUTTONUP:
-               event->type=ButtonRelease;
-               event->xbutton.x=LOWORD(lParam);
-               event->xbutton.y=HIWORD (lParam);
-               event->xbutton.button=Button2;
-               event->xbutton.window=(Window)window;
-               event->xbutton.time=GetTickCount();
-               break;
-           case WM_RBUTTONDOWN:
-           case WM_RBUTTONDBLCLK:
-               event->type=ButtonPress;
-               event->xbutton.x=LOWORD(lParam);
-               event->xbutton.y=HIWORD (lParam);
-               event->xbutton.button=Button3;
-               event->xbutton.window=(Window)window;
-               event->xbutton.time=GetTickCount();
-               break;
-           case WM_RBUTTONUP:
-               event->type=ButtonRelease;
-               event->xbutton.x=LOWORD(lParam);
-               event->xbutton.y=HIWORD (lParam);
-               event->xbutton.button=Button3;
-               event->xbutton.window=(Window)window;
-               event->xbutton.time=GetTickCount();
-               break;
-           case WM_MOUSEMOVE:
-               if (hWnd!=(HWND)NT_CWIN)  /* Mouse in different window? */
-               {
-                   if (NT_CWIN==NULL) /* No previous window */
-                   {
-                       event->type = EnterNotify;
-                       event->xcrossing.x = LOWORD(lParam);
-                       event->xcrossing.y = HIWORD(lParam);
-                       event->xcrossing.window = (Window)window;
-                   }
-                   else
-                   {
-                       event->type=LeaveNotify;
-                       event->xcrossing.x=LOWORD(lParam);
-                       event->xcrossing.y=HIWORD(lParam);
-                       event->xcrossing.window = (Window)NT_find_window_from_id(NT_CWIN);
-                   }
-               }
-               else
-               {
-                   event->type=MotionNotify;    /* Fill out mouse event */
-                   event->xmotion.window=(Window)window;
-                   event->xmotion.x=pt.x=LOWORD(lParam);
-                   event->xmotion.y=pt.y=HIWORD(lParam);
-                   event->xmotion.time=GetTickCount();
-                   ClientToScreen(hWnd,&pt);     /* Translate coordinates */
-                   event->xmotion.x_root=pt.x;
-                   event->xmotion.y_root=pt.y;
-                   if (wParam&MK_CONTROL)
-                       st|=ControlMask;
-                   if (wParam&MK_SHIFT)
-                       st|=ShiftMask;
-                   if (wParam&MK_LBUTTON)
-                       st|=Button1Mask;
-                   if (wParam&MK_MBUTTON)
-                       st|=Button2Mask;
-                   if (wParam&MK_RBUTTON)
-                       st|=Button3Mask;
-                   event->xmotion.state=st;
-               }
-               NT_CWIN=(NT_window *)hWnd;
-               break;
-           case WM_MOUSEWHEEL:
-               event->type=ButtonRelease;
-               event->xbutton.x=LOWORD(lParam);
-               event->xbutton.y=HIWORD (lParam);
-               event->xbutton.button=HIWORD(wParam)>32768?Button5:Button4;
-               event->xbutton.window=(Window)window;
-               event->xbutton.time=GetTickCount();
-               if (wParam&MK_CONTROL)
-                   st|=ControlMask;
-               if (wParam&MK_SHIFT)
-                   st|=ShiftMask;
-               if (wParam&MK_LBUTTON)
-                   st|=Button1Mask;
-               if (wParam&MK_MBUTTON)
-                   st|=Button2Mask;
-               if (wParam&MK_RBUTTON)
-                   st|=Button3Mask;
-               event->xbutton.state=st;
-               break;
-           case WM_SYSCHAR:
-           case WM_CHAR:
-               event->type=KeyPress;
-               event->xkey.state=NT_get_state();
-               event->xkey.x=event->xkey.y=0; /* Inside the window */
-               event->xkey.keycode=LOWORD(wParam);
-               if (GetKeyState(VK_CONTROL) & 0x8000) {
-                   if (event->xkey.keycode == 32) { event->xkey.keycode=0; }
-                   if (event->xkey.keycode >255 ) { event->xkey.keycode=0; }
-               }
-               event->xkey.window=(Window)window;
-               break;
-           case WM_KEYDOWN:
-               event->type=KeyPress;
-               switch (wParam)
-               {
-                   case VK_CANCEL:  key=XK_Cancel;      break;
-                   case VK_CLEAR:   key=XK_Clear;       break;
-               /*  causes AltGr to create a keypress */
-               /*  case VK_MENU:    key=XK_Alt_L;       break;*/
-                   case VK_PAUSE:   key=XK_Pause;       break;
-                   case VK_PRIOR:   key=XK_Prior;       break;
-                   case VK_NEXT:    key=XK_Next;        break;
-                   case VK_END:     key=XK_End;         break;
-                   case VK_HOME:    key=XK_Home;        break;
-                   case VK_LEFT:    key=XK_Left;        break;
-                   case VK_UP:      key=XK_Up;          break;
-                   case VK_RIGHT:   key=XK_Right;       break;
-                   case VK_DOWN:    key=XK_Down;        break;
-                   case VK_SELECT:  key=XK_Select;      break;
-                   case VK_PRINT:   key=XK_Print;       break;
-                   case VK_EXECUTE: key=XK_Execute;     break;
-                   case VK_INSERT:  key=XK_Insert;      break;
-                   case VK_DELETE:  key=XK_Delete;      break;
-                   case VK_HELP:    key=XK_Help;        break;
-                   case VK_NUMLOCK: key=XK_Num_Lock;    break;
-                   case VK_SCROLL:  key=XK_Scroll_Lock; break;
-                   case VK_BACK:    key=XK_BackSpace; break;
-                    case VK_F1:      key=XK_F1;          break;
-                    case VK_F2:      key=XK_F2;          break;
-                    case VK_F3:      key=XK_F3;          break;
-                    case VK_F4:      key=XK_F4;          break;
-                    case VK_F5:      key=XK_F5;          break;
-                    case VK_F6:      key=XK_F6;          break;
-                    case VK_F7:      key=XK_F7;          break;
-                    case VK_F8:      key=XK_F8;          break;
-                    case VK_F9:      key=XK_F9;          break;
-                    case VK_F10:     key=XK_F10;         break;
-                    case VK_F11:     key=XK_F11;         break;
-                    case VK_F12:     key=XK_F12;         break;
-                   case VK_ADD:     key=XK_KP_Add;      break;
-                   case VK_SUBTRACT:key=XK_KP_Subtract; break;
-                   default:         key=0;              break;
-               }
-               if (key == 0) {
-                   event->type = -1;
-               }
-               else
-               {
-                   event->xkey.keycode=key;
-                   event->xkey.window=(Window)window;
-                   event->xkey.state=NT_get_state();
-                   event->xkey.x=event->xkey.y=0; /* Inside the window */
-               }
-               break;
-           case WM_DESTROY:
-           case WM_QUIT:
-           case WM_CLOSE:
-               event->type = ClientMessage;
-               event->xclient.format = 32;
-               event->xclient.data.l[0] = XInternAtom(NULL,"WM_DELETE_WINDOW", FALSE);
-               break;
-           case USR_EnterNotify:
-               event->type = EnterNotify;
-               event->xcrossing.x = LOWORD(lParam);
-               event->xcrossing.y = HIWORD(lParam);
-               event->xcrossing.window = (Window)window;
-               break;
-           case WM_MOVE:
-               if (window->min==0)
-               {
-                   window->x =  LOWORD(lParam);
-                   window->y =  HIWORD(lParam);
-                   NT_configureNotify(window,window->x,window->y);
-                   event->type = ConfigureNotify;
-                   event->xconfigure.window = (Window)window;
-                   event->xconfigure.x = 0;  /* client area is always @ 0 */
-                   event->xconfigure.y = 0;
-                   event->xconfigure.width = window->wdth;
-                   event->xconfigure.height = window->hght;
-                   event->xconfigure.above = Above;
-               }
-               break;
-           case WM_SIZING:
-               event->type = ConfigureNotify;
-               window->wdth =  LOWORD(lParam);
-               if (window->wdth<window->minx)
-                   window->wdth = window->minx;
-               window->hght =  HIWORD(lParam);
-               if (window->hght<window->minx)
-                   window->hght = window->miny;
-               NT_configureNotify(window,window->x,window->y);
-               event->xconfigure.window = (Window)window;
-               event->xconfigure.x = 0;
-               event->xconfigure.y = 0;
-               event->xconfigure.width = window->wdth;
-               event->xconfigure.height = window->hght;
-               event->xconfigure.above = Above;
-               break;
-           case WM_SIZE:
-               switch(wParam)
-               {
-                   case SIZE_MINIMIZED:
-                       event->type=UnmapNotify;
-                       window->min=1;
-                       break;
-                   default:
-                       event->type = ConfigureNotify;
-                       window->wdth =  LOWORD(lParam);
-                       if (window->wdth<window->minx)
-                           window->wdth = window->minx;
-                       window->hght =  HIWORD(lParam);
-                       if (window->hght<window->minx)
-                           window->hght = window->miny;
-                       event->xconfigure.window = (Window)window;
-                       event->xconfigure.x = 0;
-                       event->xconfigure.y = 0;
-                       event->xconfigure.width = window->wdth;
-                       event->xconfigure.height = window->hght;
-                       event->xconfigure.above = Above;
-#if !defined(WIN9X)                                            
-                       if (window->min) event->type=MapNotify;
-#endif                                         
-                       window->min=0;
-                       break;
-               }
-               break;
-           case WM_DESTROYCLIPBOARD:
-               event->type = SelectionClear;
-               event->xselectionclear.time = GetTickCount();
-               break;
-           case USR_MapNotify:
-               event->type=MapNotify;
-               break;
-           case USR_ConvertSelection:
-               event->type=SelectionNotify;
-               event->xselection.requestor = (Window)window;
-               event->xselection.property = XA_CUT_BUFFER0;                    
-               break;
-           default:
-               break;
-       }
-    } while(0);
-    return (event==NULL?0: (event->type==-1?0:1));
-}
-/*****************************************************************\
-
-
-       Function: XCheckWindowEvent
-       Inputs:   display, window, event mask.
-       Returned: pointer to filled in event structure, status.
-
-       Comments: This is fudged at the moment to work with the toolkit.
-                 The event system needs rewriting to account properly for
-                 event masks.
-
-\*****************************************************************/
-
-BoolDef
-XCheckTypedEvent(display,ev,rep)
-Display *display;
-int ev;
-XEvent *rep;
-{
-       xtrace("XCheckTypedEvent\n");
-       return (False);
-}
-
-BoolDef
-XCheckWindowEvent(display,w,emask,ev)
-Display *display;
-Window w;
-long emask;
-XEvent *ev;
-{
-       NT_window *ntw=(NT_window *)w;
-       MSG msg;
-       BoolDef status = 0;
-
-       xtrace("XCheckWindowEvent\n");
-       if (emask&0)
-               if (PeekMessage(&msg,ntw->w,USR_MapNotify,
-                                               USR_MapNotify,PM_REMOVE)||
-                   PeekMessage(&msg,ntw->w,WM_PAINT,WM_PAINT,PM_REMOVE))
-               {
-                       cjh_printf("removed message\n");
-                       ev->type=ConfigureNotify;
-                       status = 1;
-               }
-       return(status);
-}
-
-/*
-  XPending checks for x events pending.
-  We don't know if we have x events until we process
-  the win events.
-  */
-int
-XPending (display)
-Display *display;
-{
-       MSG msg;
-       /*      xtrace("XPending\n"); */
-       while(wineventq->count<=0 && PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
-       {
-               doTranslateMessage(&msg);
-               DispatchMessage(&msg);
-       }
-       return wineventq->count;
-}
-
-int
-XPutBackEvent(display,event)
-Display *display;
-XEvent *event;
-{
-       xtrace("XPutBackEvent\n");
-       return 0;
-}
-
-
-StatusDef
-XSendEvent(display,w,prop,emask,event)
-Display *display;
-Window w;
-BoolDef prop;
-long emask;
-XEvent *event;
-{
-       xtrace("XSendEvent\n");
-       return 0;
-}
-
-/* I'm tempted to flush the windows queue
-**   before checking, but I think that would
-**   break the assumtion that most of the WM_PAINT
-**   messges are only going to be dispatched when
-**   the app is directly calling us.
-*/
-
-BoolDef
-XCheckTypedWindowEvent(
-       Display* display,
-       Window w,
-       int event_type,
-       XEvent* event_return)
-{
-       int i,j;
-       xtrace("XCheckTypedWindowEvent\n");
-       if (w==0) return 0;
-       /*
-       i = wineventq->next;
-       while(i != wineventq->avail)
-       {
-               if (wineventq->list[i].window==(NT_window*)w)
-               {
-                       WinEventToXEvent(&wineventq->list[i],event_return);
-                       if (event_return->type == event_type)
-                       {
-                               break;
-                       }
-               }
-               i++;
-               if (i>wineventq->num) i=0;
-       }
-       if (i != wineventq->avail)
-       {
-               while(i != wineventq->next)
-               {
-                       j =i-1;
-                       if (j<0) j= wineventq->num;
-                       copyWinEvent(&wineventq->list[i],&wineventq->list[j]);
-                       i = j;
-               }
-               wineventq->next++;
-               wineventq->count--;
-               cjh_printf("removed an event\n");
-               return 1;
-       }
-       */
-       return 0;
-}
-
-/*****************************************************************\
-
-
-       Function: XWindowEvent
-       Inputs:   display, window, event mask.
-       Returned: pointer to filled in event structure.
-
-       Comments: This is fudged at the moment to work with the toolkit.
-                 The event system needs rewriting to account properly for
-                 event masks.
-
-\*****************************************************************/
-
-int
-XWindowEvent(display,w,emask,rep)
-Display *display;
-Window w;
-long emask;
-XEvent *rep;
-{
-       NT_window *ntw=(NT_window *)w;
-       MSG msg;
-
-       xtrace("XWindowEvent\n");
-       if (emask&ExposureMask)
-       {
-               GetMessage(&msg,ntw->w,USR_MapNotify,USR_MapNotify);
-               rep->type=ConfigureNotify;
-       }
-       return 0;
-}
-
-
-
-/*****************************************************************\
-
-       Function: XNextEvent
-       Inputs:   display, event structure pointer.
-
-       Comments: Windows routines receive messages (events) in two ways:
-                 firstly by GetMessage, which takes messages from the
-                 calling thread's message queue, and secondly by the
-                 window function being called with events as arguments.
-                 To simulate the X system, we get messages from the queue
-                 and pass them to the window function anyway, which
-                 processes them and fills out the local XEvent structure.
-                 DispatchMessage calls the window procedure and waits until
-                 it returns. Translate message turns WM_KEYUP/DOWN messages
-                 into WM_CHAR.
-
-\*****************************************************************/
-
-int
-XNextEvent(Display *display,XEvent  *event)
-{
-    MSG msg;
-       
-    xtrace("XNextEvent\n");
-
-    /* if there isn't already an event in the pipe, this will block */
-    while(wineventq->count <= 0 && GetMessage(&msg, NULL, 0, 0)>0)
-    {          
-       doTranslateMessage(&msg);
-       DispatchMessage(&msg);
-    }
-    if (wineventq->count>0)
-    {
-       getQdEvent(wineventq,event);
-    }
-    else
-    {
-       /* hmm, GetMessage failed, maybe we're supposed to quit */
-       event->type=ClientMessage;
-       event->xclient.format = 32;
-       event->xclient.data.l[0] = XInternAtom(NULL,"WM_DELETE_WINDOW", FALSE);
-       return 1;
-    }
-    return 1;
-}
-
-BoolDef
-XFilterEvent(XEvent* event,Window window)
-{
-       xtrace("XFilterEvent\n");
-       return 0;
-}
-
-BoolDef
-XQueryPointer(
-       Display* display,
-       Window w,
-       Window* root_return,
-       Window* child_return,
-       int* root_x_return,
-       int* root_y_return,
-       int* win_x_return,
-       int* win_y_return,
-       unsigned int* mask_return)
-{
-    POINT point;
-       RECT rect;
-       xtrace("XQueryPointer\n");
-    GetCursorPos(&point);
-    *root_x_return = point.x;
-    *root_y_return = point.y;
-       GetWindowRect(((NT_window*)w)->w,&rect);
-       *win_x_return= point.x - rect.left;
-       *win_y_return= point.y - rect.top;
-       *mask_return = NT_get_state();
-    return True;
-}
-
-int
-XConvertSelection(
-    Display *display,
-    Atom sel, Atom target, Atom prop,
-    Window req,        
-    Time time)
-{
-    xtrace("XConvertSelection\n");
-    QEvent(wineventq,(NT_window*)req,USR_ConvertSelection,0,0L);
-    NT_wakeup(((NT_window*)req)->w);
-    return 0;
-}
-
diff --git a/W11/w32/ntdef.h b/W11/w32/ntdef.h
deleted file mode 100644 (file)
index cfe94fe..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-
-
-#ifndef __NTDEF
-#define __NTDEF
-#include <windows.h>
-
-#define INVALID_HANDLE ((HANDLE) -2)
-#define NONMAPPED_HANDLE  ((HANDLE) -3)
-#define VALID_WINDOW(x) (x && (((NT_window *)x)->w != INVALID_HANDLE))
-#define xtrace
-#define cjh_printf
-
-#define CNUMTORGB(x) x
-        /* #define printf(x)   *//* x */ 
-        /* #define SetSystemPaletteUse(x) *//* x */
-
-/*     Windows NT Special event aliases        */
-
-#define USR_MapNotify       0x0401
-#define USR_EnterNotify     0x0402
-#define USR_LeaveNotify     0x0403
-#define USR_Expose          0x0404
-#define USR_ResizeRequest   0x0405
-#define USR_WakeUp          0x0406
-#define USR_ConvertSelection 0x0407
-
-struct NT_child
-{
-       struct NT_window *w;
-       struct NT_child *next;
-} NT_child;
-
-typedef struct NT_window
-{
-       HWND w;
-       HBRUSH bg;
-       int parentRelative;
-       struct NT_window *parent;      /* parent of this window */
-       struct NT_window *next;        /* next window in list */
-       struct NT_child *child;        /* points to list of children */
-       int    x, y;                   /* Position */
-       unsigned int wdth, hght;       /* Dimensions */
-       char *title_text;
-       struct NT_prop_list *props;    /* linked list of properties.*/
-       HDC    hDC;
-       HBITMAP hBitmap;
-       int min;
-       int minx, miny;  /* minimum window size */
-       int top_flag;
-       long mask;   /* selectInputMask */
-} NT_window;
-
-/* Routine declarations */
-
-struct NT_window      *NT_find_window_from_id();
-int                    NT_delete_window();
-
-struct NT_window      *NT_new_window();
-int NT_add_child(NT_window *parent,NT_window *child);
-struct NT_window *NT_find_child(NT_window *w,unsigned long mask,
-                                                                  unsigned long val);
-int NT_del_child(NT_window *parent,NT_window *child);
-void freeMemory(void *p);
-void *allocateMemory(int s);
-void initQ();
-void catchNextDestroyClipboard();
-
-void NT_SetAtom(ATOM class);
-HWND NT_create_window(char *title,DWORD style,int x,int y,int w, int h,HWND parent);
-LONG NT_handleMsg(HWND hWnd,UINT message,UINT wParam,LONG lParam);
-HBITMAP NT_getWallpaper();
-void NT_moveWindow(NT_window *ntw, BOOL repaint);
-#endif
diff --git a/W11/w32/ntutil.c b/W11/w32/ntutil.c
deleted file mode 100644 (file)
index 613312b..0000000
+++ /dev/null
@@ -1,379 +0,0 @@
-#include "ntdef.h"
-
-static struct NT_window *window_list=NULL;
-
-void
-freeMemory(void *p) {
-       if (p!=NULL) free(p);
-}
-void *
-allocateMemory(int s) {
-       void *p=NULL;
-       if (s)
-       {
-               p=(void *)malloc(s);
-               if (p) memset(p,0,s);
-       }
-       return p;
-}
-
-
-/*---------------------------------------------------*\
-| Function: NT_new_window                             |
-| Purpose:  Add a new window id to the Window table   |
-| Return:   Pointer to the new Window structure.      |
-\*---------------------------------------------------*/
-struct NT_window *
-NT_new_window()
-{
-       struct NT_window *new;
-       xtrace("NT_new_window\n");
-       new = (struct NT_window *) allocateMemory (sizeof(struct NT_window));
-       new->next = window_list;
-       new->child=NULL;
-       new->min = 1;
-       new->minx =0;
-       new->miny =0;
-       new->w = INVALID_HANDLE;
-       new->parent= NULL;
-       new->hBitmap = INVALID_HANDLE;
-       new->hDC = INVALID_HANDLE;
-       window_list = new;
-       cjh_printf("NEW window %x\n",window_list);
-       return(window_list);
-}
-       
-/*---------------------------------------------------*\
-| Function: NT_delete_window                          |
-| Purpose:  Remove a window from the window list      |
-| Input:    w - pointer to window data                |
-| Return:   TRUE if deleted                           |
-\*---------------------------------------------------*/
-int
-NT_delete_window(struct NT_window *w)
-{
-       NT_window *f;
-       xtrace("NT_delete_window\n");
-       
-       if (w->w != INVALID_HANDLE)
-       {
-               /* ShowWindow(w->w,SW_HIDE);*/
-               DestroyWindow(w->w);
-               w->w=INVALID_HANDLE;
-       }
-       if (w->hBitmap != INVALID_HANDLE)
-       {
-               DeleteObject(w->hBitmap);
-               w->hBitmap = INVALID_HANDLE;
-       }
-       if (w->hDC != INVALID_HANDLE)
-       {
-               DeleteDC(w->hDC);
-               w->hDC=INVALID_HANDLE;
-       }
-       
-       if (window_list == w)
-               window_list=w->next;
-       else
-       {
-               for (f=window_list; f!=NULL && f->next!=w; f=f->next);
-               if (f!=NULL)
-                       f->next = w->next;
-       }
-       freeMemory(w);
-       return TRUE;
-}
-
-/*------------------------------------------------*\
-| Function: NT_find_window_from_id                 |
-| Purpose:  Find the window in the window list     |
-|           from the HWND id of the window.        |
-| Input:    w - Window id (Windows HWND)           |
-| Return:   pointer to NT_window structure for w.  |
-\*------------------------------------------------*/
-struct NT_window *
-NT_find_window_from_id(HWND w)
-{
-       struct NT_window *current = window_list;
-       /* xtrace("NT_find_window_from_id\n"); */
-       
-       while ( current != NULL &&
-                       current->w != w )
-               current = current->next;
-       if(current)
-               return(current);
-       current=window_list;
-       return NULL;
-}
-
-/*****************************************************************\
-
-       Function: NT_add_child
-       Inputs:   parent and child window IDs.
-       Returned: 1
-
-       Comments: When a child window is created (eg. client canvas) we
-                 update our internal list of windows and their children.
-                 New children are added to the front of the list.
-
-\*****************************************************************/
-
-int
-NT_add_child(parent,child)
-NT_window *parent,*child;
-{
-       struct NT_child *new;
-
-       new=(struct NT_child *) allocateMemory (sizeof(struct NT_child));
-       new->w=child;
-       new->next = parent->child;
-       parent->child=new;
-       return(1);
-}
-
-struct NT_window *
-NT_find_child(NT_window *w,unsigned long mask,
-                                                               unsigned long val)
-{
-       struct NT_window *ret = NULL;
-       struct NT_child *child = NULL;
-       if (w)
-       {
-               if ((w->mask&mask)==val) ret=w;
-               child = w->child;
-               while(!ret && child) {
-                       ret = NT_find_child(child->w, mask, val);
-                       child=child->next;
-               }
-       }
-       return ret;
-}
-
-
-
-/*****************************************************************\
-
-       Function: NT_del_child
-       Inputs:   parent and child window IDs.
-       Returned: TRUE if window is removed, FALSE otherwise.
-
-       Comments: Finds child window if it exits, and it so removes it from
-                 the window list.
-
-\*****************************************************************/
-
-int
-NT_del_child(parent,child)
-struct NT_window *parent;
-struct NT_window *child;
-{
-       struct NT_child *current,*last;
-       int status=FALSE;
-
-       if (parent->child==NULL)
-       {
-       }
-       else if (parent->child->w==child)
-       {
-               current = parent->child;
-               parent->child=parent->child->next;
-               freeMemory(current);
-               status=TRUE;
-       }
-       else
-       {
-               last=parent->child;
-               current=parent->child->next;
-               while (current->w!=child && current!=NULL)
-               {
-                       last=current;
-                       current=current->next;
-               }
-               if (current!=NULL)
-               {
-                       last->next=current->next;
-                       freeMemory(current);
-                       status=TRUE;
-               }
-       }
-       return(status);
-}
-
-/*****************************************************************\
-
-       Function: WinMain
-       Inputs:   instance, previous instance, command line arguments,
-                 default start up.
-
-       Comments: Called instead of main() as the execution entry point.
-
-\*****************************************************************/
-#ifdef NOTCYGWIN
-#define MAX_COMMAND_ARGS 20
-static HANDLE hInstance,hPrevInstance;
-int APIENTRY
-WinMain(HINSTANCE hInst,HINSTANCE hPrevInst,LPSTR lpCmdLine,int nCmdShow)
-{
-        static char *command_args[MAX_COMMAND_ARGS];
-        static int num_command_args;
-        static char proEng[] = "proe";
-        char *wordPtr,*tempPtr;
-        int i,quote;
-       hInstance=hInst;
-       hPrevInstance=hPrevInst;
-
-        for (i=0;i<MAX_COMMAND_ARGS;i++)
-          command_args[i] = NULL;
-
-        wordPtr = lpCmdLine;
-        quote = 0;
-        num_command_args = 1;
-        command_args[0] = proEng;
-        while  (*wordPtr && (*wordPtr == ' ' || *wordPtr == '\t'))
-           wordPtr++;
-        if (*wordPtr == '\"')
-        {
-          quote = 1;
-          wordPtr++;
-        }
-        if (!*wordPtr)
-          main(0,NULL);
-        else
-        {
-          while (*wordPtr && num_command_args < MAX_COMMAND_ARGS)
-          {
-            tempPtr = wordPtr;
-            if (quote)
-            {
-              while (*tempPtr && *tempPtr != '\"')
-                tempPtr++;
-              quote = 0;
-            }
-            else
-              while (*tempPtr && *tempPtr != ' ')
-                tempPtr++;
-            if (*tempPtr)
-              *(tempPtr++) = '\0';
-            command_args[num_command_args++] = wordPtr;
-            wordPtr = tempPtr;
-            while (*wordPtr && (*wordPtr == ' ' || *wordPtr == '\t'))
-              wordPtr++;
-            if (*wordPtr == '\"')
-            {
-              quote = 1;
-              wordPtr++;
-            }
-          }
-          main(num_command_args,command_args);
-        }
-
-}
-#endif
-
-static ATOM atom=0;
-void
-NT_SetAtom(ATOM class)
-{
-       atom = class;
-}
-
-HWND
-NT_create_window(char *title,DWORD style,int x,int y,int w, int h,HWND parent)
-{
-       HMODULE hInst = NULL; /* GetModuleHandleA(NULL); */
-       return CreateWindow((LPCTSTR)MAKELONG(atom,0),title,style,x,y,w,h,
-                                                                parent,NULL,hInst,NULL);
-}
-HBITMAP
-NT_getWallpaper()
-{
-       HBITMAP hb = NULL;
-       do {
-               HKEY hKey;
-               TCHAR wallpaper[MAX_PATH];
-               DWORD dwBufLen = MAX_PATH;
-               LONG lRet;
-
-               lRet = RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Control Panel\\Desktop"), 0, KEY_QUERY_VALUE, &hKey);
-               if (lRet != ERROR_SUCCESS) break;
-
-               lRet = RegQueryValueEx(hKey, TEXT("Wallpaper"), NULL, NULL, (LPBYTE)wallpaper, &dwBufLen);
-               if (lRet != ERROR_SUCCESS) break;
-
-               RegCloseKey(hKey);
-               hb = LoadImage(NULL, wallpaper, IMAGE_BITMAP, 0, 0,
-               LR_CREATEDIBSECTION | LR_DEFAULTSIZE | LR_LOADFROMFILE );
-       } while(0);
-       return hb;
-}
-
-void
-NT_moveWindow(NT_window *ntw, BOOL repaint)
-{
-       MoveWindow(ntw->w, ntw->x,ntw->y,ntw->wdth,ntw->hght,repaint);
-       NT_configureNotify(ntw,ntw->x,ntw->y);
-}
-
-NT_set_origin(NT_window *ntw,int x, int y)
-{
-       HDC hdc;
-       hdc = GetDC(ntw->w);
-       SetBrushOrgEx(hdc,-x,-y,NULL);
-       ReleaseDC(ntw->w,hdc);
-}
-
-
-NT_confChild(NT_window *ntw,int x, int y)
-{
-       HDC hdc;
-       struct NT_child *child = NULL;
-       if (ntw)
-       {
-               if (ntw->parentRelative) NT_set_origin(ntw,x,y);
-               child = ntw->child;
-               while(child && child->w) {
-                       NT_confChild(child->w, child->w->x+x, child->w->y+y);
-                       child=child->next;
-               }
-       }
-}
-
-NT_configureNotify(NT_window *ntw,int x, int y)
-{
-       while(ntw && ntw->parent) {
-               ntw=ntw->parent;
-       }
-       NT_confChild(ntw,ntw->x,ntw->y);
-}
-
-
-
-/*
-HBITMAP
-NT_getWallpaper() 
-{
-       WCHAR wszWallpaper [MAX_PATH];
-       CHAR szWallpaper[MAX_PATH];
-       HRESULT hr;
-       HBITMAP hb = NULL;
-       IActiveDesktop* pIAD = NULL;
-       do {
-               CoInitialize ( NULL );
-               hr = CoCreateInstance ( CLSID_ActiveDesktop,
-                            NULL,
-                            CLSCTX_INPROC_SERVER,
-                            IID_IActiveDesktop,
-                            (void**) &pIAD );
-               if (! SUCCEEDED(hr) ) break;
-        hr = pIAD->GetWallpaper ( wszWallpaper, MAX_PATH, 0 );
-
-        if (! SUCCEEDED(hr) ) break;
-               wsprintf(szWallpaper,"%ls",wszWallpaper);
-               hb = LoadImage(NULL, szWallpaper, IMAGE_BITMAP, 0, 0,
-               LR_CREATEDIBSECTION | LR_DEFAULTSIZE | LR_LOADFROMFILE );
-       } while(0);
-       if (pIAD) pIAD->Release();
-       CoUninitialize();
-       return hb;
-}
-*/
diff --git a/W11/w32/xlib.c b/W11/w32/xlib.c
deleted file mode 100644 (file)
index c51ca00..0000000
+++ /dev/null
@@ -1,5213 +0,0 @@
-/*****************************************************************\
-
-
-       Library of X window functions which call Windows 32
-       equivalent functions.
-
-       Some data structures are maintained by this code,
-       simulating the operation of an X server and window manager.
-
-       Aug/Sep-92      xyz     $$1 Created.
-        Oct-92  abc $$2 Added color stuff.
-
-\******************************************************************/
-
-#ifndef __XNT
-#define __XNT
-
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include <fcntl.h>
-#include "ntdef.h"
-
-/* Local Data */
-
-static void                   NT_set_GC_pen();
-static void                   NT_set_GC_brush();
-static HPEN                   NT_get_GC_pen();
-static HBRUSH                 NT_get_GC_brush();
-static HBRUSH                 NT_get_GC_bgbrush();
-
-void NT_set_rop();
-double NT_deg64_to_rad(int a);
-
-/*----------------------------------------------------------------*\
-| FUNCTIONS TO MAINTAIN AN INTERNAL LIST OF WINDOWS AND THEIR      |
-| ATTRIBUTES - AS WOULD BE MAINTAINED IN THE X SERVER.             |
-\*----------------------------------------------------------------*/
-
-/* Structure to hold pen and brush info in GC ext_data field */
-
-typedef struct NTGC_
-{
-       HPEN    pen;
-       HBRUSH  brush;
-       HBRUSH  bgbrush;
-} NTGC;
-
-HDC
-cjh_get_dc(NT_window *window)
-{
-       /* pixmaps have to do SelectObject() on their dc's */
-       if (window->hDC == INVALID_HANDLE)
-               if (window->w == INVALID_HANDLE)
-               {
-                       window->hDC= CreateDC("DISPLAY", NULL, NULL, NULL);
-               }
-       else
-               window->hDC=GetDC(window->w);
-    return window->hDC;
-}
-
-int
-cjh_rel_dc(NT_window *window,HDC dc)
-{
-       return TRUE;
-       /*      return ReleaseDC(window, dc); */
-}
-
-HDC
-drawableGetDC(Drawable drawable)
-{
-       cjh_get_dc((NT_window *)drawable);
-}
-
-int
-drawableRelDC(Drawable drawable, HDC hDC)
-{
-       cjh_rel_dc((NT_window *)drawable, hDC);
-}
-
-
-
-/*****************************************************************\
-
-       Function: XOpenDisplay
-       Inputs:   Display name
-
-       Comments: Fills out a Display structure and a Visual and Screen.
-                 Hopefully all the X macros should work with this
-                 structure.  Note that the default visual is for a
-                 True colour screen (24bits).
-\*****************************************************************/
-Display *
-XOpenDisplay (name)
-const char *name;
-{
-       static char vstring[]="NT Xlibemu",
-               *vs,*dn;
-
-       Display *d = NULL;
-       Screen *scrd;
-       static Depth dlist[1];
-       static Visual vlist[1];
-       Colormap cmap;
-       RECT rect;
-       int depth;
-       HDC rootDC = CreateDC("DISPLAY",NULL,NULL,NULL);
-
-       depth = GetDeviceCaps(rootDC, BITSPIXEL);
-       
-       xtrace("XOpenDisplay\n");
-
-       initQ();
-       
-       dlist[0].depth=depth;
-       dlist[0].nvisuals=1;
-       dlist[0].visuals=vlist;
-       vlist[0].ext_data=NULL;
-       vlist[0].visualid=0;
-       vlist[0].class=PseudoColor;
-       vlist[0].bits_per_rgb=8;
-       vlist[0].map_entries=256;
-       vlist[0].red_mask=255;
-       vlist[0].green_mask=255<<8;
-       vlist[0].blue_mask=255<<16;
-       scrd=(Screen *) allocateMemory (sizeof (Screen));
-       (NT_window*)(scrd->root)= NT_new_window();
-       ((NT_window*)(scrd->root))->w=GetDesktopWindow();
-       ((NT_window*)(scrd->root))->parent=0;
-       GetWindowRect(GetDesktopWindow(),&rect);
-       scrd->width=rect.right-rect.left;
-       scrd->height=rect.bottom-rect.top;
-       scrd->mwidth=260;
-       scrd->mheight=190;
-       scrd->ndepths=1;
-       scrd->depths=dlist;
-       scrd->root_depth=depth;
-       scrd->root_visual=vlist;
-       scrd->default_gc=NULL;
-       scrd->cmap=cmap;
-       scrd->white_pixel=0xffffff;
-       scrd->black_pixel=0;
-
-       d=(Display *) allocateMemory (sizeof (Display));
-       scrd->display=d;
-       vs=(char *) allocateMemory (sizeof (char)*strlen (vstring)+1);
-       dn=(char *) allocateMemory (sizeof (char)*strlen (name)+1);
-       strcpy (vs,vstring);
-       strcpy (dn,name);
-       d->ext_data=NULL;
-       d->fd=0;
-       d->proto_major_version=11;
-       d->proto_minor_version=4;
-       d->vendor=vs;
-       d->release=4;
-       d->display_name=dn;
-       d->nscreens=1;
-       d->screens=scrd;
-       d->max_keycode=255;
-
-       return (d);
-}
-
-
-int
-XCloseDisplay(Display *display)
-{
-  NT_window *wanderer;
-
-  xtrace("XCloseDisplay\n");
-/* Do something ? */
-/* Must GlobalDelete all atoms/properties leftover */
-  return 0;
-}
-
-char *
-XDisplayString(Display *display)
-{
-       return (display->display_name);
-}
-
-
-int
-XFlush(Display *display)
-{
-       xtrace("XFlush\n");
-       return 0;
-}
-
-
-int
-XSync(display,discard)
-Display *display;
-int discard;
-{
-       /* Do nothing here either */
-       return 0;
-}
-
-/*****************************************************************\
-
-       Function: XGetVisualInfo
-       Inputs:   display, info mask, template, number of matches.
-       Returned: List of XVisualInfo structures, one for each matching
-                 Visual.
-
-       Comments: Behaves like X routine, but there is only ever one
-                 Visual, so the returned list is never longer than one.
-
-\*****************************************************************/
-XVisualInfo *
-XGetVisualInfo(display,vinm,vint,n)
-Display *display;
-long vinm;
-XVisualInfo *vint;
-int *n;
-{
-       static XVisualInfo xvi;
-       int status=1;
-       xtrace("XGetVisualInfo\n");
-
-       if ((vinm&VisualIDMask|vinm==VisualAllMask)&&
-            vint->visualid!=display->screens->root_visual->visualid)
-               status=0;
-       if ((vinm&VisualScreenMask|vinm==VisualAllMask)&&
-           vint->screen!=0)
-               status=0;
-       if ((vinm&VisualDepthMask|vinm==VisualAllMask)&&
-           vint->depth!=24)
-               status=0;
-       if ((vinm&VisualClassMask|vinm==VisualAllMask)&&
-           vint->class!=display->screens->root_visual->class)
-               status=0;
-       if ((vinm&VisualRedMaskMask|vinm==VisualAllMask)&&
-           vint->red_mask!=display->screens->root_visual->red_mask)
-               status=0;
-       if ((vinm&VisualGreenMaskMask|vinm==VisualAllMask)&&
-           vint->green_mask!=display->screens->root_visual->green_mask)
-               status=0;
-       if ((vinm&VisualBlueMaskMask|vinm==VisualAllMask)&&
-           vint->blue_mask!=display->screens->root_visual->blue_mask)
-               status=0;
-       if ((vinm&VisualColormapSizeMask|vinm==VisualAllMask)&&
-           vint->colormap_size!=display->screens->root_visual->map_entries)
-               status=0;
-       if ((vinm&VisualBitsPerRGBMask|vinm==VisualAllMask)&&
-           vint->bits_per_rgb!=display->screens->root_visual->bits_per_rgb)
-               status=0;
-       if (status==1)
-       {
-               xvi.visualid=display->screens->root_visual->visualid;
-               xvi.screen=0;
-               xvi.depth=display->screens->root_visual->bits_per_rgb;
-               xvi.class=display->screens->root_visual->class;
-               xvi.red_mask=display->screens->root_visual->red_mask;
-               xvi.green_mask=display->screens->root_visual->green_mask;
-               xvi.blue_mask=display->screens->root_visual->blue_mask;
-               xvi.colormap_size=display->screens->root_visual->map_entries;
-               xvi.bits_per_rgb=display->screens->root_visual->bits_per_rgb;
-               xvi.visual=display->screens->root_visual;
-               *n=1;
-               return (&xvi);
-       }
-       *n=0;
-       return (&xvi);
-}
-
-StatusDef XMatchVisualInfo(
-    Display*           display,
-    int                        screen,
-    int                        depth,
-    int                        class,
-    XVisualInfo*       vinfo_return)
-{
-       int status=0;
-       xtrace("XMatchVisualInfo\n");
-       return status;
-}
-
-/*****************************************************************\
-
-       Function: XClearWindow
-       Inputs:   display, window
-
-       Comments: As mentioned, the Window structure is not the one windows
-                 recognises.  The background colour for the window is
-                 stored in this structure.
-
-                 The sequence of GetDC, CreateBrush/Pen, SelectObject,
-                 <draw stuff>, DeleteObject, ReleaseDC occurs in all the
-                 drawing functions.
-
-\*****************************************************************/
-int
-XClearWindow(display, w)
-Display *display;
-Window w;
-{
-       RECT  rRect;
-       HBRUSH hbrush;
-       HDC hDC;
-       HANDLE oldObj;
-       int oldROP;
-       NT_window *window = (NT_window *)w;
-       xtrace("XClearWindow\n");
-
-       if (VALID_WINDOW(window)) {
-               rRect.left= rRect.right=rRect.bottom=rRect.top =0;
-       
-               hDC = cjh_get_dc(window);
-               oldROP = SetROP2(hDC,R2_COPYPEN);
-               hbrush = window->bg;
-               oldObj = SelectObject(hDC, hbrush);
-               GetClientRect(window->w, &rRect);
-               FillRect(hDC, &rRect, hbrush);
-               SelectObject(hDC, oldObj);
-               //      DeleteObject(hbrush);
-               SetROP2(hDC,oldROP);
-               cjh_rel_dc(window,hDC);
-       }
-       
-       return 0;
-}
-
-/*****************************************************************\
-
-       Function: XCreateSimpleWindow
-       Inputs:   display, parent window, geometry, border width,
-                 border colour, background colour.
-       Returned: Window ID
-
-       Comments: The first time a window is made by the application, it
-                 has to be registered.
-                 To simulate the action of a window manager, the toplevel
-                 client window is reparented and a frame window is created.
-                 A MapNotify event is sent to the new client.
-                 Note that child windows are created in the manner of the
-                 default X behaviour, ie. each is clipped individually.
-
-
-        NOTE:     This routine has now changed. As part of our role as
-                  Window manager, we now defer creation of the windows until
-                  they are mapped. The fact that a window has been created
-                  and not mapped is flagged to other routines by setting the
-                  w element of the structure to -1.
-                  WE STILL CREATE THE Window STRUCTURES.
-                  (SEE XMapWindow)
-
-\*****************************************************************/
-
-Window
-XCreateSimpleWindow(display, parent,x, y, w, h, brd, brd_col, bg)
-Display *display;
-Window  parent;
-int     x, y;
-unsigned int brd,w,h;
-unsigned long bg, brd_col;
-{
-       NT_window  *canvas;
-       xtrace("XCreateSimpleWindow\n");
-
-       canvas = NT_new_window();
-       
-       canvas->x = x;
-       canvas->y = y;
-       canvas->wdth = w;
-       canvas->hght = h;
-       NT_add_child((NT_window *)parent,canvas);
-       canvas->bg=CreateSolidBrush (CNUMTORGB(bg));
-       canvas->parent=(NT_window *)parent;
-       canvas->title_text = NULL;
-       if (canvas->parent->w == GetDesktopWindow())
-       {
-               if (x==0 && y==0)
-               {
-                       canvas->x = -1;
-                       canvas->y = -1;
-               }
-               canvas->top_flag = TRUE;
-       }
-       else
-               canvas->top_flag = 0;
-       return ((Window)canvas);
-}
-
-
-/*****************************************************************\
-
-       Function: XCreateWindow
-       Inputs:   display, parent window, geometry, border width, depth,
-                 class, visual, attributes mask, attributes structure
-       Returned: Window ID
-
-       Comments: Simply calls XCreateSimpleWindow.  Some of the arguments
-                 are ignored :-).
-
-\*****************************************************************/
-
-Window
-XCreateWindow(display,parent,x,y,width,height,bw,depth,class,visual,
-                       valuemask,attr)
-Display *display;
-Window  parent;
-int x,y;
-unsigned int width,height,bw;
-int depth;
-unsigned int class;
-Visual *visual;
-unsigned long valuemask;
-XSetWindowAttributes *attr;
-{
-       xtrace("XCreateWindow\n");
-       return (XCreateSimpleWindow(display,parent,x,y,width,height,bw,
-               attr->border_pixel,attr->background_pixel));
-}
-
-
-/*****************************************************************\
-
-       Function: XDestroyWindow
-       Inputs:   Display, window to be destroyed.
-
-       Comments: Removes a window from the server.  
-
-\*****************************************************************/
-int
-XDestroyWindow(display,w)
-Display *display;
-Window w;
-{
-       NT_window *ntw = (NT_window *)w;
-       xtrace("XDestroyWindow\n");
-        if (ntw->hDC != INVALID_HANDLE)
-               {
-          ReleaseDC(ntw->w,ntw->hDC);
-                 ntw->hDC =  INVALID_HANDLE;
-               }
-               
-       /*DestroyWindow(w->w);*/
-       NT_delete_window(ntw);   /* Remove window from data structure */
-       return 0;
-}
-
-
-/*****************************************************************\
-
-       Function: XGetGeometry
-       Inputs:   display, window
-       Returned: root window, screen depth, geometry, border width
-
-       Comments: fetches information from the windows kernel and our
-                 display structure.
-
-\*****************************************************************/
-
-StatusDef
-XGetGeometry(display,w,root,x,y,width,height,bw,depth)
-Display *display;
-Drawable w;
-Window *root;
-int *x,*y;
-unsigned int *width,*height;
-unsigned int *bw,*depth;
-{
-       NT_window *ntw = (NT_window *)w;
-       RECT r;
-       xtrace("XGetGeometry\n");
-
-       *root=display->screens[0].root;
-       *depth=24;
-
-       GetWindowRect(ntw->w,&r);
-       *x=r.left;
-       *y=r.top;
-       GetClientRect(ntw->w,&r);
-       *width=r.right-r.left;
-       if (*width<ntw->minx)
-               *width=ntw->minx;
-       *height=r.bottom-r.top;
-       if (*height<ntw->miny)
-               *height=ntw->miny;
-       *bw=(*width-(r.right-r.left))/2;
-       
-       return 0;
-}
-
-
-/*****************************************************************\
-
-       Function: XGetWindowAttributes
-       Inputs:   display, window, attributes
-       Returned: 1 = ok.
-
-       Comments: Fills out attributes structure.
-
-\*****************************************************************/
-
-StatusDef
-XGetWindowAttributes(display,w,wattr)
-Display *display;
-Window w;
-XWindowAttributes *wattr;
-{
-       xtrace("XGetWindowAttributes\n");
-       XGetGeometry(display,w,&wattr->root,&wattr->x,&wattr->y,&wattr->width,
-               &wattr->height,&wattr->border_width,&wattr->depth);
-       wattr->class=InputOutput;
-       wattr->bit_gravity=StaticGravity;
-       wattr->win_gravity=CenterGravity;
-       wattr->backing_store=NotUseful;
-       wattr->backing_planes=0;
-       wattr->backing_pixel=0;
-       wattr->save_under=0;
-       wattr->colormap=None;
-       wattr->map_installed=TRUE;
-       wattr->map_state=IsViewable;
-       wattr->override_redirect=FALSE;
-       wattr->screen=display->screens;
-       return (1);
-}
-
-
-
-int
-XSelectInput(display, window, mask)
-Display *display;
-Window  window;
-long    mask;
-{
-       NT_window *ntw = (NT_window *)window;
-       xtrace("XSelectInput\n");
-       ntw->mask=mask;
-       return 0;
-}
-
-void NT_dispError(char *msg)
-{
-       LPVOID lpMsgBuf=NULL;
-       FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,NULL,
-                                 GetLastError(),
-                                 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-                                 (LPTSTR) &lpMsgBuf,
-                                 0,
-                                 NULL);
-       MessageBox( NULL, lpMsgBuf, msg, MB_OK|MB_ICONINFORMATION );
-       LocalFree( lpMsgBuf );
-}
-
-
-/*****************************************************************\
-
-       Function: XMapWindow
-       Inputs:   display, window to be mapped
-
-       Comments: If the specified window is not already mapped, this
-                 routine calls the Windows function which displays it.
-                 Again, frames have to be mapped as well as clients.
-
-\*****************************************************************/
-int
-XMapWindow(display, window)
-Display *display;
-Window window;
-{
-       NT_window *ntw = (NT_window *)window;
-       RECT rect;
-       unsigned char *hints;
-       Atom property;
-       Atom ret_type;
-       int ret_format;
-       DWORD frame_style;
-       long ret_nitems;
-       long ret_after;
-       HDC hDC;
-       char *title = "";
-       xtrace("XMapWindow\n");
-       
-       if (ntw->w == INVALID_HANDLE)
-       {
-               frame_style = WS_CHILD|WS_CLIPCHILDREN|WS_CLIPSIBLINGS;
-               if (ntw->top_flag)
-               {
-                       /* frame_style = WS_CLIPCHILDREN;
-                          frame_style |=  WS_BORDER;
-                          frame_style |= WS_THICKFRAME;
-                          frame_style |= WS_CAPTION;
-                          frame_style |= WS_POPUP;
-                          frame_style |= WS_SYSMENU;
-                          frame_style |= WS_MINIMIZEBOX;
-                          frame_style |= WS_MAXIMIZEBOX;
-                       */
-                       frame_style = WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN;
-                       ntw->hght +=  GetSystemMetrics(SM_CYSIZE)+(GetSystemMetrics(SM_CYBORDER)+GetSystemMetrics(SM_CYFRAME))*2;
-                       ntw->wdth += (GetSystemMetrics(SM_CXBORDER) + GetSystemMetrics(SM_CXFRAME))*2;
-                       title = ntw->title_text;
-                       if (ntw->x == -1 && ntw->y == -1)
-                       {
-                               ntw->x = CW_USEDEFAULT;
-                               ntw->y = CW_USEDEFAULT;
-                       }
-               }
-               else if (ntw->x == -1 && ntw->y == -1)
-               {
-                       GetClientRect(ntw->parent->w,&rect);
-                       ntw->x = rect.left;
-                       ntw->y = rect.top;
-                       ntw->wdth = rect.right-rect.left;
-                       ntw->hght = rect.bottom - rect.top;
-               }
-
-               ntw->hDC = INVALID_HANDLE;
-               
-               if (ntw->parent->w == INVALID_HANDLE)
-               {
-                       XMapWindow(display, (Window)ntw->parent);
-               }
-               ntw->w = NT_create_window(title,frame_style,
-                                                                ntw->x,ntw->y,ntw->wdth,ntw->hght,
-                                                                ntw->parent->w);
-               if (ntw->w==NULL) NT_dispError("create window1");
-               hDC = cjh_get_dc(ntw);
-               PostMessage(ntw->w,USR_MapNotify,0,0);
-       }
-       if (IsWindowVisible(ntw->w)==0)
-       {
-               ShowWindow(ntw->w, SW_SHOW);
-               PostMessage(ntw->w,USR_MapNotify,0,0);
-       }
-       UpdateWindow(ntw->w);
-       return 0;
-}
-
-int
-XIconifyWindow(Display *display,
-    Window w,
-    int screen_number)
-{
-       xtrace("XIconifyWindow\n");
-       return 0;
-}
-
-
-/*****************************************************************\
-
-       Function: XCreateGC
-       Inputs:   display, window, mask of setup values, setup values.
-       Returned: GC pointer.
-
-       Comments: Fills out a GC structure with the X defaults unless
-                 the caller specifies otherwise.
-
-\*****************************************************************/
-
-GC
-XCreateGC(display, window, mask, gc_values)
-Display *display;
-Drawable window;
-unsigned long mask;
-XGCValues *gc_values;
-{
-       GC      local_gc;
-       int     size;
-       char    *ptr;
-       xtrace("XCreateGC\n");
-
-       size = sizeof(GC);
-
-       ptr = (char *)allocateMemory((size_t)1000);
-       local_gc = (GC)ptr;
-       local_gc->ext_data = NULL;
-       local_gc->gid=(GContext) window;
-       local_gc->rects=FALSE;
-       local_gc->dashes=FALSE;
-
-       if (mask&GCArcMode)
-               local_gc->values.arc_mode=gc_values->arc_mode;
-       else
-               local_gc->values.arc_mode=ArcPieSlice;
-       if (mask&GCBackground)
-               local_gc->values.background=gc_values->background;
-       else
-               local_gc->values.background=display->screens->white_pixel;
-       if (mask&GCCapStyle)
-               local_gc->values.cap_style=gc_values->cap_style;
-       else
-               local_gc->values.cap_style=CapButt;
-       if (mask&GCClipMask)
-               local_gc->values.clip_mask=gc_values->clip_mask;
-       else
-               local_gc->values.clip_mask=None;
-       if (mask&GCClipXOrigin)
-               local_gc->values.clip_x_origin=gc_values->clip_x_origin;
-       else
-               local_gc->values.clip_x_origin=0;
-       if (mask&GCClipYOrigin)
-               local_gc->values.clip_y_origin=gc_values->clip_y_origin;
-       else
-               local_gc->values.clip_y_origin=0;
-       if (mask&GCDashList)
-               local_gc->values.dashes=gc_values->dashes;
-       else
-               local_gc->values.dashes=4;
-       if (mask&GCDashOffset)
-               local_gc->values.dash_offset=gc_values->dash_offset;
-       else
-               local_gc->values.dash_offset=0;
-       if (mask&GCFillRule)
-               local_gc->values.fill_rule=gc_values->fill_rule;
-       else
-               local_gc->values.fill_rule=EvenOddRule;
-       if (mask&GCFillStyle)
-               local_gc->values.fill_style=gc_values->fill_style;
-       else
-               local_gc->values.fill_style=FillSolid;
-       if (mask&GCFont)
-               local_gc->values.font=gc_values->font;
-       else
-               local_gc->values.font= 999;/*"fixed";*/
-       if (mask&GCForeground)
-               local_gc->values.foreground=gc_values->foreground;
-       else
-               local_gc->values.foreground=display->screens->black_pixel;
-       if (mask&GCFunction)
-               local_gc->values.function=gc_values->function;
-       else
-               local_gc->values.function=GXcopy;
-       if (mask&GCGraphicsExposures)
-               local_gc->values.graphics_exposures=gc_values->graphics_exposures;
-       else
-               local_gc->values.graphics_exposures=True;
-       if (mask&GCJoinStyle)
-               local_gc->values.join_style=gc_values->join_style;
-       else
-               local_gc->values.join_style=JoinMiter;
-       if (mask&GCLineStyle)
-               local_gc->values.line_style=gc_values->line_style;
-       else
-               local_gc->values.line_style=LineSolid;
-       if (mask&GCLineWidth)
-               local_gc->values.line_width=gc_values->line_width;
-       else
-               local_gc->values.line_width=0;
-       if (mask&GCPlaneMask)
-               local_gc->values.plane_mask=gc_values->plane_mask;
-       else
-               local_gc->values.plane_mask=255;
-       if (mask&GCStipple)
-               local_gc->values.stipple=gc_values->stipple;
-       else
-               local_gc->values.stipple=0;
-       if (mask&GCSubwindowMode)
-               local_gc->values.subwindow_mode=gc_values->subwindow_mode;
-       else
-               local_gc->values.subwindow_mode=ClipByChildren;
-       if (mask&GCTile)
-               local_gc->values.tile=gc_values->tile;
-       else
-               local_gc->values.tile=0;
-       if (mask&GCTileStipXOrigin)
-               local_gc->values.ts_x_origin=gc_values->ts_x_origin;
-       else
-               local_gc->values.ts_x_origin=0;
-       if (mask&GCTileStipYOrigin)
-               local_gc->values.ts_y_origin=gc_values->ts_y_origin;
-       else
-               local_gc->values.ts_y_origin=0;
-
-       local_gc->dirty = ~0;
-
-       return (local_gc);
-}
-
-int
-XFreeGC(display, gc)
-Display *display;
-GC gc;
-{
-       freeMemory(gc);
-}
-
-/*****************************************************************\
-
-       Function: XSetForeground
-       Inputs:   display, gc, colour.
-
-       Comments: Colour is an RGB triple (24bits).
-\*****************************************************************/
-int
-XSetForeground(display, gc, color)
-Display *display;
-GC gc;
-unsigned long    color;
-{
-       xtrace("XSetForegrond\n");
-       gc->values.foreground=color;
-       gc->dirty |= GCForeground;
-       return 0;
-}
-
-
-/*****************************************************************\
-
-       Function: XDrawString
-       Inputs:   display, window, gc, position, string, length of string.
-
-       Comments: Writes text to the screen in the manner of X windows.
-                 Note that the y origin is on the text baseline, ie.
-                 the lowest part of a letter o rests on the baseline and
-                 descenders fall below it.
-                 The text is transparent.
-
-\*****************************************************************/
-
-int
-XDrawString(Display *display, Drawable window,
-    GC gc, int x, int y, const char* str, int len)
-{
-       HDC          hDC;
-       TEXTMETRIC   tmet;
-       HFONT old;
-       xtrace("XDrawString\n");
-
-       if (VALID_WINDOW(window))
-       {
-               hDC = drawableGetDC(window);
-               SetBkMode(hDC,TRANSPARENT);
-               SetTextColor(hDC,CNUMTORGB(gc->values.foreground));
-               old=SelectObject(hDC,(HFONT)gc->values.font);
-               GetTextMetrics(hDC,&tmet);
-               TextOut(hDC,x,y-tmet.tmAscent,str,len);
-               SelectObject(hDC,old);
-               drawableRelDC(window,hDC);
-       }
-       return 0;
-}
-
-
-
-int
-XDrawString16(Display *display, Drawable window,
-    GC gc, int x, int y,
-    const XChar2b* str,
-    int len)
-{
-       xtrace("XDrawString16\n");
-       XDrawString(display, window, gc, x, y, (const char*)str, len*2);
-       return 0;
-}
-XDrawImageString(
-       Display* display,
-       Drawable d,
-       GC gc,
-       int x,
-       int y,
-       const char* string,
-       int length)
-{
-       HDC hDC = NULL;
-       TEXTMETRIC   tmet;
-       HFONT old;
-       xtrace("XDrawImageString\n");
-       if (VALID_WINDOW(d))
-       {
-           hDC = drawableGetDC(d);
-           SetBkMode(hDC,TRANSPARENT);
-           SetBkColor(hDC, CNUMTORGB(gc->values.background));  
-           SetTextColor(hDC,CNUMTORGB(gc->values.foreground));
-           old=SelectObject(hDC,(HFONT)gc->values.font);
-           if (GetTextMetrics(hDC,&tmet) && length>0) {
-               RECT fill;
-               fill.top = y-tmet.tmAscent;
-               fill.bottom = y+tmet.tmDescent;
-               fill.left = x;
-               fill.right = x + (tmet.tmAveCharWidth * length);
-               FillRect( hDC, &fill, NT_get_GC_bgbrush(hDC,gc));
-           }
-           TextOut( hDC, x, y-tmet.tmAscent, string, length ); 
-           SelectObject(hDC,old);
-           drawableRelDC(d,hDC);
-       }       
-       return 0;
-}
-
-int
-XDrawImageString16(Display *display, Drawable window,
-    GC gc, int x, int y,
-    const XChar2b* str,
-    int len)
-{
-       xtrace("XDrawImageString16\n");
-       XDrawImageString(display, window, gc, x, y, (const char*)str, len*2);
-       return 0;
-}
-
-
-/*****************************************************************\
-
-       Function: XFillRectangle
-       Inputs:   display, window, gc, geometry.
-
-       Comments: fills rectangles in uniform colours.  No tiles/Pixmaps
-                 are implemented yet.
-
-\*****************************************************************/
-
-int
-XFillRectangle (display,window,gc,x,y,w,h)
-Display *display;
-Drawable window;
-GC gc;
-int x,y;
-unsigned int w,h;
-{
-       RECT rct;
-       HBRUSH hbrush;
-       HDC hDC;
-       HANDLE oldObj;
-       int ret;
-       xtrace("XFillRectangle\n");
-
-       if (VALID_WINDOW(window))
-       {
-               hDC = drawableGetDC(window);
-               NT_set_rop(hDC,gc);
-               hbrush = NT_get_GC_brush(hDC,gc);
-               oldObj = SelectObject(hDC, hbrush);
-               rct.left=(LONG) x;
-               rct.right=(LONG) (x+w);
-               rct.top=(LONG) y;
-               rct.bottom=(LONG) (y+h);
-               ret=FillRect(hDC, &rct, hbrush);
-               SelectObject(hDC, oldObj);
-               drawableRelDC(window,hDC);
-       }
-       return (ret);
-}
-
-
-/*****************************************************************\
-
-       Function: XClearArea
-       Inputs:   display, geometry, exposure events allowed.
-
-       Comments: Straightforward.
-
-\*****************************************************************/
-int
-XClearArea(display,w,x,y,width,height,exposures)
-Display *display;
-Window w;
-int x,y;
-unsigned int width,height;
-BoolDef exposures;
-{
-       NT_window *ntw = (NT_window *)w;
-       RECT rct;
-       HBRUSH hbrush;
-       HDC hDC;
-       HANDLE oldObj;
-       int oldROP;
-       xtrace("XClearArea\n");
-
-       if (VALID_WINDOW(ntw))
-       {
-               hDC = cjh_get_dc(ntw);
-               oldROP = SetROP2(hDC,R2_COPYPEN);
-               hbrush=ntw->bg;
-               oldObj = SelectObject(hDC,hbrush);
-               GetClientRect(ntw->w,&rct);
-
-               if ((width != 0) && (height != 0))
-               {
-                       rct.left=(LONG)x;
-                       rct.right=(LONG)(x+width);
-                       rct.top=(LONG)y;
-                       rct.bottom=(LONG)(y+height);
-                       FillRect(hDC,&rct,hbrush);
-               }
-
-               SelectObject(hDC, oldObj);
-               // DeleteObject(hbrush);
-               SetROP2(hDC,oldROP);
-               cjh_rel_dc(ntw,hDC);
-       }
-       return 0;
-}
-
-
-Region
-XCreateRegion()
-{
-       HRGN hrgn;
-       xtrace("XCreateRegion\n");
-
-       hrgn=CreateRectRgn(0,0,1,1);
-       return ((Region)hrgn);
-}
-
-
-/* Untested.  The Region stuff needs thinking about. */
-
-int
-XClipBox(hrgn,rect)
-Region hrgn;
-XRectangle *rect;
-{
-       RECT rct;
-       xtrace("XClipBox\n");
-
-       GetRgnBox((HRGN)hrgn,&rct);
-       rect->x=(short)rct.left;
-       rect->y=(short)rct.top;
-       rect->width=(unsigned short)(rct.right-rct.left);
-       rect->height=(unsigned short)(rct.bottom-rct.top);
-       return TRUE;/*(rect);*/
-}
-
-
-int
-XSetRegion(display,gc,hrgn)
-Display *display;
-GC gc;
-Region hrgn;
-{
-       /* What to do here ? */
-       xtrace("XSetRegion\n");
-       return 0;
-}
-
-
-int
-XDestroyRegion(hrgn)
-Region hrgn;
-{
-       xtrace("XDestroyRegion\n");
-       DeleteObject(hrgn);
-       return 0;
-}
-
-
-int
-XUnionRectWithRegion(rect,hrgnsrc,hrgndest)
-XRectangle *rect;
-Region hrgnsrc,hrgndest;
-{
-       HRGN temp;
-       xtrace("XUnionRectWithRegion\n");
-       temp=CreateRectRgn(rect->x,rect->y,rect->x+rect->width,
-                               rect->y+rect->height);
-       CombineRgn((HRGN)hrgndest,(HRGN)hrgnsrc,temp,RGN_OR);
-       return 0;
-}
-
-
-/*****************************************************************\
-
-       Function: XDrawArc
-       Inputs:   display, window, gc, bounding box geometry, arc angles.
-
-       Comments: Works fine.
-
-\*****************************************************************/
-
-int
-XDrawArc(display,w,gc,x,y,width,height,a1,a2)
-Display *display;
-Drawable w;
-GC gc;
-int x,y;
-unsigned int width,height;
-int a1,a2;
-{
-       HDC hDC;
-       HPEN hpen;
-       int tmp;
-       double NT_deg64_to_rad();
-       HANDLE oldObj;
-       xtrace("XDrawArc\n");
-       if (a2>=0)
-               a2+=a1;
-       else
-       {
-               tmp=a1;
-               a1-=a2;
-               a2=tmp;
-       }
-
-       if (VALID_WINDOW(w))
-       {
-               hDC = drawableGetDC(w);
-               hpen = NT_get_GC_pen(hDC,gc);
-               oldObj = SelectObject(hDC,hpen);
-               Arc(hDC,x,y,x+width-1,y+height-1,
-                       (int) (x+width/2+width*cos(NT_deg64_to_rad(a1))),
-                       (int) (y+height/2-height*sin(NT_deg64_to_rad(a1))),
-                       (int) (x+width/2+width*cos(NT_deg64_to_rad(a2))),
-                       (int) (y+height/2-height*sin(NT_deg64_to_rad(a2))));
-               SelectObject(hDC, oldObj);
-               drawableRelDC(w,hDC);
-       }
-       return 0;
-}
-
-
-/*****************************************************************\
-
-       Function: XFillArc
-       Inputs:   display, window, gc, geometry as above.
-
-       Comments: Not tested at all, but should work.
-
-\*****************************************************************/
-
-int
-XFillArc(display,w,gc,x,y,width,height,a1,a2)
-Display *display;
-Drawable w;
-GC gc;
-int x,y;
-unsigned int width,height;
-int a1,a2;
-{
-       HDC hDC;
-       HBRUSH hbrush;
-       int tmp;
-        HANDLE oldObj;
-               xtrace("XFillArc\n");
-       if (a2>=0)
-               a2+=a1;
-       else
-       {
-               tmp=a1;
-               a1-=a2;
-               a2=tmp;
-       }
-       if (VALID_WINDOW(w))
-       {
-               hDC = drawableGetDC(w);
-               hbrush = NT_get_GC_brush(hDC,gc);
-               oldObj = SelectObject(hDC,hbrush);
-               if (gc->values.arc_mode==ArcChord)
-               {
-                       Chord(hDC,x,y,x+width,y+height,
-                                 (int) (x+width/2+width*cos(NT_deg64_to_rad(a1))),
-                                 (int) (y+height/2+height*sin(NT_deg64_to_rad(a1))),
-                                 (int) (x+width/2+width*cos(NT_deg64_to_rad(a2))),
-                                 (int) (y+height/2+height*sin(NT_deg64_to_rad(a2))));
-               }
-               else
-               {
-                       Pie(hDC,x,y,x+width,y+height,
-                               (int) (x+width/2+width*cos(NT_deg64_to_rad(a1))),
-                               (int) (y+height/2+height*sin(NT_deg64_to_rad(a1))),
-                               (int) (x+width/2+width*cos(NT_deg64_to_rad(a2))),
-                               (int) (y+height/2+height*sin(NT_deg64_to_rad(a2))));
-               }
-               SelectObject(hDC, oldObj);
-               drawableRelDC(w,hDC);
-       }
-       return 0;
-}
-
-
-/*****************************************************************\
-
-       Function: XFillPolygon
-       Inputs:   display, window, gc, points list, number of points,
-                 shape hint, relative drawing mode.
-
-       Comments: Works for convex polygons.  Untested on otherwise.
-                 Optimisation hints are unused, as is the mode.
-
-\*****************************************************************/
-
-int
-XFillPolygon(display,w,gc,points,nps,shape,mode)
-Display *display;
-Drawable w;
-GC gc;
-XPoint *points;
-int nps,shape,mode;
-{
-       HBRUSH hbrush;
-       int n;
-       POINT ntps[1000];
-       HDC hDC;
-       HANDLE oldObj;
-       xtrace("XFillPolygon\n");
-       /*ntps=allocateMemory(sizeof(POINT)*nps);*/
-       if (VALID_WINDOW(w))
-       {
-               hDC = drawableGetDC(w);
-               hbrush = NT_get_GC_brush(hDC,gc);
-               oldObj = SelectObject(hDC,hbrush);
-               for (n=0;n<nps;++n)
-               {
-                       (ntps+n)->x=(LONG)points->x;
-                       (ntps+n)->y=(LONG)(points++)->y;
-               }
-               Polygon(hDC,ntps,nps);
-               SelectObject(hDC, oldObj);
-               drawableRelDC(w,hDC);
-       }
-       
-       /*free(ntps);*/
-       return 0;
-}
-
-
-/*****************************************************************\
-
-       Function: XDrawLine
-       Inputs:   display, window, geometry.
-
-       Comments: Seems to work ok.
-
-\*****************************************************************/
-
-int
-XDrawLine(display,w,gc,x1,y1,x2,y2)
-Display *display;
-Drawable w;
-GC gc;
-int x1,y1,x2,y2;
-{
-       HDC hDC;
-       HPEN hpen;
-       RECT da;
-       HANDLE oldObj;
-       xtrace("XDrawLine\n");
-
-       if (VALID_WINDOW(w))
-       {
-               hDC = drawableGetDC(w);
-               hpen = NT_get_GC_pen(hDC,gc);
-               oldObj = SelectObject(hDC,hpen);
-               MoveToEx(hDC,x1,y1,NULL);
-               LineTo(hDC,x2,y2);
-               SelectObject(hDC, oldObj);
-               drawableRelDC(w,hDC);
-       }
-       return 0;
-}
-
-
-/*****************************************************************\
-
-       Function: XDrawLines
-       Inputs:   display, window, gc, points list, number of points, mode.
-
-       Comments: Untested.
-
-\*****************************************************************/
-
-int
-XDrawLines(display,w,gc,points,nps,mode)
-Display *display;
-Drawable w;
-GC gc;
-XPoint *points;
-int nps,mode;
-{
-       HPEN hpen;
-       int n;
-       POINT pts[1000];
-       HDC hDC;
-       HANDLE oldObj;
-       xtrace("XDrawLines\n");
-
-       pts->x=(LONG)points->x;
-       pts->y=(LONG)points->y;
-
-       for(n=1;n<nps;++n)
-               if (mode==CoordModeOrigin)
-               {
-                       (pts+n)->x=(LONG)(points+n)->x;
-                       (pts+n)->y=(LONG)(points+n)->y;
-               }
-               else
-               {
-                       (pts+n)->x=(LONG)(points+n)->x+(pts+n-1)->x;
-                       (pts+n)->y=(LONG)(points+n)->y+(pts+n-1)->y;
-               }
-
-       if (VALID_WINDOW(w))
-       {
-               hDC = drawableGetDC(w);
-               hpen = NT_get_GC_pen(hDC,gc);
-               oldObj = SelectObject(hDC,hpen);
-               Polyline(hDC,pts,nps);
-               SelectObject(hDC, oldObj);
-               drawableRelDC(w,hDC);
-       }
-       return 0;
-}
-
-
-/*****************************************************************\
-
-       Function: XDrawPoints
-       Inputs:   display, window, gc, points list, number of points, mode.
-
-       Comments: Untested.
-
-\*****************************************************************/
-
-int
-XDrawPoints(display,w,gc,points,nps,mode)
-Display *display;
-Drawable w;
-GC gc;
-XPoint *points;
-int nps,mode;
-{
-       HDC hDC;
-       int n;
-       xtrace("XDrawPoints\n");
-       if (VALID_WINDOW(w))
-       {
-               hDC = drawableGetDC(w);
-               SetPixelV(hDC,points->x,points->y,CNUMTORGB(gc->values.foreground));
-               for (n=1;n<nps;++n)
-               {
-                       if (mode==CoordModeOrigin)
-                               SetPixelV(hDC,(points+n)->x,(points+n)->y,
-                                                 CNUMTORGB(gc->values.foreground));
-                       else
-                               SetPixelV(hDC,(points+n-1)->x+(points+n)->x,
-                                         (points+n-1)->y+(points+n)->y,
-                                         CNUMTORGB(gc->values.foreground));
-               }
-               drawableRelDC(w,hDC);
-       }
-       return 0;
-}
-int
-XDrawPoint(display,w,gc,x,y)
-Display *display;
-Drawable w;
-GC gc;
-int x,y;
-{
-       HDC hDC;
-       xtrace("XDrawPoint\n");
-       if (VALID_WINDOW(w))
-       {
-               hDC = drawableGetDC(w);
-               SetPixelV(hDC,x,y,CNUMTORGB(gc->values.foreground));
-               drawableRelDC(w,hDC);
-       }
-       return 0;
-}
-
-
-/*****************************************************************\
-
-       Function: XDrawRectangle
-       Inputs:   display, window, gc, geometry
-
-       Comments: Seems to work.
-
-\*****************************************************************/
-
-int
-XDrawRectangle(display,w,gc,x,y,width,height)
-Display *display;
-Drawable w;
-GC gc;
-int x,y;
-unsigned int width,height;
-{
-       HDC hDC;
-       RECT rect;
-       HBRUSH hbrush;
-       HPEN hpen;
-       HANDLE oldbrush, oldpen;
-       xtrace("XDrawRectangle\n");
-       if (VALID_WINDOW(w))
-       {
-               hDC = drawableGetDC(w);
-               hbrush = NT_get_GC_brush(hDC,gc);
-               rect.left=(LONG)x;
-               rect.right=(LONG)(x+width);
-               rect.top=(LONG)y;
-               rect.bottom=(LONG)(y+height);
-               oldbrush = SelectObject(hDC,GetStockObject(NULL_BRUSH));
-               hpen = NT_get_GC_pen(hDC,gc);
-               oldpen = SelectObject(hDC,hpen);
-
-               Rectangle(hDC,(int)rect.left,(int)rect.top,(int)rect.right,(int)rect.bottom);
-               /*
-                 FrameRect(hDC,&rect,hbrush);
-               */
-               SelectObject(hDC, oldbrush);
-               SelectObject(hDC, oldpen);
-               drawableRelDC(w,hDC);
-       }
-       return 0;
-}
-
-
-/*****************************************************************\
-
-       Function: XDrawSegments
-       Inputs: display, window, gc, segment list, number of segments.
-
-       Comments: Untested.
-
-\*****************************************************************/
-
-int
-XDrawSegments(display,w,gc,segs,nsegs)
-Display *display;
-Drawable w;
-GC gc;
-XSegment *segs;
-int nsegs;
-{
-       HDC hDC;
-       HPEN hpen;
-       int n;
-       HANDLE oldObj;
-       xtrace("XDrawSegments\n");
-       if (VALID_WINDOW(w))
-       {
-               hDC = drawableGetDC(w);
-               hpen = NT_get_GC_pen(hDC,gc);
-               oldObj = SelectObject(hDC,hpen);
-               SetBkMode(hDC,TRANSPARENT);
-               for (n=0;n<nsegs;n++)
-               {
-                       MoveToEx(hDC,(segs+n)->x1,(segs+n)->y1,NULL);
-                       LineTo(hDC,(segs+n)->x2,(segs+n)->y2);
-               }
-               SelectObject(hDC, oldObj);
-               drawableRelDC(w,hDC);
-       }
-       return 0;
-}
-
-Pixmap
-XCreatePixmap(display,drawable,width,height,depth)
-Display *display;
-Drawable drawable;
-unsigned int width, height;
-unsigned int depth;
-{
-       RECT rct;
-       NT_window *w = (NT_window *)NT_new_window();
-       HDC parenthDC = drawableGetDC(drawable);
-       w->hDC = CreateCompatibleDC(parenthDC);
-       w->hBitmap = CreateCompatibleBitmap(parenthDC,width,height);
-       SelectObject(w->hDC, w->hBitmap);
-
-       rct.left=(LONG) 0;
-       rct.right=(LONG) width;
-       rct.top=(LONG) 0;
-       rct.bottom=(LONG) height;
-       FillRect(w->hDC, &rct, GetStockObject(WHITE_BRUSH));
-
-       drawableRelDC(drawable,parenthDC);
-
-       w->w = NONMAPPED_HANDLE;
-       w->x=0;
-       w->y=0;
-       w->wdth = width;
-       w->hght = height;
-       w->min = depth;
-       return (Pixmap)w;
-}
-
-const char revBytes[]={
-       0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50,
-       0xd0, 0x30, 0xb0, 0x70, 0xf0, 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8,
-       0x68, 0xe8, 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, 0x04,
-       0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, 0x14, 0x94, 0x54, 0xd4,
-       0x34, 0xb4, 0x74, 0xf4, 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c,
-       0xec, 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, 0x02, 0x82,
-       0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, 0x12, 0x92, 0x52, 0xd2, 0x32,
-       0xb2, 0x72, 0xf2, 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
-       0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, 0x06, 0x86, 0x46,
-       0xc6, 0x26, 0xa6, 0x66, 0xe6, 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6,
-       0x76, 0xf6, 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 0x1e,
-       0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, 0x01, 0x81, 0x41, 0xc1,
-       0x21, 0xa1, 0x61, 0xe1, 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71,
-       0xf1, 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 0x19, 0x99,
-       0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, 0x05, 0x85, 0x45, 0xc5, 0x25,
-       0xa5, 0x65, 0xe5, 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
-       0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, 0x1d, 0x9d, 0x5d,
-       0xdd, 0x3d, 0xbd, 0x7d, 0xfd, 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3,
-       0x63, 0xe3, 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, 0x0b,
-       0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, 0x1b, 0x9b, 0x5b, 0xdb,
-       0x3b, 0xbb, 0x7b, 0xfb, 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67,
-       0xe7, 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, 0x0f, 0x8f,
-       0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 0x1f, 0x9f, 0x5f, 0xdf, 0x3f,
-       0xbf, 0x7f, 0xff
-};
-
-
-Pixmap
-XCreateBitmapFromData(Display *display,
-    Drawable drawable, const char *data,
-    unsigned int width, unsigned int height)
-{
-       NT_window *w = (NT_window *)NT_new_window();
-       HDC parenthDC = drawableGetDC(drawable);
-       w->hDC = CreateCompatibleDC(parenthDC);
-
-       {
-               int i,j;
-               char *newdata;
-               int bytes = (width+7)>>3;
-               int newbytes = (bytes&1)?bytes+1:bytes;
-               newdata = allocateMemory(newbytes*height);
-               for (i=0;i<height;i++)
-               {
-                       for (j=0;j<bytes;j++)
-                       {
-                               newdata[(i*newbytes)+j]=revBytes[(unsigned char)data[(i*bytes)+j]];             
-                       }
-               }
-               w->hBitmap = CreateBitmap(width,height,1,1,newdata);
-               freeMemory(newdata);
-       }
-       
-       SelectObject(w->hDC, w->hBitmap);       
-       drawableRelDC(drawable,parenthDC);
-       w->x=0;
-       w->y=0;
-       w->wdth = width;
-       w->hght = height;
-       w->min = 1;
-       return (Pixmap)w;
-}
-
-int
-XFreePixmap(display, pixmap)
-        Display *display;
-        Pixmap pixmap;
-{
-       NT_window *w = (NT_window *)pixmap;
-       NT_delete_window(w);
-       return 0;
-}
-
-int
-XCopyArea(display, src, dest, gc, src_x, src_y, width, height, dest_x, dest_y)
-Display *display;
-Drawable src, dest;
-GC gc;
-int src_x, src_y;
-unsigned int width, height;
-int dest_x, dest_y;
-{
-       HDC hsrc, hdst;
-       hsrc = drawableGetDC(src);
-       if (VALID_WINDOW(dest))
-       {
-               hdst = drawableGetDC(dest);
-               (void)BitBlt(hdst,dest_x,dest_y,width,height,hsrc,src_x,src_y,SRCCOPY);
-               drawableRelDC(src,hsrc);
-       }
-       drawableRelDC(dest,hdst);
-       return 0;
-}
-
-XImage *
-NT_XCreateImage()
-{
-       return NULL;
-}
-
-int NT_XDestroyImage(ximage)
-XImage *ximage;
-{
-       /* freeMemory(ximage->data); */
-  freeMemory(ximage);
-  return 1;
-}
-
-unsigned long
-NT_XGetPixel(ximage,x,y)
-XImage *ximage;
-int x,y;
-{
-       return 0;
-}
-int
-NT_XPutPixel(ximage,x,y,pixel)
-XImage *ximage;
-int x,y;
-unsigned long pixel;
-{
-       return 0;
-}
-XImage *
-NT_XSubImage(ximage,x,y,w,h)
-XImage *ximage;
-int x,y;
-unsigned int w,h;
-{
-       return NULL;
-}
-int
-NT_XAddPixel(ximage,value)
-XImage *ximage;
-unsigned long value;
-{
-       return 0;
-}
-
-XImage *
-XGetImage(display,drawable,x,y,width,height,plane_mask,format)
-Display *display;
-Drawable drawable;
-int x,y;
-unsigned int width, height;
-unsigned long plane_mask;
-int format;
-{
-       return NULL;
-}
-
-XImage *
-XCreateImage(display,visual,depth,format,offset,data,width,height, bitmap_pad, bytes_per_line)
-Display *display;
-Visual *visual;
-unsigned int depth;
-int format;
-int offset;
-char *data;
-unsigned int width, height;
-int bitmap_pad, bytes_per_line;
-{
-    XImage *img = (XImage *) allocateMemory(sizeof(XImage));
-
-    if (img) {
-               img->depth = 24; /* depth; */
-               img->format = format;
-               img->xoffset = offset;
-               img->data = data;
-               img->width = width;
-               img->height = height;
-               img->bitmap_pad = 32;
-               img->bytes_per_line=width*((24)>>3);
-               img->bits_per_pixel = 24; /* depth; */
-               img->bitmap_bit_order = LSBFirst;
-               img->byte_order = MSBFirst;
-               img->blue_mask = 0x0ff00000;
-               img->green_mask=0x00ff0000;
-               img->red_mask= 0x0000ff00;
-               
-               img->f.create_image = NT_XCreateImage;
-               img->f.destroy_image = NT_XDestroyImage;
-               img->f.get_pixel = NT_XGetPixel;
-               img->f.put_pixel = NT_XPutPixel;
-               img->f.sub_image = NT_XSubImage;
-               img->f.add_pixel = NT_XAddPixel;
-               
-    }
-       
-       return img;
-}
-void
-DrawBitmap(HDC hdc, HBITMAP hBitmap, int xStart, int yStart)
-{
-       BITMAP bm;
-       HDC hdcMem;
-       DWORD dwSize;
-       POINT ptSize, ptOrg;
-       hdcMem = CreateCompatibleDC(hdc);
-       SelectObject(hdcMem, hBitmap);
-       SetMapMode(hdcMem,GetMapMode(hdc));
-       GetObject(hBitmap, sizeof(BITMAP), (LPVOID)&bm);
-       ptSize.x = bm.bmWidth;
-       ptSize.y = bm.bmHeight;
-       DPtoLP(hdc, &ptSize,1);
-       ptOrg.x=0;
-       ptOrg.y=0;
-       DPtoLP(hdcMem,&ptOrg,1);
-       BitBlt(hdc,xStart,yStart,ptSize.x,ptSize.y,hdcMem,ptOrg.x,ptOrg.y,SRCCOPY);
-       DeleteDC(hdcMem);
-}
-/*
-static unsigned char wBrickBits[]={
-       0xff,0x0c,0x0c,0x0c, 0xff,0xc0,0xc0,0xc0,
-       0xff,0x0c,0xff,0xff, 0xff,0xff,0xc0,0xc0,
-       0xff,0x0c,0xff,0xff, 0xff,0xff,0xc0,0xc0,
-       0xff,0x0c,0x0c,0x0c, 0xff,0xc0,0xc0,0xc0
-};
-*/
-int
-XPutImage(display,w,gc,image,sx,sy,dx,dy,width,height)
-Display *display;
-Drawable w;
-XImage *image;
-GC gc;
-int sx,sy,dx,dy;
-unsigned int width,height;
-{
-       BITMAPINFO bmInfo;
-       NT_window *pix = (NT_window *)w;
-       int res;
-       if (VALID_WINDOW(w))
-       {
-               HDC hDC = drawableGetDC(w);
-               bmInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
-               bmInfo.bmiHeader.biWidth = width;
-               bmInfo.bmiHeader.biHeight = height;
-               bmInfo.bmiHeader.biPlanes = 1;
-               bmInfo.bmiHeader.biBitCount = 24; /*image->depth; */
-               bmInfo.bmiHeader.biCompression = BI_RGB;
-               bmInfo.bmiHeader.biSizeImage = 0;
-               bmInfo.bmiHeader.biXPelsPerMeter = 3600;
-               bmInfo.bmiHeader.biYPelsPerMeter = 3600;
-               bmInfo.bmiHeader.biClrUsed = 0;
-               bmInfo.bmiHeader.biClrImportant = 0;
-               res = SetDIBitsToDevice(hDC,0,0,width,height,0,0,0,height,image->data,&bmInfo,DIB_RGB_COLORS);
-               /*      BitBlt(CreateDC("DISPLAY",NULL,NULL,NULL),10,0,width,height,hDC,0,0,SRCCOPY); */
-               if (res==0)
-                       printf("SetDIBitsfailed %d\n",res,GetLastError());
-               drawableRelDC(w,hDC);
-       }
-       return 0;
-}
-
-int
-XSetWindowBackground(display, w, bg)
-        Display *display;
-        Window w;
-        unsigned long bg;
-{
-       NT_window *window = (NT_window *)w;
-       xtrace("XSetWindowBackground\n");
-       DeleteObject(window->bg);
-       window->bg=CreateSolidBrush(CNUMTORGB(bg));
-       return 0;
-}
-
-int
-XSetWindowBackgroundPixmap(display, w, background_tile)
-Display *display;
-Window w;
-Pixmap background_tile;
-{
-       NT_window *window = (NT_window *)w;
-       NT_window *wpix = (NT_window *)background_tile;
-       BITMAPINFO *bmInfo;
-       BITMAP bm;
-       int res;
-       
-       xtrace("XSetWindowBackgroundPixmap\n");
-       if (background_tile==ParentRelative)
-       {
-               if (!window->parentRelative)
-               {
-                       HBITMAP hb = NT_getWallpaper();
-                       if (hb!=NULL) {
-                               DeleteObject(window->bg);
-                               window->bg = CreatePatternBrush(hb);
-                               window->parentRelative=1;
-                               NT_configureNotify(window,window->x,window->y);
-                       }
-               }
-       }
-       else
-       {
-               GetObject(wpix->hBitmap, sizeof(BITMAP), &bm);
-       
-               bmInfo = allocateMemory(sizeof(BITMAPINFO) + ( (bm.bmBitsPixel>>3)* bm.bmWidth*bm.bmHeight));
-               bmInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
-               bmInfo->bmiHeader.biWidth = bm.bmWidth;
-               bmInfo->bmiHeader.biHeight = bm.bmHeight;
-               bmInfo->bmiHeader.biPlanes = 1;
-               bmInfo->bmiHeader.biBitCount = bm.bmBitsPixel;
-               bmInfo->bmiHeader.biCompression = BI_RGB;
-               bmInfo->bmiHeader.biSizeImage =  0;
-               bmInfo->bmiHeader.biClrImportant = 0; 
-               bmInfo->bmiHeader.biClrUsed = 0;
-       
-               res =GetDIBits(wpix->hDC,wpix->hBitmap,0,bm.bmHeight,bmInfo->bmiColors,bmInfo,DIB_RGB_COLORS);
-               if (res==0)
-                       printf("getDIBits failed %d\n",res,GetLastError());
-       
-               DeleteObject(window->bg);
-               window->bg = CreateDIBPatternBrushPt(bmInfo, DIB_RGB_COLORS);
-               freeMemory(bmInfo);
-       }
-}
-
-
-/*****************************************************************\
-
-       Function: XSetFillStyle
-       Inputs:   display, gc, fill style.
-
-       Comments: ZZzzz...
-
-\*****************************************************************/
-
-int
-XSetFillStyle(display,gc,fs)
-Display *display;
-GC gc;
-int fs;
-{
-       xtrace("XSetFillStyle\n");
-       gc->values.fill_style=fs;
-       gc->dirty |= GCFillStyle;
-       return 0;
-}
-
-
-int
-XSetDashes(Display *display,
-    GC gc, int dash_offset,
-    const char * dash_list,
-    int n)
-{
-       xtrace("XSetDashes\n");
-       return 0;
-}
-
-
-int
-XChangeWindowAttributes(display,w,vmask,attr)
-Display *display;
-Window w;
-unsigned long vmask;
-XSetWindowAttributes *attr;
-{
-       xtrace("XChangeWindowAttributes\n");
-       return 0;
-}
-
-
-/*****************************************************************\
-
-       Function: XLowerWindow
-       Inputs:   display, window to be lowered.
-
-       Comments: Make sure if the window has a frame that that gets lowered
-                 too.
-
-\*****************************************************************/
-
-int
-XLowerWindow(display,w)
-Display *display;
-Window w;
-{
-       NT_window *ntw=(NT_window *)w;
-       xtrace("XLowerWindow\n");
-       SetWindowPos((HWND)ntw->w,HWND_BOTTOM,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
-       return 0;
-}
-
-
-/*****************************************************************\
-
-       Function: XMapRaised
-       Inputs:   display, window.
-
-       Comments: Frames get raised first.
-
-\*****************************************************************/
-
-int
-XMapRaised(display,w)
-Display *display;
-Window w;
-{
-       NT_window *ntw=(NT_window *)w;
-       xtrace("XMapRaised\n");
-       XMapWindow(display,w);
-       SetWindowPos(ntw->w,HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
-       return 0;
-}
-
-
-/*****************************************************************\
-
-       Function: XMapSubwindows
-       Inputs:   display, window.
-
-       Comments: Unfortunately, the optimisations normally made by
-                 the X server are not made here.
-
-\*****************************************************************/
-
-int
-XMapSubwindows(display,w)
-Display *display;
-Window w;
-{
-       NT_window *ntw=(NT_window *)w;
-       struct NT_child *tmp;
-
-       xtrace("XMapSubWindows\n");
-       tmp=ntw->child;
-       while (tmp!=NULL)
-       {
-               XMapWindow(display,(Window)tmp->w);
-               tmp=tmp->next;
-        }
-       return 0;
-}
-
-
-/*****************************************************************\
-
-       Function: XQueryTree
-       Inputs:   display, window.
-       Returned: root window, parent window, list of children, status.
-
-       Comments: Not fully implemented.  The child field is wrong.
-
-\*****************************************************************/
-
-StatusDef
-XQueryTree(display,w,root,parent,ch,n)
-Display *display;
-Window w;
-Window* root;
-Window* parent;
-Window** ch;
-unsigned int *n;
-{
-       NT_window *ntw=(NT_window *)w;
-       StatusDef status=1;
-
-       xtrace("XQueryTree\n");
-       *parent=(Window)ntw->parent;
-       if (ntw->parent==NULL)
-               status=0;
-       *root=display->screens[0].root;
-       *ch=NULL;
-       *n=0;
-       return (status);
-}
-
-
-/*****************************************************************\
-
-       Function: XRaiseWindow
-       Inputs:   display, window.
-
-       Comments: Recursive raising of window and its children.
-
-\*****************************************************************/
-
-int
-XRaiseWindow(display,w)
-Display *display;
-Window w;
-{
-       NT_window *ntw=(NT_window *)w;
-       struct NT_child *tmp;
-       xtrace("XRaiseWindows\n");
-
-       BringWindowToTop(ntw->w);
-       tmp=ntw->child;
-       while (tmp!=NULL)
-       {
-               XRaiseWindow(display,(Window)tmp->w);
-               tmp=tmp->next;
-       }
-       return 0;
-}
-
-
-/*****************************************************************\
-
-       Function: XRootWindow
-       Inputs:   display, screen number
-       Returned: root window ID.
-
-       Comments: Info taken from display structure.
-
-\*****************************************************************/
-
-Window
-XRootWindow(display,scr)
-Display *display;
-int scr;
-{
-       xtrace("XRootWindow\n");
-       return(display->screens[0].root);
-}
-
-
-/*****************************************************************\
-
-       Function: XRootWindowOfScreen
-       Inputs:   screen pointer
-       Returned: root window ID.
-
-       Comments: ZZzzz...
-
-\*****************************************************************/
-
-Window
-XRootWindowOfScreen(scr)
-Screen *scr;
-{
-       xtrace("XRootWindowOfScreen\n");
-       return(scr->root);
-}
-
-
-/*****************************************************************\
-
-       Function: XTranslateCoordinates
-       Inputs:   display, source window, destination window, source x, y.
-       Returned: destination x, y, child window if any.
-
-       Comments: Seems to work properly.
-
-\*****************************************************************/
-
-BoolDef
-XTranslateCoordinates(display,sw,dw,sx,sy,dx,dy,ch)
-Display *display;
-Window sw,dw;
-int sx,sy,*dx,*dy;
-Window *ch;
-{
-       xtrace("XTranslateCoordinates\n");
-       return (True);
-}
-
-
-/*****************************************************************\
-
-       Function: XUnmapWindow
-       Inputs:   display, window.
-
-       Comments: Removes a window and its frame, if it has one, from the
-                 screen.
-
-\*****************************************************************/
-
-int
-XUnmapWindow(display,w)
-Display *display;
-Window w;
-{
-       NT_window *ntw=(NT_window *)w;
-       xtrace("XUnmapWindow\n");
-       ShowWindow(ntw->w,SW_HIDE);
-       return 0;
-}
-
-
-/*****************************************************************\
-
-       Function: XCopyGC
-       Inputs:   display, source gc, values mask, destination gc.
-
-       Comments: Copies masked elements from source to destination.
-
-\*****************************************************************/
-
-int
-XCopyGC(display,sgc,vmask,dgc)
-Display *display;
-GC sgc,dgc;
-unsigned long vmask;
-{
-       xtrace("XCopyGC\n");
-       if (vmask&GCFunction)
-               dgc->values.function=sgc->values.function;
-       if (vmask&GCPlaneMask)
-               dgc->values.plane_mask=sgc->values.plane_mask;
-       if (vmask&GCForeground)
-               dgc->values.foreground=sgc->values.foreground;
-       if (vmask&GCBackground)
-               dgc->values.background=sgc->values.background;
-       if (vmask&GCLineWidth)
-               dgc->values.line_width=sgc->values.line_width;
-       if (vmask&GCLineStyle)
-               dgc->values.line_style=sgc->values.line_style;
-       if (vmask&GCCapStyle)
-               dgc->values.cap_style=sgc->values.cap_style;
-       if (vmask&GCJoinStyle)
-               dgc->values.join_style=sgc->values.join_style;
-       if (vmask&GCFillStyle)
-               dgc->values.fill_style=sgc->values.fill_style;
-       if (vmask&GCFillRule)
-               dgc->values.fill_rule=sgc->values.fill_rule;
-       if (vmask&GCTile)
-               dgc->values.tile=sgc->values.tile;
-       if (vmask&GCStipple)
-               dgc->values.stipple=sgc->values.stipple;
-       if (vmask&GCTileStipXOrigin)
-               dgc->values.ts_x_origin=sgc->values.ts_x_origin;
-       if (vmask&GCTileStipYOrigin)
-               dgc->values.ts_y_origin=sgc->values.ts_y_origin;
-       if (vmask&GCFont)
-               dgc->values.font=sgc->values.font;
-       if (vmask&GCSubwindowMode)
-               dgc->values.subwindow_mode=sgc->values.subwindow_mode;
-       if (vmask&GCGraphicsExposures)
-               dgc->values.graphics_exposures=sgc->values.graphics_exposures;
-       if (vmask&GCClipXOrigin)
-               dgc->values.clip_x_origin=sgc->values.clip_x_origin;
-       if (vmask&GCClipYOrigin)
-               dgc->values.clip_y_origin=sgc->values.clip_y_origin;
-       if (vmask&GCClipMask)
-               dgc->values.clip_mask=sgc->values.clip_mask;
-       if (vmask&GCDashList)
-               dgc->values.dashes=sgc->values.dashes;
-       if (vmask&GCArcMode)
-               dgc->values.arc_mode=sgc->values.arc_mode;
-
-       dgc->dirty = 0xFFFF;
-       return 0;
-}
-
-
-int
-XSetClipMask(display,gc,cmask)
-Display *display;
-GC gc;
-Pixmap cmask;
-{
-       xtrace("XSetClipMask\n");
-       return 0;
-}
-
-
-int
-XSetClipRectangles(display,gc,clx,cly,rs,n,order)
-Display *display;
-GC gc;
-int clx,cly;
-XRectangle *rs;
-int n,order;
-{
-       xtrace("XSetClipRectangles\n");
-       return 0;
-}
-
-
-/*****************************************************************\
-
-       Function: XSetFunction
-       Inputs:   display, gc, graphics operation.
-
-       Comments: ZZzzz...
-
-\*****************************************************************/
-
-int
-XSetFunction(display,gc,fn)
-Display *display;
-GC gc;
-int fn;
-{
-       xtrace("XSetFunction\n");
-       gc->values.function=fn;
-       gc->dirty |= GCFunction;
-       return 0;
-}
-
-
-/*****************************************************************\
-
-       Function: XSetLineAttributes
-       Inputs:   display, gc, line width, line style, cap style, join style.
-
-       Comments: These all have windows equivalents.
-
-\*****************************************************************/
-
-int
-XSetLineAttributes(display,gc,lw,ls,cs,js)
-Display *display;
-GC gc;
-unsigned int lw;
-int ls,cs,js;
-{
-       xtrace("XSetLineAttributes\n");
-       gc->values.line_width=lw;
-       gc->values.line_style=ls;
-       gc->values.cap_style=cs;
-       gc->values.join_style=js;
-       gc->dirty |= GCLineWidth | GCLineStyle | GCCapStyle | GCJoinStyle;
-       return 0;
-}
-
-
-/*****************************************************************\
-
-       Function: XSetPlaneMask
-       Inputs:   display, gc, plane mask.
-
-       Comments: What's a plane mask?
-
-\*****************************************************************/
-
-int
-XSetPlaneMask(display,gc,pmask)
-Display *display;
-GC gc;
-unsigned long pmask;
-{
-       xtrace("XSetPlaneMask\n");
-       gc->values.plane_mask=pmask;
-       return 0;
-}
-
-
-int
-XSetTile(display,gc,tile)
-Display *display;
-GC gc;
-Pixmap tile;
-{
-       xtrace("XSetTile\n");
-       return 0;
-}
-
-
-StatusDef
-XAllocColorCells(display,cmap,cont,pmasks,np,pixels,nc)
-Display *display;
-Colormap cmap;
-BoolDef cont;
-unsigned long *pmasks;
-unsigned int np;
-unsigned long *pixels;
-unsigned int nc;
-{
-       unsigned int i;
-       xtrace("XAllocColorCells\n");
-       for (i = 0;i<nc;i++)
-               pixels[i] = i;
-       if(np==1)
-       {
-               *pmasks = nc;
-       }
-       return 1;
-}
-
-
-/*****************************************************************\
-
-       Function: XAllocColorPlanes
-       Inputs:   display, colour map, contiguous flag, pixel value list,
-                 number of colours, number of reds, greens, blues.
-       Returned: red mask, green mask, blue mask, status.
-
-       Comments: Works for True Colour only.
-
-\*****************************************************************/
-
-StatusDef
-XAllocColorPlanes(display,cmap,cont,pixels,nc,nr,ng,nb,rmask,gmask,bmask)
-Display *display;
-Colormap cmap;
-BoolDef cont;
-unsigned long *pixels;
-int nc;
-int nr,ng,nb;
-unsigned long *rmask,*gmask,*bmask;
-{
-       xtrace("XAllocColorPlanes\n");
-       *rmask=255;
-       *gmask=255<<8;
-       *bmask=255<<16;
-       return (1);
-}
-
-
-StatusDef
-XAllocNamedColor(Display *display,
-    Colormap cmap, const char *cname,
-    XColor *cell, XColor *rgb)
-{
-       xtrace("XAllocNamedColor\n");
-       return 0;
-}
-
-
-Colormap
-XCreateColormap(display,w,visual,alloc)
-Display *display;
-Window w;
-Visual *visual;
-int alloc;
-{
-       xtrace("XCreateColormap\n");
-       return 0;
-}
-
-
-StatusDef
-XGetStandardColormap(display,w,cmapinf,prop)
-Display *display;
-Window w;
-XStandardColormap *cmapinf;
-Atom prop;
-{
-       xtrace("XGetStandardColormap\n");
-       return 0;
-}
-
-StatusDef
-XAllocColor(display,cmap,xc)
-Display *display;
-Colormap cmap;
-XColor *xc;
-{
-       xtrace("XAllocColor\n");
-       xc->pixel = RGB((BYTE) (xc->red>>8)&0xff, (BYTE) (xc->green>>8)&0xff, (BYTE) (xc->blue>>8)&0xff);
-       return 1;
-}
-
-int
-XQueryColor(display,cmap,cell)
-Display *display;
-Colormap cmap;
-XColor *cell;
-{
-       xtrace("XQueryColor\n");
-       cell->red = (cell->pixel>>8)&0x0ff00;
-       cell->green = (cell->pixel)&0x0ff00;
-       cell->blue = (cell->pixel<<8)&0x0ff00;
-  return 1;
-}
-
-
-int
-XQueryColors(display,cmap,cells,nc)
-Display *display;
-Colormap cmap;
-XColor *cells;
-int nc;
-{
-       int i;
-
-       xtrace("XQueryColors\n");
-       for (i=0;i<nc;i++)
-       {
-               cells[i].red=(cells[i].pixel>>8)&0xff00;
-               cells[i].green=(cells[i].pixel)&0xff00;
-               cells[i].blue=(cells[i].pixel<<8)&0xff00;
-       }
-       return 0;
-}
-
-
-int
-XStoreColor(display,cmap,cell)
-Display *display;
-Colormap cmap;
-XColor *cell;
-{
-       xtrace("XStoreColor\n");
-       return 0;
-}
-
-
-
-int
-XStoreColors(display,cmap,cells,nc)
-Display *display;
-Colormap cmap;
-XColor *cells;
-int nc;
-{
-       int i;
-       xtrace("XStoreColors\n");
-       return 0;
-}
-
-char **
-XGetFontPath(display,nps)
-Display *display;
-int *nps;
-{
-       xtrace("XGetFontPath\n");
-       return (NULL);
-}
-
-
-BoolDef
-XGetFontProperty(fstruct,atom,val)
-XFontStruct *fstruct;
-Atom atom;
-unsigned long *val;
-{
-       xtrace("XGetFontProperty\n");
-       return (0);
-}
-
-static BYTE
-getCharSetFromName(const char *name,char **lang)
-{
-    static struct {
-       char *label;
-       BYTE id;
-    } charset[] = {
-       "-gb2312", GB2312_CHARSET,
-       "-big5", CHINESEBIG5_CHARSET,
-       "-jis", SHIFTJIS_CHARSET,
-       NULL, DEFAULT_CHARSET
-    };
-    int i;
-    char *p;
-    if (!name)
-    {
-       if (lang) *lang=NULL;
-       return DEFAULT_CHARSET;
-    }
-    else if (lang) *lang=(char *)name+strlen((char *)name);
-    for (i=0; charset[i].label; i++)
-       if (NULL!=(p=strstr(name, charset[i].label)))
-       {
-           if (lang) *lang=p;
-           break;
-       }
-    return charset[i].id;
-}
-
-/* attempts to translate the font name into
-** something win32 understands.
-** 
-*/
-Font
-NT_loadfont(name)
-char *name;
-{
-    LOGFONT lf;
-    HFONT hfont;
-    char *p,*q,*lang;
-    int size = 0;
-    char buff[33];
-       
-    memset(&lf,0,sizeof(lf));
-    lf.lfHeight = -13;
-       
-    lf.lfWeight = FW_NORMAL;
-    lf.lfFaceName[0]='\0';
-       
-    lf.lfCharSet = getCharSetFromName(name,&lang);
-    
-    if (name && strstr(name,"-bold"))
-    {
-       lf.lfWeight = FW_BOLD;
-    }
-    for(p=name, q=buff; p&&p<=lang; p++)
-    {
-       if (((!*p || *p=='-') && q!=buff) || (q-buff>31))
-       {
-           *q++='\0';
-           if (lf.lfFaceName[0]=='\0')
-           {
-               if (isalpha(buff[0]) || IsDBCSLeadByte(buff[0]))
-                   strcpy(lf.lfFaceName, buff);
-               else if (isdigit(buff[0]) && ((q=strchr(buff,'x')) || (q=strchr(buff,'X'))))
-               {
-                   strcpy(lf.lfFaceName, "Courier New");
-                   size = -atoi(q+1);
-               }
-               else if (size == 0 && isdigit(buff[0]))
-                   size = -atoi(buff);
-           }
-           else if (size == 0 && isdigit(buff[0]))
-           {                           
-               size = -atoi(buff);
-           }
-           q = buff;
-       }
-       else
-           *q++ = *p;
-       if (!*p) break;
-    }
-       
-    if (size > 99)
-       lf.lfHeight = - (size/10);
-    else if (size)
-       lf.lfHeight = - size;
-    
-    if (!strcmp(lf.lfFaceName,"lucidatypewriter"))
-       strcpy(lf.lfFaceName,"Lucida Console");
-    else if (lf.lfFaceName[0]=='\0'&&lf.lfCharSet==DEFAULT_CHARSET)
-       strcpy(lf.lfFaceName,"Courier New");
-    hfont = CreateFontIndirect(&lf);
-    return (Font)hfont;
-}
-
-XFontStruct *
-XLoadQueryFont(Display *display, const char *name)
-{
-    XFontStruct *fs;
-    TEXTMETRIC tm;
-    HDC hdc;
-    HWND root;
-    HFONT old;
-    int i;
-       
-    xtrace("XLoadQueryFont\n");
-    fs = allocateMemory(sizeof(XFontStruct));
-    fs->fid = NT_loadfont(name);
-
-    root=GetDesktopWindow();
-    hdc=GetDC(root);
-    old = SelectObject(hdc, (HFONT)fs->fid);
-    GetTextMetrics(hdc, &tm);
-    fs->min_bounds.width = tm.tmAveCharWidth;
-    fs->max_bounds.width = tm.tmMaxCharWidth;
-    fs->n_properties = 0;
-    fs->properties = NULL;
-    fs->min_char_or_byte2 =tm.tmFirstChar;
-    fs->max_char_or_byte2 =tm.tmLastChar;
-    fs->per_char = (XCharStruct*)allocateMemory(sizeof(XCharStruct)*(tm.tmLastChar+1));
-    ZeroMemory(fs->per_char, sizeof(XCharStruct)*(tm.tmLastChar+1));
-
-    if (!(tm.tmPitchAndFamily & TMPF_FIXED_PITCH)) {
-       for (i=tm.tmFirstChar; i<=tm.tmLastChar; i++) {
-           fs->per_char[i].width = tm.tmAveCharWidth;
-           fs->per_char[i].rbearing = tm.tmAveCharWidth;
-       }
-    } else if (tm.tmPitchAndFamily & TMPF_TRUETYPE) {
-       for (i=tm.tmFirstChar; i<=tm.tmLastChar; i++)
-       {
-           ABC abc;
-           if (!GetCharABCWidths(hdc,i,i,&abc))
-           {
-               abc.abcA = 0;
-               abc.abcB = tm.tmAveCharWidth;
-               abc.abcC = 0;
-           }
-           fs->per_char[i].lbearing = abc.abcA;
-           fs->per_char[i].width = abc.abcB;
-           fs->per_char[i].rbearing = abc.abcB+abc.abcC;                   
-       }
-    } else {
-       for (i=tm.tmFirstChar; i<=tm.tmLastChar; i++)
-       {
-           INT fw;
-           if (!GetCharWidth(hdc,i,i,&fw))
-           {
-               fw = tm.tmAveCharWidth;
-           }
-           fs->per_char[i].lbearing = 0;
-           fs->per_char[i].width = fw;
-           fs->per_char[i].rbearing = fw;
-       }
-    }
-    if (getCharSetFromName(name,NULL) == DEFAULT_CHARSET)
-    {
-       int last = tm.tmLastChar;
-
-       switch(tm.tmCharSet) {
-           case CHINESEBIG5_CHARSET:
-           case GB2312_CHARSET:
-           case SHIFTJIS_CHARSET:
-               if (tm.tmLastChar > 127) last = 127;
-               break;
-       }
-
-       if (last >= tm.tmFirstChar)
-       {
-           fs->max_bounds = fs->per_char[last];
-           fs->min_bounds = fs->per_char[last];
-           for (i=tm.tmFirstChar; i<last; i++)
-           {
-               if (fs->per_char[i].lbearing > fs->max_bounds.lbearing)
-                   fs->max_bounds.lbearing = fs->per_char[i].lbearing;
-               else if(fs->per_char[i].lbearing < fs->min_bounds.lbearing)
-                   fs->min_bounds.lbearing = fs->per_char[i].lbearing;
-
-               if (fs->per_char[i].width > fs->max_bounds.width)
-                   fs->max_bounds.width = fs->per_char[i].width;
-               else if(fs->per_char[i].width < fs->min_bounds.width)
-                   fs->min_bounds.width = fs->per_char[i].width;
-
-               if (fs->per_char[i].rbearing > fs->max_bounds.rbearing)
-                   fs->max_bounds.rbearing = fs->per_char[i].rbearing;
-               else if(fs->per_char[i].rbearing < fs->min_bounds.rbearing)
-                   fs->min_bounds.rbearing = fs->per_char[i].rbearing;
-           }
-       }
-    }
-    fs->ascent = tm.tmAscent;
-    fs->descent= tm.tmDescent;
-    SelectObject(hdc,old);
-    ReleaseDC(root,hdc);
-    return(fs);
-}
-
-XFontStruct *
-XQueryFont(display, font_id)
-Display *display;
-XID     font_id;
-{
-       static XFontStruct fs;
-
-       xtrace("XQueryFont\n");
-       return(&fs);
-}
-
-KeySym
-XKeycodeToKeysym(display, keycode, index)
-Display *display;
-unsigned int keycode;
-int     index;
-{
-       xtrace("XKeycodeToKeysym\n");
-       if (keycode == 254) return XK_Alt_L;
-       else if (keycode == 255) return XK_Num_Lock;
-       return(NoSymbol);
-}
-KeyCode
-XKeysymToKeycode(display, keysym)
-Display *display;
-KeySym keysym;
-{
-       xtrace("XKeycodeToKeysym\n");
-       if (keysym == XK_Alt_L) return 254;
-       else if (keysym == XK_Num_Lock) return 255;
-       return(0);
-}
-KeySym
-XStringToKeysym(const char *str)
-{
-       xtrace("XStringToKeysym\n");
-       return(NoSymbol);
-}
-
-XModifierKeymap *
-XGetModifierMapping(display)
-Display *display;
-{
-       XModifierKeymap *map = NULL;
-       xtrace("XGetModifierMapping\n");
-       map = (XModifierKeymap *)allocateMemory(sizeof(XModifierKeymap));
-       map->max_keypermod = 1;
-       map->modifiermap = (KeyCode *)allocateMemory(sizeof(KeyCode)*8);
-       map->modifiermap[0]=0;
-       map->modifiermap[1]=0;
-       map->modifiermap[2]=0;
-       map->modifiermap[3]=XKeysymToKeycode(display,XK_Alt_L);
-       map->modifiermap[4]=0;
-       map->modifiermap[5]=0;
-       map->modifiermap[6]=0;
-       map->modifiermap[7]=XKeysymToKeycode(display,XK_Num_Lock);
-       return(map);
-}
-int
-XFreeModifiermap(XModifierKeymap *modmap)
-{
-       xtrace("XFreeModifiermap\n");
-       freeMemory(modmap->modifiermap);
-       freeMemory(modmap);
-       return 0;
-}
-
-
-int
-XSetFont(display,gc,font)
-Display *display;
-GC gc;
-Font font;
-{
-       xtrace("XSetFont\n");
-       gc->values.font = font;
-       return 0;
-}
-
-
-int
-XSetFontPath(display,dirs,nd)
-Display *display;
-char **dirs;
-int nd;
-{
-       xtrace("XSetFontPath\n");
-       return 0;
-}
-
-
-/*****************************************************************\
-
-       Function: XTextExtents
-       Inputs:   font structure, string, string length.
-       Returned: writing direction, max ascent, max descent, font overall
-                 characteristics.
-
-       Comments: The design of windows fonts is similar to X, as far as
-                 ascent and descent are concerned.  However, they are
-                 positioned differently on the screen (see XDrawText).
-
-\*****************************************************************/
-
-static HDC desktopHDC;
-static int firstTE = TRUE;
-int
-XTextExtents(fstruct,str,nc,dir,ascent,descent,overall)
-XFontStruct *fstruct;
-const char *str;
-int nc;
-int *dir,*ascent,*descent;
-XCharStruct *overall;
-{
-       TEXTMETRIC tmet;
-       HDC hdc;
-       SIZE tsize;
-       HWND desktop;
-       HFONT old;
-       
-       xtrace("XTextExtents\n");
-       if (firstTE)
-       {
-               firstTE = FALSE;
-               desktop=GetDesktopWindow();
-               desktopHDC=GetDC(desktop);
-       }
-       hdc = desktopHDC;
-       old = SelectObject(hdc, (HFONT)fstruct->fid);
-       GetTextMetrics(hdc,&tmet);
-       GetTextExtentPoint(hdc,str,nc,&tsize);
-       *dir=FontLeftToRight;
-       *ascent=tmet.tmAscent + 1;
-       *descent=tmet.tmDescent;
-       overall->ascent=(short)(tmet.tmAscent + 1);
-       overall->descent=(short)tmet.tmDescent;
-       overall->width=(short)tsize.cx;
-       overall->lbearing=0;
-       overall->rbearing=(short)tsize.cx;
-       /* cjh_rel_dc(desktop,hdc);*/
-       SelectObject(hdc,old);
-       return 0;
-}
-
-
-int
-XTextExtents16(fstruct,str,nc,dir,ascent,descent,overall)
-XFontStruct *fstruct;
-const XChar2b *str;
-int nc;
-int *dir,*ascent,*descent;
-XCharStruct *overall;
-{
-       xtrace("XTextExtents16\n");
-       return 0;
-}
-
-
-/*****************************************************************\
-
-
-       Function: XTextWidth
-       Inputs:   font structure, string, length of string.
-       Returned: String width in pixels.
-
-       Comments:
-
-\*****************************************************************/
-
-int
-XTextWidth(fstruct,str,co)
-XFontStruct *fstruct;
-const char *str;
-int co;
-{
-       HDC hdc;
-       SIZE tsize;
-       HWND root;
-       HFONT old;
-       xtrace("XTextWidth\n");
-
-       if(firstTE)
-       {
-               firstTE = FALSE;
-               root=GetDesktopWindow();
-               hdc=GetDC(root);
-       }
-       old = SelectObject(hdc, (HFONT)fstruct->fid);
-       GetTextExtentPoint(hdc,str,co,&tsize);
-       SelectObject(hdc,old);
-       /*cjh_rel_dc(root,hdc);*/
-       return (tsize.cx);
-}
-
-
-int
-XTextWidth16(fstruct,str,co)
-XFontStruct *fstruct;
-const XChar2b *str;
-int co;
-{
-       xtrace("XTextWidth16\n");
-       return 0;
-}
-
-
-int
-XGetErrorDatabaseText(display,name,msg,defstr,buf,len)
-Display *display;
-const char *name,*msg;
-const char *defstr;
-char *buf;
-int len;
-{
-       static char def_err[]="Errors not implemented";
-       int n;
-
-       xtrace("XGetErrorDatabaseText\n");
-       while (n<len && def_err[n] != 0)
-               *(buf+n)=def_err[n++];
-       *(buf+n)=0;
-       return 0;
-}
-
-
-int
-XGetErrorText(display,code,buf,len)
-Display *display;
-int code;
-char *buf;
-int len;
-{
-       xtrace("XGetErrorText\n");
-       return 0;
-}
-
-
-XErrorHandler
-XSetErrorHandler(handler)
-XErrorHandler handler;
-{
-       xtrace("XSetErrorHandler\n");
-       return 0;
-}
-
-
-/*****************************************************************\
-
-
-       Function: XDefaultScreen
-       Inputs:   display
-       Returned: default screen number
-
-       Comments:
-
-\*****************************************************************/
-
-int
-XDefaultScreen(display)
-Display *display;
-{
-       xtrace("XDefaultScreen\n");
-       return (display->default_screen);
-}
-
-Visual *
-XDefaultVisual(display, screen)
-Display *display;
-int screen;
-{
-       xtrace("XDefaultVisual\n");
-       return DefaultVisual(display, screen);
-}
-int
-XDefaultDepth(display, screen)
-Display *display;
-int screen;
-{
-       xtrace("XDefaultDepth\n");
-       return DefaultDepth(display, screen);
-}
-Colormap
-XDefaultColormap(display, screen)
-Display *display;
-int screen;
-{
-       xtrace("XDefaultColormap\n");
-       return DefaultColormap(display, screen);
-}
-
-
-/*****************************************************************\
-
-
-       Function: XScreenOfDisplay
-       Inputs:   display,screen number
-       Returned: screen list.
-
-       Comments:
-
-\*****************************************************************/
-
-Screen *
-XScreenOfDisplay(display,scr)
-Display *display;
-int scr;
-{
-       xtrace("XScreenOfDisplay\n");
-       return (display->screens);
-}
-
-
-Cursor
-XCreateFontCursor(display,shape)
-Display *display;
-unsigned int shape;
-{
-       xtrace("XCreateFontCursor\n");
-       return 0;
-}
-
-
-int
-XRecolorCursor(display,cursor,fg,bg)
-Display *display;
-Cursor cursor;
-XColor *fg,*bg;
-{
-       xtrace("XRecolorCursor\n");
-       return 0;
-}
-
-
-/*****************************************************************\
-
-
-       Function: XWarpPointer
-       Inputs:   display, source window, destination window, source window
-                 geometry, destination x, y.
-
-       Comments: Not knowingly tested.
-
-\*****************************************************************/
-
-int
-XWarpPointer(display,sw,dw,sx,sy,swidth,sheight,dx,dy)
-Display *display;
-Window sw,dw;
-int sx,sy;
-unsigned int swidth,sheight;
-int dx,dy;
-{
-       NT_window *ntsw=(NT_window *)sw;
-       NT_window *ntdw=(NT_window *)dw;
-
-       POINT cpt,tmp;
-       RECT srct;
-       HDC hDC;
-
-       xtrace("XWarpPointer\n");
-       GetCursorPos(&cpt);
-       if (ntsw==None)
-       {
-               if (ntdw==None)
-                       SetCursorPos(dx,dy);
-               else
-               {
-                       tmp.x=dx;
-                       tmp.y=dy;
-                       ClientToScreen(ntdw->w,&tmp);
-                       SetCursorPos(tmp.x,tmp.y);
-               }
-       }
-       else
-       {
-               GetWindowRect(ntsw->w,&srct);
-               tmp.x=sx;
-               tmp.y=sy;
-               ClientToScreen(ntsw->w,&tmp);
-               if (swidth==0)
-                       swidth=srct.right-sx;
-               if (sheight==0)
-                       sheight=srct.bottom-sy;
-               hDC = cjh_get_dc(ntdw);
-               if (cpt.x>=tmp.x && cpt.x<tmp.x+(int)swidth &&
-                   cpt.y>=tmp.y && cpt.y<tmp.y+(int)sheight &&
-                   PtVisible(hDC,cpt.x,cpt.y))
-               {
-                       if (ntdw==None)
-                               SetCursorPos(cpt.x+dx,cpt.y+dy);
-                       else
-                       {
-                               tmp.x=dx;
-                               tmp.y=dy;
-                               ClientToScreen(ntdw->w,&tmp);
-                               SetCursorPos(tmp.x,tmp.y);
-                       }
-               }
-               cjh_rel_dc(ntdw,hDC);
-       }
-       return 0;
-}
-
-
-/*****************************************************************\
-
-
-       Function: XBell
-       Inputs:   display, percent loudness.
-
-       Comments: Don't throw away your CD just yet.
-
-\*****************************************************************/
-
-int
-XBell(display,pc)
-Display *display;
-int pc;
-{
-       xtrace("XBell\n");
-       MessageBeep(MB_OK);
-       return 0;
-}
-
-
-/*****************************************************************\
-
-
-       Function: XGetInputFocus
-       Inputs:   display, focus window, revert to window.
-
-       Comments: We don't have the data in place for the revert to field
-                 to work.
-
-\*****************************************************************/
-
-int
-XGetInputFocus(display,focus,revto)
-Display *display;
-Window *focus;
-int *revto;
-{
-       xtrace("XGetInputFocus\n");
-       *focus=(Window)GetFocus();  /* Note: returns NULL if the focus window */
-       revto=RevertToNone; /*       belongs to another thread.       */
-       return 0;
-}
-
-
-/*****************************************************************\
-
-
-       Function: XSetInputFocus
-       Inputs:   display, focus window, revert to window, time.
-
-       Comments: Set focus to requested client window.
-
-\*****************************************************************/
-
-int
-XSetInputFocus(display,focus,revto,time)
-Display *display;
-Window focus;
-int revto;
-Time time;
-{
-       NT_window *ntw=(NT_window *)focus;
-       xtrace("XSetInputFocus\n");
-       SetFocus(ntw->w);
-       return 0;
-}
-
-
-int
-XLookupString(event,buf,nbytes,keysym,status)
-XKeyEvent *event;
-char *buf;
-int nbytes;
-KeySym *keysym;
-XComposeStatus *status;
-{
-       xtrace("XLookupString\n");
-       *buf=event->keycode;
-       *keysym=event->keycode;
-       return 1;
-}
-
-
-int
-XRefreshKeyboardMapping(event)
-XMappingEvent *event;
-{
-       xtrace("XRefreshKeyboardMapping\n");
-       return 0;
-}
-
-
-int
-XSetClassHint(display,w,chints)
-Display *display;
-Window w;
-XClassHint *chints;
-{
-       xtrace("XSetClassHint\n");
-       return 0;
-}
-
-
-/*****************************************************************\
-
-
-       Function: XSetNormalHints
-       Inputs:   display, window, size hints.
-
-       Comments: Assuming the role of the window manager, we alter the
-                 window geometry as requested.
-
-\*****************************************************************/
-
-int
-XSetNormalHints(display,w,hints)
-Display *display;
-Window w;
-XSizeHints *hints;
-{
-       NT_window *ntw=(NT_window *)w;
-       UINT ff;
-
-       xtrace("XSetNormalHints\n");
-
-       if (!hints->flags&PPosition)
-               ff=SWP_NOMOVE;
-       else
-               ff=0;
-       
-       if (!hints->flags&PSize)
-               ff=ff|SWP_NOSIZE;
-
-       if (hints->flags &USPosition)
-       {
-               ntw->x = hints->x;
-               ntw->y = hints->y;
-       }
-       if (hints->flags & USSize)
-       {
-               ntw->wdth = hints->width;
-               ntw->hght = hints->height;
-       }
-       
-       if (hints->flags&PMinSize)
-       {
-               ntw->minx = hints->min_width;
-               ntw->miny = hints->min_height;
-       }
-       
-       if (VALID_WINDOW(ntw) && (hints->flags & USSize || hints->flags &USPosition))
-       {
-               SetWindowPos(ntw->w,HWND_TOPMOST,hints->x,hints->y,
-                                        hints->width,hints->height,ff|SWP_SHOWWINDOW);
-       }
-       return 0;
-}
-
-
-int
-XSetWMHints(display,w,wmhints)
-Display *display;
-Window w;
-XWMHints *wmhints;
-{
-       xtrace("XSetWMHints\n");
-       return 0;
-}
-
-
-StatusDef
-XSetWMProtocols(display,w,prots,co)
-Display *display;
-Window w;
-Atom *prots;
-int co;
-{
-       xtrace("XSetWMProtocols\n");
-       return 0;
-}
-
-
-/*****************************************************************\
-
-
-       Function: XStoreName
-       Inputs:   display, window, window name.
-
-       Comments: Only set names to the frame windows, otherwise captions
-                 appear in the client areas.
-
-\*****************************************************************/
-
-int
-XStoreName(display,w,wname)
-Display *display;
-Window w;
-const char *wname;
-{
-       NT_window *ntw=(NT_window *)w;
-       int status = 0;
-
-       xtrace("XStoreName\n");
-       if (ntw->top_flag)
-       {
-               ntw->title_text = strdup(wname);
-               if (VALID_WINDOW(ntw))
-                       status = SetWindowText (ntw->w , wname);
-       }
-       return(status);
-}
-
-StatusDef
-XFetchName(
-    Display *display,
-    Window w,
-    char **window_name_return)
-{
-       NT_window *ntw=(NT_window *)w;
-       int status = 1;
-       xtrace("XFetchName\n");
-       *window_name_return = NULL;
-       if (ntw->title_text!=NULL)
-       {
-               *window_name_return = strdup(ntw->title_text);
-               status =0;
-       }
-       return(status);
-}
-
-
-
-/*****************************************************************\
-
-
-       Function: XDoesBackingStore
-       Inputs:   screen
-
-       Comments: No backing store at the moment.  Windows doesn't seem
-                 to support it, unless we do it ourselves with compatible
-                 bitmaps.
-
-\*****************************************************************/
-
-int
-XDoesBackingStore(scr)
-Screen *scr;
-{
-       xtrace("XDoesBackingStore\n");
-       return(0);
-}
-
-
-XExtCodes *
-XInitExtension(display,name)
-Display *display;
-const char *name;
-{
-       xtrace("XInitExtension\n");
-       return 0;
-}
-
-
-/*****************************************************************\
-
-
-       Function: XFree
-       Inputs:   data to be freed.
-
-       Comments: This might need changing sometime.  No crashes so far.
-
-\*****************************************************************/
-
-int
-XFree(data)
-void *data;
-{
-       xtrace("XFree\n");
-       freeMemory(data);
-       return 0;
-}
-
-/*****************************************************************\
-
-
-       Function: XServerVendor
-       Inputs:   display.
-       Returned: string of vendor's name.
-
-       Comments: Copied from the display structure.
-
-\*****************************************************************/
-
-char *
-XServerVendor(display)
-Display *display;
-{
-       xtrace("XServerVendor\n");
-       return (display->vendor);
-}
-
-
-int
-XSetIconName(display,w,iname)
-Display *display;
-Window w;
-const char *iname;
-{
-       xtrace("XSetIconName\n");
-       return 0;
-}
-int
-XGetIconName(display,w,iname)
-Display *display;
-Window w;
-char **iname;
-{
-       xtrace("XGetIconName\n");
-       *iname = NULL;
-       return 0;
-}
-
-
-int
-XSetSelectionOwner(display, sel, owner, time)
-Display* display;
-Atom sel;
-Window owner;
-Time time;
-{
-    HWND hwnd = owner ? ((NT_window*)owner)->w : NULL;
-       HWND cowner = GetClipboardOwner();
-       OpenClipboard(hwnd);
-       if (cowner==hwnd)
-               catchNextDestroyClipboard();
-       EmptyClipboard();
-       CloseClipboard();
-       return 0;
-}
-
-Window
-XGetSelectionOwner(display,selection)
-Display* display;
-Atom selection;
-{
-       HWND hwnd = NULL;
-       Window w;
-       xtrace("XGetSelectionOwner\n");
-       hwnd = GetClipboardOwner();
-       w = (Window)NT_find_window_from_id(hwnd);
-       if (!w) w=None;
-       return w;
-}
-
-/*****************************************************************\
-
-       Function: NT_set_rop
-       Inputs:   window device context, X graphics context
-
-       Comments: Sets the graphics drawing operation.
-
-\*****************************************************************/
-
-void
-NT_set_rop(hdc,gc)
-HDC hdc;
-GC gc;
-{
-       switch (gc->values.function)
-       {
-               case GXclear:
-                       SetROP2(hdc,R2_BLACK);
-                       break;
-
-               case GXand:
-                       SetROP2(hdc,R2_MASKPEN);
-                       break;
-
-               case GXandReverse:
-                       SetROP2(hdc,R2_MASKPENNOT);
-                       break;
-
-               case GXcopy:
-                       SetROP2(hdc,R2_COPYPEN);
-                       break;
-
-               case GXnoop:
-                       SetROP2(hdc,R2_NOP);
-                       break;
-
-               case GXxor:
-                       SetROP2(hdc,R2_XORPEN);/*XORPEN);*/
-                       break;
-
-               case GXor:
-                       SetROP2(hdc,R2_MERGEPEN);
-                       break;
-
-               case GXnor:
-                       SetROP2(hdc,R2_NOTMERGEPEN);
-                       break;
-
-               case GXequiv:
-                       SetROP2(hdc,R2_NOTXORPEN);
-                       break;
-
-               case GXinvert:
-                       SetROP2(hdc,R2_NOT);
-                       break;
-
-               case GXorReverse:
-                       SetROP2(hdc,R2_MERGEPENNOT);
-                       break;
-
-               case GXcopyInverted:
-                       SetROP2(hdc,R2_NOTCOPYPEN);
-                       break;
-
-               case GXorInverted:
-                       SetROP2(hdc,R2_MERGENOTPEN);
-                       break;
-
-               case GXnand:
-                       SetROP2(hdc,R2_NOTMASKPEN);
-                       break;
-
-               case GXset:
-                       SetROP2(hdc,R2_WHITE);
-                       break;
-       }
-}
-
-/*****************************************************************\
-
-       Function: NT_check_update_GC
-       Inputs:   gc - Graphics Context
-
-       Comments: Check what has changed in the GC and modify the
-                 pen and brush accordingly.
-
-\*****************************************************************/
-static int
-NT_check_update_GC(gc)
-GC gc;
-{
-       DWORD style=PS_GEOMETRIC;
-       LOGBRUSH lbr;
-       int      width;
-       NTGC    *lntgc;
-
-       if ( gc->ext_data == NULL )
-       {
-               gc->ext_data = (XExtData *)allocateMemory(sizeof(XExtData));
-               lntgc = (NTGC *)allocateMemory(sizeof(NTGC));
-               gc->ext_data->private_data = (char *)lntgc;
-               lntgc->pen = INVALID_HANDLE;
-               lntgc->brush = INVALID_HANDLE;
-               lntgc->bgbrush = INVALID_HANDLE;
-               gc->dirty=~0;
-       }
-
-       if ((gc->dirty & GCForeground) ||
-                (gc->dirty & GCLineStyle)  ||
-            (gc->dirty & GCCapStyle)   ||
-            (gc->dirty & GCJoinStyle)  ||
-            (gc->dirty & GCLineWidth) )
-       {
-               lbr.lbStyle=BS_SOLID;
-               lbr.lbColor=CNUMTORGB(gc->values.foreground);
-               lbr.lbHatch=0;
-
-               if (gc->values.line_style==LineDoubleDash)
-                       style|=PS_DASHDOT;
-               else if (gc->values.line_style==LineOnOffDash)
-                       style|=PS_DASH;
-               else
-                       style|=PS_SOLID;
-
-               if (gc->values.cap_style==CapProjecting)
-                       style|=PS_ENDCAP_SQUARE;
-               else if (gc->values.cap_style==CapRound)
-                       style|=PS_ENDCAP_ROUND;
-               else
-                       style|=PS_ENDCAP_FLAT;
-
-               if (gc->values.join_style==JoinRound)
-                       style|=PS_JOIN_ROUND;
-               else if (gc->values.join_style==JoinMiter)
-                       style|=PS_JOIN_MITER;
-               else
-                       style|=PS_JOIN_BEVEL;
-               width=gc->values.line_width;
-               if (width==0)
-                       width=1;
-
-               lntgc = (NTGC *)gc->ext_data->private_data;
-               if ( lntgc->pen != INVALID_HANDLE )
-                       DeleteObject(lntgc->pen);
-
-               lntgc->pen = ExtCreatePen(style,width,&lbr,0,NULL);
-       }
-       if (gc->values.fill_style != FillSolid)
-       {
-               if ((gc->dirty & GCStipple))
-               {
-                       NT_window *pixmap = (NT_window *)gc->values.stipple;
-                       lntgc->brush = CreatePatternBrush(pixmap->hBitmap);
-               }
-       }
-       else if ((gc->dirty & GCForeground) )
-       {
-               lntgc = (NTGC *)gc->ext_data->private_data;
-               if ( lntgc->brush != INVALID_HANDLE )
-                       DeleteObject(lntgc->brush);
-               lntgc->brush = CreateSolidBrush(CNUMTORGB(gc->values.foreground));
-
-       }
-
-       if ((gc->dirty & GCBackground) )
-       {
-               lntgc = (NTGC *)gc->ext_data->private_data;
-               if ( lntgc->bgbrush != INVALID_HANDLE )
-                       DeleteObject(lntgc->bgbrush);
-               lntgc->bgbrush = CreateSolidBrush(CNUMTORGB(gc->values.background));
-
-       }
-
-       gc->dirty = 0;
-
-       return(1);
-}
-
-
-/*****************************************************************\
-
-       Function: NT_get_GC_pen
-       Inputs:   device context, graphics context
-
-       Comments: Sets the device context and pen according to the
-                 graphics context.
-
-\*****************************************************************/
-static HPEN
-NT_get_GC_pen(hdc,gc)
-HDC hdc;
-GC gc;
-{
-       NTGC *lntgc;
-
-       NT_check_update_GC(gc);
-       NT_set_rop(hdc,gc);
-
-       lntgc = (NTGC *)gc->ext_data->private_data;
-
-       return(lntgc->pen);
-}
-
-
-/*****************************************************************\
-
-       Function: NT_get_GC_brush
-       Inputs:   device context, graphics context
-       Returns:  handle for brush.
-
-       Comments: Same as above for painting operations.
-
-\*****************************************************************/
-static HBRUSH
-NT_get_GC_brush(hdc,gc)
-HDC hdc;
-GC gc;
-{
-       NTGC *lntgc;
-
-        NT_check_update_GC(gc);
-
-       if (gc->values.fill_rule==EvenOddRule)
-               SetPolyFillMode(hdc,ALTERNATE);
-       else
-               SetPolyFillMode(hdc,WINDING);
-       
-       if (gc->values.fill_style == FillSolid || 
-           gc->values.fill_style == FillOpaqueStippled)
-       {
-               SetTextColor(hdc, CNUMTORGB(gc->values.foreground));
-               SetBkColor(hdc, CNUMTORGB(gc->values.background));
-       }
-
-       NT_set_rop(hdc,gc);
-
-       lntgc = (NTGC *)gc->ext_data->private_data;
-
-       return(lntgc->brush);
-}
-
-static HBRUSH
-NT_get_GC_bgbrush(hdc,gc)
-HDC hdc;
-GC gc;
-{
-       NTGC *lntgc;
-        NT_check_update_GC(gc);
-       lntgc = (NTGC *)gc->ext_data->private_data;
-       return(lntgc->bgbrush);
-}
-
-
-
-/*****************************************************************\
-
-       Function: NT_deg64_to_rad
-       Inputs:   angle (in 64ths of a degree)
-
-       Comments: Converts int angle to double in radians.
-
-\*****************************************************************/
-
-double
-NT_deg64_to_rad(a)
-int a;
-{
-       return ((double)a/64.0*0.017453);
-}
-
-
-/******************************************************************/
-/*                                                                */
-/*               Atoms and properties code.                       */
-/*                                                                */
-/******************************************************************/
-
-static char **nt_atoms;
-static int num_nt_atoms = 0;
-static int max_num_nt_atoms = 0;
-#define ATOMS_BLOCK_SIZE 40
-
-/******************************************************************\
-
-         Function:  XInternAtom
-         Inputs:    Display, property name, creation flag.
-
-         Comments:  Could be made much more efficient.
-
-\******************************************************************/
-
-Atom
-XInternAtom(display, property_name, only_if_exists)
-Display *display;
-const char *property_name;
-BoolDef only_if_exists;
-{
-       int i;
-       char **new_nt_atoms;
-
-       xtrace("XInternAtom\n");
-       if (strcmp(property_name,"VT_SELECTION")==0)
-       {
-               return XA_LAST_PREDEFINED + 667;
-       }
-       
-       for (i=0;i< num_nt_atoms ;i++)
-               if (strcmp(nt_atoms[i],property_name) == 0)
-                       return XA_LAST_PREDEFINED + i;
-       
-       if (only_if_exists)
-               return None;
-
-       if (num_nt_atoms >= max_num_nt_atoms)
-       {
-               new_nt_atoms = (char **)realloc(nt_atoms,(max_num_nt_atoms + ATOMS_BLOCK_SIZE)*sizeof(char *));
-               if (!new_nt_atoms)
-                       return None;
-               nt_atoms = new_nt_atoms;
-               max_num_nt_atoms+= ATOMS_BLOCK_SIZE;
-               nt_atoms[num_nt_atoms] = allocateMemory(strlen(property_name)+1);
-               if (!nt_atoms[num_nt_atoms])
-                       return None;
-               strcpy(nt_atoms[num_nt_atoms],property_name);
-               return (XA_LAST_PREDEFINED +  num_nt_atoms++);
-       }
-}
-
-/******************************************************************\
-
-         Function:  XGetAtomName
-         Inputs:    Display,Atom
-
-         Comments:  None.
-
-\******************************************************************/
-char *
-XGetAtomName(display,atom)
-Display *display;
-Atom atom;
-{
-       char *ret_string;
-       xtrace("XGetAtomName\n");
-       if (atom > num_nt_atoms + XA_LAST_PREDEFINED)
-               return NULL;
-
-       if (! (ret_string = allocateMemory(strlen(nt_atoms[atom - XA_LAST_PREDEFINED])+1)))
-               return FALSE;
-
-       strcpy(ret_string,nt_atoms[atom]);
-
-       return ret_string;
-}
-
-/******************************************************************\
-
-         Function:  XChangeProperty
-         Inputs:    Display,Window,Property,type,format,mode,data,
-                    nelements.
-
-         Comments:  None.
-
-\******************************************************************/
-int
-XChangeProperty(
-       Display *display,
-       Window window,
-       Atom property,
-       Atom type,
-       int format,
-       int mode,
-       const unsigned char *data,
-       int nelements)
-{
-       NT_window *ntw=(NT_window *)window;
-       struct NT_prop_list *wanderer, *new;
-       xtrace("XChangeProperty\n");
-
-       if (property == XA_CUT_BUFFER0 && type==XA_STRING)
-       {
-               HGLOBAL handle=NULL;
-               char *buffer=NULL;
-               int i,j,cr=0;
-               for (i=0; i<nelements; i++)
-                       if (data[i]=='\n' && (i==0 || data[i-1]!='\r')) cr++;
-               
-               handle = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE, nelements+cr+1);
-               if (!handle) return;
-               OpenClipboard(ntw->w);
-               buffer = GlobalLock(handle);
-               for (i=j=0; i<nelements; buffer[j++]=data[i++])
-                       if (data[i]=='\n' && (i==0 || data[i-1]!='\r')) buffer[j++]='\r';
-               buffer[j++]='\0';
-               GlobalUnlock(handle);
-               SetClipboardData(CF_TEXT, handle);
-               handle = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE, sizeof(LCID));
-               if (handle) {
-                       *(LCID*)GlobalLock(handle) = GetThreadLocale();
-                       GlobalUnlock(handle);
-                       SetClipboardData(CF_LOCALE, handle);
-               }
-               CloseClipboard();
-               return;
-       }
-}
-
-int
-XDeleteProperty(
-      Display *display,
-      Window w,
-      Atom property)
-{
-       return 0;
-}
-
-static char *
-NT_getClipboard() 
-{
-    char *ret = NULL;
-    char *s,*t;
-    int size, format=0;
-    HGLOBAL handle;
-    LPVOID data;
-    OpenClipboard(NULL);
-    for (format = EnumClipboardFormats(format); format; format = EnumClipboardFormats(format)) {
-       if (format != CF_TEXT && format != CF_UNICODETEXT) continue;
-       handle = GetClipboardData(format);
-       if (handle==NULL) break;
-       data = GlobalLock(handle);
-       if (format == CF_UNICODETEXT) {
-           int conv = CP_THREAD_ACP;
-           size = WideCharToMultiByte(conv,0,data,-1,NULL,0,NULL,NULL);
-           if (size == 0) /* NT doesn't support CF_THREAD_ACP */
-               size = WideCharToMultiByte( (conv = CP_UTF8),0,data,-1,NULL,0,NULL,NULL);
-           if (size==0) continue; /* let windows convert it */
-           ret = allocateMemory(size);
-           WideCharToMultiByte(conv, 0, data, -1, ret, size, NULL, NULL);
-       } else {
-           size = strlen(data)+1;
-           ret = allocateMemory(size);
-           strcpy(ret,data);
-       }    
-       GlobalUnlock(handle);
-       break;
-    }
-    CloseClipboard();
-    for (s=t=ret;s && (*t=*s++);) if (*t!='\r') t++;
-    return ret;
-}
-
-int
-XGetWindowProperty(display,window,property,long_offset,long_length,delete,
-                   req_type,actual_type_return,actual_format_return,
-                   nitems_return,bytes_after_return,prop_return)
-Display *display;
-Window window;
-Atom property;
-long long_offset;
-long long_length;
-BoolDef delete;
-Atom req_type;
-Atom *actual_type_return;
-int *actual_format_return;
-unsigned long *nitems_return;
-unsigned long *bytes_after_return;
-unsigned char **prop_return;
-{
-    xtrace("XGetWindowProperty\n");
-    if (property == XA_CUT_BUFFER0 && prop_return && (*prop_return = NT_getClipboard())) {
-       *nitems_return=strlen(*prop_return);
-       *actual_type_return = XA_STRING;
-       *bytes_after_return = 0;
-    }    
-    else {
-       *prop_return = NULL;
-       *actual_type_return = None;
-       *actual_format_return = 0;
-       *bytes_after_return = 0;
-    }
-    return 0;
-}
-
-
-
-char **
-XListExtensions(display,ret_num)
-Display *display;
-int *ret_num;
-{
-       *ret_num = 0;
-       xtrace("XListExtensions\n");
-       return NULL;
-}
-
-XFreeExtensionList(list)
-char **list;
-{
-       xtrace("XFreeExtensionList\n");
-       return 0;
-}
-
-XChangeGC(
-       Display* display,
-       GC gc,
-       unsigned long mask,
-       XGCValues* gc_values)
-{
-       xtrace("XChangeGC\n");
-       if (mask&GCArcMode)
-               gc->values.arc_mode=gc_values->arc_mode;
-       if (mask&GCBackground)
-               gc->values.background=gc_values->background;
-       if (mask&GCCapStyle)
-               gc->values.cap_style=gc_values->cap_style;
-       if (mask&GCClipMask)
-               gc->values.clip_mask=gc_values->clip_mask;
-       if (mask&GCClipXOrigin)
-               gc->values.clip_x_origin=gc_values->clip_x_origin;
-       if (mask&GCClipYOrigin)
-               gc->values.clip_y_origin=gc_values->clip_y_origin;
-       if (mask&GCDashList)
-               gc->values.dashes=gc_values->dashes;
-       if (mask&GCDashOffset)
-               gc->values.dash_offset=gc_values->dash_offset;
-       if (mask&GCFillRule)
-               gc->values.fill_rule=gc_values->fill_rule;
-       if (mask&GCFillStyle)
-               gc->values.fill_style=gc_values->fill_style;
-       if (mask&GCFont)
-               gc->values.font=gc_values->font;
-       if (mask&GCForeground)
-               gc->values.foreground=gc_values->foreground;
-       if (mask&GCFunction)
-               gc->values.function=gc_values->function;
-       if (mask&GCGraphicsExposures)
-               gc->values.graphics_exposures=gc_values->graphics_exposures;
-       if (mask&GCJoinStyle)
-               gc->values.join_style=gc_values->join_style;
-       if (mask&GCLineStyle)
-               gc->values.line_style=gc_values->line_style;
-       if (mask&GCLineWidth)
-               gc->values.line_width=gc_values->line_width;
-       if (mask&GCPlaneMask)
-               gc->values.plane_mask=gc_values->plane_mask;
-       if (mask&GCStipple)
-               gc->values.stipple=gc_values->stipple;
-       if (mask&GCSubwindowMode)
-               gc->values.subwindow_mode=gc_values->subwindow_mode;
-       if (mask&GCTile)
-               gc->values.tile=gc_values->tile;
-       if (mask&GCTileStipXOrigin)
-               gc->values.ts_x_origin=gc_values->ts_x_origin;
-       if (mask&GCTileStipYOrigin)
-               gc->values.ts_y_origin=gc_values->ts_y_origin;
-       gc->dirty |= mask;
-       return 0;
-}
-
-int
-XConnectionNumber(Display* display)
-{
-    int fd;
-    xtrace("XConnectionNumber\n");
-    fd = open ("/dev/windows", O_NONBLOCK, 0);
-    return fd;
-}
-
-XFreeFont(Display* display,XFontStruct* font_struct)
-{
-       xtrace("XFreeFont\n");
-       return 0;
-}
-
-char *
-_Xsetlocale(int category, const char *name)
-{
-       xtrace("Xsetlocale\n");
-       return (char *)name;
-}
-
-char *
-XSetLocaleModifiers(const char* modifier_list)
-{
-       xtrace("XSetLocaleModifiers\n");
-       return NULL;
-}
-XIM
-XOpenIM(
-       Display* dpy,
-       struct _XrmHashBucketRec* rdb,
-       char* res_name,
-       char* res_class)
-{
-       xtrace("XOpenIM\n");
-       return 0;
-}
-char *
-XGetIMValues(XIM im , ...)
-{
-       xtrace("XGetIMValues\n");
-       return NULL;
-}
-XIC
-XCreateIC(XIM im , ...)
-{
-       xtrace("XCreateIC\n");
-       return 0;
-}
-StatusDef
-XCloseIM(XIM im)
-{
-       xtrace("XCloseIM\n");
-       return 0;
-}
-
-char *
-XrmQuarkToString(void *quark)
-{
-       xtrace("XrmQuarkToString\n");
-       return NULL;
-}
-
-int
-XmbLookupString(
-       XIC ic,
-       XKeyPressedEvent* event,
-       char* buffer_return,
-       int bytes_buffer,
-       KeySym* keysym_return,
-       StatusDef* status_return)
-{
-       xtrace("XmbLookupString\n");
-       return 0;
-}
-int
-XmbTextPropertyToTextList(
-       Display *display,
-       XTextProperty *text_prop,
-       char ***list_return,
-       int *count_return)
-{
-       xtrace("XmbTextPropertyToTextList\n");
-       /* in the future copy this, for 2.7.1 rxvt leaks this, so don't yet */
-       *list_return = (char **)allocateMemory(sizeof(char *));
-       *list_return[0] = text_prop->value;
-       *count_return = 1;
-       return 0;       
-}
-
-void
-XFreeStringList(char **list)
-{
-       freeMemory(list);
-}
-
-int
-XmbTextListToTextProperty(
-        Display *display,
-        char **list,
-        int count,
-        XICCEncodingStyle style,
-        XTextProperty *text_prop_return)
-{
-       int ret = 0;
-       if (count!=1) ret = XNoMemory;
-       text_prop_return->value = strdup(list[0]);
-       switch (style)
-       {
-               case XStringStyle: text_prop_return->encoding = XA_STRING; break;
-               /* case XCompoundTextStyle: text_prop_return->encoding = XA_COMPOUND; break; */
-               default: ret = XLocaleNotSupported;
-       }
-       text_prop_return->format = 8;
-       text_prop_return->nitems = count;
-       return ret;
-}
-void XmbDrawString(
-       Display *display,
-       Drawable d,
-       XFontSet font_set,
-       GC gc,
-       int x, int y,
-       char *string,
-       int num_bytes) 
-{
-       xtrace("XmbDrawString\n");
-}
-
-
-void
-XSetICFocus(XIC ic)
-{
-       xtrace("XSetICFocus\n");
-}
-void
-XUnsetICFocus(XIC ic)
-{
-       xtrace("XUnsetICFocus\n");
-}
-
-
-
-/* lifted from emacs */
-/*
- *    XParseGeometry parses strings of the form
- *   "=<width>x<height>{+-}<xoffset>{+-}<yoffset>", where
- *   width, height, xoffset, and yoffset are unsigned integers.
- *   Example:  "=80x24+300-49"
- *   The equal sign is optional.
- *   It returns a bitmask that indicates which of the four values
- *   were actually found in the string.  For each value found,
- *   the corresponding argument is updated;  for each value
- *   not found, the corresponding argument is left unchanged. 
- */
-
-static int
-read_integer (string, NextString)
-     register char *string;
-     char **NextString;
-{
-       register int Result = 0;
-       int Sign = 1;
-  
-       if (*string == '+')
-               string++;
-       else if (*string == '-')
-    {
-               string++;
-               Sign = -1;
-    }
-       for (; (*string >= '0') && (*string <= '9'); string++)
-    {
-               Result = (Result * 10) + (*string - '0');
-    }
-       *NextString = string;
-       if (Sign >= 0)
-               return (Result);
-       else
-               return (-Result);
-}
-
-/* lifted from emacs */
-int
-XParseGeometry(
-       const char* string,
-       int* x,
-       int* y,
-       unsigned int* width,
-       unsigned int* height)
-{
-       int mask = NoValue;
-       register char *strind;
-       unsigned int tempWidth, tempHeight;
-       int tempX, tempY;
-       char *nextCharacter;
-  
-       if ((string == NULL) || (*string == '\0')) return (mask);
-       if (*string == '=')
-               string++;  /* ignore possible '=' at beg of geometry spec */
-  
-       strind = (char *)string;
-       if (*strind != '+' && *strind != '-' && *strind != 'x') 
-    {
-               tempWidth = read_integer (strind, &nextCharacter);
-               if (strind == nextCharacter) 
-                       return (0);
-               strind = nextCharacter;
-               mask |= WidthValue;
-    }
-  
-       if (*strind == 'x' || *strind == 'X') 
-    {  
-               strind++;
-               tempHeight = read_integer (strind, &nextCharacter);
-               if (strind == nextCharacter)
-                       return (0);
-               strind = nextCharacter;
-               mask |= HeightValue;
-    }
-  
-       if ((*strind == '+') || (*strind == '-')) 
-    {
-               if (*strind == '-') 
-               {
-                       strind++;
-                       tempX = -read_integer (strind, &nextCharacter);
-                       if (strind == nextCharacter)
-                               return (0);
-                       strind = nextCharacter;
-                       mask |= XNegative;
-
-               }
-               else
-               {       
-                       strind++;
-                       tempX = read_integer (strind, &nextCharacter);
-                       if (strind == nextCharacter)
-                               return (0);
-                       strind = nextCharacter;
-               }
-               mask |= XValue;
-               if ((*strind == '+') || (*strind == '-')) 
-               {
-                       if (*strind == '-') 
-                       {
-                               strind++;
-                               tempY = -read_integer (strind, &nextCharacter);
-                               if (strind == nextCharacter)
-                                       return (0);
-                               strind = nextCharacter;
-                               mask |= YNegative;
-
-                       }
-                       else
-                       {
-                               strind++;
-                               tempY = read_integer (strind, &nextCharacter);
-                               if (strind == nextCharacter)
-                                       return (0);
-                               strind = nextCharacter;
-                       }
-                       mask |= YValue;
-               }
-    }
-  
-       /* If strind isn't at the end of the string the it's an invalid
-          geometry specification. */
-  
-       if (*strind != '\0') return (0);
-  
-       if (mask & XValue)
-               *x = tempX;
-       if (mask & YValue)
-               *y = tempY;
-       if (mask & WidthValue)
-               *width = tempWidth;
-       if (mask & HeightValue)
-               *height = tempHeight;
-       return (mask);
-}
-
-XResizeWindow(
-       Display* display,
-       Window w,
-       unsigned int width,
-       unsigned int height)
-{
-       RECT r; 
-       NT_window *ntw=(NT_window *)w;
-       xtrace("XResizeWindow\n");
-       r.left = ntw->x;
-       r.top = ntw->y;
-       r.right = r.left + width;
-       r.bottom = r.top + height;
-       if (ntw->top_flag)
-         AdjustWindowRect(&r, WS_OVERLAPPEDWINDOW, FALSE);
-       if (VALID_WINDOW(ntw))
-         MoveWindow(ntw->w, r.left, r.top, 
-                    r.right-r.left, r.bottom-r.top,TRUE);
-       return 0;
-}
-
-void
-XSetWMNormalHints(Display* display,Window w,XSizeHints* hints)
-{
-       xtrace("XSetWMNormalHints\n");
-       XSetNormalHints(display,w,hints);
-}
-
-void
-XSetWMProperties(
-       Display* display,
-       Window w,
-       XTextProperty* window_name,
-       XTextProperty* icon_name,
-       char** argv,
-       int argc,
-       XSizeHints* normal_hints,
-       XWMHints* wm_hints,
-       XClassHint* class_hints)
-{
-       xtrace("XSetWMProperties\n");
-       XSetNormalHints(display,w,normal_hints);
-}
-XDefineCursor(Display* display,Window w,Cursor cursor)
-{
-       xtrace("XDefineCursor\n");
-       return 0;
-}
-
-XMoveResizeWindow(
-       Display* display,
-       Window w,
-       int x,
-       int y,
-       unsigned int width,
-       unsigned int height)
-{
-       NT_window *ntw=(NT_window *)w;
-       xtrace("XMoveResizeWindow\n");
-       ntw->x = x;
-       ntw->y = y;
-       ntw->wdth = width;
-       ntw->hght = height;
-       if (VALID_WINDOW(ntw)) {
-               NT_moveWindow(ntw,TRUE);
-       }
-       
-}
-
-XMoveWindow(
-       Display* display,
-       Window w,
-       int x,
-       int y)
-{
-       NT_window *ntw=(NT_window *)w;
-       xtrace("XMoveWindow\n");
-       ntw->x = x;
-       ntw->y = y;
-       if (VALID_WINDOW(ntw)) {
-               NT_moveWindow(ntw,TRUE);
-       }
-       return 0;
-}
-
-/* 
- * xcolors.c --
- *
- *     This file contains the routines used to map from X color
- *     names to RGB and pixel values.
- *
- * Copyright (c) 1996 by Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- *
- * SCCS: @(#) xcolors.c 1.3 96/12/17 13:07:02
- */
-
-/*
- * Define an array that defines the mapping from color names to RGB values.
- * Note that this array must be kept sorted alphabetically so that the
- * binary search used in XParseColor will succeed.
- */
-typedef struct {
-    char *name;
-    unsigned char red;
-    unsigned char green;
-    unsigned char blue;
-} XColorEntry;
-
-static XColorEntry xColors[] = {
-    "alice blue", 240, 248, 255,
-    "AliceBlue", 240, 248, 255,
-    "antique white", 250, 235, 215,
-    "AntiqueWhite", 250, 235, 215,
-    "AntiqueWhite1", 255, 239, 219,
-    "AntiqueWhite2", 238, 223, 204,
-    "AntiqueWhite3", 205, 192, 176,
-    "AntiqueWhite4", 139, 131, 120,
-    "aquamarine", 127, 255, 212,
-    "aquamarine1", 127, 255, 212,
-    "aquamarine2", 118, 238, 198,
-    "aquamarine3", 102, 205, 170,
-    "aquamarine4", 69, 139, 116,
-    "azure", 240, 255, 255,
-    "azure1", 240, 255, 255,
-    "azure2", 224, 238, 238,
-    "azure3", 193, 205, 205,
-    "azure4", 131, 139, 139,
-    "beige", 245, 245, 220,
-    "bisque", 255, 228, 196,
-    "bisque1", 255, 228, 196,
-    "bisque2", 238, 213, 183,
-    "bisque3", 205, 183, 158,
-    "bisque4", 139, 125, 107,
-    "black", 0, 0, 0,
-    "blanched almond", 255, 235, 205,
-    "BlanchedAlmond", 255, 235, 205,
-    "blue", 0, 0, 255,
-    "blue violet", 138, 43, 226,
-    "blue1", 0, 0, 255,
-    "blue2", 0, 0, 238,
-    "blue3", 0, 0, 205,
-    "blue4", 0, 0, 139,
-    "BlueViolet", 138, 43, 226,
-    "brown", 165, 42, 42,
-    "brown1", 255, 64, 64,
-    "brown2", 238, 59, 59,
-    "brown3", 205, 51, 51,
-    "brown4", 139, 35, 35,
-    "burlywood", 222, 184, 135,
-    "burlywood1", 255, 211, 155,
-    "burlywood2", 238, 197, 145,
-    "burlywood3", 205, 170, 125,
-    "burlywood4", 139, 115, 85,
-    "cadet blue", 95, 158, 160,
-    "CadetBlue", 95, 158, 160,
-    "CadetBlue1", 152, 245, 255,
-    "CadetBlue2", 142, 229, 238,
-    "CadetBlue3", 122, 197, 205,
-    "CadetBlue4", 83, 134, 139,
-    "chartreuse", 127, 255, 0,
-    "chartreuse1", 127, 255, 0,
-    "chartreuse2", 118, 238, 0,
-    "chartreuse3", 102, 205, 0,
-    "chartreuse4", 69, 139, 0,
-    "chocolate", 210, 105, 30,
-    "chocolate1", 255, 127, 36,
-    "chocolate2", 238, 118, 33,
-    "chocolate3", 205, 102, 29,
-    "chocolate4", 139, 69, 19,
-    "coral", 255, 127, 80,
-    "coral1", 255, 114, 86,
-    "coral2", 238, 106, 80,
-    "coral3", 205, 91, 69,
-    "coral4", 139, 62, 47,
-    "cornflower blue", 100, 149, 237,
-    "CornflowerBlue", 100, 149, 237,
-    "cornsilk", 255, 248, 220,
-    "cornsilk1", 255, 248, 220,
-    "cornsilk2", 238, 232, 205,
-    "cornsilk3", 205, 200, 177,
-    "cornsilk4", 139, 136, 120,
-    "cyan", 0, 255, 255,
-    "cyan1", 0, 255, 255,
-    "cyan2", 0, 238, 238,
-    "cyan3", 0, 205, 205,
-    "cyan4", 0, 139, 139,
-    "dark goldenrod", 184, 134, 11,
-    "dark green", 0, 100, 0,
-    "dark khaki", 189, 183, 107,
-    "dark olive green", 85, 107, 47,
-    "dark orange", 255, 140, 0,
-    "dark orchid", 153, 50, 204,
-    "dark salmon", 233, 150, 122,
-    "dark sea green", 143, 188, 143,
-    "dark slate blue", 72, 61, 139,
-    "dark slate gray", 47, 79, 79,
-    "dark slate grey", 47, 79, 79,
-    "dark turquoise", 0, 206, 209,
-    "dark violet", 148, 0, 211,
-    "DarkGoldenrod", 184, 134, 11,
-    "DarkGoldenrod1", 255, 185, 15,
-    "DarkGoldenrod2", 238, 173, 14,
-    "DarkGoldenrod3", 205, 149, 12,
-    "DarkGoldenrod4", 139, 101, 8,
-    "DarkGreen", 0, 100, 0,
-    "DarkKhaki", 189, 183, 107,
-    "DarkOliveGreen", 85, 107, 47,
-    "DarkOliveGreen1", 202, 255, 112,
-    "DarkOliveGreen2", 188, 238, 104,
-    "DarkOliveGreen3", 162, 205, 90,
-    "DarkOliveGreen4", 110, 139, 61,
-    "DarkOrange", 255, 140, 0,
-    "DarkOrange1", 255, 127, 0,
-    "DarkOrange2", 238, 118, 0,
-    "DarkOrange3", 205, 102, 0,
-    "DarkOrange4", 139, 69, 0,
-    "DarkOrchid", 153, 50, 204,
-    "DarkOrchid1", 191, 62, 255,
-    "DarkOrchid2", 178, 58, 238,
-    "DarkOrchid3", 154, 50, 205,
-    "DarkOrchid4", 104, 34, 139,
-    "DarkSalmon", 233, 150, 122,
-    "DarkSeaGreen", 143, 188, 143,
-    "DarkSeaGreen1", 193, 255, 193,
-    "DarkSeaGreen2", 180, 238, 180,
-    "DarkSeaGreen3", 155, 205, 155,
-    "DarkSeaGreen4", 105, 139, 105,
-    "DarkSlateBlue", 72, 61, 139,
-    "DarkSlateGray", 47, 79, 79,
-    "DarkSlateGray1", 151, 255, 255,
-    "DarkSlateGray2", 141, 238, 238,
-    "DarkSlateGray3", 121, 205, 205,
-    "DarkSlateGray4", 82, 139, 139,
-    "DarkSlateGrey", 47, 79, 79,
-    "DarkTurquoise", 0, 206, 209,
-    "DarkViolet", 148, 0, 211,
-    "deep pink", 255, 20, 147,
-    "deep sky blue", 0, 191, 255,
-    "DeepPink", 255, 20, 147,
-    "DeepPink1", 255, 20, 147,
-    "DeepPink2", 238, 18, 137,
-    "DeepPink3", 205, 16, 118,
-    "DeepPink4", 139, 10, 80,
-    "DeepSkyBlue", 0, 191, 255,
-    "DeepSkyBlue1", 0, 191, 255,
-    "DeepSkyBlue2", 0, 178, 238,
-    "DeepSkyBlue3", 0, 154, 205,
-    "DeepSkyBlue4", 0, 104, 139,
-    "dim gray", 105, 105, 105,
-    "dim grey", 105, 105, 105,
-    "DimGray", 105, 105, 105,
-    "DimGrey", 105, 105, 105,
-    "dodger blue", 30, 144, 255,
-    "DodgerBlue", 30, 144, 255,
-    "DodgerBlue1", 30, 144, 255,
-    "DodgerBlue2", 28, 134, 238,
-    "DodgerBlue3", 24, 116, 205,
-    "DodgerBlue4", 16, 78, 139,
-    "firebrick", 178, 34, 34,
-    "firebrick1", 255, 48, 48,
-    "firebrick2", 238, 44, 44,
-    "firebrick3", 205, 38, 38,
-    "firebrick4", 139, 26, 26,
-    "floral white", 255, 250, 240,
-    "FloralWhite", 255, 250, 240,
-    "forest green", 34, 139, 34,
-    "ForestGreen", 34, 139, 34,
-    "gainsboro", 220, 220, 220,
-    "ghost white", 248, 248, 255,
-    "GhostWhite", 248, 248, 255,
-    "gold", 255, 215, 0,
-    "gold1", 255, 215, 0,
-    "gold2", 238, 201, 0,
-    "gold3", 205, 173, 0,
-    "gold4", 139, 117, 0,
-    "goldenrod", 218, 165, 32,
-    "goldenrod1", 255, 193, 37,
-    "goldenrod2", 238, 180, 34,
-    "goldenrod3", 205, 155, 29,
-    "goldenrod4", 139, 105, 20,
-    "gray", 190, 190, 190,
-    "gray0", 0, 0, 0,
-    "gray1", 3, 3, 3,
-    "gray10", 26, 26, 26,
-    "gray100", 255, 255, 255,
-    "gray11", 28, 28, 28,
-    "gray12", 31, 31, 31,
-    "gray13", 33, 33, 33,
-    "gray14", 36, 36, 36,
-    "gray15", 38, 38, 38,
-    "gray16", 41, 41, 41,
-    "gray17", 43, 43, 43,
-    "gray18", 46, 46, 46,
-    "gray19", 48, 48, 48,
-    "gray2", 5, 5, 5,
-    "gray20", 51, 51, 51,
-    "gray21", 54, 54, 54,
-    "gray22", 56, 56, 56,
-    "gray23", 59, 59, 59,
-    "gray24", 61, 61, 61,
-    "gray25", 64, 64, 64,
-    "gray26", 66, 66, 66,
-    "gray27", 69, 69, 69,
-    "gray28", 71, 71, 71,
-    "gray29", 74, 74, 74,
-    "gray3", 8, 8, 8,
-    "gray30", 77, 77, 77,
-    "gray31", 79, 79, 79,
-    "gray32", 82, 82, 82,
-    "gray33", 84, 84, 84,
-    "gray34", 87, 87, 87,
-    "gray35", 89, 89, 89,
-    "gray36", 92, 92, 92,
-    "gray37", 94, 94, 94,
-    "gray38", 97, 97, 97,
-    "gray39", 99, 99, 99,
-    "gray4", 10, 10, 10,
-    "gray40", 102, 102, 102,
-    "gray41", 105, 105, 105,
-    "gray42", 107, 107, 107,
-    "gray43", 110, 110, 110,
-    "gray44", 112, 112, 112,
-    "gray45", 115, 115, 115,
-    "gray46", 117, 117, 117,
-    "gray47", 120, 120, 120,
-    "gray48", 122, 122, 122,
-    "gray49", 125, 125, 125,
-    "gray5", 13, 13, 13,
-    "gray50", 127, 127, 127,
-    "gray51", 130, 130, 130,
-    "gray52", 133, 133, 133,
-    "gray53", 135, 135, 135,
-    "gray54", 138, 138, 138,
-    "gray55", 140, 140, 140,
-    "gray56", 143, 143, 143,
-    "gray57", 145, 145, 145,
-    "gray58", 148, 148, 148,
-    "gray59", 150, 150, 150,
-    "gray6", 15, 15, 15,
-    "gray60", 153, 153, 153,
-    "gray61", 156, 156, 156,
-    "gray62", 158, 158, 158,
-    "gray63", 161, 161, 161,
-    "gray64", 163, 163, 163,
-    "gray65", 166, 166, 166,
-    "gray66", 168, 168, 168,
-    "gray67", 171, 171, 171,
-    "gray68", 173, 173, 173,
-    "gray69", 176, 176, 176,
-    "gray7", 18, 18, 18,
-    "gray70", 179, 179, 179,
-    "gray71", 181, 181, 181,
-    "gray72", 184, 184, 184,
-    "gray73", 186, 186, 186,
-    "gray74", 189, 189, 189,
-    "gray75", 191, 191, 191,
-    "gray76", 194, 194, 194,
-    "gray77", 196, 196, 196,
-    "gray78", 199, 199, 199,
-    "gray79", 201, 201, 201,
-    "gray8", 20, 20, 20,
-    "gray80", 204, 204, 204,
-    "gray81", 207, 207, 207,
-    "gray82", 209, 209, 209,
-    "gray83", 212, 212, 212,
-    "gray84", 214, 214, 214,
-    "gray85", 217, 217, 217,
-    "gray86", 219, 219, 219,
-    "gray87", 222, 222, 222,
-    "gray88", 224, 224, 224,
-    "gray89", 227, 227, 227,
-    "gray9", 23, 23, 23,
-    "gray90", 229, 229, 229,
-    "gray91", 232, 232, 232,
-    "gray92", 235, 235, 235,
-    "gray93", 237, 237, 237,
-    "gray94", 240, 240, 240,
-    "gray95", 242, 242, 242,
-    "gray96", 245, 245, 245,
-    "gray97", 247, 247, 247,
-    "gray98", 250, 250, 250,
-    "gray99", 252, 252, 252,
-    "green", 0, 255, 0,
-    "green yellow", 173, 255, 47,
-    "green1", 0, 255, 0,
-    "green2", 0, 238, 0,
-    "green3", 0, 205, 0,
-    "green4", 0, 139, 0,
-    "GreenYellow", 173, 255, 47,
-    "grey", 190, 190, 190,
-    "grey0", 0, 0, 0,
-    "grey1", 3, 3, 3,
-    "grey10", 26, 26, 26,
-    "grey100", 255, 255, 255,
-    "grey11", 28, 28, 28,
-    "grey12", 31, 31, 31,
-    "grey13", 33, 33, 33,
-    "grey14", 36, 36, 36,
-    "grey15", 38, 38, 38,
-    "grey16", 41, 41, 41,
-    "grey17", 43, 43, 43,
-    "grey18", 46, 46, 46,
-    "grey19", 48, 48, 48,
-    "grey2", 5, 5, 5,
-    "grey20", 51, 51, 51,
-    "grey21", 54, 54, 54,
-    "grey22", 56, 56, 56,
-    "grey23", 59, 59, 59,
-    "grey24", 61, 61, 61,
-    "grey25", 64, 64, 64,
-    "grey26", 66, 66, 66,
-    "grey27", 69, 69, 69,
-    "grey28", 71, 71, 71,
-    "grey29", 74, 74, 74,
-    "grey3", 8, 8, 8,
-    "grey30", 77, 77, 77,
-    "grey31", 79, 79, 79,
-    "grey32", 82, 82, 82,
-    "grey33", 84, 84, 84,
-    "grey34", 87, 87, 87,
-    "grey35", 89, 89, 89,
-    "grey36", 92, 92, 92,
-    "grey37", 94, 94, 94,
-    "grey38", 97, 97, 97,
-    "grey39", 99, 99, 99,
-    "grey4", 10, 10, 10,
-    "grey40", 102, 102, 102,
-    "grey41", 105, 105, 105,
-    "grey42", 107, 107, 107,
-    "grey43", 110, 110, 110,
-    "grey44", 112, 112, 112,
-    "grey45", 115, 115, 115,
-    "grey46", 117, 117, 117,
-    "grey47", 120, 120, 120,
-    "grey48", 122, 122, 122,
-    "grey49", 125, 125, 125,
-    "grey5", 13, 13, 13,
-    "grey50", 127, 127, 127,
-    "grey51", 130, 130, 130,
-    "grey52", 133, 133, 133,
-    "grey53", 135, 135, 135,
-    "grey54", 138, 138, 138,
-    "grey55", 140, 140, 140,
-    "grey56", 143, 143, 143,
-    "grey57", 145, 145, 145,
-    "grey58", 148, 148, 148,
-    "grey59", 150, 150, 150,
-    "grey6", 15, 15, 15,
-    "grey60", 153, 153, 153,
-    "grey61", 156, 156, 156,
-    "grey62", 158, 158, 158,
-    "grey63", 161, 161, 161,
-    "grey64", 163, 163, 163,
-    "grey65", 166, 166, 166,
-    "grey66", 168, 168, 168,
-    "grey67", 171, 171, 171,
-    "grey68", 173, 173, 173,
-    "grey69", 176, 176, 176,
-    "grey7", 18, 18, 18,
-    "grey70", 179, 179, 179,
-    "grey71", 181, 181, 181,
-    "grey72", 184, 184, 184,
-    "grey73", 186, 186, 186,
-    "grey74", 189, 189, 189,
-    "grey75", 191, 191, 191,
-    "grey76", 194, 194, 194,
-    "grey77", 196, 196, 196,
-    "grey78", 199, 199, 199,
-    "grey79", 201, 201, 201,
-    "grey8", 20, 20, 20,
-    "grey80", 204, 204, 204,
-    "grey81", 207, 207, 207,
-    "grey82", 209, 209, 209,
-    "grey83", 212, 212, 212,
-    "grey84", 214, 214, 214,
-    "grey85", 217, 217, 217,
-    "grey86", 219, 219, 219,
-    "grey87", 222, 222, 222,
-    "grey88", 224, 224, 224,
-    "grey89", 227, 227, 227,
-    "grey9", 23, 23, 23,
-    "grey90", 229, 229, 229,
-    "grey91", 232, 232, 232,
-    "grey92", 235, 235, 235,
-    "grey93", 237, 237, 237,
-    "grey94", 240, 240, 240,
-    "grey95", 242, 242, 242,
-    "grey96", 245, 245, 245,
-    "grey97", 247, 247, 247,
-    "grey98", 250, 250, 250,
-    "grey99", 252, 252, 252,
-    "honeydew", 240, 255, 240,
-    "honeydew1", 240, 255, 240,
-    "honeydew2", 224, 238, 224,
-    "honeydew3", 193, 205, 193,
-    "honeydew4", 131, 139, 131,
-    "hot pink", 255, 105, 180,
-    "HotPink", 255, 105, 180,
-    "HotPink1", 255, 110, 180,
-    "HotPink2", 238, 106, 167,
-    "HotPink3", 205, 96, 144,
-    "HotPink4", 139, 58, 98,
-    "indian red", 205, 92, 92,
-    "IndianRed", 205, 92, 92,
-    "IndianRed1", 255, 106, 106,
-    "IndianRed2", 238, 99, 99,
-    "IndianRed3", 205, 85, 85,
-    "IndianRed4", 139, 58, 58,
-    "ivory", 255, 255, 240,
-    "ivory1", 255, 255, 240,
-    "ivory2", 238, 238, 224,
-    "ivory3", 205, 205, 193,
-    "ivory4", 139, 139, 131,
-    "khaki", 240, 230, 140,
-    "khaki1", 255, 246, 143,
-    "khaki2", 238, 230, 133,
-    "khaki3", 205, 198, 115,
-    "khaki4", 139, 134, 78,
-    "lavender", 230, 230, 250,
-    "lavender blush", 255, 240, 245,
-    "LavenderBlush", 255, 240, 245,
-    "LavenderBlush1", 255, 240, 245,
-    "LavenderBlush2", 238, 224, 229,
-    "LavenderBlush3", 205, 193, 197,
-    "LavenderBlush4", 139, 131, 134,
-    "lawn green", 124, 252, 0,
-    "LawnGreen", 124, 252, 0,
-    "lemon chiffon", 255, 250, 205,
-    "LemonChiffon", 255, 250, 205,
-    "LemonChiffon1", 255, 250, 205,
-    "LemonChiffon2", 238, 233, 191,
-    "LemonChiffon3", 205, 201, 165,
-    "LemonChiffon4", 139, 137, 112,
-    "light blue", 173, 216, 230,
-    "light coral", 240, 128, 128,
-    "light cyan", 224, 255, 255,
-    "light goldenrod", 238, 221, 130,
-    "light goldenrod yellow", 250, 250, 210,
-    "light gray", 211, 211, 211,
-    "light grey", 211, 211, 211,
-    "light pink", 255, 182, 193,
-    "light salmon", 255, 160, 122,
-    "light sea green", 32, 178, 170,
-    "light sky blue", 135, 206, 250,
-    "light slate blue", 132, 112, 255,
-    "light slate gray", 119, 136, 153,
-    "light slate grey", 119, 136, 153,
-    "light steel blue", 176, 196, 222,
-    "light yellow", 255, 255, 224,
-    "LightBlue", 173, 216, 230,
-    "LightBlue1", 191, 239, 255,
-    "LightBlue2", 178, 223, 238,
-    "LightBlue3", 154, 192, 205,
-    "LightBlue4", 104, 131, 139,
-    "LightCoral", 240, 128, 128,
-    "LightCyan", 224, 255, 255,
-    "LightCyan1", 224, 255, 255,
-    "LightCyan2", 209, 238, 238,
-    "LightCyan3", 180, 205, 205,
-    "LightCyan4", 122, 139, 139,
-    "LightGoldenrod", 238, 221, 130,
-    "LightGoldenrod1", 255, 236, 139,
-    "LightGoldenrod2", 238, 220, 130,
-    "LightGoldenrod3", 205, 190, 112,
-    "LightGoldenrod4", 139, 129, 76,
-    "LightGoldenrodYellow", 250, 250, 210,
-    "LightGray", 211, 211, 211,
-    "LightGrey", 211, 211, 211,
-    "LightPink", 255, 182, 193,
-    "LightPink1", 255, 174, 185,
-    "LightPink2", 238, 162, 173,
-    "LightPink3", 205, 140, 149,
-    "LightPink4", 139, 95, 101,
-    "LightSalmon", 255, 160, 122,
-    "LightSalmon1", 255, 160, 122,
-    "LightSalmon2", 238, 149, 114,
-    "LightSalmon3", 205, 129, 98,
-    "LightSalmon4", 139, 87, 66,
-    "LightSeaGreen", 32, 178, 170,
-    "LightSkyBlue", 135, 206, 250,
-    "LightSkyBlue1", 176, 226, 255,
-    "LightSkyBlue2", 164, 211, 238,
-    "LightSkyBlue3", 141, 182, 205,
-    "LightSkyBlue4", 96, 123, 139,
-    "LightSlateBlue", 132, 112, 255,
-    "LightSlateGray", 119, 136, 153,
-    "LightSlateGrey", 119, 136, 153,
-    "LightSteelBlue", 176, 196, 222,
-    "LightSteelBlue1", 202, 225, 255,
-    "LightSteelBlue2", 188, 210, 238,
-    "LightSteelBlue3", 162, 181, 205,
-    "LightSteelBlue4", 110, 123, 139,
-    "LightYellow", 255, 255, 224,
-    "LightYellow1", 255, 255, 224,
-    "LightYellow2", 238, 238, 209,
-    "LightYellow3", 205, 205, 180,
-    "LightYellow4", 139, 139, 122,
-    "lime green", 50, 205, 50,
-    "LimeGreen", 50, 205, 50,
-    "linen", 250, 240, 230,
-    "magenta", 255, 0, 255,
-    "magenta1", 255, 0, 255,
-    "magenta2", 238, 0, 238,
-    "magenta3", 205, 0, 205,
-    "magenta4", 139, 0, 139,
-    "maroon", 176, 48, 96,
-    "maroon1", 255, 52, 179,
-    "maroon2", 238, 48, 167,
-    "maroon3", 205, 41, 144,
-    "maroon4", 139, 28, 98,
-    "medium aquamarine", 102, 205, 170,
-    "medium blue", 0, 0, 205,
-    "medium orchid", 186, 85, 211,
-    "medium purple", 147, 112, 219,
-    "medium sea green", 60, 179, 113,
-    "medium slate blue", 123, 104, 238,
-    "medium spring green", 0, 250, 154,
-    "medium turquoise", 72, 209, 204,
-    "medium violet red", 199, 21, 133,
-    "MediumAquamarine", 102, 205, 170,
-    "MediumBlue", 0, 0, 205,
-    "MediumOrchid", 186, 85, 211,
-    "MediumOrchid1", 224, 102, 255,
-    "MediumOrchid2", 209, 95, 238,
-    "MediumOrchid3", 180, 82, 205,
-    "MediumOrchid4", 122, 55, 139,
-    "MediumPurple", 147, 112, 219,
-    "MediumPurple1", 171, 130, 255,
-    "MediumPurple2", 159, 121, 238,
-    "MediumPurple3", 137, 104, 205,
-    "MediumPurple4", 93, 71, 139,
-    "MediumSeaGreen", 60, 179, 113,
-    "MediumSlateBlue", 123, 104, 238,
-    "MediumSpringGreen", 0, 250, 154,
-    "MediumTurquoise", 72, 209, 204,
-    "MediumVioletRed", 199, 21, 133,
-    "midnight blue", 25, 25, 112,
-    "MidnightBlue", 25, 25, 112,
-    "mint cream", 245, 255, 250,
-    "MintCream", 245, 255, 250,
-    "misty rose", 255, 228, 225,
-    "MistyRose", 255, 228, 225,
-    "MistyRose1", 255, 228, 225,
-    "MistyRose2", 238, 213, 210,
-    "MistyRose3", 205, 183, 181,
-    "MistyRose4", 139, 125, 123,
-    "moccasin", 255, 228, 181,
-    "navajo white", 255, 222, 173,
-    "NavajoWhite", 255, 222, 173,
-    "NavajoWhite1", 255, 222, 173,
-    "NavajoWhite2", 238, 207, 161,
-    "NavajoWhite3", 205, 179, 139,
-    "NavajoWhite4", 139, 121, 94,
-    "navy", 0, 0, 128,
-    "navy blue", 0, 0, 128,
-    "NavyBlue", 0, 0, 128,
-    "old lace", 253, 245, 230,
-    "OldLace", 253, 245, 230,
-    "olive drab", 107, 142, 35,
-    "OliveDrab", 107, 142, 35,
-    "OliveDrab1", 192, 255, 62,
-    "OliveDrab2", 179, 238, 58,
-    "OliveDrab3", 154, 205, 50,
-    "OliveDrab4", 105, 139, 34,
-    "orange", 255, 165, 0,
-    "orange red", 255, 69, 0,
-    "orange1", 255, 165, 0,
-    "orange2", 238, 154, 0,
-    "orange3", 205, 133, 0,
-    "orange4", 139, 90, 0,
-    "OrangeRed", 255, 69, 0,
-    "OrangeRed1", 255, 69, 0,
-    "OrangeRed2", 238, 64, 0,
-    "OrangeRed3", 205, 55, 0,
-    "OrangeRed4", 139, 37, 0,
-    "orchid", 218, 112, 214,
-    "orchid1", 255, 131, 250,
-    "orchid2", 238, 122, 233,
-    "orchid3", 205, 105, 201,
-    "orchid4", 139, 71, 137,
-    "pale goldenrod", 238, 232, 170,
-    "pale green", 152, 251, 152,
-    "pale turquoise", 175, 238, 238,
-    "pale violet red", 219, 112, 147,
-    "PaleGoldenrod", 238, 232, 170,
-    "PaleGreen", 152, 251, 152,
-    "PaleGreen1", 154, 255, 154,
-    "PaleGreen2", 144, 238, 144,
-    "PaleGreen3", 124, 205, 124,
-    "PaleGreen4", 84, 139, 84,
-    "PaleTurquoise", 175, 238, 238,
-    "PaleTurquoise1", 187, 255, 255,
-    "PaleTurquoise2", 174, 238, 238,
-    "PaleTurquoise3", 150, 205, 205,
-    "PaleTurquoise4", 102, 139, 139,
-    "PaleVioletRed", 219, 112, 147,
-    "PaleVioletRed1", 255, 130, 171,
-    "PaleVioletRed2", 238, 121, 159,
-    "PaleVioletRed3", 205, 104, 137,
-    "PaleVioletRed4", 139, 71, 93,
-    "papaya whip", 255, 239, 213,
-    "PapayaWhip", 255, 239, 213,
-    "peach puff", 255, 218, 185,
-    "PeachPuff", 255, 218, 185,
-    "PeachPuff1", 255, 218, 185,
-    "PeachPuff2", 238, 203, 173,
-    "PeachPuff3", 205, 175, 149,
-    "PeachPuff4", 139, 119, 101,
-    "peru", 205, 133, 63,
-    "pink", 255, 192, 203,
-    "pink1", 255, 181, 197,
-    "pink2", 238, 169, 184,
-    "pink3", 205, 145, 158,
-    "pink4", 139, 99, 108,
-    "plum", 221, 160, 221,
-    "plum1", 255, 187, 255,
-    "plum2", 238, 174, 238,
-    "plum3", 205, 150, 205,
-    "plum4", 139, 102, 139,
-    "powder blue", 176, 224, 230,
-    "PowderBlue", 176, 224, 230,
-    "purple", 160, 32, 240,
-    "purple1", 155, 48, 255,
-    "purple2", 145, 44, 238,
-    "purple3", 125, 38, 205,
-    "purple4", 85, 26, 139,
-    "red", 255, 0, 0,
-    "red1", 255, 0, 0,
-    "red2", 238, 0, 0,
-    "red3", 205, 0, 0,
-    "red4", 139, 0, 0,
-    "rosy brown", 188, 143, 143,
-    "RosyBrown", 188, 143, 143,
-    "RosyBrown1", 255, 193, 193,
-    "RosyBrown2", 238, 180, 180,
-    "RosyBrown3", 205, 155, 155,
-    "RosyBrown4", 139, 105, 105,
-    "royal blue", 65, 105, 225,
-    "RoyalBlue", 65, 105, 225,
-    "RoyalBlue1", 72, 118, 255,
-    "RoyalBlue2", 67, 110, 238,
-    "RoyalBlue3", 58, 95, 205,
-    "RoyalBlue4", 39, 64, 139,
-    "saddle brown", 139, 69, 19,
-    "SaddleBrown", 139, 69, 19,
-    "salmon", 250, 128, 114,
-    "salmon1", 255, 140, 105,
-    "salmon2", 238, 130, 98,
-    "salmon3", 205, 112, 84,
-    "salmon4", 139, 76, 57,
-    "sandy brown", 244, 164, 96,
-    "SandyBrown", 244, 164, 96,
-    "sea green", 46, 139, 87,
-    "SeaGreen", 46, 139, 87,
-    "SeaGreen1", 84, 255, 159,
-    "SeaGreen2", 78, 238, 148,
-    "SeaGreen3", 67, 205, 128,
-    "SeaGreen4", 46, 139, 87,
-    "seashell", 255, 245, 238,
-    "seashell1", 255, 245, 238,
-    "seashell2", 238, 229, 222,
-    "seashell3", 205, 197, 191,
-    "seashell4", 139, 134, 130,
-    "sienna", 160, 82, 45,
-    "sienna1", 255, 130, 71,
-    "sienna2", 238, 121, 66,
-    "sienna3", 205, 104, 57,
-    "sienna4", 139, 71, 38,
-    "sky blue", 135, 206, 235,
-    "SkyBlue", 135, 206, 235,
-    "SkyBlue1", 135, 206, 255,
-    "SkyBlue2", 126, 192, 238,
-    "SkyBlue3", 108, 166, 205,
-    "SkyBlue4", 74, 112, 139,
-    "slate blue", 106, 90, 205,
-    "slate gray", 112, 128, 144,
-    "slate grey", 112, 128, 144,
-    "SlateBlue", 106, 90, 205,
-    "SlateBlue1", 131, 111, 255,
-    "SlateBlue2", 122, 103, 238,
-    "SlateBlue3", 105, 89, 205,
-    "SlateBlue4", 71, 60, 139,
-    "SlateGray", 112, 128, 144,
-    "SlateGray1", 198, 226, 255,
-    "SlateGray2", 185, 211, 238,
-    "SlateGray3", 159, 182, 205,
-    "SlateGray4", 108, 123, 139,
-    "SlateGrey", 112, 128, 144,
-    "snow", 255, 250, 250,
-    "snow1", 255, 250, 250,
-    "snow2", 238, 233, 233,
-    "snow3", 205, 201, 201,
-    "snow4", 139, 137, 137,
-    "spring green", 0, 255, 127,
-    "SpringGreen", 0, 255, 127,
-    "SpringGreen1", 0, 255, 127,
-    "SpringGreen2", 0, 238, 118,
-    "SpringGreen3", 0, 205, 102,
-    "SpringGreen4", 0, 139, 69,
-    "steel blue", 70, 130, 180,
-    "SteelBlue", 70, 130, 180,
-    "SteelBlue1", 99, 184, 255,
-    "SteelBlue2", 92, 172, 238,
-    "SteelBlue3", 79, 148, 205,
-    "SteelBlue4", 54, 100, 139,
-    "tan", 210, 180, 140,
-    "tan1", 255, 165, 79,
-    "tan2", 238, 154, 73,
-    "tan3", 205, 133, 63,
-    "tan4", 139, 90, 43,
-    "thistle", 216, 191, 216,
-    "thistle1", 255, 225, 255,
-    "thistle2", 238, 210, 238,
-    "thistle3", 205, 181, 205,
-    "thistle4", 139, 123, 139,
-    "tomato", 255, 99, 71,
-    "tomato1", 255, 99, 71,
-    "tomato2", 238, 92, 66,
-    "tomato3", 205, 79, 57,
-    "tomato4", 139, 54, 38,
-    "turquoise", 64, 224, 208,
-    "turquoise1", 0, 245, 255,
-    "turquoise2", 0, 229, 238,
-    "turquoise3", 0, 197, 205,
-    "turquoise4", 0, 134, 139,
-    "violet", 238, 130, 238,
-    "violet red", 208, 32, 144,
-    "VioletRed", 208, 32, 144,
-    "VioletRed1", 255, 62, 150,
-    "VioletRed2", 238, 58, 140,
-    "VioletRed3", 205, 50, 120,
-    "VioletRed4", 139, 34, 82,
-    "wheat", 245, 222, 179,
-    "wheat1", 255, 231, 186,
-    "wheat2", 238, 216, 174,
-    "wheat3", 205, 186, 150,
-    "wheat4", 139, 126, 102,
-    "white", 255, 255, 255,
-    "white smoke", 245, 245, 245,
-    "WhiteSmoke", 245, 245, 245,
-    "yellow", 255, 255, 0,
-    "yellow green", 154, 205, 50,
-    "yellow1", 255, 255, 0,
-    "yellow2", 238, 238, 0,
-    "yellow3", 205, 205, 0,
-    "yellow4", 139, 139, 0,
-    "YellowGreen", 154, 205, 50,
-    NULL, 0, 0, 0
-};
-
-
-/*
- * This value will be set to the number of colors in the color table
- * the first time it is needed.
- */
-
-static int numXColors = 0;
-
-/*
- * Forward declarations for functions used only in this file.
- */
-
-static int     FindColor(const char *name, XColor *colorPtr);
-
-int strcasecmp(const char *a, const char *b)
-{
-       int i=0,c;
-       if((a==NULL)||(b==NULL)) return -1;
-       
-       while(((!(c=toupper(a[i])-toupper(b[i])))&&a[i]&&b[i])) i++;
-       return c;
-}
-/*
- *----------------------------------------------------------------------
- *
- * FindColor --
- *
- *     This routine finds the color entry that corresponds to the
- *     specified color.
- *
- * Results:
- *     Returns non-zero on success.  The RGB values of the XColor
- *     will be initialized to the proper values on success.
- *
- * Side effects:
- *     None.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-FindColor(name, colorPtr)
-    const char *name;
-    XColor *colorPtr;
-{
-    int l, u, r, i;
-
-    /*
-     * Count the number of elements in the color array if we haven't
-     * done so yet.
-     */
-
-    if (numXColors == 0) {
-       XColorEntry *ePtr;
-       for (ePtr = xColors; ePtr->name != NULL; ePtr++) {
-           numXColors++;
-       }
-    }
-
-    /*
-     * Perform a binary search on the sorted array of colors.
-     */
-
-    l = 0;
-    u = numXColors - 1;
-    while (l <= u) {
-       i = (l + u) / 2;
-       r = strcasecmp(name, xColors[i].name);
-       if (r == 0) {
-           break;
-       } else if (r < 0) {
-           u = i-1;
-       } else {
-           l = i+1;
-       }
-    }
-    if (l > u) {
-       return 0;
-    }
-    colorPtr->red = xColors[i].red << 8;
-    colorPtr->green = xColors[i].green << 8;
-    colorPtr->blue = xColors[i].blue << 8;
-    return 1;
-}
-\f
-/*
- *----------------------------------------------------------------------
- *
- * XParseColor --
- *
- *     Partial implementation of X color name parsing interface.
- *
- * Results:
- *     Returns non-zero on success.
- *
- * Side effects:
- *     None.
- *
- *----------------------------------------------------------------------
- */
-
-StatusDef
-XParseColor(display, map, spec, colorPtr)
-    Display *display;
-    Colormap map;
-    const char* spec;
-    XColor *colorPtr;
-{
-    if (spec[0] == '#') {
-       char fmt[16];
-       int i, red, green, blue;
-       
-       if ((i = strlen(spec+1))%3) {
-           return 0;
-       }
-       i /= 3;
-
-       sprintf(fmt, "%%%dx%%%dx%%%dx", i, i, i);
-       if (sscanf(spec+1, fmt, &red, &green, &blue) != 3) {
-           return 0;
-       }
-       colorPtr->red = ((unsigned short) red) << (4 * (4 - i));
-       colorPtr->green = ((unsigned short) green) << (4 * (4 - i));
-       colorPtr->blue = ((unsigned short) blue) << (4 * (4 - i));
-    } else {
-       if (!FindColor(spec, colorPtr)) {
-           return 0;
-       }
-    }
-    colorPtr->pixel = ((colorPtr->red)>>8)&0xff;
-    colorPtr->flags = DoRed|DoGreen|DoBlue;
-    colorPtr->pad = 0;
-    return 1;
-}
-/** xpm support */
-int
-XFreeColors(display, cmap, pixels, npixels, planes)
-Display *display;
-Colormap cmap;
-unsigned long pixels[];
-int npixels;
-unsigned long planes;
-{
-       return 0;
-}
-
-int
-XGrabServer(display)
-        Display *display;
-{
-       return 0;
-}
-
-int
-XUngrabServer(display)
-        Display *display;
-{
-       return 0;
-}
-
-
-#endif
diff --git a/W11/wrap/Makefile b/W11/wrap/Makefile
deleted file mode 100644 (file)
index f79d22e..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-
-CFLAGS=-O
-
-first_rule: all
-
-all allbin: ../lib/libX11.a
-
-alldoc tags:
-
-../lib/libX11.a: wrap.o rxvt_res.o
-       ar r ../lib/libX11.a wrap.o rxvt_res.o
-
-wrap.o: wrap.c xwrappers.gen
-       gcc ${CFLAGS} -c wrap.c -I.. -mwin32
-
-rxvt_res.o: rxvt.rc
-       windres -i rxvt.rc -o rxvt_res.o
-
-xwrappers.gen: ../X11/Xlib.h
-       perl mkproxy.pl ../X11/Xlib.h > xwrappers.gen
-
-clean:
-       -rm wrap.o rxvt_res.o ../lib/libX11.a 
diff --git a/W11/wrap/mkproxy.pl b/W11/wrap/mkproxy.pl
deleted file mode 100644 (file)
index a7d6810..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#! perl
-
-$file = join("",<>);
-$file=~s/[^\000]+\/\* functions \*\///;
-$file=~s/#endif\s+$//;
-foreach my $def (split(/\s*;\s*/,$file))
-{
-       $def =~ s/\s+/ /g;
-       my $paren = ($def=~s/\(([^\(\)]*)\)\s*//)?$1:'';
-       my $type = ($def=~s/^([^\000]*\s+\*?)//)?$1:'';
-       $type=~s/^\s+//; 
-       $type=~s/\s+$//;  
-       push(@list,{def=>$def,type=>$type,paren=>$paren}); 
-}
-foreach my $s (sort {$a->{def} cmp $b->{def}} @list) 
-{
-       my $def = $s->{def};
-       my $type = $s->{type};
-       my $paren=$s->{paren};
-       my $params = $paren;
-       $params=~s/[\[\]\*]//g;
-       $params=~s/\s+,/,/g;
-       $params=~s/[^,\s]+\s+//g;
-       next if ($params =~ /\.\.\./);
-       next if ($def eq 'XOpenDisplay');
-       my $return = $type eq 'void' ? '':'return ';
-       print "
-typedef $type (proto_$def)($paren);
-static proto_$def *func_$def = NULL;
-$type $def($paren) {
-       if (!func_$def) func_$def=(proto_$def *)_loadfunc(\"$def\");
-       $return(func_$def)($params);
-}
-";
-
-}
diff --git a/W11/wrap/rxtv.ico b/W11/wrap/rxtv.ico
deleted file mode 100644 (file)
index 110e25b..0000000
Binary files a/W11/wrap/rxtv.ico and /dev/null differ
diff --git a/W11/wrap/rxvt.ico b/W11/wrap/rxvt.ico
deleted file mode 100644 (file)
index a049316..0000000
Binary files a/W11/wrap/rxvt.ico and /dev/null differ
diff --git a/W11/wrap/rxvt.rc b/W11/wrap/rxvt.rc
deleted file mode 100644 (file)
index cf1030b..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#include "wrap.h"
-
-IDI_RXVT ICON    DISCARDABLE PRELOAD     "rxvt.ico"
-
-
-1 VERSIONINFO 
-FILEVERSION 2, 7, 10, 2
-PRODUCTVERSION 2, 7, 10, 2
-FILESUBTYPE 0
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
-  BLOCK "04090000"
-  BEGIN
-   VALUE "FileDescription", "rxvt\000"
-   VALUE "FileVersion", "2.7.10-2\000"
-   VALUE "InternalName", "rxvt\000"
-   VALUE "OriginalFilename", "rxvt.exe\000"
-   VALUE "ProductName","rxvt\000"
-   VALUE "ProductVersion","2.7.10-2\000"
-  END
- END
-END
diff --git a/W11/wrap/wrap.c b/W11/wrap/wrap.c
deleted file mode 100644 (file)
index df78674..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
-
-#include <X11/Xlib.h>
-#include <windows.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <malloc.h>
-#include "wrap.h"
-
-void __cdecl WinMainCRTStartup(void) { mainCRTStartup(); }
-
-static void *_lib=NULL;
-static char *_libname = NULL;
-
-static void *_loadfunc(char *name)
-{
-       void *f = NULL;
-       if (_lib==NULL) {
-               if (_libname==NULL) {
-                       fprintf(stderr,"%s called before XOpenDisplay!\n",name);
-                       exit(3);
-               }
-               _lib = LoadLibrary(_libname);
-               if (_lib == NULL) {
-                       fprintf(stderr,"failed to load %s.dll\n",_libname);
-                       exit(1);
-               }
-       }
-       f = GetProcAddress(_lib,name);
-       if (f==NULL) {
-               fprintf(stderr,"failed to find %s\n",name);
-               exit(2);
-       }       
-       return f;
-}
-
-static void _freelib()
-{
-       FreeLibrary(_lib);
-       _lib=NULL;
-}
-typedef LONG (proto_WndProc)(HWND hWnd,UINT message,UINT wParam,LONG lParam);
-static proto_WndProc *func_WndProc = NULL;
-LONG __stdcall WndProc(HWND hWnd,UINT message,UINT wParam,LONG lParam)
-{
-       if (!func_WndProc) func_WndProc=(proto_WndProc *)_loadfunc("NT_handleMsg");
-       return (func_WndProc)(hWnd,message,wParam,lParam);
-}
-
-static void
-hideConsole()
-{
-       HWND conwin;
-       HANDLE hConsole;
-       CONSOLE_SCREEN_BUFFER_INFO buffInfo;
-       SECURITY_ATTRIBUTES  sa;
-
-       char app_name[40];
-       sprintf(app_name, "rxvt%08x", (unsigned int)GetCurrentThreadId());
-       /* from eConsole source */
-       sa.nLength = sizeof(sa);
-       sa.bInheritHandle = TRUE;
-       sa.lpSecurityDescriptor = NULL; 
-       hConsole = CreateFile( "CONOUT$", GENERIC_WRITE | GENERIC_READ,
-                                                  FILE_SHARE_READ | FILE_SHARE_WRITE, &sa,     
-                                                  OPEN_EXISTING, 0, 0 );
-       if (GetConsoleScreenBufferInfo(hConsole,&buffInfo) &&
-               buffInfo.dwCursorPosition.X==0 &&
-               buffInfo.dwCursorPosition.Y==0)
-       {
-               /* find the console window, from eConsole source */
-               SetConsoleTitle( app_name );
-               while ((conwin = FindWindow( NULL, app_name))==NULL)
-                       Sleep( 40 );
-               ShowWindowAsync(conwin, SW_HIDE);
-       }
-}
-
-
-ATOM
-_register_window_class()
-{
-       WNDCLASS  wc;
-       HANDLE    curInstance = GetModuleHandleA(NULL);
-       char app_name[40];
-       sprintf(app_name, "rxvt%08x", (unsigned int)GetCurrentThreadId());      
-       hideConsole();
-       wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; /* CS_OWNDC */
-       wc.lpfnWndProc = WndProc;
-       wc.cbClsExtra = 0;
-       wc.cbWndExtra = 0;
-       wc.hInstance = curInstance;
-       wc.hIcon = LoadIcon(curInstance, MAKEINTRESOURCE( IDI_RXVT ));
-       wc.hCursor =  LoadCursor(NULL, IDC_ARROW);
-       wc.hbrBackground = NULL;
-       wc.lpszMenuName =  NULL;
-       wc.lpszClassName = app_name;
-       return RegisterClass(&wc);
-}
-
-typedef void (proto_NT_SetAtom)(ATOM class);
-static proto_NT_SetAtom *func_NT_SetAtom = NULL;
-void _set_atom(ATOM class)
-{
-       if (!func_NT_SetAtom) func_NT_SetAtom=(proto_NT_SetAtom *)_loadfunc("NT_SetAtom");
-       (func_NT_SetAtom)(class);
-}
-
-typedef void (proto_W11AddEventHandler)(Display *d, proto_W11EventHandler *ev);
-static proto_W11AddEventHandler *func_W11AddEventHandler = NULL;
-void W11AddEventHandler(Display *d, proto_W11EventHandler *ev)
-{
-       if (func_W11AddEventHandler) 
-           (func_W11AddEventHandler)(d,ev);
-}
-
-typedef Display * (proto_XOpenDisplay)(const char *name);
-static proto_XOpenDisplay *func_XOpenDisplay = NULL;
-Display * XOpenDisplay(const char *name) {
-    ATOM class;
-    char *env_var=NULL;
-    if (_libname==NULL)
-    {
-       env_var = getenv("W11_LIBRARY");
-       if (env_var!=NULL) _libname = strdup(env_var);
-       else if (name==NULL || !strcmp(name,":0")) {
-           _libname="libW11";
-           class = _register_window_class();
-           _set_atom(class);
-           func_W11AddEventHandler=(proto_W11AddEventHandler *)_loadfunc("W11AddEventHandler");
-       }       
-       else _libname="libX11";
-    }
-    if (!func_XOpenDisplay) func_XOpenDisplay=(proto_XOpenDisplay *)_loadfunc("XOpenDisplay");
-    return (func_XOpenDisplay)(name);
-}
-
-typedef struct {
-    char    *name;
-    XPointer value;
-} XIMArg;
-
-static void
-_XIMVaToList(va_list var, XIMArg *args)
-{
-    char   *attr;
-       int i = 0;
-    if (!args) return;
-    for (attr = va_arg(var, char*); attr && i<11; attr = va_arg(var, char*)) {
-           args->name = attr;
-           args->value = va_arg(var, XPointer);
-           args++;
-               i++;
-    }
-       for(;i<11;i++) {
-               args->name=NULL;
-               args->value=NULL;
-               args++;
-       }
-}
-
-typedef XIC (proto_XCreateIC)(XIM im, ...);
-static proto_XCreateIC *func_XCreateIC = NULL;
-XIC
-XCreateIC(XIM im, ...)
-{
-    va_list var;
-    XIMArg a[11];
-
-    va_start(var, im);
-    _XIMVaToList(var, a);
-    va_end(var);
-       
-       if (a[10].name!=NULL) {
-               fprintf(stderr,"call to XCreateIC with more than 20 args\n");
-               exit(5);
-       }
-       
-       if (!func_XCreateIC) func_XCreateIC=(proto_XCreateIC *)_loadfunc("XCreateIC");
-       return (func_XCreateIC)(im,
-                                                  a[0].name, a[0].value,
-                                                  a[1].name, a[1].value,
-                                                  a[2].name, a[2].value,
-                                                  a[3].name, a[3].value,
-                                                  a[4].name, a[4].value,
-                                                  a[5].name, a[5].value,
-                                                  a[6].name, a[6].value,
-                                                  a[7].name, a[7].value,
-                                                  a[8].name, a[8].value,
-                                                  a[9].name, a[9].value,
-                                                  NULL);
-}
-
-typedef char * (proto_XGetIMValues)(XIM im, ...);
-static proto_XGetIMValues *func_XGetIMValues = NULL;
-char *
-XGetIMValues(XIM im, ...)
-{
-    va_list var;
-    XIMArg a[11];
-
-    va_start(var, im);
-    _XIMVaToList(var, a);
-    va_end(var);
-       
-       if (a[10].name!=NULL) {
-               fprintf(stderr,"call to XGetIMValues with more than 20 args\n");
-               exit(5);
-       }
-
-       if (!func_XGetIMValues) func_XGetIMValues=(proto_XGetIMValues *)_loadfunc("XGetIMValues");
-       return (func_XGetIMValues)(im,
-                                                  a[0].name, a[0].value,
-                                                  a[1].name, a[1].value,
-                                                  a[2].name, a[2].value,
-                                                  a[3].name, a[3].value,
-                                                  a[4].name, a[4].value,
-                                                  a[5].name, a[5].value,
-                                                  a[6].name, a[6].value,
-                                                  a[7].name, a[7].value,
-                                                  a[8].name, a[8].value,
-                                                  a[9].name, a[9].value,
-                                                  NULL);
-}
-
-
-#include "xwrappers.gen"
diff --git a/W11/wrap/wrap.h b/W11/wrap/wrap.h
deleted file mode 100644 (file)
index b36b585..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#define IDI_RXTV 101
-#define IDI_RXVT 102
diff --git a/W11/wrap/xwrappers.gen b/W11/wrap/xwrappers.gen
deleted file mode 100644 (file)
index 3a46345..0000000
+++ /dev/null
@@ -1,1134 +0,0 @@
-
-typedef StatusDef (proto_XAllocColor)( Display *display, Colormap cmap, XColor *xc);
-static proto_XAllocColor *func_XAllocColor = NULL;
-StatusDef XAllocColor( Display *display, Colormap cmap, XColor *xc) {
-       if (!func_XAllocColor) func_XAllocColor=(proto_XAllocColor *)_loadfunc("XAllocColor");
-       return (func_XAllocColor)( display, cmap, xc);
-}
-
-typedef StatusDef (proto_XAllocColorCells)( Display *display, Colormap cmap, BoolDef cont, unsigned long *pmasks, unsigned int np, unsigned long *pixels, unsigned int nc);
-static proto_XAllocColorCells *func_XAllocColorCells = NULL;
-StatusDef XAllocColorCells( Display *display, Colormap cmap, BoolDef cont, unsigned long *pmasks, unsigned int np, unsigned long *pixels, unsigned int nc) {
-       if (!func_XAllocColorCells) func_XAllocColorCells=(proto_XAllocColorCells *)_loadfunc("XAllocColorCells");
-       return (func_XAllocColorCells)( display, cmap, cont, pmasks, np, pixels, nc);
-}
-
-typedef StatusDef (proto_XAllocColorPlanes)( Display *display, Colormap cmap, BoolDef cont, unsigned long *pixels, int nc, int nr,int ng,int nb, unsigned long *rmask, unsigned long *gmask, unsigned long *bmask);
-static proto_XAllocColorPlanes *func_XAllocColorPlanes = NULL;
-StatusDef XAllocColorPlanes( Display *display, Colormap cmap, BoolDef cont, unsigned long *pixels, int nc, int nr,int ng,int nb, unsigned long *rmask, unsigned long *gmask, unsigned long *bmask) {
-       if (!func_XAllocColorPlanes) func_XAllocColorPlanes=(proto_XAllocColorPlanes *)_loadfunc("XAllocColorPlanes");
-       return (func_XAllocColorPlanes)( display, cmap, cont, pixels, nc, nr,ng,nb, rmask, gmask, bmask);
-}
-
-typedef StatusDef (proto_XAllocNamedColor)(Display *display, Colormap cmap, const char *cname, XColor *cell, XColor *rgb);
-static proto_XAllocNamedColor *func_XAllocNamedColor = NULL;
-StatusDef XAllocNamedColor(Display *display, Colormap cmap, const char *cname, XColor *cell, XColor *rgb) {
-       if (!func_XAllocNamedColor) func_XAllocNamedColor=(proto_XAllocNamedColor *)_loadfunc("XAllocNamedColor");
-       return (func_XAllocNamedColor)(display, cmap, cname, cell, rgb);
-}
-
-typedef int (proto_XBell)( Display *display, int pc);
-static proto_XBell *func_XBell = NULL;
-int XBell( Display *display, int pc) {
-       if (!func_XBell) func_XBell=(proto_XBell *)_loadfunc("XBell");
-       return (func_XBell)( display, pc);
-}
-
-typedef int (proto_XChangeGC)( Display* display, GC gc, unsigned long mask, XGCValues* gc_values);
-static proto_XChangeGC *func_XChangeGC = NULL;
-int XChangeGC( Display* display, GC gc, unsigned long mask, XGCValues* gc_values) {
-       if (!func_XChangeGC) func_XChangeGC=(proto_XChangeGC *)_loadfunc("XChangeGC");
-       return (func_XChangeGC)( display, gc, mask, gc_values);
-}
-
-typedef int (proto_XChangeProperty)( Display *display, Window window, Atom property, Atom type, int format, int mode, const unsigned char *data, int nelements);
-static proto_XChangeProperty *func_XChangeProperty = NULL;
-int XChangeProperty( Display *display, Window window, Atom property, Atom type, int format, int mode, const unsigned char *data, int nelements) {
-       if (!func_XChangeProperty) func_XChangeProperty=(proto_XChangeProperty *)_loadfunc("XChangeProperty");
-       return (func_XChangeProperty)( display, window, property, type, format, mode, data, nelements);
-}
-
-typedef int (proto_XChangeWindowAttributes)( Display *display, Window w, unsigned long vmask, XSetWindowAttributes *attr);
-static proto_XChangeWindowAttributes *func_XChangeWindowAttributes = NULL;
-int XChangeWindowAttributes( Display *display, Window w, unsigned long vmask, XSetWindowAttributes *attr) {
-       if (!func_XChangeWindowAttributes) func_XChangeWindowAttributes=(proto_XChangeWindowAttributes *)_loadfunc("XChangeWindowAttributes");
-       return (func_XChangeWindowAttributes)( display, w, vmask, attr);
-}
-
-typedef BoolDef (proto_XCheckTypedEvent)( Display *display, int ev, XEvent *rep);
-static proto_XCheckTypedEvent *func_XCheckTypedEvent = NULL;
-BoolDef XCheckTypedEvent( Display *display, int ev, XEvent *rep) {
-       if (!func_XCheckTypedEvent) func_XCheckTypedEvent=(proto_XCheckTypedEvent *)_loadfunc("XCheckTypedEvent");
-       return (func_XCheckTypedEvent)( display, ev, rep);
-}
-
-typedef BoolDef (proto_XCheckTypedWindowEvent)( Display* display, Window w, int event_type, XEvent* event_return);
-static proto_XCheckTypedWindowEvent *func_XCheckTypedWindowEvent = NULL;
-BoolDef XCheckTypedWindowEvent( Display* display, Window w, int event_type, XEvent* event_return) {
-       if (!func_XCheckTypedWindowEvent) func_XCheckTypedWindowEvent=(proto_XCheckTypedWindowEvent *)_loadfunc("XCheckTypedWindowEvent");
-       return (func_XCheckTypedWindowEvent)( display, w, event_type, event_return);
-}
-
-typedef BoolDef (proto_XCheckWindowEvent)( Display *display, Window w, long emask, XEvent *ev);
-static proto_XCheckWindowEvent *func_XCheckWindowEvent = NULL;
-BoolDef XCheckWindowEvent( Display *display, Window w, long emask, XEvent *ev) {
-       if (!func_XCheckWindowEvent) func_XCheckWindowEvent=(proto_XCheckWindowEvent *)_loadfunc("XCheckWindowEvent");
-       return (func_XCheckWindowEvent)( display, w, emask, ev);
-}
-
-typedef int (proto_XClearArea)( Display *display, Window w, int x, int y, unsigned int width, unsigned int height, BoolDef exposures);
-static proto_XClearArea *func_XClearArea = NULL;
-int XClearArea( Display *display, Window w, int x, int y, unsigned int width, unsigned int height, BoolDef exposures) {
-       if (!func_XClearArea) func_XClearArea=(proto_XClearArea *)_loadfunc("XClearArea");
-       return (func_XClearArea)( display, w, x, y, width, height, exposures);
-}
-
-typedef int (proto_XClearWindow)(Display *display, Window w);
-static proto_XClearWindow *func_XClearWindow = NULL;
-int XClearWindow(Display *display, Window w) {
-       if (!func_XClearWindow) func_XClearWindow=(proto_XClearWindow *)_loadfunc("XClearWindow");
-       return (func_XClearWindow)(display, w);
-}
-
-typedef int (proto_XClipBox)( Region hrgn, XRectangle *rect);
-static proto_XClipBox *func_XClipBox = NULL;
-int XClipBox( Region hrgn, XRectangle *rect) {
-       if (!func_XClipBox) func_XClipBox=(proto_XClipBox *)_loadfunc("XClipBox");
-       return (func_XClipBox)( hrgn, rect);
-}
-
-typedef int (proto_XCloseDisplay)(Display *display);
-static proto_XCloseDisplay *func_XCloseDisplay = NULL;
-int XCloseDisplay(Display *display) {
-       if (!func_XCloseDisplay) func_XCloseDisplay=(proto_XCloseDisplay *)_loadfunc("XCloseDisplay");
-       return (func_XCloseDisplay)(display);
-}
-
-typedef StatusDef (proto_XCloseIM)(XIM im);
-static proto_XCloseIM *func_XCloseIM = NULL;
-StatusDef XCloseIM(XIM im) {
-       if (!func_XCloseIM) func_XCloseIM=(proto_XCloseIM *)_loadfunc("XCloseIM");
-       return (func_XCloseIM)(im);
-}
-
-typedef int (proto_XConnectionNumber)(Display* display);
-static proto_XConnectionNumber *func_XConnectionNumber = NULL;
-int XConnectionNumber(Display* display) {
-       if (!func_XConnectionNumber) func_XConnectionNumber=(proto_XConnectionNumber *)_loadfunc("XConnectionNumber");
-       return (func_XConnectionNumber)(display);
-}
-
-typedef int (proto_XConvertSelection)( Display *display, Atom sel, Atom target, Atom prop, Window req, Time time);
-static proto_XConvertSelection *func_XConvertSelection = NULL;
-int XConvertSelection( Display *display, Atom sel, Atom target, Atom prop, Window req, Time time) {
-       if (!func_XConvertSelection) func_XConvertSelection=(proto_XConvertSelection *)_loadfunc("XConvertSelection");
-       return (func_XConvertSelection)( display, sel, target, prop, req, time);
-}
-
-typedef int (proto_XCopyArea)( Display *display, Drawable src, Drawable dest, GC gc, int src_x, int src_y, unsigned int width, unsigned int height, int dest_x, int dest_y);
-static proto_XCopyArea *func_XCopyArea = NULL;
-int XCopyArea( Display *display, Drawable src, Drawable dest, GC gc, int src_x, int src_y, unsigned int width, unsigned int height, int dest_x, int dest_y) {
-       if (!func_XCopyArea) func_XCopyArea=(proto_XCopyArea *)_loadfunc("XCopyArea");
-       return (func_XCopyArea)( display, src, dest, gc, src_x, src_y, width, height, dest_x, dest_y);
-}
-
-typedef int (proto_XCopyGC)( Display *display, GC sgc, unsigned long vmask, GC dgc);
-static proto_XCopyGC *func_XCopyGC = NULL;
-int XCopyGC( Display *display, GC sgc, unsigned long vmask, GC dgc) {
-       if (!func_XCopyGC) func_XCopyGC=(proto_XCopyGC *)_loadfunc("XCopyGC");
-       return (func_XCopyGC)( display, sgc, vmask, dgc);
-}
-
-typedef Pixmap (proto_XCreateBitmapFromData)(Display *display, Drawable drawable, const char *data, unsigned int width, unsigned int height);
-static proto_XCreateBitmapFromData *func_XCreateBitmapFromData = NULL;
-Pixmap XCreateBitmapFromData(Display *display, Drawable drawable, const char *data, unsigned int width, unsigned int height) {
-       if (!func_XCreateBitmapFromData) func_XCreateBitmapFromData=(proto_XCreateBitmapFromData *)_loadfunc("XCreateBitmapFromData");
-       return (func_XCreateBitmapFromData)(display, drawable, data, width, height);
-}
-
-typedef Colormap (proto_XCreateColormap)( Display *display, Window w, Visual *visual, int alloc);
-static proto_XCreateColormap *func_XCreateColormap = NULL;
-Colormap XCreateColormap( Display *display, Window w, Visual *visual, int alloc) {
-       if (!func_XCreateColormap) func_XCreateColormap=(proto_XCreateColormap *)_loadfunc("XCreateColormap");
-       return (func_XCreateColormap)( display, w, visual, alloc);
-}
-
-typedef Cursor (proto_XCreateFontCursor)( Display *display, unsigned int shape);
-static proto_XCreateFontCursor *func_XCreateFontCursor = NULL;
-Cursor XCreateFontCursor( Display *display, unsigned int shape) {
-       if (!func_XCreateFontCursor) func_XCreateFontCursor=(proto_XCreateFontCursor *)_loadfunc("XCreateFontCursor");
-       return (func_XCreateFontCursor)( display, shape);
-}
-
-typedef GC (proto_XCreateGC)( Display *display, Drawable window, unsigned long mask, XGCValues *gc_values);
-static proto_XCreateGC *func_XCreateGC = NULL;
-GC XCreateGC( Display *display, Drawable window, unsigned long mask, XGCValues *gc_values) {
-       if (!func_XCreateGC) func_XCreateGC=(proto_XCreateGC *)_loadfunc("XCreateGC");
-       return (func_XCreateGC)( display, window, mask, gc_values);
-}
-
-typedef XImage * (proto_XCreateImage)( Display *display, Visual *visual, unsigned int depth, int format, int offset, char *data, unsigned int width, unsigned int height, int bitmap_pad, int bytes_per_line);
-static proto_XCreateImage *func_XCreateImage = NULL;
-XImage * XCreateImage( Display *display, Visual *visual, unsigned int depth, int format, int offset, char *data, unsigned int width, unsigned int height, int bitmap_pad, int bytes_per_line) {
-       if (!func_XCreateImage) func_XCreateImage=(proto_XCreateImage *)_loadfunc("XCreateImage");
-       return (func_XCreateImage)( display, visual, depth, format, offset, data, width, height, bitmap_pad, bytes_per_line);
-}
-
-typedef Pixmap (proto_XCreatePixmap)( Display *display, Drawable drawable, unsigned int width, unsigned int height, unsigned int depth);
-static proto_XCreatePixmap *func_XCreatePixmap = NULL;
-Pixmap XCreatePixmap( Display *display, Drawable drawable, unsigned int width, unsigned int height, unsigned int depth) {
-       if (!func_XCreatePixmap) func_XCreatePixmap=(proto_XCreatePixmap *)_loadfunc("XCreatePixmap");
-       return (func_XCreatePixmap)( display, drawable, width, height, depth);
-}
-
-typedef Region (proto_XCreateRegion)();
-static proto_XCreateRegion *func_XCreateRegion = NULL;
-Region XCreateRegion() {
-       if (!func_XCreateRegion) func_XCreateRegion=(proto_XCreateRegion *)_loadfunc("XCreateRegion");
-       return (func_XCreateRegion)();
-}
-
-typedef Window (proto_XCreateSimpleWindow)( Display *display, Window parent, int x, int y, unsigned int brd, unsigned int w, unsigned int h, unsigned long bg, unsigned long brd_col);
-static proto_XCreateSimpleWindow *func_XCreateSimpleWindow = NULL;
-Window XCreateSimpleWindow( Display *display, Window parent, int x, int y, unsigned int brd, unsigned int w, unsigned int h, unsigned long bg, unsigned long brd_col) {
-       if (!func_XCreateSimpleWindow) func_XCreateSimpleWindow=(proto_XCreateSimpleWindow *)_loadfunc("XCreateSimpleWindow");
-       return (func_XCreateSimpleWindow)( display, parent, x, y, brd, w, h, bg, brd_col);
-}
-
-typedef Window (proto_XCreateWindow)( Display *display, Window parent, int x, int y, unsigned int width, unsigned int height, unsigned int bw, int depth, unsigned int class, Visual *visual, unsigned long valuemask, XSetWindowAttributes *attr);
-static proto_XCreateWindow *func_XCreateWindow = NULL;
-Window XCreateWindow( Display *display, Window parent, int x, int y, unsigned int width, unsigned int height, unsigned int bw, int depth, unsigned int class, Visual *visual, unsigned long valuemask, XSetWindowAttributes *attr) {
-       if (!func_XCreateWindow) func_XCreateWindow=(proto_XCreateWindow *)_loadfunc("XCreateWindow");
-       return (func_XCreateWindow)( display, parent, x, y, width, height, bw, depth, class, visual, valuemask, attr);
-}
-
-typedef Colormap (proto_XDefaultColormap)( Display *display, int screen);
-static proto_XDefaultColormap *func_XDefaultColormap = NULL;
-Colormap XDefaultColormap( Display *display, int screen) {
-       if (!func_XDefaultColormap) func_XDefaultColormap=(proto_XDefaultColormap *)_loadfunc("XDefaultColormap");
-       return (func_XDefaultColormap)( display, screen);
-}
-
-typedef int (proto_XDefaultDepth)( Display *display, int screen);
-static proto_XDefaultDepth *func_XDefaultDepth = NULL;
-int XDefaultDepth( Display *display, int screen) {
-       if (!func_XDefaultDepth) func_XDefaultDepth=(proto_XDefaultDepth *)_loadfunc("XDefaultDepth");
-       return (func_XDefaultDepth)( display, screen);
-}
-
-typedef int (proto_XDefaultScreen)(Display *display);
-static proto_XDefaultScreen *func_XDefaultScreen = NULL;
-int XDefaultScreen(Display *display) {
-       if (!func_XDefaultScreen) func_XDefaultScreen=(proto_XDefaultScreen *)_loadfunc("XDefaultScreen");
-       return (func_XDefaultScreen)(display);
-}
-
-typedef Visual * (proto_XDefaultVisual)( Display *display, int screen);
-static proto_XDefaultVisual *func_XDefaultVisual = NULL;
-Visual * XDefaultVisual( Display *display, int screen) {
-       if (!func_XDefaultVisual) func_XDefaultVisual=(proto_XDefaultVisual *)_loadfunc("XDefaultVisual");
-       return (func_XDefaultVisual)( display, screen);
-}
-
-typedef int (proto_XDefineCursor)(Display* display,Window w,Cursor cursor);
-static proto_XDefineCursor *func_XDefineCursor = NULL;
-int XDefineCursor(Display* display,Window w,Cursor cursor) {
-       if (!func_XDefineCursor) func_XDefineCursor=(proto_XDefineCursor *)_loadfunc("XDefineCursor");
-       return (func_XDefineCursor)(display,w,cursor);
-}
-
-typedef int (proto_XDestroyRegion)(Region hrgn);
-static proto_XDestroyRegion *func_XDestroyRegion = NULL;
-int XDestroyRegion(Region hrgn) {
-       if (!func_XDestroyRegion) func_XDestroyRegion=(proto_XDestroyRegion *)_loadfunc("XDestroyRegion");
-       return (func_XDestroyRegion)(hrgn);
-}
-
-typedef int (proto_XDestroyWindow)( Display *display, Window w);
-static proto_XDestroyWindow *func_XDestroyWindow = NULL;
-int XDestroyWindow( Display *display, Window w) {
-       if (!func_XDestroyWindow) func_XDestroyWindow=(proto_XDestroyWindow *)_loadfunc("XDestroyWindow");
-       return (func_XDestroyWindow)( display, w);
-}
-
-typedef char * (proto_XDisplayString)(Display *display);
-static proto_XDisplayString *func_XDisplayString = NULL;
-char * XDisplayString(Display *display) {
-       if (!func_XDisplayString) func_XDisplayString=(proto_XDisplayString *)_loadfunc("XDisplayString");
-       return (func_XDisplayString)(display);
-}
-
-typedef int (proto_XDoesBackingStore)(Screen *scr);
-static proto_XDoesBackingStore *func_XDoesBackingStore = NULL;
-int XDoesBackingStore(Screen *scr) {
-       if (!func_XDoesBackingStore) func_XDoesBackingStore=(proto_XDoesBackingStore *)_loadfunc("XDoesBackingStore");
-       return (func_XDoesBackingStore)(scr);
-}
-
-typedef int (proto_XDrawArc)( Display *display, Drawable w, GC gc, int x, int y, unsigned int width,unsigned int height, int a1, int a2);
-static proto_XDrawArc *func_XDrawArc = NULL;
-int XDrawArc( Display *display, Drawable w, GC gc, int x, int y, unsigned int width,unsigned int height, int a1, int a2) {
-       if (!func_XDrawArc) func_XDrawArc=(proto_XDrawArc *)_loadfunc("XDrawArc");
-       return (func_XDrawArc)( display, w, gc, x, y, width,height, a1, a2);
-}
-
-typedef int (proto_XDrawImageString)( Display* display, Drawable d, GC gc, int x, int y, const char* string, int length);
-static proto_XDrawImageString *func_XDrawImageString = NULL;
-int XDrawImageString( Display* display, Drawable d, GC gc, int x, int y, const char* string, int length) {
-       if (!func_XDrawImageString) func_XDrawImageString=(proto_XDrawImageString *)_loadfunc("XDrawImageString");
-       return (func_XDrawImageString)( display, d, gc, x, y, string, length);
-}
-
-typedef int (proto_XDrawImageString16)(Display *display, Drawable window, GC gc, int x, int y, const XChar2b* str, int len);
-static proto_XDrawImageString16 *func_XDrawImageString16 = NULL;
-int XDrawImageString16(Display *display, Drawable window, GC gc, int x, int y, const XChar2b* str, int len) {
-       if (!func_XDrawImageString16) func_XDrawImageString16=(proto_XDrawImageString16 *)_loadfunc("XDrawImageString16");
-       return (func_XDrawImageString16)(display, window, gc, x, y, str, len);
-}
-
-typedef int (proto_XDrawLine)( Display *display, Drawable w, GC gc, int x1,int y1, int x2,int y2);
-static proto_XDrawLine *func_XDrawLine = NULL;
-int XDrawLine( Display *display, Drawable w, GC gc, int x1,int y1, int x2,int y2) {
-       if (!func_XDrawLine) func_XDrawLine=(proto_XDrawLine *)_loadfunc("XDrawLine");
-       return (func_XDrawLine)( display, w, gc, x1,y1, x2,y2);
-}
-
-typedef int (proto_XDrawLines)( Display *display, Drawable w, GC gc, XPoint *points, int nps,int mode);
-static proto_XDrawLines *func_XDrawLines = NULL;
-int XDrawLines( Display *display, Drawable w, GC gc, XPoint *points, int nps,int mode) {
-       if (!func_XDrawLines) func_XDrawLines=(proto_XDrawLines *)_loadfunc("XDrawLines");
-       return (func_XDrawLines)( display, w, gc, points, nps,mode);
-}
-
-typedef int (proto_XDrawPoint)( Display *display, Drawable w, GC gc, int x, int y);
-static proto_XDrawPoint *func_XDrawPoint = NULL;
-int XDrawPoint( Display *display, Drawable w, GC gc, int x, int y) {
-       if (!func_XDrawPoint) func_XDrawPoint=(proto_XDrawPoint *)_loadfunc("XDrawPoint");
-       return (func_XDrawPoint)( display, w, gc, x, y);
-}
-
-typedef int (proto_XDrawPoints)( Display *display, Drawable w, GC gc, XPoint *points, int nps, int mode);
-static proto_XDrawPoints *func_XDrawPoints = NULL;
-int XDrawPoints( Display *display, Drawable w, GC gc, XPoint *points, int nps, int mode) {
-       if (!func_XDrawPoints) func_XDrawPoints=(proto_XDrawPoints *)_loadfunc("XDrawPoints");
-       return (func_XDrawPoints)( display, w, gc, points, nps, mode);
-}
-
-typedef int (proto_XDrawRectangle)( Display *display, Drawable w, GC gc, int x, int y, unsigned int width, unsigned int height);
-static proto_XDrawRectangle *func_XDrawRectangle = NULL;
-int XDrawRectangle( Display *display, Drawable w, GC gc, int x, int y, unsigned int width, unsigned int height) {
-       if (!func_XDrawRectangle) func_XDrawRectangle=(proto_XDrawRectangle *)_loadfunc("XDrawRectangle");
-       return (func_XDrawRectangle)( display, w, gc, x, y, width, height);
-}
-
-typedef int (proto_XDrawSegments)( Display *display, Drawable w, GC gc, XSegment *segs, int nsegs);
-static proto_XDrawSegments *func_XDrawSegments = NULL;
-int XDrawSegments( Display *display, Drawable w, GC gc, XSegment *segs, int nsegs) {
-       if (!func_XDrawSegments) func_XDrawSegments=(proto_XDrawSegments *)_loadfunc("XDrawSegments");
-       return (func_XDrawSegments)( display, w, gc, segs, nsegs);
-}
-
-typedef int (proto_XDrawString)(Display *display, Drawable window, GC gc, int x, int y, const char* str, int len);
-static proto_XDrawString *func_XDrawString = NULL;
-int XDrawString(Display *display, Drawable window, GC gc, int x, int y, const char* str, int len) {
-       if (!func_XDrawString) func_XDrawString=(proto_XDrawString *)_loadfunc("XDrawString");
-       return (func_XDrawString)(display, window, gc, x, y, str, len);
-}
-
-typedef int (proto_XDrawString16)(Display *display, Drawable window, GC gc, int x, int y, const XChar2b* str, int len);
-static proto_XDrawString16 *func_XDrawString16 = NULL;
-int XDrawString16(Display *display, Drawable window, GC gc, int x, int y, const XChar2b* str, int len) {
-       if (!func_XDrawString16) func_XDrawString16=(proto_XDrawString16 *)_loadfunc("XDrawString16");
-       return (func_XDrawString16)(display, window, gc, x, y, str, len);
-}
-
-typedef StatusDef (proto_XFetchName)( Display *display, Window w, char **window_name_return);
-static proto_XFetchName *func_XFetchName = NULL;
-StatusDef XFetchName( Display *display, Window w, char **window_name_return) {
-       if (!func_XFetchName) func_XFetchName=(proto_XFetchName *)_loadfunc("XFetchName");
-       return (func_XFetchName)( display, w, window_name_return);
-}
-
-typedef int (proto_XFillArc)( Display *display, Drawable w, GC gc, int x, int y, unsigned int width,unsigned height, int a1, int a2);
-static proto_XFillArc *func_XFillArc = NULL;
-int XFillArc( Display *display, Drawable w, GC gc, int x, int y, unsigned int width,unsigned height, int a1, int a2) {
-       if (!func_XFillArc) func_XFillArc=(proto_XFillArc *)_loadfunc("XFillArc");
-       return (func_XFillArc)( display, w, gc, x, y, width,height, a1, a2);
-}
-
-typedef int (proto_XFillPolygon)( Display *display, Drawable w, GC gc, XPoint *points, int nps, int shape, int mode);
-static proto_XFillPolygon *func_XFillPolygon = NULL;
-int XFillPolygon( Display *display, Drawable w, GC gc, XPoint *points, int nps, int shape, int mode) {
-       if (!func_XFillPolygon) func_XFillPolygon=(proto_XFillPolygon *)_loadfunc("XFillPolygon");
-       return (func_XFillPolygon)( display, w, gc, points, nps, shape, mode);
-}
-
-typedef int (proto_XFillRectangle)( Display *display, Drawable window, GC gc, int x, int y, unsigned int w, unsigned int h);
-static proto_XFillRectangle *func_XFillRectangle = NULL;
-int XFillRectangle( Display *display, Drawable window, GC gc, int x, int y, unsigned int w, unsigned int h) {
-       if (!func_XFillRectangle) func_XFillRectangle=(proto_XFillRectangle *)_loadfunc("XFillRectangle");
-       return (func_XFillRectangle)( display, window, gc, x, y, w, h);
-}
-
-typedef BoolDef (proto_XFilterEvent)(XEvent* event,Window window);
-static proto_XFilterEvent *func_XFilterEvent = NULL;
-BoolDef XFilterEvent(XEvent* event,Window window) {
-       if (!func_XFilterEvent) func_XFilterEvent=(proto_XFilterEvent *)_loadfunc("XFilterEvent");
-       return (func_XFilterEvent)(event,window);
-}
-
-typedef int (proto_XFlush)(Display *display);
-static proto_XFlush *func_XFlush = NULL;
-int XFlush(Display *display) {
-       if (!func_XFlush) func_XFlush=(proto_XFlush *)_loadfunc("XFlush");
-       return (func_XFlush)(display);
-}
-
-typedef int (proto_XFree)(void *data);
-static proto_XFree *func_XFree = NULL;
-int XFree(void *data) {
-       if (!func_XFree) func_XFree=(proto_XFree *)_loadfunc("XFree");
-       return (func_XFree)(data);
-}
-
-typedef int (proto_XFreeColors)(Display *display, Colormap cmap, unsigned long pixels[], int npixels, unsigned long planes);
-static proto_XFreeColors *func_XFreeColors = NULL;
-int XFreeColors(Display *display, Colormap cmap, unsigned long pixels[], int npixels, unsigned long planes) {
-       if (!func_XFreeColors) func_XFreeColors=(proto_XFreeColors *)_loadfunc("XFreeColors");
-       return (func_XFreeColors)(display, cmap, pixels, npixels, planes);
-}
-
-typedef int (proto_XFreeExtensionList)(char **list);
-static proto_XFreeExtensionList *func_XFreeExtensionList = NULL;
-int XFreeExtensionList(char **list) {
-       if (!func_XFreeExtensionList) func_XFreeExtensionList=(proto_XFreeExtensionList *)_loadfunc("XFreeExtensionList");
-       return (func_XFreeExtensionList)(list);
-}
-
-typedef int (proto_XFreeFont)(Display* display,XFontStruct* font_struct);
-static proto_XFreeFont *func_XFreeFont = NULL;
-int XFreeFont(Display* display,XFontStruct* font_struct) {
-       if (!func_XFreeFont) func_XFreeFont=(proto_XFreeFont *)_loadfunc("XFreeFont");
-       return (func_XFreeFont)(display,font_struct);
-}
-
-typedef int (proto_XFreeGC)( Display *display, GC gc);
-static proto_XFreeGC *func_XFreeGC = NULL;
-int XFreeGC( Display *display, GC gc) {
-       if (!func_XFreeGC) func_XFreeGC=(proto_XFreeGC *)_loadfunc("XFreeGC");
-       return (func_XFreeGC)( display, gc);
-}
-
-typedef int (proto_XFreeModifiermap)(XModifierKeymap *modmap);
-static proto_XFreeModifiermap *func_XFreeModifiermap = NULL;
-int XFreeModifiermap(XModifierKeymap *modmap) {
-       if (!func_XFreeModifiermap) func_XFreeModifiermap=(proto_XFreeModifiermap *)_loadfunc("XFreeModifiermap");
-       return (func_XFreeModifiermap)(modmap);
-}
-
-typedef int (proto_XFreePixmap)( Display *display, Pixmap pixmap);
-static proto_XFreePixmap *func_XFreePixmap = NULL;
-int XFreePixmap( Display *display, Pixmap pixmap) {
-       if (!func_XFreePixmap) func_XFreePixmap=(proto_XFreePixmap *)_loadfunc("XFreePixmap");
-       return (func_XFreePixmap)( display, pixmap);
-}
-
-typedef void (proto_XFreeStringList)(char **list);
-static proto_XFreeStringList *func_XFreeStringList = NULL;
-void XFreeStringList(char **list) {
-       if (!func_XFreeStringList) func_XFreeStringList=(proto_XFreeStringList *)_loadfunc("XFreeStringList");
-       (func_XFreeStringList)(list);
-}
-
-typedef char * (proto_XGetAtomName)( Display *display, Atom atom);
-static proto_XGetAtomName *func_XGetAtomName = NULL;
-char * XGetAtomName( Display *display, Atom atom) {
-       if (!func_XGetAtomName) func_XGetAtomName=(proto_XGetAtomName *)_loadfunc("XGetAtomName");
-       return (func_XGetAtomName)( display, atom);
-}
-
-typedef int (proto_XGetErrorDatabaseText)( Display *display, const char *name, const char *msg, const char *defstr, char *buf, int len);
-static proto_XGetErrorDatabaseText *func_XGetErrorDatabaseText = NULL;
-int XGetErrorDatabaseText( Display *display, const char *name, const char *msg, const char *defstr, char *buf, int len) {
-       if (!func_XGetErrorDatabaseText) func_XGetErrorDatabaseText=(proto_XGetErrorDatabaseText *)_loadfunc("XGetErrorDatabaseText");
-       return (func_XGetErrorDatabaseText)( display, name, msg, defstr, buf, len);
-}
-
-typedef int (proto_XGetErrorText)( Display *display, int code, char *buf, int len);
-static proto_XGetErrorText *func_XGetErrorText = NULL;
-int XGetErrorText( Display *display, int code, char *buf, int len) {
-       if (!func_XGetErrorText) func_XGetErrorText=(proto_XGetErrorText *)_loadfunc("XGetErrorText");
-       return (func_XGetErrorText)( display, code, buf, len);
-}
-
-typedef char ** (proto_XGetFontPath)( Display *display, int *nps);
-static proto_XGetFontPath *func_XGetFontPath = NULL;
-char ** XGetFontPath( Display *display, int *nps) {
-       if (!func_XGetFontPath) func_XGetFontPath=(proto_XGetFontPath *)_loadfunc("XGetFontPath");
-       return (func_XGetFontPath)( display, nps);
-}
-
-typedef BoolDef (proto_XGetFontProperty)( XFontStruct *fstruct, Atom atom, unsigned long *val);
-static proto_XGetFontProperty *func_XGetFontProperty = NULL;
-BoolDef XGetFontProperty( XFontStruct *fstruct, Atom atom, unsigned long *val) {
-       if (!func_XGetFontProperty) func_XGetFontProperty=(proto_XGetFontProperty *)_loadfunc("XGetFontProperty");
-       return (func_XGetFontProperty)( fstruct, atom, val);
-}
-
-typedef StatusDef (proto_XGetGeometry)( Display *display, Drawable w, Window *root, int *x, int *y, unsigned int *width, unsigned int *height, unsigned int *bw, unsigned int *depth);
-static proto_XGetGeometry *func_XGetGeometry = NULL;
-StatusDef XGetGeometry( Display *display, Drawable w, Window *root, int *x, int *y, unsigned int *width, unsigned int *height, unsigned int *bw, unsigned int *depth) {
-       if (!func_XGetGeometry) func_XGetGeometry=(proto_XGetGeometry *)_loadfunc("XGetGeometry");
-       return (func_XGetGeometry)( display, w, root, x, y, width, height, bw, depth);
-}
-
-typedef int (proto_XGetIconName)( Display *display, Window w, char **iname);
-static proto_XGetIconName *func_XGetIconName = NULL;
-int XGetIconName( Display *display, Window w, char **iname) {
-       if (!func_XGetIconName) func_XGetIconName=(proto_XGetIconName *)_loadfunc("XGetIconName");
-       return (func_XGetIconName)( display, w, iname);
-}
-
-typedef XImage * (proto_XGetImage)( Display *display, Drawable drawable, int x, int y, unsigned int width, unsigned int height, unsigned long plane_mask, int format);
-static proto_XGetImage *func_XGetImage = NULL;
-XImage * XGetImage( Display *display, Drawable drawable, int x, int y, unsigned int width, unsigned int height, unsigned long plane_mask, int format) {
-       if (!func_XGetImage) func_XGetImage=(proto_XGetImage *)_loadfunc("XGetImage");
-       return (func_XGetImage)( display, drawable, x, y, width, height, plane_mask, format);
-}
-
-typedef int (proto_XGetInputFocus)( Display *display, Window *focus, int *revto);
-static proto_XGetInputFocus *func_XGetInputFocus = NULL;
-int XGetInputFocus( Display *display, Window *focus, int *revto) {
-       if (!func_XGetInputFocus) func_XGetInputFocus=(proto_XGetInputFocus *)_loadfunc("XGetInputFocus");
-       return (func_XGetInputFocus)( display, focus, revto);
-}
-
-typedef XModifierKeymap * (proto_XGetModifierMapping)(Display *display);
-static proto_XGetModifierMapping *func_XGetModifierMapping = NULL;
-XModifierKeymap * XGetModifierMapping(Display *display) {
-       if (!func_XGetModifierMapping) func_XGetModifierMapping=(proto_XGetModifierMapping *)_loadfunc("XGetModifierMapping");
-       return (func_XGetModifierMapping)(display);
-}
-
-typedef Window (proto_XGetSelectionOwner)( Display* display, Atom selection);
-static proto_XGetSelectionOwner *func_XGetSelectionOwner = NULL;
-Window XGetSelectionOwner( Display* display, Atom selection) {
-       if (!func_XGetSelectionOwner) func_XGetSelectionOwner=(proto_XGetSelectionOwner *)_loadfunc("XGetSelectionOwner");
-       return (func_XGetSelectionOwner)( display, selection);
-}
-
-typedef StatusDef (proto_XGetStandardColormap)( Display *display, Window w, XStandardColormap *cmapinf, Atom prop);
-static proto_XGetStandardColormap *func_XGetStandardColormap = NULL;
-StatusDef XGetStandardColormap( Display *display, Window w, XStandardColormap *cmapinf, Atom prop) {
-       if (!func_XGetStandardColormap) func_XGetStandardColormap=(proto_XGetStandardColormap *)_loadfunc("XGetStandardColormap");
-       return (func_XGetStandardColormap)( display, w, cmapinf, prop);
-}
-
-typedef XVisualInfo * (proto_XGetVisualInfo)( Display *display, long vinm, XVisualInfo *vint, int *n);
-static proto_XGetVisualInfo *func_XGetVisualInfo = NULL;
-XVisualInfo * XGetVisualInfo( Display *display, long vinm, XVisualInfo *vint, int *n) {
-       if (!func_XGetVisualInfo) func_XGetVisualInfo=(proto_XGetVisualInfo *)_loadfunc("XGetVisualInfo");
-       return (func_XGetVisualInfo)( display, vinm, vint, n);
-}
-
-typedef StatusDef (proto_XGetWindowAttributes)(Display *display, Window w, XWindowAttributes *wattr);
-static proto_XGetWindowAttributes *func_XGetWindowAttributes = NULL;
-StatusDef XGetWindowAttributes(Display *display, Window w, XWindowAttributes *wattr) {
-       if (!func_XGetWindowAttributes) func_XGetWindowAttributes=(proto_XGetWindowAttributes *)_loadfunc("XGetWindowAttributes");
-       return (func_XGetWindowAttributes)(display, w, wattr);
-}
-
-typedef int (proto_XGetWindowProperty)( Display *display, Window window, Atom property, long long_offset, long long_length, BoolDef delete, Atom req_type, Atom *actual_type_return, int *actual_format_return, unsigned long *nitems_return, unsigned long *bytes_after_return, unsigned char **prop_return);
-static proto_XGetWindowProperty *func_XGetWindowProperty = NULL;
-int XGetWindowProperty( Display *display, Window window, Atom property, long long_offset, long long_length, BoolDef delete, Atom req_type, Atom *actual_type_return, int *actual_format_return, unsigned long *nitems_return, unsigned long *bytes_after_return, unsigned char **prop_return) {
-       if (!func_XGetWindowProperty) func_XGetWindowProperty=(proto_XGetWindowProperty *)_loadfunc("XGetWindowProperty");
-       return (func_XGetWindowProperty)( display, window, property, long_offset, long_length, delete, req_type, actual_type_return, actual_format_return, nitems_return, bytes_after_return, prop_return);
-}
-
-typedef int (proto_XGrabServer)(Display *display);
-static proto_XGrabServer *func_XGrabServer = NULL;
-int XGrabServer(Display *display) {
-       if (!func_XGrabServer) func_XGrabServer=(proto_XGrabServer *)_loadfunc("XGrabServer");
-       return (func_XGrabServer)(display);
-}
-
-typedef int (proto_XIconifyWindow)(Display *display, Window w, int screen_number);
-static proto_XIconifyWindow *func_XIconifyWindow = NULL;
-int XIconifyWindow(Display *display, Window w, int screen_number) {
-       if (!func_XIconifyWindow) func_XIconifyWindow=(proto_XIconifyWindow *)_loadfunc("XIconifyWindow");
-       return (func_XIconifyWindow)(display, w, screen_number);
-}
-
-typedef XExtCodes * (proto_XInitExtension)(Display *display, const char *name);
-static proto_XInitExtension *func_XInitExtension = NULL;
-XExtCodes * XInitExtension(Display *display, const char *name) {
-       if (!func_XInitExtension) func_XInitExtension=(proto_XInitExtension *)_loadfunc("XInitExtension");
-       return (func_XInitExtension)(display, name);
-}
-
-typedef Atom (proto_XInternAtom)( Display *display, const char *property_name, BoolDef only_if_exists);
-static proto_XInternAtom *func_XInternAtom = NULL;
-Atom XInternAtom( Display *display, const char *property_name, BoolDef only_if_exists) {
-       if (!func_XInternAtom) func_XInternAtom=(proto_XInternAtom *)_loadfunc("XInternAtom");
-       return (func_XInternAtom)( display, property_name, only_if_exists);
-}
-
-typedef KeySym (proto_XKeycodeToKeysym)( Display *display, unsigned int keycode, int index);
-static proto_XKeycodeToKeysym *func_XKeycodeToKeysym = NULL;
-KeySym XKeycodeToKeysym( Display *display, unsigned int keycode, int index) {
-       if (!func_XKeycodeToKeysym) func_XKeycodeToKeysym=(proto_XKeycodeToKeysym *)_loadfunc("XKeycodeToKeysym");
-       return (func_XKeycodeToKeysym)( display, keycode, index);
-}
-
-typedef KeyCode (proto_XKeysymToKeycode)( Display *display, KeySym keysym);
-static proto_XKeysymToKeycode *func_XKeysymToKeycode = NULL;
-KeyCode XKeysymToKeycode( Display *display, KeySym keysym) {
-       if (!func_XKeysymToKeycode) func_XKeysymToKeycode=(proto_XKeysymToKeycode *)_loadfunc("XKeysymToKeycode");
-       return (func_XKeysymToKeycode)( display, keysym);
-}
-
-typedef char ** (proto_XListExtensions)( Display *display, int *ret_num);
-static proto_XListExtensions *func_XListExtensions = NULL;
-char ** XListExtensions( Display *display, int *ret_num) {
-       if (!func_XListExtensions) func_XListExtensions=(proto_XListExtensions *)_loadfunc("XListExtensions");
-       return (func_XListExtensions)( display, ret_num);
-}
-
-typedef XFontStruct * (proto_XLoadQueryFont)(Display *display, const char *name);
-static proto_XLoadQueryFont *func_XLoadQueryFont = NULL;
-XFontStruct * XLoadQueryFont(Display *display, const char *name) {
-       if (!func_XLoadQueryFont) func_XLoadQueryFont=(proto_XLoadQueryFont *)_loadfunc("XLoadQueryFont");
-       return (func_XLoadQueryFont)(display, name);
-}
-
-typedef int (proto_XLookupString)( XKeyEvent *event, char *buf, int nbytes, KeySym *keysym, XComposeStatus *status);
-static proto_XLookupString *func_XLookupString = NULL;
-int XLookupString( XKeyEvent *event, char *buf, int nbytes, KeySym *keysym, XComposeStatus *status) {
-       if (!func_XLookupString) func_XLookupString=(proto_XLookupString *)_loadfunc("XLookupString");
-       return (func_XLookupString)( event, buf, nbytes, keysym, status);
-}
-
-typedef int (proto_XLowerWindow)(Display *display, Window w);
-static proto_XLowerWindow *func_XLowerWindow = NULL;
-int XLowerWindow(Display *display, Window w) {
-       if (!func_XLowerWindow) func_XLowerWindow=(proto_XLowerWindow *)_loadfunc("XLowerWindow");
-       return (func_XLowerWindow)(display, w);
-}
-
-typedef int (proto_XMapRaised)( Display *display, Window w);
-static proto_XMapRaised *func_XMapRaised = NULL;
-int XMapRaised( Display *display, Window w) {
-       if (!func_XMapRaised) func_XMapRaised=(proto_XMapRaised *)_loadfunc("XMapRaised");
-       return (func_XMapRaised)( display, w);
-}
-
-typedef int (proto_XMapSubwindows)( Display *display, Window w);
-static proto_XMapSubwindows *func_XMapSubwindows = NULL;
-int XMapSubwindows( Display *display, Window w) {
-       if (!func_XMapSubwindows) func_XMapSubwindows=(proto_XMapSubwindows *)_loadfunc("XMapSubwindows");
-       return (func_XMapSubwindows)( display, w);
-}
-
-typedef int (proto_XMapWindow)(Display *display, Window window);
-static proto_XMapWindow *func_XMapWindow = NULL;
-int XMapWindow(Display *display, Window window) {
-       if (!func_XMapWindow) func_XMapWindow=(proto_XMapWindow *)_loadfunc("XMapWindow");
-       return (func_XMapWindow)(display, window);
-}
-
-typedef StatusDef (proto_XMatchVisualInfo)( Display* display, int screen, int depth, int class, XVisualInfo* vinfo_return);
-static proto_XMatchVisualInfo *func_XMatchVisualInfo = NULL;
-StatusDef XMatchVisualInfo( Display* display, int screen, int depth, int class, XVisualInfo* vinfo_return) {
-       if (!func_XMatchVisualInfo) func_XMatchVisualInfo=(proto_XMatchVisualInfo *)_loadfunc("XMatchVisualInfo");
-       return (func_XMatchVisualInfo)( display, screen, depth, class, vinfo_return);
-}
-
-typedef int (proto_XMoveResizeWindow)( Display* display, Window w, int x, int y, unsigned int width, unsigned int height);
-static proto_XMoveResizeWindow *func_XMoveResizeWindow = NULL;
-int XMoveResizeWindow( Display* display, Window w, int x, int y, unsigned int width, unsigned int height) {
-       if (!func_XMoveResizeWindow) func_XMoveResizeWindow=(proto_XMoveResizeWindow *)_loadfunc("XMoveResizeWindow");
-       return (func_XMoveResizeWindow)( display, w, x, y, width, height);
-}
-
-typedef int (proto_XMoveWindow)( Display* display, Window w, int x, int y);
-static proto_XMoveWindow *func_XMoveWindow = NULL;
-int XMoveWindow( Display* display, Window w, int x, int y) {
-       if (!func_XMoveWindow) func_XMoveWindow=(proto_XMoveWindow *)_loadfunc("XMoveWindow");
-       return (func_XMoveWindow)( display, w, x, y);
-}
-
-typedef int (proto_XNextEvent)( Display *display, XEvent *event);
-static proto_XNextEvent *func_XNextEvent = NULL;
-int XNextEvent( Display *display, XEvent *event) {
-       if (!func_XNextEvent) func_XNextEvent=(proto_XNextEvent *)_loadfunc("XNextEvent");
-       return (func_XNextEvent)( display, event);
-}
-
-typedef XIM (proto_XOpenIM)( Display* dpy, struct _XrmHashBucketRec* rdb, char* res_name, char* res_class);
-static proto_XOpenIM *func_XOpenIM = NULL;
-XIM XOpenIM( Display* dpy, struct _XrmHashBucketRec* rdb, char* res_name, char* res_class) {
-       if (!func_XOpenIM) func_XOpenIM=(proto_XOpenIM *)_loadfunc("XOpenIM");
-       return (func_XOpenIM)( dpy, rdb, res_name, res_class);
-}
-
-typedef StatusDef (proto_XParseColor)( Display *display, Colormap map, const char* spec, XColor *colorPtr);
-static proto_XParseColor *func_XParseColor = NULL;
-StatusDef XParseColor( Display *display, Colormap map, const char* spec, XColor *colorPtr) {
-       if (!func_XParseColor) func_XParseColor=(proto_XParseColor *)_loadfunc("XParseColor");
-       return (func_XParseColor)( display, map, spec, colorPtr);
-}
-
-typedef int (proto_XParseGeometry)( const char* string, int* x, int* y, unsigned int* width, unsigned int* height);
-static proto_XParseGeometry *func_XParseGeometry = NULL;
-int XParseGeometry( const char* string, int* x, int* y, unsigned int* width, unsigned int* height) {
-       if (!func_XParseGeometry) func_XParseGeometry=(proto_XParseGeometry *)_loadfunc("XParseGeometry");
-       return (func_XParseGeometry)( string, x, y, width, height);
-}
-
-typedef int (proto_XPending)(Display *display);
-static proto_XPending *func_XPending = NULL;
-int XPending(Display *display) {
-       if (!func_XPending) func_XPending=(proto_XPending *)_loadfunc("XPending");
-       return (func_XPending)(display);
-}
-
-typedef int (proto_XPutBackEvent)(Display *display, XEvent *event);
-static proto_XPutBackEvent *func_XPutBackEvent = NULL;
-int XPutBackEvent(Display *display, XEvent *event) {
-       if (!func_XPutBackEvent) func_XPutBackEvent=(proto_XPutBackEvent *)_loadfunc("XPutBackEvent");
-       return (func_XPutBackEvent)(display, event);
-}
-
-typedef int (proto_XPutImage)( Display *display, Drawable w, GC gc, XImage *image, int sx,int sy,int dx,int dy, unsigned int width,unsigned int height);
-static proto_XPutImage *func_XPutImage = NULL;
-int XPutImage( Display *display, Drawable w, GC gc, XImage *image, int sx,int sy,int dx,int dy, unsigned int width,unsigned int height) {
-       if (!func_XPutImage) func_XPutImage=(proto_XPutImage *)_loadfunc("XPutImage");
-       return (func_XPutImage)( display, w, gc, image, sx,sy,dx,dy, width,height);
-}
-
-typedef int (proto_XQueryColor)( Display *display, Colormap cmap, XColor *cell);
-static proto_XQueryColor *func_XQueryColor = NULL;
-int XQueryColor( Display *display, Colormap cmap, XColor *cell) {
-       if (!func_XQueryColor) func_XQueryColor=(proto_XQueryColor *)_loadfunc("XQueryColor");
-       return (func_XQueryColor)( display, cmap, cell);
-}
-
-typedef int (proto_XQueryColors)( Display *display, Colormap cmap, XColor *cells, int nc);
-static proto_XQueryColors *func_XQueryColors = NULL;
-int XQueryColors( Display *display, Colormap cmap, XColor *cells, int nc) {
-       if (!func_XQueryColors) func_XQueryColors=(proto_XQueryColors *)_loadfunc("XQueryColors");
-       return (func_XQueryColors)( display, cmap, cells, nc);
-}
-
-typedef XFontStruct * (proto_XQueryFont)( Display *display, XID font_id);
-static proto_XQueryFont *func_XQueryFont = NULL;
-XFontStruct * XQueryFont( Display *display, XID font_id) {
-       if (!func_XQueryFont) func_XQueryFont=(proto_XQueryFont *)_loadfunc("XQueryFont");
-       return (func_XQueryFont)( display, font_id);
-}
-
-typedef BoolDef (proto_XQueryPointer)( Display* display, Window w, Window* root_return, Window* child_return, int* root_x_return, int* root_y_return, int* win_x_return, int* win_y_return, unsigned int* mask_return);
-static proto_XQueryPointer *func_XQueryPointer = NULL;
-BoolDef XQueryPointer( Display* display, Window w, Window* root_return, Window* child_return, int* root_x_return, int* root_y_return, int* win_x_return, int* win_y_return, unsigned int* mask_return) {
-       if (!func_XQueryPointer) func_XQueryPointer=(proto_XQueryPointer *)_loadfunc("XQueryPointer");
-       return (func_XQueryPointer)( display, w, root_return, child_return, root_x_return, root_y_return, win_x_return, win_y_return, mask_return);
-}
-
-typedef StatusDef (proto_XQueryTree)( Display *display, Window w, Window* root, Window* parent, Window** ch, unsigned int *n);
-static proto_XQueryTree *func_XQueryTree = NULL;
-StatusDef XQueryTree( Display *display, Window w, Window* root, Window* parent, Window** ch, unsigned int *n) {
-       if (!func_XQueryTree) func_XQueryTree=(proto_XQueryTree *)_loadfunc("XQueryTree");
-       return (func_XQueryTree)( display, w, root, parent, ch, n);
-}
-
-typedef int (proto_XRaiseWindow)( Display *display, Window w);
-static proto_XRaiseWindow *func_XRaiseWindow = NULL;
-int XRaiseWindow( Display *display, Window w) {
-       if (!func_XRaiseWindow) func_XRaiseWindow=(proto_XRaiseWindow *)_loadfunc("XRaiseWindow");
-       return (func_XRaiseWindow)( display, w);
-}
-
-typedef int (proto_XRecolorCursor)( Display *display, Cursor cursor, XColor *fg,XColor *bg);
-static proto_XRecolorCursor *func_XRecolorCursor = NULL;
-int XRecolorCursor( Display *display, Cursor cursor, XColor *fg,XColor *bg) {
-       if (!func_XRecolorCursor) func_XRecolorCursor=(proto_XRecolorCursor *)_loadfunc("XRecolorCursor");
-       return (func_XRecolorCursor)( display, cursor, fg,bg);
-}
-
-typedef int (proto_XRefreshKeyboardMapping)(XMappingEvent *event);
-static proto_XRefreshKeyboardMapping *func_XRefreshKeyboardMapping = NULL;
-int XRefreshKeyboardMapping(XMappingEvent *event) {
-       if (!func_XRefreshKeyboardMapping) func_XRefreshKeyboardMapping=(proto_XRefreshKeyboardMapping *)_loadfunc("XRefreshKeyboardMapping");
-       return (func_XRefreshKeyboardMapping)(event);
-}
-
-typedef int (proto_XResizeWindow)( Display* display, Window w, unsigned int width, unsigned int height);
-static proto_XResizeWindow *func_XResizeWindow = NULL;
-int XResizeWindow( Display* display, Window w, unsigned int width, unsigned int height) {
-       if (!func_XResizeWindow) func_XResizeWindow=(proto_XResizeWindow *)_loadfunc("XResizeWindow");
-       return (func_XResizeWindow)( display, w, width, height);
-}
-
-typedef Window (proto_XRootWindow)( Display *display, int scr);
-static proto_XRootWindow *func_XRootWindow = NULL;
-Window XRootWindow( Display *display, int scr) {
-       if (!func_XRootWindow) func_XRootWindow=(proto_XRootWindow *)_loadfunc("XRootWindow");
-       return (func_XRootWindow)( display, scr);
-}
-
-typedef Window (proto_XRootWindowOfScreen)(Screen *scr);
-static proto_XRootWindowOfScreen *func_XRootWindowOfScreen = NULL;
-Window XRootWindowOfScreen(Screen *scr) {
-       if (!func_XRootWindowOfScreen) func_XRootWindowOfScreen=(proto_XRootWindowOfScreen *)_loadfunc("XRootWindowOfScreen");
-       return (func_XRootWindowOfScreen)(scr);
-}
-
-typedef Screen * (proto_XScreenOfDisplay)( Display *display, int scr);
-static proto_XScreenOfDisplay *func_XScreenOfDisplay = NULL;
-Screen * XScreenOfDisplay( Display *display, int scr) {
-       if (!func_XScreenOfDisplay) func_XScreenOfDisplay=(proto_XScreenOfDisplay *)_loadfunc("XScreenOfDisplay");
-       return (func_XScreenOfDisplay)( display, scr);
-}
-
-typedef int (proto_XSelectInput)(Display *display, Window window, long mask);
-static proto_XSelectInput *func_XSelectInput = NULL;
-int XSelectInput(Display *display, Window window, long mask) {
-       if (!func_XSelectInput) func_XSelectInput=(proto_XSelectInput *)_loadfunc("XSelectInput");
-       return (func_XSelectInput)(display, window, mask);
-}
-
-typedef StatusDef (proto_XSendEvent)( Display *display, Window w, BoolDef prop, long emask, XEvent *event);
-static proto_XSendEvent *func_XSendEvent = NULL;
-StatusDef XSendEvent( Display *display, Window w, BoolDef prop, long emask, XEvent *event) {
-       if (!func_XSendEvent) func_XSendEvent=(proto_XSendEvent *)_loadfunc("XSendEvent");
-       return (func_XSendEvent)( display, w, prop, emask, event);
-}
-
-typedef char * (proto_XServerVendor)(Display *display);
-static proto_XServerVendor *func_XServerVendor = NULL;
-char * XServerVendor(Display *display) {
-       if (!func_XServerVendor) func_XServerVendor=(proto_XServerVendor *)_loadfunc("XServerVendor");
-       return (func_XServerVendor)(display);
-}
-
-typedef int (proto_XSetClassHint)( Display *display, Window w, XClassHint *chints);
-static proto_XSetClassHint *func_XSetClassHint = NULL;
-int XSetClassHint( Display *display, Window w, XClassHint *chints) {
-       if (!func_XSetClassHint) func_XSetClassHint=(proto_XSetClassHint *)_loadfunc("XSetClassHint");
-       return (func_XSetClassHint)( display, w, chints);
-}
-
-typedef int (proto_XSetClipMask)( Display *display, GC gc, Pixmap cmask);
-static proto_XSetClipMask *func_XSetClipMask = NULL;
-int XSetClipMask( Display *display, GC gc, Pixmap cmask) {
-       if (!func_XSetClipMask) func_XSetClipMask=(proto_XSetClipMask *)_loadfunc("XSetClipMask");
-       return (func_XSetClipMask)( display, gc, cmask);
-}
-
-typedef int (proto_XSetClipRectangles)( Display *display, GC gc, int clx, int cly, XRectangle *rs, int n, int order);
-static proto_XSetClipRectangles *func_XSetClipRectangles = NULL;
-int XSetClipRectangles( Display *display, GC gc, int clx, int cly, XRectangle *rs, int n, int order) {
-       if (!func_XSetClipRectangles) func_XSetClipRectangles=(proto_XSetClipRectangles *)_loadfunc("XSetClipRectangles");
-       return (func_XSetClipRectangles)( display, gc, clx, cly, rs, n, order);
-}
-
-typedef int (proto_XSetDashes)(Display *display, GC gc, int dash_offset, const char * dash_list, int n);
-static proto_XSetDashes *func_XSetDashes = NULL;
-int XSetDashes(Display *display, GC gc, int dash_offset, const char * dash_list, int n) {
-       if (!func_XSetDashes) func_XSetDashes=(proto_XSetDashes *)_loadfunc("XSetDashes");
-       return (func_XSetDashes)(display, gc, dash_offset, dash_list, n);
-}
-
-typedef XErrorHandler (proto_XSetErrorHandler)(XErrorHandler handler);
-static proto_XSetErrorHandler *func_XSetErrorHandler = NULL;
-XErrorHandler XSetErrorHandler(XErrorHandler handler) {
-       if (!func_XSetErrorHandler) func_XSetErrorHandler=(proto_XSetErrorHandler *)_loadfunc("XSetErrorHandler");
-       return (func_XSetErrorHandler)(handler);
-}
-
-typedef int (proto_XSetFillStyle)( Display *display, GC gc, int fs);
-static proto_XSetFillStyle *func_XSetFillStyle = NULL;
-int XSetFillStyle( Display *display, GC gc, int fs) {
-       if (!func_XSetFillStyle) func_XSetFillStyle=(proto_XSetFillStyle *)_loadfunc("XSetFillStyle");
-       return (func_XSetFillStyle)( display, gc, fs);
-}
-
-typedef int (proto_XSetFont)( Display *display, GC gc, Font font);
-static proto_XSetFont *func_XSetFont = NULL;
-int XSetFont( Display *display, GC gc, Font font) {
-       if (!func_XSetFont) func_XSetFont=(proto_XSetFont *)_loadfunc("XSetFont");
-       return (func_XSetFont)( display, gc, font);
-}
-
-typedef int (proto_XSetFontPath)( Display *display, char **dirs, int nd);
-static proto_XSetFontPath *func_XSetFontPath = NULL;
-int XSetFontPath( Display *display, char **dirs, int nd) {
-       if (!func_XSetFontPath) func_XSetFontPath=(proto_XSetFontPath *)_loadfunc("XSetFontPath");
-       return (func_XSetFontPath)( display, dirs, nd);
-}
-
-typedef int (proto_XSetForeground)( Display *display, GC gc, unsigned long color);
-static proto_XSetForeground *func_XSetForeground = NULL;
-int XSetForeground( Display *display, GC gc, unsigned long color) {
-       if (!func_XSetForeground) func_XSetForeground=(proto_XSetForeground *)_loadfunc("XSetForeground");
-       return (func_XSetForeground)( display, gc, color);
-}
-
-typedef int (proto_XSetFunction)( Display *display, GC gc, int fn);
-static proto_XSetFunction *func_XSetFunction = NULL;
-int XSetFunction( Display *display, GC gc, int fn) {
-       if (!func_XSetFunction) func_XSetFunction=(proto_XSetFunction *)_loadfunc("XSetFunction");
-       return (func_XSetFunction)( display, gc, fn);
-}
-
-typedef void (proto_XSetICFocus)(XIC ic);
-static proto_XSetICFocus *func_XSetICFocus = NULL;
-void XSetICFocus(XIC ic) {
-       if (!func_XSetICFocus) func_XSetICFocus=(proto_XSetICFocus *)_loadfunc("XSetICFocus");
-       (func_XSetICFocus)(ic);
-}
-
-typedef int (proto_XSetIconName)(Display *display, Window w, const char *iname);
-static proto_XSetIconName *func_XSetIconName = NULL;
-int XSetIconName(Display *display, Window w, const char *iname) {
-       if (!func_XSetIconName) func_XSetIconName=(proto_XSetIconName *)_loadfunc("XSetIconName");
-       return (func_XSetIconName)(display, w, iname);
-}
-
-typedef int (proto_XSetInputFocus)( Display *display, Window focus, int revto, Time time);
-static proto_XSetInputFocus *func_XSetInputFocus = NULL;
-int XSetInputFocus( Display *display, Window focus, int revto, Time time) {
-       if (!func_XSetInputFocus) func_XSetInputFocus=(proto_XSetInputFocus *)_loadfunc("XSetInputFocus");
-       return (func_XSetInputFocus)( display, focus, revto, time);
-}
-
-typedef int (proto_XSetLineAttributes)( Display *display, GC gc, unsigned int lw, int ls, int cs, int js);
-static proto_XSetLineAttributes *func_XSetLineAttributes = NULL;
-int XSetLineAttributes( Display *display, GC gc, unsigned int lw, int ls, int cs, int js) {
-       if (!func_XSetLineAttributes) func_XSetLineAttributes=(proto_XSetLineAttributes *)_loadfunc("XSetLineAttributes");
-       return (func_XSetLineAttributes)( display, gc, lw, ls, cs, js);
-}
-
-typedef char * (proto_XSetLocaleModifiers)(const char* modifier_list);
-static proto_XSetLocaleModifiers *func_XSetLocaleModifiers = NULL;
-char * XSetLocaleModifiers(const char* modifier_list) {
-       if (!func_XSetLocaleModifiers) func_XSetLocaleModifiers=(proto_XSetLocaleModifiers *)_loadfunc("XSetLocaleModifiers");
-       return (func_XSetLocaleModifiers)(modifier_list);
-}
-
-typedef int (proto_XSetNormalHints)( Display *display, Window w, XSizeHints *hints);
-static proto_XSetNormalHints *func_XSetNormalHints = NULL;
-int XSetNormalHints( Display *display, Window w, XSizeHints *hints) {
-       if (!func_XSetNormalHints) func_XSetNormalHints=(proto_XSetNormalHints *)_loadfunc("XSetNormalHints");
-       return (func_XSetNormalHints)( display, w, hints);
-}
-
-typedef int (proto_XSetPlaneMask)( Display *display, GC gc, unsigned long pmask);
-static proto_XSetPlaneMask *func_XSetPlaneMask = NULL;
-int XSetPlaneMask( Display *display, GC gc, unsigned long pmask) {
-       if (!func_XSetPlaneMask) func_XSetPlaneMask=(proto_XSetPlaneMask *)_loadfunc("XSetPlaneMask");
-       return (func_XSetPlaneMask)( display, gc, pmask);
-}
-
-typedef int (proto_XSetRegion)( Display *display, GC gc, Region hrgn);
-static proto_XSetRegion *func_XSetRegion = NULL;
-int XSetRegion( Display *display, GC gc, Region hrgn) {
-       if (!func_XSetRegion) func_XSetRegion=(proto_XSetRegion *)_loadfunc("XSetRegion");
-       return (func_XSetRegion)( display, gc, hrgn);
-}
-
-typedef int (proto_XSetSelectionOwner)( Display* display, Atom sel, Window owner, Time time);
-static proto_XSetSelectionOwner *func_XSetSelectionOwner = NULL;
-int XSetSelectionOwner( Display* display, Atom sel, Window owner, Time time) {
-       if (!func_XSetSelectionOwner) func_XSetSelectionOwner=(proto_XSetSelectionOwner *)_loadfunc("XSetSelectionOwner");
-       return (func_XSetSelectionOwner)( display, sel, owner, time);
-}
-
-typedef int (proto_XSetTile)( Display *display, GC gc, Pixmap tile);
-static proto_XSetTile *func_XSetTile = NULL;
-int XSetTile( Display *display, GC gc, Pixmap tile) {
-       if (!func_XSetTile) func_XSetTile=(proto_XSetTile *)_loadfunc("XSetTile");
-       return (func_XSetTile)( display, gc, tile);
-}
-
-typedef int (proto_XSetWMHints)( Display *display, Window w, XWMHints *wmhints);
-static proto_XSetWMHints *func_XSetWMHints = NULL;
-int XSetWMHints( Display *display, Window w, XWMHints *wmhints) {
-       if (!func_XSetWMHints) func_XSetWMHints=(proto_XSetWMHints *)_loadfunc("XSetWMHints");
-       return (func_XSetWMHints)( display, w, wmhints);
-}
-
-typedef void (proto_XSetWMNormalHints)(Display* display,Window w,XSizeHints* hints);
-static proto_XSetWMNormalHints *func_XSetWMNormalHints = NULL;
-void XSetWMNormalHints(Display* display,Window w,XSizeHints* hints) {
-       if (!func_XSetWMNormalHints) func_XSetWMNormalHints=(proto_XSetWMNormalHints *)_loadfunc("XSetWMNormalHints");
-       (func_XSetWMNormalHints)(display,w,hints);
-}
-
-typedef void (proto_XSetWMProperties)( Display* display, Window w, XTextProperty* window_name, XTextProperty* icon_name, char** argv, int argc, XSizeHints* normal_hints, XWMHints* wm_hints, XClassHint* class_hints);
-static proto_XSetWMProperties *func_XSetWMProperties = NULL;
-void XSetWMProperties( Display* display, Window w, XTextProperty* window_name, XTextProperty* icon_name, char** argv, int argc, XSizeHints* normal_hints, XWMHints* wm_hints, XClassHint* class_hints) {
-       if (!func_XSetWMProperties) func_XSetWMProperties=(proto_XSetWMProperties *)_loadfunc("XSetWMProperties");
-       (func_XSetWMProperties)( display, w, window_name, icon_name, argv, argc, normal_hints, wm_hints, class_hints);
-}
-
-typedef StatusDef (proto_XSetWMProtocols)( Display *display, Window w, Atom *prots, int co);
-static proto_XSetWMProtocols *func_XSetWMProtocols = NULL;
-StatusDef XSetWMProtocols( Display *display, Window w, Atom *prots, int co) {
-       if (!func_XSetWMProtocols) func_XSetWMProtocols=(proto_XSetWMProtocols *)_loadfunc("XSetWMProtocols");
-       return (func_XSetWMProtocols)( display, w, prots, co);
-}
-
-typedef int (proto_XSetWindowBackground)( Display *display, Window w, unsigned long bg);
-static proto_XSetWindowBackground *func_XSetWindowBackground = NULL;
-int XSetWindowBackground( Display *display, Window w, unsigned long bg) {
-       if (!func_XSetWindowBackground) func_XSetWindowBackground=(proto_XSetWindowBackground *)_loadfunc("XSetWindowBackground");
-       return (func_XSetWindowBackground)( display, w, bg);
-}
-
-typedef int (proto_XSetWindowBackgroundPixmap)( Display *display, Window w, Pixmap background_tile);
-static proto_XSetWindowBackgroundPixmap *func_XSetWindowBackgroundPixmap = NULL;
-int XSetWindowBackgroundPixmap( Display *display, Window w, Pixmap background_tile) {
-       if (!func_XSetWindowBackgroundPixmap) func_XSetWindowBackgroundPixmap=(proto_XSetWindowBackgroundPixmap *)_loadfunc("XSetWindowBackgroundPixmap");
-       return (func_XSetWindowBackgroundPixmap)( display, w, background_tile);
-}
-
-typedef int (proto_XStoreColor)( Display *display, Colormap cmap, XColor *cell);
-static proto_XStoreColor *func_XStoreColor = NULL;
-int XStoreColor( Display *display, Colormap cmap, XColor *cell) {
-       if (!func_XStoreColor) func_XStoreColor=(proto_XStoreColor *)_loadfunc("XStoreColor");
-       return (func_XStoreColor)( display, cmap, cell);
-}
-
-typedef int (proto_XStoreColors)( Display *display, Colormap cmap, XColor *cells, int nc);
-static proto_XStoreColors *func_XStoreColors = NULL;
-int XStoreColors( Display *display, Colormap cmap, XColor *cells, int nc) {
-       if (!func_XStoreColors) func_XStoreColors=(proto_XStoreColors *)_loadfunc("XStoreColors");
-       return (func_XStoreColors)( display, cmap, cells, nc);
-}
-
-typedef int (proto_XStoreName)(Display *display, Window w, const char *wname);
-static proto_XStoreName *func_XStoreName = NULL;
-int XStoreName(Display *display, Window w, const char *wname) {
-       if (!func_XStoreName) func_XStoreName=(proto_XStoreName *)_loadfunc("XStoreName");
-       return (func_XStoreName)(display, w, wname);
-}
-
-typedef KeySym (proto_XStringToKeysym)(const char *str);
-static proto_XStringToKeysym *func_XStringToKeysym = NULL;
-KeySym XStringToKeysym(const char *str) {
-       if (!func_XStringToKeysym) func_XStringToKeysym=(proto_XStringToKeysym *)_loadfunc("XStringToKeysym");
-       return (func_XStringToKeysym)(str);
-}
-
-typedef int (proto_XSync)(Display *display,int discard);
-static proto_XSync *func_XSync = NULL;
-int XSync(Display *display,int discard) {
-       if (!func_XSync) func_XSync=(proto_XSync *)_loadfunc("XSync");
-       return (func_XSync)(display,discard);
-}
-
-typedef int (proto_XTextExtents)( XFontStruct *fstruct, const char *str, int nc, int *dir,int *ascent,int *descent, XCharStruct *overall);
-static proto_XTextExtents *func_XTextExtents = NULL;
-int XTextExtents( XFontStruct *fstruct, const char *str, int nc, int *dir,int *ascent,int *descent, XCharStruct *overall) {
-       if (!func_XTextExtents) func_XTextExtents=(proto_XTextExtents *)_loadfunc("XTextExtents");
-       return (func_XTextExtents)( fstruct, str, nc, dir,ascent,descent, overall);
-}
-
-typedef int (proto_XTextExtents16)( XFontStruct *fstruct, const XChar2b *str, int nc, int *dir, int *ascent, int *descent, XCharStruct *overall);
-static proto_XTextExtents16 *func_XTextExtents16 = NULL;
-int XTextExtents16( XFontStruct *fstruct, const XChar2b *str, int nc, int *dir, int *ascent, int *descent, XCharStruct *overall) {
-       if (!func_XTextExtents16) func_XTextExtents16=(proto_XTextExtents16 *)_loadfunc("XTextExtents16");
-       return (func_XTextExtents16)( fstruct, str, nc, dir, ascent, descent, overall);
-}
-
-typedef int (proto_XTextWidth)( XFontStruct *fstruct, const char *str, int co);
-static proto_XTextWidth *func_XTextWidth = NULL;
-int XTextWidth( XFontStruct *fstruct, const char *str, int co) {
-       if (!func_XTextWidth) func_XTextWidth=(proto_XTextWidth *)_loadfunc("XTextWidth");
-       return (func_XTextWidth)( fstruct, str, co);
-}
-
-typedef int (proto_XTextWidth16)( XFontStruct *fstruct, const XChar2b *str, int co);
-static proto_XTextWidth16 *func_XTextWidth16 = NULL;
-int XTextWidth16( XFontStruct *fstruct, const XChar2b *str, int co) {
-       if (!func_XTextWidth16) func_XTextWidth16=(proto_XTextWidth16 *)_loadfunc("XTextWidth16");
-       return (func_XTextWidth16)( fstruct, str, co);
-}
-
-typedef BoolDef (proto_XTranslateCoordinates)( Display *display, Window sw, Window dw, int sx, int sy, int *dx, int *dy, Window *ch);
-static proto_XTranslateCoordinates *func_XTranslateCoordinates = NULL;
-BoolDef XTranslateCoordinates( Display *display, Window sw, Window dw, int sx, int sy, int *dx, int *dy, Window *ch) {
-       if (!func_XTranslateCoordinates) func_XTranslateCoordinates=(proto_XTranslateCoordinates *)_loadfunc("XTranslateCoordinates");
-       return (func_XTranslateCoordinates)( display, sw, dw, sx, sy, dx, dy, ch);
-}
-
-typedef int (proto_XUngrabServer)(Display *display);
-static proto_XUngrabServer *func_XUngrabServer = NULL;
-int XUngrabServer(Display *display) {
-       if (!func_XUngrabServer) func_XUngrabServer=(proto_XUngrabServer *)_loadfunc("XUngrabServer");
-       return (func_XUngrabServer)(display);
-}
-
-typedef int (proto_XUnionRectWithRegion)(XRectangle *rect, Region hrgnsrc, Region hrgndest);
-static proto_XUnionRectWithRegion *func_XUnionRectWithRegion = NULL;
-int XUnionRectWithRegion(XRectangle *rect, Region hrgnsrc, Region hrgndest) {
-       if (!func_XUnionRectWithRegion) func_XUnionRectWithRegion=(proto_XUnionRectWithRegion *)_loadfunc("XUnionRectWithRegion");
-       return (func_XUnionRectWithRegion)(rect, hrgnsrc, hrgndest);
-}
-
-typedef int (proto_XUnmapWindow)(Display *display, Window w);
-static proto_XUnmapWindow *func_XUnmapWindow = NULL;
-int XUnmapWindow(Display *display, Window w) {
-       if (!func_XUnmapWindow) func_XUnmapWindow=(proto_XUnmapWindow *)_loadfunc("XUnmapWindow");
-       return (func_XUnmapWindow)(display, w);
-}
-
-typedef void (proto_XUnsetICFocus)(XIC ic);
-static proto_XUnsetICFocus *func_XUnsetICFocus = NULL;
-void XUnsetICFocus(XIC ic) {
-       if (!func_XUnsetICFocus) func_XUnsetICFocus=(proto_XUnsetICFocus *)_loadfunc("XUnsetICFocus");
-       (func_XUnsetICFocus)(ic);
-}
-
-typedef int (proto_XWarpPointer)( Display *display, Window sw,Window dw, int sx,int sy, unsigned int swidth,unsigned int sheight, int dx, int dy);
-static proto_XWarpPointer *func_XWarpPointer = NULL;
-int XWarpPointer( Display *display, Window sw,Window dw, int sx,int sy, unsigned int swidth,unsigned int sheight, int dx, int dy) {
-       if (!func_XWarpPointer) func_XWarpPointer=(proto_XWarpPointer *)_loadfunc("XWarpPointer");
-       return (func_XWarpPointer)( display, sw,dw, sx,sy, swidth,sheight, dx, dy);
-}
-
-typedef int (proto_XWindowEvent)( Display *display, Window w, long emask, XEvent *rep);
-static proto_XWindowEvent *func_XWindowEvent = NULL;
-int XWindowEvent( Display *display, Window w, long emask, XEvent *rep) {
-       if (!func_XWindowEvent) func_XWindowEvent=(proto_XWindowEvent *)_loadfunc("XWindowEvent");
-       return (func_XWindowEvent)( display, w, emask, rep);
-}
-
-typedef int (proto_XmbLookupString)( XIC ic, XKeyPressedEvent* event, char* buffer_return, int bytes_buffer, KeySym* keysym_return, StatusDef* status_return);
-static proto_XmbLookupString *func_XmbLookupString = NULL;
-int XmbLookupString( XIC ic, XKeyPressedEvent* event, char* buffer_return, int bytes_buffer, KeySym* keysym_return, StatusDef* status_return) {
-       if (!func_XmbLookupString) func_XmbLookupString=(proto_XmbLookupString *)_loadfunc("XmbLookupString");
-       return (func_XmbLookupString)( ic, event, buffer_return, bytes_buffer, keysym_return, status_return);
-}
-
-typedef int (proto_XmbTextListToTextProperty)( Display *display, char **list, int count, XICCEncodingStyle style, XTextProperty *text_prop_return);
-static proto_XmbTextListToTextProperty *func_XmbTextListToTextProperty = NULL;
-int XmbTextListToTextProperty( Display *display, char **list, int count, XICCEncodingStyle style, XTextProperty *text_prop_return) {
-       if (!func_XmbTextListToTextProperty) func_XmbTextListToTextProperty=(proto_XmbTextListToTextProperty *)_loadfunc("XmbTextListToTextProperty");
-       return (func_XmbTextListToTextProperty)( display, list, count, style, text_prop_return);
-}
-
-typedef int (proto_XmbTextPropertyToTextList)( Display *display, XTextProperty *text_prop, char ***list_return, int *count_return);
-static proto_XmbTextPropertyToTextList *func_XmbTextPropertyToTextList = NULL;
-int XmbTextPropertyToTextList( Display *display, XTextProperty *text_prop, char ***list_return, int *count_return) {
-       if (!func_XmbTextPropertyToTextList) func_XmbTextPropertyToTextList=(proto_XmbTextPropertyToTextList *)_loadfunc("XmbTextPropertyToTextList");
-       return (func_XmbTextPropertyToTextList)( display, text_prop, list_return, count_return);
-}
-
-typedef char * (proto_XrmQuarkToString)(void *quark);
-static proto_XrmQuarkToString *func_XrmQuarkToString = NULL;
-char * XrmQuarkToString(void *quark) {
-       if (!func_XrmQuarkToString) func_XrmQuarkToString=(proto_XrmQuarkToString *)_loadfunc("XrmQuarkToString");
-       return (func_XrmQuarkToString)(quark);
-}
index a3cd6e1269ec99b8207e5ff1c5a6766f34ae5eb0..e169fdc1017a43a8bf484a2701405f1d9b7f45b8 100644 (file)
@@ -51,6 +51,9 @@
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
+/* Define to 1 if you have the `getpt' function. */
+#undef HAVE_GETPT
+
 /* Define to 1 if you have the `grantpt' function. */
 #undef HAVE_GRANTPT
 
 /* Define for this pty type */
 #undef PTYS_ARE_CLONE
 
+/* Define for this pty type */
+#undef PTYS_ARE_GETPT
+
 /* Define for this pty type */
 #undef PTYS_ARE_NUMERIC
 
index 812339bad996fa772df5c690ad3c4eb139717d68..585437c9f000e5f970e480b1317b7fbb0fabf032 100755 (executable)
--- a/configure
+++ b/configure
@@ -10155,6 +10155,7 @@ esac
 
 
 
+
 
 for ac_func in \
        atexit \
@@ -10167,6 +10168,7 @@ for ac_func in \
        setpgrp \
        setpgid \
        _getpty \
+       getpt \
        posix_openpt \
        grantpt \
        unlockpt \
@@ -11958,7 +11960,7 @@ _ACEOF
 
 fi
 
-if test x$ac_cv_func_posix_openpt = xno; then
+if test x$ac_cv_func_getpt = xno -a x$ac_cv_func_posix_openpt = xno; then
   echo "$as_me:$LINENO: checking for openpty" >&5
 echo $ECHO_N "checking for openpty... $ECHO_C" >&6
 if test "${ac_cv_func_openpty+set}" = set; then
@@ -12129,6 +12131,8 @@ if test "${rxvt_cv_ptys+set}" = set; then
 else
   if test x$ac_cv_func_openpty = xyes -o x$ac_cv_lib_util_openpty = xyes; then
     rxvt_cv_ptys=OPENPTY
+ else if test x$ac_cv_func_getpt = xyes; then
+    rxvt_cv_ptys=GLIBC
  else if test x$ac_cv_func_posix_openpt = xyes; then
     rxvt_cv_ptys=POSIX
  else if test x$ac_cv_func__getpty = xyes; then
 fi
 fi
 fi
+fi
 
 fi
 echo "$as_me:$LINENO: result: $rxvt_cv_ptys" >&5
 echo "${ECHO_T}$rxvt_cv_ptys" >&6
 
+if test x$rxvt_cv_ptys = xGLIBC; then
+
+cat >>confdefs.h <<\_ACEOF
+#define PTYS_ARE_GETPT 1
+_ACEOF
+
+fi
 if test x$rxvt_cv_ptys = xPOSIX; then
 
 cat >>confdefs.h <<\_ACEOF