aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVlad Zagorodniy <[email protected]>2018-10-17 14:05:11 +0300
committerVlad Zagorodniy <[email protected]>2018-10-18 19:27:01 +0300
commitab5d66dc0f1ac7e13bef360304d2f7aef8387c22 (patch)
tree435f9b56c0c2aad44ccffa1d419bf544eda3cf16
parent984727ad93cae2c4fd21b04d9c8250eef17f28bc (diff)
[effects/diminactive] Fix false-triggering of the out animation
Summary: In some cases, the out transition is false-triggered because we don't react to changes in the keep-above and the full screen state. Test Plan: * Set the keep-above state on a window; * Click on the desktop; * (the window didn't "flicker") Reviewers: #kwin, davidedmundson Reviewed By: #kwin, davidedmundson Subscribers: davidedmundson, abetts, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D16270
-rw-r--r--effects.cpp17
-rw-r--r--effects/diminactive/diminactive.cpp29
-rw-r--r--effects/diminactive/diminactive.h4
-rw-r--r--libkwineffects/kwineffects.h24
4 files changed, 65 insertions, 9 deletions
diff --git a/effects.cpp b/effects.cpp
index 8b6cf4c..7761ca9 100644
--- a/effects.cpp
+++ b/effects.cpp
@@ -338,6 +338,23 @@ void EffectsHandlerImpl::setupAbstractClientConnections(AbstractClient* c)
emit windowHidden(c->effectWindow());
}
);
+ connect(c, &AbstractClient::keepAboveChanged, this,
+ [this, c](bool above) {
+ Q_UNUSED(above)
+ emit windowKeepAboveChanged(c->effectWindow());
+ }
+ );
+ connect(c, &AbstractClient::keepBelowChanged, this,
+ [this, c](bool below) {
+ Q_UNUSED(below)
+ emit windowKeepBelowChanged(c->effectWindow());
+ }
+ );
+ connect(c, &AbstractClient::fullScreenChanged, this,
+ [this, c]() {
+ emit windowFullScreenChanged(c->effectWindow());
+ }
+ );
}
void EffectsHandlerImpl::setupClientConnections(Client* c)
diff --git a/effects/diminactive/diminactive.cpp b/effects/diminactive/diminactive.cpp
index a6f4f05..862e161 100644
--- a/effects/diminactive/diminactive.cpp
+++ b/effects/diminactive/diminactive.cpp
@@ -57,6 +57,10 @@ DimInactiveEffect::DimInactiveEffect()
this, &DimInactiveEffect::windowDeleted);
connect(effects, &EffectsHandler::activeFullScreenEffectChanged,
this, &DimInactiveEffect::activeFullScreenEffectChanged);
+ connect(effects, &EffectsHandler::windowKeepAboveChanged,
+ this, &DimInactiveEffect::updateActiveWindow);
+ connect(effects, &EffectsHandler::windowFullScreenChanged,
+ this, &DimInactiveEffect::updateActiveWindow);
}
DimInactiveEffect::~DimInactiveEffect()
@@ -77,14 +81,7 @@ void DimInactiveEffect::reconfigure(ReconfigureFlags flags)
m_dimByGroup = DimInactiveConfig::dimByGroup();
m_dimFullScreen = DimInactiveConfig::dimFullScreen();
- // Need to reset m_activeWindow becase canDimWindow returns false
- // if m_activeWindow is equal to effects->activeWindow().
- m_activeWindow = nullptr;
-
- EffectWindow *activeWindow = effects->activeWindow();
- m_activeWindow = (activeWindow && canDimWindow(activeWindow))
- ? activeWindow
- : nullptr;
+ updateActiveWindow(effects->activeWindow());
m_activeWindowGroup = (m_dimByGroup && m_activeWindow)
? m_activeWindow->group()
@@ -400,4 +397,20 @@ void DimInactiveEffect::activeFullScreenEffectChanged()
effects->addRepaintFull();
}
+void DimInactiveEffect::updateActiveWindow(EffectWindow *w)
+{
+ if (effects->activeWindow() == nullptr) {
+ return;
+ }
+
+ if (effects->activeWindow() != w) {
+ return;
+ }
+
+ // Need to reset m_activeWindow because canDimWindow depends on it.
+ m_activeWindow = nullptr;
+
+ m_activeWindow = canDimWindow(w) ? w : nullptr;
+}
+
} // namespace KWin
diff --git a/effects/diminactive/diminactive.h b/effects/diminactive/diminactive.h
index 4aef26e..b145833 100644
--- a/effects/diminactive/diminactive.h
+++ b/effects/diminactive/diminactive.h
@@ -65,6 +65,8 @@ private Q_SLOTS:
void windowDeleted(EffectWindow *w);
void activeFullScreenEffectChanged();
+ void updateActiveWindow(EffectWindow *w);
+
private:
void dimWindow(WindowPaintData &data, qreal strength);
bool canDimWindow(const EffectWindow *w) const;
@@ -82,7 +84,7 @@ private:
bool m_dimByGroup;
bool m_dimFullScreen;
- EffectWindow *m_activeWindow;
+ EffectWindow *m_activeWindow = nullptr;
const EffectWindowGroup *m_activeWindowGroup;
QHash<EffectWindow*, TimeLine> m_transitions;
QHash<EffectWindow*, qreal> m_forceDim;
diff --git a/libkwineffects/kwineffects.h b/libkwineffects/kwineffects.h
index 0702ed7..c3ce5cd 100644
--- a/libkwineffects/kwineffects.h
+++ b/libkwineffects/kwineffects.h
@@ -1729,6 +1729,30 @@ Q_SIGNALS:
**/
void hasActiveFullScreenEffectChanged();
+ /**
+ * This signal is emitted when the keep above state of @p w was changed.
+ *
+ * @param w The window whose the keep above state was changed.
+ * @since 5.15
+ **/
+ void windowKeepAboveChanged(EffectWindow *w);
+
+ /**
+ * This signal is emitted when the keep below state of @p was changed.
+ *
+ * @param w The window whose the keep below state was changed.
+ * @since 5.15
+ **/
+ void windowKeepBelowChanged(EffectWindow *w);
+
+ /**
+ * This signal is emitted when the full screen state of @p w was changed.
+ *
+ * @param w The window whose the full screen state was changed.
+ * @since 5.15
+ **/
+ void windowFullScreenChanged(EffectWindow *w);
+
protected:
QVector< EffectPair > loaded_effects;
//QHash< QString, EffectFactory* > effect_factories;