From 342b8e69aa5127eb25e57cd359371b2f0b44c142 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 3 Sep 2011 18:27:58 +0000 Subject: Fix shutdown dialog fading when compositing is enabled Add a bit of logging to kompmgr Fix a broken signal/slot disconnect in kwin git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1251223 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- ksmserver/shutdowndlg.cpp | 79 ++++++++++++++++++++++++++++++----------------- kwin/kompmgr/kompmgr.c | 1 + kwin/workspace.cpp | 2 +- 3 files changed, 52 insertions(+), 30 deletions(-) diff --git a/ksmserver/shutdowndlg.cpp b/ksmserver/shutdowndlg.cpp index d16c36335..8a7693528 100644 --- a/ksmserver/shutdowndlg.cpp +++ b/ksmserver/shutdowndlg.cpp @@ -67,7 +67,7 @@ KSMShutdownFeedback * KSMShutdownFeedback::s_pSelf = 0L; KSMShutdownFeedback::KSMShutdownFeedback() : TQWidget( 0L, "feedbackwidget", WType_Popup ), - m_currentY( 0 ), + m_currentY( 0 ), m_grayOpacity( 0.0f ), m_compensation( 0.0f ), m_fadeBackwards( FALSE ), @@ -129,30 +129,40 @@ void KSMShutdownFeedback::slotPaintEffect() if ( m_greyImageCreated == false ) { m_greyImageCreated = true; - setBackgroundMode( TQWidget::NoBackground ); + + // eliminate nasty flicker on first show + m_root.resize( width(), height() ); + TQImage blendedImage = m_grayImage; + TQPainter p; + p.begin( &m_root ); + blendedImage.setAlphaBuffer(false); + p.drawImage( 0, 0, blendedImage ); + p.end(); + + setBackgroundPixmap( m_root ); setGeometry( TQApplication::desktop()->geometry() ); - m_root.resize( width(), height() ); // for the default logout - + setBackgroundMode( TQWidget::NoBackground ); + m_unfadedImage = m_grayImage.copy(); - + register uchar * r = m_grayImage.bits(); uchar * end = m_grayImage.bits() + m_grayImage.numBytes(); - + while ( r != end ) { *reinterpret_cast(r) = qRgba(0, 0, 0, 128); r += 4; } - + // start timer which is used for cpu-speed-independent fading m_fadeTime.start(); m_rowsDone = 0; } - + // return if fading is completely done... if ( ( m_grayOpacity >= 1.0f && m_fadeBackwards == FALSE ) || ( m_grayOpacity <= 0.0f && m_fadeBackwards == TRUE ) ) return; - - + + if ( m_fadeBackwards == FALSE ) { m_grayOpacity = m_fadeTime.elapsed() / doFancyLogoutFadeTime; @@ -165,21 +175,21 @@ void KSMShutdownFeedback::slotPaintEffect() if ( m_grayOpacity < 0.0f ) m_grayOpacity = 0.0f; } - + const int imgWidth = m_unfadedImage.width(); int imgHeight = m_unfadedImage.height(); int heightUnit = imgHeight / 3; if( heightUnit < 1 ) heightUnit = 1; - + int y1 = static_cast( imgHeight*m_grayOpacity - heightUnit + m_grayOpacity*heightUnit*2.0f ); if( y1 > imgHeight ) y1 = imgHeight; - + int y2 = y1+heightUnit; if( y2 > imgHeight ) y2 = imgHeight; - + if( m_fadeBackwards == FALSE ) { if( y1 > 0 && y1 < imgHeight && y1-m_rowsDone > 0 && m_rowsDone < imgHeight ) @@ -201,7 +211,7 @@ void KSMShutdownFeedback::slotPaintEffect() m_rowsDone = y2; } } - + int start_y1 = y1; if( start_y1 < 0 ) start_y1 = 0; @@ -223,7 +233,7 @@ void KSMShutdownFeedback::slotPaintEffect() } bitBlt( this, 0, start_y1, &img ); } - + TQTimer::singleShot( 5, this, TQT_SLOT( slotPaintEffect() ) ); } else { @@ -233,24 +243,25 @@ void KSMShutdownFeedback::slotPaintEffect() if ( m_greyImageCreated == false ) { m_greyImageCreated = true; + setBackgroundMode( TQWidget::NoBackground ); setGeometry( TQApplication::desktop()->geometry() ); m_root.resize( width(), height() ); // for the default logout - + m_unfadedImage = m_grayImage.copy(); - + register uchar * r = m_grayImage.bits(); register uchar * g = m_grayImage.bits() + 1; register uchar * b = m_grayImage.bits() + 2; uchar * end = m_grayImage.bits() + m_grayImage.numBytes(); - + while ( r != end ) { *r = *g = *b = (uchar) ( ( (*r)*11 + ((*g)<<4) + (*b)*5 ) * doFancyLogoutAdditionalDarkness / 32.0f ); r += 4; g += 4; b += 4; } - + // start timer which is used for cpu-speed-independent fading m_fadeTime.start(); m_rowsDone = 0; @@ -349,7 +360,7 @@ void KSMShutdownFeedback::slotPaintEffect() //bitBlt( this, 0, start_y1, &pm ); bitBlt( this, 0, start_y1, &img ); } - + TQTimer::singleShot( 5, this, TQT_SLOT( slotPaintEffect() ) ); } @@ -365,20 +376,30 @@ void KSMShutdownFeedback::slotPaintEffect() if ( m_greyImageCreated == false ) { m_greyImageCreated = true; - setBackgroundMode( TQWidget::NoBackground ); + + // eliminate nasty flicker on first show + m_root.resize( width(), height() ); + TQImage blendedImage = m_grayImage; + TQPainter p; + p.begin( &m_root ); + blendedImage.setAlphaBuffer(false); + p.drawImage( 0, 0, blendedImage ); + p.end(); + + setBackgroundPixmap( m_root ); setGeometry( TQApplication::desktop()->geometry() ); - m_root.resize( width(), height() ); // for the default logout - + setBackgroundMode( TQWidget::NoBackground ); + m_unfadedImage = m_grayImage.copy(); - + register uchar * r = m_grayImage.bits(); uchar * end = m_grayImage.bits() + m_grayImage.numBytes(); - + while ( r != end ) { *reinterpret_cast(r) = qRgba(0, 0, 0, 107); r += 4; } - + // start timer which is used for cpu-speed-independent fading m_fadeTime.start(); m_rowsDone = 0; @@ -437,7 +458,7 @@ void KSMShutdownFeedback::slotPaintEffect() m_rowsDone = y2; } } - + int start_y1 = y1; if( start_y1 < 0 ) start_y1 = 0; @@ -458,7 +479,7 @@ void KSMShutdownFeedback::slotPaintEffect() } bitBlt( this, 0, start_y1, &img ); } - + TQTimer::singleShot( 1, this, TQT_SLOT( slotPaintEffect() ) ); } else { diff --git a/kwin/kompmgr/kompmgr.c b/kwin/kompmgr/kompmgr.c index b1c5b841d..870cf1b47 100644 --- a/kwin/kompmgr/kompmgr.c +++ b/kwin/kompmgr/kompmgr.c @@ -385,6 +385,7 @@ void delete_pid_file() #if WORK_AROUND_FGLRX if (my_exit_code == 3) { + printf("kompmgr lost connection to X server, restarting...\n\r"); fflush(stdout); sleep(1); char me[2048]; readlink("/proc/self/exe", me, sizeof(me)); diff --git a/kwin/workspace.cpp b/kwin/workspace.cpp index 77e22af6f..66b8780ec 100644 --- a/kwin/workspace.cpp +++ b/kwin/workspace.cpp @@ -2739,7 +2739,7 @@ void Workspace::stopKompmgr() } delete kompmgr_selection; kompmgr_selection = NULL; - kompmgr->disconnect(this, TQT_SLOT(restartKompmgr())); + kompmgr->disconnect(this, TQT_SLOT(restartKompmgr(KProcess*))); options->useTranslucency = FALSE; if (popup){ delete popup; popup = 0L; } // to add/remove opacity slider kompmgr->kill(); -- cgit v1.2.1