Add Activities::nullUuid() to replace define in client.cpp

REVIEW: 109853
This commit is contained in:
Martin Gräßlin 2013-04-10 09:46:07 +02:00
parent da85b5fdc7
commit bac6edb269
2 changed files with 12 additions and 8 deletions

View file

@ -56,6 +56,7 @@ public:
static Activities *self();
static Activities *create(QObject *parent);
static QString nullUuid();
Q_SIGNALS:
/**
@ -124,6 +125,13 @@ const QStringList &Activities::running() const
return m_running;
}
inline
QString Activities::nullUuid()
{
// cloned from kactivities/src/lib/core/consumer.cpp
return QString("00000000-0000-0000-0000-000000000000");
}
}
#endif // KWIN_ACTIVITIES_H

View file

@ -1535,8 +1535,6 @@ void Client::setOnActivity(const QString &activity, bool enable)
/**
* set exactly which activities this client is on
*/
// cloned from kactivities/src/lib/core/consumer.cpp
#define NULL_UUID "00000000-0000-0000-0000-000000000000"
void Client::setOnActivities(QStringList newActivitiesList)
{
#ifdef KWIN_BUILD_ACTIVITIES
@ -1547,10 +1545,11 @@ void Client::setOnActivities(QStringList newActivitiesList)
QStringList allActivities = Activities::self()->all();
if ( newActivitiesList.isEmpty() ||
(newActivitiesList.count() > 1 && newActivitiesList.count() == allActivities.count()) ||
(newActivitiesList.count() == 1 && newActivitiesList.at(0) == NULL_UUID)) {
(newActivitiesList.count() == 1 && newActivitiesList.at(0) == Activities::nullUuid())) {
activityList.clear();
const QByteArray nullUuid = Activities::nullUuid().toUtf8();
XChangeProperty(display(), window(), atoms->activities, XA_STRING, 8,
PropModeReplace, (const unsigned char *)NULL_UUID, 36);
PropModeReplace, (const unsigned char *)nullUuid.constData(), nullUuid.length());
} else {
QByteArray joined = joinedActivitiesList.toAscii();
@ -2400,7 +2399,7 @@ void Client::checkActivities()
QStringList newActivitiesList;
QByteArray prop = getStringProperty(window(), atoms->activities);
activitiesDefined = !prop.isEmpty();
if (prop == NULL_UUID) {
if (prop == Activities::nullUuid()) {
//copied from setOnAllActivities to avoid a redundant XChangeProperty.
if (!activityList.isEmpty()) {
activityList.clear();
@ -2439,9 +2438,6 @@ void Client::checkActivities()
#endif
}
#undef NULL_UUID
void Client::setSessionInteract(bool needed)
{
needsSessionInteract = needed;