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) 2007 Philip Falkner <philip.falkner@gmail.com>
|
|
|
|
|
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_BOXSWITCH_H
|
|
|
|
#define KWIN_BOXSWITCH_H
|
|
|
|
|
|
|
|
#include <kwineffects.h>
|
|
|
|
|
|
|
|
#include <QHash>
|
|
|
|
#include <QRect>
|
|
|
|
#include <QRegion>
|
|
|
|
#include <QSize>
|
2007-09-03 15:02:26 +00:00
|
|
|
#include <QFont>
|
2008-10-05 11:41:15 +00:00
|
|
|
#include <QQueue>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#include <kwinglutils.h>
|
2008-05-07 14:43:13 +00:00
|
|
|
#include <kwinxrenderutils.h>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2009-11-08 16:42:13 +00:00
|
|
|
#include "boxswitch_proxy.h"
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
class BoxSwitchEffect
|
|
|
|
: public Effect
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
BoxSwitchEffect();
|
|
|
|
~BoxSwitchEffect();
|
2008-10-02 09:27:32 +00:00
|
|
|
virtual void reconfigure( ReconfigureFlags );
|
2008-10-05 11:41:15 +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 );
|
2008-10-05 11:41:15 +00:00
|
|
|
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 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();
|
2008-01-13 13:08:46 +00:00
|
|
|
virtual void windowClosed( EffectWindow* w );
|
2009-11-08 16:42:13 +00:00
|
|
|
virtual void* proxy();
|
|
|
|
void activateFromProxy( int mode, bool animate, bool showText, float positioningFactor );
|
|
|
|
void paintWindowsBox( const QRegion& region );
|
2007-04-29 17:35:43 +00:00
|
|
|
private:
|
|
|
|
class ItemInfo;
|
|
|
|
void setActive();
|
|
|
|
void setInactive();
|
|
|
|
void moveResizeInputWindow( int x, int y, int width, int height );
|
|
|
|
void calculateFrameSize();
|
|
|
|
void calculateItemSizes();
|
2008-01-13 13:08:46 +00:00
|
|
|
void setSelectedWindow( EffectWindow* w );
|
2007-04-29 17:35:43 +00:00
|
|
|
|
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 );
|
|
|
|
|
|
|
|
bool mActivated;
|
|
|
|
Window mInput;
|
|
|
|
int mMode;
|
|
|
|
|
2010-07-18 16:32:37 +00:00
|
|
|
EffectFrame* thumbnailFrame;
|
2009-02-21 04:53:13 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
QRect frame_area;
|
2009-02-21 04:53:13 +00:00
|
|
|
int highlight_margin;
|
2007-04-29 17:35:43 +00:00
|
|
|
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-09-09 11:59:29 +00:00
|
|
|
QColor color_frame;
|
|
|
|
QColor color_highlight;
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2008-09-05 10:48:18 +00:00
|
|
|
float bg_opacity;
|
2008-09-06 09:58:49 +00:00
|
|
|
bool elevate_window;
|
2008-09-05 10:48:18 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
QHash< EffectWindow*, ItemInfo* > windows;
|
|
|
|
EffectWindowList original_windows;
|
2009-09-06 12:25:25 +00:00
|
|
|
EffectWindowList referrencedWindows;
|
2007-04-29 17:35:43 +00:00
|
|
|
EffectWindow* selected_window;
|
|
|
|
QHash< int, ItemInfo* > desktops;
|
|
|
|
QList< int > original_desktops;
|
|
|
|
int selected_desktop;
|
|
|
|
|
|
|
|
int painting_desktop;
|
2008-10-05 11:41:15 +00:00
|
|
|
|
|
|
|
bool mAnimateSwitch;
|
2008-11-28 15:23:21 +00:00
|
|
|
TimeLine activeTimeLine;
|
2008-10-05 11:41:15 +00:00
|
|
|
TimeLine timeLine;
|
|
|
|
bool animation;
|
|
|
|
QRect highlight_area;
|
|
|
|
bool highlight_is_set;
|
|
|
|
enum Direction
|
|
|
|
{
|
|
|
|
Left,
|
|
|
|
Right
|
|
|
|
};
|
|
|
|
Direction direction;
|
|
|
|
QQueue<Direction> scheduled_directions;
|
|
|
|
EffectWindow* edge_window;
|
|
|
|
EffectWindow* right_window;
|
2009-09-13 11:36:45 +00:00
|
|
|
|
|
|
|
bool primaryTabBox;
|
|
|
|
bool secondaryTabBox;
|
2009-11-08 16:42:13 +00:00
|
|
|
|
|
|
|
BoxSwitchEffectProxy mProxy;
|
|
|
|
bool mProxyActivated;
|
|
|
|
bool mProxyAnimateSwitch;
|
|
|
|
bool mProxyShowText;
|
|
|
|
float mPositioningFactor;
|
2007-04-29 17:35:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class BoxSwitchEffect::ItemInfo
|
|
|
|
{
|
|
|
|
public:
|
2009-03-08 05:07:32 +00:00
|
|
|
ItemInfo();
|
|
|
|
~ItemInfo();
|
2007-04-29 17:35:43 +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;
|
2007-04-29 17:35:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|