KDEUI
kwindowsystem.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 1999 Matthias Ettrich (ettrich@kde.org) 00003 Copyright (C) 2007 Lubos Lunak (l.lunak@kde.org) 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 /* 00021 * kwindowsystem.h. Part of the KDE project. 00022 */ 00023 00024 #ifndef KWINDOWSYSTEM_H 00025 #define KWINDOWSYSTEM_H 00026 00027 #include <kdeui_export.h> 00028 #include <QtCore/QObject> 00029 #include <QtGui/QWidgetList> //For WId 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 00497 static void allowExternalProcessWindowActivation( int pid = -1 ); 00498 00499 #ifdef Q_WS_X11 00500 00504 static bool mapViewport(); 00509 static int viewportToDesktop( const QPoint& pos ); 00514 static int viewportWindowToDesktop( const QRect& r ); 00519 static QPoint desktopToViewport( int desktop, bool absolute ); 00526 static QPoint constrainViewportRelativePosition( const QPoint& pos ); 00527 #endif 00528 00529 Q_SIGNALS: 00530 00535 void currentDesktopChanged( int desktop); 00536 00541 void windowAdded(WId id); 00542 00547 void windowRemoved(WId id); 00548 00553 void activeWindowChanged(WId id); 00554 00558 void desktopNamesChanged(); 00559 00564 void numberOfDesktopsChanged(int num); 00565 00569 void workAreaChanged(); 00570 00576 void strutChanged(); 00577 00582 void stackingOrderChanged(); 00583 00594 void windowChanged(WId id, const unsigned long* properties ); 00595 00605 void windowChanged(WId id, unsigned int properties); 00606 00611 void windowChanged(WId id); 00612 00616 void showingDesktopChanged( bool showing ); 00617 00618 protected: 00619 virtual void connectNotify( const char* signal ); 00620 00621 private: 00622 friend class KWindowSystemStaticContainer; 00623 00624 KWindowSystem() {} 00625 00626 enum { INFO_BASIC=1, // desktop info, not per-window 00627 INFO_WINDOWS=2 }; // also per-window info 00628 00629 static void init(int); 00630 00631 friend class KWindowSystemPrivate; 00632 static KWindowSystemPrivate* s_d_func(); 00633 }; 00634 00635 #endif
KDE 4.6 API Reference