From 0dda9dc7d09c6750885e30a6e20658563e204c37 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 21 Aug 2020 13:32:04 +0300 Subject: [PATCH] Use namespace kwin only in autotests In kwin core, we prefer not to put `using namespace KWin` because it makes defining forward declared classes more trickier. --- appmenu.cpp | 5 ++++- dmabuftexture.cpp | 4 +++- effects/backgroundcontrast/contrastshader.cpp | 5 +++-- effects/windowgeometry/windowgeometry.cpp | 5 ++++- inputpanelv1client.cpp | 6 +++++- libkwineffects/anidata.cpp | 7 +++++-- libkwineffects/kwinanimationeffect.cpp | 10 +++++----- libkwineffects/kwineffectquickview.cpp | 5 ++++- libkwineffects/kwineglimagetexture.cpp | 7 +++++-- onscreennotification.cpp | 7 +++++-- screencast/pipewirestream.cpp | 1 - tabletmodemanager.cpp | 5 ++++- 12 files changed, 47 insertions(+), 20 deletions(-) diff --git a/appmenu.cpp b/appmenu.cpp index 5dad80912..01a036fc1 100644 --- a/appmenu.cpp +++ b/appmenu.cpp @@ -19,7 +19,8 @@ #include "decorations/decorationbridge.h" #include -using namespace KWin; +namespace KWin +{ KWIN_SINGLETON_FACTORY(ApplicationMenu) @@ -118,3 +119,5 @@ AbstractClient *ApplicationMenu::findAbstractClientWithApplicationMenu(const QSt && c->applicationMenuObjectPath() == menuObjectPath.path(); }); } + +} // namespace KWin diff --git a/dmabuftexture.cpp b/dmabuftexture.cpp index 3ab5d55a8..f1b4d8af3 100644 --- a/dmabuftexture.cpp +++ b/dmabuftexture.cpp @@ -9,7 +9,8 @@ #include "kwineglimagetexture.h" #include "kwinglutils.h" -using namespace KWin; +namespace KWin +{ DmaBufTexture::DmaBufTexture(KWin::GLTexture *texture) : m_texture(texture) @@ -24,3 +25,4 @@ KWin::GLRenderTarget *DmaBufTexture::framebuffer() const return m_framebuffer.data(); } +} // namespace KWin diff --git a/effects/backgroundcontrast/contrastshader.cpp b/effects/backgroundcontrast/contrastshader.cpp index 93dcc01f2..568db6b9b 100644 --- a/effects/backgroundcontrast/contrastshader.cpp +++ b/effects/backgroundcontrast/contrastshader.cpp @@ -17,8 +17,8 @@ #include -using namespace KWin; - +namespace KWin +{ ContrastShader::ContrastShader() : mValid(false), shader(nullptr), m_opacity(1) @@ -195,3 +195,4 @@ void ContrastShader::init() setIsValid(shader->isValid()); } +} // namespace KWin diff --git a/effects/windowgeometry/windowgeometry.cpp b/effects/windowgeometry/windowgeometry.cpp index 21140ae0a..328b3455a 100644 --- a/effects/windowgeometry/windowgeometry.cpp +++ b/effects/windowgeometry/windowgeometry.cpp @@ -19,7 +19,8 @@ #include #include -using namespace KWin; +namespace KWin +{ WindowGeometry::WindowGeometry() { @@ -224,3 +225,5 @@ bool WindowGeometry::isActive() const { return iAmActive; } + +} // namespace KWin diff --git a/inputpanelv1client.cpp b/inputpanelv1client.cpp index f7342371b..a7000407c 100644 --- a/inputpanelv1client.cpp +++ b/inputpanelv1client.cpp @@ -18,9 +18,11 @@ #include #include -using namespace KWin; using namespace KWaylandServer; +namespace KWin +{ + InputPanelV1Client::InputPanelV1Client(InputPanelSurfaceV1Interface *panelSurface) : WaylandClient(panelSurface->surface()) , m_panelSurface(panelSurface) @@ -136,3 +138,5 @@ void InputPanelV1Client::setOutput(OutputInterface *outputIface) connect(m_output, &AbstractWaylandOutput::geometryChanged, this, &InputPanelV1Client::reposition); } } + +} // namespace KWin diff --git a/libkwineffects/anidata.cpp b/libkwineffects/anidata.cpp index fe0ed4a36..d2ee9d85b 100644 --- a/libkwineffects/anidata.cpp +++ b/libkwineffects/anidata.cpp @@ -12,14 +12,15 @@ #include "logging_p.h" +namespace KWin +{ + QDebug operator<<(QDebug dbg, const KWin::AniData &a) { dbg.nospace() << a.debugInfo(); return dbg.space(); } -using namespace KWin; - FullScreenEffectLock::FullScreenEffectLock(Effect *effect) { effects->setActiveFullScreenEffect(effect); @@ -120,3 +121,5 @@ QString AniData::debugInfo() const QLatin1String( " Duration: ") + QString::number(timeLine.duration().count()) + QLatin1String("ms\n") + QLatin1String( " Passed: ") + QString::number(timeLine.elapsed().count()) + QLatin1String("ms\n"); } + +} // namespace KWin diff --git a/libkwineffects/kwinanimationeffect.cpp b/libkwineffects/kwinanimationeffect.cpp index 80a90ec62..eb287aaee 100644 --- a/libkwineffects/kwinanimationeffect.cpp +++ b/libkwineffects/kwinanimationeffect.cpp @@ -16,14 +16,15 @@ #include #include +namespace KWin +{ + QDebug operator<<(QDebug dbg, const KWin::FPx2 &fpx2) { dbg.nospace() << fpx2[0] << "," << fpx2[1] << QString(fpx2.isValid() ? QStringLiteral(" (valid)") : QStringLiteral(" (invalid)")); return dbg.space(); } -namespace KWin { - QElapsedTimer AnimationEffect::s_clock; class AnimationEffectPrivate { @@ -39,9 +40,6 @@ public: QWeakPointer m_fullScreenEffectLock; bool m_animated, m_damageDirty, m_needSceneRepaint, m_animationsTouched, m_isInitialized; }; -} - -using namespace KWin; quint64 AnimationEffectPrivate::m_animCounter = 0; @@ -1043,4 +1041,6 @@ AnimationEffect::AniMap AnimationEffect::state() const return d->m_animations; } +} // namespace KWin + #include "moc_kwinanimationeffect.cpp" diff --git a/libkwineffects/kwineffectquickview.cpp b/libkwineffects/kwineffectquickview.cpp index a0eae9fc5..b2554cfc5 100644 --- a/libkwineffects/kwineffectquickview.cpp +++ b/libkwineffects/kwineffectquickview.cpp @@ -28,7 +28,8 @@ #include -using namespace KWin; +namespace KWin +{ static std::unique_ptr s_shareContext; @@ -375,3 +376,5 @@ QQuickItem *EffectQuickScene::rootItem() const { return qobject_cast(d->qmlObject->rootObject()); } + +} // namespace KWin diff --git a/libkwineffects/kwineglimagetexture.cpp b/libkwineffects/kwineglimagetexture.cpp index 94970c989..9400b69e1 100644 --- a/libkwineffects/kwineglimagetexture.cpp +++ b/libkwineffects/kwineglimagetexture.cpp @@ -9,11 +9,12 @@ #include "kwineglimagetexture.h" -using namespace KWin; - #include #include +namespace KWin +{ + EGLImageTexture::EGLImageTexture(EGLDisplay display, EGLImage image, int internalFormat, const QSize &size) : GLTexture(internalFormat, size, 1, true) , m_image(image) @@ -31,3 +32,5 @@ EGLImageTexture::~EGLImageTexture() { eglDestroyImageKHR(m_display, m_image); } + +} // namespace KWin diff --git a/onscreennotification.cpp b/onscreennotification.cpp index 2a4af9cf2..cc7bdcdde 100644 --- a/onscreennotification.cpp +++ b/onscreennotification.cpp @@ -23,9 +23,10 @@ #include -using namespace KWin; +namespace KWin +{ -class KWin::OnScreenNotificationInputEventSpy : public InputEventSpy +class OnScreenNotificationInputEventSpy : public InputEventSpy { public: explicit OnScreenNotificationInputEventSpy(OnScreenNotification *parent); @@ -228,3 +229,5 @@ void OnScreenNotification::setSkipCloseAnimation(bool skip) w->setProperty("KWIN_SKIP_CLOSE_ANIMATION", skip); } } + +} // namespace KWin diff --git a/screencast/pipewirestream.cpp b/screencast/pipewirestream.cpp index 386893f18..8c52fce32 100644 --- a/screencast/pipewirestream.cpp +++ b/screencast/pipewirestream.cpp @@ -355,7 +355,6 @@ void PipeWireStream::recordFrame(GLTexture *frameTexture, const QRegion &damaged painter.drawImage(QRect{position, cursor->image().size()}, cursor->image()); } } else { - using namespace KWin; auto &buf = m_dmabufDataForPwBuffer[buffer]; spa_data->chunk->stride = buf->stride(); diff --git a/tabletmodemanager.cpp b/tabletmodemanager.cpp index 1a6fe2441..04221ee16 100644 --- a/tabletmodemanager.cpp +++ b/tabletmodemanager.cpp @@ -16,7 +16,8 @@ #include #include -using namespace KWin; +namespace KWin +{ KWIN_SINGLETON_FACTORY_VARIABLE(TabletModeManager, s_manager) @@ -154,3 +155,5 @@ void KWin::TabletModeManager::setTabletModeAvailable(bool detecting) tabletModeAvailableChanged(detecting); } } + +} // namespace KWin