2008-02-21 13:20:22 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
2008-06-30 14:58:38 +00:00
|
|
|
Copyright (C) 2008 Martin Gräßlin <ubuntu@martin-graesslin.com>
|
2008-02-21 13:20:22 +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/>.
|
|
|
|
*********************************************************************/
|
|
|
|
|
|
|
|
#ifndef KWIN_COVERSWITCH_H
|
|
|
|
#define KWIN_COVERSWITCH_H
|
|
|
|
|
2008-11-11 21:32:45 +00:00
|
|
|
#include <QHash>
|
|
|
|
#include <QPixmap>
|
|
|
|
#include <QRect>
|
|
|
|
#include <QRegion>
|
|
|
|
#include <QSize>
|
|
|
|
#include <QQueue>
|
|
|
|
|
2008-02-21 13:20:22 +00:00
|
|
|
#include <kwineffects.h>
|
2008-11-11 21:32:45 +00:00
|
|
|
#include <kwinglutils.h>
|
2008-02-21 13:20:22 +00:00
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
class CoverSwitchEffect
|
2008-03-04 10:27:32 +00:00
|
|
|
: public Effect
|
2008-02-21 13:20:22 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
CoverSwitchEffect();
|
|
|
|
~CoverSwitchEffect();
|
|
|
|
|
2008-10-02 09:27:32 +00:00
|
|
|
virtual void reconfigure( ReconfigureFlags );
|
2008-02-21 13:20:22 +00:00
|
|
|
virtual void prePaintScreen( ScreenPrePaintData& data, int time );
|
|
|
|
virtual void paintScreen( int mask, QRegion region, ScreenPaintData& data );
|
|
|
|
virtual void postPaintScreen();
|
|
|
|
virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data );
|
|
|
|
virtual void tabBoxAdded( int mode );
|
|
|
|
virtual void tabBoxClosed();
|
|
|
|
virtual void tabBoxUpdated();
|
2008-11-11 21:32:45 +00:00
|
|
|
virtual void windowInputMouseEvent( Window w, QEvent* e );
|
2008-02-21 13:20:22 +00:00
|
|
|
|
2008-12-04 08:47:07 +00:00
|
|
|
static bool supported();
|
2008-02-21 13:20:22 +00:00
|
|
|
private:
|
|
|
|
void paintScene( EffectWindow* frontWindow, QList< EffectWindow* >* leftWindows, QList< EffectWindow* >* rightWindows,
|
2008-04-19 00:28:38 +00:00
|
|
|
bool reflectedWindows = false );
|
2008-11-11 21:32:45 +00:00
|
|
|
void paintWindowCover( EffectWindow* w, bool reflectedWindow, WindowPaintData& data );
|
2008-03-09 14:42:20 +00:00
|
|
|
void paintFrontWindow( EffectWindow* frontWindow, int width, int leftWindows, int rightWindows, bool reflectedWindow );
|
|
|
|
void paintWindows( QList< EffectWindow* >* windows, bool left, bool reflectedWindows, EffectWindow* additionalWindow = NULL );
|
2009-01-31 13:23:58 +00:00
|
|
|
void abort();
|
2008-11-11 21:32:45 +00:00
|
|
|
// thumbnail bar
|
|
|
|
class ItemInfo;
|
|
|
|
void calculateFrameSize();
|
|
|
|
void calculateItemSizes();
|
|
|
|
void paintFrame();
|
|
|
|
void paintHighlight( QRect area );
|
|
|
|
void paintWindowThumbnail( EffectWindow* w );
|
|
|
|
void paintWindowIcon( EffectWindow* w );
|
|
|
|
|
2008-02-21 13:20:22 +00:00
|
|
|
bool mActivated;
|
|
|
|
float angle;
|
|
|
|
bool animateSwitch;
|
|
|
|
bool animateStart;
|
|
|
|
bool animateStop;
|
|
|
|
bool animation;
|
|
|
|
bool start;
|
|
|
|
bool stop;
|
|
|
|
bool reflection;
|
2009-05-12 17:18:27 +00:00
|
|
|
bool windowTitle;
|
2008-02-21 13:20:22 +00:00
|
|
|
int animationDuration;
|
|
|
|
bool stopRequested;
|
|
|
|
bool startRequested;
|
2008-04-19 00:28:38 +00:00
|
|
|
TimeLine timeLine;
|
2008-04-17 14:15:55 +00:00
|
|
|
QRect area;
|
2008-06-30 14:58:38 +00:00
|
|
|
Window input;
|
2008-11-11 21:32:45 +00:00
|
|
|
float zPosition;
|
|
|
|
float scaleFactor;
|
|
|
|
enum Direction
|
|
|
|
{
|
|
|
|
Left,
|
|
|
|
Right
|
|
|
|
};
|
|
|
|
Direction direction;
|
|
|
|
QQueue<Direction> scheduled_directions;
|
|
|
|
EffectWindow* selected_window;
|
|
|
|
int activeScreen;
|
|
|
|
QList< EffectWindow* > leftWindows;
|
|
|
|
QList< EffectWindow* > rightWindows;
|
|
|
|
|
2009-02-21 04:53:13 +00:00
|
|
|
EffectFrame captionFrame;
|
|
|
|
QFont captionFont;
|
|
|
|
|
2008-11-11 21:32:45 +00:00
|
|
|
// thumbnail bar
|
2009-02-21 04:53:13 +00:00
|
|
|
EffectFrame thumbnailFrame;
|
2008-11-11 21:32:45 +00:00
|
|
|
bool thumbnails;
|
|
|
|
bool dynamicThumbnails;
|
|
|
|
int thumbnailWindows;
|
|
|
|
QHash< EffectWindow*, ItemInfo* > windows;
|
|
|
|
QRect frame_area;
|
|
|
|
int frame_margin;
|
|
|
|
int highlight_margin;
|
|
|
|
QSize item_max_size; // maximum item display size (including highlight)
|
|
|
|
QColor color_frame;
|
|
|
|
QColor color_highlight;
|
|
|
|
QColor color_text;
|
|
|
|
EffectWindow* edge_window;
|
|
|
|
EffectWindow* right_window;
|
|
|
|
QRect highlight_area;
|
|
|
|
bool highlight_is_set;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class CoverSwitchEffect::ItemInfo
|
|
|
|
{
|
|
|
|
public:
|
2009-03-08 05:07:32 +00:00
|
|
|
ItemInfo();
|
|
|
|
~ItemInfo();
|
2008-11-11 21:32:45 +00:00
|
|
|
QRect area; // maximal painting area, including any frames/highlights/etc.
|
|
|
|
QRegion clickable;
|
|
|
|
QRect thumbnail;
|
2009-03-08 05:07:32 +00:00
|
|
|
EffectFrame* iconFrame;
|
2008-02-21 13:20:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|