2007-01-12 14:14:53 +00:00
|
|
|
/*****************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2007 Rivo Laks <rivolaks@hot.ee>
|
|
|
|
|
|
|
|
You can Freely distribute this program under the GNU General Public
|
|
|
|
License. See the file "COPYING" for the exact licensing terms.
|
|
|
|
******************************************************************/
|
|
|
|
|
|
|
|
#ifndef KWIN_PRESENTWINDOWS_H
|
|
|
|
#define KWIN_PRESENTWINDOWS_H
|
|
|
|
|
|
|
|
// Include with base class for effects.
|
|
|
|
#include <effects.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace KWinInternal
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Expose-like effect which shows all windows on current desktop side-by-side,
|
|
|
|
* letting the user select active window.
|
|
|
|
**/
|
|
|
|
class PresentWindowsEffect
|
|
|
|
: public QObject, public Effect
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2007-02-04 22:19:17 +00:00
|
|
|
PresentWindowsEffect();
|
2007-01-12 14:14:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
virtual void prePaintScreen( int* mask, QRegion* region, int time );
|
2007-01-22 22:57:22 +00:00
|
|
|
virtual void prePaintWindow( EffectWindow* w, int* mask, QRegion* region, int time );
|
|
|
|
virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data );
|
2007-01-12 14:14:53 +00:00
|
|
|
virtual void postPaintScreen();
|
|
|
|
|
2007-01-22 22:57:22 +00:00
|
|
|
virtual void windowClosed( EffectWindow* c );
|
|
|
|
virtual void windowActivated( EffectWindow* c );
|
2007-01-12 14:14:53 +00:00
|
|
|
virtual void windowInputMouseEvent( Window w, QEvent* e );
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void setActive(bool active);
|
|
|
|
void toggleActive() { setActive(!mActivated); }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// Updates window tranformations, i.e. destination pos and scale of the window
|
|
|
|
void rearrangeWindows();
|
|
|
|
void calculateWindowTransformationsDumb(ClientList clientlist);
|
|
|
|
void calculateWindowTransformationsKompose(ClientList clientlist);
|
|
|
|
|
|
|
|
// Helper methods for layout calculation
|
|
|
|
float clientAspectRatio(Client* c);
|
|
|
|
int clientWidthForHeight(Client* c, int h);
|
|
|
|
int clientHeightForWidth(Client* c, int w);
|
|
|
|
|
|
|
|
// Called once the effect is activated (and wasn't activated before)
|
|
|
|
void effectActivated();
|
|
|
|
// Called once the effect has terminated
|
|
|
|
void effectTerminated();
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Whether the effect is currently activated by the user
|
|
|
|
bool mActivated;
|
|
|
|
// 0 = not active, 1 = fully active
|
|
|
|
float mActiveness;
|
|
|
|
|
|
|
|
Window mInput;
|
|
|
|
|
|
|
|
struct WindowData
|
|
|
|
{
|
|
|
|
QRect area;
|
|
|
|
float scale;
|
|
|
|
};
|
2007-03-14 16:50:19 +00:00
|
|
|
QHash<Toplevel*, WindowData> mWindowData;
|
2007-01-12 14:14:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|