summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2021-08-03 08:49:16 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2021-08-24 10:58:17 +0200
commit36060ad8dca6720c77dfa2bf0292978d4eadb2db (patch)
tree50d8a089329c9dcf5b4f3d7c1635a0e9324bf0db
parent41f8aa24d30a896d69e7ddeced61911d785518e9 (diff)
downloadqtwayland-36060ad8dca6720c77dfa2bf0292978d4eadb2db.tar.gz
Ignore viewporter buffer size when buffer is null
The documentation for viewporter says: "if the source rectangle is partially or completely outside of the non-NULL wl_buffer, then the out_of_buffer protocol error is raised when the surface state is applied. A NULL wl_buffer does not raise the out_of_buffer error." The intention here is that the viewport can be initialized before the buffer is actually attached to the surface, and the parameters will be kept for later. We simply skip the error condition when there is no buffer. [ChangeLog][QtWaylandCompositor] Fixed an issue in the wp_viewporter extension, where it would emit a protocol error if the viewport was configured before attaching a buffer to the surface. Pick-to: 5.15 6.1 6.2 Fixes: QTBUG-95464 Change-Id: I71d09974dfe5e0f39ed79e7718e1e0d402547583 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> (cherry picked from commit 639bd92682f5f61f15f97f78ccd9791bec852b6c)
-rw-r--r--src/compositor/extensions/qwaylandviewporter.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/compositor/extensions/qwaylandviewporter.cpp b/src/compositor/extensions/qwaylandviewporter.cpp
index a51eac3c..c4f3b2e7 100644
--- a/src/compositor/extensions/qwaylandviewporter.cpp
+++ b/src/compositor/extensions/qwaylandviewporter.cpp
@@ -149,14 +149,16 @@ void QWaylandViewporterPrivate::Viewport::checkCommittedState()
return;
}
- QRectF max = QRectF(QPointF(), m_surface->bufferSize() / m_surface->bufferScale());
- // We can't use QRectF.contains, because that would return false for values on the border
- if (max.united(source) != max) {
- wl_resource_post_error(resource()->handle, error_out_of_buffer,
- "source %f,%f, %fx%f extends outside attached buffer %fx%f",
- source.x(), source.y(), source.width(), source.height(),
- max.width(), max.height());
- return;
+ if (m_surface->bufferSize().isValid()) {
+ QRectF max = QRectF(QPointF(), m_surface->bufferSize() / m_surface->bufferScale());
+ // We can't use QRectF.contains, because that would return false for values on the border
+ if (max.united(source) != max) {
+ wl_resource_post_error(resource()->handle, error_out_of_buffer,
+ "source %f,%f, %fx%f extends outside attached buffer %fx%f",
+ source.x(), source.y(), source.width(), source.height(),
+ max.width(), max.height());
+ return;
+ }
}
}