25 #ifndef __taskmanager_h__
26 #define __taskmanager_h__
28 #include <sys/types.h>
42 #include <KStartupInfo>
43 #include <KWindowSystem>
45 #if defined(HAVE_XCOMPOSITE) && \
46 defined(HAVE_XRENDER) && \
49 #include <X11/extensions/Xcomposite.h>
50 #include <X11/extensions/Xfixes.h>
51 #include <X11/extensions/Xrender.h>
53 #if XCOMPOSITE_VERSION >= 00200 && \
54 XFIXES_VERSION >= 20000 && \
55 (RENDER_MAJOR > 0 || RENDER_MINOR >= 6)
56 #define THUMBNAILING_POSSIBLE
76 Q_PROPERTY(QString visibleName READ visibleName)
77 Q_PROPERTY(QString name READ name)
78 Q_PROPERTY(QString visibleNameWithState READ visibleNameWithState)
79 Q_PROPERTY(QPixmap pixmap READ pixmap)
80 Q_PROPERTY(
bool maximized READ isMaximized)
81 Q_PROPERTY(
bool minimized READ isMinimized)
83 Q_PROPERTY(
bool iconified READ isIconified)
84 Q_PROPERTY(
bool shaded READ isShaded WRITE setShaded)
85 Q_PROPERTY(
bool active READ isActive)
86 Q_PROPERTY(
bool onCurrentDesktop READ isOnCurrentDesktop)
87 Q_PROPERTY(
bool onAllDesktops READ isOnAllDesktops)
88 Q_PROPERTY(
bool alwaysOnTop READ isAlwaysOnTop WRITE setAlwaysOnTop)
89 Q_PROPERTY(
bool modified READ isModified)
90 Q_PROPERTY(
bool demandsAttention READ demandsAttention)
91 Q_PROPERTY(
int desktop READ desktop)
92 Q_PROPERTY(
double thumbnailSize READ thumbnailSize WRITE setThumbnailSize)
93 Q_PROPERTY(
bool hasThumbnail READ hasThumbnail)
94 Q_PROPERTY(QPixmap thumbnail READ thumbnail)
101 Task(WId win,
QObject *parent, const
char *name = 0);
115 return _info.visibleName();
119 return _info.visibleNameWithState();
126 QString classClass();
160 QPixmap bestIcon(
int size,
bool &isStaticIcon);
171 QPixmap icon(
int width,
int height,
bool allowResize =
false);
177 static bool idMatch(
const QString &,
const QString &);
184 bool isMaximized()
const;
189 bool isMinimized()
const;
195 bool isIconified()
const;
200 bool isShaded()
const;
205 bool isActive()
const;
211 bool isOnTop()
const;
216 bool isOnCurrentDesktop()
const;
221 bool isOnAllDesktops()
const;
227 bool isAlwaysOnTop()
const;
233 bool isKeptBelowOthers()
const;
238 bool isFullScreen()
const;
246 bool isModified()
const ;
253 return _info.desktop();
259 bool demandsAttention()
const;
265 bool isOnScreen(
int screen)
const;
272 return _info.state() ^ NET::SkipTaskbar;
280 return _info.state() ^ NET::SkipPager;
288 return _info.geometry();
294 void refresh(
unsigned int dirty);
298 void addTransient(WId w,
const NETWinInfo& info);
300 void removeTransient(WId w);
304 return _transients.indexOf(w) != -1;
307 void updateDemandsAttentionState(WId w);
309 void setActive(
bool a);
337 return !_thumb.isNull();
349 QPixmap thumbnail(
int maxDimension);
351 void updateWindowPixmap();
359 void setMaximized(
bool);
360 void toggleMaximized();
380 void setIconified(
bool);
381 void toggleIconified();
408 void activateRaiseOrIconify();
413 void setAlwaysOnTop(
bool);
414 void toggleAlwaysOnTop();
419 void setKeptBelowOthers(
bool);
420 void toggleKeptBelowOthers();
425 void setFullScreen(
bool);
426 void toggleFullScreen();
432 void setShaded(
bool);
443 void toCurrentDesktop();
450 void publishIconGeometry(QRect);
456 void updateThumbnail();
482 void thumbnailChanged();
486 void generateThumbnail();
489 void findWindowFrameId();
508 QRect m_iconGeometry;
509 #ifdef THUMBNAILING_POSSIBLE
510 Pixmap m_windowPixmap;
511 #endif // THUMBNAILING_POSSIBLE
532 static bool canDecode(
const QMimeData* e);
550 Q_PROPERTY(QString text READ text)
551 Q_PROPERTY(QString bin READ bin)
552 Q_PROPERTY(QString icon READ icon)
558 Startup(const KStartupInfoId&
id, const KStartupInfoData& data,
QObject * parent,
559 const
char *name = 0);
567 return _data.findName();
583 return _data.findIcon();
585 void update(
const KStartupInfoData& data);
586 const KStartupInfoId&
id()
const
599 KStartupInfoData _data;
600 class StartupPrivate *d;
616 Q_PROPERTY(
int currentDesktop READ currentDesktop)
617 Q_PROPERTY(
int numberOfDesktops READ numberOfDesktops)
626 Task::TaskPtr findTask(WId w);
631 Task::TaskPtr findTask(
int desktop, const QPoint& p);
652 QString desktopName(
int n)
const;
657 int numberOfDesktops()
const;
662 int currentDesktop()
const;
667 bool isOnTop(
const Task*);
676 m_trackGeometry =
true;
682 static bool isOnScreen(
int screen,
const WId wid);
689 void setXCompositeEnabled(
bool state);
692 return m_xCompositeEnabled != 0;
726 void desktopChanged(
int desktop);
736 void windowAdded(WId);
738 void windowRemoved(WId);
740 void windowChanged(WId,
unsigned int);
743 void activeWindowChanged(WId);
745 void currentDesktopChanged(
int);
747 void killStartup(
const KStartupInfoId&);
752 void gotNewStartup(
const KStartupInfoId&,
const KStartupInfoData&);
754 void gotStartupChange(
const KStartupInfoId&,
const KStartupInfoData&);
757 void configure_startup();
758 void updateWindowPixmap(WId);
767 KStartupInfo* _startup_info;
768 KWindowSystem* m_winModule;
769 bool m_trackGeometry;
772 static uint m_xCompositeEnabled;
774 class TaskManagerPrivate *d;
const QPixmap & thumbnail() const
Returns the thumbnail for this task (or a null image if there is none).
bool showInPager() const
Returns true if the task should be shown in pager-like apps.
Provids a drag object for tasks across desktops.
int desktop() const
Returns the desktop on which this task's window resides.
Represents a task which is in the process of starting.
QMap< WId, Task::TaskPtr > Dict
QString visibleNameWithState() const
A generic API for task managers.
QPixmap pixmap() const
Returns a 16x16 (KIconLoader::Small) icon for the task.
WindowList transients() const
A list of the window ids of all transient windows (dialogs) associated with this task.
void trackGeometry()
Tells the task manager whether or not we care about geometry updates.
KSharedPtr< Startup > StartupPtr
QVector< Task::TaskPtr > List
QString icon() const
The name of the icon to be used for the starting task.
QString bin() const
The name of the executable of the starting task.
KWindowSystem * winModule() const
static bool xCompositeEnabled()
double thumbnailSize() const
Returns the current thumbnail size.
bool hasThumbnail() const
Returns true if this task has a thumbnail.
Startup::List startups() const
Returns a list of all current startups.
QRect geometry() const
Returns the geometry for this window.
QString visibleName() const
bool hasTransient(WId w) const
#define SUPERKARAMBA_EXPORT
const KStartupInfoId & id() const
bool showInTaskbar() const
Returns true if the task should be shown in taskbar-like apps.
QVector< Startup::StartupPtr > List
KSharedPtr< Task > TaskPtr
A dynamic interface to a task (main window).
void setThumbnailSize(double size)
Sets the size for the window thumbnail.