Commit e9ab3485 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

[effects] Ignore previous state of WindowForceBlurRole

Summary:
Currently, effects like Maximize, Slide Back have problems with setting
WindowForceBlurRole. They store previous state of WindowForceBlurRole.
This is wrong. Instead they should either ignore previous state of
WindowForceBlur or refcount forced role.

There's no need for refcounting right now. For example, if several effects
force blur or background contrast, they are most likely in a conflict.
Please notice that the Desktop Grid effect uses the Present Windows
effect only to calculate transformations.

Some other problems with the code that sets WindowForceBlurRole:
* Maximize effect stores previous state of WindowForceBlurRole only
  for one window. It ignores the fact that there could be several
  active maximize animations;
* Desktop Grid/Present Windows/Slide back don't clean after themselves.
  So, after using those effects for good amount of times, memory usage
  will bump.

Test Plan:
* Enabled blur for Konsole
* Maximized Konsole
* Activated Present Windows
* Activated Desktop Grid
* Raised another window(to trigger Slide Back)

Reviewers: #kwin, fredrik

Reviewed By: fredrik

Subscribers: fredrik, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D13479
parent 64d1b0e9
......@@ -164,7 +164,6 @@ void DesktopGridEffect::prePaintScreen(ScreenPrePaintData& data, int time)
}
for (auto const &w : effects->stackingOrder()) {
m_windowForceBlurRoleState[w] = w->data(WindowForceBlurRole).toBool();
w->setData(WindowForceBlurRole, QVariant(true));
}
......@@ -257,7 +256,7 @@ void DesktopGridEffect::postPaintScreen()
}
for (auto &w : effects->stackingOrder()) {
w->setData(WindowForceBlurRole, m_windowForceBlurRoleState.value(w, false));
w->setData(WindowForceBlurRole, QVariant());
}
effects->postPaintScreen();
......
......@@ -175,9 +175,6 @@ private:
// Shortcut - needed to toggle the effect
QList<QKeySequence> shortcut;
// State of WindowForceBlurRole before this effect
QMap <EffectWindow*, bool> m_windowForceBlurRoleState;
PresentWindowsEffectProxy* m_proxy;
QList<WindowMotionManager> m_managers;
bool m_usePresentWindows;
......
......@@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/*global effect, effects, animate, animationTime, Effect*/
var maximizeEffect = {
duration: animationTime(250),
windowForceBlurRoleState: false,
loadConfig: function () {
"use strict";
maximizeEffect.duration = animationTime(250);
......@@ -29,7 +28,6 @@ var maximizeEffect = {
if (!window.oldGeometry) {
return;
}
maximizeEffect.windowForceBlurRoleState = window.data(Effect.WindowForceBlurRole);
window.setData(Effect.WindowForceBlurRole, true);
var oldGeometry, newGeometry;
oldGeometry = window.oldGeometry;
......@@ -76,7 +74,7 @@ var maximizeEffect = {
}
},
restoreForceBlurState: function(window) {
window.setData(Effect.WindowForceBlurRole, maximizeEffect.windowForceBlurRoleState);
window.setData(Effect.WindowForceBlurRole, null);
},
geometryChange: function (window, oldGeometry) {
"use strict";
......
......@@ -244,8 +244,8 @@ void PresentWindowsEffect::postPaintScreen()
m_windowData.clear();
foreach (EffectWindow * w, effects->stackingOrder()) {
w->setData(WindowForceBlurRole, QVariant(m_windowForceBlurRoleState.value(w, false)));
w->setData(WindowForceBackgroundContrastRole, QVariant(false));
w->setData(WindowForceBlurRole, QVariant());
w->setData(WindowForceBackgroundContrastRole, QVariant());
}
effects->setActiveFullScreenEffect(NULL);
effects->addRepaintFull();
......@@ -1584,7 +1584,6 @@ void PresentWindowsEffect::setActive(bool active)
setHighlightedWindow(effects->activeWindow());
foreach (EffectWindow * w, effects->stackingOrder()) {
m_windowForceBlurRoleState[w] = w->data(WindowForceBlurRole).toBool();
w->setData(WindowForceBlurRole, QVariant(true));
w->setData(WindowForceBackgroundContrastRole, QVariant(true));
}
......
......@@ -309,9 +309,6 @@ private:
// Grid layout info
QList<GridSize> m_gridSizes;
// State of WindowForceBlurRole before this effect
QMap <EffectWindow*, bool> m_windowForceBlurRoleState;
// Filter box
EffectFrame* m_filterFrame;
QString m_windowFilter;
......
......@@ -151,7 +151,6 @@ void SlideBackEffect::prePaintScreen(ScreenPrePaintData &data, int time)
}
for (auto const &w : effects->stackingOrder()) {
m_windowForceBlurRoleState[w] = w->data(WindowForceBlurRole).toBool();
w->setData(WindowForceBlurRole, QVariant(true));
}
......@@ -165,7 +164,7 @@ void SlideBackEffect::postPaintScreen()
}
for (auto &w : effects->stackingOrder()) {
w->setData(WindowForceBlurRole, m_windowForceBlurRoleState.value(w, false));
w->setData(WindowForceBlurRole, QVariant());
}
effects->postPaintScreen();
......
......@@ -66,8 +66,6 @@ private:
int m_tabboxActive;
QList <QRegion> clippedRegions;
QMap <EffectWindow*, bool> m_windowForceBlurRoleState;
QRect getSlideDestination(const QRect &windowUnderGeometry, const QRect &windowOverGeometry);
bool isWindowUsable(EffectWindow *w);
bool intersects(EffectWindow *windowUnder, const QRect &windowOverGeometry);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment