示例#1
0
Bool
DRIDestroySurface(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable,
                  void (*notify) (void *, void *), void *notify_data)
{
    DRIDrawablePrivPtr  pDRIDrawablePriv;

    if (pDrawable->type == DRAWABLE_WINDOW) {
        pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW((WindowPtr)pDrawable);
    } else if (pDrawable->type == DRAWABLE_PIXMAP) {
        pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_PIXMAP((PixmapPtr)pDrawable);
    } else {
        return FALSE;
    }

    if (pDRIDrawablePriv != NULL) {
        if (notify != NULL) {
            pDRIDrawablePriv->notifiers = x_hook_remove(pDRIDrawablePriv->notifiers,
                                                        notify, notify_data);
        }
        if (--pDRIDrawablePriv->refCount <= 0) {
            /* This calls back to DRIDrawablePrivDelete
               which frees the private area */
            FreeResourceByType(id, DRIDrawablePrivResType, FALSE);
        }
    }

    return TRUE;
}
示例#2
0
Bool
DRIDestroySurface(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable,
                  void (*notify)(void *, void *), void *notify_data)
{
    DRIDrawablePrivPtr pDRIDrawablePriv;

    if (pDrawable->type == DRAWABLE_WINDOW) {
        pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW((WindowPtr)pDrawable);
    }
    else if (pDrawable->type == DRAWABLE_PIXMAP) {
        pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_PIXMAP((PixmapPtr)pDrawable);
    }
    else {
        return FALSE;
    }

    if (pDRIDrawablePriv != NULL) {
        /*
         * This doesn't seem to be used, because notify is NULL in all callers.
         */

        if (notify != NULL) {
            pDRIDrawablePriv->notifiers = x_hook_remove(
                pDRIDrawablePriv->notifiers,
                notify, notify_data);
        }

        --pDRIDrawablePriv->refCount;

        /*
         * Check if the drawable privates still have a reference to the
         * surface.
         */

        if (pDRIDrawablePriv->refCount <= 0) {
            /*
             * This calls back to DRIDrawablePrivDelete which
             * frees the private area and dispatches events, if needed.
             */
            FreeResourceByType(id, DRIDrawablePrivResType, FALSE);
        }
    }

    return TRUE;
}