From 14659a9907ce868af6dc39e39cecc120797e7a2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 15 Jan 2015 16:31:20 +0100 Subject: [PATCH] Split Client::checkActivities into two parts REVIEW: 122087 CCBUG: 329979 --- client.cpp | 23 +++++++++++++++++++++-- client.h | 2 ++ manage.cpp | 3 ++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/client.cpp b/client.cpp index 8805b388e8..1fc719896d 100644 --- a/client.cpp +++ b/client.cpp @@ -2230,11 +2230,20 @@ void Client::debug(QDebug& stream) const print(stream); } -void Client::checkActivities() +Xcb::StringProperty Client::fetchActivities() const +{ +#ifdef KWIN_BUILD_ACTIVITIES + return Xcb::StringProperty(window(), atoms->activities); +#else + return Xcb::StringProperty(); +#endif +} + +void Client::readActivities(Xcb::StringProperty &property) { #ifdef KWIN_BUILD_ACTIVITIES QStringList newActivitiesList; - QByteArray prop = Xcb::StringProperty(window(), atoms->activities); + QByteArray prop = property; activitiesDefined = !prop.isEmpty(); if (QString::fromUtf8(prop) == Activities::nullUuid()) { //copied from setOnAllActivities to avoid a redundant XChangeProperty. @@ -2272,6 +2281,16 @@ void Client::checkActivities() } } setOnActivities(newActivitiesList); +#else + Q_UNUSED(property) +#endif +} + +void Client::checkActivities() +{ +#ifdef KWIN_BUILD_ACTIVITIES + Xcb::StringProperty property = fetchActivities(); + readActivities(property); #endif } diff --git a/client.h b/client.h index a66a013579..90d32279e6 100644 --- a/client.h +++ b/client.h @@ -1036,6 +1036,8 @@ private: friend bool performTransiencyCheck(); + Xcb::StringProperty fetchActivities() const; + void readActivities(Xcb::StringProperty &property); void checkActivities(); bool activitiesDefined; //whether the x property was actually set diff --git a/manage.cpp b/manage.cpp index a7da4029bc..9c5b054399 100644 --- a/manage.cpp +++ b/manage.cpp @@ -104,6 +104,7 @@ bool Client::manage(xcb_window_t w, bool isMapped) auto colorSchemeCookie = fetchColorScheme(); auto firstInTabBoxCookie = fetchFirstInTabBox(); auto transientCookie = fetchTransient(); + auto activitiesCookie = fetchActivities(); info = new WinInfo(this, m_client, rootWindow(), properties, properties2); // If it's already mapped, ignore hint @@ -170,7 +171,7 @@ bool Client::manage(xcb_window_t w, bool isMapped) init_minimize = rules()->checkMinimize(init_minimize, !isMapped); noborder = rules()->checkNoBorder(noborder, !isMapped); - checkActivities(); + readActivities(activitiesCookie); // Initial desktop placement if (session) {