diff --git a/include/X11/Xlib.h b/include/X11/Xlib.h index a26789b..e8aaae6 100644 --- a/include/X11/Xlib.h +++ b/include/X11/Xlib.h @@ -36,6 +36,9 @@ in this Software without prior written authorization from The Open Group. #ifndef _XLIB_H_ #define _XLIB_H_ +/* whether users can set and get a pointer to private data */ +#define XLIB_DISPLAY_DATA + #define XlibSpecificationRelease 6 #ifdef USG @@ -4003,6 +4006,12 @@ extern int _Xwctomb( wchar_t /* wc */ ); +/* whether users can set and get a pointer to private data */ +#ifdef XLIB_DISPLAY_DATA +extern void *XGetDisplayData (Display *dpy); +extern Bool XSetDisplayData (Display *dpy, const void *data); +#endif /* XLIB_DISPLAY_DATA */ + _XFUNCPROTOEND #endif /* _XLIB_H_ */ diff --git a/include/X11/Xlibint.h b/include/X11/Xlibint.h index 8aab764..11c5522 100644 --- a/include/X11/Xlibint.h +++ b/include/X11/Xlibint.h @@ -185,6 +185,9 @@ struct _XDisplay struct _XkbInfoRec *xkb_info; /* XKB info */ struct _XtransConnInfo *trans_conn; /* transport connection object */ struct _X11XCBPrivate *xcb; /* XCB glue private data */ +#ifdef XLIB_DISPLAY_DATA + void *data; /* user supplied data */ +#endif /* XLIB_DISPLAY_DATA */ }; #define XAllocIDs(dpy,ids,n) (*(dpy)->idlist_alloc)(dpy,ids,n) diff --git a/src/OpenDis.c b/src/OpenDis.c index 9c327d1..8587688 100644 --- a/src/OpenDis.c +++ b/src/OpenDis.c @@ -84,6 +84,28 @@ static Bool _XBigReqHandler(Display *dpy, xReply *rep, char *buf, int len, XPointer data); #endif /* !USE_XCB */ +#ifdef XLIB_DISPLAY_DATA +void * +XGetDisplayData (Display *dpy) +{ + if (dpy != 0 && dpy->data != 0) + return dpy->data; + + return NULL; +} + +Bool +XSetDisplayData (Display *dpy, const void *data) +{ + if (dpy != 0 && data != 0) + { + dpy->data = data; + return False; + } + return True; +} +#endif /* XLIB_DISPLAY_DATA */ + /* * Connects to a server, creates a Display object and returns a pointer to * the newly created Display back to the caller.