/* Moves window to [x,y] and resizes to width x height
   if no animation or starts animation */
static Bool
placeWin (CompWindow *w,
	  int        x,
	  int        y,
	  int        width,
	  int        height)
{
    /* window existence check */
    if (!w)
	return FALSE;

    /* this checks if the window isnt smaller
       than minimum size it has defined */
    constrainMinMax (w, width, height, &width, &height);

    /* check if the window isnt already where its going to be */
    if (x == w->attrib.x && y == w->attrib.y &&
	width == w->attrib.width && height == w->attrib.height)
	return TRUE;

    TILE_WINDOW(w);

    /* set previous coordinates for animation */
    tw->prevCoords.x = w->attrib.x;
    tw->prevCoords.y = w->attrib.y;
    tw->prevCoords.width = w->attrib.width;
    tw->prevCoords.height = w->attrib.height;

    /* set future coordinates for animation */
    tw->newCoords.x = x;
    tw->newCoords.y = y;
    tw->newCoords.width = width;
    tw->newCoords.height = height;

    tw->alreadyResized = FALSE; /* window is not resized now */
    tw->needConfigure = TRUE;

    switch (tileGetAnimateType (w->screen->display))
    {
    case AnimateTypeNone:
	tileSetNewWindowSize (w);
	break;
    case AnimateTypeFilledOutline:
    case AnimateTypeSlide:
    case AnimateTypeZoom:
    case AnimateTypeDropFromTop:
	tileSetNewWindowSize (w);
	/* fall-through */
    case AnimateTypeFade:
	tw->animationType = Animating;
	break;
    default:
	break;
    }

    return TRUE;
}
Exemple #2
0
float Filter::constrainAbs(float val, float max)
{
    return constrainMinMax(val, -max, +max);
}