Пример #1
0
_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));
Пример #2
0
/*
** 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));