From cca0e15b455ba606043c720479490794d8d86309 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Sun, 15 Mar 2020 20:59:29 +0100 Subject: [PATCH] Fix compiler warnings Summary: No need to keep them around for no reason. Test Plan: Tested the plugins I thought could be affected. Have been using it for a couple of days without problems Reviewers: #kwin, zzag Reviewed By: #kwin, zzag Subscribers: zzag, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D28062 --- CMakeLists.txt | 2 +- abstract_wayland_output.cpp | 2 +- debug_console.cpp | 2 +- decorations/settings.cpp | 4 +-- effects/highlightwindow/highlightwindow.cpp | 4 +-- effects/screenshot/screenshot.cpp | 4 +-- effects/showfps/showfps.cpp | 8 ++--- effects/showfps/showfps.h | 4 +-- input.cpp | 2 +- .../declarative-plugin/previewclient.cpp | 2 +- kcmkwin/kwintabbox/main.cpp | 2 +- layers.cpp | 4 +-- libkwineffects/kwinglplatform.cpp | 3 +- main_wayland.cpp | 21 +++++++------ plugins/kdecorations/aurorae/src/aurorae.cpp | 30 ++++++++++--------- plugins/platforms/drm/drm_backend.cpp | 8 ++--- plugins/platforms/drm/edid.cpp | 2 ++ .../fbdev/scene_qpainter_fb_backend.cpp | 2 +- plugins/platforms/virtual/egl_gbm_backend.cpp | 4 +-- plugins/platforms/wayland/wayland_backend.cpp | 6 ++-- .../platforms/x11/standalone/glxbackend.cpp | 6 ++-- plugins/scenes/opengl/scene_opengl.cpp | 2 +- tabbox/clientmodel.cpp | 28 ++++++++--------- useractions.cpp | 2 +- wayland_server.cpp | 6 ++-- xwl/drag_x.cpp | 2 +- 26 files changed, 83 insertions(+), 79 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 70a3ff73f9..0daf215f14 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ project(KWin) set(PROJECT_VERSION "5.18.80") set(PROJECT_VERSION_MAJOR 5) -set(QT_MIN_VERSION "5.12.0") +set(QT_MIN_VERSION "5.14.0") set(KF5_MIN_VERSION "5.66.0") set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH}) diff --git a/abstract_wayland_output.cpp b/abstract_wayland_output.cpp index c49b277dbb..c6563763e0 100644 --- a/abstract_wayland_output.cpp +++ b/abstract_wayland_output.cpp @@ -196,7 +196,7 @@ void AbstractWaylandOutput::applyChanges(const KWayland::Server::OutputChangeSet overallSizeCheckNeeded = true; } if (changeSet->scaleChanged()) { - qCDebug(KWIN_CORE) << "Setting scale:" << changeSet->scale(); + qCDebug(KWIN_CORE) << "Setting scale:" << changeSet->scaleF(); setScale(changeSet->scaleF()); emitModeChanged = true; } diff --git a/debug_console.cpp b/debug_console.cpp index 5573379887..17ccd045cf 100644 --- a/debug_console.cpp +++ b/debug_console.cpp @@ -709,7 +709,7 @@ DebugConsoleDelegate::~DebugConsoleDelegate() = default; QString DebugConsoleDelegate::displayText(const QVariant &value, const QLocale &locale) const { - switch (value.type()) { + switch (value.userType()) { case QMetaType::QPoint: { const QPoint p = value.toPoint(); return QStringLiteral("%1,%2").arg(p.x()).arg(p.y()); diff --git a/decorations/settings.cpp b/decorations/settings.cpp index f229b069a9..1dcec80c66 100644 --- a/decorations/settings.cpp +++ b/decorations/settings.cpp @@ -56,9 +56,7 @@ SettingsImpl::SettingsImpl(KDecoration2::DecorationSettings *parent) ); // prevent changes in Decoration due to Compositor being destroyed connect(Compositor::self(), &Compositor::aboutToDestroy, this, - [this, c] { - disconnect(c); - } + [c] { disconnect(c); } ); connect(Workspace::self(), &Workspace::configChanged, this, &SettingsImpl::readSettings); connect(DecorationBridge::self(), &DecorationBridge::metaDataLoaded, this, &SettingsImpl::readSettings); diff --git a/effects/highlightwindow/highlightwindow.cpp b/effects/highlightwindow/highlightwindow.cpp index 9de3c1785a..ecfb681b43 100644 --- a/effects/highlightwindow/highlightwindow.cpp +++ b/effects/highlightwindow/highlightwindow.cpp @@ -61,7 +61,7 @@ void HighlightWindowEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& if (!m_highlightedWindows.isEmpty()) { // Initial fade out and changing highlight animation if (opacity == m_windowOpacity.end()) - opacity = m_windowOpacity.insertMulti(w, 0.0f); + opacity = m_windowOpacity.insert(w, 0.0f); float oldOpacity = *opacity; if (m_highlightedWindows.contains(w)) *opacity = qMin(1.0f, oldOpacity + time / m_fadeDuration); @@ -250,7 +250,7 @@ void HighlightWindowEffect::prepareHighlighting() m_finishing = false; foreach (EffectWindow * w, effects->stackingOrder()) { if (!m_windowOpacity.contains(w)) // Just in case we are still finishing from last time - m_windowOpacity.insertMulti(w, isInitiallyHidden(w) ? 0.0 : 1.0); + m_windowOpacity.insert(w, isInitiallyHidden(w) ? 0.0 : 1.0); if (!m_highlightedWindows.isEmpty()) m_highlightedWindows.at(0)->addRepaintFull(); } diff --git a/effects/screenshot/screenshot.cpp b/effects/screenshot/screenshot.cpp index 86c4bd1e4b..d30b44fac8 100644 --- a/effects/screenshot/screenshot.cpp +++ b/effects/screenshot/screenshot.cpp @@ -658,7 +658,7 @@ void ScreenShotEffect::convertFromGLImage(QImage &img, int w, int h) // see https://github.com/qt/qtbase/blob/dev/src/opengl/qgl.cpp if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { // OpenGL gives RGBA; Qt wants ARGB - uint *p = (uint*)img.bits(); + uint *p = reinterpret_cast(img.bits()); uint *end = p + w * h; while (p < end) { uint a = *p << 24; @@ -668,7 +668,7 @@ void ScreenShotEffect::convertFromGLImage(QImage &img, int w, int h) } else { // OpenGL gives ABGR (i.e. RGBA backwards); Qt wants ARGB for (int y = 0; y < h; y++) { - uint *q = (uint*)img.scanLine(y); + uint *q = reinterpret_cast(img.scanLine(y)); for (int x = 0; x < w; ++x) { const uint pixel = *q; *q = ((pixel << 16) & 0xff0000) | ((pixel >> 16) & 0xff) diff --git a/effects/showfps/showfps.cpp b/effects/showfps/showfps.cpp index c7c4d23c79..abfb0852b8 100644 --- a/effects/showfps/showfps.cpp +++ b/effects/showfps/showfps.cpp @@ -123,11 +123,7 @@ void ShowFpsEffect::reconfigure(ReconfigureFlags) void ShowFpsEffect::prePaintScreen(ScreenPrePaintData& data, int time) { - if (time == 0) { - // TODO optimized away - } - t.start(); - frames[ frames_pos ] = t.minute() * 60000 + t.second() * 1000 + t.msec(); + frames[ frames_pos ] = t.restart(); if (++frames_pos == MAX_FPS) frames_pos = 0; effects->prePaintScreen(data, time); @@ -158,7 +154,7 @@ void ShowFpsEffect::paintScreen(int mask, const QRegion ®ion, ScreenPaintData for (int i = 0; i < MAX_FPS; ++i) - if (abs(t.minute() * 60000 + t.second() * 1000 + t.msec() - frames[ i ]) < 1000) + if (abs(t.elapsed() - frames[ i ]) < 1000) ++fps; // count all frames in the last second if (fps > MAX_TIME) fps = MAX_TIME; // keep it the same height diff --git a/effects/showfps/showfps.h b/effects/showfps/showfps.h index e75e610a40..69e5ff144b 100644 --- a/effects/showfps/showfps.h +++ b/effects/showfps/showfps.h @@ -21,7 +21,7 @@ along with this program. If not, see . #ifndef KWIN_SHOWFPS_H #define KWIN_SHOWFPS_H -#include +#include #include #include @@ -83,7 +83,7 @@ private: void paintDrawSizeGraph(int x, int y); void paintGraph(int x, int y, QList values, QList lines, bool colorize); QImage fpsTextImage(int fps); - QTime t; + QElapsedTimer t; enum { NUM_PAINTS = 100 }; // remember time needed to paint this many paints int paints[ NUM_PAINTS ]; // time needed to paint int paint_size[ NUM_PAINTS ]; // number of pixels painted diff --git a/input.cpp b/input.cpp index 08cf5164ea..79cbd87218 100644 --- a/input.cpp +++ b/input.cpp @@ -1787,7 +1787,7 @@ void InputRedirection::setupWorkspace() connect(fakeInput, &FakeInputInterface::deviceCreated, this, [this] (FakeInputDevice *device) { connect(device, &FakeInputDevice::authenticationRequested, this, - [this, device] (const QString &application, const QString &reason) { + [device] (const QString &application, const QString &reason) { Q_UNUSED(application) Q_UNUSED(reason) // TODO: make secure diff --git a/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp b/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp index 8319ccb9ae..fd9f9f278b 100644 --- a/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp +++ b/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp @@ -111,7 +111,7 @@ PreviewClient::PreviewClient(DecoratedClient *c, Decoration *decoration) connect(this, &PreviewClient::bordersLeftEdgeChanged, this, emitEdgesChanged); connect(this, &PreviewClient::bordersRightEdgeChanged, this, emitEdgesChanged); connect(this, &PreviewClient::bordersBottomEdgeChanged, this, emitEdgesChanged); - auto emitSizeChanged = [this, c]() { + auto emitSizeChanged = [c]() { emit c->sizeChanged(c->size()); }; connect(this, &PreviewClient::widthChanged, this, emitSizeChanged); diff --git a/kcmkwin/kwintabbox/main.cpp b/kcmkwin/kwintabbox/main.cpp index 84d41ef1f0..551cabf0b4 100644 --- a/kcmkwin/kwintabbox/main.cpp +++ b/kcmkwin/kwintabbox/main.cpp @@ -490,7 +490,7 @@ void KWinTabBoxConfig::tabBoxToggled(bool on) CHECK_CURRENT_TABBOX_UI on = !on || ui->effectCombo->currentIndex() >= Layout; ui->highlightWindowCheck->setEnabled(on); - emit changed(); + markAsChanged(); } void KWinTabBoxConfig::configureEffectClicked() diff --git a/layers.cpp b/layers.cpp index 4a5b17fb01..248468e4a1 100644 --- a/layers.cpp +++ b/layers.cpp @@ -509,7 +509,7 @@ QList Workspace::constrainedStackingOrder() QList layer[ NumLayers ]; // build the order from layers - QVector< QMap > minimum_layer(screens()->count()); + QVector< QMultiMap > minimum_layer(screens()->count()); for (auto it = unconstrained_stacking_order.constBegin(), end = unconstrained_stacking_order.constEnd(); it != end; ++it) { Layer l = (*it)->layer(); @@ -525,7 +525,7 @@ QList Workspace::constrainedStackingOrder() l = ActiveLayer; *mLayer = l; } else if (c) { - minimum_layer[screen].insertMulti(c->group(), l); + minimum_layer[screen].insert(c->group(), l); } layer[ l ].append(*it); } diff --git a/libkwineffects/kwinglplatform.cpp b/libkwineffects/kwinglplatform.cpp index 0a0ebd1cf7..1ba14ec942 100644 --- a/libkwineffects/kwinglplatform.cpp +++ b/libkwineffects/kwinglplatform.cpp @@ -687,7 +687,8 @@ void GLPlatform::detect(OpenGLPlatformInterface platformInterface) } } else { const QByteArray extensions = (const char *) glGetString(GL_EXTENSIONS); - m_extensions = QSet::fromList(extensions.split(' ')); + QList extensionsList = extensions.split(' '); + m_extensions = {extensionsList.constBegin(), extensionsList.constEnd()}; } // Parse the Mesa version diff --git a/main_wayland.cpp b/main_wayland.cpp index ea08a6b604..019ceb2b21 100644 --- a/main_wayland.cpp +++ b/main_wayland.cpp @@ -225,9 +225,8 @@ void ApplicationWayland::startSession() environment.remove("WAYLAND_DISPLAY"); QProcess *p = new Process(this); p->setProcessChannelMode(QProcess::ForwardedErrorChannel); - auto finishedSignal = static_cast(&QProcess::finished); - connect(p, finishedSignal, this, - [this, p] { + connect(p, qOverload(&QProcess::finished), this, + [p] { if (waylandServer()) { waylandServer()->destroyInputMethodConnection(); } @@ -235,8 +234,9 @@ void ApplicationWayland::startSession() } ); p->setProcessEnvironment(environment); - p->start(m_inputMethodServerToStart); - p->waitForStarted(); + p->setProgram(m_inputMethodServerToStart); + p->start(); + p->waitForStarted(); //do we really need to wait? } } @@ -245,8 +245,8 @@ void ApplicationWayland::startSession() QProcess *p = new Process(this); p->setProcessChannelMode(QProcess::ForwardedErrorChannel); p->setProcessEnvironment(processStartupEnvironment()); - auto finishedSignal = static_cast(&QProcess::finished); - connect(p, finishedSignal, this, [](int code, QProcess::ExitStatus status) { + connect(p, qOverload(&QProcess::finished), this, [p] (int code, QProcess::ExitStatus status) { + p->deleteLater(); if (status == QProcess::CrashExit) { qWarning() << "Session process has crashed"; QCoreApplication::exit(-1); @@ -259,7 +259,8 @@ void ApplicationWayland::startSession() QCoreApplication::exit(code); }); - p->start(m_sessionArgument); + p->setProgram(m_sessionArgument); + p->start(); } // start the applications passed to us as command line arguments if (!m_applicationsToStart.isEmpty()) { @@ -269,7 +270,9 @@ void ApplicationWayland::startSession() QProcess *p = new Process(this); p->setProcessChannelMode(QProcess::ForwardedErrorChannel); p->setProcessEnvironment(processStartupEnvironment()); - p->start(application); + p->setProgram(application); + p->startDetached(); + p->deleteLater(); } } } diff --git a/plugins/kdecorations/aurorae/src/aurorae.cpp b/plugins/kdecorations/aurorae/src/aurorae.cpp index 311c85cd9c..260aac8883 100644 --- a/plugins/kdecorations/aurorae/src/aurorae.cpp +++ b/plugins/kdecorations/aurorae/src/aurorae.cpp @@ -354,22 +354,24 @@ void Decoration::init() connect(m_extendedBorders, &KWin::Borders::topChanged, this, &Decoration::updateExtendedBorders); connect(m_extendedBorders, &KWin::Borders::bottomChanged, this, &Decoration::updateExtendedBorders); } - connect(client().data(), &KDecoration2::DecoratedClient::maximizedChanged, this, &Decoration::updateBorders, Qt::QueuedConnection); - connect(client().data(), &KDecoration2::DecoratedClient::shadedChanged, this, &Decoration::updateBorders); + + auto decorationClient = clientPointer(); + connect(decorationClient, &KDecoration2::DecoratedClient::maximizedChanged, this, &Decoration::updateBorders, Qt::QueuedConnection); + connect(decorationClient, &KDecoration2::DecoratedClient::shadedChanged, this, &Decoration::updateBorders); updateBorders(); if (m_view) { auto resizeWindow = [this] { QRect rect(QPoint(0, 0), size()); - if (m_padding && !client().data()->isMaximized()) { + if (m_padding && !clientPointer()->isMaximized()) { rect = rect.adjusted(-m_padding->left(), -m_padding->top(), m_padding->right(), m_padding->bottom()); } m_view->setGeometry(rect); }; connect(this, &Decoration::bordersChanged, this, resizeWindow); - connect(client().data(), &KDecoration2::DecoratedClient::widthChanged, this, resizeWindow); - connect(client().data(), &KDecoration2::DecoratedClient::heightChanged, this, resizeWindow); - connect(client().data(), &KDecoration2::DecoratedClient::maximizedChanged, this, resizeWindow); - connect(client().data(), &KDecoration2::DecoratedClient::shadedChanged, this, resizeWindow); + connect(decorationClient, &KDecoration2::DecoratedClient::widthChanged, this, resizeWindow); + connect(decorationClient, &KDecoration2::DecoratedClient::heightChanged, this, resizeWindow); + connect(decorationClient, &KDecoration2::DecoratedClient::maximizedChanged, this, resizeWindow); + connect(decorationClient, &KDecoration2::DecoratedClient::shadedChanged, this, resizeWindow); resizeWindow(); updateBuffer(); } else { @@ -400,7 +402,7 @@ void Decoration::setupBorders(QQuickItem *item) void Decoration::updateBorders() { KWin::Borders *b = m_borders; - if (client().data()->isMaximized() && m_maximizedBorders) { + if (clientPointer()->isMaximized() && m_maximizedBorders) { b = m_maximizedBorders; } if (!b) { @@ -430,7 +432,7 @@ void Decoration::updateShadow() const auto oldShadow = shadow(); if (m_padding && (m_padding->left() > 0 || m_padding->top() > 0 || m_padding->right() > 0 || m_padding->bottom() > 0) && - !client().data()->isMaximized()) { + !clientPointer()->isMaximized()) { if (oldShadow.isNull()) { updateShadow = true; } else { @@ -564,15 +566,15 @@ void Decoration::updateExtendedBorders() int extBottom = m_extendedBorders->bottom(); if (settings()->borderSize() == KDecoration2::BorderSize::None) { - if (!client().data()->isMaximizedHorizontally()) { + if (!clientPointer()->isMaximizedHorizontally()) { extLeft = qMax(m_extendedBorders->left(), extSize); extRight = qMax(m_extendedBorders->right(), extSize); } - if (!client().data()->isMaximizedVertically()) { + if (!clientPointer()->isMaximizedVertically()) { extBottom = qMax(m_extendedBorders->bottom(), extSize); } - } else if (settings()->borderSize() == KDecoration2::BorderSize::NoSides && !client().data()->isMaximizedHorizontally() ) { + } else if (settings()->borderSize() == KDecoration2::BorderSize::NoSides && !clientPointer()->isMaximizedHorizontally() ) { extLeft = qMax(m_extendedBorders->left(), extSize); extRight = qMax(m_extendedBorders->right(), extSize); } @@ -585,7 +587,7 @@ void Decoration::updateBuffer() m_contentRect = QRect(QPoint(0, 0), m_view->bufferAsImage().size()); if (m_padding && (m_padding->left() > 0 || m_padding->top() > 0 || m_padding->right() > 0 || m_padding->bottom() > 0) && - !client().data()->isMaximized()) { + !clientPointer()->isMaximized()) { m_contentRect = m_contentRect.adjusted(m_padding->left(), m_padding->top(), -m_padding->right(), -m_padding->bottom()); } updateShadow(); @@ -594,7 +596,7 @@ void Decoration::updateBuffer() KDecoration2::DecoratedClient *Decoration::clientPointer() const { - return client().data(); + return client().toStrongRef().data(); } ThemeFinder::ThemeFinder(QObject *parent, const QVariantList &args) diff --git a/plugins/platforms/drm/drm_backend.cpp b/plugins/platforms/drm/drm_backend.cpp index 01d2a38550..08811b053c 100644 --- a/plugins/platforms/drm/drm_backend.cpp +++ b/plugins/platforms/drm/drm_backend.cpp @@ -781,11 +781,11 @@ QString DrmBackend::supportInformation() const QString supportInfo; QDebug s(&supportInfo); s.nospace(); - s << "Name: " << "DRM" << endl; - s << "Active: " << m_active << endl; - s << "Atomic Mode Setting: " << m_atomicModeSetting << endl; + s << "Name: " << "DRM" << Qt::endl; + s << "Active: " << m_active << Qt::endl; + s << "Atomic Mode Setting: " << m_atomicModeSetting << Qt::endl; #if HAVE_EGL_STREAMS - s << "Using EGL Streams: " << m_useEglStreams << endl; + s << "Using EGL Streams: " << m_useEglStreams << Qt::endl; #endif return supportInfo; } diff --git a/plugins/platforms/drm/edid.cpp b/plugins/platforms/drm/edid.cpp index cfed325039..1081ab409f 100644 --- a/plugins/platforms/drm/edid.cpp +++ b/plugins/platforms/drm/edid.cpp @@ -155,6 +155,8 @@ static QByteArray parseVendor(const uint8_t *data) } } } +#else + Q_UNUSED(data) #endif return {}; } diff --git a/plugins/platforms/fbdev/scene_qpainter_fb_backend.cpp b/plugins/platforms/fbdev/scene_qpainter_fb_backend.cpp index 35a1968962..dd1cf5d5b6 100644 --- a/plugins/platforms/fbdev/scene_qpainter_fb_backend.cpp +++ b/plugins/platforms/fbdev/scene_qpainter_fb_backend.cpp @@ -45,7 +45,7 @@ FramebufferQPainterBackend::FramebufferQPainterBackend(FramebufferBackend *backe m_backBuffer.fill(Qt::black); connect(VirtualTerminal::self(), &VirtualTerminal::activeChanged, this, - [this] (bool active) { + [] (bool active) { if (active) { Compositor::self()->bufferSwapComplete(); Compositor::self()->addRepaintFull(); diff --git a/plugins/platforms/virtual/egl_gbm_backend.cpp b/plugins/platforms/virtual/egl_gbm_backend.cpp index 80514311db..8c04d57d1f 100644 --- a/plugins/platforms/virtual/egl_gbm_backend.cpp +++ b/plugins/platforms/virtual/egl_gbm_backend.cpp @@ -194,7 +194,7 @@ static void convertFromGLImage(QImage &img, int w, int h) // see https://github.com/qt/qtbase/blob/dev/src/opengl/qgl.cpp if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { // OpenGL gives RGBA; Qt wants ARGB - uint *p = (uint*)img.bits(); + uint *p = reinterpret_cast(img.bits()); uint *end = p + w * h; while (p < end) { uint a = *p << 24; @@ -204,7 +204,7 @@ static void convertFromGLImage(QImage &img, int w, int h) } else { // OpenGL gives ABGR (i.e. RGBA backwards); Qt wants ARGB for (int y = 0; y < h; y++) { - uint *q = (uint*)img.scanLine(y); + uint *q = reinterpret_cast(img.scanLine(y)); for (int x = 0; x < w; ++x) { const uint pixel = *q; *q = ((pixel << 16) & 0xff0000) | ((pixel >> 16) & 0xff) diff --git a/plugins/platforms/wayland/wayland_backend.cpp b/plugins/platforms/wayland/wayland_backend.cpp index b38fce7630..c88d088719 100644 --- a/plugins/platforms/wayland/wayland_backend.cpp +++ b/plugins/platforms/wayland/wayland_backend.cpp @@ -103,7 +103,9 @@ void WaylandCursor::installImage() doInstallImage(nullptr, QSize()); return; } - wl_buffer *imageBuffer = *(m_backend->shmPool()->createBuffer(image).data()); + + auto buffer = m_backend->shmPool()->createBuffer(image).toStrongRef(); + wl_buffer *imageBuffer = *buffer.data(); doInstallImage(imageBuffer, image.size()); } @@ -675,7 +677,7 @@ void WaylandBackend::createOutputs() if (ssdManager) { auto decoration = ssdManager->create(surface, this); connect(decoration, &ServerSideDecoration::modeChanged, this, - [this, decoration] { + [decoration] { if (decoration->mode() != ServerSideDecoration::Mode::Server) { decoration->requestMode(ServerSideDecoration::Mode::Server); } diff --git a/plugins/platforms/x11/standalone/glxbackend.cpp b/plugins/platforms/x11/standalone/glxbackend.cpp index 1831ce4462..1ea6d4e6b9 100644 --- a/plugins/platforms/x11/standalone/glxbackend.cpp +++ b/plugins/platforms/x11/standalone/glxbackend.cpp @@ -573,7 +573,7 @@ FBConfigInfo *GlxBackend::infoForVisual(xcb_visualid_t visual) const xcb_render_directformat_t *direct = XRenderUtils::findPictFormatInfo(format); if (!direct) { - qCCritical(KWIN_X11STANDALONE).nospace() << "Could not find a picture format for visual 0x" << hex << visual; + qCCritical(KWIN_X11STANDALONE).nospace() << "Could not find a picture format for visual 0x" << Qt::hex << visual; return info; } @@ -607,7 +607,7 @@ FBConfigInfo *GlxBackend::infoForVisual(xcb_visualid_t visual) GLXFBConfig *configs = glXChooseFBConfig(display(), DefaultScreen(display()), attribs, &count); if (count < 1) { - qCCritical(KWIN_X11STANDALONE).nospace() << "Could not find a framebuffer configuration for visual 0x" << hex << visual; + qCCritical(KWIN_X11STANDALONE).nospace() << "Could not find a framebuffer configuration for visual 0x" << Qt::hex << visual; return info; } @@ -689,7 +689,7 @@ FBConfigInfo *GlxBackend::infoForVisual(xcb_visualid_t visual) glXGetFBConfigAttrib(display(), info->fbconfig, GLX_FBCONFIG_ID, &fbc_id); glXGetFBConfigAttrib(display(), info->fbconfig, GLX_VISUAL_ID, &visual_id); - qCDebug(KWIN_X11STANDALONE).nospace() << "Using FBConfig 0x" << hex << fbc_id << " for visual 0x" << hex << visual_id; + qCDebug(KWIN_X11STANDALONE).nospace() << "Using FBConfig 0x" << Qt::hex << fbc_id << " for visual 0x" << Qt::hex << visual_id; } return info; diff --git a/plugins/scenes/opengl/scene_opengl.cpp b/plugins/scenes/opengl/scene_opengl.cpp index 3ec1f9fd9f..002efd0480 100644 --- a/plugins/scenes/opengl/scene_opengl.cpp +++ b/plugins/scenes/opengl/scene_opengl.cpp @@ -2110,7 +2110,7 @@ QSharedPointer DecorationShadowTextureCache::getTexture(SceneOpenGLSh { Q_ASSERT(shadow->hasDecorationShadow()); unregister(shadow); - const auto &decoShadow = shadow->decorationShadow(); + const auto &decoShadow = shadow->decorationShadow().toStrongRef(); Q_ASSERT(!decoShadow.isNull()); auto it = m_cache.find(decoShadow.data()); if (it != m_cache.end()) { diff --git a/tabbox/clientmodel.cpp b/tabbox/clientmodel.cpp index 6ea6f5fc87..4011ca56b9 100644 --- a/tabbox/clientmodel.cpp +++ b/tabbox/clientmodel.cpp @@ -164,12 +164,12 @@ void ClientModel::createClientList(bool partialReset) void ClientModel::createClientList(int desktop, bool partialReset) { - TabBoxClient* start = tabBox->activeClient().toStrongRef().data(); + auto start = tabBox->activeClient().toStrongRef(); // TODO: new clients are not added at correct position if (partialReset && !m_clientList.isEmpty()) { - QSharedPointer firstClient = m_clientList.first().toStrongRef(); + QSharedPointer firstClient = m_clientList.constFirst(); if (firstClient) { - start = firstClient.data(); + start = firstClient; } } @@ -179,34 +179,34 @@ void ClientModel::createClientList(int desktop, bool partialReset) switch(tabBox->config().clientSwitchingMode()) { case TabBoxConfig::FocusChainSwitching: { - TabBoxClient* c = start; - if (!tabBox->isInFocusChain(c)) { + auto c = start; + if (!tabBox->isInFocusChain(c.data())) { QSharedPointer firstClient = tabBox->firstClientFocusChain().toStrongRef(); if (firstClient) { - c = firstClient.data(); + c = firstClient; } } - TabBoxClient* stop = c; + auto stop = c; do { - QWeakPointer add = tabBox->clientToAddToList(c, desktop); + QSharedPointer add = tabBox->clientToAddToList(c.data(), desktop); if (!add.isNull()) { m_clientList += add; if (add.data()->isFirstInTabBox()) { stickyClients << add; } } - c = tabBox->nextClientFocusChain(c).data(); + c = tabBox->nextClientFocusChain(c.data()); } while (c && c != stop); break; } case TabBoxConfig::StackingOrderSwitching: { // TODO: needs improvement - TabBoxClientList stacking = tabBox->stackingOrder(); - TabBoxClient* c = stacking.first().data(); - TabBoxClient* stop = c; + const TabBoxClientList stacking = tabBox->stackingOrder(); + auto c = stacking.first().toStrongRef(); + auto stop = c; int index = 0; while (c) { - QWeakPointer add = tabBox->clientToAddToList(c, desktop); + QSharedPointer add = tabBox->clientToAddToList(c.data(), desktop); if (!add.isNull()) { if (start == add.data()) { m_clientList.removeAll(add); @@ -220,7 +220,7 @@ void ClientModel::createClientList(int desktop, bool partialReset) if (index >= stacking.size() - 1) { c = nullptr; } else { - c = stacking[++index].data(); + c = stacking[++index]; } if (c == stop) diff --git a/useractions.cpp b/useractions.cpp index 00cbc54a0f..7ac429548b 100644 --- a/useractions.cpp +++ b/useractions.cpp @@ -326,7 +326,7 @@ void UserActionsMenu::init() p->setProcessEnvironment(kwinApp()->processStartupEnvironment()); p->setProgram(QStringLiteral("kcmshell5")); connect(p, static_cast(&QProcess::finished), p, &QProcess::deleteLater); - connect(p, &QProcess::errorOccurred, this, [p](QProcess::ProcessError e) { + connect(p, &QProcess::errorOccurred, this, [] (QProcess::ProcessError e) { if (e == QProcess::FailedToStart) { qCDebug(KWIN_CORE) << "Failed to start kcmshell5"; } diff --git a/wayland_server.cpp b/wayland_server.cpp index 0b03d5b1da..ade32fc8f6 100644 --- a/wayland_server.cpp +++ b/wayland_server.cpp @@ -424,7 +424,7 @@ bool WaylandServer::init(const QByteArray &socketName, InitializationFlags flags c->installServerSideDecoration(deco); } connect(deco, &ServerSideDecorationInterface::modeRequested, this, - [this, deco] (ServerSideDecorationManagerInterface::Mode mode) { + [deco] (ServerSideDecorationManagerInterface::Mode mode) { // always acknowledge the requested mode deco->setMode(mode); } @@ -435,7 +435,7 @@ bool WaylandServer::init(const QByteArray &socketName, InitializationFlags flags m_outputManagement = m_display->createOutputManagement(m_display); connect(m_outputManagement, &OutputManagementInterface::configurationChangeRequested, - this, [this](KWayland::Server::OutputConfigurationInterface *config) { + this, [](KWayland::Server::OutputConfigurationInterface *config) { kwinApp()->platform()->requestOutputsChange(config); }); m_outputManagement->create(); @@ -731,7 +731,7 @@ quint32 WaylandServer::createWindowId(SurfaceInterface *surface) quint16 WaylandServer::createClientId(ClientConnection *c) { - auto ids = m_clientIds.values().toSet(); + const QSet ids(m_clientIds.constBegin(), m_clientIds.constEnd()); quint16 id = 1; if (!ids.isEmpty()) { for (quint16 i = ids.count() + 1; i >= 1 ; i--) { diff --git a/xwl/drag_x.cpp b/xwl/drag_x.cpp index b108c07be1..f84bb136c2 100644 --- a/xwl/drag_x.cpp +++ b/xwl/drag_x.cpp @@ -68,7 +68,7 @@ XToWlDrag::XToWlDrag(X11Source *source) connect(DataBridge::self()->dnd(), &Dnd::transferFinished, this, [this](xcb_timestamp_t eventTime) { // we use this mechanism, because the finished call is not // reliable done by Wayland clients - auto it = std::find_if(m_dataRequests.begin(), m_dataRequests.end(), [this, eventTime](QPair req) { + auto it = std::find_if(m_dataRequests.begin(), m_dataRequests.end(), [eventTime](const QPair &req) { return req.first == eventTime; }); if (it == m_dataRequests.end()) {