Beispiel #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);
    }
}
Beispiel #2
0
/*
 * Given the id of a physical window, try to find the top-level (or root)
 * X window that it represents.
 */
WindowPtr
xprGetXWindowFromAppKit(int windowNumber)
{
    RootlessWindowRec *winRec;
    Bool ret;
    xp_window_id wid;

    if (window_hash == NULL)
        return FALSE;

    /* need to lock, since this function can be called by any thread */

    pthread_mutex_lock(&window_hash_mutex);

    if (xp_lookup_native_window(windowNumber, &wid))
        ret = xprGetXWindow(wid) != NULL;
    else
        ret = FALSE;

    pthread_mutex_unlock(&window_hash_mutex);

    if (!ret) return NULL;
    winRec = x_hash_table_lookup(window_hash, x_cvt_uint_to_vptr(wid), NULL);

    return winRec != NULL ? winRec->win : NULL;
}
Beispiel #3
0
/*
 * Change frame stacking.
 */
static void xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) {
    xp_window_changes wc;
    unsigned int mask = XP_STACKING;

    TA_SERVER();
    
    /* Stack frame below nextWid it if it exists, or raise
       frame above everything otherwise. */

    if(nextWid == NULL) {
        wc.stack_mode = XP_MAPPED_ABOVE;
        wc.sibling = 0;
    } else {
        wc.stack_mode = XP_MAPPED_BELOW;
        wc.sibling = x_cvt_vptr_to_uint(nextWid);
    }

    if(window_hash) {
        RootlessWindowRec *winRec = x_hash_table_lookup(window_hash, wid, NULL);

        if(winRec) {
            if(XQuartzIsRootless)
                wc.window_level = normal_window_levels[winRec->level];
            else if(XQuartzShieldingWindowLevel)
                wc.window_level = XQuartzShieldingWindowLevel + 1;
            else
                wc.window_level = rooted_window_levels[winRec->level];
            mask |= XP_WINDOW_LEVEL;
        }
    }

    xprConfigureWindow(x_cvt_vptr_to_uint(wid), mask, &wc);
}
Beispiel #4
0
/*
 * Given the id of a physical window, try to find the top-level (or root)
 * X window that it represents.
 */
WindowPtr
xprGetXWindow(xp_window_id wid)
{
    RootlessWindowRec *winRec;

    if (window_hash == NULL)
        return NULL;

    winRec = x_hash_table_lookup(window_hash, x_cvt_uint_to_vptr(wid), NULL);

    return winRec != NULL ? winRec->win : NULL;
}
Beispiel #5
0
/*
 * Given the id of a physical window, try to find the top-level (or root)
 * X window that it represents.
 */
static WindowPtr
xprGetXWindow(xp_window_id wid)
{
    RootlessWindowRec *winRec;

    if (window_hash == NULL)
        return NULL;

    winRec = x_hash_table_lookup(window_hash, (void *) wid, NULL);

    return winRec != NULL ? winRec->win : NULL;
}
Beispiel #6
0
/* 
 * 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);
    }
}