diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-08-14 03:00:30 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-08-14 03:00:30 +0200 |
commit | 88851b6de433ab25047166bf4708e99e111b7af2 (patch) | |
tree | 3acfbd26c14076cef5865bf15d370e6f25b5dad6 | |
parent | 9411f6fbd9c05eaf7109982a055348a088721080 (diff) | |
parent | bbd16989e07d6da367f71a4c36234409bf018287 (diff) |
Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: Ia9584a185a3d7a68a4333890ade535585ba33fee
-rw-r--r-- | src/client/qwaylandbuffer.cpp | 4 | ||||
-rw-r--r-- | src/client/qwaylandbuffer_p.h | 4 | ||||
-rw-r--r-- | src/client/qwaylandshmbackingstore.cpp | 17 | ||||
-rw-r--r-- | src/client/qwaylandshmbackingstore_p.h | 2 | ||||
-rw-r--r-- | src/client/qwaylandwindow.cpp | 9 | ||||
-rw-r--r-- | src/client/qwaylandwindow_p.h | 3 | ||||
-rw-r--r-- | src/compositor/compositor_api/qwaylandcompositor.cpp | 1 | ||||
-rw-r--r-- | src/compositor/compositor_api/qwaylandquickitem.cpp | 5 | ||||
-rw-r--r-- | src/compositor/compositor_api/qwaylandsurface_p.h | 2 | ||||
-rw-r--r-- | src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp | 6 |
10 files changed, 45 insertions, 8 deletions
diff --git a/src/client/qwaylandbuffer.cpp b/src/client/qwaylandbuffer.cpp index 9792cdd61..12df9cc4f 100644 --- a/src/client/qwaylandbuffer.cpp +++ b/src/client/qwaylandbuffer.cpp @@ -64,7 +64,9 @@ void QWaylandBuffer::init(wl_buffer *buf) void QWaylandBuffer::release(void *data, wl_buffer *) { - static_cast<QWaylandBuffer *>(data)->mBusy = false; + QWaylandBuffer *self = static_cast<QWaylandBuffer *>(data); + self->mBusy = false; + self->mCommitted = false; } const wl_buffer_listener QWaylandBuffer::listener = { diff --git a/src/client/qwaylandbuffer_p.h b/src/client/qwaylandbuffer_p.h index 156ea9530..eea090f35 100644 --- a/src/client/qwaylandbuffer_p.h +++ b/src/client/qwaylandbuffer_p.h @@ -76,11 +76,15 @@ public: void setBusy() { mBusy = true; } bool busy() const { return mBusy; } + void setCommitted() { mCommitted = true; } + bool committed() const { return mCommitted; } + protected: struct wl_buffer *mBuffer = nullptr; private: bool mBusy = false; + bool mCommitted = false; static void release(void *data, wl_buffer *); static const wl_buffer_listener listener; diff --git a/src/client/qwaylandshmbackingstore.cpp b/src/client/qwaylandshmbackingstore.cpp index dde01357b..ecb03c0d6 100644 --- a/src/client/qwaylandshmbackingstore.cpp +++ b/src/client/qwaylandshmbackingstore.cpp @@ -48,7 +48,6 @@ #include <QtCore/qtemporaryfile.h> #include <QtGui/QPainter> #include <QMutexLocker> -#include <QLoggingCategory> #include <wayland-client.h> #include <wayland-client-protocol.h> @@ -68,10 +67,6 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -Q_DECLARE_LOGGING_CATEGORY(lcWaylandBackingstore) - -Q_LOGGING_CATEGORY(lcWaylandBackingstore, "qt.qpa.wayland.backingstore") - QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, const QSize &size, QImage::Format format, int scale) { @@ -199,6 +194,8 @@ void QWaylandShmBackingStore::beginPaint(const QRegion ®ion) void QWaylandShmBackingStore::endPaint() { mPainting = false; + if (mPendingFlush) + flush(window(), mPendingRegion, QPoint()); waylandWindow()->setCanResize(true); } @@ -218,9 +215,19 @@ void QWaylandShmBackingStore::flush(QWindow *window, const QRegion ®ion, cons // called instead. The default implementation from QPlatformBackingStore is sufficient // however so no need to reimplement that. + Q_UNUSED(window); Q_UNUSED(offset); + if (mPainting) { + mPendingRegion |= region; + mPendingFlush = true; + return; + } + + mPendingFlush = false; + mPendingRegion = QRegion(); + if (windowDecoration() && windowDecoration()->isDirty()) updateDecorations(); diff --git a/src/client/qwaylandshmbackingstore_p.h b/src/client/qwaylandshmbackingstore_p.h index cb66288fc..88ecfc5ec 100644 --- a/src/client/qwaylandshmbackingstore_p.h +++ b/src/client/qwaylandshmbackingstore_p.h @@ -120,6 +120,8 @@ private: QWaylandShmBuffer *mFrontBuffer = nullptr; QWaylandShmBuffer *mBackBuffer = nullptr; bool mPainting = false; + bool mPendingFlush = false; + QRegion mPendingRegion; QMutex mMutex; QSize mRequestedSize; diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index df9e8437e..0ff3a72e5 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -73,6 +73,8 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { +Q_LOGGING_CATEGORY(lcWaylandBackingstore, "qt.qpa.wayland.backingstore") + QWaylandWindow *QWaylandWindow::mMouseGrab = nullptr; QWaylandWindow::QWaylandWindow(QWindow *window) @@ -534,6 +536,7 @@ void QWaylandWindow::handleScreenRemoved(QScreen *qScreen) void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) { + Q_ASSERT(!buffer->committed()); if (mFrameCallback) { wl_callback_destroy(mFrameCallback); mFrameCallback = nullptr; @@ -564,12 +567,18 @@ void QWaylandWindow::damage(const QRect &rect) void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage) { + if (buffer->committed()) { + qCDebug(lcWaylandBackingstore) << "Buffer already committed, ignoring."; + return; + } if (!isInitialized()) return; attachOffset(buffer); for (const QRect &rect: damage) wl_surface::damage(rect.x(), rect.y(), rect.width(), rect.height()); + Q_ASSERT(!buffer->committed()); + buffer->setCommitted(); wl_surface::commit(); } diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h index 55f3a515f..b6b499a3b 100644 --- a/src/client/qwaylandwindow_p.h +++ b/src/client/qwaylandwindow_p.h @@ -55,6 +55,7 @@ #include <QtCore/QMutex> #include <QtGui/QIcon> #include <QtCore/QVariant> +#include <QtCore/QLoggingCategory> #include <qpa/qplatformwindow.h> @@ -67,6 +68,8 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { +Q_DECLARE_LOGGING_CATEGORY(lcWaylandBackingstore) + class QWaylandDisplay; class QWaylandBuffer; class QWaylandShellSurface; diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp index 8f70bbb35..f08470b78 100644 --- a/src/compositor/compositor_api/qwaylandcompositor.cpp +++ b/src/compositor/compositor_api/qwaylandcompositor.cpp @@ -332,6 +332,7 @@ void QWaylandCompositorPrivate::subcompositor_get_subsurface(wl_subcompositor::R QWaylandSurface *childSurface = QWaylandSurface::fromResource(surface); QWaylandSurface *parentSurface = QWaylandSurface::fromResource(parent); QWaylandSurfacePrivate::get(childSurface)->initSubsurface(parentSurface, resource->client(), id, 1); + QWaylandSurfacePrivate::get(parentSurface)->subsurfaceChildren.append(childSurface); emit q->subsurfaceChanged(childSurface, parentSurface); } diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp index b3e370f45..f0dc08cc2 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.cpp +++ b/src/compositor/compositor_api/qwaylandquickitem.cpp @@ -50,6 +50,7 @@ #include <QtWaylandCompositor/QWaylandDrag> #endif #include <QtWaylandCompositor/private/qwlclientbufferintegration_p.h> +#include <QtWaylandCompositor/private/qwaylandsurface_p.h> #include <QtGui/QKeyEvent> #include <QtGui/QGuiApplication> @@ -888,6 +889,10 @@ void QWaylandQuickItem::handleSurfaceChanged() QWaylandOutput *output = newSurface->compositor()->outputFor(window()); d->view->setOutput(output); } + for (auto subsurface : QWaylandSurfacePrivate::get(newSurface)->subsurfaceChildren) { + if (!subsurface.isNull()) + handleSubsurfaceAdded(subsurface.data()); + } updateSize(); } diff --git a/src/compositor/compositor_api/qwaylandsurface_p.h b/src/compositor/compositor_api/qwaylandsurface_p.h index 0cb12d15b..e0b624fce 100644 --- a/src/compositor/compositor_api/qwaylandsurface_p.h +++ b/src/compositor/compositor_api/qwaylandsurface_p.h @@ -163,6 +163,8 @@ public: //member variables QList<QtWayland::FrameCallback *> pendingFrameCallbacks; QList<QtWayland::FrameCallback *> frameCallbacks; + QList<QPointer<QWaylandSurface>> subsurfaceChildren; + QRegion inputRegion; QRegion opaqueRegion; diff --git a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp index f151d1eb6..1dc43b371 100644 --- a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp +++ b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp @@ -206,8 +206,10 @@ QWaylandXdgSurfaceV6::QWaylandXdgSurfaceV6(QWaylandXdgShellV6 *shell, ::zxdg_sur QWaylandXdgSurfaceV6::~QWaylandXdgSurfaceV6() { - if (m_toplevel) - zxdg_toplevel_v6_destroy(m_toplevel->object()); + if (m_toplevel) { + delete m_toplevel; + m_toplevel = nullptr; + } if (m_popup) { delete m_popup; m_popup = nullptr; |