diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2019-06-04 20:11:32 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2019-07-12 09:45:12 +0200 |
commit | 905cdffeaa1813123a27a2151b345d106923ca24 (patch) | |
tree | dbe298aa0c4cc31b83e0e880825828e0094374be | |
parent | 8ecf6e29b2e110b9289a583122e45e29bb5cb749 (diff) |
QWaylandShmBackingStore: replace a QLinkedList with std::list
...and mark the module QLinkedList-free.
QLinkedList is going to be deprecated.
Change-Id: Ieb9efef24cd8677edc1262f22b7c6d41b6376347
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
-rw-r--r-- | .qmake.conf | 1 | ||||
-rw-r--r-- | src/client/qwaylandshmbackingstore.cpp | 14 | ||||
-rw-r--r-- | src/client/qwaylandshmbackingstore_p.h | 5 |
3 files changed, 11 insertions, 9 deletions
diff --git a/.qmake.conf b/.qmake.conf index 05ee6f974..2c01c5d2a 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -2,5 +2,6 @@ load(qt_build_config) DEFINES += QT_NO_FOREACH DEFINES += QT_NO_JAVA_STYLE_ITERATORS +DEFINES += QT_NO_LINKED_LIST MODULE_VERSION = 5.14.0 diff --git a/src/client/qwaylandshmbackingstore.cpp b/src/client/qwaylandshmbackingstore.cpp index d768e7fc2..9b5971a21 100644 --- a/src/client/qwaylandshmbackingstore.cpp +++ b/src/client/qwaylandshmbackingstore.cpp @@ -249,7 +249,7 @@ QWaylandShmBuffer *QWaylandShmBackingStore::getBuffer(const QSize &size) if (b->size() == size) { return b; } else { - mBuffers.removeOne(b); + mBuffers.remove(b); if (mBackBuffer == b) mBackBuffer = nullptr; delete b; @@ -257,11 +257,11 @@ QWaylandShmBuffer *QWaylandShmBackingStore::getBuffer(const QSize &size) } } - static const int MAX_BUFFERS = 5; - if (mBuffers.count() < MAX_BUFFERS) { + static const size_t MAX_BUFFERS = 5; + if (mBuffers.size() < MAX_BUFFERS) { QImage::Format format = QPlatformScreen::platformScreenForWindow(window())->format(); QWaylandShmBuffer *b = new QWaylandShmBuffer(mDisplay, size, format, waylandWindow()->scale()); - mBuffers.prepend(b); + mBuffers.push_front(b); return b; } return nullptr; @@ -300,9 +300,9 @@ void QWaylandShmBackingStore::resize(const QSize &size) // ensure the new buffer is at the beginning of the list so next time getBuffer() will pick // it if possible - if (mBuffers.first() != buffer) { - mBuffers.removeOne(buffer); - mBuffers.prepend(buffer); + if (mBuffers.front() != buffer) { + mBuffers.remove(buffer); + mBuffers.push_front(buffer); } if (windowDecoration() && window()->isVisible() && oldSizeInBytes != newSizeInBytes) diff --git a/src/client/qwaylandshmbackingstore_p.h b/src/client/qwaylandshmbackingstore_p.h index 88ecfc5ec..8a85cd7f3 100644 --- a/src/client/qwaylandshmbackingstore_p.h +++ b/src/client/qwaylandshmbackingstore_p.h @@ -57,7 +57,8 @@ #include <QtGui/QImage> #include <qpa/qplatformwindow.h> #include <QMutex> -#include <QLinkedList> + +#include <list> QT_BEGIN_NAMESPACE @@ -116,7 +117,7 @@ private: QWaylandShmBuffer *getBuffer(const QSize &size); QWaylandDisplay *mDisplay = nullptr; - QLinkedList<QWaylandShmBuffer *> mBuffers; + std::list<QWaylandShmBuffer *> mBuffers; QWaylandShmBuffer *mFrontBuffer = nullptr; QWaylandShmBuffer *mBackBuffer = nullptr; bool mPainting = false; |