• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

KWin

effects.h

Go to the documentation of this file.
00001 /********************************************************************
00002  KWin - the KDE window manager
00003  This file is part of the KDE project.
00004 
00005 Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org>
00006 
00007 This program is free software; you can redistribute it and/or modify
00008 it under the terms of the GNU General Public License as published by
00009 the Free Software Foundation; either version 2 of the License, or
00010 (at your option) any later version.
00011 
00012 This program is distributed in the hope that it will be useful,
00013 but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with this program.  If not, see <http://www.gnu.org/licenses/>.
00019 *********************************************************************/
00020 
00021 #ifndef KWIN_EFFECTSIMPL_H
00022 #define KWIN_EFFECTSIMPL_H
00023 
00024 #include "kwineffects.h"
00025 
00026 #include "scene.h"
00027 
00028 #include <QStack>
00029 #include <QMap>
00030 
00031 
00032 class KService;
00033 
00034 
00035 namespace KWin
00036 {
00037 
00038 class EffectsHandlerImpl : public EffectsHandler
00039 {
00040     public:
00041         EffectsHandlerImpl(CompositingType type);
00042         virtual ~EffectsHandlerImpl();
00043         virtual void prePaintScreen( ScreenPrePaintData& data, int time );
00044         virtual void paintScreen( int mask, QRegion region, ScreenPaintData& data );
00045         virtual void postPaintScreen();
00046         virtual void prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time );
00047         virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data );
00048         virtual void postPaintWindow( EffectWindow* w );
00049 
00050         virtual void drawWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data );
00051 
00052         virtual void activateWindow( EffectWindow* c );
00053         virtual EffectWindow* activeWindow() const;
00054         virtual void moveWindow( EffectWindow* w, const QPoint& pos );
00055         virtual void windowToDesktop( EffectWindow* w, int desktop );
00056 
00057         virtual int currentDesktop() const;
00058         virtual int numberOfDesktops() const;
00059         virtual void setCurrentDesktop( int desktop );
00060         virtual QString desktopName( int desktop ) const;
00061         virtual int displayWidth() const;
00062         virtual int displayHeight() const;
00063         virtual QPoint cursorPos() const;
00064         virtual bool grabKeyboard( Effect* effect );
00065         virtual void ungrabKeyboard();
00066         virtual EffectWindow* findWindow( WId id ) const;
00067         virtual EffectWindowList stackingOrder() const;
00068         virtual void setElevatedWindow( EffectWindow* w, bool set );
00069 
00070         virtual void setTabBoxWindow(EffectWindow*);
00071         virtual void setTabBoxDesktop(int);
00072         virtual EffectWindowList currentTabBoxWindowList() const;
00073         virtual void refTabBox();
00074         virtual void unrefTabBox();
00075         virtual void closeTabBox();
00076         virtual QList< int > currentTabBoxDesktopList() const;
00077         virtual int currentTabBoxDesktop() const;
00078         virtual EffectWindow* currentTabBoxWindow() const;
00079 
00080         virtual void setActiveFullScreenEffect( Effect* e );
00081         virtual Effect* activeFullScreenEffect() const;
00082 
00083         virtual void pushRenderTarget(GLRenderTarget* target);
00084         virtual GLRenderTarget* popRenderTarget();
00085 
00086         virtual void addRepaintFull();
00087         virtual void addRepaint( const QRect& r );
00088         virtual void addRepaint( const QRegion& r );
00089         virtual void addRepaint( int x, int y, int w, int h );
00090         virtual int activeScreen() const;
00091         virtual int numScreens() const;
00092         virtual int screenNumber( const QPoint& pos ) const;
00093         virtual QRect clientArea( clientAreaOption, int screen, int desktop ) const;
00094         virtual QRect clientArea( clientAreaOption, const EffectWindow* c ) const;
00095         virtual QRect clientArea( clientAreaOption, const QPoint& p, int desktop ) const;
00096         virtual void calcDesktopLayout(int* x, int* y, Qt::Orientation* orientation) const;
00097         virtual bool optionRollOverDesktops() const;
00098         virtual int desktopToLeft( int desktop, bool wrap ) const;
00099         virtual int desktopToRight( int desktop, bool wrap ) const;
00100         virtual int desktopUp( int desktop, bool wrap ) const;
00101         virtual int desktopDown( int desktop, bool wrap ) const;
00102 
00103         virtual Window createInputWindow( Effect* e, int x, int y, int w, int h, const QCursor& cursor );
00104         using EffectsHandler::createInputWindow;
00105         virtual void destroyInputWindow( Window w );
00106         virtual bool checkInputWindowEvent( XEvent* e );
00107         virtual void checkInputWindowStacking();
00108 
00109         virtual void checkElectricBorder(const QPoint &pos, Time time);
00110         virtual void reserveElectricBorder( ElectricBorder border );
00111         virtual void unreserveElectricBorder( ElectricBorder border );
00112         virtual void reserveElectricBorderSwitching( bool reserve );
00113 
00114         virtual unsigned long xrenderBufferPicture();
00115         virtual void reconfigure();
00116         virtual void registerPropertyType( long atom, bool reg );
00117 
00118         // internal (used by kwin core or compositing code)
00119         void startPaint();
00120         void windowUserMovedResized( EffectWindow* c, bool first, bool last );
00121         void windowOpacityChanged( EffectWindow* c, double old_opacity );
00122         void windowAdded( EffectWindow* c );
00123         void windowClosed( EffectWindow* c );
00124         void windowDeleted( EffectWindow* c );
00125         void windowActivated( EffectWindow* c );
00126         void windowMinimized( EffectWindow* c );
00127         void windowUnminimized( EffectWindow* c );
00128         void desktopChanged( int old );
00129         void windowDamaged( EffectWindow* w, const QRect& r );
00130         void windowGeometryShapeChanged( EffectWindow* w, const QRect& old );
00131         void tabBoxAdded( int mode );
00132         void tabBoxClosed();
00133         void tabBoxUpdated();
00134         bool borderActivated( ElectricBorder border );
00135         void mouseChanged( const QPoint& pos, const QPoint& oldpos,
00136             Qt::MouseButtons buttons, Qt::MouseButtons oldbuttons,
00137             Qt::KeyboardModifiers modifiers, Qt::KeyboardModifiers oldmodifiers );
00138         void grabbedKeyboardEvent( QKeyEvent* e );
00139         bool hasKeyboardGrab() const;
00140         void propertyNotify( EffectWindow* c, long atom );
00141 
00142         bool loadEffect( const QString& name );
00143         void toggleEffect( const QString& name );
00144         void unloadEffect( const QString& name );
00145         void reloadEffect( const QString& name );
00146         bool isEffectLoaded( const QString& name );
00147         QStringList loadedEffects() const;
00148         QStringList listOfEffects() const;
00149 
00150         QList<EffectWindow*> elevatedWindows() const;
00151 
00152     protected:
00153         KLibrary* findEffectLibrary( KService* service );
00154         void effectsChanged();
00155 
00156         Effect* keyboard_grab_effect;
00157         QStack<GLRenderTarget*> render_targets;
00158         Effect* fullscreen_effect;
00159         QList<EffectWindow*> elevated_windows;
00160         QMultiMap< int, EffectPair > effect_order;
00161         QHash< long, int > registered_atoms;
00162 };
00163 
00164 class EffectWindowImpl : public EffectWindow
00165 {
00166     public:
00167         EffectWindowImpl();
00168         virtual ~EffectWindowImpl();
00169 
00170         virtual void enablePainting( int reason );
00171         virtual void disablePainting( int reason );
00172         virtual bool isPaintingEnabled();
00173         virtual void addRepaint( const QRect& r );
00174         virtual void addRepaint( int x, int y, int w, int h );
00175         virtual void addRepaintFull();
00176 
00177         virtual void refWindow();
00178         virtual void unrefWindow();
00179         virtual bool isDeleted() const;
00180 
00181         virtual bool isOnAllDesktops() const;
00182         virtual int desktop() const; // prefer isOnXXX()
00183         virtual bool isMinimized() const;
00184         virtual double opacity() const;
00185         virtual QString caption() const;
00186         virtual QPixmap icon() const;
00187         virtual QString windowClass() const;
00188         virtual QString windowRole() const;
00189         virtual const EffectWindowGroup* group() const;
00190 
00191         virtual int x() const;
00192         virtual int y() const;
00193         virtual int width() const;
00194         virtual int height() const;
00195         virtual QRect geometry() const;
00196         virtual QRegion shape() const;
00197         virtual int screen() const;
00198         virtual bool hasOwnShape() const;
00199         virtual QPoint pos() const;
00200         virtual QSize size() const;
00201         virtual QRect rect() const;
00202         virtual bool isMovable() const;
00203         virtual bool isUserMove() const;
00204         virtual bool isUserResize() const;
00205         virtual QRect iconGeometry() const;
00206         virtual QRect contentsRect() const;
00207         virtual QByteArray readProperty( long atom, long type, int format ) const;
00208 
00209         virtual bool isDesktop() const;
00210         virtual bool isDock() const;
00211         virtual bool isToolbar() const;
00212         virtual bool isTopMenu() const;
00213         virtual bool isMenu() const;
00214         virtual bool isNormalWindow() const; // normal as in 'NET::Normal or NET::Unknown non-transient'
00215         virtual bool isSpecialWindow() const;
00216         virtual bool isDialog() const;
00217         virtual bool isSplash() const;
00218         virtual bool isUtility() const;
00219         virtual bool isDropdownMenu() const;
00220         virtual bool isPopupMenu() const; // a context popup, not dropdown, not torn-off
00221         virtual bool isTooltip() const;
00222         virtual bool isNotification() const;
00223         virtual bool isComboBox() const;
00224         virtual bool isDNDIcon() const;
00225         virtual bool isManaged() const; // managed or override-redirect
00226 
00227         virtual bool isModal() const;
00228         virtual EffectWindow* findModal();
00229         virtual EffectWindowList mainWindows() const;
00230 
00231         virtual WindowQuadList buildQuads() const;
00232 
00233         const Toplevel* window() const;
00234         Toplevel* window();
00235 
00236         void setWindow( Toplevel* w ); // internal
00237         void setSceneWindow( Scene::Window* w ); // internal
00238         const Scene::Window* sceneWindow() const; // internal
00239         Scene::Window* sceneWindow(); // internal
00240     private:
00241         Toplevel* toplevel;
00242         Scene::Window* sw; // This one is used only during paint pass.
00243 };
00244 
00245 class EffectWindowGroupImpl
00246     : public EffectWindowGroup
00247     {
00248     public:
00249         EffectWindowGroupImpl( Group* g );
00250         virtual EffectWindowList members() const;
00251     private:
00252         Group* group;
00253     };
00254 
00255 
00256 inline
00257 QList<EffectWindow*> EffectsHandlerImpl::elevatedWindows() const
00258     {
00259     return elevated_windows;
00260     }
00261 
00262 
00263 inline
00264 EffectWindowGroupImpl::EffectWindowGroupImpl( Group* g )
00265     : group( g )
00266     {
00267     }
00268 
00269 EffectWindow* effectWindow( Toplevel* w );
00270 EffectWindow* effectWindow( Scene::Window* w );
00271 
00272 inline
00273 const Scene::Window* EffectWindowImpl::sceneWindow() const
00274     {
00275     return sw;
00276     }
00277 
00278 inline
00279 Scene::Window* EffectWindowImpl::sceneWindow()
00280     {
00281     return sw;
00282     }
00283 
00284 inline
00285 const Toplevel* EffectWindowImpl::window() const
00286     {
00287     return toplevel;
00288     }
00289 
00290 inline
00291 Toplevel* EffectWindowImpl::window()
00292     {
00293     return toplevel;
00294     }
00295 
00296 
00297 } // namespace
00298 
00299 #endif

KWin

Skip menu "KWin"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libplasma
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal