Enable box switch animations by default.
Add window fading when activating or deactivating to make it look nicer. CCBUG: 176338 svn path=/trunk/KDE/kdebase/workspace/; revision=890199
This commit is contained in:
parent
eca9561ab7
commit
ab330beb59
3 changed files with 31 additions and 12 deletions
|
@ -63,12 +63,15 @@ void BoxSwitchEffect::reconfigure( ReconfigureFlags )
|
||||||
color_highlight = KColorScheme( QPalette::Active, KColorScheme::Selection ).background().color();
|
color_highlight = KColorScheme( QPalette::Active, KColorScheme::Selection ).background().color();
|
||||||
color_highlight.setAlphaF( 0.9 );
|
color_highlight.setAlphaF( 0.9 );
|
||||||
color_text = KColorScheme( QPalette::Active, KColorScheme::Window ).foreground().color();
|
color_text = KColorScheme( QPalette::Active, KColorScheme::Window ).foreground().color();
|
||||||
|
activeTimeLine.setDuration( animationTime( 250 ));
|
||||||
|
activeTimeLine.setCurveShape( TimeLine::EaseInOutCurve );
|
||||||
timeLine.setDuration( animationTime( 150 ));
|
timeLine.setDuration( animationTime( 150 ));
|
||||||
|
timeLine.setCurveShape( TimeLine::EaseInOutCurve );
|
||||||
KConfigGroup conf = effects->effectConfig( "BoxSwitch" );
|
KConfigGroup conf = effects->effectConfig( "BoxSwitch" );
|
||||||
|
|
||||||
bg_opacity = conf.readEntry( "BackgroundOpacity", 25 ) / 100.0;
|
bg_opacity = conf.readEntry( "BackgroundOpacity", 25 ) / 100.0;
|
||||||
elevate_window = conf.readEntry( "ElevateSelected", true );
|
elevate_window = conf.readEntry( "ElevateSelected", true );
|
||||||
mAnimateSwitch = conf.readEntry( "AnimateSwitch", false );
|
mAnimateSwitch = conf.readEntry( "AnimateSwitch", true );
|
||||||
}
|
}
|
||||||
|
|
||||||
void BoxSwitchEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time )
|
void BoxSwitchEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time )
|
||||||
|
@ -100,6 +103,10 @@ void BoxSwitchEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data,
|
||||||
|
|
||||||
void BoxSwitchEffect::prePaintScreen( ScreenPrePaintData& data, int time )
|
void BoxSwitchEffect::prePaintScreen( ScreenPrePaintData& data, int time )
|
||||||
{
|
{
|
||||||
|
if( mActivated )
|
||||||
|
activeTimeLine.addTime( time );
|
||||||
|
else
|
||||||
|
activeTimeLine.removeTime( time );
|
||||||
if( mActivated && animation )
|
if( mActivated && animation )
|
||||||
{
|
{
|
||||||
timeLine.addTime( time );
|
timeLine.addTime( time );
|
||||||
|
@ -167,6 +174,10 @@ void BoxSwitchEffect::paintScreen( int mask, QRegion region, ScreenPaintData& da
|
||||||
|
|
||||||
void BoxSwitchEffect::postPaintScreen()
|
void BoxSwitchEffect::postPaintScreen()
|
||||||
{
|
{
|
||||||
|
if( mActivated && activeTimeLine.value() != 1.0 )
|
||||||
|
effects->addRepaintFull();
|
||||||
|
if( !mActivated && activeTimeLine.value() != 0.0 )
|
||||||
|
effects->addRepaintFull();
|
||||||
if( mActivated && animation )
|
if( mActivated && animation )
|
||||||
{
|
{
|
||||||
if( timeLine.value() == 1.0 )
|
if( timeLine.value() == 1.0 )
|
||||||
|
@ -190,14 +201,15 @@ void BoxSwitchEffect::postPaintScreen()
|
||||||
|
|
||||||
void BoxSwitchEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data )
|
void BoxSwitchEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data )
|
||||||
{
|
{
|
||||||
if( mActivated )
|
if(( mActivated && mMode == TabBoxWindowsMode ) || ( !mActivated && activeTimeLine.value() != 0.0 ))
|
||||||
{
|
|
||||||
if( mMode == TabBoxWindowsMode )
|
|
||||||
{
|
{
|
||||||
if( windows.contains( w ) && w != selected_window )
|
if( windows.contains( w ) && w != selected_window )
|
||||||
{
|
{
|
||||||
data.opacity *= bg_opacity;
|
if( w->isMinimized() )
|
||||||
}
|
// TODO: When deactivating minimized windows are not painted at all
|
||||||
|
data.opacity *= activeTimeLine.value() * bg_opacity;
|
||||||
|
else
|
||||||
|
data.opacity *= 1.0 - activeTimeLine.value() * ( 1.0 - bg_opacity );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
effects->paintWindow( w, mask, region, data );
|
effects->paintWindow( w, mask, region, data );
|
||||||
|
@ -414,6 +426,11 @@ void BoxSwitchEffect::tabBoxUpdated()
|
||||||
void BoxSwitchEffect::setActive()
|
void BoxSwitchEffect::setActive()
|
||||||
{
|
{
|
||||||
mActivated = true;
|
mActivated = true;
|
||||||
|
|
||||||
|
// Do this here so we have correct fading on deactivation
|
||||||
|
qDeleteAll( windows );
|
||||||
|
windows.clear();
|
||||||
|
|
||||||
if( mMode == TabBoxWindowsMode )
|
if( mMode == TabBoxWindowsMode )
|
||||||
{
|
{
|
||||||
original_windows = effects->currentTabBoxWindowList();
|
original_windows = effects->currentTabBoxWindowList();
|
||||||
|
@ -454,9 +471,10 @@ void BoxSwitchEffect::setInactive()
|
||||||
if( w != selected_window )
|
if( w != selected_window )
|
||||||
w->addRepaintFull();
|
w->addRepaintFull();
|
||||||
}
|
}
|
||||||
qDeleteAll( windows );
|
// We don't unset the selected window so we have correct fading
|
||||||
windows.clear();
|
// But we do need to remove elevation status
|
||||||
setSelectedWindow( 0 );
|
if( elevate_window && selected_window )
|
||||||
|
effects->setElevatedWindow( selected_window, false );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // DesktopMode
|
{ // DesktopMode
|
||||||
|
|
|
@ -100,6 +100,7 @@ class BoxSwitchEffect
|
||||||
int painting_desktop;
|
int painting_desktop;
|
||||||
|
|
||||||
bool mAnimateSwitch;
|
bool mAnimateSwitch;
|
||||||
|
TimeLine activeTimeLine;
|
||||||
TimeLine timeLine;
|
TimeLine timeLine;
|
||||||
bool animation;
|
bool animation;
|
||||||
QRect highlight_area;
|
QRect highlight_area;
|
||||||
|
|
|
@ -68,7 +68,7 @@ void BoxSwitchEffectConfig::load()
|
||||||
bool elevate = conf.readEntry( "ElevateSelected", true );
|
bool elevate = conf.readEntry( "ElevateSelected", true );
|
||||||
m_ui->elevateBox->setChecked( elevate );
|
m_ui->elevateBox->setChecked( elevate );
|
||||||
|
|
||||||
bool animate = conf.readEntry( "AnimateSwitch", false );
|
bool animate = conf.readEntry( "AnimateSwitch", true );
|
||||||
m_ui->animateBox->setChecked( animate );
|
m_ui->animateBox->setChecked( animate );
|
||||||
|
|
||||||
emit changed(false);
|
emit changed(false);
|
||||||
|
@ -96,7 +96,7 @@ void BoxSwitchEffectConfig::defaults()
|
||||||
{
|
{
|
||||||
m_ui->opacitySpin->setValue( 25 );
|
m_ui->opacitySpin->setValue( 25 );
|
||||||
m_ui->elevateBox->setChecked( true );
|
m_ui->elevateBox->setChecked( true );
|
||||||
m_ui->animateBox->setChecked( false );
|
m_ui->animateBox->setChecked( true );
|
||||||
emit changed(true);
|
emit changed(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue