x11: Fix damage region updates

We cannot use addDamage() in getDamageReply() because the former sets
back the m_isDamaged flag.
This commit is contained in:
Vlad Zahorodnii 2021-02-04 18:27:17 +02:00
parent 72fda78cf6
commit e117caa3eb
2 changed files with 9 additions and 13 deletions

View file

@ -403,7 +403,7 @@ void Toplevel::getDamageRegionReply()
reply->extents.width, reply->extents.height);
free(reply);
addDamage(region);
addDamage_helper(region);
}
void Toplevel::addDamageFull()
@ -412,17 +412,7 @@ void Toplevel::addDamageFull()
return;
const QRect bufferRect = bufferGeometry();
const QRect frameRect = frameGeometry();
const int offsetX = bufferRect.x() - frameRect.x();
const int offsetY = bufferRect.y() - frameRect.y();
const QRect damagedRect(0, 0, bufferRect.width(), bufferRect.height());
damage_region = damagedRect;
addRepaint(damagedRect.translated(offsetX, offsetY));
emit damaged(this, damage_region);
addDamage_helper(QRect(0, 0, bufferRect.width(), bufferRect.height()));
}
void Toplevel::resetDamage()
@ -738,11 +728,16 @@ void Toplevel::setSurface(KWaylandServer::SurfaceInterface *surface)
}
void Toplevel::addDamage(const QRegion &damage)
{
m_isDamaged = true;
addDamage_helper(damage);
}
void Toplevel::addDamage_helper(const QRegion &damage)
{
const QRect bufferRect = bufferGeometry();
const QRect frameRect = frameGeometry();
m_isDamaged = true;
damage_region += damage;
addRepaint(damage.translated(bufferRect.topLeft() - frameRect.topLeft()));

View file

@ -695,6 +695,7 @@ protected:
void discardWindowPixmap();
void addDamageFull();
virtual void addDamage(const QRegion &damage);
void addDamage_helper(const QRegion &damage);
Xcb::Property fetchWmClientLeader() const;
void readWmClientLeader(Xcb::Property &p);
void getWmClientLeader();