00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef KWIN_H
00020 #define KWIN_H
00021
00022 #include <sys/types.h>
00023 #include <qwindowdefs.h>
00024 #include <qstring.h>
00025 #include <qpixmap.h>
00026 #include "kdelibs_export.h"
00027
00028 #ifdef Q_OS_UNIX
00029
00030 #include <netwm_def.h>
00031 class NETWinInfo;
00032
00061 class KDECORE_EXPORT KWin
00062 {
00063 public:
00064
00092 static void activateWindow( WId win, long time = 0 );
00093
00108 static void forceActiveWindow( WId win, long time = 0 );
00113 static void setActiveWindow( WId win ) KDE_DEPRECATED;
00114
00126 static void demandAttention( WId win, bool set = true );
00127
00138 static void setUserTime( WId win, long time );
00139
00143 static void invokeContextHelp();
00144
00145
00159 static void setMainWindow( QWidget* subwindow, WId mainwindow );
00160
00170 static void setSystemTrayWindowFor( WId trayWin, WId forWin );
00171
00172 class WindowInfo;
00173 class WindowInfoPrivate;
00186 static WindowInfo windowInfo( WId win, unsigned long properties = 0, unsigned long properties2 = 0 );
00187
00195 static WId transientFor( WId window );
00196
00202 static WId groupLeader( WId window );
00203
00220 static QPixmap icon( WId win, int width = -1, int height = -1, bool scale = false );
00221
00230 enum IconSource { NETWM = 1,
00231 WMHints = 2,
00232 ClassHint = 4,
00233 XApp = 8
00234 };
00250 static QPixmap icon( WId win, int width, int height, bool scale, int flags );
00251
00258 static void setIcons( WId win, const QPixmap& icon, const QPixmap& miniIcon );
00259
00270 static void setType( WId win, NET::WindowType windowType );
00271
00283 static void setState( WId win, unsigned long state );
00284
00296 static void clearState( WId win, unsigned long state );
00297
00308 static void setOpacity( WId win, uint percent );
00309
00320 static void setShadowSize( WId win, uint percent );
00321
00330 static void setOnAllDesktops( WId win, bool b );
00331
00338 static void setOnDesktop( WId win, int desktop);
00339
00361 static void setExtendedStrut( WId win, int left_width, int left_start, int left_end,
00362 int right_width, int right_start, int right_end, int top_width, int top_start, int top_end,
00363 int bottom_width, int bottom_start, int bottom_end );
00364
00375 static void setStrut( WId win, int left, int right, int top, int bottom );
00380 static int currentDesktop();
00381
00387 static int numberOfDesktops();
00388
00394 static void setCurrentDesktop( int desktop );
00395
00404 static void iconifyWindow( WId win, bool animation = true );
00405
00414 static void deIconifyWindow( WId win, bool animation = true );
00415
00423 static void raiseWindow( WId win );
00424
00432 static void lowerWindow( WId win );
00433
00439 static bool icccmCompliantMappingState();
00440
00445 static bool allowedActionsSupported();
00446
00452 static QString readNameProperty( WId window, unsigned long atom );
00453
00457 struct KDECORE_EXPORT Info
00458 {
00460 WId win;
00462 long unsigned int state;
00464 bool isMinimized() const;
00465 bool isIconified() const;
00466 NET::MappingState mappingState;
00468 NETStrut strut;
00470 NET::WindowType windowType;
00472 QString visibleName;
00474 QString name;
00476 int desktop;
00478 bool onAllDesktops;
00480 pid_t pid;
00482 QRect geometry;
00484 QRect frameGeometry;
00485
00486 QString visibleNameWithState() const;
00487 };
00488
00493 static Info info( WId win ) KDE_DEPRECATED;
00494
00495 #ifdef KDE_NO_COMPAT
00496 private:
00497 #endif
00498
00502 static void appStarted() KDE_DEPRECATED;
00503 };
00504
00505
00510 class KDECORE_EXPORT KWin::WindowInfo
00511 {
00512 public:
00516 WindowInfo( WId window, unsigned long properties, unsigned long properties2 );
00517 WindowInfo();
00518 ~WindowInfo();
00525 bool valid( bool withdrawn_is_valid = false ) const;
00529 WId win() const;
00534 unsigned long state() const;
00540 bool hasState( unsigned long s ) const { return ( state() & s ) == s; }
00548 bool isMinimized() const;
00555 NET::MappingState mappingState() const;
00560 NETExtendedStrut extendedStrut() const;
00566 NETStrut strut() const;
00572 NET::WindowType windowType( int supported_types ) const;
00578 QString visibleName() const;
00588 QString visibleNameWithState() const;
00594 QString name() const;
00601 QString visibleIconName() const;
00612 QString visibleIconNameWithState() const;
00619 QString iconName() const;
00624 bool isOnCurrentDesktop() const;
00629 bool isOnDesktop( int desktop ) const;
00635 bool onAllDesktops() const;
00641 int desktop() const;
00646 QRect geometry() const;
00651 QRect frameGeometry() const;
00657 WId transientFor() const;
00662 WId groupLeader() const;
00663
00670 QCString windowClassClass() const;
00671
00678 QCString windowClassName() const;
00679
00685 QCString windowRole() const;
00686
00692 QCString clientMachine() const;
00693
00699 bool actionSupported( NET::Action action ) const;
00700
00701 WindowInfo( const WindowInfo& );
00702 WindowInfo& operator=( const WindowInfo& );
00703 private:
00704 WindowInfoPrivate* d;
00705 };
00706
00707 #endif //Q_OS_UNIX
00708
00709 #endif