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;
00187 static WindowInfo windowInfo( WId win, unsigned long properties = 0, unsigned long properties2 = 0 );
00188
00196 static WId transientFor( WId window );
00197
00203 static WId groupLeader( WId window );
00204
00221 static QPixmap icon( WId win, int width = -1, int height = -1, bool scale = false );
00222
00231 enum IconSource { NETWM = 1,
00232 WMHints = 2,
00233 ClassHint = 4,
00234 XApp = 8
00235 };
00251 static QPixmap icon( WId win, int width, int height, bool scale, int flags );
00252
00259 static void setIcons( WId win, const QPixmap& icon, const QPixmap& miniIcon );
00260
00267 static void setType( WId win, NET::WindowType windowType );
00268
00280 static void setState( WId win, unsigned long state );
00281
00293 static void clearState( WId win, unsigned long state );
00294
00305 static void setOpacity( WId win, uint percent );
00306
00317 static void setShadowSize( WId win, uint percent );
00318
00327 static void setOnAllDesktops( WId win, bool b );
00328
00335 static void setOnDesktop( WId win, int desktop);
00336
00358 static void setExtendedStrut( WId win, int left_width, int left_start, int left_end,
00359 int right_width, int right_start, int right_end, int top_width, int top_start, int top_end,
00360 int bottom_width, int bottom_start, int bottom_end );
00361
00372 static void setStrut( WId win, int left, int right, int top, int bottom );
00377 static int currentDesktop();
00378
00384 static int numberOfDesktops();
00385
00391 static void setCurrentDesktop( int desktop );
00392
00400 static void setCurrentDesktopViewport( int desktop, QPoint viewport );
00401
00410 static void iconifyWindow( WId win, bool animation = true );
00411
00420 static void deIconifyWindow( WId win, bool animation = true );
00421
00429 static void raiseWindow( WId win );
00430
00438 static void lowerWindow( WId win );
00439
00445 static bool icccmCompliantMappingState();
00446
00451 static bool allowedActionsSupported();
00452
00458 static QString readNameProperty( WId window, unsigned long atom );
00459
00464 static bool compositingActive();
00465
00469 struct KDECORE_EXPORT Info
00470 {
00472 WId win;
00474 long unsigned int state;
00476 bool isMinimized() const;
00477 bool isIconified() const;
00478 NET::MappingState mappingState;
00480 NETStrut strut;
00482 NET::WindowType windowType;
00484 QString visibleName;
00486 QString name;
00488 int desktop;
00490 bool onAllDesktops;
00492 pid_t pid;
00494 QRect geometry;
00496 QRect frameGeometry;
00497
00498 QString visibleNameWithState() const;
00499 };
00500
00505 static Info info( WId win ) KDE_DEPRECATED;
00506
00507 #ifdef KDE_NO_COMPAT
00508 private:
00509 #endif
00510
00514 static void appStarted() KDE_DEPRECATED;
00515 };
00516
00517
00522 class KDECORE_EXPORT KWin::WindowInfo
00523 {
00524 public:
00528 WindowInfo( WId window, unsigned long properties, unsigned long properties2 );
00529 WindowInfo();
00530 ~WindowInfo();
00537 bool valid( bool withdrawn_is_valid = false ) const;
00541 WId win() const;
00546 unsigned long state() const;
00552 bool hasState( unsigned long s ) const { return ( state() & s ) == s; }
00560 bool isMinimized() const;
00567 NET::MappingState mappingState() const;
00572 NETExtendedStrut extendedStrut() const;
00578 NETStrut strut() const;
00584 NET::WindowType windowType( int supported_types ) const;
00590 QString visibleName() const;
00600 QString visibleNameWithState() const;
00606 QString name() const;
00613 QString visibleIconName() const;
00624 QString visibleIconNameWithState() const;
00631 QString iconName() const;
00636 bool isOnCurrentDesktop() const;
00641 bool isOnDesktop( int desktop ) const;
00647 bool onAllDesktops() const;
00653 int desktop() const;
00658 QRect geometry() const;
00663 QRect frameGeometry() const;
00669 WId transientFor() const;
00674 WId groupLeader() const;
00675
00682 QCString windowClassClass() const;
00683
00690 QCString windowClassName() const;
00691
00697 QCString windowRole() const;
00698
00704 QCString clientMachine() const;
00705
00711 bool actionSupported( NET::Action action ) const;
00712
00713 WindowInfo( const WindowInfo& );
00714 WindowInfo& operator=( const WindowInfo& );
00715 private:
00716 WindowInfoPrivate* d;
00717 };
00718
00719 #endif //Q_OS_UNIX
00720
00721 #endif