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