[server] Restrict damage to the surface geometry

Before emitting the new damage we need to restrict it to the geometry
of the surface. That's required by the documentation and at least
QtWayland/OpenGL emits non-sense damage events.
This commit is contained in:
Martin Gräßlin 2015-05-26 11:37:00 +02:00
parent 35a854e991
commit 713dbc51fa

View file

@ -228,6 +228,10 @@ void SurfaceInterface::Private::commit()
}
if (bufferChanged) {
if (!current.damage.isEmpty()) {
const QRegion windowRegion = QRegion(0, 0, q->size().width(), q->size().height());
if (!windowRegion.isEmpty()) {
current.damage = windowRegion.intersected(current.damage);
}
emit q->damaged(current.damage);
} else if (!current.buffer) {
emit q->unmapped();
@ -244,7 +248,6 @@ void SurfaceInterface::Private::damage(const QRect &rect)
// TODO: should we send an error?
return;
}
// TODO: documentation says we need to remove the parts outside of the surface
pending.damage = pending.damage.united(rect);
}