Changeset View
Changeset View
Standalone View
Standalone View
libtaskmanager/xwindowtasksmodel.cpp
Show All 15 Lines | |||||
16 | Lesser General Public License for more details. | 16 | Lesser General Public License for more details. | ||
17 | 17 | | |||
18 | You should have received a copy of the GNU Lesser General Public | 18 | You should have received a copy of the GNU Lesser General Public | ||
19 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | 19 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
20 | *********************************************************************/ | 20 | *********************************************************************/ | ||
21 | 21 | | |||
22 | #include "xwindowtasksmodel.h" | 22 | #include "xwindowtasksmodel.h" | ||
23 | #include "tasktools.h" | 23 | #include "tasktools.h" | ||
24 | #include "xwindowsystemeventbatcher.h" | ||||
24 | 25 | | |||
25 | #include <KActivities/ResourceInstance> | 26 | #include <KActivities/ResourceInstance> | ||
26 | #include <KDesktopFile> | 27 | #include <KDesktopFile> | ||
27 | #include <KDirWatch> | 28 | #include <KDirWatch> | ||
28 | #include <KIconLoader> | 29 | #include <KIconLoader> | ||
29 | #include <KRun> | 30 | #include <KRun> | ||
30 | #include <KService> | 31 | #include <KService> | ||
31 | #include <KSharedConfig> | 32 | #include <KSharedConfig> | ||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Line(s) | 144 | auto rulesConfigChange = [this, clearCacheAndRefresh] { | |||
144 | rulesConfig->reparseConfiguration(); | 145 | rulesConfig->reparseConfiguration(); | ||
145 | clearCacheAndRefresh(); | 146 | clearCacheAndRefresh(); | ||
146 | }; | 147 | }; | ||
147 | 148 | | |||
148 | QObject::connect(configWatcher, &KDirWatch::dirty, rulesConfigChange); | 149 | QObject::connect(configWatcher, &KDirWatch::dirty, rulesConfigChange); | ||
149 | QObject::connect(configWatcher, &KDirWatch::created, rulesConfigChange); | 150 | QObject::connect(configWatcher, &KDirWatch::created, rulesConfigChange); | ||
150 | QObject::connect(configWatcher, &KDirWatch::deleted, rulesConfigChange); | 151 | QObject::connect(configWatcher, &KDirWatch::deleted, rulesConfigChange); | ||
151 | 152 | | |||
152 | QObject::connect(KWindowSystem::self(), &KWindowSystem::windowAdded, q, | 153 | auto windowSystem = new XWindowSystemEventBatcher(q); | ||
154 | | ||||
155 | QObject::connect(windowSystem, &XWindowSystemEventBatcher::windowAdded, q, | ||||
153 | [this](WId window) { | 156 | [this](WId window) { | ||
154 | addWindow(window); | 157 | addWindow(window); | ||
155 | } | 158 | } | ||
156 | ); | 159 | ); | ||
157 | 160 | | |||
158 | QObject::connect(KWindowSystem::self(), &KWindowSystem::windowRemoved, q, | 161 | QObject::connect(windowSystem, &XWindowSystemEventBatcher::windowRemoved, q, | ||
159 | [this](WId window) { | 162 | [this](WId window) { | ||
160 | removeWindow(window); | 163 | removeWindow(window); | ||
161 | } | 164 | } | ||
162 | ); | 165 | ); | ||
163 | 166 | | |||
164 | void (KWindowSystem::*myWindowChangeSignal)(WId window, | 167 | QObject::connect(windowSystem, &XWindowSystemEventBatcher::windowChanged, q, | ||
165 | NET::Properties properties, NET::Properties2 properties2) = &KWindowSystem::windowChanged; | | |||
166 | QObject::connect(KWindowSystem::self(), myWindowChangeSignal, q, | | |||
167 | [this](WId window, NET::Properties properties, NET::Properties2 properties2) { | 168 | [this](WId window, NET::Properties properties, NET::Properties2 properties2) { | ||
168 | windowChanged(window, properties, properties2); | 169 | windowChanged(window, properties, properties2); | ||
169 | } | 170 | } | ||
170 | ); | 171 | ); | ||
171 | 172 | | |||
172 | // Update IsActive for previously- and newly-active windows. | 173 | // Update IsActive for previously- and newly-active windows. | ||
173 | QObject::connect(KWindowSystem::self(), &KWindowSystem::activeWindowChanged, q, | 174 | QObject::connect(KWindowSystem::self(), &KWindowSystem::activeWindowChanged, q, | ||
174 | [this](WId window) { | 175 | [this](WId window) { | ||
▲ Show 20 Lines • Show All 892 Lines • Show Last 20 Lines |