/* * groupPaintWindow * */ Bool groupPaintWindow(CompWindow * w, const WindowPaintAttrib * attrib, const CompTransform *transform, Region region, unsigned int mask) { Bool status; Bool doRotate; GROUP_SCREEN(w->screen); GROUP_WINDOW(w); WindowPaintAttrib gAttrib = *attrib; CompTransform wTransform = *transform; if (gw->inSelection) { int opacity = groupGetSelectOpacity(w->screen); int saturation = groupGetSelectSaturation(w->screen); int brightness = groupGetSelectBrightness(w->screen); opacity = OPAQUE * opacity / 100; saturation = COLOR * saturation / 100; brightness = BRIGHT * brightness / 100; gAttrib.opacity = opacity; gAttrib.saturation = saturation; gAttrib.brightness = brightness; } else if (gw->group && gw->group->tabbingState != PaintOff && (gw->animateState & (IS_ANIMATED | FINISHED_ANIMATION))) { //fade the window out float opacity; int origDistanceX = (gw->orgPos.x - gw->destination.x); int origDistanceY = (gw->orgPos.y - gw->destination.y); float origDistance = sqrt(pow(origDistanceX, 2) + pow(origDistanceY,2)); float distanceX = (WIN_X(w) - gw->destination.x); float distanceY = (WIN_Y(w) - gw->destination.y); float distance = sqrt(pow(distanceX, 2) + pow(distanceY, 2)); if(distance > origDistance) opacity = 100.0f; else { if(!origDistanceX && !origDistanceY) { if (IS_TOP_TAB(w, gw->group) && (gw->group->tabbingState == PaintFadeIn)) opacity = 100.0f; else opacity = 0.0f; } else opacity = 100.0f * distance / origDistance; if (gw->group->tabbingState == PaintFadeOut) opacity = 100.0f - opacity; } gAttrib.opacity = gAttrib.opacity * opacity / 100; } doRotate = gw->group && (gw->group->changeState != PaintOff) && (IS_TOP_TAB(w, gw->group) || IS_PREV_TOP_TAB(w, gw->group)); if (doRotate) { float rotateAngle; float timeLeft = gw->group->changeAnimationTime; float animationProgress; float animWidth, animHeight; float animScaleX, animScaleY; if(gw->group->changeState == PaintFadeIn) timeLeft += groupGetChangeAnimationTime(w->screen) * 500.0f; animationProgress = (1 - (timeLeft / (groupGetChangeAnimationTime(w->screen) * 1000.0f))); // 0 at the beginning, 1 at the end. rotateAngle = animationProgress * 180.0f; if (IS_TOP_TAB(w, gw->group)) rotateAngle += 180.0f; if (gw->group->changeAnimationDirection < 0) rotateAngle *= -1.0f; animWidth = (1 - animationProgress) * WIN_WIDTH(PREV_TOP_TAB(gw->group)) + animationProgress * WIN_WIDTH(TOP_TAB(gw->group)); animHeight = (1 - animationProgress) * WIN_HEIGHT(PREV_TOP_TAB(gw->group)) + animationProgress * WIN_HEIGHT(TOP_TAB(gw->group)); animScaleX = animWidth / WIN_WIDTH(w); animScaleY = animHeight / WIN_HEIGHT(w); matrixScale(&wTransform, animScaleX, animScaleY, 1.0f / w->screen->width); matrixTranslate(&wTransform, animScaleX * (WIN_X(w) + WIN_WIDTH(w) / 2.0f), 0.0f, 0.0f); matrixRotate(&wTransform, rotateAngle, 0.0f, 1.0f, 0.0f); matrixTranslate(&wTransform, -animScaleX * (WIN_X(w) + WIN_WIDTH(w) / 2.0f), 0.0f, 0.0f); glPushMatrix(); glLoadMatrixf(wTransform.m); mask |= PAINT_WINDOW_TRANSFORMED_MASK; } if (gw->windowHideInfo) mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK; UNWRAP(gs, w->screen, paintWindow); status = (*w->screen->paintWindow) (w, &gAttrib, &wTransform, region, mask); if (gw->group && gw->group->tabBar) { if (HAS_TOP_WIN(gw->group) && IS_TOP_TAB(w, gw->group)) { if ((gw->group->changeState == PaintOff) || (gw->group->changeState == PaintFadeOut)) groupPaintTabBar(gw->group, attrib, &wTransform, mask, region); } else if (IS_PREV_TOP_TAB(w, gw->group)) { if (gw->group->changeState == PaintFadeIn) groupPaintTabBar(gw->group, attrib, &wTransform, mask, region); } } WRAP(gs, w->screen, paintWindow, groupPaintWindow); if(doRotate) glPopMatrix(); return status; }