http://www.jwz.org/xscreensaver/xscreensaver-5.09.tar.gz
[xscreensaver] / OSX / jwxyz.h
1 /* xscreensaver, Copyright (c) 1991-2009 Jamie Zawinski <jwz@jwz.org>
2  *
3  * Permission to use, copy, modify, distribute, and sell this software and its
4  * documentation for any purpose is hereby granted without fee, provided that
5  * the above copyright notice appear in all copies and that both that
6  * copyright notice and this permission notice appear in supporting
7  * documentation.  No representations are made about the suitability of this
8  * software for any purpose.  It is provided "as is" without express or 
9  * implied warranty.
10  */
11
12 /* JWXYZ Is Not Xlib.
13
14    But it's a bunch of function definitions that bear some resemblance to
15    Xlib and that do Cocoa-ish things that bear some resemblance to the
16    things that Xlib might have done.
17  */
18
19 #ifndef __JWXYZ_H__
20 #define __JWXYZ_H__
21
22 typedef int Bool;
23 typedef int Status;
24 typedef void * XPointer;
25 typedef unsigned long Time;
26 typedef unsigned int KeySym;
27 typedef unsigned int KeyCode;
28 typedef unsigned int VisualID;
29
30 typedef struct jwxyz_Display            Display;
31 typedef struct jwxyz_Screen             Screen;
32 typedef struct jwxyz_Visual             Visual;
33 typedef struct jwxyz_Drawable *         Drawable;
34 typedef struct jwxyz_Colormap *         Colormap;
35 typedef struct jwxyz_GC *               GC;
36 typedef struct jwxyz_XColor             XColor;
37 typedef struct jwxyz_XGCValues          XGCValues;
38 typedef struct jwxyz_XPoint             XPoint;
39 typedef struct jwxyz_XSegment           XSegment;
40 typedef struct jwxyz_XRectangle         XRectangle;
41 typedef struct jwxyz_XArc               XArc;
42 typedef struct jwxyz_XWindowAttributes  XWindowAttributes;
43 typedef struct jwxyz_XrmOptionDescRec   XrmOptionDescRec;
44 typedef struct jwxyz_XrmDatabase *      XrmDatabase;
45 typedef struct jwxyz_XImage             XImage;
46 typedef struct jwxyz_XFontStruct        XFontStruct;
47 typedef struct jwxyz_Font *             Font;
48 typedef struct jwxyz_XCharStruct        XCharStruct;
49 typedef struct jwxyz_XComposeStatus     XComposeStatus;
50 typedef struct jwxyz_XPixmapFormatValues XPixmapFormatValues;
51
52 typedef union  jwxyz_XEvent             XEvent;
53 typedef struct jwxyz_XAnyEvent          XAnyEvent;
54 typedef struct jwxyz_XKeyEvent          XKeyEvent;
55 typedef struct jwxyz_XMotionEvent       XMotionEvent;
56 typedef struct jwxyz_XButtonEvent       XButtonEvent;
57 typedef XKeyEvent                       XKeyPressedEvent;
58 typedef XKeyEvent                       XKeyReleasedEvent;
59 typedef XMotionEvent                    XPointerMovedEvent;
60 typedef XButtonEvent                    XButtonPressedEvent;
61 typedef XButtonEvent                    XButtonReleasedEvent;
62
63
64 /* Not technically Xlib... */
65 typedef struct jwxyz_GLXContext *       GLXContext;
66 typedef struct jwxyz_XtAppContext *     XtAppContext;
67 typedef struct jwxyz_XtIntervalId *     XtIntervalId;
68 typedef struct jwxyz_XtInputId *        XtInputId;
69 typedef void *                          XtPointer;
70 #define XtInputReadMask                 (1L<<0)
71 #define XtInputWriteMask                (1L<<1)
72 #define XtInputExceptMask               (1L<<2)
73
74 #define True 1
75 #define TRUE 1
76 #define False 0
77 #define FALSE 0
78 #define None 0
79
80 #define Window Drawable
81 #define Pixmap Drawable
82
83 #define XrmoptionNoArg  0
84 #define XrmoptionSepArg 1
85
86 #define CoordModeOrigin         0
87 #define CoordModePrevious       1
88
89 #define LineSolid               0
90 #define LineOnOffDash           1
91 #define LineDoubleDash          2
92
93 #define CapNotLast              0
94 #define CapButt                 1
95 #define CapRound                2
96 #define CapProjecting           3
97
98 #define JoinMiter               0
99 #define JoinRound               1
100 #define JoinBevel               2
101
102 #define FillSolid               0
103 #define FillTiled               1
104 #define FillStippled            2
105 #define FillOpaqueStippled      3
106
107 #define EvenOddRule             0
108 #define WindingRule             1
109
110 #define Complex                 0
111 #define Nonconvex               1
112 #define Convex                  2
113
114 #define XYBitmap                0
115 #define XYPixmap                1
116 #define ZPixmap                 2
117
118 #define AllocNone               0
119 #define AllocAll                1
120
121 #define StaticGray              0
122 #define GrayScale               1
123 #define StaticColor             2
124 #define PseudoColor             3
125 #define TrueColor               4
126 #define DirectColor             5
127
128 #define LSBFirst                0
129 #define MSBFirst                1
130
131 #define DoRed                   (1<<0)
132 #define DoGreen                 (1<<1)
133 #define DoBlue                  (1<<2)
134
135 #define GCFunction              (1L<<0)
136 #define GCPlaneMask             (1L<<1)
137 #define GCForeground            (1L<<2)
138 #define GCBackground            (1L<<3)
139 #define GCLineWidth             (1L<<4)
140 #define GCLineStyle             (1L<<5)
141 #define GCCapStyle              (1L<<6)
142 #define GCJoinStyle             (1L<<7)
143 #define GCFillStyle             (1L<<8)
144 #define GCFillRule              (1L<<9) 
145 #define GCTile                  (1L<<10)
146 #define GCStipple               (1L<<11)
147 #define GCTileStipXOrigin       (1L<<12)
148 #define GCTileStipYOrigin       (1L<<13)
149 #define GCFont                  (1L<<14)
150 #define GCSubwindowMode         (1L<<15)
151 #define GCGraphicsExposures     (1L<<16)
152 #define GCClipXOrigin           (1L<<17)
153 #define GCClipYOrigin           (1L<<18)
154 #define GCClipMask              (1L<<19)
155 #define GCDashOffset            (1L<<20)
156 #define GCDashList              (1L<<21)
157 #define GCArcMode               (1L<<22)
158
159 #define KeyPress                2
160 #define KeyRelease              3
161 #define ButtonPress             4
162 #define ButtonRelease           5
163 #define MotionNotify            6
164 #define Expose                  12
165 #define GraphicsExpose          13
166 #define NoExpose                14
167 #define VisibilityNotify        15
168
169 #define ClipByChildren          0
170 #define IncludeInferiors        1
171
172 #define KeyPressMask            (1L<<0)
173 #define KeyReleaseMask          (1L<<1)
174 #define ButtonPressMask         (1L<<2)
175 #define ButtonReleaseMask       (1L<<3)
176 #define PointerMotionMask       (1L<<6)
177
178 #define Button1                 1
179 #define Button2                 2
180 #define Button3                 3
181 #define Button4                 4
182 #define Button5                 5
183
184 #define ShiftMask               (1<<0)
185 #define LockMask                (1<<1)
186 #define ControlMask             (1<<2)
187 #define Mod1Mask                (1<<3)
188 #define Mod2Mask                (1<<4)
189 #define Mod3Mask                (1<<5)
190 #define Mod4Mask                (1<<6)
191 #define Mod5Mask                (1<<7)
192 #define Button1Mask             (1<<8)
193 #define Button2Mask             (1<<9)
194 #define Button3Mask             (1<<10)
195 #define Button4Mask             (1<<11)
196 #define Button5Mask             (1<<12)
197
198 #define GXclear                 0x0             /* 0 */
199 #define GXand                   0x1             /* src AND dst */
200 // #define GXandReverse         0x2             /* src AND NOT dst */
201 #define GXcopy                  0x3             /* src */
202 // #define GXandInverted        0x4             /* NOT src AND dst */
203 // #define GXnoop               0x5             /* dst */
204 #define GXxor                   0x6             /* src XOR dst */
205 #define GXor                    0x7             /* src OR dst */
206 // #define GXnor                0x8             /* NOT src AND NOT dst */
207 // #define GXequiv              0x9             /* NOT src XOR dst */
208 // #define GXinvert             0xa             /* NOT dst */
209 // #define GXorReverse          0xb             /* src OR NOT dst */
210 // #define GXcopyInverted       0xc             /* NOT src */
211 // #define GXorInverted         0xd             /* NOT src OR dst */
212 // #define GXnand               0xe             /* NOT src OR NOT dst */
213 #define GXset                   0xf             /* 1 */
214
215 #define DefaultScreen(dpy) (0)
216 #define BlackPixelOfScreen(s) (0xFF000000)
217 #define WhitePixelOfScreen(s) (0xFFFFFFFF)
218 #define BlackPixel(dpy,n) BlackPixelOfScreen(0)
219 #define WhitePixel(dpy,n) WhitePixelOfScreen(0)
220 #define CellsOfScreen(s) (0x00FFFFFF)
221 #define XFree(x) free(x)
222 #define BitmapPad(dpy) (8)
223 #define BitmapBitOrder(dpy) (MSBFirst)
224 #define ImageByteOrder(dpy) (MSBFirst)
225 #define DisplayOfScreen XDisplayOfScreen
226 #define DefaultScreenOfDisplay XDefaultScreenOfDisplay
227 #define ScreenOfDisplay(dpy,n) DefaultScreenOfDisplay(dpy)
228 #define DefaultVisualOfScreen XDefaultVisualOfScreen
229 #define DefaultColormapOfScreen(s) (0)
230 #define RootWindow XRootWindow
231 #define RootWindowOfScreen(s) RootWindow(DisplayOfScreen(s),0)
232 #define DisplayWidth XDisplayWidth
233 #define DisplayHeight XDisplayHeight
234 #define XMaxRequestSize(dpy) (65535)
235
236 extern Display *jwxyz_make_display (void *nsview);
237 extern void jwxyz_free_display (Display *);
238 extern void *jwxyz_window_view (Window);
239 extern void jwxyz_window_resized (Display *, Window w);
240
241 extern Window XRootWindow (Display *, int screen);
242 extern Screen *XDefaultScreenOfDisplay (Display *);
243 extern Visual *XDefaultVisualOfScreen (Screen *);
244 extern Display *XDisplayOfScreen (Screen *);
245 extern int XDisplayNumberOfScreen (Screen *);
246 extern int XScreenNumberOfScreen (Screen *);
247 extern int XDisplayWidth (Display *, int);
248 extern int XDisplayHeight (Display *, int);
249
250 extern int XDrawPoint (Display *, Drawable, GC, int x, int y);
251 extern int XDrawPoints (Display *, Drawable, GC, XPoint *, int n, int mode);
252 extern int XDrawSegments (Display *, Drawable, GC, XSegment *, int n);
253
254 extern GC XCreateGC (Display *, Drawable, unsigned long mask, XGCValues *);
255 extern int XChangeGC (Display *, GC, unsigned long mask, XGCValues *);
256 extern int XFreeGC (Display *, GC);
257
258 extern int XClearWindow (Display *, Window);
259 extern int XClearArea (Display *, Window, int x, int y, int w, int h,Bool exp);
260 extern int XSetWindowBackground (Display *, Window, unsigned long);
261 extern Status XGetWindowAttributes (Display *, Window, XWindowAttributes *);
262 extern Status XGetGeometry (Display *, Drawable, Window *root_ret,
263                             int *x_ret, int *y_ret, 
264                             unsigned int *w_ret, unsigned int *h_ret,
265                             unsigned int *bw_ret, unsigned int *depth_ret);
266 extern Status XAllocColor (Display *, Colormap, XColor *);
267 extern Status XAllocColorCells (Display *, Colormap, Bool contig,
268                                 unsigned long *pmret, unsigned int npl,
269                                 unsigned long *pxret, unsigned int npx);
270 extern int XStoreColors (Display *, Colormap, XColor *, int n);
271 extern int XStoreColor (Display *, Colormap, XColor *);
272 extern Status XParseColor(Display *, Colormap, const char *spec, XColor *ret);
273 extern Status XAllocNamedColor (Display *, Colormap, char *name,
274                                 XColor *screen_ret, XColor *exact_ret);
275 extern int XQueryColor (Display *, Colormap, XColor *);
276 extern int XQueryColors(Display *, Colormap colormap, XColor *, int ncolors);
277
278 extern int XSetForeground (Display *, GC, unsigned long);
279 extern int XSetBackground (Display *, GC, unsigned long);
280 extern int XSetFunction (Display *, GC, int);
281 extern int XSetSubwindowMode (Display *, GC, int);
282 extern int XSetLineAttributes (Display *, GC, unsigned int line_width,
283                                int line_style, int cap_style, int join_style);
284 extern int XSetClipMask (Display *, GC, Pixmap);
285 extern int XSetClipOrigin (Display *, GC, int x, int y);
286 extern int jwxyz_XSetAlphaAllowed (Display *, GC, Bool);
287 extern int jwxyz_XSetAntiAliasing (Display *, GC, Bool);
288
289 extern int XFlush (Display *);
290 extern int XSync (Display *, Bool);
291 extern int XFreeColors (Display *, Colormap, unsigned long *px, int n,
292                         unsigned long planes);
293 extern int XFillPolygon (Display *, Drawable, GC, 
294                          XPoint * points, int npoints, int shape, int mode);
295 extern int XCopyArea (Display *, Drawable src, Drawable dest, GC, 
296                       int src_x, int src_y, 
297                       unsigned int width, unsigned int height, 
298                       int dest_x, int dest_y);
299 extern int XCopyPlane (Display *, Drawable, Drawable, GC,
300                        int src_x, int src_y,
301                        unsigned width, int height,
302                        int dest_x, int dest_y,
303                        unsigned long plane);
304
305 extern int XDrawLine (Display *, Drawable, GC, int x1, int y1, int x2, int y2);
306 extern int XDrawLines (Display *, Drawable, GC, XPoint *, int n, int mode);
307 extern int XDrawArc (Display *, Drawable, GC, int x, int y, 
308                      unsigned int width, unsigned int height,
309                      int angle1, int angle2);
310 extern int XFillArc (Display *, Drawable, GC, int x, int y, 
311                      unsigned int width, unsigned int height,
312                      int angle1, int angle2);
313 extern int XDrawArcs (Display *, Drawable, GC, XArc *arcs, int narcs);
314 extern int XFillArcs (Display *, Drawable, GC, XArc *arcs, int narcs);
315 extern int XDrawRectangle (Display *, Drawable, GC, int x, int y, 
316                            unsigned int width, unsigned int height);
317 extern int XFillRectangle (Display *, Drawable, GC, int x, int y, 
318                            unsigned int width, unsigned int height);
319 extern int XFillRectangles (Display *, Drawable, GC, XRectangle *, int n);
320
321 extern int XDrawString (Display *, Drawable, GC, int x, int y, const char *,
322                         int len);
323 extern int XDrawImageString (Display *, Drawable, GC, int x, int y, 
324                              const char *, int len);
325
326 extern Bool XQueryPointer (Display *, Window, Window *root_ret,
327                            Window *child_ret,
328                            int *root_x_ret, int *root_y_ret,
329                            int *win_x_ret, int *win_y_ret,
330                            unsigned int *mask_ret);
331 extern int XLookupString (XKeyEvent *, char *ret, int size, KeySym *ks_ret,
332                           XComposeStatus *);
333 extern KeySym XKeycodeToKeysym (Display *, KeyCode, int index);
334
335 extern Status XInitImage (XImage *);
336 extern XImage *XCreateImage (Display *, Visual *, unsigned int depth,
337                              int format, int offset, char *data,
338                              unsigned int width, unsigned int height,
339                              int bitmap_pad, int bytes_per_line);
340 extern XImage *XSubImage (XImage *, int x, int y, 
341                           unsigned int w, unsigned int h);
342
343 extern unsigned long XGetPixel (XImage *, int x, int y);
344 extern int XPutPixel (XImage *, int x, int y, unsigned long);
345 extern int XDestroyImage (XImage *);
346 extern int XPutImage (Display *, Drawable, GC, XImage *, 
347                       int src_x, int src_y, int dest_x, int dest_y,
348                       unsigned int w, unsigned int h);
349 extern XImage *XGetImage (Display *, Drawable, int x, int y,
350                           unsigned int w, unsigned int h,
351                           unsigned long pm, int fmt);
352 extern Pixmap XCreatePixmapFromBitmapData (Display *, Drawable,
353                                            const char *data,
354                                            unsigned int w, unsigned int h,
355                                            unsigned long fg,
356                                            unsigned int bg,
357                                            unsigned int depth);
358 extern XPixmapFormatValues *XListPixmapFormats (Display *, int *count_ret);
359
360 extern void jwxyz_draw_NSImage (Display *, Drawable, void *NSImage_arg,
361                                 XRectangle *geom_ret, int exif_rotation);
362
363 extern int XSetGraphicsExposures (Display *, GC, Bool);
364 extern Bool XTranslateCoordinates (Display *, Window src_w, Window dest_w,
365                                    int src_x, int src_y,
366                                    int *dest_x_ret, int *dest_y_ret,
367                                    Window *child_ret);
368
369 extern Font XLoadFont (Display *, const char *);
370 extern XFontStruct * XQueryFont (Display *, Font);
371 extern XFontStruct * XLoadQueryFont (Display *, const char *);
372 extern int XFreeFontInfo (char **names, XFontStruct *info, int n);
373 extern int XFreeFont (Display *, XFontStruct *);
374 extern int XUnloadFont (Display *, Font);
375 extern int XTextExtents (XFontStruct *, const char *, int length,
376                          int *dir_ret, int *ascent_ret, int *descent_ret,
377                          XCharStruct *overall_ret);
378 extern int XTextWidth (XFontStruct *, const char *, int length);
379 extern int XSetFont (Display *, GC, Font);
380
381 extern Pixmap XCreatePixmap (Display *, Drawable,
382                              unsigned int width, unsigned int height,
383                              unsigned int depth);
384 extern int XFreePixmap (Display *, Pixmap);
385
386 // Xt timers and fds
387 extern XtAppContext XtDisplayToApplicationContext (Display *);
388 typedef void (*XtTimerCallbackProc) (XtPointer closure, XtIntervalId *);
389 typedef void (*XtInputCallbackProc) (XtPointer closure, int *fd, XtInputId *);
390 extern XtIntervalId XtAppAddTimeOut (XtAppContext, unsigned long usecs,
391                                      XtTimerCallbackProc, XtPointer closure);
392 extern void XtRemoveTimeOut (XtIntervalId);
393 extern XtInputId XtAppAddInput (XtAppContext, int fd, XtPointer flags,
394                                XtInputCallbackProc, XtPointer closure);
395 extern void XtRemoveInput (XtInputId);
396 extern struct jwxyz_sources_data *display_sources_data (Display *);
397
398 // Some GLX stuff that also doesn't technically belong here...
399 // from XScreenSaverGLView.m
400 extern void glXSwapBuffers (Display *, Window);
401 extern void glXMakeCurrent (Display *, Window, GLXContext);
402
403 // also declared in utils/visual.h
404 extern int has_writable_cells (Screen *, Visual *);
405 extern int visual_depth (Screen *, Visual *);
406 extern int visual_cells (Screen *, Visual *);
407 extern int visual_class (Screen *, Visual *);
408
409 // also declared in utils/grabclient.h
410 extern Bool use_subwindow_mode_p (Screen *, Window);
411
412 struct jwxyz_Visual {
413   VisualID visualid;    /* visual id of this visual */
414   int class;            /* class of screen (monochrome, etc.) */
415   unsigned long red_mask, green_mask, blue_mask;        /* mask values */
416   int bits_per_rgb;     /* log base 2 of distinct color values */
417 //  int map_entries;    /* color map entries */
418 };
419
420 struct jwxyz_XGCValues {
421   int function;         /* logical operation */
422 #if 0
423   unsigned long plane_mask;/* plane mask */
424 #endif
425   unsigned long foreground;/* foreground pixel */
426   unsigned long background;/* background pixel */
427   int line_width;       /* line width */
428 #if 0
429   int line_style;       /* LineSolid, LineOnOffDash, LineDoubleDash */
430 #endif
431   int cap_style;        /* CapNotLast, CapButt, CapRound, CapProjecting */
432   int join_style;       /* JoinMiter, JoinRound, JoinBevel */
433 #if 0
434   int fill_style;       /* FillSolid, FillTiled, 
435                            FillStippled, FillOpaeueStippled */
436 #endif
437   int fill_rule;        /* EvenOddRule, WindingRule */
438 #if 0
439   int arc_mode;         /* ArcChord, ArcPieSlice */
440   Pixmap tile;          /* tile pixmap for tiling operations */
441   Pixmap stipple;       /* stipple 1 plane pixmap for stipping */
442   int ts_x_origin;      /* offset for tile or stipple operations */
443   int ts_y_origin;
444 #endif
445   Font font;            /* default text font for text operations */
446   int subwindow_mode;     /* ClipByChildren, IncludeInferiors */
447 #if 0
448   Bool graphics_exposures;/* boolean, should exposures be generated */
449 #endif
450   int clip_x_origin;    /* origin for clipping */
451   int clip_y_origin;
452   Pixmap clip_mask;     /* bitmap clipping; other calls for rects */
453 #if 0
454   int dash_offset;      /* patterned/dashed line information */
455   char dashes;
456 #endif
457
458   Bool alpha_allowed_p; /* jwxyz extension: whether pixel values may have
459                            a non-opaque alpha component. */
460   Bool antialias_p;     /* jwxyz extension: whether Quartz should draw
461                            with antialiasing. */
462 };
463
464 struct jwxyz_XWindowAttributes {
465     int x, y;                   /* location of window */
466     int width, height;          /* width and height of window */
467     int border_width;           /* border width of window */
468     int depth;                  /* depth of window */
469     Visual *visual;             /* the associated visual structure */
470 #if 0
471     Window root;                /* root of screen containing window */
472     int class;                  /* InputOutput, InputOnly*/
473     int bit_gravity;            /* one of bit gravity values */
474     int win_gravity;            /* one of the window gravity values */
475     int backing_store;          /* NotUseful, WhenMapped, Always */
476     unsigned long backing_planes;/* planes to be preserved if possible */
477     unsigned long backing_pixel;/* value to be used when restoring planes */
478     Bool save_under;            /* boolean, should bits under be saved? */
479 #endif
480     Colormap colormap;          /* color map to be associated with window */
481 #if 0
482     Bool map_installed;         /* boolean, is color map currently installed*/
483     int map_state;              /* IsUnmapped, IsUnviewable, IsViewable */
484     long all_event_masks;       /* set of events all people have interest in*/
485     long your_event_mask;       /* my event mask */
486     long do_not_propagate_mask; /* set of events that should not propagate */
487     Bool override_redirect;     /* boolean value for override-redirect */
488 #endif
489     Screen *screen;             /* back pointer to correct screen */
490 };
491
492 struct jwxyz_XColor {
493   unsigned long pixel;
494   unsigned short red, green, blue;
495   char flags;  /* do_red, do_green, do_blue */
496   char pad;
497 };
498
499 struct jwxyz_XPoint {
500   short x, y;
501 };
502
503 struct jwxyz_XSegment {
504   short x1, y1, x2, y2;
505 };
506
507 struct jwxyz_XRectangle {
508   short x, y;
509   unsigned short width, height;
510 };
511
512 struct jwxyz_XArc {
513   short x, y;
514   unsigned short width, height;
515   short angle1, angle2;
516 };
517
518
519 struct jwxyz_XrmOptionDescRec {
520   char *option;
521   char *specifier;
522   int argKind;
523   void *value;
524 };
525
526 struct jwxyz_XAnyEvent {
527   int type;
528 #if 0
529   unsigned long serial;
530   Bool send_event;
531   Display *display;
532   Window window;
533 #endif
534 };
535
536 struct jwxyz_XKeyEvent {
537   int type;
538 #if 0
539   unsigned long serial;
540   Bool send_event;
541   Display *display;
542   Window window;
543   Window root;
544   Window subwindow;
545   Time time;
546   int x, y;
547   int x_root, y_root;
548 #endif
549   unsigned int state;
550   unsigned int keycode;
551 #if 0
552   Bool same_screen;
553 #endif
554 };
555
556 struct jwxyz_XButtonEvent {
557   int type;
558 #if 0
559   unsigned long serial;
560   Bool send_event;
561   Display *display;
562   Window window;
563   Window root;
564   Window subwindow;
565   Time time;
566 #endif
567   int x, y;
568 #if 0
569   int x_root, y_root;
570 #endif
571   unsigned int state;
572   unsigned int button;
573 #if 0
574   Bool same_screen;
575 #endif
576 };
577
578 struct jwxyz_XMotionEvent {
579   int type;
580 #if 0
581   unsigned long serial;
582   Bool send_event;
583   Display *display;
584   Window window;
585   Window root;
586   Window subwindow;
587   Time time;
588 #endif
589   int x, y;
590 #if 0
591   int x_root, y_root;
592 #endif
593   unsigned int state;
594 #if 0
595   char is_hint;
596   Bool same_screen;
597 #endif
598 };
599
600 union jwxyz_XEvent {
601   int type;
602   XAnyEvent xany;
603   XKeyEvent xkey;
604   XButtonEvent xbutton;
605   XMotionEvent xmotion;
606 };
607
608 struct jwxyz_XImage {
609     int width, height;          /* size of image */
610     int xoffset;                /* number of pixels offset in X direction */
611     int format;                 /* XYBitmap, XYPixmap, ZPixmap */
612     char *data;                 /* pointer to image data */
613     int byte_order;             /* data byte order, LSBFirst, MSBFirst */
614     int bitmap_unit;            /* quant. of scanline 8, 16, 32 */
615     int bitmap_bit_order;       /* LSBFirst, MSBFirst */
616     int bitmap_pad;             /* 8, 16, 32 either XY or ZPixmap */
617     int depth;                  /* depth of image */
618     int bytes_per_line;         /* accelarator to next line */
619     int bits_per_pixel;         /* bits per pixel (ZPixmap) */
620     unsigned long red_mask;     /* bits in z arrangment */
621     unsigned long green_mask;
622     unsigned long blue_mask;
623 //  XPointer obdata;            /* hook for the object routines to hang on */
624     struct funcs {              /* image manipulation routines */
625 #if 0
626       XImage *(*create_image)(
627                 Display*        /* display */,
628                 Visual*         /* visual */,
629                 unsigned int    /* depth */,
630                 int             /* format */,
631                 int             /* offset */,
632                 char*           /* data */,
633                 unsigned int    /* width */,
634                 unsigned int    /* height */,
635                 int             /* bitmap_pad */,
636                 int             /* bytes_per_line */);
637         int (*destroy_image)        (XImage *);
638 #endif
639         unsigned long (*get_pixel)  (XImage *, int, int);
640         int (*put_pixel)            (XImage *, int, int, unsigned long);
641 #if 0
642         XImage *(*sub_image)        (XImage *, int, int, unsigned int, unsigned int);
643         int (*add_pixel)            (XImage *, long);
644 #endif
645     } f;
646 };
647
648 struct jwxyz_XCharStruct {
649   short lbearing;       /* origin to left edge of raster */
650   short rbearing;       /* origin to right edge of raster */
651   short width;          /* advance to next char's origin */
652   short ascent;         /* baseline to top edge of raster */
653   short descent;        /* baseline to bottom edge of raster */
654 #if 0
655   unsigned short attributes;    /* per char flags (not predefined) */
656 #endif
657 };
658
659 struct jwxyz_XFontStruct {
660 #if 0
661   XExtData      *ext_data;      /* hook for extension to hang data */
662 #endif
663   Font          fid;            /* Font id for this font */
664 #if 0
665   unsigned      direction;      /* hint about direction the font is painted */
666 #endif
667   unsigned      min_char_or_byte2;      /* first character */
668   unsigned      max_char_or_byte2;      /* last character */
669 #if 0
670   unsigned      min_byte1;      /* first row that exists */
671   unsigned      max_byte1;      /* last row that exists */
672   Bool  all_chars_exist;        /* flag if all characters have non-zero size*/
673 #endif
674   unsigned      default_char;   /* char to print for undefined character */
675 #if 0
676   int         n_properties;   /* how many properties there are */
677   XFontProp     *properties;    /* pointer to array of additional properties*/
678 #endif
679   XCharStruct   min_bounds;     /* minimum bounds over all existing char*/
680   XCharStruct   max_bounds;     /* maximum bounds over all existing char*/
681   XCharStruct   *per_char;      /* first_char to last_char information */
682   int           ascent;         /* log. extent above baseline for spacing */
683   int           descent;        /* log. descent below baseline for spacing */
684 };
685
686 struct jwxyz_XComposeStatus {
687   char dummy;
688 };
689
690 struct  jwxyz_XPixmapFormatValues {
691   int depth;
692   int bits_per_pixel;
693   int scanline_pad;
694 };
695
696 #endif /* __JWXYZ_H__ */