From 391b7e023e7b8700e6c2011ecf50c59a6552e466 Mon Sep 17 00:00:00 2001 From: Kevin Ottens Date: Fri, 5 Mar 2021 09:34:04 +0100 Subject: [PATCH] Receive the activity list as a const reference This is mainly to make that coherent with common coding style in other places. --- src/abstract_client.cpp | 2 +- src/abstract_client.h | 2 +- src/x11client.cpp | 18 +++++++++--------- src/x11client.h | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/abstract_client.cpp b/src/abstract_client.cpp index 3c24a1dc37..628c0315c0 100644 --- a/src/abstract_client.cpp +++ b/src/abstract_client.cpp @@ -2789,7 +2789,7 @@ void AbstractClient::evaluateWindowRules() applyWindowRules(); } -void AbstractClient::setOnActivities(QStringList newActivitiesList) +void AbstractClient::setOnActivities(const QStringList &newActivitiesList) { Q_UNUSED(newActivitiesList) } diff --git a/src/abstract_client.h b/src/abstract_client.h index 126d20441b..f3dd378e49 100644 --- a/src/abstract_client.h +++ b/src/abstract_client.h @@ -537,7 +537,7 @@ public: virtual bool userCanSetFullScreen() const; virtual bool userCanSetNoBorder() const; virtual void checkNoBorder(); - virtual void setOnActivities(QStringList newActivitiesList); + virtual void setOnActivities(const QStringList &newActivitiesList); virtual void setOnAllActivities(bool set) = 0; const WindowRules* rules() const { return &m_rules; diff --git a/src/x11client.cpp b/src/x11client.cpp index 6b88a29deb..3a78d1ef1c 100644 --- a/src/x11client.cpp +++ b/src/x11client.cpp @@ -1911,37 +1911,37 @@ void X11Client::setOnActivity(const QString &activity, bool enable) /** * set exactly which activities this client is on */ -void X11Client::setOnActivities(QStringList newActivitiesList) +void X11Client::setOnActivities(const QStringList &newActivitiesList) { #ifdef KWIN_BUILD_ACTIVITIES if (!Activities::self()) { return; } - newActivitiesList = rules()->checkActivity(newActivitiesList); + auto activitiesList = rules()->checkActivity(newActivitiesList); QStringList allActivities = Activities::self()->all(); - auto it = newActivitiesList.begin(); - while (it != newActivitiesList.end()) { + auto it = activitiesList.begin(); + while (it != activitiesList.end()) { if (! allActivities.contains(*it)) { - it = newActivitiesList.erase(it); + it = activitiesList.erase(it); } else { it++; } } if (// If we got the request to be on all activities explicitly - newActivitiesList.isEmpty() || newActivitiesList.contains(Activities::nullUuid()) || + activitiesList.isEmpty() || activitiesList.contains(Activities::nullUuid()) || // If we got a list of activities that covers all activities - (newActivitiesList.count() > 1 && newActivitiesList.count() == allActivities.count())) { + (activitiesList.count() > 1 && activitiesList.count() == allActivities.count())) { activityList.clear(); const QByteArray nullUuid = Activities::nullUuid().toUtf8(); m_client.changeProperty(atoms->activities, XCB_ATOM_STRING, 8, nullUuid.length(), nullUuid.constData()); } else { - QByteArray joined = newActivitiesList.join(QStringLiteral(",")).toLatin1(); - activityList = newActivitiesList; + QByteArray joined = activitiesList.join(QStringLiteral(",")).toLatin1(); + activityList = activitiesList; m_client.changeProperty(atoms->activities, XCB_ATOM_STRING, 8, joined.length(), joined.constData()); } diff --git a/src/x11client.h b/src/x11client.h index 70f2b2ba7a..dfca76d4a2 100644 --- a/src/x11client.h +++ b/src/x11client.h @@ -124,7 +124,7 @@ public: QStringList activities() const override; void setOnActivity(const QString &activity, bool enable); void setOnAllActivities(bool set) override; - void setOnActivities(QStringList newActivitiesList) override; + void setOnActivities(const QStringList &newActivitiesList) override; void updateActivities(bool includeTransients); void blockActivityUpdates(bool b = true) override;