Force backgroundcontrast during slidingpopup animations

This fixes the sliding popups losing their contrast effect when
animating, less flicker.

In this patch, we temporarily force the contrast effect on, but only if
it hasn't been explicitely disabled. As soon as the animation stops, the
force flag is disabled again. For disappearing windows, we just set the
flag in the same way, but skip over the bookkeeping, since the window is
going to be deleted, anyway.

REVIEW:115902
This commit is contained in:
Sebastian Kügler 2014-02-20 14:10:18 +01:00
parent 57a0667e9d
commit ca172e2082
2 changed files with 18 additions and 0 deletions

View file

@ -85,6 +85,11 @@ void SlidingPopupsEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& da
} else {
delete mAppearingWindows.take(w);
w->setData(WindowForceBlurRole, false);
if (m_backgroundContrastForced.contains(w) && w->hasAlpha() &&
w->data(WindowForceBackgroundContrastRole).toBool()) {
w->setData(WindowForceBackgroundContrastRole, QVariant());
m_backgroundContrastForced.removeAll(w);
}
}
} else if (mDisappearingWindows.contains(w)) {
@ -255,6 +260,10 @@ void SlidingPopupsEffect::slotWindowAdded(EffectWindow *w)
{
slotPropertyNotify(w, mAtom);
if (w->isOnCurrentDesktop() && mWindowsData.contains(w)) {
if (!w->data(WindowForceBackgroundContrastRole).isValid() && w->hasAlpha()) {
w->setData(WindowForceBackgroundContrastRole, QVariant(true));
m_backgroundContrastForced.append(w);
}
mAppearingWindows.insert(w, new QTimeLine(mWindowsData[ w ].fadeInDuration, this));
mAppearingWindows[ w ]->setCurveShape(QTimeLine::EaseInOutCurve);
@ -278,9 +287,13 @@ void SlidingPopupsEffect::slotWindowClosed(EffectWindow* w)
// Tell other windowClosed() effects to ignore this window
w->setData(WindowClosedGrabRole, QVariant::fromValue(static_cast<void*>(this)));
w->setData(WindowForceBlurRole, true);
if (!w->data(WindowForceBackgroundContrastRole).isValid() && w->hasAlpha()) {
w->setData(WindowForceBackgroundContrastRole, QVariant(true));
}
w->addRepaintFull();
}
m_backgroundContrastForced.removeAll(w);
}
void SlidingPopupsEffect::slotWindowDeleted(EffectWindow* w)

View file

@ -74,6 +74,11 @@ private:
int slideLength;
};
long mAtom;
// This list is only for appearing windows: we remember that we've enabled the
// WindowBackgroundContrastForcedRole flag, so we can remove it later.
// It doesn't matter for disappearing windows, they'll be deleted anyway.
QList< const EffectWindow* > m_backgroundContrastForced;
QHash< const EffectWindow*, QTimeLine* > mAppearingWindows;
QHash< const EffectWindow*, QTimeLine* > mDisappearingWindows;
QHash< const EffectWindow*, Data > mWindowsData;