From 713dbc51fa5d32770fa63d5e5e311af39bbf0b3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 26 May 2015 11:37:00 +0200 Subject: [PATCH] [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. --- src/wayland/surface_interface.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/wayland/surface_interface.cpp b/src/wayland/surface_interface.cpp index b17a6ba057..31e2be1983 100644 --- a/src/wayland/surface_interface.cpp +++ b/src/wayland/surface_interface.cpp @@ -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); }