diff --git a/effects/slidingpopups/slidingpopups.cpp b/effects/slidingpopups/slidingpopups.cpp --- a/effects/slidingpopups/slidingpopups.cpp +++ b/effects/slidingpopups/slidingpopups.cpp @@ -40,8 +40,6 @@ display->createSlideManager(this)->create(); } - m_slideLength = QFontMetrics(qApp->font()).height() * 8; - m_atom = effects->announceSupportProperty("_KDE_SLIDE", this); connect(effects, &EffectsHandler::windowAdded, this, &SlidingPopupsEffect::slotWindowAdded); connect(effects, &EffectsHandler::windowClosed, this, &SlidingPopupsEffect::slideOut); @@ -121,44 +119,47 @@ } const AnimationData &animData = m_animationsData[w]; - const int slideLength = (animData.slideLength > 0) ? animData.slideLength : m_slideLength; const QRect screenRect = effects->clientArea(FullScreenArea, w->screen(), effects->currentDesktop()); int splitPoint = 0; const QRect geo = w->expandedGeometry(); const qreal t = (*animationIt).timeLine.value(); + int slideLength = animData.slideLength; + + data.multiplyOpacity(interpolate(0.0, 1.0, t)); + switch (animData.location) { case Location::Left: - if (slideLength < geo.width()) { - data.multiplyOpacity(t); - } - data.translate(-interpolate(qMin(geo.width(), slideLength), 0.0, t)); + slideLength = (slideLength > 0) ? slideLength : geo.width(); + slideLength = qMin(geo.width(), slideLength); + + data.translate(-interpolate(slideLength, 0.0, t)); splitPoint = geo.width() - (geo.x() + geo.width() - screenRect.x() - animData.offset); region = QRegion(geo.x() + splitPoint, geo.y(), geo.width() - splitPoint, geo.height()); break; case Location::Top: - if (slideLength < geo.height()) { - data.multiplyOpacity(t); - } - data.translate(0.0, -interpolate(qMin(geo.height(), slideLength), 0.0, t)); + slideLength = (slideLength > 0) ? slideLength : geo.height(); + slideLength = qMin(geo.height(), slideLength); + + data.translate(0.0, -interpolate(slideLength, 0.0, t)); splitPoint = geo.height() - (geo.y() + geo.height() - screenRect.y() - animData.offset); region = QRegion(geo.x(), geo.y() + splitPoint, geo.width(), geo.height() - splitPoint); break; case Location::Right: - if (slideLength < geo.width()) { - data.multiplyOpacity(t); - } - data.translate(interpolate(qMin(geo.width(), slideLength), 0.0, t)); + slideLength = (slideLength > 0) ? slideLength : geo.width(); + slideLength = qMin(geo.width(), slideLength); + + data.translate(interpolate(slideLength, 0.0, t)); splitPoint = screenRect.x() + screenRect.width() - geo.x() - animData.offset; region = QRegion(geo.x(), geo.y(), splitPoint, geo.height()); break; case Location::Bottom: default: - if (slideLength < geo.height()) { - data.multiplyOpacity(t); - } - data.translate(0.0, interpolate(qMin(geo.height(), slideLength), 0.0, t)); + slideLength = (slideLength > 0) ? slideLength : geo.height(); + slideLength = qMin(geo.height(), slideLength); + + data.translate(0.0, interpolate(slideLength, 0.0, t)); splitPoint = screenRect.y() + screenRect.height() - geo.y() - animData.offset; region = QRegion(geo.x(), geo.y(), geo.width(), splitPoint); } @@ -396,7 +397,7 @@ animation.kind = AnimationKind::In; animation.timeLine.setDirection(TimeLine::Forward); animation.timeLine.setDuration((*dataIt).slideInDuration); - animation.timeLine.setEasingCurve(QEasingCurve::InOutSine); + animation.timeLine.setEasingCurve(QEasingCurve::OutExpo); // If the opposite animation (Out) was active and it had shorter duration, // at this point, the timeline can end up in the "done" state. Thus, we have @@ -435,7 +436,7 @@ animation.kind = AnimationKind::Out; animation.timeLine.setDirection(TimeLine::Backward); animation.timeLine.setDuration((*dataIt).slideOutDuration); - animation.timeLine.setEasingCurve(QEasingCurve::InOutSine); + animation.timeLine.setEasingCurve(QEasingCurve::OutExpo); // basically InQuart, as direction is backwards // If the opposite animation (In) was active and it had shorter duration, // at this point, the timeline can end up in the "done" state. Thus, we have