void TaskManager::windowAdded(WId w ) { NETWinInfo info (qt_xdisplay(), w, qt_xrootwin(), NET::WMWindowType | NET::WMPid | NET::WMState ); // ignore NET::Tool and other special window types if (info.windowType() != NET::Normal && info.windowType() != NET::Override && info.windowType() != NET::Unknown && info.windowType() != NET::Dialog) return; // ignore windows that want to be ignored by the taskbar if ((info.state() & NET::SkipTaskbar) != 0) { _skiptaskbar_windows.push_front( w ); // remember them though return; } Window transient_for_tmp; if (XGetTransientForHint( qt_xdisplay(), (Window) w, &transient_for_tmp )) { WId transient_for = (WId) transient_for_tmp; // check if it's transient for a skiptaskbar window if( _skiptaskbar_windows.contains( transient_for )) return; // lets see if this is a transient for an existing task if( transient_for != qt_xrootwin() && transient_for != 0 ) { Task* t = findTask(transient_for); if (t) { if (t->window() != w) { t->addTransient(w); // kdDebug() << "TM: Transient " << w << " added for Task: " << t->window() << endl; } return; } } } Task* t = new Task(w, this); _tasks.append(t); // kdDebug() << "TM: Task added for WId: " << w << endl; emit taskAdded(t); }
void TaskManager::windowChanged(WId w, unsigned int dirty) { if( dirty & NET::WMState ) { NETWinInfo info ( qt_xdisplay(), w, qt_xrootwin(), NET::WMState ); if ( (info.state() & NET::SkipTaskbar) != 0 ) { windowRemoved( w ); _skiptaskbar_windows.push_front( w ); return; } else { _skiptaskbar_windows.remove( w ); if( !findTask( w )) windowAdded( w ); // skipTaskBar state was removed, so add this window } } // check if any state we are interested in is marked dirty if(!(dirty & (NET::WMVisibleName|NET::WMName|NET::WMState|NET::WMIcon|NET::XAWMState|NET::WMDesktop)) ) return; // find task Task* t = findTask( w ); if (!t) return; //kdDebug() << "TaskManager::windowChanged " << w << " " << dirty << endl; // refresh icon pixmap if necessary if (dirty & NET::WMIcon) t->refresh(true); else t->refresh(); if(dirty & (NET::WMDesktop|NET::WMState|NET::XAWMState)) emit windowChanged(w); // moved to different desktop or is on all or change in iconification/withdrawnnes }