예제 #1
0
void
DRISurfaceNotify(xp_surface_id id, int kind)
{
    DRIDrawablePrivPtr pDRIDrawablePriv = NULL;
    DRISurfaceNotifyArg arg;

    arg.id = id;
    arg.kind = kind;

    if (surface_hash != NULL)
    {
        pDRIDrawablePriv = x_hash_table_lookup(surface_hash,
                                               (void *) id, NULL);
    }

    if (pDRIDrawablePriv == NULL)
        return;

    if (kind == AppleDRISurfaceNotifyDestroyed)
    {
        pDRIDrawablePriv->sid = 0;
        x_hash_table_remove(surface_hash, (void *) id);
    }

    x_hook_run(pDRIDrawablePriv->notifiers, &arg);

    if (kind == AppleDRISurfaceNotifyDestroyed)
    {
        /* Kill off the handle. */

        FreeResourceByType(pDRIDrawablePriv->pDraw->id,
                           DRIDrawablePrivResType, FALSE);
    }
}
예제 #2
0
/*
 * Destroy a frame.
 */
void
xprDestroyFrame(RootlessFrameID wid)
{
    pthread_mutex_lock(&window_hash_mutex);
    x_hash_table_remove(window_hash, wid);
    pthread_mutex_unlock(&window_hash_mutex);

    xp_destroy_window((xp_window_id) wid);
}
예제 #3
0
파일: xprFrame.c 프로젝트: aosm/X11server
/*
 * Destroy a frame.
 */
static void
xprDestroyFrame(RootlessFrameID wid)
{
    xp_error err;
    TA_SERVER();
    
    pthread_mutex_lock(&window_hash_mutex);
    x_hash_table_remove(window_hash, wid);
    pthread_mutex_unlock(&window_hash_mutex);

    err = xp_destroy_window(x_cvt_vptr_to_uint(wid));
    if (err != Success)
        FatalError("Could not destroy window %d (%d).", (int)x_cvt_vptr_to_uint(wid), (int)err);
}
예제 #4
0
파일: dri.c 프로젝트: L3oV1nc3/VMGL
Bool
DRIDrawablePrivDelete(pointer pResource, XID id)
{
    DrawablePtr         pDrawable = (DrawablePtr)pResource;
    DRIScreenPrivPtr    pDRIPriv = DRI_SCREEN_PRIV(pDrawable->pScreen);
    DRIDrawablePrivPtr  pDRIDrawablePriv = NULL;
    WindowPtr           pWin = NULL;
    PixmapPtr           pPix = NULL;

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

    if (pDRIDrawablePriv == NULL) {
	return DRIFreePixmapImp(pDrawable);
    }

    if (pDRIDrawablePriv->drawableIndex != -1) {
        /* release drawable table entry */
        pDRIPriv->DRIDrawables[pDRIDrawablePriv->drawableIndex] = NULL;
    }

    if (pDRIDrawablePriv->sid != 0) {
        xp_destroy_surface(pDRIDrawablePriv->sid);
        x_hash_table_remove(surface_hash, x_cvt_uint_to_vptr(pDRIDrawablePriv->sid));
    }

    if (pDRIDrawablePriv->notifiers != NULL)
        x_hook_free(pDRIDrawablePriv->notifiers);

    xfree(pDRIDrawablePriv);

    if (pDrawable->type == DRAWABLE_WINDOW) {
	dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, NULL);
    } else if (pDrawable->type == DRAWABLE_PIXMAP) {
	dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey, NULL);
    }

    --pDRIPriv->nrWindows;

    return TRUE;
}
예제 #5
0
파일: dri.c 프로젝트: 4eremuxa/xserver
/* 
 * Note: this also cleans up the hash table in addition to notifying clients.
 * The sid/surface-id should not be used after this, because it will be
 * invalid.
 */ 
void
DRISurfaceNotify(xp_surface_id id, int kind)
{
    DRIDrawablePrivPtr pDRIDrawablePriv = NULL;
    DRISurfaceNotifyArg arg;

    arg.id = id;
    arg.kind = kind;

    if (surface_hash != NULL)
    {
        pDRIDrawablePriv = x_hash_table_lookup(surface_hash,
                                               x_cvt_uint_to_vptr(id), NULL);
    }

    if (pDRIDrawablePriv == NULL)
        return;

    if (kind == AppleDRISurfaceNotifyDestroyed)
    {
	x_hash_table_remove(surface_hash, x_cvt_uint_to_vptr(id));
    }

    x_hook_run(pDRIDrawablePriv->notifiers, &arg);

    if (kind == AppleDRISurfaceNotifyDestroyed)
    {
	xp_error error;
	
	error = xp_destroy_surface(pDRIDrawablePriv->sid);
	
	if(error) 
	    ErrorF("%s: xp_destroy_surface failed: %d\n", __func__, error);
		
	/* Guard against reuse, even though we are freeing after this. */
	pDRIDrawablePriv->sid = 0;

        FreeResourceByType(pDRIDrawablePriv->pDraw->id,
                           DRIDrawablePrivResType, FALSE);
    }
}