Fix standard logout fade when compositing is disabled

pull/2/head
Timothy Pearson 11 years ago
parent 6a40ac081b
commit 3a84ecae5d

@ -113,13 +113,10 @@ void KSMShutdownFeedback::fadeBack( void )
void KSMShutdownFeedback::slotPaintEffect()
{
// determine which fade to use
if (TDEConfigGroup(TDEGlobal::config(), "Logout").readBoolEntry("doFancyLogout", true))
{
if (TDEConfigGroup(TDEGlobal::config(), "Logout").readBoolEntry("doFancyLogout", true)) {
// fancy logout fade
float doFancyLogoutAdditionalDarkness = (float)TDEConfigGroup(TDEGlobal::config(), "Logout").readDoubleNumEntry("doFancyLogoutAdditionalDarkness", 0.6);
float doFancyLogoutFadeTime = (float)TDEConfigGroup(TDEGlobal::config(), "Logout").readDoubleNumEntry("doFancyLogoutFadeTime", 4000);
float doFancyLogoutFadeBackTime = (float)TDEConfigGroup(TDEGlobal::config(), "Logout").readDoubleNumEntry("doFancyLogoutFadeBackTime", 1000);
if (kapp->isX11CompositionAvailable()) {
@ -364,18 +361,15 @@ void KSMShutdownFeedback::slotPaintEffect()
TQTimer::singleShot( 5, this, TQT_SLOT( slotPaintEffect() ) );
}
}
else {
// standard logout fade
else
{
if (kapp->isX11CompositionAvailable()) {
// We can do this in a different (simpler) manner because we have compositing support!
// The end effect will be very similar to the old style logout
float doFancyLogoutFadeTime = 1000;
float doFancyLogoutFadeBackTime = 0;
if ( m_greyImageCreated == false )
{
if ( m_greyImageCreated == false ) {
m_greyImageCreated = true;
// eliminate nasty flicker on first show
@ -407,18 +401,16 @@ void KSMShutdownFeedback::slotPaintEffect()
}
// return if fading is completely done...
if ( ( m_grayOpacity >= 1.0f && m_fadeBackwards == FALSE ) || ( m_grayOpacity <= 0.0f && m_fadeBackwards == TRUE ) )
if ( ( m_grayOpacity >= 1.0f && m_fadeBackwards == FALSE ) || ( m_grayOpacity <= 0.0f && m_fadeBackwards == TRUE ) ) {
return;
}
if ( m_fadeBackwards == FALSE )
{
if ( m_fadeBackwards == FALSE ) {
m_grayOpacity = m_fadeTime.elapsed() / doFancyLogoutFadeTime;
if ( m_grayOpacity > 1.0f )
m_grayOpacity = 1.0f;
}
else
{
else {
m_grayOpacity = 1.0f - m_fadeTime.elapsed() / doFancyLogoutFadeBackTime - m_compensation;
if ( m_grayOpacity < 0.0f )
m_grayOpacity = 0.0f;
@ -431,12 +423,14 @@ void KSMShutdownFeedback::slotPaintEffect()
heightUnit = 1;
int y1 = static_cast<int>( imgHeight*m_grayOpacity - heightUnit + m_grayOpacity*heightUnit*2.0f );
if( y1 > imgHeight )
if( y1 > imgHeight ) {
y1 = imgHeight;
}
int y2 = y1+heightUnit;
if( y2 > imgHeight )
if( y2 > imgHeight ) {
y2 = imgHeight;
}
if( m_fadeBackwards == FALSE )
{
@ -448,8 +442,7 @@ void KSMShutdownFeedback::slotPaintEffect()
m_rowsDone = y1;
}
}
else
{
else {
// when fading back we have to blit area which isnt gray anymore to unfaded image
if( y2 > 0 && y2 < imgHeight && m_rowsDone > y2 )
{
@ -461,10 +454,10 @@ void KSMShutdownFeedback::slotPaintEffect()
}
int start_y1 = y1;
if( start_y1 < 0 )
if( start_y1 < 0 ) {
start_y1 = 0;
if( y2 > start_y1 )
{
}
if( y2 > start_y1 ) {
TQImage img( imgWidth, y2-start_y1, 32 );
memcpy( img.bits(), m_grayImage.scanLine( start_y1 ), ( y2-start_y1 ) * imgWidth * 4 );
register uchar * rs = m_unfadedImage.scanLine( start_y1 );
@ -493,6 +486,10 @@ void KSMShutdownFeedback::slotPaintEffect()
}
if ( m_currentY == 0 ) {
setBackgroundMode( TQWidget::NoBackground );
setGeometry( TQApplication::desktop()->geometry() );
m_root.resize( width(), height() ); // for the default logout
KPixmap pixmap;
pixmap = TQPixmap(TQPixmap::grabWindow( tqt_xrootwin(), 0, 0, width(), height() ));
bitBlt( this, 0, 0, &pixmap );

Loading…
Cancel
Save