2007-11-27 19:40:25 +00:00
|
|
|
/********************************************************************
|
2007-04-29 17:35:43 +00:00
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org>
|
|
|
|
|
2007-11-27 19:40:25 +00:00
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#ifndef KWIN_EFFECTSIMPL_H
|
|
|
|
#define KWIN_EFFECTSIMPL_H
|
|
|
|
|
|
|
|
#include "kwineffects.h"
|
|
|
|
|
|
|
|
#include "scene.h"
|
|
|
|
|
|
|
|
#include <QStack>
|
2007-07-06 12:38:41 +00:00
|
|
|
#include <QMap>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
|
2007-07-06 12:38:41 +00:00
|
|
|
class KService;
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
class EffectsHandlerImpl : public EffectsHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
EffectsHandlerImpl(CompositingType type);
|
|
|
|
virtual ~EffectsHandlerImpl();
|
2007-07-07 14:01:32 +00:00
|
|
|
virtual void prePaintScreen( ScreenPrePaintData& data, int time );
|
2007-04-29 17:35:43 +00:00
|
|
|
virtual void paintScreen( int mask, QRegion region, ScreenPaintData& data );
|
|
|
|
virtual void postPaintScreen();
|
2007-07-07 14:01:32 +00:00
|
|
|
virtual void prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time );
|
2007-04-29 17:35:43 +00:00
|
|
|
virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data );
|
|
|
|
virtual void postPaintWindow( EffectWindow* w );
|
|
|
|
|
|
|
|
virtual void drawWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data );
|
|
|
|
|
|
|
|
virtual void activateWindow( EffectWindow* c );
|
|
|
|
virtual EffectWindow* activeWindow() const;
|
|
|
|
virtual void moveWindow( EffectWindow* w, const QPoint& pos );
|
|
|
|
virtual void windowToDesktop( EffectWindow* w, int desktop );
|
|
|
|
|
|
|
|
virtual int currentDesktop() const;
|
|
|
|
virtual int numberOfDesktops() const;
|
|
|
|
virtual void setCurrentDesktop( int desktop );
|
|
|
|
virtual QString desktopName( int desktop ) const;
|
|
|
|
virtual int displayWidth() const;
|
|
|
|
virtual int displayHeight() const;
|
|
|
|
virtual QPoint cursorPos() const;
|
|
|
|
virtual bool grabKeyboard( Effect* effect );
|
|
|
|
virtual void ungrabKeyboard();
|
|
|
|
virtual EffectWindowList stackingOrder() const;
|
2007-05-24 14:41:56 +00:00
|
|
|
virtual void setElevatedWindow( EffectWindow* w, bool set );
|
2007-04-29 17:35:43 +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-11-01 17:47:41 +00:00
|
|
|
virtual void setActiveFullScreenEffect( Effect* e );
|
|
|
|
virtual Effect* activeFullScreenEffect() const;
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
virtual void pushRenderTarget(GLRenderTarget* target);
|
|
|
|
virtual GLRenderTarget* popRenderTarget();
|
|
|
|
|
|
|
|
virtual void addRepaintFull();
|
|
|
|
virtual void addRepaint( const QRect& r );
|
|
|
|
virtual void addRepaint( int x, int y, int w, int h );
|
2007-11-20 18:58:30 +00:00
|
|
|
virtual int activeScreen() const;
|
|
|
|
virtual QRect clientArea( clientAreaOption, int screen, int desktop ) const;
|
|
|
|
virtual QRect clientArea( clientAreaOption, const EffectWindow* c ) const;
|
|
|
|
virtual QRect clientArea( clientAreaOption, const QPoint& p, int desktop ) const;
|
2007-04-29 17:35:43 +00:00
|
|
|
virtual void calcDesktopLayout(int* x, int* y, Qt::Orientation* orientation) const;
|
|
|
|
virtual bool optionRollOverDesktops() const;
|
2007-11-20 16:17:08 +00:00
|
|
|
virtual int desktopToLeft( int desktop, bool wrap ) const;
|
|
|
|
virtual int desktopToRight( int desktop, bool wrap ) const;
|
|
|
|
virtual int desktopUp( int desktop, bool wrap ) const;
|
|
|
|
virtual int desktopDown( int desktop, bool wrap ) const;
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
virtual Window createInputWindow( Effect* e, int x, int y, int w, int h, const QCursor& cursor );
|
2007-11-20 16:19:06 +00:00
|
|
|
using EffectsHandler::createInputWindow;
|
2007-04-29 17:35:43 +00:00
|
|
|
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 );
|
|
|
|
|
|
|
|
virtual unsigned long xrenderBufferPicture();
|
2007-05-28 11:23:00 +00:00
|
|
|
virtual void reconfigure();
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
// internal (used by kwin core or compositing code)
|
|
|
|
void startPaint();
|
|
|
|
void windowUserMovedResized( EffectWindow* c, bool first, bool last );
|
2007-09-03 15:00:43 +00:00
|
|
|
void windowOpacityChanged( EffectWindow* c, double old_opacity );
|
2007-04-29 17:35:43 +00:00
|
|
|
void windowAdded( EffectWindow* c );
|
|
|
|
void windowClosed( EffectWindow* c );
|
|
|
|
void windowDeleted( EffectWindow* c );
|
|
|
|
void windowActivated( EffectWindow* c );
|
|
|
|
void windowMinimized( EffectWindow* c );
|
|
|
|
void windowUnminimized( EffectWindow* c );
|
|
|
|
void desktopChanged( int old );
|
|
|
|
void windowDamaged( EffectWindow* w, const QRect& r );
|
|
|
|
void windowGeometryShapeChanged( EffectWindow* w, const QRect& old );
|
|
|
|
void tabBoxAdded( int mode );
|
|
|
|
void tabBoxClosed();
|
|
|
|
void tabBoxUpdated();
|
|
|
|
bool borderActivated( ElectricBorder border );
|
|
|
|
void mouseChanged( const QPoint& pos, const QPoint& old,
|
|
|
|
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers );
|
|
|
|
void grabbedKeyboardEvent( QKeyEvent* e );
|
|
|
|
bool hasKeyboardGrab() const;
|
|
|
|
|
2007-07-20 21:13:10 +00:00
|
|
|
bool loadEffect( const QString& name );
|
2007-04-29 17:35:43 +00:00
|
|
|
void toggleEffect( const QString& name );
|
|
|
|
void unloadEffect( const QString& name );
|
2007-05-29 11:42:47 +00:00
|
|
|
void reloadEffect( const QString& name );
|
|
|
|
bool isEffectLoaded( const QString& name );
|
|
|
|
|
2007-05-24 14:41:56 +00:00
|
|
|
ToplevelList elevatedWindows() const;
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
protected:
|
2007-07-06 12:38:41 +00:00
|
|
|
KLibrary* findEffectLibrary( KService* service );
|
|
|
|
void effectsChanged();
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
Effect* keyboard_grab_effect;
|
|
|
|
QStack<GLRenderTarget*> render_targets;
|
2007-11-01 17:47:41 +00:00
|
|
|
Effect* fullscreen_effect;
|
2007-05-24 14:41:56 +00:00
|
|
|
ToplevelList elevated_windows;
|
2007-07-06 12:38:41 +00:00
|
|
|
QMultiMap< int, EffectPair > effect_order;
|
2007-04-29 17:35:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class EffectWindowImpl : public EffectWindow
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
EffectWindowImpl();
|
|
|
|
virtual ~EffectWindowImpl();
|
|
|
|
|
|
|
|
virtual void enablePainting( int reason );
|
|
|
|
virtual void disablePainting( int reason );
|
|
|
|
virtual bool isPaintingEnabled();
|
|
|
|
virtual void addRepaint( const QRect& r );
|
|
|
|
virtual void addRepaint( int x, int y, int w, int h );
|
|
|
|
virtual void addRepaintFull();
|
|
|
|
|
|
|
|
virtual void refWindow();
|
|
|
|
virtual void unrefWindow();
|
|
|
|
virtual bool isDeleted() const;
|
|
|
|
|
|
|
|
virtual bool isOnAllDesktops() const;
|
|
|
|
virtual int desktop() const; // prefer isOnXXX()
|
|
|
|
virtual bool isMinimized() const;
|
2007-09-03 15:00:43 +00:00
|
|
|
virtual double opacity() const;
|
2007-04-29 17:35:43 +00:00
|
|
|
virtual QString caption() const;
|
|
|
|
virtual QPixmap icon() const;
|
|
|
|
virtual QString windowClass() const;
|
2007-11-13 19:59:53 +00:00
|
|
|
virtual QString windowRole() const;
|
2007-04-29 17:35:43 +00:00
|
|
|
virtual const EffectWindowGroup* group() const;
|
|
|
|
|
|
|
|
virtual int x() const;
|
|
|
|
virtual int y() const;
|
|
|
|
virtual int width() const;
|
|
|
|
virtual int height() const;
|
|
|
|
virtual QRect geometry() const;
|
2007-12-07 18:03:24 +00:00
|
|
|
virtual QRegion shape() const;
|
2007-04-29 17:35:43 +00:00
|
|
|
virtual QPoint pos() const;
|
|
|
|
virtual QSize size() const;
|
|
|
|
virtual QRect rect() const;
|
|
|
|
virtual bool isMovable() const;
|
|
|
|
virtual bool isUserMove() const;
|
|
|
|
virtual bool isUserResize() const;
|
|
|
|
virtual QRect iconGeometry() const;
|
2007-07-19 13:32:46 +00:00
|
|
|
virtual QRect contentsRect() const;
|
2007-04-29 17:35:43 +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;
|
|
|
|
|
|
|
|
virtual bool isModal() const;
|
|
|
|
virtual EffectWindow* findModal();
|
|
|
|
virtual EffectWindowList mainWindows() const;
|
|
|
|
|
2007-08-08 14:42:06 +00:00
|
|
|
virtual WindowQuadList buildQuads() const;
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
const Toplevel* window() const;
|
|
|
|
Toplevel* window();
|
|
|
|
|
|
|
|
void setWindow( Toplevel* w ); // internal
|
|
|
|
void setSceneWindow( Scene::Window* w ); // internal
|
2007-08-08 14:42:06 +00:00
|
|
|
const Scene::Window* sceneWindow() const; // internal
|
2007-04-29 17:35:43 +00:00
|
|
|
Scene::Window* sceneWindow(); // internal
|
|
|
|
private:
|
|
|
|
Toplevel* toplevel;
|
|
|
|
Scene::Window* sw; // This one is used only during paint pass.
|
|
|
|
};
|
|
|
|
|
|
|
|
class EffectWindowGroupImpl
|
|
|
|
: public EffectWindowGroup
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
EffectWindowGroupImpl( Group* g );
|
|
|
|
virtual EffectWindowList members() const;
|
|
|
|
private:
|
|
|
|
Group* group;
|
|
|
|
};
|
|
|
|
|
2007-05-24 14:41:56 +00:00
|
|
|
|
|
|
|
inline
|
|
|
|
ToplevelList EffectsHandlerImpl::elevatedWindows() const
|
|
|
|
{
|
|
|
|
return elevated_windows;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
inline
|
|
|
|
EffectWindowGroupImpl::EffectWindowGroupImpl( Group* g )
|
|
|
|
: group( g )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
EffectWindow* effectWindow( Toplevel* w );
|
|
|
|
EffectWindow* effectWindow( Scene::Window* w );
|
|
|
|
|
2007-08-08 14:42:06 +00:00
|
|
|
inline
|
|
|
|
const Scene::Window* EffectWindowImpl::sceneWindow() const
|
|
|
|
{
|
|
|
|
return sw;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
Scene::Window* EffectWindowImpl::sceneWindow()
|
|
|
|
{
|
|
|
|
return sw;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
const Toplevel* EffectWindowImpl::window() const
|
|
|
|
{
|
|
|
|
return toplevel;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
Toplevel* EffectWindowImpl::window()
|
|
|
|
{
|
|
|
|
return toplevel;
|
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|