[effects/slide] Fix coding style

Summary:
Kdelibs coding style states the following about whitespace placement:

> For pointers or references, use a single space before '*' or '&', but not after

Source: https://community.kde.org/Policies/Kdelibs_Coding_Style#Whitespace

Also, putting a whitespace after ! is not common in KWin.

Test Plan: Switched between virtual desktops.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D14260
This commit is contained in:
Vlad Zagorodniy 2018-07-21 11:33:40 +03:00
parent 59e3e21c47
commit 9cff6c21f3
3 changed files with 44 additions and 44 deletions

View file

@ -71,7 +71,7 @@ void SlideEffect::reconfigure(ReconfigureFlags)
m_slideBackground = SlideConfig::slideBackground(); m_slideBackground = SlideConfig::slideBackground();
} }
void SlideEffect::prePaintScreen(ScreenPrePaintData& data, int time) void SlideEffect::prePaintScreen(ScreenPrePaintData &data, int time)
{ {
m_timeLine.update(std::chrono::milliseconds(time)); m_timeLine.update(std::chrono::milliseconds(time));
@ -92,7 +92,7 @@ void SlideEffect::prePaintScreen(ScreenPrePaintData& data, int time)
* @param w Width of the desktop grid * @param w Width of the desktop grid
* @param h Height of the desktop grid * @param h Height of the desktop grid
*/ */
inline void wrapDiff(QPoint& diff, int w, int h) inline void wrapDiff(QPoint &diff, int w, int h)
{ {
if (diff.x() > w/2) { if (diff.x() > w/2) {
diff.setX(diff.x() - w); diff.setX(diff.x() - w);
@ -107,7 +107,7 @@ inline void wrapDiff(QPoint& diff, int w, int h)
} }
} }
inline QRegion buildClipRegion(const QPoint& pos, int w, int h) inline QRegion buildClipRegion(const QPoint &pos, int w, int h)
{ {
const QSize screenSize = effects->virtualScreenSize(); const QSize screenSize = effects->virtualScreenSize();
QRegion r = QRect(pos, screenSize); QRegion r = QRect(pos, screenSize);
@ -126,9 +126,9 @@ inline QRegion buildClipRegion(const QPoint& pos, int w, int h)
return r; return r;
} }
void SlideEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data) void SlideEffect::paintScreen(int mask, QRegion region, ScreenPaintData &data)
{ {
if (! m_active) { if (!m_active) {
effects->paintScreen(mask, region, data); effects->paintScreen(mask, region, data);
return; return;
} }
@ -152,7 +152,7 @@ void SlideEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
const QRegion clipRegion = buildClipRegion(currentPos, w, h); const QRegion clipRegion = buildClipRegion(currentPos, w, h);
for (int i = 1; i <= effects->numberOfDesktops(); i++) { for (int i = 1; i <= effects->numberOfDesktops(); i++) {
const QRect desktopGeo = desktopGeometry(i); const QRect desktopGeo = desktopGeometry(i);
if (! clipRegion.contains(desktopGeo)) { if (!clipRegion.contains(desktopGeo)) {
continue; continue;
} }
visibleDesktops << i; visibleDesktops << i;
@ -167,8 +167,8 @@ void SlideEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
if (m_slideDocks) { if (m_slideDocks) {
const auto windows = effects->stackingOrder(); const auto windows = effects->stackingOrder();
m_paintCtx.fullscreenWindows.clear(); m_paintCtx.fullscreenWindows.clear();
for (EffectWindow* w : windows) { for (EffectWindow *w : windows) {
if (! w->isFullScreen()) { if (!w->isFullScreen()) {
continue; continue;
} }
m_paintCtx.fullscreenWindows << w; m_paintCtx.fullscreenWindows << w;
@ -204,7 +204,7 @@ void SlideEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
* Decide whether given window @p w should be transformed/translated. * Decide whether given window @p w should be transformed/translated.
* @returns @c true if given window @p w should be transformed, otherwise @c false * @returns @c true if given window @p w should be transformed, otherwise @c false
*/ */
bool SlideEffect::isTranslated(const EffectWindow* w) const bool SlideEffect::isTranslated(const EffectWindow *w) const
{ {
if (w->isOnAllDesktops()) { if (w->isOnAllDesktops()) {
if (w->isDock()) { if (w->isDock()) {
@ -226,14 +226,14 @@ bool SlideEffect::isTranslated(const EffectWindow* w) const
* Decide whether given window @p w should be painted. * Decide whether given window @p w should be painted.
* @returns @c true if given window @p w should be painted, otherwise @c false * @returns @c true if given window @p w should be painted, otherwise @c false
*/ */
bool SlideEffect::isPainted(const EffectWindow* w) const bool SlideEffect::isPainted(const EffectWindow *w) const
{ {
if (w->isOnAllDesktops()) { if (w->isOnAllDesktops()) {
if (w->isDock()) { if (w->isDock()) {
if (! m_slideDocks) { if (!m_slideDocks) {
return m_paintCtx.lastPass; return m_paintCtx.lastPass;
} }
for (const EffectWindow* fw : qAsConst(m_paintCtx.fullscreenWindows)) { for (const EffectWindow *fw : qAsConst(m_paintCtx.fullscreenWindows)) {
if (fw->isOnDesktop(m_paintCtx.desktop) if (fw->isOnDesktop(m_paintCtx.desktop)
&& fw->screen() == w->screen()) { && fw->screen() == w->screen()) {
return false; return false;
@ -263,7 +263,7 @@ bool SlideEffect::isPainted(const EffectWindow* w) const
return false; return false;
} }
void SlideEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time) void SlideEffect::prePaintWindow(EffectWindow *w, WindowPrePaintData &data, int time)
{ {
if (m_active) { if (m_active) {
const bool painted = isPainted(w); const bool painted = isPainted(w);
@ -279,7 +279,7 @@ void SlideEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int
effects->prePaintWindow(w, data, time); effects->prePaintWindow(w, data, time);
} }
void SlideEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) void SlideEffect::paintWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data)
{ {
if (m_active && isTranslated(w)) { if (m_active && isTranslated(w)) {
data += m_paintCtx.translation; data += m_paintCtx.translation;
@ -341,7 +341,7 @@ int SlideEffect::workspaceHeight() const
return h; return h;
} }
bool SlideEffect::shouldForceBlur(const EffectWindow* w) const bool SlideEffect::shouldForceBlur(const EffectWindow *w) const
{ {
// While there is an active fullscreen effect, the blur effect // While there is an active fullscreen effect, the blur effect
// tends to do nothing, i.e. it doesn't blur behind windows. // tends to do nothing, i.e. it doesn't blur behind windows.
@ -364,7 +364,7 @@ bool SlideEffect::shouldForceBlur(const EffectWindow* w) const
// if (surf) { // if (surf) {
// return !surf->blur().isNull(); // return !surf->blur().isNull();
// } // }
const KWayland::Server::SurfaceInterface* surf = w->surface(); const KWayland::Server::SurfaceInterface *surf = w->surface();
if (surf && surf->blur()) { if (surf && surf->blur()) {
return true; return true;
} }
@ -374,7 +374,7 @@ bool SlideEffect::shouldForceBlur(const EffectWindow* w) const
return w->hasAlpha(); return w->hasAlpha();
} }
bool SlideEffect::shouldForceBackgroundContrast(const EffectWindow* w) const bool SlideEffect::shouldForceBackgroundContrast(const EffectWindow *w) const
{ {
// While there is an active fullscreen effect, the background // While there is an active fullscreen effect, the background
// contrast effect tends to do nothing, i.e. it doesn't change // contrast effect tends to do nothing, i.e. it doesn't change
@ -393,7 +393,7 @@ bool SlideEffect::shouldForceBackgroundContrast(const EffectWindow* w) const
// if (surf) { // if (surf) {
// return !surf->contrast().isNull(); // return !surf->contrast().isNull();
// } // }
const KWayland::Server::SurfaceInterface* surf = w->surface(); const KWayland::Server::SurfaceInterface *surf = w->surface();
if (surf && surf->contrast()) { if (surf && surf->contrast()) {
return true; return true;
} }
@ -405,7 +405,7 @@ bool SlideEffect::shouldForceBackgroundContrast(const EffectWindow* w) const
&& (w->isDock() || w->keepAbove()); && (w->isDock() || w->keepAbove());
} }
bool SlideEffect::shouldElevate(const EffectWindow* w) const bool SlideEffect::shouldElevate(const EffectWindow *w) const
{ {
// Static docks(i.e. this effect doesn't slide docks) should be elevated // Static docks(i.e. this effect doesn't slide docks) should be elevated
// so they can properly animate themselves when an user enters or leaves // so they can properly animate themselves when an user enters or leaves
@ -413,7 +413,7 @@ bool SlideEffect::shouldElevate(const EffectWindow* w) const
return w->isDock() && !m_slideDocks; return w->isDock() && !m_slideDocks;
} }
void SlideEffect::start(int old, int current, EffectWindow* movingWindow) void SlideEffect::start(int old, int current, EffectWindow *movingWindow)
{ {
m_movingWindow = movingWindow; m_movingWindow = movingWindow;
@ -436,7 +436,7 @@ void SlideEffect::start(int old, int current, EffectWindow* movingWindow)
} }
const auto windows = effects->stackingOrder(); const auto windows = effects->stackingOrder();
for (EffectWindow* w : windows) { for (EffectWindow *w : windows) {
if (shouldForceBlur(w)) { if (shouldForceBlur(w)) {
w->setData(WindowForceBlurRole, QVariant(true)); w->setData(WindowForceBlurRole, QVariant(true));
m_forcedRoles.blur << w; m_forcedRoles.blur << w;
@ -464,17 +464,17 @@ void SlideEffect::start(int old, int current, EffectWindow* movingWindow)
void SlideEffect::stop() void SlideEffect::stop()
{ {
for (EffectWindow* w : m_forcedRoles.blur) { for (EffectWindow *w : m_forcedRoles.blur) {
w->setData(WindowForceBlurRole, QVariant()); w->setData(WindowForceBlurRole, QVariant());
} }
m_forcedRoles.blur.clear(); m_forcedRoles.blur.clear();
for (EffectWindow* w : m_forcedRoles.backgroundContrast) { for (EffectWindow *w : m_forcedRoles.backgroundContrast) {
w->setData(WindowForceBackgroundContrastRole, QVariant()); w->setData(WindowForceBackgroundContrastRole, QVariant());
} }
m_forcedRoles.backgroundContrast.clear(); m_forcedRoles.backgroundContrast.clear();
for (EffectWindow* w : m_elevatedWindows) { for (EffectWindow *w : m_elevatedWindows) {
effects->setElevatedWindow(w, false); effects->setElevatedWindow(w, false);
} }
m_elevatedWindows.clear(); m_elevatedWindows.clear();
@ -485,7 +485,7 @@ void SlideEffect::stop()
effects->setActiveFullScreenEffect(nullptr); effects->setActiveFullScreenEffect(nullptr);
} }
void SlideEffect::desktopChanged(int old, int current, EffectWindow* with) void SlideEffect::desktopChanged(int old, int current, EffectWindow *with)
{ {
if (effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this) { if (effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this) {
return; return;
@ -495,7 +495,7 @@ void SlideEffect::desktopChanged(int old, int current, EffectWindow* with)
void SlideEffect::windowAdded(EffectWindow *w) void SlideEffect::windowAdded(EffectWindow *w)
{ {
if (! m_active) { if (!m_active) {
return; return;
} }
if (shouldForceBlur(w)) { if (shouldForceBlur(w)) {
@ -514,7 +514,7 @@ void SlideEffect::windowAdded(EffectWindow *w)
void SlideEffect::windowDeleted(EffectWindow *w) void SlideEffect::windowDeleted(EffectWindow *w)
{ {
if (! m_active) { if (!m_active) {
return; return;
} }
if (w == m_movingWindow) { if (w == m_movingWindow) {
@ -528,7 +528,7 @@ void SlideEffect::windowDeleted(EffectWindow *w)
void SlideEffect::numberDesktopsChanged(uint) void SlideEffect::numberDesktopsChanged(uint)
{ {
if (! m_active) { if (!m_active) {
return; return;
} }
stop(); stop();
@ -536,7 +536,7 @@ void SlideEffect::numberDesktopsChanged(uint)
void SlideEffect::numberScreensChanged() void SlideEffect::numberScreensChanged()
{ {
if (! m_active) { if (!m_active) {
return; return;
} }
stop(); stop();

View file

@ -43,12 +43,12 @@ public:
void reconfigure(ReconfigureFlags) override; void reconfigure(ReconfigureFlags) override;
void prePaintScreen(ScreenPrePaintData& data, int time) override; void prePaintScreen(ScreenPrePaintData &data, int time) override;
void paintScreen(int mask, QRegion region, ScreenPaintData& data) override; void paintScreen(int mask, QRegion region, ScreenPaintData &data) override;
void postPaintScreen() override; void postPaintScreen() override;
void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time) override; void prePaintWindow(EffectWindow *w, WindowPrePaintData &data, int time) override;
void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) override; void paintWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data) override;
bool isActive() const override { bool isActive() const override {
return m_active; return m_active;
@ -67,9 +67,9 @@ public:
bool slideBackground() const; bool slideBackground() const;
private Q_SLOTS: private Q_SLOTS:
void desktopChanged(int old, int current, EffectWindow* with); void desktopChanged(int old, int current, EffectWindow *with);
void windowAdded(EffectWindow* w); void windowAdded(EffectWindow *w);
void windowDeleted(EffectWindow* w); void windowDeleted(EffectWindow *w);
void numberDesktopsChanged(uint old); void numberDesktopsChanged(uint old);
void numberScreensChanged(); void numberScreensChanged();
@ -80,14 +80,14 @@ private:
int workspaceWidth() const; int workspaceWidth() const;
int workspaceHeight() const; int workspaceHeight() const;
bool isTranslated(const EffectWindow* w) const; bool isTranslated(const EffectWindow *w) const;
bool isPainted(const EffectWindow* w) const; bool isPainted(const EffectWindow *w) const;
bool shouldForceBlur(const EffectWindow* w) const; bool shouldForceBlur(const EffectWindow *w) const;
bool shouldForceBackgroundContrast(const EffectWindow* w) const; bool shouldForceBackgroundContrast(const EffectWindow *w) const;
bool shouldElevate(const EffectWindow* w) const; bool shouldElevate(const EffectWindow *w) const;
void start(int old, int current, EffectWindow* movingWindow = nullptr); void start(int old, int current, EffectWindow *movingWindow = nullptr);
void stop(); void stop();
private: private:
@ -100,7 +100,7 @@ private:
TimeLine m_timeLine; TimeLine m_timeLine;
QPoint m_startPos; QPoint m_startPos;
QPoint m_diff; QPoint m_diff;
EffectWindow* m_movingWindow = nullptr; EffectWindow *m_movingWindow = nullptr;
struct { struct {
int desktop; int desktop;

View file

@ -33,7 +33,7 @@ class SlideEffectConfig : public KCModule
Q_OBJECT Q_OBJECT
public: public:
explicit SlideEffectConfig(QWidget *parent = nullptr, const QVariantList& args = QVariantList()); explicit SlideEffectConfig(QWidget *parent = nullptr, const QVariantList &args = QVariantList());
~SlideEffectConfig(); ~SlideEffectConfig();
void save(); void save();