From bd6d04b417161f1b5864f08ec1295f35163078d1 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 26 Aug 2021 09:34:39 +0300 Subject: [PATCH] x11: Pass the output name to X11Output constructor The output name is static, i.e. it cannot change, so there's no point for having a setter. --- src/plugins/platforms/x11/standalone/x11_output.cpp | 8 ++------ src/plugins/platforms/x11/standalone/x11_output.h | 4 +--- src/plugins/platforms/x11/standalone/x11_platform.cpp | 3 +-- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/plugins/platforms/x11/standalone/x11_output.cpp b/src/plugins/platforms/x11/standalone/x11_output.cpp index 6cf5ef30b1..2640a074f4 100644 --- a/src/plugins/platforms/x11/standalone/x11_output.cpp +++ b/src/plugins/platforms/x11/standalone/x11_output.cpp @@ -12,8 +12,9 @@ namespace KWin { -X11Output::X11Output(QObject *parent) +X11Output::X11Output(const QString &name, QObject *parent) : AbstractOutput(parent) + , m_name(name) { } @@ -22,11 +23,6 @@ QString X11Output::name() const return m_name; } -void X11Output::setName(QString set) -{ - m_name = set; -} - QRect X11Output::geometry() const { if (m_geometry.isValid()) { diff --git a/src/plugins/platforms/x11/standalone/x11_output.h b/src/plugins/platforms/x11/standalone/x11_output.h index 71b264075e..935f341327 100644 --- a/src/plugins/platforms/x11/standalone/x11_output.h +++ b/src/plugins/platforms/x11/standalone/x11_output.h @@ -28,11 +28,9 @@ class KWIN_EXPORT X11Output : public AbstractOutput Q_OBJECT public: - explicit X11Output(QObject *parent = nullptr); - ~X11Output() override = default; + explicit X11Output(const QString &name, QObject *parent = nullptr); QString name() const override; - void setName(QString set); QRect geometry() const override; void setGeometry(QRect set); diff --git a/src/plugins/platforms/x11/standalone/x11_platform.cpp b/src/plugins/platforms/x11/standalone/x11_platform.cpp index 1a772e6df2..6738bbaf32 100644 --- a/src/plugins/platforms/x11/standalone/x11_platform.cpp +++ b/src/plugins/platforms/x11/standalone/x11_platform.cpp @@ -520,8 +520,7 @@ void X11StandalonePlatform::doUpdateOutputs() changed.append(output); removed.removeOne(output); } else { - output = new X11Output(); - output->setName(outputInfo.name()); + output = new X11Output(outputInfo.name()); added.append(output); }