_X_HIDDEN __GLXdisplayPrivate * __glXInitialize(Display * dpy) { XExtDisplayInfo *info = __glXFindDisplay(dpy); XExtData **privList, *private, *found; __GLXdisplayPrivate *dpyPriv; XEDataObject dataObj; int major, minor; if (!XextHasExtension(info)) return NULL; /* See if a display private already exists. If so, return it */ dataObj.display = dpy; privList = XEHeadOfExtensionList(dataObj); found = XFindOnExtensionList(privList, info->codes->extension); if (found) return (__GLXdisplayPrivate *) found->private_data; /* See if the versions are compatible */ if (!QueryVersion(dpy, info->codes->major_opcode, &major, &minor)) return NULL; /* ** Allocate memory for all the pieces needed for this buffer. */ private = (XExtData *) Xmalloc(sizeof(XExtData));
int DPSCAPCopyGCProc( Display *dpy, GC gc, XExtCodes *codes) { XGCValues values; DPSCAPData my; XExtData *extData = XFindOnExtensionList( CSDPSHeadOfDpyExt(dpy), codes->extension); if (extData) my = (DPSCAPData) extData->private_data; else return(0); /* We change the GC unconditionally, since friggin' XCopyGC clears the dirty bits of the values that are copied! */ DPSAssertWarn(XGetGCValues(dpy, gc, DPSGCBITS & ~(GCClipMask), &values), NULL, "DPS NX: XGetGCValues returned False\n"); values.clip_mask = gc->values.clip_mask; DPSCAPChangeGC(my->agent, gc, DPSGCBITS, &values); /* We have to make sure that the agent completely processes the change to the GC. If we allow the agent to update the GC in its own sweet time, the stupid client may delete the GC after the agent has already queued a request to, e.g., copy the GC, but before the request is flushed. */ XDPSLSync(dpy); return(1); }
int DPSCAPFreeGCProc( Display *pdpy, GC gc, XExtCodes *codes) { register xCAPNotifyReq *req; DPSCAPData my; Display *dpy = pdpy; /* Stupid macros insists on Display being 'dpy' */ XExtData *extData = XFindOnExtensionList( CSDPSHeadOfDpyExt(dpy), codes->extension); if (extData) my = (DPSCAPData) extData->private_data; else return(0); /* Notify the agent that the client deleted a GC. Let the agent figure out if it cares. */ /* ASSERT: called from within LockDisplay section */ dpy = my->agent; if (dpy == (Display *)NULL || dpy == pdpy) return(0); /* May need to sync changes to GC */ if (gNXSyncGCMode == DPSNXSYNCGCMODE_DELAYED) XDPSLSync(pdpy); { Display *xdpy = pdpy; /* pdpy is X server */ NXMacroGetReq(CAPNotify, req); } req->reqType = DPSCAPOPCODEBASE; req->type = X_CAPNotify; req->cxid = 0; req->notification = DPSCAPNOTE_FREEGC; req->data = XGContextFromGC(gc); req->extra = 0; /* Guarantee that everyone sees GC go away */ XSync(pdpy, False); /* pdpy is X server */ if (gNXSyncGCMode == DPSNXSYNCGCMODE_FLUSH) { LockDisplay(dpy); /* dpy means agent here */ N_XFlush(dpy); UnlockDisplay(dpy); } else XDPSLSync(pdpy); /* ASSERT: SynchHandle called by caller */ return(1); }
int DPSCAPFlushGCProc( Display *dpy, GC gc, XExtCodes *codes) { XGCValues values; DPSCAPData my; XExtData *extData; unsigned long int dirty; /* When GC is created, it is flushed with no dirty bits set, so we have to notice that situation. */ if (gc->dirty) { if (XDPSLGetGCFlushMode(dpy) == XDPSNX_GC_UPDATES_FAST || !(gc->dirty & DPSGCBITS)) return(0); } extData = XFindOnExtensionList(CSDPSHeadOfDpyExt(dpy), codes->extension); if (extData) my = (DPSCAPData) extData->private_data; else return(0); /* HERE IF (gc->dirty & DPSGCBITS || !gc->dirty) */ dirty = gc->dirty; DPSAssertWarn(XGetGCValues(dpy, gc, DPSGCBITS & ~(GCClipMask), &values), NULL, "NX: XGetGCValues returned False\n"); values.clip_mask = gc->values.clip_mask; /* Must guarantee that gc change is registered by X server before notification is sent to agent. */ XSync(dpy, False); DPSCAPChangeGC(my->agent, gc, DPSGCBITS, &values); /* We have to make sure that the agent completely processes the change to the GC. If we allow the agent to update the GC in its own sweet time, the stupid client may delete the GC after the agent has already queued a request to, e.g., copy the GC, but before the request is flushed. */ if (gNXSyncGCMode == DPSNXSYNCGCMODE_SYNC) XDPSLSync(dpy); else XDPSLFlush(dpy); #ifdef CSDPSDEBUG if (dirty) ++gcCountFlushedDirty; else ++gcCountFlushedClean; #endif /* CSDPSDEBUG */ return(1); }
/* ** Initialize the client side extension code. */ _X_HIDDEN __GLXdisplayPrivate * __glXInitialize(Display * dpy) { XExtDisplayInfo *info = __glXFindDisplay(dpy); XExtData **privList, *private, *found; __GLXdisplayPrivate *dpyPriv; XEDataObject dataObj; int major, minor; #ifdef GLX_DIRECT_RENDERING Bool glx_direct, glx_accel; #endif /* The one and only long long lock */ __glXLock(); if (!XextHasExtension(info)) { /* No GLX extension supported by this server. Oh well. */ __glXUnlock(); XMissingExtension(dpy, __glXExtensionName); return 0; } /* See if a display private already exists. If so, return it */ dataObj.display = dpy; privList = XEHeadOfExtensionList(dataObj); found = XFindOnExtensionList(privList, info->codes->extension); if (found) { __glXUnlock(); return (__GLXdisplayPrivate *) found->private_data; } /* See if the versions are compatible */ if (!QueryVersion(dpy, info->codes->major_opcode, &major, &minor)) { /* The client and server do not agree on versions. Punt. */ __glXUnlock(); return 0; } /* ** Allocate memory for all the pieces needed for this buffer. */ private = (XExtData *) Xmalloc(sizeof(XExtData));