home *** CD-ROM | disk | FTP | other *** search
- /*
- xlib.h
- mac hack at X window calls
- oct91
- */
-
- #include <Types.h>
-
- typedef char Bool;
-
- #define DoRed 1
- #define DoBlue 2
- #define DoGreen 4
-
- #define XYBitmap 1
- #define XYPixmap 2
- #define ZPixmap 3
-
- #define LSBFirst 0
- #define MSBFirst 1
- #define AllocNone 0
-
- typedef int* Colormap;
- typedef char* Pixmap;
- typedef int Display;
- typedef Pixmap Drawable; // Pixmap is used as drawable in some places...
- typedef Pixmap Window;
- typedef int xCursor;
- typedef int GC;
- typedef int Visual;
- typedef int VisualID;
-
-
- typedef struct {
- int x,y;
- int width,height;
- } XRectangle;
-
- typedef struct {
- unsigned long pixel;
- unsigned short red,green,blue;
- char flags;
- char pad;
- } XColor;
-
- typedef struct _XImage {
- int width,height; // size of image
- int xoffset; //num pixels offset in X direction
- int format; //XYBitmap,XYPixmap,ZPixmap
- char *data; // ptr to image
- int byte_order; //data byte order LSB/MSBFirst
- int bitmap_unit; //scanline 8/16/32
- int bitmap_bit_order; //LSB/MSBFirst
- int bitmap_pad; // 8/16/32 for Pixmaps
- int depth; //depth of image
- int bytes_per_line; //
- int bits_per_pixel; //ZPixmap
- unsigned long red_mask; //
- unsigned long green_mask;
- unsigned long blue_mask;
- char *obdata; //hook for object routines
- struct funcs { //image manip routines
- struct _XImage *(*create_image)();
- int (*destroy_image)();
- unsigned long (*get_pixel)();
- int (*put_pixel)();
- struct _XImage *(*sub_image)();
- int (*add_pixel)();
- } f;
- } XImage;
-
-
- typedef struct {
- Pixmap background_pixmap;
- unsigned long background_pixel;
- Pixmap border_pixmap;
- unsigned long border_pixel;
- int bit_gravity;
- int win_gravity;
- int backing_store;
- unsigned long backing_planes;
- unsigned long backing_pixel;
- Bool save_under;
- long event_mask;
- long do_not_propogate_mask;
- Bool override_redirect;
- Colormap colormap;
- xCursor cursor;
- } XSetWindowAttributes;
-
- typedef struct {
- Visual *visual;
- VisualID visualid;
- int screen;
- unsigned int depth;
- int class;
- unsigned long red_mask;
- unsigned long green_mask;
- unsigned long blue_mask;
- int colormap_size;
- int bits_per_rgb;
- } XVisualInfo;
-
-
- #define XSync(dsp, flag)
- #define XSetClipMask(dsp, gc, a)
- #define XSetClipRectangles(dsp, gc, a,b,c,d,e)
- #define XDrawImageString(dsp, win, gc, a,b,c,d)
- #define XDrawString(dsp, win, gc, x,y, s, slen)
- #define XSetFillStyle(dsp, gc, a);
- #define XFreeColormap(dsp, cmap)
- #define XMapWindow(dsp, win)
- #define XCreateWindow(dsp, win, x, y, w, h, z, d, io, vis, bs, xswa) (Window)NULL
- #define XMoveResizeWindow(dsp, win, x, y, w, h)
- #define XUnmapWindow(dsp, win)
- #define XDestroyWindow(dsp, win)
- #define XDrawLine(dsp, win, gc, x1, y1, x2, y2)
- #define XDrawPoint(dsp, win, gc, x, y)
-
- XImage *XCreateImage(
- Display *dsp,
- Visual *vis,
- unsigned int depth,
- int format,
- int offset,
- char *data,
- unsigned int width,
- unsigned int height,
- int bitmap_pad,
- int bytes_per_line);
-
- void XPutImage(
- Display *dsp,
- Drawable win,
- GC gc,
- XImage *image,
- int src_x,
- int src_y,
- int dest_x,
- int dest_y,
- unsigned int width,
- unsigned int height);
-
- void XCopyArea(
- Display *dsp,
- Drawable src,
- Drawable dest,
- GC gc,
- int src_x,
- int src_y,
- unsigned int width,
- unsigned int height,
- int dest_x,
- int dest_y);
-
- Pixmap XCreatePixmap(
- Display *dsp,
- Drawable win,
- unsigned int width,
- unsigned int height,
- unsigned int depth);
-
- void XFreePixmap(
- Display *dsp,
- Pixmap pix);
-
- Display *XOpenDisplay( char* name);
-
- XResizeWindow( dsp, win, width, height);
-
- void XSetWindowColormap(
- Display *dsp,
- Drawable win,
- Colormap cmap);
-
- XAllocColorCells( dsp, cmap, contig, plane_masks_return,
- nplanes, pixels_return, npixels);
- /***
- int XAllocColorCells(
- Display *dsp,
- Colormap cmap,
- Bool contig,
- unsigned long plane_masks_return[],
- unsigned int nplanes,
- unsigned long pixels_return[],
- unsigned int npixels);
- *****/
-
- void XStoreColors(
- Display *dsp,
- Colormap cmap,
- XColor color[],
- int ncolors);
-
- Colormap XCreateColormap(
- Display *dsp,
- Window win,
- Visual *vis,
- int allocflag);
-
- void XSetForeground(
- Display *dsp,
- GC gc,
- unsigned long foreground);
-
- void XSetBackground(
- Display *dsp,
- GC gc,
- unsigned long background);
-
- void XFillRectangle(
- Display *dsp,
- Drawable win,
- GC gc,
- int x,
- int y,
- int width,
- int height);
-
- void XFillRectangles(
- Display *dsp,
- Drawable win,
- GC gc,
- XRectangle *rects,
- int nrects);
-
- Bool optionKeyIsDown();
- Bool capsLockIsDown();
- Bool shiftKeyIsDown();
- Bool cmdKeyIsDown();
- Bool StopKey();
- Bool MouseButton();
- Bool Keypress();
- int usleep( unsigned long usec);
- long hundredthsofseconds();
-
- char *StdGetFile(
- char* prompt,
- OSType fileTypes[],
- int nFileTypes);
-
-