From kde-commits Fri Apr 30 21:48:18 2010 From: Matthieu Gallien Date: Fri, 30 Apr 2010 21:48:18 +0000 To: kde-commits Subject: KDE/kdebase/workspace/libs/taskmanager Message-Id: <20100430214818.C384CAC8AA () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=127266386732553 SVN commit 1121233 by mgallien: change the class TaskManager to listen to the updated signal from KWindowSystem that contains both NET::Property and NET::Property2 represented by an unsigned int pointer and update Task class When modifying the Task class, add a struct with two fields each for one set of NET properties as suggested by aseigo. This change fixes the detection of changes represented by the enum NET::Property2. M +17 -10 task.cpp M +18 -1 task.h M +2 -2 task_p.h M +9 -9 taskmanager.cpp M +1 -1 taskmanager.h --- trunk/KDE/kdebase/workspace/libs/taskmanager/task.cpp #1121232:1121233 @@ -59,10 +59,11 @@ void Task::timerEvent(QTimerEvent *) { - if (d->cachedChanges) { + if (d->cachedChanges.netWindowInfoProperties || d->cachedChanges.netWindowInfoProperties2) { d->lastUpdate = QTime(); refresh(d->cachedChanges); - d->cachedChanges = 0; + d->cachedChanges.netWindowInfoProperties = 0; + d->cachedChanges.netWindowInfoProperties2 = 0; } killTimer(d->cachedChangesTimerId); @@ -93,10 +94,11 @@ emit changed(IconChanged); } -::TaskManager::TaskChanges Task::refresh(unsigned int dirty) +::TaskManager::TaskChanges Task::refresh(WindowProperties dirty) { if (!d->lastUpdate.isNull() && d->lastUpdate.elapsed() < 200) { - d->cachedChanges |= dirty; + d->cachedChanges.netWindowInfoProperties |= dirty.netWindowInfoProperties; + d->cachedChanges.netWindowInfoProperties2 |= dirty.netWindowInfoProperties2; if (!d->cachedChangesTimerId) { d->cachedChangesTimerId = startTimer(200 - d->lastUpdate.elapsed()); @@ -117,27 +119,27 @@ d->info = info; - if (dirty & NET::WMState || dirty & NET::XAWMState) { + if (dirty.netWindowInfoProperties & NET::WMState || dirty.netWindowInfoProperties & NET::XAWMState) { changes |= StateChanged; } - if (dirty & NET::WMDesktop) { + if (dirty.netWindowInfoProperties & NET::WMDesktop) { changes |= DesktopChanged; } - if (dirty & NET::WMGeometry) { + if (dirty.netWindowInfoProperties & NET::WMGeometry) { changes |= GeometryChanged; } - if (dirty & NET::WMWindowType) { + if (dirty.netWindowInfoProperties & NET::WMWindowType) { changes |= WindowTypeChanged; } - if (dirty & NET::WM2AllowedActions) { + if (dirty.netWindowInfoProperties2 & NET::WM2AllowedActions) { changes |= ActionsChanged; } - if (dirty & NET::WMIcon) { + if (dirty.netWindowInfoProperties & NET::WMIcon) { refreshIcon(); } @@ -632,6 +634,11 @@ return id; } +Task::WindowProperties::WindowProperties(unsigned int netWinInfoProperties, unsigned int netWinInfoProperties2) + : netWindowInfoProperties(netWinInfoProperties), netWindowInfoProperties2(netWinInfoProperties2) +{ +} + } // TaskManager namespace #include "task.moc" --- trunk/KDE/kdebase/workspace/libs/taskmanager/task.h #1121232:1121233 @@ -70,6 +70,23 @@ Q_PROPERTY( int desktop READ desktop ) public: + + /** + * Represents all the informations reported by KWindowSystem about the NET properties of the task + */ + struct WindowProperties { + /** + * This is corresponding to NET::Property enum reported properties. + */ + unsigned int netWindowInfoProperties; + /** + * This is corresponding to NET::Property2 enum reported properties. + */ + unsigned int netWindowInfoProperties2; + + WindowProperties(unsigned int netWinInfoProperties, unsigned int netWinInfoProperties2); + }; + Task(WId win, QObject *parent, const char *name = 0); virtual ~Task(); @@ -235,7 +252,7 @@ // internal //* @internal - ::TaskManager::TaskChanges refresh(unsigned int dirty); + ::TaskManager::TaskChanges refresh(WindowProperties dirty); //* @internal #ifdef Q_WS_X11 void addTransient( WId w, const NETWinInfo& info ); --- trunk/KDE/kdebase/workspace/libs/taskmanager/task_p.h #1121232:1121233 @@ -47,7 +47,7 @@ info(KWindowSystem::windowInfo(w, windowInfoFlags, windowInfoFlags2)), lastWidth(0), lastHeight(0), - cachedChanges(0), + cachedChanges(0, 0), cachedChangesTimerId(0), active(false), lastResize(false) @@ -67,7 +67,7 @@ QRect iconGeometry; QTime lastUpdate; - unsigned int cachedChanges; + Task::WindowProperties cachedChanges; int cachedChangesTimerId; QPixmap pixmap; QPixmap lastIcon; --- trunk/KDE/kdebase/workspace/libs/taskmanager/taskmanager.cpp #1121232:1121233 @@ -116,8 +116,8 @@ this, SLOT(activeWindowChanged(WId))); connect(KWindowSystem::self(), SIGNAL(currentDesktopChanged(int)), this, SLOT(currentDesktopChanged(int))); - connect(KWindowSystem::self(), SIGNAL(windowChanged(WId,unsigned int)), - this, SLOT(windowChanged(WId,unsigned int))); + connect(KWindowSystem::self(), SIGNAL(windowChanged(WId,unsigned int*)), + this, SLOT(windowChanged(WId,unsigned int*))); if (QCoreApplication::instance()) { connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), this, SLOT(onAppExitCleanup())); } @@ -323,10 +323,10 @@ } } -void TaskManager::windowChanged(WId w, unsigned int dirty) +void TaskManager::windowChanged(WId w, unsigned int *dirty) { #ifdef Q_WS_X11 - if (dirty & NET::WMState) { + if (dirty[NETWinInfo::PROTOCOLS] & NET::WMState) { NETWinInfo info (QX11Info::display(), w, QX11Info::appRootWindow(), NET::WMState | NET::XAWMState); @@ -346,10 +346,10 @@ #endif // check if any state we are interested in is marked dirty - if (!(dirty & (NET::WMVisibleName | NET::WMName | + if (!(dirty[NETWinInfo::PROTOCOLS] & (NET::WMVisibleName | NET::WMName | NET::WMState | NET::WMIcon | NET::XAWMState | NET::WMDesktop) || - (trackGeometry() && dirty & NET::WMGeometry))) { + (trackGeometry() && dirty[NETWinInfo::PROTOCOLS] & NET::WMGeometry))) { return; } @@ -361,14 +361,14 @@ //kDebug() << "TaskManager::windowChanged " << w << " " << dirty; - if (dirty & NET::WMState) { + if (dirty[NETWinInfo::PROTOCOLS] & NET::WMState) { t->updateDemandsAttentionState(w); } //kDebug() << "got changes, but will we refresh?" << dirty; - if (dirty) { + if (dirty[NETWinInfo::PROTOCOLS] || dirty[NETWinInfo::PROTOCOLS2]) { // only refresh this stuff if we have other changes besides icons - t->refresh(dirty); + t->refresh(Task::WindowProperties(dirty[NETWinInfo::PROTOCOLS], dirty[NETWinInfo::PROTOCOLS2])); } } --- trunk/KDE/kdebase/workspace/libs/taskmanager/taskmanager.h #1121232:1121233 @@ -186,7 +186,7 @@ //* @internal void windowRemoved(WId); //* @internal - void windowChanged(WId, unsigned int); + void windowChanged(WId, unsigned int*); //* @internal void activeWindowChanged(WId);