From 3649ec474b5515ada8fcc125eb42219f9d9fd0ce Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 28 Sep 2022 15:00:49 +0100 Subject: [PATCH] [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. --- src/x11window.cpp | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/src/x11window.cpp b/src/x11window.cpp index 9cd83073a4..69e0bdcfa1 100644 --- a/src/x11window.cpp +++ b/src/x11window.cpp @@ -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)