Have Toplevel::damage emit a QRegion
Instead of looping through the rects in the region, emit the region at bulk. It reduces the amount of emissions we do and allows us to pack the response accordingly.master
parent
fd917b4e00
commit
26950a65a6
|
@ -590,7 +590,7 @@ void EffectsHandlerImpl::slotTabRemoved(EffectWindow *w, EffectWindow* leaderOfF
|
||||||
emit tabRemoved(w, leaderOfFormerGroup);
|
emit tabRemoved(w, leaderOfFormerGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectsHandlerImpl::slotWindowDamaged(Toplevel* t, const QRect& r)
|
void EffectsHandlerImpl::slotWindowDamaged(Toplevel* t, const QRegion& r)
|
||||||
{
|
{
|
||||||
if (!t->effectWindow()) {
|
if (!t->effectWindow()) {
|
||||||
// can happen during tear down of window
|
// can happen during tear down of window
|
||||||
|
|
|
@ -289,7 +289,7 @@ protected Q_SLOTS:
|
||||||
void slotGeometryShapeChanged(KWin::Toplevel *t, const QRect &old);
|
void slotGeometryShapeChanged(KWin::Toplevel *t, const QRect &old);
|
||||||
void slotFrameGeometryChanged(Toplevel *toplevel, const QRect &oldGeometry);
|
void slotFrameGeometryChanged(Toplevel *toplevel, const QRect &oldGeometry);
|
||||||
void slotPaddingChanged(KWin::Toplevel *t, const QRect &old);
|
void slotPaddingChanged(KWin::Toplevel *t, const QRect &old);
|
||||||
void slotWindowDamaged(KWin::Toplevel *t, const QRect& r);
|
void slotWindowDamaged(KWin::Toplevel *t, const QRegion& r);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void connectNotify(const QMetaMethod &signal) override;
|
void connectNotify(const QMetaMethod &signal) override;
|
||||||
|
|
|
@ -73,7 +73,7 @@ void ThumbnailAsideEffect::paintWindow(EffectWindow *w, int mask, QRegion region
|
||||||
painted |= region;
|
painted |= region;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThumbnailAsideEffect::slotWindowDamaged(EffectWindow* w, const QRect&)
|
void ThumbnailAsideEffect::slotWindowDamaged(EffectWindow* w, const QRegion&)
|
||||||
{
|
{
|
||||||
foreach (const Data & d, windows) {
|
foreach (const Data & d, windows) {
|
||||||
if (d.window == w)
|
if (d.window == w)
|
||||||
|
|
|
@ -55,7 +55,7 @@ private Q_SLOTS:
|
||||||
void toggleCurrentThumbnail();
|
void toggleCurrentThumbnail();
|
||||||
void slotWindowClosed(KWin::EffectWindow *w);
|
void slotWindowClosed(KWin::EffectWindow *w);
|
||||||
void slotWindowFrameGeometryChanged(KWin::EffectWindow *w, const QRect &old);
|
void slotWindowFrameGeometryChanged(KWin::EffectWindow *w, const QRect &old);
|
||||||
void slotWindowDamaged(KWin::EffectWindow* w, const QRect& damage);
|
void slotWindowDamaged(KWin::EffectWindow* w, const QRegion& damage);
|
||||||
bool isActive() const override;
|
bool isActive() const override;
|
||||||
void repaintAll();
|
void repaintAll();
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -175,7 +175,7 @@ X-KDE-Library=kwin4_effect_cooleffect
|
||||||
|
|
||||||
#define KWIN_EFFECT_API_MAKE_VERSION( major, minor ) (( major ) << 8 | ( minor ))
|
#define KWIN_EFFECT_API_MAKE_VERSION( major, minor ) (( major ) << 8 | ( minor ))
|
||||||
#define KWIN_EFFECT_API_VERSION_MAJOR 0
|
#define KWIN_EFFECT_API_VERSION_MAJOR 0
|
||||||
#define KWIN_EFFECT_API_VERSION_MINOR 231
|
#define KWIN_EFFECT_API_VERSION_MINOR 232
|
||||||
#define KWIN_EFFECT_API_VERSION KWIN_EFFECT_API_MAKE_VERSION( \
|
#define KWIN_EFFECT_API_VERSION KWIN_EFFECT_API_MAKE_VERSION( \
|
||||||
KWIN_EFFECT_API_VERSION_MAJOR, KWIN_EFFECT_API_VERSION_MINOR )
|
KWIN_EFFECT_API_VERSION_MAJOR, KWIN_EFFECT_API_VERSION_MINOR )
|
||||||
|
|
||||||
|
@ -1561,7 +1561,7 @@ Q_SIGNALS:
|
||||||
* @param r Always empty.
|
* @param r Always empty.
|
||||||
* @since 4.7
|
* @since 4.7
|
||||||
*/
|
*/
|
||||||
void windowDamaged(KWin::EffectWindow *w, const QRect &r);
|
void windowDamaged(KWin::EffectWindow *w, const QRegion &r);
|
||||||
/**
|
/**
|
||||||
* Signal emitted when a tabbox is added.
|
* Signal emitted when a tabbox is added.
|
||||||
* An effect who wants to replace the tabbox with itself should use refTabBox.
|
* An effect who wants to replace the tabbox with itself should use refTabBox.
|
||||||
|
|
|
@ -90,7 +90,7 @@ private:
|
||||||
m_toplevel->addRepaintFull();
|
m_toplevel->addRepaintFull();
|
||||||
}
|
}
|
||||||
|
|
||||||
void includeDamage(Toplevel *toplevel, const QRect &damage) {
|
void includeDamage(Toplevel *toplevel, const QRegion &damage) {
|
||||||
Q_ASSERT(m_toplevel == toplevel);
|
Q_ASSERT(m_toplevel == toplevel);
|
||||||
m_damagedRegion |= damage;
|
m_damagedRegion |= damage;
|
||||||
}
|
}
|
||||||
|
|
14
toplevel.cpp
14
toplevel.cpp
|
@ -45,7 +45,7 @@ Toplevel::Toplevel()
|
||||||
, m_screen(0)
|
, m_screen(0)
|
||||||
, m_skipCloseAnimation(false)
|
, m_skipCloseAnimation(false)
|
||||||
{
|
{
|
||||||
connect(this, SIGNAL(damaged(KWin::Toplevel*,QRect)), SIGNAL(needsRepaint()));
|
connect(this, &Toplevel::damaged, this, &Toplevel::needsRepaint);
|
||||||
connect(screens(), SIGNAL(changed()), SLOT(checkScreen()));
|
connect(screens(), SIGNAL(changed()), SLOT(checkScreen()));
|
||||||
connect(screens(), SIGNAL(countChanged(int,int)), SLOT(checkScreen()));
|
connect(screens(), SIGNAL(countChanged(int,int)), SLOT(checkScreen()));
|
||||||
setupCheckScreenConnection();
|
setupCheckScreenConnection();
|
||||||
|
@ -327,10 +327,10 @@ void Toplevel::damageNotifyEvent()
|
||||||
{
|
{
|
||||||
m_isDamaged = true;
|
m_isDamaged = true;
|
||||||
|
|
||||||
// Note: The rect is supposed to specify the damage extents,
|
// Note: The damage is supposed to specify the damage extents,
|
||||||
// but we don't know it at this point. No one who connects
|
// but we don't know it at this point. No one who connects
|
||||||
// to this signal uses the rect however.
|
// to this signal uses the rect however.
|
||||||
emit damaged(this, QRect());
|
emit damaged(this, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Toplevel::compositing() const
|
bool Toplevel::compositing() const
|
||||||
|
@ -421,12 +421,12 @@ void Toplevel::addDamageFull()
|
||||||
const int offsetX = bufferRect.x() - frameRect.x();
|
const int offsetX = bufferRect.x() - frameRect.x();
|
||||||
const int offsetY = bufferRect.y() - frameRect.y();
|
const int offsetY = bufferRect.y() - frameRect.y();
|
||||||
|
|
||||||
const QRect damagedRect = QRect(0, 0, bufferRect.width(), bufferRect.height());
|
const QRect damagedRect(0, 0, bufferRect.width(), bufferRect.height());
|
||||||
|
|
||||||
damage_region = damagedRect;
|
damage_region = damagedRect;
|
||||||
repaints_region |= damagedRect.translated(offsetX, offsetY);
|
repaints_region |= damagedRect.translated(offsetX, offsetY);
|
||||||
|
|
||||||
emit damaged(this, damagedRect);
|
emit damaged(this, damage_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Toplevel::resetDamage()
|
void Toplevel::resetDamage()
|
||||||
|
@ -748,9 +748,7 @@ void Toplevel::addDamage(const QRegion &damage)
|
||||||
{
|
{
|
||||||
m_isDamaged = true;
|
m_isDamaged = true;
|
||||||
damage_region += damage;
|
damage_region += damage;
|
||||||
for (const QRect &r : damage) {
|
emit damaged(this, damage);
|
||||||
emit damaged(this, r);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Toplevel::windowRole() const
|
QByteArray Toplevel::windowRole() const
|
||||||
|
|
|
@ -585,7 +585,7 @@ public:
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void opacityChanged(KWin::Toplevel* toplevel, qreal oldOpacity);
|
void opacityChanged(KWin::Toplevel* toplevel, qreal oldOpacity);
|
||||||
void damaged(KWin::Toplevel* toplevel, const QRect& damage);
|
void damaged(KWin::Toplevel* toplevel, const QRegion& damage);
|
||||||
void inputTransformationChanged();
|
void inputTransformationChanged();
|
||||||
/**
|
/**
|
||||||
* This signal is emitted when the Toplevel's frame geometry changes.
|
* This signal is emitted when the Toplevel's frame geometry changes.
|
||||||
|
|
Loading…
Reference in New Issue