• Skip to content
  • Skip to link menu
KDE 4.2 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 buildQuads( EffectWindow* w, WindowQuadList& quadList );
00053 
00054         virtual void activateWindow( EffectWindow* c );
00055         virtual EffectWindow* activeWindow() const;
00056         virtual void moveWindow( EffectWindow* w, const QPoint& pos );
00057         virtual void windowToDesktop( EffectWindow* w, int desktop );
00058 
00059         virtual int currentDesktop() const;
00060         virtual int numberOfDesktops() const;
00061         virtual void setCurrentDesktop( int desktop );
00062         virtual QString desktopName( int desktop ) const;
00063         virtual int displayWidth() const;
00064         virtual int displayHeight() const;
00065         virtual QPoint cursorPos() const;
00066         virtual bool grabKeyboard( Effect* effect );
00067         virtual void ungrabKeyboard();
00068         virtual EffectWindow* findWindow( WId id ) const;
00069         virtual EffectWindowList stackingOrder() const;
00070         virtual void setElevatedWindow( EffectWindow* w, bool set );
00071 
00072         virtual void setTabBoxWindow(EffectWindow*);
00073         virtual void setTabBoxDesktop(int);
00074         virtual EffectWindowList currentTabBoxWindowList() const;
00075         virtual void refTabBox();
00076         virtual void unrefTabBox();
00077         virtual void closeTabBox();
00078         virtual QList< int > currentTabBoxDesktopList() const;
00079         virtual int currentTabBoxDesktop() const;
00080         virtual EffectWindow* currentTabBoxWindow() const;
00081 
00082         virtual void setActiveFullScreenEffect( Effect* e );
00083         virtual Effect* activeFullScreenEffect() const;
00084 
00085         virtual void pushRenderTarget(GLRenderTarget* target);
00086         virtual GLRenderTarget* popRenderTarget();
00087 
00088         virtual void addRepaintFull();
00089         virtual void addRepaint( const QRect& r );
00090         virtual void addRepaint( const QRegion& r );
00091         virtual void addRepaint( int x, int y, int w, int h );
00092         virtual int activeScreen() const;
00093         virtual int numScreens() const;
00094         virtual int screenNumber( const QPoint& pos ) const;
00095         virtual QRect clientArea( clientAreaOption, int screen, int desktop ) const;
00096         virtual QRect clientArea( clientAreaOption, const EffectWindow* c ) const;
00097         virtual QRect clientArea( clientAreaOption, const QPoint& p, int desktop ) const;
00098         virtual void calcDesktopLayout(int* x, int* y, Qt::Orientation* orientation) const;
00099         virtual bool optionRollOverDesktops() const;
00100         virtual int desktopToLeft( int desktop, bool wrap ) const;
00101         virtual int desktopToRight( int desktop, bool wrap ) const;
00102         virtual int desktopUp( int desktop, bool wrap ) const;
00103         virtual int desktopDown( int desktop, bool wrap ) const;
00104         virtual double animationTimeFactor() const;
00105         virtual WindowQuadType newWindowQuadType();
00106 
00107         virtual Window createInputWindow( Effect* e, int x, int y, int w, int h, const QCursor& cursor );
00108         using EffectsHandler::createInputWindow;
00109         virtual void destroyInputWindow( Window w );
00110         virtual bool checkInputWindowEvent( XEvent* e );
00111         virtual void checkInputWindowStacking();
00112 
00113         virtual void checkElectricBorder(const QPoint &pos, Time time);
00114         virtual void reserveElectricBorder( ElectricBorder border );
00115         virtual void unreserveElectricBorder( ElectricBorder border );
00116         virtual void reserveElectricBorderSwitching( bool reserve );
00117 
00118         virtual unsigned long xrenderBufferPicture();
00119         virtual void reconfigure();
00120         virtual void registerPropertyType( long atom, bool reg );
00121 
00122         virtual bool hasDecorationShadows() const;
00123         virtual QList< QList<QImage> > shadowTextures();
00124         virtual int shadowTextureList( ShadowType type ) const;
00125 
00126         // internal (used by kwin core or compositing code)
00127         void startPaint();
00128         void windowUserMovedResized( EffectWindow* c, bool first, bool last );
00129         void windowOpacityChanged( EffectWindow* c, double old_opacity );
00130         void windowAdded( EffectWindow* c );
00131         void windowClosed( EffectWindow* c );
00132         void windowDeleted( EffectWindow* c );
00133         void windowActivated( EffectWindow* c );
00134         void windowMinimized( EffectWindow* c );
00135         void windowUnminimized( EffectWindow* c );
00136         void desktopChanged( int old );
00137         void windowDamaged( EffectWindow* w, const QRect& r );
00138         void windowGeometryShapeChanged( EffectWindow* w, const QRect& old );
00139         void tabBoxAdded( int mode );
00140         void tabBoxClosed();
00141         void tabBoxUpdated();
00142         bool borderActivated( ElectricBorder border );
00143         void mouseChanged( const QPoint& pos, const QPoint& oldpos,
00144             Qt::MouseButtons buttons, Qt::MouseButtons oldbuttons,
00145             Qt::KeyboardModifiers modifiers, Qt::KeyboardModifiers oldmodifiers );
00146         void grabbedKeyboardEvent( QKeyEvent* e );
00147         bool hasKeyboardGrab() const;
00148         void propertyNotify( EffectWindow* c, long atom );
00149 
00150         bool loadEffect( const QString& name );
00151         void toggleEffect( const QString& name );
00152         void unloadEffect( const QString& name );
00153         void reconfigureEffect( const QString& name );
00154         bool isEffectLoaded( const QString& name );
00155         QStringList loadedEffects() const;
00156         QStringList listOfEffects() const;
00157 
00158         QList<EffectWindow*> elevatedWindows() const;
00159 
00160     protected:
00161         KLibrary* findEffectLibrary( KService* service );
00162         void effectsChanged();
00163 
00164         Effect* keyboard_grab_effect;
00165         QStack<GLRenderTarget*> render_targets;
00166         Effect* fullscreen_effect;
00167         QList<EffectWindow*> elevated_windows;
00168         QMultiMap< int, EffectPair > effect_order;
00169         QHash< long, int > registered_atoms;
00170         int next_window_quad_type;
00171 };
00172 
00173 class EffectWindowImpl : public EffectWindow
00174 {
00175     public:
00176         EffectWindowImpl();
00177         virtual ~EffectWindowImpl();
00178 
00179         virtual void enablePainting( int reason );
00180         virtual void disablePainting( int reason );
00181         virtual bool isPaintingEnabled();
00182         virtual void addRepaint( const QRect& r );
00183         virtual void addRepaint( int x, int y, int w, int h );
00184         virtual void addRepaintFull();
00185 
00186         virtual void refWindow();
00187         virtual void unrefWindow();
00188         virtual bool isDeleted() const;
00189 
00190         virtual bool isOnAllDesktops() const;
00191         virtual int desktop() const; // prefer isOnXXX()
00192         virtual bool isMinimized() const;
00193         virtual double opacity() const;
00194         virtual QString caption() const;
00195         virtual QPixmap icon() const;
00196         virtual QString windowClass() const;
00197         virtual QString windowRole() const;
00198         virtual const EffectWindowGroup* group() const;
00199 
00200         virtual int x() const;
00201         virtual int y() const;
00202         virtual int width() const;
00203         virtual int height() const;
00204         virtual QRect geometry() const;
00205         virtual QRegion shape() const;
00206         virtual int screen() const;
00207         virtual bool hasOwnShape() const;
00208         virtual QPoint pos() const;
00209         virtual QSize size() const;
00210         virtual QRect rect() const;
00211         virtual bool isMovable() const;
00212         virtual bool isMovableAcrossScreens() const;
00213         virtual bool isUserMove() const;
00214         virtual bool isUserResize() const;
00215         virtual QRect iconGeometry() const;
00216         virtual QRect contentsRect() const;
00217         virtual QByteArray readProperty( long atom, long type, int format ) const;
00218 
00219         virtual bool isDesktop() const;
00220         virtual bool isDock() const;
00221         virtual bool isToolbar() const;
00222         virtual bool isTopMenu() const;
00223         virtual bool isMenu() const;
00224         virtual bool isNormalWindow() const; // normal as in 'NET::Normal or NET::Unknown non-transient'
00225         virtual bool isSpecialWindow() const;
00226         virtual bool isDialog() const;
00227         virtual bool isSplash() const;
00228         virtual bool isUtility() const;
00229         virtual bool isDropdownMenu() const;
00230         virtual bool isPopupMenu() const; // a context popup, not dropdown, not torn-off
00231         virtual bool isTooltip() const;
00232         virtual bool isNotification() const;
00233         virtual bool isComboBox() const;
00234         virtual bool isDNDIcon() const;
00235         virtual bool isManaged() const; // managed or override-redirect
00236 
00237         virtual bool isModal() const;
00238         virtual EffectWindow* findModal();
00239         virtual EffectWindowList mainWindows() const;
00240 
00241         virtual QList<QRect> shadowQuads( ShadowType type ) const;
00242         virtual double shadowOpacity( ShadowType type ) const;
00243         virtual double shadowBrightness( ShadowType type ) const;
00244         virtual double shadowSaturation( ShadowType type ) const;
00245 
00246         virtual WindowQuadList buildQuads( bool force = false ) const;
00247 
00248         const Toplevel* window() const;
00249         Toplevel* window();
00250 
00251         void setWindow( Toplevel* w ); // internal
00252         void setSceneWindow( Scene::Window* w ); // internal
00253         const Scene::Window* sceneWindow() const; // internal
00254         Scene::Window* sceneWindow(); // internal
00255     private:
00256         Toplevel* toplevel;
00257         Scene::Window* sw; // This one is used only during paint pass.
00258 };
00259 
00260 class EffectWindowGroupImpl
00261     : public EffectWindowGroup
00262     {
00263     public:
00264         EffectWindowGroupImpl( Group* g );
00265         virtual EffectWindowList members() const;
00266     private:
00267         Group* group;
00268     };
00269 
00270 
00271 inline
00272 QList<EffectWindow*> EffectsHandlerImpl::elevatedWindows() const
00273     {
00274     return elevated_windows;
00275     }
00276 
00277 
00278 inline
00279 EffectWindowGroupImpl::EffectWindowGroupImpl( Group* g )
00280     : group( g )
00281     {
00282     }
00283 
00284 EffectWindow* effectWindow( Toplevel* w );
00285 EffectWindow* effectWindow( Scene::Window* w );
00286 
00287 inline
00288 const Scene::Window* EffectWindowImpl::sceneWindow() const
00289     {
00290     return sw;
00291     }
00292 
00293 inline
00294 Scene::Window* EffectWindowImpl::sceneWindow()
00295     {
00296     return sw;
00297     }
00298 
00299 inline
00300 const Toplevel* EffectWindowImpl::window() const
00301     {
00302     return toplevel;
00303     }
00304 
00305 inline
00306 Toplevel* EffectWindowImpl::window()
00307     {
00308     return toplevel;
00309     }
00310 
00311 
00312 } // namespace
00313 
00314 #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
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.7
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