diff --git a/effects/maketransparent.cpp b/effects/maketransparent.cpp
index da1b274059..37c8e7a811 100644
--- a/effects/maketransparent.cpp
+++ b/effects/maketransparent.cpp
@@ -50,10 +50,17 @@ MakeTransparentEffect::MakeTransparentEffect()
tornoffmenus = menus;
}
active = effects->activeWindow();
+ moveresize_timeline.setCurveShape( TimeLine::EaseOutCurve );
+ moveresize_timeline.setDuration( conf.readEntry( "Duration", 1500 ) );
+ activeinactive_timeline.setCurveShape( TimeLine::EaseInOutCurve );
+ activeinactive_timeline.setDuration( conf.readEntry( "Duration", 1500 ) );
}
void MakeTransparentEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time )
{
+ moveresize_timeline.addTime(time);
+ activeinactive_timeline.addTime(time);
+
if( decoration != 1.0 && w->hasDecoration())
{
data.mask |= PAINT_WINDOW_TRANSLUCENT;
@@ -78,18 +85,78 @@ void MakeTransparentEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData&
void MakeTransparentEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data )
{
+ // We keep track of the windows that was last active so we know
+ // which one to fade out and which ones to paint as fully inactive
+ if ( w == active && w != current )
+ {
+ previous = current;
+ current = w;
+ }
+
+ if ( w->isDesktop() || w->isDock() )
+ {
+ effects->paintWindow( w, mask, region, data );
+ return;
+ }
+ // Handling active and inactive windows
if( inactive != 1.0 && isInactive(w) )
{
data.opacity *= inactive;
+
+ if ( w == previous )
+ {
+ data.opacity *= (inactive + ((1.0 - inactive) * (1.0 - activeinactive_timeline.value())));
+ if ( activeinactive_timeline.value() < 1.0 )
+ w->addRepaintFull();
+ }
}
else
{
+ // Fading in
+ if ( !isInactive(w) && !w->isDesktop() )
+ {
+ data.opacity *= (inactive + ((1.0 - inactive) * activeinactive_timeline.value()));
+ if ( activeinactive_timeline.value() < 1.0 )
+ w->addRepaintFull();
+ }
+ // decoration and dialogs
if( decoration != 1.0 && w->hasDecoration())
data.decoration_opacity *= decoration;
if( dialogs != 1.0 && w->isDialog())
data.opacity *= dialogs;
- if( moveresize != 1.0 && ( w->isUserMove() || w->isUserResize()))
- data.opacity *= moveresize;
+
+ // Handling moving and resizing
+ if( moveresize != 1.0 && !isInactive(w) && !w->isDesktop() && !w->isDock())
+ {
+ double progress = moveresize_timeline.value();
+ if ( w->isUserMove() || w->isUserResize() )
+ { // Fading to translucent
+ if ( w == active )
+ {
+ data.opacity *= (moveresize + ((1.0 - moveresize) * ( 1.0 - progress )));
+ if (progress < 1.0)
+ {
+ w->addRepaintFull();
+ if ( fadeout != w )
+ fadeout = w;
+ }
+ }
+ }
+ else
+ { // Fading back to more opaque
+ if ( w == active && (w == fadeout) && !w->isUserMove() && !w->isUserResize() )
+ {
+ data.opacity *= (moveresize + ((1.0 - moveresize) * (progress)));
+ if ( progress == 1.0 )
+ fadeout = NULL;
+ else
+ w->addRepaintFull();
+
+ }
+ }
+ }
+
+ // Menues and combos
if( dropdownmenus != 1.0 && w->isDropdownMenu() )
data.opacity *= dropdownmenus;
if( popupmenus != 1.0 && w->isPopupMenu() )
@@ -98,6 +165,7 @@ void MakeTransparentEffect::paintWindow( EffectWindow* w, int mask, QRegion regi
data.opacity *= tornoffmenus;
if( comboboxpopups != 1.0 && w->isComboBox() )
data.opacity *= comboboxpopups;
+
}
effects->paintWindow( w, mask, region, data );
}
@@ -117,13 +185,17 @@ bool MakeTransparentEffect::isInactive( const EffectWindow* w ) const
void MakeTransparentEffect::windowUserMovedResized( EffectWindow* w, bool first, bool last )
{
if( moveresize != 1.0 && ( first || last ))
+ {
+ moveresize_timeline.setProgress(0.0);
w->addRepaintFull();
+ }
}
void MakeTransparentEffect::windowActivated( EffectWindow* w )
{
if( inactive != 1.0 )
{
+ activeinactive_timeline.setProgress(0.0);
if( NULL != active && active != w )
{
if( ( NULL == w || w->group() != active->group() ) &&
@@ -149,7 +221,6 @@ void MakeTransparentEffect::windowActivated( EffectWindow* w )
w->addRepaintFull();
}
}
-
active = w;
}
diff --git a/effects/maketransparent.h b/effects/maketransparent.h
index 80ad316886..d6ad64bb94 100644
--- a/effects/maketransparent.h
+++ b/effects/maketransparent.h
@@ -37,6 +37,7 @@ class MakeTransparentEffect
virtual void windowActivated( EffectWindow* w );
private:
bool isInactive( const EffectWindow *w ) const;
+ bool individualmenuconfig;
double decoration;
double moveresize;
@@ -44,12 +45,17 @@ class MakeTransparentEffect
double inactive;
double comboboxpopups;
double menus;
- bool individualmenuconfig;
double dropdownmenus;
double popupmenus;
double tornoffmenus;
-
+
+ EffectWindow* fadeout;
+ EffectWindow* current;
+ EffectWindow* previous;
EffectWindow* active;
+
+ TimeLine moveresize_timeline;
+ TimeLine activeinactive_timeline;
};
} // namespace
diff --git a/effects/maketransparent_config.cpp b/effects/maketransparent_config.cpp
index 1e71508496..70de7ed70e 100644
--- a/effects/maketransparent_config.cpp
+++ b/effects/maketransparent_config.cpp
@@ -61,6 +61,7 @@ MakeTransparentEffectConfig::MakeTransparentEffectConfig(QWidget* parent, const
connect(m_ui->dropdownmenus, SIGNAL(valueChanged(int)), this, SLOT(changed()));
connect(m_ui->popupmenus, SIGNAL(valueChanged(int)), this, SLOT(changed()));
connect(m_ui->tornoffmenus, SIGNAL(valueChanged(int)), this, SLOT(changed()));
+ connect(m_ui->duration, SIGNAL(valueChanged(int)), this, SLOT(changed()));
load();
}
@@ -94,6 +95,7 @@ void MakeTransparentEffectConfig::load()
m_ui->dropdownmenus->setValue( (int)( conf.readEntry( "DropdownMenus", 1.0) * 100 ) );
m_ui->popupmenus->setValue( (int)( conf.readEntry( "PopupMenus", 1.0) * 100 ) );
m_ui->tornoffmenus->setValue( (int)( conf.readEntry( "TornOffMenus", 1.0) * 100 ) );
+ m_ui->duration->setValue( conf.readEntry( "Duration", 1500) );
setIndividualMenuConfig( m_ui->individualmenuconfig->isChecked() ? Qt::Checked : Qt::Unchecked );
emit changed(false);
@@ -115,6 +117,7 @@ void MakeTransparentEffectConfig::save()
conf.writeEntry( "DropdownMenus", m_ui->dropdownmenus->value() / 100.0 );
conf.writeEntry( "PopupMenus", m_ui->popupmenus->value() / 100.0 );
conf.writeEntry( "TornOffMenus", m_ui->tornoffmenus->value() / 100.0 );
+ conf.writeEntry( "Duration", m_ui->duration->value() );
conf.sync();
emit changed(false);
@@ -134,6 +137,7 @@ void MakeTransparentEffectConfig::defaults()
m_ui->dropdownmenus->setValue( 100 );
m_ui->popupmenus->setValue( 100 );
m_ui->tornoffmenus->setValue( 100 );
+ m_ui->duration->setValue( 1500 );
emit changed(true);
}
diff --git a/effects/maketransparent_config.ui b/effects/maketransparent_config.ui
index 289d03faba..3fb282a9bc 100644
--- a/effects/maketransparent_config.ui
+++ b/effects/maketransparent_config.ui
@@ -5,246 +5,21 @@
0
0
- 318
- 423
+ 497
+ 634
Translucency
- -
-
-
- General opacity settings:
-
-
-
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- Decorations:
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- %
-
-
- 10
-
-
- 100
-
-
-
-
-
- -
-
-
-
-
-
-
- 0
- 0
-
-
-
- Inactive windows:
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- %
-
-
- 10
-
-
- 100
-
-
-
-
-
- -
-
-
-
-
-
-
- 0
- 0
-
-
-
- Moved or resized windows:
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- %
-
-
- 10
-
-
- 100
-
-
-
-
-
- -
-
-
-
-
-
-
- 0
- 0
-
-
-
- Dialogs:
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- %
-
-
- 10
-
-
- 100
-
-
-
-
-
- -
-
-
-
-
-
-
- 0
- 0
-
-
-
- Combobox Popups:
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- %
-
-
- 10
-
-
- 100
-
-
-
-
-
- -
-
-
-
-
-
-
- 0
- 0
-
-
-
- Menus:
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- %
-
-
- 10
-
-
- 100
-
-
-
-
-
-
-
-
-
Advanced opacity settings for menus:
-
-
+
-
Set individual opacity for different menu types
@@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menus:
+ Fading duration:
-
-
-
-
- 0
- 0
-
-
-
- %
-
+
- 10
+ 0
+ 5000
+
+
100
+
+ 100
+
+
+ 1500
+
+
+ Qt::Horizontal
+
+
+ QSlider::TicksBothSides
+
+
+ 500
+
- -
-
-
-
-
-
-
- 0
- 0
-
-
-
- Torn-off menus:
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- %
-
-
- 10
-
-
- 100
-
-
-
-
+ -
+
+
+
+ 60
+ 0
+
+
+
+ msec
+
+
+ 5000
+
+
+ 100
+
+
+ 1500
+
+
@@ -365,5 +390,38 @@
-
+
+
+ duration
+ valueChanged(int)
+ durationSlider
+ setValue(int)
+
+
+ 433
+ 282
+
+
+ 246
+ 283
+
+
+
+
+ durationSlider
+ valueChanged(int)
+ duration
+ setValue(int)
+
+
+ 246
+ 283
+
+
+ 433
+ 282
+
+
+
+