commit 00b03781b8106cc9d079d133373af88b23522fc1 Author: Aaron Seigo Date: Thu Aug 11 16:53:36 2011 +0200 if we are supposd to skip a task .. still check for startup items. this should prevent the ghost-in-the-taskbar bugs diff --git a/libs/taskmanager/groupmanager.cpp b/libs/taskmanager/groupmanager.cpp index 4d8e4d9..854db2e 100644 --- a/libs/taskmanager/groupmanager.cpp +++ b/libs/taskmanager/groupmanager.cpp @@ -233,14 +233,15 @@ bool GroupManagerPrivate::addTask(TaskPtr task) << task->className() << task->classClass(); */ + bool skip = false; if (!task->showInTaskbar()) { //kDebug() << "Do not show in taskbar"; - return false; + skip = true; } if (showOnlyCurrentScreen && !task->isOnScreen(currentScreen)) { //kDebug() << "Not on this screen and showOnlyCurrentScreen"; - return false; + skip = true; } // Should the Task be displayed ? We always display if attention is demaded @@ -250,25 +251,25 @@ bool GroupManagerPrivate::addTask(TaskPtr task) if (showOnlyCurrentDesktop && !task->isOnCurrentDesktop()) { /* kDebug() << "Not on this desktop and showOnlyCurrentDesktop" << KWindowSystem::currentDesktop() << task->desktop(); */ - return false; + skip = true; } if (showOnlyCurrentActivity && !task->isOnCurrentActivity()) { /* kDebug() << "Not on this desktop and showOnlyCurrentActivity" << KWindowSystem::currentActivity() << task->desktop(); */ - return false; + skip = true; } if (showOnlyMinimized && !task->isMinimized()) { //kDebug() << "Not minimized and only showing minimized"; - return false; + skip = true; } NET::WindowType type = task->info().windowType(NET::NormalMask | NET::DialogMask | NET::OverrideMask | NET::UtilityMask); if (type == NET::Utility) { //kDebug() << "skipping utility window" << task->name(); - return false; + skip = true; } //TODO: should we check for transiency? if so the following code can detect it. @@ -288,14 +289,14 @@ bool GroupManagerPrivate::addTask(TaskPtr task) //Ok the Task should be displayed TaskItem *item = qobject_cast(currentRootGroup()->getMemberByWId(task->window())); - if (!item) { - // first search for an existing startuptask for this task + if (!item || skip) { + TaskItem *startupItem = 0; QHash::iterator it = startupList.begin(); QHash::iterator itEnd = startupList.end(); while (it != itEnd) { if (it.key()->matchesWindow(task->window())) { //kDebug() << "startup task found"; - item = it.value(); + item = startupItem = it.value(); startupList.erase(it); QObject::disconnect(item, 0, q, 0); item->setTaskPointer(task); @@ -304,6 +305,12 @@ bool GroupManagerPrivate::addTask(TaskPtr task) ++it; } + // if we are to skip because we don't display, we simply delete the startup related to it + if (skip) { + delete startupItem; + return false; + } + if (!item) { item = new TaskItem(q, task); } @@ -324,7 +331,6 @@ bool GroupManagerPrivate::addTask(TaskPtr task) } geometryTasks.insert(task.data()); - return true; }