1 /* xscreensaver, Copyright (c) 1991-2015 Jamie Zawinski <jwz@jwz.org>
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
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.
22 extern void jwxyz_abort(const char *fmt, ...) __dead2;
23 #define abort() jwxyz_abort("abort in %s:%d", __FUNCTION__, __LINE__)
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 *. */
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;
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;
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)
83 #define XtIMAlternateInput 4
85 #define XtIMAll (XtIMXEvent | XtIMTimer | XtIMAlternateInput | XtIMSignal)
93 #define Window Drawable
94 #define Pixmap Drawable
96 #define XrmoptionNoArg 0
97 #define XrmoptionSepArg 1
99 #define CoordModeOrigin 0
100 #define CoordModePrevious 1
103 #define LineOnOffDash 1
104 #define LineDoubleDash 2
109 #define CapProjecting 3
117 #define FillStippled 2
118 #define FillOpaqueStippled 3
120 #define EvenOddRule 0
121 #define WindingRule 1
136 #define StaticColor 2
137 #define PseudoColor 3
139 #define DirectColor 5
145 #define DoGreen (1<<1)
146 #define DoBlue (1<<2)
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)
174 #define ButtonPress 4
175 #define ButtonRelease 5
176 #define MotionNotify 6
178 #define GraphicsExpose 13
180 #define VisibilityNotify 15
182 #define ClipByChildren 0
183 #define IncludeInferiors 1
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)
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)
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
226 #define XK_Home 0xFF50
227 #define XK_Left 0xFF51
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
247 #define XK_F10 0xFFC7
248 #define XK_F11 0xFFC8
249 #define XK_F12 0xFFC9
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 */
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)
292 #define ScreenCount(dpy) jwxyz_ScreenCount(dpy)
293 extern int jwxyz_ScreenCount(Display *);
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,
301 extern void jwxyz_mouse_moved (Display *, Window, int x, int y);
302 extern void jwxyz_flush_context (Display *);
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);
313 unsigned long XBlackPixelOfScreen(Screen *);
314 unsigned long XWhitePixelOfScreen(Screen *);
315 unsigned long XCellsOfScreen(Screen *);
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);
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);
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);
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);
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);
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);
388 extern int XDrawString (Display *, Drawable, GC, int x, int y, const char *,
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);
395 extern Bool XQueryPointer (Display *, Window, Window *root_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,
402 extern KeySym XKeycodeToKeysym (Display *, KeyCode, int index);
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);
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,
423 unsigned int w, unsigned int h,
427 extern XPixmapFormatValues *XListPixmapFormats (Display *, int *count_ret);
429 extern void jwxyz_draw_NSImage_or_CGImage (Display *, Drawable,
430 Bool nsimg_p, void *NSImage_arg,
431 XRectangle *geom_ret,
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,
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);
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);
469 extern Pixmap XCreatePixmap (Display *, Drawable,
470 unsigned int width, unsigned int height,
472 extern int XFreePixmap (Display *, Pixmap);
474 extern char *XGetAtomName (Display *, Atom);
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 *);
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);
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 *);
503 // also declared in utils/grabclient.h
504 extern Bool use_subwindow_mode_p (Screen *, Window);
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 */
515 struct jwxyz_XGCValues {
516 int function; /* logical operation */
518 unsigned long plane_mask;/* plane mask */
520 unsigned long foreground;/* foreground pixel */
521 unsigned long background;/* background pixel */
522 int line_width; /* line width */
524 int line_style; /* LineSolid, LineOnOffDash, LineDoubleDash */
526 int cap_style; /* CapNotLast, CapButt, CapRound, CapProjecting */
527 int join_style; /* JoinMiter, JoinRound, JoinBevel */
529 int fill_style; /* FillSolid, FillTiled,
530 FillStippled, FillOpaeueStippled */
532 int fill_rule; /* EvenOddRule, WindingRule */
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 */
540 Font font; /* default text font for text operations */
541 int subwindow_mode; /* ClipByChildren, IncludeInferiors */
543 Bool graphics_exposures;/* boolean, should exposures be generated */
545 int clip_x_origin; /* origin for clipping */
547 Pixmap clip_mask; /* bitmap clipping; other calls for rects */
549 int dash_offset; /* patterned/dashed line information */
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. */
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 */
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? */
575 Colormap colormap; /* color map to be associated with window */
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 */
584 Screen *screen; /* back pointer to correct screen */
587 struct jwxyz_XColor {
589 unsigned short red, green, blue;
590 char flags; /* do_red, do_green, do_blue */
594 struct jwxyz_XPoint {
598 struct jwxyz_XSegment {
599 short x1, y1, x2, y2;
602 struct jwxyz_XRectangle {
604 unsigned short width, height;
609 unsigned short width, height;
610 short angle1, angle2;
614 struct jwxyz_XrmOptionDescRec {
621 struct jwxyz_XAnyEvent {
624 unsigned long serial;
631 struct jwxyz_XKeyEvent {
634 unsigned long serial;
645 unsigned int keycode;
651 struct jwxyz_XButtonEvent {
654 unsigned long serial;
673 struct jwxyz_XMotionEvent {
676 unsigned long serial;
699 XButtonEvent xbutton;
700 XMotionEvent xmotion;
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 */
721 XImage *(*create_image)(
722 Display* /* display */,
723 Visual* /* visual */,
724 unsigned int /* depth */,
728 unsigned int /* width */,
729 unsigned int /* height */,
730 int /* bitmap_pad */,
731 int /* bytes_per_line */);
732 int (*destroy_image) (XImage *);
734 unsigned long (*get_pixel) (XImage *, int, int);
735 int (*put_pixel) (XImage *, int, int, unsigned long);
737 XImage *(*sub_image) (XImage *, int, int, unsigned int, unsigned int);
738 int (*add_pixel) (XImage *, long);
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 */
750 unsigned short attributes; /* per char flags (not predefined) */
754 struct jwxyz_XFontProp {
756 unsigned long card32; /* Careful: This holds (32- or 64-bit) pointers. */
759 struct jwxyz_XFontStruct {
761 XExtData *ext_data; /* hook for extension to hang data */
763 Font fid; /* Font id for this font */
765 unsigned direction; /* hint about direction the font is painted */
767 unsigned min_char_or_byte2; /* first character */
768 unsigned max_char_or_byte2; /* last character */
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*/
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 */
784 struct jwxyz_XComposeStatus {
788 struct jwxyz_XPixmapFormatValues {
794 struct jwxyz_XChar2b {
799 #endif /* __JWXYZ_H__ */