Merge the coverswitch branch from git://github.com/Zarin/kwin.git (http://github.com/Zarin/kwin/tree/coverswitch)
This includes: * use of RotationData instead of glRotate * use of x/y/zTranslate instead of glTranslate * does not define own projection matrix * changed the direction of the animation (consistent with Cover Flow) * no special code for start/stop animations. That's now covered in the code for "normal" switching, thanks to not using glTranslate any more. Therefore minimized windows are faded instead of moved from panel * zoom - define how far away the windows appear (only in config dialog possible) * additional thumbnail bar which is shown when there are many (>= 8, configurable) windows * window covers can be clicked and become selected window (Sorry for the one big commit - looking forward to the days when we don't lose commit history when using git ;-)) svn path=/trunk/KDE/kdebase/workspace/; revision=883008
This commit is contained in:
parent
7d428058d3
commit
b274203a6a
5 changed files with 1127 additions and 430 deletions
File diff suppressed because it is too large
Load diff
|
@ -21,7 +21,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#ifndef KWIN_COVERSWITCH_H
|
||||
#define KWIN_COVERSWITCH_H
|
||||
|
||||
#include <QHash>
|
||||
#include <QPixmap>
|
||||
#include <QRect>
|
||||
#include <QRegion>
|
||||
#include <QSize>
|
||||
#include <QQueue>
|
||||
|
||||
#include <kwineffects.h>
|
||||
#include <kwinglutils.h>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
@ -41,13 +49,23 @@ class CoverSwitchEffect
|
|||
virtual void tabBoxAdded( int mode );
|
||||
virtual void tabBoxClosed();
|
||||
virtual void tabBoxUpdated();
|
||||
virtual void windowInputMouseEvent( Window w, QEvent* e );
|
||||
|
||||
private:
|
||||
void paintScene( EffectWindow* frontWindow, QList< EffectWindow* >* leftWindows, QList< EffectWindow* >* rightWindows,
|
||||
bool reflectedWindows = false );
|
||||
void paintWindowCover( EffectWindow* w, QRect windowRect, bool reflectedWindow, float opacity = 1.0 );
|
||||
void paintWindowCover( EffectWindow* w, bool reflectedWindow, WindowPaintData& data );
|
||||
void paintFrontWindow( EffectWindow* frontWindow, int width, int leftWindows, int rightWindows, bool reflectedWindow );
|
||||
void paintWindows( QList< EffectWindow* >* windows, bool left, bool reflectedWindows, EffectWindow* additionalWindow = NULL );
|
||||
// thumbnail bar
|
||||
class ItemInfo;
|
||||
void calculateFrameSize();
|
||||
void calculateItemSizes();
|
||||
void paintFrame();
|
||||
void paintHighlight( QRect area );
|
||||
void paintWindowThumbnail( EffectWindow* w );
|
||||
void paintWindowIcon( EffectWindow* w );
|
||||
|
||||
bool mActivated;
|
||||
float angle;
|
||||
bool animateSwitch;
|
||||
|
@ -56,17 +74,54 @@ class CoverSwitchEffect
|
|||
bool animation;
|
||||
bool start;
|
||||
bool stop;
|
||||
bool forward;
|
||||
bool reflection;
|
||||
int animationDuration;
|
||||
int selectedWindow;
|
||||
int rearrangeWindows;
|
||||
bool stopRequested;
|
||||
bool startRequested;
|
||||
TimeLine timeLine;
|
||||
QRect area;
|
||||
bool twinview;
|
||||
Window input;
|
||||
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;
|
||||
|
||||
// thumbnail bar
|
||||
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:
|
||||
QRect area; // maximal painting area, including any frames/highlights/etc.
|
||||
QRegion clickable;
|
||||
QRect thumbnail;
|
||||
QPixmap icon;
|
||||
GLTexture iconTexture;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -48,7 +48,14 @@ CoverSwitchEffectConfig::CoverSwitchEffectConfig(QWidget* parent, const QVariant
|
|||
connect(m_ui->checkAnimateStart, SIGNAL(stateChanged(int)), this, SLOT(changed()));
|
||||
connect(m_ui->checkAnimateStop, SIGNAL(stateChanged(int)), this, SLOT(changed()));
|
||||
connect(m_ui->checkReflection, SIGNAL(stateChanged(int)), this, SLOT(changed()));
|
||||
connect(m_ui->checkThumbnails, SIGNAL(stateChanged(int)), this, SLOT(changed()));
|
||||
connect(m_ui->checkDynamicThumbnails, SIGNAL(stateChanged(int)), this, SLOT(changed()));
|
||||
connect(m_ui->spinThumbnailWindows, SIGNAL(valueChanged(int)), this, SLOT(changed()));
|
||||
connect(m_ui->spinDuration, SIGNAL(valueChanged(int)), this, SLOT(changed()));
|
||||
connect(m_ui->zPositionSlider, SIGNAL(valueChanged(int)), this, SLOT(changed()));
|
||||
|
||||
connect(m_ui->checkThumbnails, SIGNAL(stateChanged(int)), this, SLOT(thumbnailsChanged()));
|
||||
connect(m_ui->checkDynamicThumbnails, SIGNAL(stateChanged(int)), this, SLOT(thumbnailsChanged()));
|
||||
|
||||
load();
|
||||
}
|
||||
|
@ -59,44 +66,17 @@ void CoverSwitchEffectConfig::load()
|
|||
|
||||
KConfigGroup conf = EffectsHandler::effectConfig( "CoverSwitch" );
|
||||
|
||||
int duration = conf.readEntry( "Duration", 0 );
|
||||
bool animateSwitch = conf.readEntry( "AnimateSwitch", true );
|
||||
bool animateStart = conf.readEntry( "AnimateStart", true );
|
||||
bool animateStop = conf.readEntry( "AnimateStop", true );
|
||||
bool reflection = conf.readEntry( "Reflection", true );
|
||||
m_ui->spinDuration->setValue( duration );
|
||||
if( animateSwitch )
|
||||
{
|
||||
m_ui->checkAnimateSwitch->setCheckState( Qt::Checked );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->checkAnimateSwitch->setCheckState( Qt::Unchecked );
|
||||
}
|
||||
if( animateStart )
|
||||
{
|
||||
m_ui->checkAnimateStart->setCheckState( Qt::Checked );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->checkAnimateStart->setCheckState( Qt::Unchecked );
|
||||
}
|
||||
if( animateStop )
|
||||
{
|
||||
m_ui->checkAnimateStop->setCheckState( Qt::Checked );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->checkAnimateStop->setCheckState( Qt::Unchecked );
|
||||
}
|
||||
if( reflection )
|
||||
{
|
||||
m_ui->checkReflection->setCheckState( Qt::Checked );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->checkReflection->setCheckState( Qt::Unchecked );
|
||||
}
|
||||
m_ui->spinDuration->setValue( conf.readEntry( "Duration", 0 ) );
|
||||
m_ui->checkAnimateSwitch->setChecked( conf.readEntry( "AnimateSwitch", true ));
|
||||
m_ui->checkAnimateStart->setChecked( conf.readEntry( "AnimateStart", true ));
|
||||
m_ui->checkAnimateStop->setChecked( conf.readEntry( "AnimateStop", true ));
|
||||
m_ui->checkReflection->setChecked( conf.readEntry( "Reflection", true ));
|
||||
m_ui->checkThumbnails->setChecked( conf.readEntry( "Thumbnails", true ));
|
||||
m_ui->checkDynamicThumbnails->setChecked( conf.readEntry( "DynamicThumbnails", true ));
|
||||
m_ui->spinThumbnailWindows->setValue( conf.readEntry( "ThumbnailWindows", 8 ));
|
||||
m_ui->zPositionSlider->setValue( conf.readEntry( "ZPosition", 900 ));
|
||||
|
||||
thumbnailsChanged();
|
||||
|
||||
emit changed(false);
|
||||
}
|
||||
|
@ -106,10 +86,14 @@ void CoverSwitchEffectConfig::save()
|
|||
KConfigGroup conf = EffectsHandler::effectConfig( "CoverSwitch" );
|
||||
|
||||
conf.writeEntry( "Duration", m_ui->spinDuration->value() );
|
||||
conf.writeEntry( "AnimateSwitch", m_ui->checkAnimateSwitch->checkState() == Qt::Checked ? true : false );
|
||||
conf.writeEntry( "AnimateStart", m_ui->checkAnimateStart->checkState() == Qt::Checked ? true : false );
|
||||
conf.writeEntry( "AnimateStop", m_ui->checkAnimateStop->checkState() == Qt::Checked ? true : false );
|
||||
conf.writeEntry( "Reflection", m_ui->checkReflection->checkState() == Qt::Checked ? true : false );
|
||||
conf.writeEntry( "AnimateSwitch", m_ui->checkAnimateSwitch->isChecked() );
|
||||
conf.writeEntry( "AnimateStart", m_ui->checkAnimateStart->isChecked() );
|
||||
conf.writeEntry( "AnimateStop", m_ui->checkAnimateStop->isChecked() );
|
||||
conf.writeEntry( "Reflection", m_ui->checkReflection->isChecked() );
|
||||
conf.writeEntry( "Thumbnails", m_ui->checkThumbnails->isChecked() );
|
||||
conf.writeEntry( "DynamicThumbnails", m_ui->checkDynamicThumbnails->isChecked() );
|
||||
conf.writeEntry( "ThumbnailWindows", m_ui->spinThumbnailWindows->value() );
|
||||
conf.writeEntry( "ZPosition", m_ui->zPositionSlider->value() );
|
||||
|
||||
conf.sync();
|
||||
|
||||
|
@ -124,9 +108,20 @@ void CoverSwitchEffectConfig::defaults()
|
|||
m_ui->checkAnimateStart->setCheckState( Qt::Checked );
|
||||
m_ui->checkAnimateStop->setCheckState( Qt::Checked );
|
||||
m_ui->checkReflection->setCheckState( Qt::Checked );
|
||||
m_ui->checkThumbnails->setCheckState( Qt::Checked );
|
||||
m_ui->checkDynamicThumbnails->setCheckState( Qt::Checked );
|
||||
m_ui->spinThumbnailWindows->setValue( 8 );
|
||||
m_ui->zPositionSlider->setValue( 900 );
|
||||
emit changed(true);
|
||||
}
|
||||
|
||||
void CoverSwitchEffectConfig::thumbnailsChanged()
|
||||
{
|
||||
bool enabled = m_ui->checkThumbnails->isChecked() && m_ui->checkDynamicThumbnails->isChecked();
|
||||
m_ui->checkDynamicThumbnails->setEnabled( m_ui->checkThumbnails->isChecked() );
|
||||
m_ui->spinThumbnailWindows->setEnabled( enabled );
|
||||
m_ui->labelThumbnailWindows->setEnabled( enabled );
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
|
|
|
@ -47,6 +47,9 @@ class CoverSwitchEffectConfig : public KCModule
|
|||
virtual void load();
|
||||
virtual void defaults();
|
||||
|
||||
private slots:
|
||||
void thumbnailsChanged();
|
||||
|
||||
private:
|
||||
CoverSwitchEffectConfigForm* m_ui;
|
||||
};
|
||||
|
|
|
@ -5,12 +5,102 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>289</width>
|
||||
<height>190</height>
|
||||
<width>608</width>
|
||||
<height>238</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<layout class="QGridLayout" name="gridLayout_2" >
|
||||
<item row="0" column="1" >
|
||||
<widget class="QGroupBox" name="groupBox_3" >
|
||||
<property name="title" >
|
||||
<string>Thumbnail Bar</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QCheckBox" name="checkThumbnails" >
|
||||
<property name="text" >
|
||||
<string>Use additional thumbnail bar</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QCheckBox" name="checkDynamicThumbnails" >
|
||||
<property name="toolTip" >
|
||||
<string>Only show thumbnail bar if there are at least specified number of windows</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Dynamic mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="labelThumbnailWindows" >
|
||||
<property name="text" >
|
||||
<string>Number of windows:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>spinThumbnailWindows</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QSpinBox" name="spinThumbnailWindows" />
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QGroupBox" name="groupBox_2" >
|
||||
<property name="title" >
|
||||
<string>Zoom</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_8" >
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_8" >
|
||||
<property name="text" >
|
||||
<string>Near</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QLabel" name="label_9" >
|
||||
<property name="text" >
|
||||
<string>Far</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2" >
|
||||
<widget class="QSlider" name="zPositionSlider" >
|
||||
<property name="toolTip" >
|
||||
<string>Define how far away the windows should appear</string>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>3000</number>
|
||||
</property>
|
||||
<property name="singleStep" >
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="pageStep" >
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition" >
|
||||
<enum>QSlider::TicksBelow</enum>
|
||||
</property>
|
||||
<property name="tickInterval" >
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item rowspan="2" row="0" column="0" >
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="title" >
|
||||
<string>Appearance</string>
|
||||
|
@ -19,41 +109,28 @@
|
|||
<item row="0" column="0" colspan="2" >
|
||||
<widget class="QCheckBox" name="checkAnimateSwitch" >
|
||||
<property name="text" >
|
||||
<string>Animate &switch</string>
|
||||
<string>Animate switch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2" >
|
||||
<widget class="QCheckBox" name="checkAnimateStart" >
|
||||
<property name="text" >
|
||||
<string>Animation on tab box &open</string>
|
||||
<string>Animation on tab box open</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2" >
|
||||
<widget class="QCheckBox" name="checkAnimateStop" >
|
||||
<property name="text" >
|
||||
<string>Animation on tab box &close</string>
|
||||
<string>Animation on tab box close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2" >
|
||||
<widget class="QCheckBox" name="checkReflection" >
|
||||
<property name="text" >
|
||||
<string>&Reflections</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" >
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="text" >
|
||||
<string>&Animation duration:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>spinDuration</cstring>
|
||||
<string>Reflections</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -79,23 +156,25 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" >
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="text" >
|
||||
<string>Animation duration:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>spinDuration</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<spacer name="verticalSpacer" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>groupBox_3</zorder>
|
||||
<zorder>groupBox</zorder>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>checkAnimateSwitch</tabstop>
|
||||
|
@ -103,6 +182,10 @@
|
|||
<tabstop>checkAnimateStop</tabstop>
|
||||
<tabstop>checkReflection</tabstop>
|
||||
<tabstop>spinDuration</tabstop>
|
||||
<tabstop>checkThumbnails</tabstop>
|
||||
<tabstop>checkDynamicThumbnails</tabstop>
|
||||
<tabstop>spinThumbnailWindows</tabstop>
|
||||
<tabstop>zPositionSlider</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
|
Loading…
Reference in a new issue