Receive the activity list as a const reference
This is mainly to make that coherent with common coding style in other places.
This commit is contained in:
parent
0eb37563e9
commit
391b7e023e
4 changed files with 12 additions and 12 deletions
|
@ -2789,7 +2789,7 @@ void AbstractClient::evaluateWindowRules()
|
||||||
applyWindowRules();
|
applyWindowRules();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractClient::setOnActivities(QStringList newActivitiesList)
|
void AbstractClient::setOnActivities(const QStringList &newActivitiesList)
|
||||||
{
|
{
|
||||||
Q_UNUSED(newActivitiesList)
|
Q_UNUSED(newActivitiesList)
|
||||||
}
|
}
|
||||||
|
|
|
@ -537,7 +537,7 @@ public:
|
||||||
virtual bool userCanSetFullScreen() const;
|
virtual bool userCanSetFullScreen() const;
|
||||||
virtual bool userCanSetNoBorder() const;
|
virtual bool userCanSetNoBorder() const;
|
||||||
virtual void checkNoBorder();
|
virtual void checkNoBorder();
|
||||||
virtual void setOnActivities(QStringList newActivitiesList);
|
virtual void setOnActivities(const QStringList &newActivitiesList);
|
||||||
virtual void setOnAllActivities(bool set) = 0;
|
virtual void setOnAllActivities(bool set) = 0;
|
||||||
const WindowRules* rules() const {
|
const WindowRules* rules() const {
|
||||||
return &m_rules;
|
return &m_rules;
|
||||||
|
|
|
@ -1911,37 +1911,37 @@ void X11Client::setOnActivity(const QString &activity, bool enable)
|
||||||
/**
|
/**
|
||||||
* set exactly which activities this client is on
|
* set exactly which activities this client is on
|
||||||
*/
|
*/
|
||||||
void X11Client::setOnActivities(QStringList newActivitiesList)
|
void X11Client::setOnActivities(const QStringList &newActivitiesList)
|
||||||
{
|
{
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
#ifdef KWIN_BUILD_ACTIVITIES
|
||||||
if (!Activities::self()) {
|
if (!Activities::self()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
newActivitiesList = rules()->checkActivity(newActivitiesList);
|
auto activitiesList = rules()->checkActivity(newActivitiesList);
|
||||||
|
|
||||||
QStringList allActivities = Activities::self()->all();
|
QStringList allActivities = Activities::self()->all();
|
||||||
|
|
||||||
auto it = newActivitiesList.begin();
|
auto it = activitiesList.begin();
|
||||||
while (it != newActivitiesList.end()) {
|
while (it != activitiesList.end()) {
|
||||||
if (! allActivities.contains(*it)) {
|
if (! allActivities.contains(*it)) {
|
||||||
it = newActivitiesList.erase(it);
|
it = activitiesList.erase(it);
|
||||||
} else {
|
} else {
|
||||||
it++;
|
it++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (// If we got the request to be on all activities explicitly
|
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
|
// 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();
|
activityList.clear();
|
||||||
const QByteArray nullUuid = Activities::nullUuid().toUtf8();
|
const QByteArray nullUuid = Activities::nullUuid().toUtf8();
|
||||||
m_client.changeProperty(atoms->activities, XCB_ATOM_STRING, 8, nullUuid.length(), nullUuid.constData());
|
m_client.changeProperty(atoms->activities, XCB_ATOM_STRING, 8, nullUuid.length(), nullUuid.constData());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
QByteArray joined = newActivitiesList.join(QStringLiteral(",")).toLatin1();
|
QByteArray joined = activitiesList.join(QStringLiteral(",")).toLatin1();
|
||||||
activityList = newActivitiesList;
|
activityList = activitiesList;
|
||||||
m_client.changeProperty(atoms->activities, XCB_ATOM_STRING, 8, joined.length(), joined.constData());
|
m_client.changeProperty(atoms->activities, XCB_ATOM_STRING, 8, joined.length(), joined.constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ public:
|
||||||
QStringList activities() const override;
|
QStringList activities() const override;
|
||||||
void setOnActivity(const QString &activity, bool enable);
|
void setOnActivity(const QString &activity, bool enable);
|
||||||
void setOnAllActivities(bool set) override;
|
void setOnAllActivities(bool set) override;
|
||||||
void setOnActivities(QStringList newActivitiesList) override;
|
void setOnActivities(const QStringList &newActivitiesList) override;
|
||||||
void updateActivities(bool includeTransients);
|
void updateActivities(bool includeTransients);
|
||||||
void blockActivityUpdates(bool b = true) override;
|
void blockActivityUpdates(bool b = true) override;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue