Run clang-format yet another time

This commit is contained in:
Vlad Zahorodnii 2022-04-15 15:23:44 +03:00
parent 1466836ba7
commit ca7927e3b6
6 changed files with 28 additions and 33 deletions

View file

@ -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;

View file

@ -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 &region, 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 &region, 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 &region, 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()) {

View file

@ -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<int> visibleDesktops;

View file

@ -18,8 +18,8 @@
#include <KWaylandServer/plasmavirtualdesktop_interface.h>
// Qt
#include <QAction>
#include <QUuid>
#include <QDebug>
#include <QUuid>
#include <algorithm>
@ -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);

View file

@ -12,11 +12,11 @@
#include <kwin_export.h>
#include <kwinglobals.h>
// Qt includes
#include <QAction>
#include <QObject>
#include <QPoint>
#include <QPointer>
#include <QSize>
#include <QAction>
// KDE includes
#include <KConfig>

View file

@ -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 *);