[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kde-workspace] kwin/effects/slidingpopups: Force backgroundcontrast during slidingpopup animations
From:       Sebastian_Kügler <sebas () kde ! org>
Date:       2014-02-20 13:11:13
Message-ID: E1WGTPF-0007X5-6N () scm ! kde ! org
[Download RAW message or body]

Git commit a2f398292d05b44ec23406a71b9b84e8eb786dcf by Sebastian K=C3=BCgle=
r.
Committed on 20/02/2014 at 13:10.
Pushed by sebas into branch 'master'.

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

M  +13   -0    kwin/effects/slidingpopups/slidingpopups.cpp
M  +5    -0    kwin/effects/slidingpopups/slidingpopups.h

http://commits.kde.org/kde-workspace/a2f398292d05b44ec23406a71b9b84e8eb786d=
cf

diff --git a/kwin/effects/slidingpopups/slidingpopups.cpp b/kwin/effects/sl=
idingpopups/slidingpopups.cpp
index 4f0a9ea..99c3bfe 100644
--- a/kwin/effects/slidingpopups/slidingpopups.cpp
+++ b/kwin/effects/slidingpopups/slidingpopups.cpp
@@ -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->ha=
sAlpha()) {
+            w->setData(WindowForceBackgroundContrastRole, QVariant(true));
+            m_backgroundContrastForced.append(w);
+        }
         mAppearingWindows.insert(w, new QTimeLine(mWindowsData[ w ].fadeIn=
Duration, this));
         mAppearingWindows[ w ]->setCurveShape(QTimeLine::EaseInOutCurve);
 =

@@ -278,9 +287,13 @@ void SlidingPopupsEffect::slotWindowClosed(EffectWindo=
w* w)
         // Tell other windowClosed() effects to ignore this window
         w->setData(WindowClosedGrabRole, QVariant::fromValue(static_cast<v=
oid*>(this)));
         w->setData(WindowForceBlurRole, true);
+        if (!w->data(WindowForceBackgroundContrastRole).isValid() && w->ha=
sAlpha()) {
+            w->setData(WindowForceBackgroundContrastRole, QVariant(true));
+        }
 =

         w->addRepaintFull();
     }
+    m_backgroundContrastForced.removeAll(w);
 }
 =

 void SlidingPopupsEffect::slotWindowDeleted(EffectWindow* w)
diff --git a/kwin/effects/slidingpopups/slidingpopups.h b/kwin/effects/slid=
ingpopups/slidingpopups.h
index f66e42e..77f0103 100644
--- a/kwin/effects/slidingpopups/slidingpopups.h
+++ b/kwin/effects/slidingpopups/slidingpopups.h
@@ -74,6 +74,11 @@ private:
         int slideLength;
     };
     long mAtom;
+
+    // This list is only for appearing windows: we remember that we've ena=
bled the
+    // WindowBackgroundContrastForcedRole flag, so we can remove it later.
+    // It doesn't matter for disappearing windows, they'll be deleted anyw=
ay.
+    QList< const EffectWindow* > m_backgroundContrastForced;
     QHash< const EffectWindow*, QTimeLine* > mAppearingWindows;
     QHash< const EffectWindow*, QTimeLine* > mDisappearingWindows;
     QHash< const EffectWindow*, Data > mWindowsData;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic