25 #include "taskmanager.moc"
27 #include <QApplication>
32 #include <QDesktopWidget>
37 #include <KIconLoader>
38 #include <KConfigGroup>
40 #include <K3StaticDeleter>
41 #include <KWindowSystem>
43 #include <kiconloader.h>
47 uint TaskManager::m_xCompositeEnabled = 0;
57 TaskManager::TaskManager()
61 m_winModule(KWindowSystem::self()),
62 m_trackGeometry(false)
64 KGlobal::locale()->insertCatalog( QLatin1String(
"libtaskmanager" ));
77 const QList<WId> windows = m_winModule->windows();
78 QList<WId>::ConstIterator end(windows.end());
79 for (QList<WId>::ConstIterator it = windows.begin(); it != end; ++it) {
84 WId win = m_winModule->activeWindow();
91 KGlobal::locale()->removeCatalog(
"libtaskmanager");
96 KConfig config(
"klaunchrc");
97 KConfigGroup c(&config,
"FeedbackStyle");
98 if (!c.readEntry(
"TaskbarButton",
true))
100 _startup_info =
new KStartupInfo(KStartupInfo::CleanOnCantDetect,
this);
101 connect(_startup_info,
104 connect(_startup_info,
107 connect(_startup_info,
108 SIGNAL(gotRemoveStartup(KStartupInfoId,KStartupInfoData)),
110 c = KConfigGroup(&config,
"TaskbarButtonSettings");
111 _startup_info->setTimeout(c.readEntry(
"Timeout", 30));
114 #ifdef THUMBNAILING_POSSIBLE
117 Display *dpy = QPaintDevice::x11AppDisplay();
120 if (!--m_xCompositeEnabled) {
122 for (
int i = 0; i < ScreenCount(dpy); i++) {
123 XCompositeUnredirectSubwindows(dpy, RootWindow(dpy, i),
124 CompositeRedirectAutomatic);
130 if (m_xCompositeEnabled) {
132 m_xCompositeEnabled++;
137 int event_base, error_base;
138 if (!XCompositeQueryExtension(dpy, &event_base, &error_base)) {
142 int major = 0, minor = 99;
143 XCompositeQueryVersion(dpy, &major, &minor);
147 if (major == 0 && minor < 2) {
152 if (!XRenderQueryExtension(dpy, &event_base, &error_base)) {
156 major = 0, minor = 99;
157 XRenderQueryVersion(dpy, &major, &minor);
161 if (major == 0 && minor < 6) {
166 if (!XFixesQueryExtension(dpy, &event_base, &error_base)) {
170 major = 3, minor = 99;
171 XFixesQueryVersion(dpy, &major, &minor);
179 m_xCompositeEnabled++;
182 for (
int i = 0; i < ScreenCount(dpy); i++) {
183 XCompositeRedirectSubwindows(dpy, RootWindow(dpy, i),
184 CompositeRedirectAutomatic);
187 Task::Dict::iterator itEnd = m_tasksByWId.end();
188 for (Task::Dict::iterator it = m_tasksByWId.begin(); it != itEnd; ++it) {
189 it.data()->updateWindowPixmap();
192 #else // THUMBNAILING_POSSIBLE
195 #endif // !THUMBNAILING_POSSIBLE
203 Task::Dict::iterator it = m_tasksByWId.begin();
204 Task::Dict::iterator itEnd = m_tasksByWId.end();
206 for (; it != itEnd; ++it) {
207 if (it.key() == w || it.value()->hasTransient(w)) {
217 QList<WId> list =
winModule()->stackingOrder();
220 int currentIndex = -1;
221 Task::Dict::iterator itEnd = m_tasksByWId.end();
222 for (Task::Dict::iterator it = m_tasksByWId.begin(); it != itEnd; ++it) {
224 if (!t->isOnAllDesktops() && t->desktop() != desktop) {
228 if (t->isIconified() || t->isShaded()) {
232 if (t->geometry().contains(p)) {
233 int index = list.indexOf(t->window());
234 if (index > currentIndex) {
235 currentIndex = index;
246 NETWinInfo info(QX11Info::display(), w, QX11Info::appRootWindow(),
247 NET::WMWindowType | NET::WMPid | NET::WMState);
250 NET::WindowType wType =
251 info.windowType(NET::NormalMask | NET::DesktopMask | NET::DockMask |
252 NET::ToolbarMask | NET::MenuMask | NET::DialogMask |
253 NET::OverrideMask | NET::TopMenuMask |
254 NET::UtilityMask | NET::SplashMask);
256 if (wType != NET::Normal &&
257 wType != NET::Override &&
258 wType != NET::Unknown &&
259 wType != NET::Dialog &&
260 wType != NET::Utility) {
265 if ((info.state() & NET::SkipTaskbar) != 0) {
266 _skiptaskbar_windows.push_front(w);
270 Window transient_for_tmp;
271 if (XGetTransientForHint(QX11Info::display(), (Window) w, &transient_for_tmp)) {
272 WId transient_for = (WId) transient_for_tmp;
275 if (_skiptaskbar_windows.contains(transient_for))
279 if (transient_for != QX11Info::appRootWindow()
280 && transient_for != 0
281 && wType != NET::Utility) {
284 if (t->window() != w) {
285 t->addTransient(w, info);
303 _skiptaskbar_windows.removeAll(w);
311 if (t->window() == w) {
312 m_tasksByWId.remove(w);
321 t->removeTransient(w);
328 if (dirty & NET::WMState) {
329 NETWinInfo info(QX11Info::display(), w, QX11Info::appRootWindow(),
330 NET::WMState | NET::XAWMState);
331 if (info.state() & NET::SkipTaskbar) {
333 _skiptaskbar_windows.push_front(w);
336 _skiptaskbar_windows.removeAll(w);
337 if (info.mappingState() != NET::Withdrawn && !
findTask(w)) {
346 if (!(dirty & (NET::WMVisibleName | NET::WMName |
347 NET::WMState | NET::WMIcon |
348 NET::XAWMState | NET::WMDesktop) ||
349 (m_trackGeometry && dirty & NET::WMGeometry))) {
361 if (dirty & NET::WMState) {
362 t->updateDemandsAttentionState(w);
366 if (dirty & NET::WMIcon) {
368 dirty ^= NET::WMIcon;
376 if (dirty & (NET::WMDesktop | NET::WMState | NET::XAWMState)) {
380 if (m_xCompositeEnabled && dirty & NET::WMState) {
385 }
else if (dirty & NET::WMGeometry) {
388 if (m_xCompositeEnabled) {
398 if (!m_xCompositeEnabled) {
404 task->updateWindowPixmap();
415 _active->setActive(
false);
423 _active->setActive(
false);
426 _active->setActive(
true);
447 Startup::List::iterator itEnd = _startups.end();
448 for (Startup::List::iterator sIt = _startups.begin(); sIt != itEnd; ++sIt) {
449 if ((*sIt)->id() == id) {
450 (*sIt)->update(data);
458 Startup::List::iterator sIt = _startups.begin();
459 Startup::List::iterator itEnd = _startups.end();
461 for (; sIt != itEnd; ++sIt) {
462 if ((*sIt)->id() == id) {
472 _startups.erase(sIt);
482 Startup::List::iterator sIt = _startups.begin();
483 Startup::List::iterator itEnd = _startups.end();
484 for (; sIt != itEnd; ++sIt) {
486 _startups.erase(sIt);
496 return m_winModule->desktopName(desk);
501 return m_winModule->numberOfDesktops();
510 QList<WId> list = m_winModule->stackingOrder();
511 QList<WId>::const_iterator begin(list.constBegin());
512 QList<WId>::const_iterator it = list.constBegin() + (list.size() - 1);
514 Task::Dict::iterator taskItEnd = m_tasksByWId.end();
515 for (Task::Dict::iterator taskIt = m_tasksByWId.begin();
516 taskIt != taskItEnd; ++taskIt) {
518 if ((*it) == t->window()) {
523 if (!t->isIconified() &&
531 }
while (it-- != begin);
542 KWindowInfo wi = KWindowSystem::windowInfo(wid, NET::WMFrameExtents);
546 QRect window = wi.frameGeometry();
547 QRect desktop = QApplication::desktop()->screenGeometry(screen);
548 desktop.adjust(5, 5, -5, -5);
549 return window.intersects(desktop);
557 _info(KWindowSystem::windowInfo(_win,
558 NET::WMState | NET::XAWMState | NET::WMDesktop | NET::WMVisibleName | NET::WMGeometry,
559 NET::WM2AllowedActions)),
568 setObjectName( QLatin1String( name ) );
571 _pixmap = KWindowSystem::icon(_win, 16, 16,
true);
574 if (_pixmap.isNull()) {
575 KIconLoader::global()->loadIcon(
className().toLower(),
578 KIconLoader::DefaultState,
579 QStringList(),0,
true);
583 if (_pixmap.isNull()) {
584 _pixmap = SmallIcon(
"kcmx");
587 #ifdef THUMBNAILING_POSSIBLE
594 #endif // THUMBNAILING_POSSIBLE
599 #ifdef THUMBNAILING_POSSIBLE
600 if (m_windowPixmap) {
601 XFreePixmap(QPaintDevice::x11AppDisplay(), m_windowPixmap);
603 #endif // THUMBNAILING_POSSIBLE
612 #ifdef THUMBNAILING_POSSIBLE
613 Window target_win, parent, root;
619 if (!XQueryTree(QPaintDevice::x11AppDisplay(), target_win, &root,
620 &parent, &children, &nchildren)) {
628 if (!parent || parent == root) {
635 m_frameId = target_win;
636 #endif // THUMBNAILING_POSSIBLE
642 _pixmap = KWindowSystem::icon(_win, 16, 16,
true);
645 if (_pixmap.isNull()) {
646 KIconLoader::global()->loadIcon(
className().toLower(),
649 KIconLoader::DefaultState,
650 QStringList(),0,
true);
654 if (_pixmap.isNull()) {
655 _pixmap = SmallIcon(
"kcmx");
658 _lastIcon = QPixmap();
665 _info = KWindowSystem::windowInfo(_win,
666 NET::WMState | NET::XAWMState | NET::WMDesktop | NET::WMVisibleName | NET::WMGeometry,
667 NET::WM2AllowedActions);
669 if (dirty != NET::WMName || name !=
visibleName()) {
686 return _info.valid() && (_info.state() & NET::Max);
691 return _info.valid() && _info.isMinimized();
696 return _info.valid() && _info.isMinimized();
701 return _info.valid() && (_info.state() & NET::StaysOnTop);
706 return _info.valid() && (_info.state() & NET::KeepBelow);
711 return _info.valid() && (_info.state() & NET::FullScreen);
716 return _info.valid() && (_info.state() & NET::Shaded);
721 return _info.valid() && _info.isOnCurrentDesktop();
726 return _info.valid() && _info.onAllDesktops();
741 static QString modStr = QString::fromUtf8(
"[") +
743 QString::fromUtf8(
"]");
744 int modStrPos = _info.visibleName().indexOf(modStr);
746 return (modStrPos != -1);
751 return (_info.valid() && (_info.state() & NET::DemandsAttention)) ||
752 _transients_demanding_attention.count() > 0;
764 NETWinInfo i(QX11Info::display(), w, QX11Info::appRootWindow(), NET::WMState);
765 if (i.state() & NET::DemandsAttention) {
766 if (!_transients_demanding_attention.contains(w)) {
767 _transients_demanding_attention.append(w);
770 _transients_demanding_attention.removeAll(w);
777 _transients.append(w);
778 if (info.state() & NET::DemandsAttention) {
779 _transients_demanding_attention.append(w);
786 _transients.removeAll(w);
787 _transients_demanding_attention.removeAll(w);
793 if (XGetClassHint(QX11Info::display(), _win, &hint)) {
794 QString nh(hint.res_name);
795 XFree(hint.res_name);
796 XFree(hint.res_class);
805 if (XGetClassHint(QX11Info::display(), _win, &hint)) {
806 QString ch(hint.res_class);
807 XFree(hint.res_name);
808 XFree(hint.res_class);
816 if ((width == _lastWidth)
817 && (height == _lastHeight)
818 && (allowResize == _lastResize)
819 && (!_lastIcon.isNull()))
822 QPixmap newIcon = KWindowSystem::icon(_win, width, height, allowResize);
823 if (!newIcon.isNull()) {
826 _lastHeight = height;
827 _lastResize = allowResize;
836 isStaticIcon =
false;
839 case KIconLoader::SizeSmall: {
840 pixmap =
icon(16, 16,
true);
843 if (pixmap.isNull()) {
844 pixmap = KIconLoader::global()->loadIcon(
"go",
845 KIconLoader::NoGroup,
846 KIconLoader::SizeSmall);
851 case KIconLoader::SizeMedium: {
856 pixmap =
icon(34, 34,
false);
858 if (((pixmap.width() != 34) || (pixmap.height() != 34)) &&
859 ((pixmap.width() != 32) || (pixmap.height() != 32))) {
860 pixmap =
icon(32, 32,
true);
864 if (pixmap.isNull()) {
865 pixmap = KIconLoader::global()->loadIcon(
"go",
866 KIconLoader::NoGroup,
867 KIconLoader::SizeMedium);
872 case KIconLoader::SizeLarge: {
874 pixmap =
icon(size, size,
false);
877 if (pixmap.isNull() || pixmap.width() != size || pixmap.height() != size) {
878 pixmap = KIconLoader::global()->loadIcon(
className(),
879 KIconLoader::NoGroup,
881 KIconLoader::DefaultState,
888 if (pixmap.isNull() || (pixmap.width() != size) || (pixmap.height() != size)) {
889 pixmap =
icon(size, size,
true);
890 isStaticIcon =
false;
894 if (pixmap.isNull()) {
895 pixmap = KIconLoader::global()->loadIcon(
"go",
896 KIconLoader::NoGroup,
908 if (id1.isEmpty() || id2.isEmpty())
911 if (id1.contains(id2) > 0)
914 if (id2.contains(id1) > 0)
923 bool on_current = _info.isOnCurrentDesktop();
926 KWindowSystem::setCurrentDesktop(_info.desktop());
927 KWindowSystem::forceActiveWindow(_win);
930 if (_info.isMinimized()) {
931 KWindowSystem::unminimizeWindow(_win);
934 QRect geom = _info.geometry();
935 QCursor::setPos(geom.center());
937 NETRootInfo ri(QX11Info::display(), NET::WMMoveResize);
938 ri.moveResizeRequest(_win, geom.center().x(),
939 geom.center().y(), NET::Move);
944 bool on_current = _info.isOnCurrentDesktop();
947 KWindowSystem::setCurrentDesktop(_info.desktop());
948 KWindowSystem::forceActiveWindow(_win);
951 if (_info.isMinimized()) {
952 KWindowSystem::unminimizeWindow(_win);
955 QRect geom = _info.geometry();
956 QCursor::setPos(geom.bottomRight());
958 NETRootInfo ri(QX11Info::display(), NET::WMMoveResize);
959 ri.moveResizeRequest(_win, geom.bottomRight().x(),
960 geom.bottomRight().y(), NET::BottomRight);
965 KWindowInfo
info = KWindowSystem::windowInfo(_win, NET::WMState | NET::XAWMState | NET::WMDesktop);
966 bool on_current = info.isOnCurrentDesktop();
969 KWindowSystem::setCurrentDesktop(info.desktop());
972 if (info.isMinimized()) {
973 KWindowSystem::unminimizeWindow(_win);
976 NETWinInfo ni(QX11Info::display(), _win, QX11Info::appRootWindow(), NET::WMState);
979 ni.setState(NET::Max, NET::Max);
981 ni.setState(0, NET::Max);
985 KWindowSystem::forceActiveWindow(_win);
996 KWindowInfo
info = KWindowSystem::windowInfo(_win, NET::WMState | NET::XAWMState | NET::WMDesktop);
997 bool on_current = info.isOnCurrentDesktop();
1000 KWindowSystem::setCurrentDesktop(info.desktop());
1003 if (info.isMinimized()) {
1004 KWindowSystem::unminimizeWindow(_win);
1007 NETWinInfo ni(QX11Info::display(), _win, QX11Info::appRootWindow(), NET::WMState);
1008 ni.setState(0, NET::Max);
1011 KWindowSystem::forceActiveWindow(_win);
1018 KWindowSystem::minimizeWindow(_win);
1020 KWindowInfo
info = KWindowSystem::windowInfo(_win, NET::WMState | NET::XAWMState | NET::WMDesktop);
1021 bool on_current = info.isOnCurrentDesktop();
1024 KWindowSystem::setCurrentDesktop(info.desktop());
1027 KWindowSystem::unminimizeWindow(_win);
1030 KWindowSystem::forceActiveWindow(_win);
1042 NETRootInfo ri(QX11Info::display(), NET::CloseWindow);
1043 ri.closeWindowRequest(_win);
1049 KWindowSystem::raiseWindow(_win);
1055 KWindowSystem::lowerWindow(_win);
1062 if (_transients_demanding_attention.count() > 0) {
1063 w = _transients_demanding_attention.last();
1065 KWindowSystem::forceActiveWindow(w);
1081 NETWinInfo ni(QX11Info::display(), _win, QX11Info::appRootWindow(), NET::WMDesktop);
1083 if (_info.valid() && _info.onAllDesktops()) {
1085 KWindowSystem::forceActiveWindow(_win);
1087 ni.setDesktop(NETWinInfo::OnAllDesktops);
1092 ni.setDesktop(desk);
1094 KWindowSystem::forceActiveWindow(_win);
1104 NETWinInfo ni(QX11Info::display(), _win, QX11Info::appRootWindow(), NET::WMState);
1106 ni.setState(NET::StaysOnTop, NET::StaysOnTop);
1108 ni.setState(0, NET::StaysOnTop);
1118 NETWinInfo ni(QX11Info::display(), _win, QX11Info::appRootWindow(), NET::WMState);
1121 ni.setState(NET::KeepBelow, NET::KeepBelow);
1123 ni.setState(0, NET::KeepBelow);
1134 NETWinInfo ni(QX11Info::display(), _win, QX11Info::appRootWindow(), NET::WMState);
1137 ni.setState(NET::FullScreen, NET::FullScreen);
1139 ni.setState(0, NET::FullScreen);
1150 NETWinInfo ni(QX11Info::display(), _win, QX11Info::appRootWindow(), NET::WMState);
1152 ni.setState(NET::Shaded, NET::Shaded);
1154 ni.setState(0, NET::Shaded);
1164 if (rect == m_iconGeometry) {
1168 m_iconGeometry = rect;
1169 NETWinInfo ni(QX11Info::display(), _win, QX11Info::appRootWindow(), 0);
1172 if (rect.isValid()) {
1175 r.size.width = rect.width();
1176 r.size.height = rect.height();
1178 ni.setIconGeometry(r);
1183 if (!_info.valid() ||
1196 QWidget *rootWin = qApp->desktop();
1197 QRect geom = _info.geometry();
1198 _grab = QPixmap::grabWindow(rootWin->winId(),
1200 geom.width(), geom.height());
1202 if (!_grab.isNull()) {
1212 double width = _grab.width();
1213 double height = _grab.height();
1214 width = width * _thumbSize;
1215 height = height * _thumbSize;
1217 _thumb = _grab.scaled(qRound(width), qRound(height), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
1223 #ifdef THUMBNAILING_POSSIBLE
1230 Display *dpy = QPaintDevice::x11AppDisplay();
1232 XWindowAttributes winAttr;
1233 XGetWindowAttributes(dpy, m_frameId, &winAttr);
1234 XRenderPictFormat *format = XRenderFindVisualFormat(dpy, winAttr.visual);
1236 XRenderPictureAttributes picAttr;
1237 picAttr.subwindow_mode = IncludeInferiors;
1239 Picture picture = XRenderCreatePicture(dpy, m_windowPixmap, format,
1240 CPSubwindowMode, &picAttr);
1243 XserverRegion region = XFixesCreateRegionFromWindow(dpy, m_frameId,
1244 WindowRegionBounding);
1245 XFixesSetPictureClipRegion(dpy, picture, 0, 0, region);
1246 XFixesDestroyRegion(dpy, region);
1249 if (winAttr.width > winAttr.height) {
1250 factor = (double)maxDimension / (
double)winAttr.width;
1252 factor = (double)maxDimension / (
double)winAttr.height;
1254 int thumbnailWidth = (int)(winAttr.width * factor);
1255 int thumbnailHeight = (int)(winAttr.height * factor);
1257 QPixmap
thumbnail(thumbnailWidth, thumbnailHeight);
1260 #if 0 // QImage::smoothScale() scaling
1261 QPixmap full(winAttr.width, winAttr.height);
1262 full.fill(QApplication::palette().
active().background());
1264 bool hasAlpha = format->type == PictTypeDirect && format->direct.alphaMask;
1266 XRenderComposite(dpy,
1267 hasAlpha ? PictOpOver : PictOpSrc,
1270 full.x11RenderHandle(),
1274 winAttr.width, winAttr.height);
1277 QImage image = io.toImage(full);
1278 thumbnail = io.convertToPixmap(image.smoothScale(thumbnailWidth,
1280 #else // XRENDER scaling
1282 XTransform transformation = {{
1283 { XDoubleToFixed(1), XDoubleToFixed(0), XDoubleToFixed(0) },
1284 { XDoubleToFixed(0), XDoubleToFixed(1), XDoubleToFixed(0) },
1285 { XDoubleToFixed(0), XDoubleToFixed(0), XDoubleToFixed(factor) }
1288 XRenderSetPictureTransform(dpy, picture, &transformation);
1289 XRenderSetPictureFilter(dpy, picture, FilterBest, 0, 0);
1291 XRenderComposite(QPaintDevice::x11AppDisplay(),
1299 thumbnailWidth, thumbnailHeight);
1301 XRenderFreePicture(dpy, picture);
1305 #else // THUMBNAILING_POSSIBLE
1310 #endif // THUMBNAILING_POSSIBLE
1314 #ifdef THUMBNAILING_POSSIBLE
1320 Display *dpy = QPaintDevice::x11AppDisplay();
1322 if (m_windowPixmap) {
1323 XFreePixmap(dpy, m_windowPixmap);
1326 m_windowPixmap = XCompositeNameWindowPixmap(dpy, m_frameId);
1327 #endif // THUMBNAILING_POSSIBLE
1331 QObject * parent,
const char *name)
1332 :
QObject(parent), _id(id), _data(data)
1334 setObjectName( QLatin1String( name ) );
1348 return m_winModule->currentDesktop();
1355 QDataStream stream(&data, QIODevice::WriteOnly);
1357 stream.setVersion(QDataStream::Qt_3_1);
1359 Task::List::const_iterator itEnd = tasks.constEnd();
1360 for (Task::List::const_iterator it = tasks.constBegin(); it != itEnd; ++it) {
1361 stream << (quint32)(*it)->window();
1364 QMimeData* mimeData =
new QMimeData();
1365 mimeData->setData(
"taskbar/task", data);
1366 setMimeData(mimeData);
1374 return e->hasFormat(
"taskbar/task");
1379 QByteArray data(e->data(
"taskbar/task"));
1383 QDataStream stream(data);
1384 while (!stream.atEnd()) {
void setAlwaysOnTop(bool)
If true, the task's window will remain at the top of the stacking order.
void killStartup(const KStartupInfoId &)
void activateRaiseOrIconify()
Perform the action that is most appropriate for this task.
void iconChanged()
Indicates that the icon for this task has changed.
bool isOnTop(const Task *)
Returns true if the specified task is on top.
void changed()
Indicates that this task has changed in some way.
const QPixmap & thumbnail() const
Returns the thumbnail for this task (or a null image if there is none).
void taskAdded(Task::TaskPtr)
Emitted when a new task has started.
bool isAlwaysOnTop() const
Returns true if the task's window will remain at the top of the stacking order.
void thumbnailChanged()
Indicates that the thumbnail for this task has changed.
void move()
Move the window of this task.
void gotStartupChange(const KStartupInfoId &, const KStartupInfoData &)
void activated()
Indicates that this task is now the active task.
QString desktopName(int n) const
Returns the name of the nth desktop.
bool isOnCurrentDesktop() const
Returns true if the task's window is on the current virtual desktop.
void changed()
Indicates that this startup has changed in some way.
void setXCompositeEnabled(bool state)
void setMaximized(bool)
Maximise the main window of this task.
void toDesktop(int)
Moves the task's window to the specified virtual desktop.
Represents a task which is in the process of starting.
QPixmap bestIcon(int size, bool &isStaticIcon)
Returns the best icon for any of the KIconLoader::StdSizes.
static K3StaticDeleter< TaskManager > staticTaskManagerDeleter
int numberOfDesktops() const
Returns the number of virtual desktops.
bool isModified() const
Returns true if the document the task is editing has been modified.
void taskRemoved(Task::TaskPtr)
Emitted when a task has terminated.
bool isOnScreen(int screen) const
Returns true if the window is on the specified screen of a multihead configuration.
bool isMaximized() const
Returns true if the task's window is maximized.
A generic API for task managers.
void updateDemandsAttentionState(WId w)
QPixmap pixmap() const
Returns a 16x16 (KIconLoader::Small) icon for the task.
int currentDesktop() const
Returns the number of the current desktop.
bool isKeptBelowOthers() const
Returns true if the task's window will remain at the bottom of the stacking order.
bool isOnTop() const
Returns true if the task's window is the topmost non-iconified, non-always-on-top window...
void desktopChanged(int desktop)
Emitted when the current desktop changes.
void publishIconGeometry(QRect)
This method informs the window manager of the location at which this task will be displayed when icon...
KSharedPtr< Startup > StartupPtr
QVector< Task::TaskPtr > List
static bool isOnScreen(int screen, const WId wid)
Returns whether the Window with WId wid is on the screen screen.
void toggleKeptBelowOthers()
void windowChanged(Task::TaskPtr)
Emitted when a window changes desktop.
void setIconified(bool)
Iconify the task.
void setShaded(bool)
If true then the task's window will be shaded.
KWindowSystem * winModule() const
static bool xCompositeEnabled()
void resize()
Resize the window of this task.
void gotNewStartup(const KStartupInfoId &, const KStartupInfoData &)
void setFullScreen(bool)
If true, the task's window will enter full screen mode.
bool isActive() const
Returns true if the task's window is the active window.
void update(const KStartupInfoData &data)
void activeTaskChanged(Task::TaskPtr)
Emitted when the active window changed.
void close()
Close the task's window.
QPixmap icon(int width, int height, bool allowResize=false)
Tries to find an icon for the task with the specified size.
bool isMinimized() const
Returns true if the task's window is minimized.
void raise()
Raise the task's window.
void currentDesktopChanged(int)
void activate()
Activate the task's window.
void activeWindowChanged(WId)
static bool canDecode(const QMimeData *e)
Returns true if the mime source can be decoded to a TaskDrag.
static TaskManager * self()
bool isOnAllDesktops() const
Returns true if the task's window is on all virtual desktops.
void addTransient(WId w, const NETWinInfo &info)
bool isFullScreen() const
Returns true if the task's window is in full screen mode.
void updateThumbnail()
Tells the task to generate a new thumbnail.
void setKeptBelowOthers(bool)
If true, the task's window will remain at the bottom of the stacking order.
QString visibleName() const
void refresh(unsigned int dirty)
void restore()
Restore the main window of the task (if it was iconified).
void updateWindowPixmap()
void deactivated()
Indicates that this task is no longer the active task.
void updateWindowPixmap(WId)
bool demandsAttention() const
Returns true if the task is not active but demands user's attention.
Task(WId win, QObject *parent, const char *name=0)
void startupAdded(Startup::StartupPtr)
Emitted when a new task is expected.
Task::TaskPtr findTask(WId w)
Returns the task for a given WId, or 0 if there is no such task.
void toCurrentDesktop()
Moves the task's window to the current virtual desktop.
void removeTransient(WId w)
void windowChangedGeometry(Task::TaskPtr)
KSharedPtr< Task > TaskPtr
Startup(const KStartupInfoId &id, const KStartupInfoData &data, QObject *parent, const char *name=0)
A dynamic interface to a task (main window).
static bool idMatch(const QString &, const QString &)
Returns true iff the windows with the specified ids should be grouped together in the task list...
void lower()
Lower the task's window.
void startupRemoved(Startup::StartupPtr)
Emitted when a startup item should be removed.
static Task::List decode(const QMimeData *e)
Decodes the tasks from the mime source and returns them if successful.
TaskDrag(const Task::List &tasks, QWidget *source=0)
Constructs a task drag object for a task list.
bool isShaded() const
Returns true if the task's window is shaded.