libkwineffects: Introduce windowExpandedGeometryChanged()

This signal can be useful if you want to know when the visible geometry
has changed to update cached repaint region during an animation.
This commit is contained in:
Vlad Zahorodnii 2021-02-05 15:05:13 +02:00
parent c6d2eee3c1
commit b61c800cee
6 changed files with 26 additions and 15 deletions

View file

@ -354,6 +354,9 @@ void EffectsHandlerImpl::setupClientConnections(AbstractClient* c)
emit windowFullScreenChanged(c->effectWindow());
}
);
connect(c, &AbstractClient::visibleGeometryChanged, this, [this, c]() {
emit windowExpandedGeometryChanged(c->effectWindow());
});
}
void EffectsHandlerImpl::setupUnmanagedConnections(Unmanaged* u)
@ -364,6 +367,9 @@ void EffectsHandlerImpl::setupUnmanagedConnections(Unmanaged* u)
connect(u, &Unmanaged::frameGeometryChanged, this, &EffectsHandlerImpl::slotFrameGeometryChanged);
connect(u, &Unmanaged::paddingChanged, this, &EffectsHandlerImpl::slotPaddingChanged);
connect(u, &Unmanaged::damaged, this, &EffectsHandlerImpl::slotWindowDamaged);
connect(u, &Unmanaged::visibleGeometryChanged, this, [this, u]() {
emit windowExpandedGeometryChanged(u->effectWindow());
});
}
void EffectsHandlerImpl::reconfigure()

View file

@ -213,12 +213,8 @@ quint64 AnimationEffect::p_animate( EffectWindow *w, Attribute a, uint meta, int
if (!d->m_isInitialized)
init(); // needs to ensure the window gets removed if deleted in the same event cycle
if (d->m_animations.isEmpty()) {
connect(effects, &EffectsHandler::windowGeometryShapeChanged,
this, &AnimationEffect::_expandedGeometryChanged);
connect(effects, &EffectsHandler::windowStepUserMovedResized,
this, &AnimationEffect::_expandedGeometryChanged);
connect(effects, &EffectsHandler::windowPaddingChanged,
this, &AnimationEffect::_expandedGeometryChanged);
connect(effects, &EffectsHandler::windowExpandedGeometryChanged,
this, &AnimationEffect::_windowExpandedGeometryChanged);
}
AniMap::iterator it = d->m_animations.find(w);
if (it == d->m_animations.end())
@ -555,12 +551,8 @@ void AnimationEffect::clipWindow(const EffectWindow *w, const AniData &anim, Win
void AnimationEffect::disconnectGeometryChanges()
{
disconnect(effects, &EffectsHandler::windowGeometryShapeChanged,
this, &AnimationEffect::_expandedGeometryChanged);
disconnect(effects, &EffectsHandler::windowStepUserMovedResized,
this, &AnimationEffect::_expandedGeometryChanged);
disconnect(effects, &EffectsHandler::windowPaddingChanged,
this, &AnimationEffect::_expandedGeometryChanged);
disconnect(effects, &EffectsHandler::windowExpandedGeometryChanged,
this, &AnimationEffect::_windowExpandedGeometryChanged);
}
@ -970,9 +962,8 @@ region_creation:
d->m_damageDirty = false;
}
void AnimationEffect::_expandedGeometryChanged(KWin::EffectWindow *w, const QRect &old)
void AnimationEffect::_windowExpandedGeometryChanged(KWin::EffectWindow *w)
{
Q_UNUSED(old)
Q_D(AnimationEffect);
AniMap::const_iterator entry = d->m_animations.constFind(w);
if (entry != d->m_animations.constEnd()) {

View file

@ -389,7 +389,7 @@ private Q_SLOTS:
void triggerRepaint();
void _windowClosed( KWin::EffectWindow* w );
void _windowDeleted( KWin::EffectWindow* w );
void _expandedGeometryChanged(KWin::EffectWindow *w, const QRect &old);
void _windowExpandedGeometryChanged(KWin::EffectWindow *w);
private:
static QElapsedTimer s_clock;

View file

@ -1845,6 +1845,11 @@ Q_SIGNALS:
*/
void sessionStateChanged();
/**
* This signal is emitted when the visible geometry of a window changed.
*/
void windowExpandedGeometryChanged(KWin::EffectWindow *window);
protected:
QVector< EffectPair > loaded_effects;
//QHash< QString, EffectFactory* > effect_factories;

View file

@ -50,6 +50,10 @@ Toplevel::Toplevel()
setupCheckScreenConnection();
connect(this, &Toplevel::bufferGeometryChanged, this, &Toplevel::inputTransformationChanged);
connect(this, &Toplevel::paddingChanged, this, &Toplevel::visibleGeometryChanged);
connect(this, &Toplevel::bufferGeometryChanged, this, &Toplevel::visibleGeometryChanged);
connect(this, &Toplevel::frameGeometryChanged, this, &Toplevel::visibleGeometryChanged);
// Only for compatibility reasons, drop in the next major release.
connect(this, &Toplevel::frameGeometryChanged, this, &Toplevel::geometryChanged);
}

View file

@ -665,6 +665,11 @@ Q_SIGNALS:
*/
void clientGeometryChanged(KWin::Toplevel *toplevel, const QRect &oldGeometry);
/**
* This signal is emitted when the visible geometry has changed.
*/
void visibleGeometryChanged();
protected Q_SLOTS:
/**
* Checks whether the screen number for this Toplevel changed and updates if needed.