2006-07-04 20:51:01 +00:00
|
|
|
/*****************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org>
|
|
|
|
|
|
|
|
You can Freely distribute this program under the GNU General Public
|
|
|
|
License. See the file "COPYING" for the exact licensing terms.
|
|
|
|
******************************************************************/
|
|
|
|
|
2007-04-10 13:02:08 +00:00
|
|
|
#ifndef KWIN_EFFECTSIMPL_H
|
|
|
|
#define KWIN_EFFECTSIMPL_H
|
2006-07-05 12:56:04 +00:00
|
|
|
|
2007-04-10 13:02:08 +00:00
|
|
|
#include "kwineffects.h"
|
2006-07-04 20:51:01 +00:00
|
|
|
|
2006-10-16 10:12:48 +00:00
|
|
|
#include "scene.h"
|
|
|
|
|
2007-04-10 13:02:08 +00:00
|
|
|
|
2007-01-05 16:45:56 +00:00
|
|
|
|
2007-04-05 12:07:35 +00:00
|
|
|
namespace KWin
|
2006-07-04 20:51:01 +00:00
|
|
|
{
|
|
|
|
|
2007-04-10 13:02:08 +00:00
|
|
|
class EffectsHandlerImpl : public EffectsHandler
|
|
|
|
{
|
2006-07-04 20:51:01 +00:00
|
|
|
public:
|
2007-04-10 13:02:08 +00:00
|
|
|
EffectsHandlerImpl(CompositingType type);
|
|
|
|
virtual ~EffectsHandlerImpl();
|
2006-10-24 19:17:48 +00:00
|
|
|
virtual void prePaintScreen( int* mask, QRegion* region, int time );
|
2006-10-16 10:12:48 +00:00
|
|
|
virtual void paintScreen( int mask, QRegion region, ScreenPaintData& data );
|
2006-10-29 19:07:10 +00:00
|
|
|
virtual void postPaintScreen();
|
2007-03-25 10:48:07 +00:00
|
|
|
virtual void prePaintWindow( EffectWindow* w, int* mask, QRegion* paint, QRegion* clip, int time );
|
2007-01-22 22:57:22 +00:00
|
|
|
virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data );
|
|
|
|
virtual void postPaintWindow( EffectWindow* w );
|
2007-02-04 22:19:17 +00:00
|
|
|
|
2007-04-10 13:02:08 +00:00
|
|
|
virtual void drawWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data );
|
2007-02-04 22:19:17 +00:00
|
|
|
|
2007-04-10 13:02:08 +00:00
|
|
|
virtual void activateWindow( EffectWindow* c );
|
|
|
|
|
|
|
|
virtual int currentDesktop() const;
|
2007-04-12 13:12:37 +00:00
|
|
|
virtual int numberOfDesktops() const;
|
2007-04-12 14:12:34 +00:00
|
|
|
virtual QString desktopName( int desktop ) const;
|
2007-04-10 13:02:08 +00:00
|
|
|
virtual int displayWidth() const;
|
|
|
|
virtual int displayHeight() const;
|
|
|
|
virtual QPoint cursorPos() const;
|
|
|
|
virtual EffectWindowList stackingOrder() const;
|
2007-04-12 14:12:34 +00:00
|
|
|
|
|
|
|
virtual void setTabBoxWindow(EffectWindow*);
|
|
|
|
virtual void setTabBoxDesktop(int);
|
|
|
|
virtual EffectWindowList currentTabBoxWindowList() const;
|
|
|
|
virtual void refTabBox();
|
|
|
|
virtual void unrefTabBox();
|
|
|
|
virtual void closeTabBox();
|
|
|
|
virtual QList< int > currentTabBoxDesktopList() const;
|
|
|
|
virtual int currentTabBoxDesktop() const;
|
|
|
|
virtual EffectWindow* currentTabBoxWindow() const;
|
|
|
|
|
2007-04-10 13:02:08 +00:00
|
|
|
virtual void addRepaintFull();
|
2007-04-10 15:38:36 +00:00
|
|
|
virtual void addRepaint( const QRect& r );
|
|
|
|
virtual void addRepaint( int x, int y, int w, int h );
|
2007-04-10 13:02:08 +00:00
|
|
|
virtual QRect clientArea( clientAreaOption opt, const QPoint& p, int desktop ) const;
|
2007-04-12 13:12:37 +00:00
|
|
|
virtual void calcDesktopLayout(int* x, int* y, Qt::Orientation* orientation) const;
|
|
|
|
virtual bool optionRollOverDesktops() const;
|
2007-04-10 13:02:08 +00:00
|
|
|
|
|
|
|
virtual Window createInputWindow( Effect* e, int x, int y, int w, int h, const QCursor& cursor );
|
|
|
|
virtual void destroyInputWindow( Window w );
|
|
|
|
virtual bool checkInputWindowEvent( XEvent* e );
|
|
|
|
virtual void checkInputWindowStacking();
|
|
|
|
|
|
|
|
virtual void checkElectricBorder(const QPoint &pos, Time time);
|
|
|
|
virtual void reserveElectricBorder( ElectricBorder border );
|
|
|
|
virtual void unreserveElectricBorder( ElectricBorder border );
|
|
|
|
virtual void reserveElectricBorderSwitching( bool reserve );
|
2007-04-10 15:38:36 +00:00
|
|
|
|
|
|
|
virtual unsigned long xrenderBufferPicture();
|
2007-04-10 18:47:13 +00:00
|
|
|
|
|
|
|
// internal (used by kwin core or compositing code)
|
|
|
|
virtual void startPaint();
|
|
|
|
virtual void windowUserMovedResized( EffectWindow* c, bool first, bool last );
|
|
|
|
virtual void windowOpacityChanged( EffectWindow* c, double old_opacity );
|
|
|
|
virtual void windowAdded( EffectWindow* c );
|
|
|
|
virtual void windowClosed( EffectWindow* c );
|
|
|
|
virtual void windowDeleted( EffectWindow* c );
|
|
|
|
virtual void windowActivated( EffectWindow* c );
|
|
|
|
virtual void windowMinimized( EffectWindow* c );
|
|
|
|
virtual void windowUnminimized( EffectWindow* c );
|
|
|
|
virtual void desktopChanged( int old );
|
|
|
|
virtual void windowDamaged( EffectWindow* w, const QRect& r );
|
|
|
|
virtual void windowGeometryShapeChanged( EffectWindow* w, const QRect& old );
|
|
|
|
virtual void tabBoxAdded( int mode );
|
|
|
|
virtual void tabBoxClosed();
|
|
|
|
virtual void tabBoxUpdated();
|
|
|
|
virtual bool borderActivated( ElectricBorder border );
|
|
|
|
|
|
|
|
void loadEffect( const QString& name );
|
|
|
|
void unloadEffect( const QString& name );
|
|
|
|
|
|
|
|
protected:
|
|
|
|
KLibrary* findEffectLibrary( const QString& effectname );
|
2007-04-10 13:02:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class EffectWindowImpl : public EffectWindow
|
|
|
|
{
|
2006-07-04 20:51:01 +00:00
|
|
|
public:
|
2007-04-10 13:02:08 +00:00
|
|
|
EffectWindowImpl();
|
|
|
|
virtual ~EffectWindowImpl();
|
|
|
|
|
|
|
|
virtual void enablePainting( int reason );
|
|
|
|
virtual void disablePainting( int reason );
|
2007-04-10 14:48:55 +00:00
|
|
|
virtual void addRepaint( const QRect& r );
|
|
|
|
virtual void addRepaint( int x, int y, int w, int h );
|
|
|
|
virtual void addRepaintFull();
|
2007-04-10 13:02:08 +00:00
|
|
|
|
2007-04-12 11:55:07 +00:00
|
|
|
virtual void refWindow();
|
|
|
|
virtual void unrefWindow();
|
2007-04-10 13:02:08 +00:00
|
|
|
virtual bool isDeleted() const;
|
|
|
|
|
|
|
|
virtual bool isOnAllDesktops() const;
|
|
|
|
virtual int desktop() const; // prefer isOnXXX()
|
|
|
|
virtual bool isMinimized() const;
|
2007-04-12 13:12:37 +00:00
|
|
|
virtual double opacity() const;
|
2007-04-10 13:02:08 +00:00
|
|
|
virtual QString caption() const;
|
2007-04-12 14:12:34 +00:00
|
|
|
virtual QPixmap icon() const;
|
2007-04-10 14:48:55 +00:00
|
|
|
virtual const EffectWindowGroup* group() const;
|
2007-04-10 13:02:08 +00:00
|
|
|
|
|
|
|
virtual int x() const;
|
|
|
|
virtual int y() const;
|
|
|
|
virtual int width() const;
|
|
|
|
virtual int height() const;
|
|
|
|
virtual QRect geometry() const;
|
|
|
|
virtual QPoint pos() const;
|
|
|
|
virtual QSize size() const;
|
|
|
|
virtual QRect rect() const;
|
2007-04-12 11:55:07 +00:00
|
|
|
virtual bool isUserMove() const;
|
|
|
|
virtual bool isUserResize() const;
|
|
|
|
virtual QRect iconGeometry() const;
|
2007-04-10 13:02:08 +00:00
|
|
|
|
|
|
|
virtual bool isDesktop() const;
|
|
|
|
virtual bool isDock() const;
|
|
|
|
virtual bool isToolbar() const;
|
|
|
|
virtual bool isTopMenu() const;
|
|
|
|
virtual bool isMenu() const;
|
|
|
|
virtual bool isNormalWindow() const; // normal as in 'NET::Normal or NET::Unknown non-transient'
|
|
|
|
virtual bool isSpecialWindow() const;
|
|
|
|
virtual bool isDialog() const;
|
|
|
|
virtual bool isSplash() const;
|
|
|
|
virtual bool isUtility() const;
|
|
|
|
virtual bool isDropdownMenu() const;
|
|
|
|
virtual bool isPopupMenu() const; // a context popup, not dropdown, not torn-off
|
|
|
|
virtual bool isTooltip() const;
|
|
|
|
virtual bool isNotification() const;
|
|
|
|
virtual bool isComboBox() const;
|
|
|
|
virtual bool isDNDIcon() const;
|
2007-02-04 22:19:17 +00:00
|
|
|
|
2007-04-12 13:12:37 +00:00
|
|
|
virtual bool isModal() const;
|
|
|
|
virtual EffectWindow* findModal();
|
|
|
|
virtual EffectWindowList mainWindows() const;
|
|
|
|
|
2007-04-11 15:46:46 +00:00
|
|
|
virtual QVector<Vertex>& vertices();
|
|
|
|
virtual void requestVertexGrid(int maxquadsize);
|
|
|
|
virtual void markVerticesDirty();
|
|
|
|
|
2007-01-22 22:57:22 +00:00
|
|
|
const Toplevel* window() const;
|
|
|
|
Toplevel* window();
|
2007-02-01 17:20:48 +00:00
|
|
|
|
2007-01-22 22:57:22 +00:00
|
|
|
void setWindow( Toplevel* w ); // internal
|
|
|
|
void setSceneWindow( Scene::Window* w ); // internal
|
|
|
|
Scene::Window* sceneWindow(); // internal
|
|
|
|
private:
|
2007-02-01 17:20:48 +00:00
|
|
|
Toplevel* toplevel;
|
2007-01-22 22:57:22 +00:00
|
|
|
Scene::Window* sw; // This one is used only during paint pass.
|
2007-04-10 13:02:08 +00:00
|
|
|
};
|
2007-01-22 22:57:22 +00:00
|
|
|
|
2007-04-10 14:48:55 +00:00
|
|
|
class EffectWindowGroupImpl
|
|
|
|
: public EffectWindowGroup
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
EffectWindowGroupImpl( Group* g );
|
|
|
|
virtual EffectWindowList members() const;
|
|
|
|
private:
|
|
|
|
Group* group;
|
|
|
|
};
|
|
|
|
|
|
|
|
inline
|
|
|
|
EffectWindowGroupImpl::EffectWindowGroupImpl( Group* g )
|
|
|
|
: group( g )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-01-22 22:57:22 +00:00
|
|
|
EffectWindow* effectWindow( Toplevel* w );
|
|
|
|
EffectWindow* effectWindow( Scene::Window* w );
|
|
|
|
|
2007-02-04 22:19:17 +00:00
|
|
|
|
2006-07-04 20:51:01 +00:00
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|