diff --git a/plugins/platforms/wayland/wayland_backend.cpp b/plugins/platforms/wayland/wayland_backend.cpp index abd59587dd..03b59aa40a 100644 --- a/plugins/platforms/wayland/wayland_backend.cpp +++ b/plugins/platforms/wayland/wayland_backend.cpp @@ -340,10 +340,10 @@ WaylandSeat::WaylandSeat(wl_seat *seat, WaylandBackend *backend) void WaylandBackend::pointerMotionRelativeToOutput(const QPointF &position, quint32 time) { - auto outputIt = std::find_if(m_outputs.begin(), m_outputs.end(), [this](WaylandOutput *wo) { + auto outputIt = std::find_if(m_outputs.constBegin(), m_outputs.constEnd(), [this](WaylandOutput *wo) { return wo->surface() == m_seat->pointer()->enteredSurface(); }); - Q_ASSERT(outputIt != m_outputs.end()); + Q_ASSERT(outputIt != m_outputs.constEnd()); const QPointF outputPosition = (*outputIt)->geometry().topLeft() + position; Platform::pointerMotion(outputPosition, time); } @@ -640,10 +640,10 @@ void WaylandBackend::initConnection() void WaylandBackend::updateScreenSize(WaylandOutput *output) { - auto it = std::find(m_outputs.begin(), m_outputs.end(), output); + auto it = std::find(m_outputs.constBegin(), m_outputs.constEnd(), output); int nextLogicalPosition = output->geometry().topRight().x(); - while (++it != m_outputs.end()) { + while (++it != m_outputs.constEnd()) { const QRect geo = (*it)->geometry(); (*it)->setGeometry(QPoint(nextLogicalPosition, 0), geo.size()); nextLogicalPosition = geo.topRight().x(); @@ -737,7 +737,7 @@ QPainterBackend *WaylandBackend::createQPainterBackend() void WaylandBackend::checkBufferSwap() { - const bool allRendered = std::all_of(m_outputs.begin(), m_outputs.end(), [](WaylandOutput *o) { + const bool allRendered = std::all_of(m_outputs.constBegin(), m_outputs.constEnd(), [](WaylandOutput *o) { return o->rendered(); }); if (!allRendered) { @@ -750,10 +750,9 @@ void WaylandBackend::checkBufferSwap() if (!output->rendered()) { return; } - } Compositor::self()->bufferSwapComplete(); - for (auto *output : m_outputs) { + for (auto *output : qAsConst(m_outputs)) { output->resetRendered(); } } @@ -771,8 +770,8 @@ WaylandOutput* WaylandBackend::getOutputAt(const QPointF globalPosition) auto checkPosition = [pos](WaylandOutput *output) { return output->geometry().contains(pos); }; - auto it = std::find_if(m_outputs.begin(), m_outputs.end(), checkPosition); - return it == m_outputs.end() ? nullptr : *it; + auto it = std::find_if(m_outputs.constBegin(), m_outputs.constEnd(), checkPosition); + return it == m_outputs.constEnd() ? nullptr : *it; } bool WaylandBackend::supportsPointerLock()