void TranslucencyEffect::reconfigure(ReconfigureFlags)
{
    KConfigGroup conf = effects->effectConfig("Translucency");
    decoration = conf.readEntry("Decoration", 1.0);
    moveresize = conf.readEntry("MoveResize", 0.8);
    dialogs = conf.readEntry("Dialogs", 1.0);
    inactive = conf.readEntry("Inactive", 1.0);
    comboboxpopups = conf.readEntry("ComboboxPopups", 1.0);
    menus = conf.readEntry("Menus", 1.0);
    individualmenuconfig = conf.readEntry("IndividualMenuConfig", false);
    if (individualmenuconfig) {
        dropdownmenus = conf.readEntry("DropdownMenus", 1.0);
        popupmenus = conf.readEntry("PopupMenus", 1.0);
        tornoffmenus = conf.readEntry("TornOffMenus", 1.0);
    } else {
        dropdownmenus = menus;
        popupmenus = menus;
        tornoffmenus = menus;
    }
    moveresize_timeline.setCurveShape(QTimeLine::EaseInOutCurve);
    moveresize_timeline.setDuration(animationTime(conf, "Duration", 800));
    activeinactive_timeline.setCurveShape(QTimeLine::EaseInOutCurve);
    activeinactive_timeline.setDuration(animationTime(conf, "Duration", 800));

    // Repaint the screen just in case the user changed the inactive opacity
    effects->addRepaintFull();
}
Beispiel #2
0
DimInactiveEffect::DimInactiveEffect()
{
    reconfigure(ReconfigureAll);
    timeline.setDuration(animationTime(250));
    previousActiveTimeline.setDuration(animationTime(250));
    active = effects->activeWindow();
    previousActive = NULL;
    connect(effects, SIGNAL(windowActivated(KWin::EffectWindow*)), this, SLOT(slotWindowActivated(KWin::EffectWindow*)));
    connect(effects, SIGNAL(windowDeleted(KWin::EffectWindow*)), this, SLOT(slotWindowDeleted(KWin::EffectWindow*)));
}
Beispiel #3
0
void ScaleInEffect::slotWindowAdded(EffectWindow* c)
{
    if (c->isOnCurrentDesktop()) {
        mTimeLineWindows.insert(c, new QTimeLine(animationTime(250), this));
        c->addRepaintFull();
    }
}
Beispiel #4
0
void GlideEffect::reconfigure(ReconfigureFlags)
{
    KConfigGroup conf = effects->effectConfig("Glide");
    duration = animationTime(conf, "AnimationTime", 350);
    effect = (EffectStyle) conf.readEntry("GlideEffect", 0);
    angle = conf.readEntry("GlideAngle", -90);
}
Beispiel #5
0
void CoverSwitchEffect::reconfigure(ReconfigureFlags)
{
    KConfigGroup conf = effects->effectConfig("CoverSwitch");
    animationDuration = animationTime(conf, "Duration", 200);
    animateSwitch     = conf.readEntry("AnimateSwitch", true);
    animateStart      = conf.readEntry("AnimateStart", true);
    animateStop       = conf.readEntry("AnimateStop", true);
    reflection        = conf.readEntry("Reflection", true);
    windowTitle       = conf.readEntry("WindowTitle", true);
    zPosition         = conf.readEntry("ZPosition", 900.0);
    thumbnails        = conf.readEntry("Thumbnails", true);
    dynamicThumbnails = conf.readEntry("DynamicThumbnails", true);
    thumbnailWindows  = conf.readEntry("ThumbnailWindows", 8);
    timeLine.setCurveShape(QTimeLine::EaseInOutCurve);
    timeLine.setDuration(animationDuration);
    primaryTabBox = conf.readEntry("TabBox", false);
    secondaryTabBox = conf.readEntry("TabBoxAlternative", false);
    QColor tmp        = conf.readEntry("MirrorFrontColor", QColor(0, 0, 0));
    mirrorColor[0][0] = tmp.redF();
    mirrorColor[0][1] = tmp.greenF();
    mirrorColor[0][2] = tmp.blueF();
    mirrorColor[0][3] = 1.0;
    tmp               = conf.readEntry("MirrorRearColor", QColor(0, 0, 0));
    mirrorColor[1][0] = tmp.redF();
    mirrorColor[1][1] = tmp.greenF();
    mirrorColor[1][2] = tmp.blueF();
    mirrorColor[1][3] = -1.0;

}
Beispiel #6
0
void LogoutEffect::prePaintScreen(ScreenPrePaintData& data, int time)
{
    if (!displayEffect && progress == 0.0) {
        if (blurTexture) {
            delete blurTexture;
            blurTexture = NULL;
            delete blurTarget;
            blurTarget = NULL;
            blurSupported = false;
        }
    } else if (!blurTexture) {
        blurSupported = false;
        delete blurTarget; // catch as we just tested the texture ;-P
        if (effects->compositingType() == OpenGLCompositing && GLTexture::NPOTTextureSupported() && GLRenderTarget::blitSupported() && useBlur) {
            // TODO: It seems that it is not possible to create a GLRenderTarget that has
            //       a different size than the display right now. Most likely a KWin core bug.
            // Create texture and render target
            blurTexture = new GLTexture(displayWidth(), displayHeight());
            blurTexture->setFilter(GL_LINEAR_MIPMAP_LINEAR);
            blurTexture->setWrapMode(GL_CLAMP_TO_EDGE);

            blurTarget = new GLRenderTarget(*blurTexture);
            if (blurTarget->valid())
                blurSupported = true;

            // As creating the render target takes time it can cause the first two frames of the
            // blur animation to be jerky. For this reason we only start the animation after the
            // third frame.
            frameDelay = 2;
        }
    }

    if (frameDelay)
        --frameDelay;
    else {
        if (displayEffect)
            progress = qMin(1.0, progress + time / animationTime(2000.0));
        else if (progress > 0.0)
            progress = qMax(0.0, progress - time / animationTime(500.0));
    }

    if (blurSupported && progress > 0.0) {
        data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS;
    }

    effects->prePaintScreen(data, time);
}
Beispiel #7
0
void LogoutEffect::prePaintScreen( ScreenPrePaintData& data, int time )
    {
    if( logoutWindow != NULL && !logoutWindowClosed )
        progress = qMin( 1.0, progress + time / animationTime( 2000.0 ));
    else if( progress > 0.0 )
        progress = qMax( 0.0, progress - time / animationTime( 500.0 ));

#ifdef KWIN_HAVE_OPENGL_COMPOSITING
    if( blurSupported && progress > 0.0 )
        {
        data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS;
        effects->pushRenderTarget( blurTarget );
        }
#endif

    effects->prePaintScreen( data, time );
    }
HighlightWindowEffect::HighlightWindowEffect()
    : m_finishing(false)
    , m_fadeDuration(float(animationTime(150)))
    , m_monitorWindow(NULL)
{
    m_atom = effects->announceSupportProperty("_KDE_WINDOW_HIGHLIGHT", this);
    connect(effects, SIGNAL(windowAdded(KWin::EffectWindow*)), this, SLOT(slotWindowAdded(KWin::EffectWindow*)));
    connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*)));
    connect(effects, SIGNAL(windowDeleted(KWin::EffectWindow*)), this, SLOT(slotWindowDeleted(KWin::EffectWindow*)));
    connect(effects, SIGNAL(propertyNotify(KWin::EffectWindow*,long)), this, SLOT(slotPropertyNotify(KWin::EffectWindow*,long)));
}
Beispiel #9
0
void CubeSlideEffect::reconfigure(ReconfigureFlags)
{
    CubeSlideConfig::self()->read();
    // TODO: rename rotationDuration to duration
    rotationDuration = animationTime(CubeSlideConfig::rotationDuration() != 0 ? CubeSlideConfig::rotationDuration() : 500);
    timeLine.setCurveShape(QTimeLine::EaseInOutCurve);
    timeLine.setDuration(rotationDuration);
    dontSlidePanels = CubeSlideConfig::dontSlidePanels();
    dontSlideStickyWindows = CubeSlideConfig::dontSlideStickyWindows();
    usePagerLayout = CubeSlideConfig::usePagerLayout();
    useWindowMoving = CubeSlideConfig::useWindowMoving();
}
Beispiel #10
0
void SlidingPopupsEffect::reconfigure(ReconfigureFlags flags)
{
    Q_UNUSED(flags)
    KConfigGroup conf = effects->effectConfig(QStringLiteral("SlidingPopups"));
    mFadeInTime = animationTime(conf, QStringLiteral("SlideInTime"), 250);
    mFadeOutTime = animationTime(conf, QStringLiteral("SlideOutTime"), 250);
    QHash< const EffectWindow*, QTimeLine* >::iterator it = mAppearingWindows.begin();
    while (it != mAppearingWindows.end()) {
        it.value()->setDuration(animationTime(mFadeInTime));
        ++it;
    }
    it = mDisappearingWindows.begin();
    while (it != mDisappearingWindows.end()) {
        it.value()->setDuration(animationTime(mFadeOutTime));
        ++it;
    }
    QHash< const EffectWindow*, Data >::iterator wIt = mWindowsData.begin();
    while (wIt != mWindowsData.end()) {
        wIt.value().fadeInDuration = mFadeInTime;
        wIt.value().fadeOutDuration = mFadeOutTime;
        ++wIt;
    }
}
Beispiel #11
0
void LoginEffect::prePaintScreen( ScreenPrePaintData& data, int time )
    {
    if( login_window != NULL )
        {
        if( progress != 1.0 )
            {
            progress = qBound( 0.0, progress + time / animationTime( 2000 ), 1.0 );
            if( progress == 1.0 )
                {
                login_window->unrefWindow();
                login_window = NULL;
                effects->prePaintScreen( data, time );
                return;
                }
            }
        }
    effects->prePaintScreen( data, time );
    }
Beispiel #12
0
void ExplosionEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time)
{
    if (mWindows.contains(w)) {
        if (mValid) {
            mWindows[ w  ] += time / animationTime(700.0);   // complete change in 700ms
            if (mWindows[ w  ] < 1) {
                data.setTranslucent();
                data.setTransformed();
                w->enablePainting(EffectWindow::PAINT_DISABLED_BY_DELETE);
            } else {
                mWindows.remove(w);
                w->unrefWindow();
                mActiveAnimations--;
            }
        }
    }

    effects->prePaintWindow(w, data, time);
}
Beispiel #13
0
void PulseEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time )
    {
    if( mTimeLineWindows.contains( w ) )
        {
        mTimeLineWindows[ w ].second.addTime( time );
        if( mTimeLineWindows[ w ].second.value() < 1 )
            data.setTransformed();
        else if ( !mTimeLineWindows[ w ].first )
            { // zoom complete, now pulse
            mTimeLineWindows[ w ].first = true;
            TimeLine& t = mTimeLineWindows[ w ].second;
            t.setCurveShape( TimeLine::EaseOutCurve );
            t.setDuration( animationTime( mPulseDuration ) );
            t.setProgress( 0.0 );
            data.setTransformed();
            }
        else
            mTimeLineWindows.remove( w );
        }
    effects->prePaintWindow( w, data, time );
    }
Beispiel #14
0
void DimScreenEffect::reconfigure(ReconfigureFlags)
{
    timeline.setDuration(animationTime(250));
}
Beispiel #15
0
void SnapHelperEffect::reconfigure(ReconfigureFlags)
{
    m_timeline.setDuration(animationTime(250));
}
Beispiel #16
0
void SlidingPopupsEffect::slotPropertyNotify(EffectWindow* w, long a)
{
    if (!w || a != mAtom)
        return;

    QByteArray data = w->readProperty(mAtom, mAtom, 32);

    if (data.length() < 1) {
        // Property was removed, thus also remove the effect for window
        delete mAppearingWindows.take(w);
        delete mDisappearingWindows.take(w);
        mWindowsData.remove(w);
        return;
    }

    auto* d = reinterpret_cast< uint32_t* >(data.data());
    Data animData;
    animData.start = d[ 0 ];
    animData.from = (Position)d[ 1 ];
    if (data.length() >= (int)(sizeof(uint32_t) * 3)) {
        animData.fadeInDuration = d[2];
        if (data.length() >= (int)(sizeof(uint32_t) * 4))
            animData.fadeOutDuration = d[3];
        else
            animData.fadeOutDuration = d[2];
    } else {
        animData.fadeInDuration = animationTime(mFadeInTime);
        animData.fadeOutDuration = animationTime(mFadeOutTime);
    }
    const QRect screenRect = effects->clientArea(FullScreenArea, w->screen(), effects->currentDesktop());
    if (animData.start == -1) {
        switch (animData.from) {
        case West:
            animData.start = qMax(w->x() - screenRect.x(), 0);
            break;
        case North:
            animData.start = qMax(w->y() - screenRect.y(), 0);
            break;
        case East:
            animData.start = qMax(screenRect.x() + screenRect.width() - (w->x() + w->width()), 0);
            break;
        case South:
        default:
            animData.start = qMax(screenRect.y() + screenRect.height() - (w->y() + w->height()), 0);
            break;
        }
    }
    // sanitize
    int difference = 0;
    switch (animData.from) {
    case West:
        difference = w->x() - screenRect.x();
        break;
    case North:
        difference = w->y() - screenRect.y();
        break;
    case East:
        difference = w->x() + w->width() - (screenRect.x() + screenRect.width());
        break;
    case South:
    default:
        difference = w->y() + w->height() - (screenRect.y() + screenRect.height());
        break;
    }
    animData.start = qMax<int>(animData.start, difference);
    mWindowsData[ w ] = animData;
}
Beispiel #17
0
void MinimizeAnimationEffect::windowUnminimized( EffectWindow* w )
    {
    mTimeLineWindows[w].setCurveShape(TimeLine::EaseOutCurve);
    mTimeLineWindows[w].setDuration( animationTime( 250 ));
    mTimeLineWindows[w].setProgress(1.0f);
    }
Beispiel #18
0
void SlideEffect::reconfigure( ReconfigureFlags )
    {
    mTimeLine.setDuration( animationTime( 250 ));
    }