|
|
1.1 ! root 1: ! 2: #include <X/mit-copyright.h> ! 3: ! 4: /* $Header: Xlib.h,v 10.20 86/12/16 17:17:31 tony Exp $ */ ! 5: /* Copyright Massachusetts Institute of Technology 1985 */ ! 6: ! 7: /* ! 8: * Xlib.h - Header definition and support file for the C subroutine ! 9: * interface library (Xlib) to the X Window System Protocol. ! 10: * ! 11: */ ! 12: ! 13: extern char *malloc(), *calloc(), *realloc(), *alloca(); ! 14: #ifdef notdef ! 15: #include <sys/types.h> ! 16: #endif ! 17: #include <X/X.h> ! 18: ! 19: #define Status int ! 20: #define XId long ! 21: #define XClearVertexFlag() (_XlibCurrentDisplay->lastdraw = NULL) ! 22: #define XMakePattern(pattern, patlen, patmul)\ ! 23: ((Pattern)(((patmul) << 20) | (((patlen) - 1) << 16) | (pattern) )) ! 24: #define dpyno() (_XlibCurrentDisplay->fd) ! 25: #define RootWindow (_XlibCurrentDisplay->root) ! 26: #define BlackPixmap (_XlibCurrentDisplay->black) ! 27: #define WhitePixmap (_XlibCurrentDisplay->white) ! 28: #define AllPlanes (~0) ! 29: #define QLength() (_XlibCurrentDisplay->qlen) ! 30: #define DisplayType() (_XlibCurrentDisplay->dtype) ! 31: #define DisplayPlanes() (_XlibCurrentDisplay->dplanes) ! 32: #define DisplayCells() (_XlibCurrentDisplay->dcells) ! 33: #define ProtocolVersion() (_XlibCurrentDisplay->vnumber) ! 34: #define DisplayName() (_XlibCurrentDisplay->displayname) ! 35: ! 36: /* Bitmask returned by XParseGeometry(). Each bit tells if the corresponding ! 37: value (x, y, width, height) was found in the parsed string. */ ! 38: ! 39: #define NoValue 0x0000 ! 40: #define XValue 0x0001 ! 41: #define YValue 0x0002 ! 42: #define WidthValue 0x0004 ! 43: #define HeightValue 0x0008 ! 44: #define AllValues 0x000F ! 45: #define XNegative 0x0010 ! 46: #define YNegative 0x0020 ! 47: ! 48: /* Definition of a generic event. It must be cast to a specific event ! 49: * type before one can read event-specific data */ ! 50: ! 51: typedef struct _XEvent { ! 52: unsigned long type; /* of event (KeyPressed, ExposeWindow, etc.) */ ! 53: Window window; /* which selected this event */ ! 54: long pad_l1, pad_l2; /* event-specific data */ ! 55: Window subwindow; /* child window (if any) event actually happened in */ ! 56: long pad_l4; /* event-specific data */ ! 57: } XEvent; ! 58: ! 59: ! 60: /* ! 61: * _QEvent datatype for use in input queueing. ! 62: */ ! 63: typedef struct _qevent { ! 64: struct _qevent *next; ! 65: XEvent event; ! 66: } _QEvent; ! 67: ! 68: ! 69: /* ! 70: * Display datatype maintaining display specific data. ! 71: */ ! 72: typedef struct _display { ! 73: int fd; /* Network socket. */ ! 74: Window root; /* Root window id. */ ! 75: int vnumber; /* X protocol version number. */ ! 76: int dtype; /* X server display device type. */ ! 77: int dplanes; /* Number of display bit planes. */ ! 78: int dcells; /* Number of display color map cells. */ ! 79: _QEvent *head, *tail; /* Input event queue. */ ! 80: int qlen; /* Length of input event queue */ ! 81: int request; /* Id of last request. */ ! 82: char * lastdraw; /* Last draw request. */ ! 83: char *buffer; /* Output buffer starting address. */ ! 84: char *bufptr; /* Output buffer index pointer. */ ! 85: char *bufmax; /* Output buffer maximum+1 address. */ ! 86: int squish; /* Squish MouseMoved events? */ ! 87: Pixmap black, white; /* Constant tile pixmaps */ ! 88: char *displayname; /* "host:display" string used on this connect*/ ! 89: int width, height; /* width and height of display */ ! 90: } Display; ! 91: ! 92: ! 93: /* ! 94: * XAssoc - Association elements used in the XAssocTable data structure. ! 95: * XAssoc's are used as bucket entries in the association table. ! 96: */ ! 97: typedef struct _x_assoc { ! 98: struct _x_assoc *next; /* Next object in this bucket. */ ! 99: struct _x_assoc *prev; /* Previous obejct in this bucket. */ ! 100: Display *display; /* Display which ownes the id. */ ! 101: XId x_id; /* X Window System id. */ ! 102: char *data; /* Pointer to untyped memory. */ ! 103: } XAssoc; ! 104: ! 105: /* ! 106: * XAssocTable - X Window System id to data structure pointer association ! 107: * table. An XAssocTable is a hash table who's buckets are circular ! 108: * queue's of XAssoc's. The XAssocTable is constructed from an array of ! 109: * XAssoc's which are the circular queue headers (bucket headers). ! 110: * An XAssocTable consists an XAssoc pointer that points to the first ! 111: * bucket in the bucket array and an integer that indicates the number ! 112: * of buckets in the array. ! 113: */ ! 114: typedef struct _x_assoc_table { ! 115: struct _x_assoc *buckets; /* Pointer to first bucket in bucket array.*/ ! 116: int size; /* Table size (number of buckets). */ ! 117: } XAssocTable; ! 118: ! 119: /* ! 120: * Declare the XAssocTable routines that don't return int. ! 121: */ ! 122: extern char *XLookUpAssoc(); ! 123: XAssocTable *XCreateAssocTable(); ! 124: ! 125: ! 126: /* ! 127: * Data returned by XQueryWindow. ! 128: */ ! 129: typedef struct _WindowInfo { ! 130: short width, height; /* Width and height. */ ! 131: short x, y; /* X and y coordinates. */ ! 132: short bdrwidth; /* Border width. */ ! 133: short mapped; /* IsUnmapped, IsMapped or IsInvisible.*/ ! 134: short type; /* IsTransparent, IsOpaque or IsIcon. */ ! 135: Window assoc_wind; /* Associated icon or opaque Window. */ ! 136: } WindowInfo; ! 137: ! 138: ! 139: /* ! 140: * Data returned by XQueryFont. ! 141: */ ! 142: typedef struct _FontInfo { ! 143: Font id; ! 144: short height, width, baseline, fixedwidth; ! 145: unsigned char firstchar, lastchar; ! 146: short *widths; /* pointer to width array in OpenFont */ ! 147: } FontInfo; ! 148: ! 149: ! 150: /* ! 151: * Data structure used by color operations; ints rather than shorts ! 152: * to keep 16 bit protocol limitation out of the library. ! 153: */ ! 154: typedef struct _Color { ! 155: int pixel; ! 156: unsigned short red, green, blue; ! 157: } Color; ! 158: ! 159: ! 160: /* ! 161: * Data structure use by XCreateTiles. ! 162: */ ! 163: typedef struct _TileFrame { ! 164: int pixel; /* Pixel color for constructing the tile. */ ! 165: Pixmap pixmap; /* Pixmap id of the pixmap, filled in later. */ ! 166: } TileFrame; ! 167: ! 168: ! 169: /* ! 170: * Data structures used by XCreateWindows XCreateTransparencies and ! 171: * XCreateWindowBatch. ! 172: */ ! 173: typedef struct _OpaqueFrame { ! 174: Window self; /* window id of the window, filled in later */ ! 175: short x, y; /* where to create the window */ ! 176: short width, height; /* width and height */ ! 177: short bdrwidth; /* border width */ ! 178: Pixmap border; /* border pixmap */ ! 179: Pixmap background; /* background */ ! 180: } OpaqueFrame; ! 181: ! 182: typedef struct _TransparentFrame { ! 183: Window self; /* window id of the window, filled in later */ ! 184: short x, y; /* where to create the window */ ! 185: short width, height; /* width and height */ ! 186: } TransparentFrame; ! 187: ! 188: typedef struct _BatchFrame { ! 189: short type; /* One of (IsOpaque, IsTransparent). */ ! 190: Window parent; /* Window if of the window's parent. */ ! 191: Window self; /* Window id of the window, filled in later. */ ! 192: short x, y; /* Where to create the window. */ ! 193: short width, height; /* Window width and height. */ ! 194: short bdrwidth; /* Window border width. */ ! 195: Pixmap border; /* Window border pixmap */ ! 196: Pixmap background; /* Window background pixmap. */ ! 197: } BatchFrame; ! 198: ! 199: ! 200: /* ! 201: * Definitions of specific events ! 202: * In all of the following, fields whose names begin with "pad" contain ! 203: * no meaningful value. ! 204: */ ! 205: ! 206: struct _XKeyOrButtonEvent { ! 207: unsigned long type; /* of event (KeyPressed, ButtonReleased, etc.) */ ! 208: Window window; /* which selected this event */ ! 209: unsigned short time B16; /* in 10 millisecond ticks */ ! 210: short detail B16; /* event-dependent data (key state, etc.) */ ! 211: short x B16; /* mouse x coordinate within event window */ ! 212: short y B16; /* mouse y coordinate within event window */ ! 213: Window subwindow; /* child window (if any) mouse was in */ ! 214: Locator location; /* absolute coordinates of mouse */ ! 215: }; ! 216: ! 217: typedef struct _XKeyOrButtonEvent XKeyOrButtonEvent; ! 218: ! 219: typedef struct _XKeyOrButtonEvent XKeyEvent; ! 220: typedef struct _XKeyOrButtonEvent XKeyPressedEvent; ! 221: typedef struct _XKeyOrButtonEvent XKeyReleasedEvent; ! 222: ! 223: typedef struct _XKeyOrButtonEvent XButtonEvent; ! 224: typedef struct _XKeyOrButtonEvent XButtonPressedEvent; ! 225: typedef struct _XKeyOrButtonEvent XButtonReleasedEvent; ! 226: ! 227: struct _XMouseOrCrossingEvent { ! 228: unsigned long type; /* EnterWindow, LeaveWindow, or MouseMoved */ ! 229: Window window; /* which selected this event */ ! 230: short pad_s2 B16; ! 231: short detail B16; /* event-dependent data (key state, etc. ) */ ! 232: short x B16; /* mouse x coordinate within event window */ ! 233: short y B16; /* mouse y coordinate within event window */ ! 234: Window subwindow; /* child window (if any) mouse was in */ ! 235: Locator location; /* absolute coordinates of mouse */ ! 236: }; ! 237: ! 238: typedef struct _XMouseOrCrossingEvent XMouseOrCrossingEvent; ! 239: ! 240: typedef struct _XMouseOrCrossingEvent XMouseEvent; ! 241: typedef struct _XMouseOrCrossingEvent XMouseMovedEvent; ! 242: ! 243: typedef struct _XMouseOrCrossingEvent XCrossingEvent; ! 244: typedef struct _XMouseOrCrossingEvent XEnterWindowEvent; ! 245: typedef struct _XMouseOrCrossingEvent XLeaveWindowEvent; ! 246: ! 247: struct _XExposeEvent { ! 248: unsigned long type; /* ExposeWindow or ExposeRegion */ ! 249: Window window; /* that selected this event */ ! 250: short pad_s2 B16; ! 251: short detail B16; /* 0 or ExposeCopy */ ! 252: short width B16; /* width of exposed area */ ! 253: short height B16; /* height of exposed area */ ! 254: Window subwindow; /* child window (if any) actually exposed */ ! 255: short y B16; /* top of exposed area (0 for ExposeWindow) */ ! 256: short x B16; /* left edge of exposed area (0 for ExposeWindow) */ ! 257: }; ! 258: ! 259: typedef struct _XExposeEvent XExposeEvent; ! 260: typedef struct _XExposeEvent XExposeWindowEvent; ! 261: typedef struct _XExposeEvent XExposeRegionEvent; ! 262: ! 263: typedef struct _XExposeCopyEvent { ! 264: unsigned long type; /* ExposeCopy */ ! 265: Window window; /* that selected this event */ ! 266: long pad_l1; ! 267: long pad_l2; ! 268: Window subwindow; /* child window (if any) actually exposed */ ! 269: long pad_l4; ! 270: } XExposeCopyEvent; ! 271: ! 272: typedef struct _XUnmapEvent { ! 273: unsigned long type; /* UnmapWindow */ ! 274: Window window; /* that selected this event */ ! 275: long pad_l1; ! 276: long pad_l2; ! 277: Window subwindow; /* child window (if any) actually unmapped */ ! 278: long pad_l4; ! 279: } XUnmapEvent; ! 280: ! 281: typedef struct _XFocusChangeEvent { ! 282: unsigned long type; /* FocusChange */ ! 283: Window window; /* that selected this event */ ! 284: short pad_s2 B16; ! 285: short detail B16; /* EnterWindow or LeaveWindow */ ! 286: long pad_l2; ! 287: Window subwindow; /* child window (if any) of actual focus change*/ ! 288: long pad_l4; ! 289: } XFocusChangeEvent; ! 290: ! 291: typedef struct _XErrorEvent { ! 292: long pad; ! 293: long serial; /* serial number of failed request */ ! 294: char error_code; /* error code of failed request */ ! 295: char request_code; /* request code of failed request */ ! 296: char func; /* function field of failed request */ ! 297: char pad_b7; ! 298: Window window; /* Window of failed request */ ! 299: long pad_l3; ! 300: long pad_l4; ! 301: } XErrorEvent; ! 302: ! 303: /* ! 304: * Line pattern related definitions for the library. ! 305: */ ! 306: typedef long Pattern; ! 307: ! 308: #define DashedLine XMakePattern(0xf0f0, 16, 1) ! 309: #define DottedLine XMakePattern(0xaaaa, 16, 1) ! 310: #define DotDashLine XMakePattern(0xf4f4, 16, 1) ! 311: #define SolidLine XMakePattern(1,1,1) ! 312: ! 313: typedef short KeyMapEntry [8]; ! 314: ! 315: /* define values for keyboard map table */ ! 316: /* these values will vanish in the next version; DO NOT USE THEM! */ ! 317: #define SHFT (short) -2 ! 318: #define CNTL (short) -3 ! 319: #define LOCK (short) -4 ! 320: #define SYMBOL (short) -5 ! 321: #define KEYPAD (short) -6 ! 322: #define CURSOR (short) -7 ! 323: #define PFX (short) -8 ! 324: #define FUNC1 (short) -9 ! 325: #define FUNC2 (short) -10 ! 326: #define FUNC3 (short) -11 ! 327: #define FUNC4 (short) -12 ! 328: #define FUNC5 (short) -13 ! 329: #define FUNC6 (short) -14 ! 330: #define FUNC7 (short) -15 ! 331: #define FUNC8 (short) -16 ! 332: #define FUNC9 (short) -17 ! 333: #define FUNC10 (short) -18 ! 334: #define FUNC11 (short) -19 ! 335: #define FUNC12 (short) -20 ! 336: #define FUNC13 (short) -21 ! 337: #define FUNC14 (short) -22 ! 338: #define FUNC15 (short) -23 ! 339: #define FUNC16 (short) -24 ! 340: #define FUNC17 (short) -25 ! 341: #define FUNC18 (short) -26 ! 342: #define FUNC19 (short) -27 ! 343: #define FUNC20 (short) -28 ! 344: #define E1 (short) -29 ! 345: #define E2 (short) -30 ! 346: #define E3 (short) -31 ! 347: #define E4 (short) -32 ! 348: #define E5 (short) -33 ! 349: #define E6 (short) -34 ! 350: ! 351: ! 352: /* ! 353: * X function declarations. ! 354: */ ! 355: Display *XOpenDisplay(); ! 356: ! 357: char *XFetchBytes(); ! 358: char * XFetchBuffer(); ! 359: ! 360: char *XErrDescrip(); ! 361: char *XLookupMapping(); ! 362: ! 363: short *XFontWidths(); ! 364: FontInfo *XOpenFont(); ! 365: extern Display *_XlibCurrentDisplay; ! 366: char *XGetDefault(); ! 367: Bitmap XCharBitmap(), XStoreBitmap(); ! 368: Pixmap XMakePixmap(), XMakeTile(), XStorePixmapXY(), XStorePixmapZ(); ! 369: Pixmap XPixmapSave(); ! 370: Cursor XCreateCursor(), XStoreCursor(); ! 371: Window XCreate(), XCreateTerm(), XCreateTransparency(), XCreateWindow(); ! 372: Window XGetIconWindow(); ! 373: Font XGetFont(); ! 374: Status XFetchName(), XGetColorCells(), XGetColor(), XGetHardwareColor(); ! 375: Status XGetResizeHint(), XGrabButton(), XGrabMouse(), XInterpretLocator(); ! 376: Status XParseColor(), XPixmapGetXY(), XPixmapGetZ(), XQueryMouseButtons(); ! 377: Status XQueryFont(), XQueryMouse(), XQueryTree(), XQueryWindow(); ! 378: Status XReadBitmapFile(), XUpdateMouse(); ! 379: XAssocTable *XCreateAssocTable();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.