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