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 class KWindowSystemPrivate;
00034
00055 class KDEUI_EXPORT KWindowSystem : public QObject, public NET
00056 {
00057 Q_OBJECT
00058
00059 public:
00063 static KWindowSystem* self();
00064
00083 static const QList<WId>& windows();
00084
00090 static bool hasWId(WId id);
00091
00102 static KWindowInfo windowInfo( WId win, unsigned long properties, unsigned long properties2 = 0 );
00103
00110 static QList<WId> stackingOrder();
00111
00117 static WId activeWindow();
00118
00145 static void activateWindow( WId win, long time = 0 );
00146
00159 static void forceActiveWindow( WId win, long time = 0 );
00160
00170 static void demandAttention( WId win, bool set = true );
00171
00176 static bool compositingActive();
00177
00182 static int currentDesktop();
00183
00188 static int numberOfDesktops();
00189
00195 static void setCurrentDesktop( int desktop );
00196
00205 static void setOnAllDesktops( WId win, bool b );
00206
00213 static void setOnDesktop( WId win, int desktop);
00214
00226 static void setMainWindow( QWidget* subwindow, WId mainwindow );
00227 #ifdef Q_WS_X11
00228
00234 static WId transientFor( WId window );
00235
00240 static WId groupLeader( WId window );
00241 #endif
00242
00258 static QPixmap icon( WId win, int width = -1, int height = -1, bool scale = false );
00259
00268 enum IconSource { NETWM = 1,
00269 WMHints = 2,
00270 ClassHint = 4,
00271 XApp = 8
00272 };
00287 static QPixmap icon( WId win, int width, int height, bool scale, int flags );
00288
00295 static void setIcons( WId win, const QPixmap& icon, const QPixmap& miniIcon );
00302 static void setType( WId win, NET::WindowType windowType );
00314 static void setState( WId win, unsigned long state );
00315
00327 static void clearState( WId win, unsigned long state );
00328
00337 static void minimizeWindow( WId win, bool animation = true );
00338
00347 static void unminimizeWindow( WId win, bool animation = true );
00348
00355 static void raiseWindow( WId win );
00356
00363 static void lowerWindow( WId win );
00364
00370 static bool icccmCompliantMappingState();
00371
00379 static QRect workArea( int desktop = - 1 );
00380
00381
00392 static QRect workArea( const QList<WId> &excludes, int desktop = -1);
00393
00399 static QString desktopName( int desktop );
00400
00406 static void setDesktopName( int desktop, const QString& name );
00407
00411 static bool showingDesktop();
00412
00421 static void setUserTime( WId win, long time );
00443 static void setExtendedStrut( WId win, int left_width, int left_start, int left_end,
00444 int right_width, int right_start, int right_end, int top_width, int top_start, int top_end,
00445 int bottom_width, int bottom_start, int bottom_end );
00446
00458 static void setStrut( WId win, int left, int right, int top, int bottom );
00462 static bool allowedActionsSupported();
00467 static QString readNameProperty( WId window, unsigned long atom );
00468
00478 static void doNotManage( const QString& title );
00479
00480 #ifdef Q_WS_X11
00481
00485 static bool mapViewport();
00490 static int viewportToDesktop( const QPoint& pos );
00495 static int viewportWindowToDesktop( const QRect& r );
00500 static QPoint desktopToViewport( int desktop, bool absolute );
00507 static QPoint constrainViewportRelativePosition( const QPoint& pos );
00508 #endif
00509
00510 Q_SIGNALS:
00511
00516 void currentDesktopChanged( int desktop);
00517
00522 void windowAdded(WId id);
00523
00528 void windowRemoved(WId id);
00529
00534 void activeWindowChanged(WId id);
00535
00539 void desktopNamesChanged();
00540
00545 void numberOfDesktopsChanged(int num);
00546
00550 void workAreaChanged();
00551
00557 void strutChanged();
00558
00563 void stackingOrderChanged();
00564
00575 void windowChanged(WId id, const unsigned long* properties );
00576
00586 void windowChanged(WId id, unsigned int properties);
00587
00592 void windowChanged(WId id);
00593
00597 void showingDesktopChanged( bool showing );
00598
00599 protected:
00600 virtual void connectNotify( const char* signal );
00601
00602 private:
00603 friend class KWindowSystemStaticContainer;
00604
00605 KWindowSystem() {}
00606
00607 enum { INFO_BASIC=1,
00608 INFO_WINDOWS=2 };
00609
00610 static void init(int);
00611
00612 friend class KWindowSystemPrivate;
00613 static KWindowSystemPrivate* s_d_func();
00614 };
00615
00616 #endif