Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit ab5d66dc authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

[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
parent 984727ad
......@@ -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)
......
......@@ -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
......@@ -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;
......
......@@ -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;
......
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