📄 xlibint.h
字号:
WORD64ALIGN\ if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\ _XFlush(dpy);\ req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\ req->reqType = X_##name;\ req->length = (SIZEOF(x##name##Req))>>2;\ dpy->bufptr += SIZEOF(x##name##Req);\ dpy->request++#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */#define GetReq(name, req) \ WORD64ALIGN\ if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\ _XFlush(dpy);\ req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\ req->reqType = X_/**/name;\ req->length = (SIZEOF(x/**/name/**/Req))>>2;\ dpy->bufptr += SIZEOF(x/**/name/**/Req);\ dpy->request++#endif/* GetReqExtra is the same as GetReq, but allocates "n" additional bytes after the request. "n" must be a multiple of 4! */#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)#define GetReqExtra(name, n, req) \ WORD64ALIGN\ if ((dpy->bufptr + SIZEOF(x##name##Req) + n) > dpy->bufmax)\ _XFlush(dpy);\ req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\ req->reqType = X_##name;\ req->length = (SIZEOF(x##name##Req) + n)>>2;\ dpy->bufptr += SIZEOF(x##name##Req) + n;\ dpy->request++#else#define GetReqExtra(name, n, req) \ WORD64ALIGN\ if ((dpy->bufptr + SIZEOF(x/**/name/**/Req) + n) > dpy->bufmax)\ _XFlush(dpy);\ req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\ req->reqType = X_/**/name;\ req->length = (SIZEOF(x/**/name/**/Req) + n)>>2;\ dpy->bufptr += SIZEOF(x/**/name/**/Req) + n;\ dpy->request++#endif/* * GetResReq is for those requests that have a resource ID * (Window, Pixmap, GContext, etc.) as their single argument. * "rid" is the name of the resource. */#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)#define GetResReq(name, rid, req) \ WORD64ALIGN\ if ((dpy->bufptr + SIZEOF(xResourceReq)) > dpy->bufmax)\ _XFlush(dpy);\ req = (xResourceReq *) (dpy->last_req = dpy->bufptr);\ req->reqType = X_##name;\ req->length = 2;\ req->id = (rid);\ dpy->bufptr += SIZEOF(xResourceReq);\ dpy->request++#else#define GetResReq(name, rid, req) \ WORD64ALIGN\ if ((dpy->bufptr + SIZEOF(xResourceReq)) > dpy->bufmax)\ _XFlush(dpy);\ req = (xResourceReq *) (dpy->last_req = dpy->bufptr);\ req->reqType = X_/**/name;\ req->length = 2;\ req->id = (rid);\ dpy->bufptr += SIZEOF(xResourceReq);\ dpy->request++#endif/* * GetEmptyReq is for those requests that have no arguments * at all. */#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)#define GetEmptyReq(name, req) \ WORD64ALIGN\ if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\ _XFlush(dpy);\ req = (xReq *) (dpy->last_req = dpy->bufptr);\ req->reqType = X_##name;\ req->length = 1;\ dpy->bufptr += SIZEOF(xReq);\ dpy->request++#else#define GetEmptyReq(name, req) \ WORD64ALIGN\ if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\ _XFlush(dpy);\ req = (xReq *) (dpy->last_req = dpy->bufptr);\ req->reqType = X_/**/name;\ req->length = 1;\ dpy->bufptr += SIZEOF(xReq);\ dpy->request++#endif#ifdef WORD64#define MakeBigReq(req,n) \ { \ char _BRdat[4]; \ unsigned long _BRlen = req->length - 1; \ req->length = 0; \ memcpy(_BRdat, ((char *)req) + (_BRlen << 2), 4); \ memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \ memcpy(((char *)req) + 4, _BRdat, 4); \ Data32(dpy, (long *)&_BRdat, 4); \ }#else#define MakeBigReq(req,n) \ { \ CARD32 _BRdat; \ CARD32 _BRlen = req->length - 1; \ req->length = 0; \ _BRdat = ((CARD32 *)req)[_BRlen]; \ memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \ ((CARD32 *)req)[1] = _BRlen + n + 2; \ Data32(dpy, &_BRdat, 4); \ }#endif#define SetReqLen(req,n,badlen) \ if ((req->length + n) > (unsigned)65535) { \ if (dpy->bigreq_size) { \ MakeBigReq(req,n) \ } else { \ n = badlen; \ req->length += n; \ } \ } else \ req->length += n#define SyncHandle() \ if (dpy->synchandler) (*dpy->synchandler)(dpy)extern void _XFlushGCCache();#define FlushGC(dpy, gc) \ if ((gc)->dirty) _XFlushGCCache((dpy), (gc))/* * Data - Place data in the buffer and pad the end to provide * 32 bit word alignment. Transmit if the buffer fills. * * "dpy" is a pointer to a Display. * "data" is a pinter to a data buffer. * "len" is the length of the data buffer. */#ifndef DataRoutineIsProcedure#define Data(dpy, data, len) \ if (dpy->bufptr + (len) <= dpy->bufmax) {\ memcpy(dpy->bufptr, data, (int)len);\ dpy->bufptr += ((len) + 3) & ~3;\ } else\ _XSend(dpy, data, len)#endif /* DataRoutineIsProcedure *//* Allocate bytes from the buffer. No padding is done, so if * the length is not a multiple of 4, the caller must be * careful to leave the buffer aligned after sending the * current request. * * "type" is the type of the pointer being assigned to. * "ptr" is the pointer being assigned to. * "n" is the number of bytes to allocate. * * Example: * xTextElt *elt; * BufAlloc (xTextElt *, elt, nbytes) */#define BufAlloc(type, ptr, n) \ if (dpy->bufptr + (n) > dpy->bufmax) \ _XFlush (dpy); \ ptr = (type) dpy->bufptr; \ dpy->bufptr += (n);#ifdef WORD64#define Data16(dpy, data, len) _XData16(dpy, (short *)data, len)#define Data32(dpy, data, len) _XData32(dpy, (long *)data, len)#else#define Data16(dpy, data, len) Data((dpy), (char *)(data), (len))#define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len))#define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len))#ifdef LONG64#define Data32(dpy, data, len) _XData32(dpy, (long *)data, len)#else#define Data32(dpy, data, len) Data((dpy), (char *)(data), (len))#define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len))#endif#endif /* not WORD64 */#define PackData16(dpy,data,len) Data16 (dpy, data, len)#define PackData32(dpy,data,len) Data32 (dpy, data, len)/* Xlib manual is bogus */#define PackData(dpy,data,len) PackData16 (dpy, data, len)#define min(a,b) (((a) < (b)) ? (a) : (b))#define max(a,b) (((a) > (b)) ? (a) : (b))#define CI_NONEXISTCHAR(cs) (((cs)->width == 0) && \ (((cs)->rbearing|(cs)->lbearing| \ (cs)->ascent|(cs)->descent) == 0))/* * CI_GET_CHAR_INFO_1D - return the charinfo struct for the indicated 8bit * character. If the character is in the column and exists, then return the * appropriate metrics (note that fonts with common per-character metrics will * return min_bounds). If none of these hold true, try again with the default * char. */#define CI_GET_CHAR_INFO_1D(fs,col,def,cs) \{ \ cs = def; \ if (col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \ if (fs->per_char == NULL) { \ cs = &fs->min_bounds; \ } else { \ cs = &fs->per_char[(col - fs->min_char_or_byte2)]; \ if (CI_NONEXISTCHAR(cs)) cs = def; \ } \ } \}#define CI_GET_DEFAULT_INFO_1D(fs,cs) \ CI_GET_CHAR_INFO_1D (fs, fs->default_char, NULL, cs)/* * CI_GET_CHAR_INFO_2D - return the charinfo struct for the indicated row and * column. This is used for fonts that have more than row zero. */#define CI_GET_CHAR_INFO_2D(fs,row,col,def,cs) \{ \ cs = def; \ if (row >= fs->min_byte1 && row <= fs->max_byte1 && \ col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \ if (fs->per_char == NULL) { \ cs = &fs->min_bounds; \ } else { \ cs = &fs->per_char[((row - fs->min_byte1) * \ (fs->max_char_or_byte2 - \ fs->min_char_or_byte2 + 1)) + \ (col - fs->min_char_or_byte2)]; \ if (CI_NONEXISTCHAR(cs)) cs = def; \ } \ } \}#define CI_GET_DEFAULT_INFO_2D(fs,cs) \{ \ unsigned int r = (fs->default_char >> 8); \ unsigned int c = (fs->default_char & 0xff); \ CI_GET_CHAR_INFO_2D (fs, r, c, NULL, cs); \}#ifdef MUSTCOPY/* for when 32-bit alignment is not good enough */#define OneDataCard32(dpy,dstaddr,srcvar) \ { dpy->bufptr -= 4; Data32 (dpy, (char *) &(srcvar), 4); }#else/* srcvar must be a variable for large architecture version */#define OneDataCard32(dpy,dstaddr,srcvar) \ { *(CARD32 *)(dstaddr) = (srcvar); }#endif /* MUSTCOPY */typedef struct _XInternalAsync { struct _XInternalAsync *next; /* * handler arguments: * rep is the generic reply that caused this handler * to be invoked. It must also be passed to _XGetAsyncReply. * buf and len are opaque values that must be passed to * _XGetAsyncReply or _XGetAsyncData. * data is the closure stored in this struct. * The handler returns True iff it handled this reply. */ Bool (*handler)(#if NeedNestedPrototypes Display* /* dpy */, xReply* /* rep */, char* /* buf */, int /* len */, XPointer /* data */#endif ); XPointer data;} _XAsyncHandler;typedef struct _XAsyncEState { unsigned long min_sequence_number; unsigned long max_sequence_number; unsigned char error_code; unsigned char major_opcode; unsigned short minor_opcode; unsigned char last_error_received; int error_count;} _XAsyncErrorState;extern void _XDeqAsyncHandler();#define DeqAsyncHandler(dpy,handler) { \ if (dpy->async_handlers == (handler)) \ dpy->async_handlers = (handler)->next; \ else \ _XDeqAsyncHandler(dpy, handler); \ }/* * This structure is private to the library. */typedef struct _XFreeFuncs { void (*atoms)(); /* _XFreeAtomTable */ int (*modifiermap)(); /* XFreeModifierMap */ void (*key_bindings)(); /* _XFreeKeyBindings */ void (*context_db)(); /* _XFreeContextDB */ void (*defaultCCCs)(); /* _XcmsFreeDefaultCCCs */ void (*clientCmaps)(); /* _XcmsFreeClientCmaps */ void (*intensityMaps)(); /* _XcmsFreeIntensityMaps */ void (*im_filters)(); /* _XFreeIMFilters */ void (*xkb)(); /* _XkbFreeInfo */} _XFreeFuncRec;/* * This structure is private to the library. */typedef struct _XExten { /* private to extension mechanism */ struct _XExten *next; /* next in list */ XExtCodes codes; /* public information, all extension told */ int (*create_GC)(); /* routine to call when GC created */ int (*copy_GC)(); /* routine to call when GC copied */ int (*flush_GC)(); /* routine to call when GC flushed */ int (*free_GC)(); /* routine to call when GC freed */ int (*create_Font)(); /* routine to call when Font created */ int (*free_Font)(); /* routine to call when Font freed */ int (*close_display)(); /* routine to call when connection closed */ int (*error)(); /* who to call when an error occurs */ char *(*error_string)(); /* routine to supply error string */ char *name; /* name of this extension */ void (*error_values)(); /* routine to supply error values */ void (*before_flush)(); /* routine to call when sending data */ struct _XExten *next_flush; /* next in list of those with flushes */} _XExtension;/* extension hooks */_XFUNCPROTOBEGIN#ifdef DataRoutineIsProcedureextern void Data();#endifextern int _XError(#if NeedFunctionPrototypes Display* /* dpy */, xError* /* rep */#endif);extern int _XIOError(#if NeedFunctionPrototypes Display* /* dpy */#endif);extern int (*_XIOErrorFunction)(#if NeedNestedPrototypes Display* /* dpy */#endif);extern int (*_XErrorFunction)(#if NeedNestedPrototypes Display* /* dpy */, XErrorEvent* /* error_event */#endif);extern void _XEatData(#if NeedFunctionPrototypes Display* /* dpy */, unsigned long /* n */#endif);extern char *_XAllocScratch(#if NeedFunctionPrototypes Display* /* dpy */, unsigned long /* nbytes */#endif);extern char *_XAllocTemp(#if NeedFunctionPrototypes Display* /* dpy */, unsigned long /* nbytes */#endif);extern void _XFreeTemp(#if NeedFunctionPrototypes Display* /* dpy */, char* /* buf */, unsigned long /* nbytes */#endif);extern Visual *_XVIDtoVisual(#if NeedFunctionPrototypes Display* /* dpy */, VisualID /* id */#endif);extern unsigned long _XSetLastRequestRead(#if NeedFunctionPrototypes Display* /* dpy */, xGenericReply* /* rep */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -