diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2021-08-03 08:49:16 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-08-23 10:44:55 +0000 |
commit | 1a4545f9a5f2ecac9dc7d9ce1ebd8c6b47b37907 (patch) | |
tree | ac236f5c0b124ee99113cfece023d59963c0fcb3 | |
parent | c71f7090919c524cb9f6a3ad2828b9f8d10bd8f9 (diff) | |
download | qtwayland-1a4545f9a5f2ecac9dc7d9ce1ebd8c6b47b37907.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.
Fixes: QTBUG-95464
Change-Id: I71d09974dfe5e0f39ed79e7718e1e0d402547583
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
(cherry picked from commit 639bd92682f5f61f15f97f78ccd9791bec852b6c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/compositor/extensions/qwaylandviewporter.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/compositor/extensions/qwaylandviewporter.cpp b/src/compositor/extensions/qwaylandviewporter.cpp index b98274b1..c34e3d0d 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; + } } } |