Commit 533be1aa authored by David Edmundson's avatar David Edmundson Committed by Vlad Zahorodnii
Browse files

[x11window] Remove duplicate activities check

We check if activities are valid in Window::setActivities. We don't need
to do it when we read the X11 properties.


(cherry picked from commit 3649ec47)
parent d4713767
Pipeline #238644 passed with stage
in 27 minutes and 10 seconds
......@@ -2473,7 +2473,6 @@ Xcb::StringProperty X11Window::fetchActivities() const
void X11Window::readActivities(Xcb::StringProperty &property)
{
#if KWIN_BUILD_ACTIVITIES
QStringList newActivitiesList;
QString prop = QString::fromUtf8(property);
activitiesDefined = !prop.isEmpty();
......@@ -2494,31 +2493,12 @@ void X11Window::readActivities(Xcb::StringProperty &property)
return;
}
newActivitiesList = prop.split(u',');
const QStringList newActivitiesList = prop.split(u',');
if (newActivitiesList == m_activityList) {
return; // expected change, it's ok.
}
// otherwise, somebody else changed it. we need to validate before reacting.
// if the activities are not synced, and there are existing clients with
// activities specified, somebody has restarted kwin. we can not validate
// activities in this case. we need to trust the old values.
if (Workspace::self()->activities() && Workspace::self()->activities()->serviceStatus() != KActivities::Consumer::Unknown) {
QStringList allActivities = Workspace::self()->activities()->all();
if (allActivities.isEmpty()) {
qCDebug(KWIN_CORE) << "no activities!?!?";
// don't touch anything, there's probably something bad going on and we don't wanna make it worse
return;
}
for (int i = 0; i < newActivitiesList.size(); ++i) {
if (!allActivities.contains(newActivitiesList.at(i))) {
qCDebug(KWIN_CORE) << "invalid:" << newActivitiesList.at(i);
newActivitiesList.removeAt(i--);
}
}
}
setOnActivities(newActivitiesList);
#else
Q_UNUSED(property)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment