diff options
author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2022-09-12 18:30:13 +0300 |
---|---|---|
committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2022-09-12 18:30:13 +0300 |
commit | 2ce7b8d2c5355d91642256d9260222d211cc368c (patch) | |
tree | 31adf9ce81bcd65294a4d03c51c002b9811095d4 | |
parent | 96f7165dd1200ca63330dd44660d309e761fd522 (diff) | |
parent | a9cadc1dcfb282bec1a3ca01f2f4d93b9999e4f3 (diff) |
Merge remote-tracking branch 'origin/tqtc/lts-5.15.7' into tqtc/lts-5.15-opensourcev5.15.7-lts-lgpl
Change-Id: I42a0e780eea6d92f0463566e5ab9b23efc9f49b7
-rw-r--r-- | .qmake.conf | 2 | ||||
-rw-r--r-- | src/client/qwaylanddatadevice.cpp | 2 | ||||
-rw-r--r-- | src/compositor/compositor_api/qwaylandquickitem.cpp | 27 | ||||
-rw-r--r-- | src/compositor/compositor_api/qwaylandquickitem_p.h | 2 | ||||
-rw-r--r-- | src/compositor/extensions/qwaylandviewporter.cpp | 18 |
5 files changed, 36 insertions, 15 deletions
diff --git a/.qmake.conf b/.qmake.conf index 768ec91d8..7c9136780 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -4,4 +4,4 @@ DEFINES += QT_NO_FOREACH DEFINES += QT_NO_JAVA_STYLE_ITERATORS DEFINES += QT_NO_LINKED_LIST -MODULE_VERSION = 5.15.6 +MODULE_VERSION = 5.15.7 diff --git a/src/client/qwaylanddatadevice.cpp b/src/client/qwaylanddatadevice.cpp index 19944a349..7e2e33081 100644 --- a/src/client/qwaylanddatadevice.cpp +++ b/src/client/qwaylanddatadevice.cpp @@ -168,7 +168,7 @@ void QWaylandDataDevice::data_device_drop() void QWaylandDataDevice::data_device_enter(uint32_t serial, wl_surface *surface, wl_fixed_t x, wl_fixed_t y, wl_data_offer *id) { - auto *dragWaylandWindow = QWaylandWindow::fromWlSurface(surface); + auto *dragWaylandWindow = surface ? QWaylandWindow::fromWlSurface(surface) : nullptr; if (!dragWaylandWindow) return; // Ignore foreign surfaces diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp index 818089082..a5d7e91ef 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.cpp +++ b/src/compositor/compositor_api/qwaylandquickitem.cpp @@ -253,6 +253,16 @@ void QWaylandBufferMaterial::ensureTextures(int count) m_textures << nullptr; } } + +void QWaylandBufferMaterial::setBufferRef(QWaylandQuickItem *surfaceItem, const QWaylandBufferRef &ref) +{ + Q_UNUSED(surfaceItem); + m_bufferRef = ref; + for (int plane = 0; plane < bufferTypes[ref.bufferFormatEgl()].planeCount; plane++) + if (auto texture = ref.toOpenGLTexture(plane)) + setTextureForPlane(plane, texture); + bind(); +} #endif // QT_CONFIG(opengl) QMutex *QWaylandQuickItemPrivate::mutex = nullptr; @@ -1411,13 +1421,20 @@ QSGNode *QWaylandQuickItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat if (d->newTexture) { d->newTexture = false; - for (int plane = 0; plane < bufferTypes[ref.bufferFormatEgl()].planeCount; plane++) - if (auto texture = ref.toOpenGLTexture(plane)) - material->setTextureForPlane(plane, texture); - material->bind(); + material->setBufferRef(this, ref); } - QSGGeometry::updateTexturedRectGeometry(geometry, rect, QRectF(0, 0, 1, 1)); + const QSize surfaceSize = ref.size() / surface()->bufferScale(); + const QRectF sourceGeometry = surface()->sourceGeometry(); + const QRectF normalizedCoordinates = + sourceGeometry.isValid() + ? QRectF(sourceGeometry.x() / surfaceSize.width(), + sourceGeometry.y() / surfaceSize.height(), + sourceGeometry.width() / surfaceSize.width(), + sourceGeometry.height() / surfaceSize.height()) + : QRectF(0, 0, 1, 1); + + QSGGeometry::updateTexturedRectGeometry(geometry, rect, normalizedCoordinates); node->setGeometry(geometry); node->setFlag(QSGNode::OwnsGeometry, true); diff --git a/src/compositor/compositor_api/qwaylandquickitem_p.h b/src/compositor/compositor_api/qwaylandquickitem_p.h index a75cdb2ba..a507cec0a 100644 --- a/src/compositor/compositor_api/qwaylandquickitem_p.h +++ b/src/compositor/compositor_api/qwaylandquickitem_p.h @@ -80,6 +80,7 @@ public: ~QWaylandBufferMaterial() override; void setTextureForPlane(int plane, QOpenGLTexture *texture); + void setBufferRef(QWaylandQuickItem *surfaceItem, const QWaylandBufferRef &ref); void bind(); @@ -92,6 +93,7 @@ private: const QWaylandBufferRef::BufferFormatEgl m_format; QVarLengthArray<QOpenGLTexture*, 3> m_textures; + QWaylandBufferRef m_bufferRef; }; #endif // QT_CONFIG(opengl) diff --git a/src/compositor/extensions/qwaylandviewporter.cpp b/src/compositor/extensions/qwaylandviewporter.cpp index b98274b1b..c34e3d0dd 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; + } } } |