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.
master
Vlad Zahorodnii 2020-08-21 13:32:04 +03:00
parent 571ca776c3
commit 0dda9dc7d0
12 changed files with 47 additions and 20 deletions

View File

@ -19,7 +19,8 @@
#include "decorations/decorationbridge.h" #include "decorations/decorationbridge.h"
#include <KDecoration2/DecorationSettings> #include <KDecoration2/DecorationSettings>
using namespace KWin; namespace KWin
{
KWIN_SINGLETON_FACTORY(ApplicationMenu) KWIN_SINGLETON_FACTORY(ApplicationMenu)
@ -118,3 +119,5 @@ AbstractClient *ApplicationMenu::findAbstractClientWithApplicationMenu(const QSt
&& c->applicationMenuObjectPath() == menuObjectPath.path(); && c->applicationMenuObjectPath() == menuObjectPath.path();
}); });
} }
} // namespace KWin

View File

@ -9,7 +9,8 @@
#include "kwineglimagetexture.h" #include "kwineglimagetexture.h"
#include "kwinglutils.h" #include "kwinglutils.h"
using namespace KWin; namespace KWin
{
DmaBufTexture::DmaBufTexture(KWin::GLTexture *texture) DmaBufTexture::DmaBufTexture(KWin::GLTexture *texture)
: m_texture(texture) : m_texture(texture)
@ -24,3 +25,4 @@ KWin::GLRenderTarget *DmaBufTexture::framebuffer() const
return m_framebuffer.data(); return m_framebuffer.data();
} }
} // namespace KWin

View File

@ -17,8 +17,8 @@
#include <cmath> #include <cmath>
using namespace KWin; namespace KWin
{
ContrastShader::ContrastShader() ContrastShader::ContrastShader()
: mValid(false), shader(nullptr), m_opacity(1) : mValid(false), shader(nullptr), m_opacity(1)
@ -195,3 +195,4 @@ void ContrastShader::init()
setIsValid(shader->isValid()); setIsValid(shader->isValid());
} }
} // namespace KWin

View File

@ -19,7 +19,8 @@
#include <KGlobalAccel> #include <KGlobalAccel>
#include <KLocalizedString> #include <KLocalizedString>
using namespace KWin; namespace KWin
{
WindowGeometry::WindowGeometry() WindowGeometry::WindowGeometry()
{ {
@ -224,3 +225,5 @@ bool WindowGeometry::isActive() const
{ {
return iAmActive; return iAmActive;
} }
} // namespace KWin

View File

@ -18,9 +18,11 @@
#include <KWaylandServer/surface_interface.h> #include <KWaylandServer/surface_interface.h>
#include <KWaylandServer/textinput_interface.h> #include <KWaylandServer/textinput_interface.h>
using namespace KWin;
using namespace KWaylandServer; using namespace KWaylandServer;
namespace KWin
{
InputPanelV1Client::InputPanelV1Client(InputPanelSurfaceV1Interface *panelSurface) InputPanelV1Client::InputPanelV1Client(InputPanelSurfaceV1Interface *panelSurface)
: WaylandClient(panelSurface->surface()) : WaylandClient(panelSurface->surface())
, m_panelSurface(panelSurface) , m_panelSurface(panelSurface)
@ -136,3 +138,5 @@ void InputPanelV1Client::setOutput(OutputInterface *outputIface)
connect(m_output, &AbstractWaylandOutput::geometryChanged, this, &InputPanelV1Client::reposition); connect(m_output, &AbstractWaylandOutput::geometryChanged, this, &InputPanelV1Client::reposition);
} }
} }
} // namespace KWin

View File

@ -12,14 +12,15 @@
#include "logging_p.h" #include "logging_p.h"
namespace KWin
{
QDebug operator<<(QDebug dbg, const KWin::AniData &a) QDebug operator<<(QDebug dbg, const KWin::AniData &a)
{ {
dbg.nospace() << a.debugInfo(); dbg.nospace() << a.debugInfo();
return dbg.space(); return dbg.space();
} }
using namespace KWin;
FullScreenEffectLock::FullScreenEffectLock(Effect *effect) FullScreenEffectLock::FullScreenEffectLock(Effect *effect)
{ {
effects->setActiveFullScreenEffect(effect); effects->setActiveFullScreenEffect(effect);
@ -120,3 +121,5 @@ QString AniData::debugInfo() const
QLatin1String( " Duration: ") + QString::number(timeLine.duration().count()) + QLatin1String("ms\n") + QLatin1String( " Duration: ") + QString::number(timeLine.duration().count()) + QLatin1String("ms\n") +
QLatin1String( " Passed: ") + QString::number(timeLine.elapsed().count()) + QLatin1String("ms\n"); QLatin1String( " Passed: ") + QString::number(timeLine.elapsed().count()) + QLatin1String("ms\n");
} }
} // namespace KWin

View File

@ -16,14 +16,15 @@
#include <QtDebug> #include <QtDebug>
#include <QVector3D> #include <QVector3D>
namespace KWin
{
QDebug operator<<(QDebug dbg, const KWin::FPx2 &fpx2) QDebug operator<<(QDebug dbg, const KWin::FPx2 &fpx2)
{ {
dbg.nospace() << fpx2[0] << "," << fpx2[1] << QString(fpx2.isValid() ? QStringLiteral(" (valid)") : QStringLiteral(" (invalid)")); dbg.nospace() << fpx2[0] << "," << fpx2[1] << QString(fpx2.isValid() ? QStringLiteral(" (valid)") : QStringLiteral(" (invalid)"));
return dbg.space(); return dbg.space();
} }
namespace KWin {
QElapsedTimer AnimationEffect::s_clock; QElapsedTimer AnimationEffect::s_clock;
class AnimationEffectPrivate { class AnimationEffectPrivate {
@ -39,9 +40,6 @@ public:
QWeakPointer<FullScreenEffectLock> m_fullScreenEffectLock; QWeakPointer<FullScreenEffectLock> m_fullScreenEffectLock;
bool m_animated, m_damageDirty, m_needSceneRepaint, m_animationsTouched, m_isInitialized; bool m_animated, m_damageDirty, m_needSceneRepaint, m_animationsTouched, m_isInitialized;
}; };
}
using namespace KWin;
quint64 AnimationEffectPrivate::m_animCounter = 0; quint64 AnimationEffectPrivate::m_animCounter = 0;
@ -1043,4 +1041,6 @@ AnimationEffect::AniMap AnimationEffect::state() const
return d->m_animations; return d->m_animations;
} }
} // namespace KWin
#include "moc_kwinanimationeffect.cpp" #include "moc_kwinanimationeffect.cpp"

View File

@ -28,7 +28,8 @@
#include <KDeclarative/QmlObjectSharedEngine> #include <KDeclarative/QmlObjectSharedEngine>
using namespace KWin; namespace KWin
{
static std::unique_ptr<QOpenGLContext> s_shareContext; static std::unique_ptr<QOpenGLContext> s_shareContext;
@ -375,3 +376,5 @@ QQuickItem *EffectQuickScene::rootItem() const
{ {
return qobject_cast<QQuickItem *>(d->qmlObject->rootObject()); return qobject_cast<QQuickItem *>(d->qmlObject->rootObject());
} }
} // namespace KWin

View File

@ -9,11 +9,12 @@
#include "kwineglimagetexture.h" #include "kwineglimagetexture.h"
using namespace KWin;
#include <QDebug> #include <QDebug>
#include <epoxy/egl.h> #include <epoxy/egl.h>
namespace KWin
{
EGLImageTexture::EGLImageTexture(EGLDisplay display, EGLImage image, int internalFormat, const QSize &size) EGLImageTexture::EGLImageTexture(EGLDisplay display, EGLImage image, int internalFormat, const QSize &size)
: GLTexture(internalFormat, size, 1, true) : GLTexture(internalFormat, size, 1, true)
, m_image(image) , m_image(image)
@ -31,3 +32,5 @@ EGLImageTexture::~EGLImageTexture()
{ {
eglDestroyImageKHR(m_display, m_image); eglDestroyImageKHR(m_display, m_image);
} }
} // namespace KWin

View File

@ -23,9 +23,10 @@
#include <functional> #include <functional>
using namespace KWin; namespace KWin
{
class KWin::OnScreenNotificationInputEventSpy : public InputEventSpy class OnScreenNotificationInputEventSpy : public InputEventSpy
{ {
public: public:
explicit OnScreenNotificationInputEventSpy(OnScreenNotification *parent); explicit OnScreenNotificationInputEventSpy(OnScreenNotification *parent);
@ -228,3 +229,5 @@ void OnScreenNotification::setSkipCloseAnimation(bool skip)
w->setProperty("KWIN_SKIP_CLOSE_ANIMATION", skip); w->setProperty("KWIN_SKIP_CLOSE_ANIMATION", skip);
} }
} }
} // namespace KWin

View File

@ -355,7 +355,6 @@ void PipeWireStream::recordFrame(GLTexture *frameTexture, const QRegion &damaged
painter.drawImage(QRect{position, cursor->image().size()}, cursor->image()); painter.drawImage(QRect{position, cursor->image().size()}, cursor->image());
} }
} else { } else {
using namespace KWin;
auto &buf = m_dmabufDataForPwBuffer[buffer]; auto &buf = m_dmabufDataForPwBuffer[buffer];
spa_data->chunk->stride = buf->stride(); spa_data->chunk->stride = buf->stride();

View File

@ -16,7 +16,8 @@
#include <QTimer> #include <QTimer>
#include <QDBusConnection> #include <QDBusConnection>
using namespace KWin; namespace KWin
{
KWIN_SINGLETON_FACTORY_VARIABLE(TabletModeManager, s_manager) KWIN_SINGLETON_FACTORY_VARIABLE(TabletModeManager, s_manager)
@ -154,3 +155,5 @@ void KWin::TabletModeManager::setTabletModeAvailable(bool detecting)
tabletModeAvailableChanged(detecting); tabletModeAvailableChanged(detecting);
} }
} }
} // namespace KWin