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