00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef KWINDOWSYSTEM_H
00025 #define KWINDOWSYSTEM_H
00026
00027 #include <kdeui_export.h>
00028 #include <QtCore/QObject>
00029 #include <QtGui/QWidgetList>
00030 #include <netwm_def.h>
00031 #include <kwindowinfo.h>
00032
00033 #if defined(Q_WS_X11) || defined(Q_WS_MAC)
00034 class KWindowSystemPrivate;
00035 #endif
00036
00037
00058 class KDEUI_EXPORT KWindowSystem : public QObject, public NET
00059 {
00060 Q_OBJECT
00061
00062 public:
00063 #if defined(Q_WS_X11) || defined(Q_WS_MAC)
00064
00067 static KWindowSystem* self();
00068 #endif
00069
00087 static const QList<WId>& windows();
00088 #if defined(Q_WS_X11) || defined(Q_WS_MAC)
00089
00094 static bool hasWId(WId id);
00095
00106 static KWindowInfo windowInfo( WId win, unsigned long properties, unsigned long properties2 = 0 );
00107 #endif
00108
00114 static QList<WId> stackingOrder();
00115
00121 static WId activeWindow();
00122
00149 static void activateWindow( WId win, long time = 0 );
00150
00163 static void forceActiveWindow( WId win, long time = 0 );
00164
00174 static void demandAttention( WId win, bool set = true );
00175
00180 static bool compositingActive();
00181
00186 static int currentDesktop();
00187
00192 static int numberOfDesktops();
00193
00199 static void setCurrentDesktop( int desktop );
00200
00209 static void setOnAllDesktops( WId win, bool b );
00210
00217 static void setOnDesktop( WId win, int desktop);
00218
00230 static void setMainWindow( QWidget* subwindow, WId mainwindow );
00231 #ifdef Q_WS_X11
00232
00238 static WId transientFor( WId window );
00239
00244 static WId groupLeader( WId window );
00245 #endif
00246
00262 static QPixmap icon( WId win, int width = -1, int height = -1, bool scale = false );
00263
00272 enum IconSource { NETWM = 1,
00273 WMHints = 2,
00274 ClassHint = 4,
00275 XApp = 8
00276 };
00291 static QPixmap icon( WId win, int width, int height, bool scale, int flags );
00292
00299 static void setIcons( WId win, const QPixmap& icon, const QPixmap& miniIcon );
00306 static void setType( WId win, NET::WindowType windowType );
00318 static void setState( WId win, unsigned long state );
00319
00331 static void clearState( WId win, unsigned long state );
00332
00341 static void minimizeWindow( WId win, bool animation = true );
00342
00351 static void unminimizeWindow( WId win, bool animation = true );
00352
00359 static void raiseWindow( WId win );
00360
00367 static void lowerWindow( WId win );
00368
00374 static bool icccmCompliantMappingState();
00375
00383 static QRect workArea( int desktop = - 1 );
00384
00385
00396 static QRect workArea( const QList<WId> &excludes, int desktop = -1);
00397
00403 static QString desktopName( int desktop );
00404
00410 static void setDesktopName( int desktop, const QString& name );
00411
00415 static bool showingDesktop();
00416
00425 static void setUserTime( WId win, long time );
00447 static void setExtendedStrut( WId win, int left_width, int left_start, int left_end,
00448 int right_width, int right_start, int right_end, int top_width, int top_start, int top_end,
00449 int bottom_width, int bottom_start, int bottom_end );
00450
00462 static void setStrut( WId win, int left, int right, int top, int bottom );
00466 static bool allowedActionsSupported();
00471 static QString readNameProperty( WId window, unsigned long atom );
00472
00482 static void doNotManage( const QString& title );
00483
00484 #ifdef Q_WS_X11
00485
00489 static bool mapViewport();
00494 static int viewportToDesktop( const QPoint& pos );
00499 static int viewportWindowToDesktop( const QRect& r );
00504 static QPoint desktopToViewport( int desktop, bool absolute );
00511 static QPoint constrainViewportRelativePosition( const QPoint& pos );
00512 #endif
00513
00514 Q_SIGNALS:
00515
00520 void currentDesktopChanged( int desktop);
00521
00526 void windowAdded(WId id);
00527
00532 void windowRemoved(WId id);
00533
00538 void activeWindowChanged(WId id);
00539
00543 void desktopNamesChanged();
00544
00549 void numberOfDesktopsChanged(int num);
00550
00554 void workAreaChanged();
00555
00561 void strutChanged();
00562
00567 void stackingOrderChanged();
00568
00579 void windowChanged(WId id, const unsigned long* properties );
00580
00590 void windowChanged(WId id, unsigned int properties);
00591
00596 void windowChanged(WId id);
00597
00601 void showingDesktopChanged( bool showing );
00602
00603 protected:
00604 virtual void connectNotify( const char* signal );
00605
00606 private:
00607 #if defined(Q_WS_X11) || defined(Q_WS_MAC)
00608 friend class KWindowSystemStaticContainer;
00609 #endif
00610 KWindowSystem() {}
00611
00612 enum { INFO_BASIC=1,
00613 INFO_WINDOWS=2 };
00614 #if defined(Q_WS_X11) || defined(Q_WS_MAC)
00615 static void init(int);
00616
00617 friend class KWindowSystemPrivate;
00618 static KWindowSystemPrivate* s_d_func();
00619 #endif
00620 };
00621
00622 #endif