From ca7927e3b6618c902533f983cc508f120f013aed Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 15 Apr 2022 15:23:44 +0300 Subject: [PATCH] Run clang-format yet another time --- src/effects.cpp | 27 ++++++++++++--------------- src/effects/slide/slide.cpp | 17 ++++++++--------- src/effects/slide/slide.h | 7 +++---- src/virtualdesktops.cpp | 6 +++--- src/virtualdesktops.h | 2 +- src/workspace.h | 2 +- 6 files changed, 28 insertions(+), 33 deletions(-) diff --git a/src/effects.cpp b/src/effects.cpp index cd8319425b..2e312f5c70 100644 --- a/src/effects.cpp +++ b/src/effects.cpp @@ -145,22 +145,19 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene) } }); connect(ws, &Workspace::currentDesktopChanged, this, [this](int old, AbstractClient *c) { - const int newDesktop = VirtualDesktopManager::self()->current(); - if (old != 0 && newDesktop != old) { - Q_EMIT desktopChanged(old, newDesktop, c ? c->effectWindow() : nullptr); - // TODO: remove in 4.10 - Q_EMIT desktopChanged(old, newDesktop); - } + const int newDesktop = VirtualDesktopManager::self()->current(); + if (old != 0 && newDesktop != old) { + Q_EMIT desktopChanged(old, newDesktop, c ? c->effectWindow() : nullptr); + // TODO: remove in 4.10 + Q_EMIT desktopChanged(old, newDesktop); } - ); - connect(ws, &Workspace::currentDesktopChanging, this, [this](uint currentDesktop, QPointF offset, KWin::AbstractClient* c){ - Q_EMIT desktopChanging(currentDesktop, offset, c ? c->effectWindow() : nullptr); - } - ); - connect(ws, &Workspace::currentDesktopChangingCancelled, this, [this](){ - Q_EMIT desktopChangingCancelled(); - } - ); + }); + connect(ws, &Workspace::currentDesktopChanging, this, [this](uint currentDesktop, QPointF offset, KWin::AbstractClient *c) { + Q_EMIT desktopChanging(currentDesktop, offset, c ? c->effectWindow() : nullptr); + }); + connect(ws, &Workspace::currentDesktopChangingCancelled, this, [this]() { + Q_EMIT desktopChangingCancelled(); + }); connect(ws, &Workspace::desktopPresenceChanged, this, [this](AbstractClient *c, int old) { if (!c->effectWindow()) { return; diff --git a/src/effects/slide/slide.cpp b/src/effects/slide/slide.cpp index a477240807..6e02ceb656 100644 --- a/src/effects/slide/slide.cpp +++ b/src/effects/slide/slide.cpp @@ -105,7 +105,7 @@ void SlideEffect::prePaintScreen(ScreenPrePaintData &data, std::chrono::millisec const int w = effects->desktopGridWidth(); const int h = effects->desktopGridHeight(); - //Clipping + // Clipping m_paintCtx.visibleDesktops.clear(); m_paintCtx.visibleDesktops.reserve(4); // 4 - maximum number of visible desktops bool includedX = false, includedY = false; @@ -144,7 +144,7 @@ void SlideEffect::paintScreen(int mask, const QRegion ®ion, ScreenPaintData & drawPosition = constrainToDrawableRange(drawPosition); } - //If we're wrapping, draw the desktop in the second position. + // If we're wrapping, draw the desktop in the second position. if (drawPosition.x() > w - 1) { wrappingX = true; } @@ -153,7 +153,6 @@ void SlideEffect::paintScreen(int mask, const QRegion ®ion, ScreenPaintData & wrappingY = true; } - // When we enter a virtual desktop that has a window in fullscreen mode, // stacking order is fine. When we leave a virtual desktop that has // a window in fullscreen mode, stacking order is no longer valid @@ -181,7 +180,7 @@ void SlideEffect::paintScreen(int mask, const QRegion ®ion, ScreenPaintData & for (int desktop : qAsConst(m_paintCtx.visibleDesktops)) { m_paintCtx.desktop = desktop; m_paintCtx.lastPass = (lastDesktop == desktop); - m_paintCtx.translation = QPointF(effects->desktopGridCoords(desktop)) - drawPosition;//TODO: verify + m_paintCtx.translation = QPointF(effects->desktopGridCoords(desktop)) - drawPosition; // TODO: verify // Decide if that first desktop should be drawn at 0 or the higher position used for wrapping. if (effects->desktopGridCoords(desktop).x() == 0 && wrappingX) { @@ -285,7 +284,7 @@ void SlideEffect::paintWindow(EffectWindow *w, int mask, QRegion region, WindowP return; } - for (EffectScreen *screen: effects->screens()) { + for (EffectScreen *screen : effects->screens()) { QPoint translation = getDrawCoords(m_paintCtx.translation, screen); if (isTranslated(w)) { data += translation; @@ -350,7 +349,7 @@ void SlideEffect::startAnimation(int old, int current, EffectWindow *movingWindo const bool wrap = effects->optionRollOverDesktops(); - //Handle stacking order + // Handle stacking order const auto windows = effects->stackingOrder(); for (EffectWindow *w : windows) { if (shouldElevate(w)) { @@ -523,9 +522,9 @@ void SlideEffect::optimizePath() m_endPos.setY(fmod(m_endPos.y(), h)); } - // Is there is a shorter possible route? - // If the x distance to be traveled is more than half the grid width, it's faster to wrap. - // To avoid negative coordinates, take the lower coordinate and raise. + // Is there is a shorter possible route? + // If the x distance to be traveled is more than half the grid width, it's faster to wrap. + // To avoid negative coordinates, take the lower coordinate and raise. if (std::abs((m_startPos.x() - m_endPos.x())) > w / 2.0) { if (m_startPos.x() < m_endPos.x()) { while (m_startPos.x() < m_endPos.x()) { diff --git a/src/effects/slide/slide.h b/src/effects/slide/slide.h index 49c0b0b483..539e9e8e1f 100644 --- a/src/effects/slide/slide.h +++ b/src/effects/slide/slide.h @@ -42,7 +42,6 @@ namespace KWin * Good luck :) */ - class SlideEffect : public Effect { Q_OBJECT @@ -85,7 +84,7 @@ public: private Q_SLOTS: void desktopChanged(int old, int current, EffectWindow *with); - void desktopChanging(uint old, QPointF desktopOffset, EffectWindow* with); + void desktopChanging(uint old, QPointF desktopOffset, EffectWindow *with); void desktopChangingCancelled(); void windowAdded(EffectWindow *w); void windowDeleted(EffectWindow *w); @@ -98,7 +97,7 @@ private: QPointF moveInsideDesktopGrid(QPointF p); QPointF constrainToDrawableRange(QPointF p); QPointF forcePositivePosition(QPointF p) const; - void optimizePath(); //Find the best path to target desktop + void optimizePath(); // Find the best path to target desktop void startAnimation(int old, int current, EffectWindow *movingWindow = nullptr); void finishedSwitching(); @@ -128,7 +127,7 @@ private: int desktop; bool firstPass; bool lastPass; - QPointF translation; //Uses desktops as units + QPointF translation; // Uses desktops as units QPoint currentPos; QVector visibleDesktops; diff --git a/src/virtualdesktops.cpp b/src/virtualdesktops.cpp index 10e5d00b1c..9a1b896539 100644 --- a/src/virtualdesktops.cpp +++ b/src/virtualdesktops.cpp @@ -18,8 +18,8 @@ #include // Qt #include -#include #include +#include #include @@ -794,7 +794,7 @@ void VirtualDesktopManager::initShortcuts() Q_UNUSED(addAction(QStringLiteral("Switch to Next Desktop"), i18n("Switch to Next Desktop"), &VirtualDesktopManager::slotNext)) Q_UNUSED(addAction(QStringLiteral("Switch to Previous Desktop"), i18n("Switch to Previous Desktop"), &VirtualDesktopManager::slotPrevious)) - //shortcuts + // shortcuts QAction *slotRightAction = addAction(QStringLiteral("Switch One Desktop to the Right"), i18n("Switch One Desktop to the Right"), &VirtualDesktopManager::slotRight); KGlobalAccel::setGlobalShortcut(slotRightAction, QKeySequence(Qt::CTRL | Qt::META | Qt::Key_Right)); QAction *slotLeftAction = addAction(QStringLiteral("Switch One Desktop to the Left"), i18n("Switch One Desktop to the Left"), &VirtualDesktopManager::slotLeft); @@ -809,7 +809,7 @@ void VirtualDesktopManager::initShortcuts() connect(m_swipeGestureReleasedX.get(), &QAction::triggered, this, &VirtualDesktopManager::gestureReleasedX); connect(m_swipeGestureReleasedY.get(), &QAction::triggered, this, &VirtualDesktopManager::gestureReleasedY); - //These take the live feedback from a gesture + // These take the live feedback from a gesture input()->registerRealtimeTouchpadSwipeShortcut(SwipeDirection::Left, 3, m_swipeGestureReleasedX.get(), [this](qreal cb) { if (grid().width() > 1) { m_currentDesktopOffset.setX(cb); diff --git a/src/virtualdesktops.h b/src/virtualdesktops.h index 760f26325d..1990b3de51 100644 --- a/src/virtualdesktops.h +++ b/src/virtualdesktops.h @@ -12,11 +12,11 @@ #include #include // Qt includes +#include #include #include #include #include -#include // KDE includes #include diff --git a/src/workspace.h b/src/workspace.h index 3a6d987a39..4b69240933 100644 --- a/src/workspace.h +++ b/src/workspace.h @@ -529,7 +529,7 @@ Q_SIGNALS: void desktopPresenceChanged(KWin::AbstractClient *, int); void currentActivityChanged(); void currentDesktopChanged(int, KWin::AbstractClient *); - void currentDesktopChanging(uint currentDesktop, QPointF delta, KWin::AbstractClient*);//for realtime animations + void currentDesktopChanging(uint currentDesktop, QPointF delta, KWin::AbstractClient *); // for realtime animations void currentDesktopChangingCancelled(); void clientAdded(KWin::AbstractClient *); void clientRemoved(KWin::AbstractClient *);