5e1767a8a437870a0ab22c6f3dfb8f127616fe89
[xscreensaver] / OSX / jwxyz.h
1 /* xscreensaver, Copyright (c) 1991-2007 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);
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 extern Font XGContextFromGC (GC);
381
382 extern Pixmap XCreatePixmap (Display *, Drawable,
383                              unsigned int width, unsigned int height,
384                              unsigned int depth);
385 extern int XFreePixmap (Display *, Pixmap);
386
387 // Xt timers and fds
388 extern XtAppContext XtDisplayToApplicationContext (Display *);
389 typedef void (*XtTimerCallbackProc) (XtPointer closure, XtIntervalId *);
390 typedef void (*XtInputCallbackProc) (XtPointer closure, int *fd, XtInputId *);
391 extern XtIntervalId XtAppAddTimeOut (XtAppContext, unsigned long usecs,
392                                      XtTimerCallbackProc, XtPointer closure);
393 extern void XtRemoveTimeOut (XtIntervalId);
394 extern XtInputId XtAppAddInput (XtAppContext, int fd, XtPointer flags,
395                                XtInputCallbackProc, XtPointer closure);
396 extern void XtRemoveInput (XtInputId);
397 extern struct jwxyz_sources_data *display_sources_data (Display *);
398
399 // Some GLX stuff that also doesn't technically belong here...
400 // from XScreenSaverGLView.m
401 extern void glXSwapBuffers (Display *, Window);
402 extern void glXMakeCurrent (Display *, Window, GLXContext);
403
404 // also declared in utils/visual.h
405 extern int has_writable_cells (Screen *, Visual *);
406 extern int visual_depth (Screen *, Visual *);
407 extern int visual_cells (Screen *, Visual *);
408 extern int visual_class (Screen *, Visual *);
409
410 // also declared in utils/grabclient.h
411 extern Bool use_subwindow_mode_p (Screen *, Window);
412
413 // for aglUseFont
414 extern int jwxyz_font_info (Font, int *size_ret, int *face_ret);
415
416
417 struct jwxyz_Visual {
418   VisualID visualid;    /* visual id of this visual */
419   int class;            /* class of screen (monochrome, etc.) */
420   unsigned long red_mask, green_mask, blue_mask;        /* mask values */
421   int bits_per_rgb;     /* log base 2 of distinct color values */
422 //  int map_entries;    /* color map entries */
423 };
424
425 struct jwxyz_XGCValues {
426   int function;         /* logical operation */
427 #if 0
428   unsigned long plane_mask;/* plane mask */
429 #endif
430   unsigned long foreground;/* foreground pixel */
431   unsigned long background;/* background pixel */
432   int line_width;       /* line width */
433 #if 0
434   int line_style;       /* LineSolid, LineOnOffDash, LineDoubleDash */
435 #endif
436   int cap_style;        /* CapNotLast, CapButt, CapRound, CapProjecting */
437   int join_style;       /* JoinMiter, JoinRound, JoinBevel */
438 #if 0
439   int fill_style;       /* FillSolid, FillTiled, 
440                            FillStippled, FillOpaeueStippled */
441 #endif
442   int fill_rule;        /* EvenOddRule, WindingRule */
443 #if 0
444   int arc_mode;         /* ArcChord, ArcPieSlice */
445   Pixmap tile;          /* tile pixmap for tiling operations */
446   Pixmap stipple;       /* stipple 1 plane pixmap for stipping */
447   int ts_x_origin;      /* offset for tile or stipple operations */
448   int ts_y_origin;
449 #endif
450   Font font;            /* default text font for text operations */
451   int subwindow_mode;     /* ClipByChildren, IncludeInferiors */
452 #if 0
453   Bool graphics_exposures;/* boolean, should exposures be generated */
454 #endif
455   int clip_x_origin;    /* origin for clipping */
456   int clip_y_origin;
457   Pixmap clip_mask;     /* bitmap clipping; other calls for rects */
458 #if 0
459   int dash_offset;      /* patterned/dashed line information */
460   char dashes;
461 #endif
462
463   Bool alpha_allowed_p; /* jwxyz extension: whether pixel values may have
464                            a non-opaque alpha component. */
465   Bool antialias_p;     /* jwxyz extension: whether Quartz should draw
466                            with antialiasing. */
467 };
468
469 struct jwxyz_XWindowAttributes {
470     int x, y;                   /* location of window */
471     int width, height;          /* width and height of window */
472     int border_width;           /* border width of window */
473     int depth;                  /* depth of window */
474     Visual *visual;             /* the associated visual structure */
475 #if 0
476     Window root;                /* root of screen containing window */
477     int class;                  /* InputOutput, InputOnly*/
478     int bit_gravity;            /* one of bit gravity values */
479     int win_gravity;            /* one of the window gravity values */
480     int backing_store;          /* NotUseful, WhenMapped, Always */
481     unsigned long backing_planes;/* planes to be preserved if possible */
482     unsigned long backing_pixel;/* value to be used when restoring planes */
483     Bool save_under;            /* boolean, should bits under be saved? */
484 #endif
485     Colormap colormap;          /* color map to be associated with window */
486 #if 0
487     Bool map_installed;         /* boolean, is color map currently installed*/
488     int map_state;              /* IsUnmapped, IsUnviewable, IsViewable */
489     long all_event_masks;       /* set of events all people have interest in*/
490     long your_event_mask;       /* my event mask */
491     long do_not_propagate_mask; /* set of events that should not propagate */
492     Bool override_redirect;     /* boolean value for override-redirect */
493 #endif
494     Screen *screen;             /* back pointer to correct screen */
495 };
496
497 struct jwxyz_XColor {
498   unsigned long pixel;
499   unsigned short red, green, blue;
500   char flags;  /* do_red, do_green, do_blue */
501   char pad;
502 };
503
504 struct jwxyz_XPoint {
505   short x, y;
506 };
507
508 struct jwxyz_XSegment {
509   short x1, y1, x2, y2;
510 };
511
512 struct jwxyz_XRectangle {
513   short x, y;
514   unsigned short width, height;
515 };
516
517 struct jwxyz_XArc {
518   short x, y;
519   unsigned short width, height;
520   short angle1, angle2;
521 };
522
523
524 struct jwxyz_XrmOptionDescRec {
525   char *option;
526   char *specifier;
527   int argKind;
528   void *value;
529 };
530
531 struct jwxyz_XAnyEvent {
532   int type;
533 #if 0
534   unsigned long serial;
535   Bool send_event;
536   Display *display;
537   Window window;
538 #endif
539 };
540
541 struct jwxyz_XKeyEvent {
542   int type;
543 #if 0
544   unsigned long serial;
545   Bool send_event;
546   Display *display;
547   Window window;
548   Window root;
549   Window subwindow;
550   Time time;
551   int x, y;
552   int x_root, y_root;
553 #endif
554   unsigned int state;
555   unsigned int keycode;
556 #if 0
557   Bool same_screen;
558 #endif
559 };
560
561 struct jwxyz_XButtonEvent {
562   int type;
563 #if 0
564   unsigned long serial;
565   Bool send_event;
566   Display *display;
567   Window window;
568   Window root;
569   Window subwindow;
570   Time time;
571 #endif
572   int x, y;
573 #if 0
574   int x_root, y_root;
575 #endif
576   unsigned int state;
577   unsigned int button;
578 #if 0
579   Bool same_screen;
580 #endif
581 };
582
583 struct jwxyz_XMotionEvent {
584   int type;
585 #if 0
586   unsigned long serial;
587   Bool send_event;
588   Display *display;
589   Window window;
590   Window root;
591   Window subwindow;
592   Time time;
593 #endif
594   int x, y;
595 #if 0
596   int x_root, y_root;
597 #endif
598   unsigned int state;
599 #if 0
600   char is_hint;
601   Bool same_screen;
602 #endif
603 };
604
605 union jwxyz_XEvent {
606   int type;
607   XAnyEvent xany;
608   XKeyEvent xkey;
609   XButtonEvent xbutton;
610   XMotionEvent xmotion;
611 };
612
613 struct jwxyz_XImage {
614     int width, height;          /* size of image */
615     int xoffset;                /* number of pixels offset in X direction */
616     int format;                 /* XYBitmap, XYPixmap, ZPixmap */
617     char *data;                 /* pointer to image data */
618     int byte_order;             /* data byte order, LSBFirst, MSBFirst */
619     int bitmap_unit;            /* quant. of scanline 8, 16, 32 */
620     int bitmap_bit_order;       /* LSBFirst, MSBFirst */
621     int bitmap_pad;             /* 8, 16, 32 either XY or ZPixmap */
622     int depth;                  /* depth of image */
623     int bytes_per_line;         /* accelarator to next line */
624     int bits_per_pixel;         /* bits per pixel (ZPixmap) */
625     unsigned long red_mask;     /* bits in z arrangment */
626     unsigned long green_mask;
627     unsigned long blue_mask;
628 //  XPointer obdata;            /* hook for the object routines to hang on */
629     struct funcs {              /* image manipulation routines */
630 #if 0
631       XImage *(*create_image)(
632                 Display*        /* display */,
633                 Visual*         /* visual */,
634                 unsigned int    /* depth */,
635                 int             /* format */,
636                 int             /* offset */,
637                 char*           /* data */,
638                 unsigned int    /* width */,
639                 unsigned int    /* height */,
640                 int             /* bitmap_pad */,
641                 int             /* bytes_per_line */);
642         int (*destroy_image)        (XImage *);
643 #endif
644         unsigned long (*get_pixel)  (XImage *, int, int);
645         int (*put_pixel)            (XImage *, int, int, unsigned long);
646 #if 0
647         XImage *(*sub_image)        (XImage *, int, int, unsigned int, unsigned int);
648         int (*add_pixel)            (XImage *, long);
649 #endif
650     } f;
651 };
652
653 struct jwxyz_XCharStruct {
654   short lbearing;       /* origin to left edge of raster */
655   short rbearing;       /* origin to right edge of raster */
656   short width;          /* advance to next char's origin */
657   short ascent;         /* baseline to top edge of raster */
658   short descent;        /* baseline to bottom edge of raster */
659 #if 0
660   unsigned short attributes;    /* per char flags (not predefined) */
661 #endif
662 };
663
664 struct jwxyz_XFontStruct {
665 #if 0
666   XExtData      *ext_data;      /* hook for extension to hang data */
667 #endif
668   Font          fid;            /* Font id for this font */
669 #if 0
670   unsigned      direction;      /* hint about direction the font is painted */
671 #endif
672   unsigned      min_char_or_byte2;      /* first character */
673   unsigned      max_char_or_byte2;      /* last character */
674 #if 0
675   unsigned      min_byte1;      /* first row that exists */
676   unsigned      max_byte1;      /* last row that exists */
677   Bool  all_chars_exist;        /* flag if all characters have non-zero size*/
678 #endif
679   unsigned      default_char;   /* char to print for undefined character */
680 #if 0
681   int         n_properties;   /* how many properties there are */
682   XFontProp     *properties;    /* pointer to array of additional properties*/
683 #endif
684   XCharStruct   min_bounds;     /* minimum bounds over all existing char*/
685   XCharStruct   max_bounds;     /* maximum bounds over all existing char*/
686   XCharStruct   *per_char;      /* first_char to last_char information */
687   int           ascent;         /* log. extent above baseline for spacing */
688   int           descent;        /* log. descent below baseline for spacing */
689 };
690
691 struct jwxyz_XComposeStatus {
692   char dummy;
693 };
694
695 struct  jwxyz_XPixmapFormatValues {
696   int depth;
697   int bits_per_pixel;
698   int scanline_pad;
699 };
700
701 #endif /* __JWXYZ_H__ */