|
|
1.1 ! root 1: #include "copyright.h" ! 2: ! 3: /* $Header: XClDisplay.c,v 11.17 87/09/01 14:39:45 toddb Exp $ */ ! 4: /* Copyright Massachusetts Institute of Technology 1985 */ ! 5: ! 6: #include "Xlibint.h" ! 7: ! 8: extern Display *_XHeadOfDisplayList; ! 9: /* ! 10: * XCloseDisplay - XSync the connection to the X Server, close the connection, ! 11: * and free all associated storage. ! 12: */ ! 13: ! 14: XCloseDisplay (dpy) ! 15: register Display *dpy; ! 16: { ! 17: register _XExtension *ext; ! 18: register int i; ! 19: register Display **dp = &_XHeadOfDisplayList; ! 20: register Display *cp = _XHeadOfDisplayList; ! 21: for (i = 0; i < dpy->nscreens; i++) { ! 22: register Screen *sp = &dpy->screens[i]; ! 23: XFreeGC (dpy, sp->default_gc); ! 24: } ! 25: XSync(dpy, 1); /* throw away pending input events */ ! 26: ext = dpy->ext_procs; ! 27: while (ext) { /* call out to any extensions interested */ ! 28: if (ext->close_display != NULL) ! 29: (*ext->close_display)(dpy, &ext->codes); ! 30: ext = ext->next; ! 31: } ! 32: LockDisplay(dpy); ! 33: _XDisconnectDisplay(dpy->fd); ! 34: while (cp != NULL) { ! 35: if (cp == dpy) { ! 36: *dp = cp->next; ! 37: _XFreeDisplayStructure (dpy); ! 38: return; ! 39: } ! 40: dp = &(cp->next); ! 41: cp = *dp; ! 42: } ! 43: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.