| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| #ifndef _EXTUTIL_H_ |
| #define _EXTUTIL_H_ |
|
|
| #include <X11/extensions/Xext.h> |
|
|
| |
| |
| |
| |
| |
| typedef struct _XExtDisplayInfo { |
| struct _XExtDisplayInfo *next; |
| Display *display; |
| XExtCodes *codes; |
| XPointer data; |
| } XExtDisplayInfo; |
|
|
| typedef struct _XExtensionInfo { |
| XExtDisplayInfo *head; |
| XExtDisplayInfo *cur; |
| int ndisplays; |
| } XExtensionInfo; |
|
|
| typedef struct _XExtensionHooks { |
| int (*create_gc)( |
| Display* , |
| GC , |
| XExtCodes* |
| ); |
| int (*copy_gc)( |
| Display* , |
| GC , |
| XExtCodes* |
| ); |
| int (*flush_gc)( |
| Display* , |
| GC , |
| XExtCodes* |
| ); |
| int (*free_gc)( |
| Display* , |
| GC , |
| XExtCodes* |
| ); |
| int (*create_font)( |
| Display* , |
| XFontStruct* , |
| XExtCodes* |
| ); |
| int (*free_font)( |
| Display* , |
| XFontStruct* , |
| XExtCodes* |
| ); |
| int (*close_display)( |
| Display* , |
| XExtCodes* |
| ); |
| Bool (*wire_to_event)( |
| Display* , |
| XEvent* , |
| xEvent* |
| ); |
| Status (*event_to_wire)( |
| Display* , |
| XEvent* , |
| xEvent* |
| ); |
| int (*error)( |
| Display* , |
| xError* , |
| XExtCodes* , |
| int* |
| ); |
| char *(*error_string)( |
| Display* , |
| int , |
| XExtCodes* , |
| char* , |
| int |
| ); |
| } XExtensionHooks; |
|
|
| extern XExtensionInfo *XextCreateExtension( |
| void |
| ); |
| extern void XextDestroyExtension( |
| XExtensionInfo* |
| ); |
| extern XExtDisplayInfo *XextAddDisplay( |
| XExtensionInfo* , |
| Display* , |
| _Xconst char* , |
| XExtensionHooks* , |
| int , |
| XPointer |
| ); |
| extern int XextRemoveDisplay( |
| XExtensionInfo* , |
| Display* |
| ); |
| extern XExtDisplayInfo *XextFindDisplay( |
| XExtensionInfo* , |
| Display* |
| ); |
|
|
| #define XextHasExtension(i) ((i) && ((i)->codes)) |
| #define XextCheckExtension(dpy,i,name,val) \ |
| if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return val; } |
| #define XextSimpleCheckExtension(dpy,i,name) \ |
| if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return; } |
|
|
|
|
| |
| |
| |
| |
| |
| |
| #define XEXT_GENERATE_FIND_DISPLAY(proc,extinfo,extname,hooks,nev,data) \ |
| XExtDisplayInfo *proc (Display *dpy) \ |
| { \ |
| XExtDisplayInfo *dpyinfo; \ |
| if (!extinfo) { if (!(extinfo = XextCreateExtension())) return NULL; } \ |
| if (!(dpyinfo = XextFindDisplay (extinfo, dpy))) \ |
| dpyinfo = XextAddDisplay (extinfo,dpy,extname,hooks,nev,data); \ |
| return dpyinfo; \ |
| } |
|
|
| #define XEXT_FIND_DISPLAY_PROTO(proc) \ |
| XExtDisplayInfo *proc(Display *dpy) |
|
|
| #define XEXT_GENERATE_CLOSE_DISPLAY(proc,extinfo) \ |
| int proc (Display *dpy, XExtCodes *codes) \ |
| { \ |
| return XextRemoveDisplay (extinfo, dpy); \ |
| } |
|
|
| #define XEXT_CLOSE_DISPLAY_PROTO(proc) \ |
| int proc(Display *dpy, XExtCodes *codes) |
|
|
| #define XEXT_GENERATE_ERROR_STRING(proc,extname,nerr,errl) \ |
| char *proc (Display *dpy, int code, XExtCodes *codes, char *buf, int n) \ |
| { \ |
| code -= codes->first_error; \ |
| if (code >= 0 && code < nerr) { \ |
| char tmp[256]; \ |
| sprintf (tmp, "%s.%d", extname, code); \ |
| XGetErrorDatabaseText (dpy, "XProtoError", tmp, errl[code], buf, n); \ |
| return buf; \ |
| } \ |
| return (char *)0; \ |
| } |
|
|
| #define XEXT_ERROR_STRING_PROTO(proc) \ |
| char *proc(Display *dpy, int code, XExtCodes *codes, char *buf, int n) |
| #endif |
|
|