2007-04-29 17:35:43 +00:00
|
|
|
/*****************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2007 Philip Falkner <philip.falkner@gmail.com>
|
|
|
|
|
|
|
|
You can Freely distribute this program under the GNU General Public
|
|
|
|
License. See the file "COPYING" for the exact licensing terms.
|
|
|
|
******************************************************************/
|
|
|
|
|
|
|
|
#ifndef KWIN_BOXSWITCH_H
|
|
|
|
#define KWIN_BOXSWITCH_H
|
|
|
|
|
|
|
|
#include <kwineffects.h>
|
|
|
|
|
|
|
|
#include <QHash>
|
|
|
|
#include <QPixmap>
|
|
|
|
#include <QRect>
|
|
|
|
#include <QRegion>
|
|
|
|
#include <QSize>
|
2007-09-03 15:02:26 +00:00
|
|
|
#include <QFont>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#include <kwinglutils.h>
|
|
|
|
|
|
|
|
#ifdef HAVE_XRENDER
|
|
|
|
#include <X11/extensions/Xrender.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
class BoxSwitchEffect
|
|
|
|
: public Effect
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
BoxSwitchEffect();
|
|
|
|
~BoxSwitchEffect();
|
|
|
|
|
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 );
|
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 windowInputMouseEvent( Window w, QEvent* e );
|
|
|
|
virtual void windowDamaged( EffectWindow* w, const QRect& damage );
|
|
|
|
virtual void windowGeometryShapeChanged( EffectWindow* w, const QRect& old );
|
|
|
|
virtual void tabBoxAdded( int mode );
|
|
|
|
virtual void tabBoxClosed();
|
|
|
|
virtual void tabBoxUpdated();
|
|
|
|
private:
|
|
|
|
class ItemInfo;
|
|
|
|
void setActive();
|
|
|
|
void setInactive();
|
|
|
|
void moveResizeInputWindow( int x, int y, int width, int height );
|
|
|
|
void calculateFrameSize();
|
|
|
|
void calculateItemSizes();
|
|
|
|
|
|
|
|
void paintFrame();
|
2007-07-09 21:05:34 +00:00
|
|
|
void paintHighlight( QRect area );
|
2007-04-29 17:35:43 +00:00
|
|
|
void paintWindowThumbnail( EffectWindow* w );
|
|
|
|
void paintDesktopThumbnail( int iDesktop );
|
|
|
|
void paintWindowIcon( EffectWindow* w );
|
2007-09-03 15:02:26 +00:00
|
|
|
void paintText( const QString& text );
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
bool mActivated;
|
|
|
|
Window mInput;
|
|
|
|
int mMode;
|
|
|
|
|
|
|
|
QRect frame_area;
|
|
|
|
int frame_margin; // TODO graphical background
|
|
|
|
int highlight_margin; // TODO graphical background
|
|
|
|
QSize item_max_size; // maximum item display size (including highlight)
|
2007-07-09 21:05:34 +00:00
|
|
|
QRect text_area;
|
2007-09-03 15:02:26 +00:00
|
|
|
QFont text_font;
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
QHash< EffectWindow*, ItemInfo* > windows;
|
|
|
|
EffectWindowList original_windows;
|
|
|
|
EffectWindow* selected_window;
|
|
|
|
QHash< int, ItemInfo* > desktops;
|
|
|
|
QList< int > original_desktops;
|
|
|
|
int selected_desktop;
|
|
|
|
|
|
|
|
int painting_desktop;
|
|
|
|
|
|
|
|
#ifdef HAVE_XRENDER
|
|
|
|
XRenderPictFormat* alphaFormat;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
class BoxSwitchEffect::ItemInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
QRect area; // maximal painting area, including any frames/highlights/etc.
|
|
|
|
QRegion clickable;
|
|
|
|
QRect thumbnail;
|
|
|
|
QPixmap icon;
|
|
|
|
#ifdef HAVE_OPENGL
|
|
|
|
GLTexture iconTexture;
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_XRENDER
|
|
|
|
Picture iconPicture;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|