From 1f40ada72d693d681ec6a32c2ef717e8dd73b5bb Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 10 Sep 2011 22:32:00 +0000 Subject: [PATCH] Force windows with the modal system notification atom set to stay above other windows Enhance logout sequence appearance Add remote folder synchronization on logout support Fix flickering to black window with subsequent partial repaint of certain widgets occurring during fancy logout sequence git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1252640 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- ksmserver/CMakeLists.txt | 2 +- ksmserver/server.cpp | 13 ++++++++++- ksmserver/server.h | 2 ++ ksmserver/shutdown.cpp | 27 ++++++++++++++++++++--- ksmserver/shutdowndlg.cpp | 46 ++++++++++++++++++++++----------------- ksmserver/shutdowndlg.h | 8 +++++-- kwin/client.cpp | 12 +++++++++- kwin/client.h | 5 ----- 8 files changed, 82 insertions(+), 33 deletions(-) diff --git a/ksmserver/CMakeLists.txt b/ksmserver/CMakeLists.txt index 66a4b050b..042e36fe3 100644 --- a/ksmserver/CMakeLists.txt +++ b/ksmserver/CMakeLists.txt @@ -43,5 +43,5 @@ tde_add_kdeinit_executable( ksmserver AUTOMOC main.cpp server.cpp shutdowndlg.cpp legacy.cpp startup.cpp shutdown.cpp client.cpp KSMServerInterface.skel server.skel timed.ui - LINK dmctl-static kdeui-shared ${HAL_LIBRARIES} ${DBUS_TQT_LIBRARIES} + LINK dmctl-static kdeui-shared krsync-shared ${HAL_LIBRARIES} ${DBUS_TQT_LIBRARIES} ) diff --git a/ksmserver/server.cpp b/ksmserver/server.cpp index ce118a529..003abf3af 100644 --- a/ksmserver/server.cpp +++ b/ksmserver/server.cpp @@ -913,7 +913,18 @@ bool KSMServer::isWM( const TQString& program ) const // therefore make sure it's recognized even if ksmserver // was initially started with different WM, and kwin replaced // it later - return program == wm || program == "kwin"; + return ((program == wm) || (program == "kwin")); +} + +bool KSMServer::isCM( const KSMClient* client ) const +{ + return isCM( client->program()); +} + +bool KSMServer::isCM( const TQString& program ) const +{ + // Returns true if the program in question is a composition manager + return (program == "kompmgr"); } bool KSMServer::defaultSession() const diff --git a/ksmserver/server.h b/ksmserver/server.h index 1fd55a217..c7224eb36 100644 --- a/ksmserver/server.h +++ b/ksmserver/server.h @@ -145,6 +145,8 @@ private: bool isWM( const KSMClient* client ) const; bool isWM( const TQString& program ) const; + bool isCM( const KSMClient* client ) const; + bool isCM( const TQString& program ) const; bool defaultSession() const; // empty session void setupXIOErrorHandler(); diff --git a/ksmserver/shutdown.cpp b/ksmserver/shutdown.cpp index a153b2806..b5e40a50b 100644 --- a/ksmserver/shutdown.cpp +++ b/ksmserver/shutdown.cpp @@ -81,6 +81,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include +#include + #include "server.h" #include "global.h" #include "shutdowndlg.h" @@ -182,6 +184,7 @@ void KSMServer::shutdownInternal( KApplication::ShutdownConfirm confirm, shutdownType = sdtype; shutdownMode = sdmode; bootOption = bopt; + shutdownNotifierIPDlg = 0; // shall we save the session on logout? saveSession = ( config->readEntry( "loginMode", "restorePreviousLogout" ) == "restorePreviousLogout" ); @@ -189,6 +192,19 @@ void KSMServer::shutdownInternal( KApplication::ShutdownConfirm confirm, if (showFancyLogout) { KSMShutdownIPFeedback::showit(); // hide the UGLY logout process from the user shutdownNotifierIPDlg = KSMShutdownIPDlg::showShutdownIP(); + while (!KSMShutdownIPFeedback::ispainted()) { + tqApp->processEvents(); + } + } + + // synchronize any folders that were requested for shutdown sync + if (shutdownNotifierIPDlg) { + static_cast(shutdownNotifierIPDlg)->setStatusMessage(i18n("Synchronizing remote folders").append("...")); + } + KRsync krs(this, ""); + krs.executeLogoutAutoSync(); + if (shutdownNotifierIPDlg) { + static_cast(shutdownNotifierIPDlg)->setStatusMessage(""); } if ( saveSession ) @@ -196,7 +212,9 @@ void KSMServer::shutdownInternal( KApplication::ShutdownConfirm confirm, // Set the real desktop background to black so that exit looks // clean regardless of what was on "our" desktop. - TQT_TQWIDGET(kapp->desktop())->setBackgroundColor( Qt::black ); + if (!showFancyLogout) { + TQT_TQWIDGET(kapp->desktop())->setBackgroundColor( Qt::black ); + } state = Shutdown; wmPhase1WaitingCount = 0; saveType = saveSession?SmSaveBoth:SmSaveGlobal; @@ -520,7 +538,7 @@ void KSMServer::startKilling() // kill all clients state = Killing; for ( KSMClient* c = clients.first(); c; c = clients.next() ) { - if( isWM( c )) // kill the WM as the last one in order to reduce flicker + if( isWM( c ) || isCM( c ) ) // kill the WM and CM as the last one in order to reduce flicker continue; kdDebug( 1218 ) << "completeShutdown: client " << c->program() << "(" << c->clientId() << ")" << endl; SmsDie( c->connection() ); @@ -539,7 +557,7 @@ void KSMServer::completeKilling() if( state == Killing ) { bool wait = false; for( KSMClient* c = clients.first(); c; c = clients.next()) { - if( isWM( c )) + if( isWM( c ) || isCM( c ) ) continue; wait = true; // still waiting for clients to go away } @@ -563,6 +581,9 @@ void KSMServer::killWM() kdDebug( 1218 ) << "killWM: client " << c->program() << "(" << c->clientId() << ")" << endl; SmsDie( c->connection() ); } + if( isCM( c )) { + SmsDie( c->connection() ); + } } if( iswm ) { completeKillingWM(); diff --git a/ksmserver/shutdowndlg.cpp b/ksmserver/shutdowndlg.cpp index c49e31974..1fc5af648 100644 --- a/ksmserver/shutdowndlg.cpp +++ b/ksmserver/shutdowndlg.cpp @@ -516,19 +516,18 @@ void KSMShutdownFeedback::slotPaintEffect() KSMShutdownIPFeedback * KSMShutdownIPFeedback::s_pSelf = 0L; KSMShutdownIPFeedback::KSMShutdownIPFeedback() - : TQWidget( 0L, "feedbackipwidget", Qt::WType_Dialog | Qt::WStyle_StaysOnTop ), m_timeout(0) + : TQWidget( 0L, "feedbackipwidget", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_StaysOnTop ), m_timeout(0), m_isPainted(false) { - setShown(false); - setWindowState(WindowFullScreen); - // Try to get the root pixmap system("krootbacking &"); + + resize(0, 0); + setShown(true); } void KSMShutdownIPFeedback::showNow() { -// slotPaintEffect(); TQTimer::singleShot( 0, this, SLOT(slotPaintEffect()) ); } @@ -588,11 +587,15 @@ void KSMShutdownIPFeedback::slotPaintEffect() pm.convertFromImage(correctedImage); } - resize(kapp->desktop()->width(), kapp->desktop()->height()); + setBackgroundPixmap( pm ); move(0,0); - setShown(true); + setWindowState(WindowFullScreen); + setGeometry( TQApplication::desktop()->geometry() ); - setBackgroundPixmap( pm ); + repaint(true); + tqApp->flushX(); + + m_isPainted = true; } void KSMShutdownIPFeedback::enableExports() @@ -1106,22 +1109,25 @@ TQWidget* KSMShutdownIPDlg::showShutdownIP() l->move(rect.x() + (rect.width() - sh.width())/2, rect.y() + (rect.height() - sh.height())/2); - TQTimer *timer = new TQTimer(l); - connect( timer, SIGNAL(timeout()), l, SLOT(exec()) ); - timer->start( 0, TRUE ); - kapp->disableStyles(); return l; } +void KSMShutdownIPDlg::setStatusMessage(TQString message) +{ + if (message == "") { + m_statusLabel->setText(i18n("Saving your settings").append("...")); + } + else { + m_statusLabel->setText(message); + } +} + KSMShutdownIPDlg::KSMShutdownIPDlg(TQWidget* parent) - : TQDialog( 0, "", TRUE, Qt::WStyle_Customize | Qt::WType_Dialog | Qt::WStyle_Title | Qt::WDestructiveClose ) + : TQWidget( 0, "", Qt::WStyle_Customize | Qt::WType_Dialog | Qt::WStyle_Title | Qt::WStyle_StaysOnTop | Qt::WDestructiveClose ) { - // Signal that this window should stay on top of everything else - setModal(true); - // Signal that we do not want any window controls to be shown at all Atom kde_wm_system_modal_notification; kde_wm_system_modal_notification = XInternAtom(qt_xdisplay(), "_KDE_WM_MODAL_SYS_NOTIFICATION", False); @@ -1182,12 +1188,12 @@ KSMShutdownIPDlg::KSMShutdownIPDlg(TQWidget* parent) label->setFont( fnt ); centerbox->addWidget( label, AlignCenter ); - label = new TQLabel( i18n("Saving your settings..."), frame ); - fnt = label->font(); + m_statusLabel = new TQLabel( i18n("Saving your settings..."), frame ); + fnt = m_statusLabel->font(); fnt.setBold( false ); fnt.setPointSize( fnt.pointSize() * 1 ); - label->setFont( fnt ); - gbox->addMultiCellWidget( label, 2, 2, 0, 0, AlignLeft | AlignVCenter ); + m_statusLabel->setFont( fnt ); + gbox->addMultiCellWidget( m_statusLabel, 2, 2, 0, 0, AlignLeft | AlignVCenter ); gbox->addLayout(centerbox, 0, 0); gbox->addLayout(seperatorbox, 1, 0); diff --git a/ksmserver/shutdowndlg.h b/ksmserver/shutdowndlg.h index 72db4b1b1..7ba93401f 100644 --- a/ksmserver/shutdowndlg.h +++ b/ksmserver/shutdowndlg.h @@ -87,11 +87,12 @@ public: static void showit() { if ( s_pSelf != 0L ) s_pSelf->showNow(); } static void stop() { if ( s_pSelf != 0L ) s_pSelf->fadeBack(); delete s_pSelf; s_pSelf = 0L; } static KSMShutdownIPFeedback * self() { return s_pSelf; } + static bool ispainted() { if ( s_pSelf != 0L ) return s_pSelf->m_isPainted; else return false; } protected: ~KSMShutdownIPFeedback(); -private slots: +public slots: void slotPaintEffect(); private: @@ -104,6 +105,7 @@ private: TQString pixmapName(int desk); void enableExports(); int m_timeout; + bool m_isPainted; }; // The confirmation dialog @@ -139,12 +141,13 @@ private: }; // The shutdown-in-progress dialog -class KSMShutdownIPDlg : public TQDialog +class KSMShutdownIPDlg : public TQWidget { Q_OBJECT public: static TQWidget* showShutdownIP(); + void setStatusMessage(TQString message); protected: ~KSMShutdownIPDlg(); @@ -154,6 +157,7 @@ protected slots: private: KSMShutdownIPDlg( TQWidget* parent ); + TQLabel* m_statusLabel; }; class KSMDelayedPushButton : public KPushButton diff --git a/kwin/client.cpp b/kwin/client.cpp index 114300821..0a7f71526 100644 --- a/kwin/client.cpp +++ b/kwin/client.cpp @@ -610,7 +610,7 @@ void Client::hideClient( bool hide ) updateVisibility(); } -/* +/*! Returns whether the window is minimizable or not */ bool Client::isMinimizable() const @@ -643,6 +643,16 @@ bool Client::isMinimizable() const return true; } +/*! + Returns whether the window is kept above or not + */ +bool Client::keepAbove() const + { + if( isModalSystemNotification()) + return true; + return keep_above; + } + /*! Minimizes this client plus its transients */ diff --git a/kwin/client.h b/kwin/client.h index 9ee08efe5..ec94a994d 100644 --- a/kwin/client.h +++ b/kwin/client.h @@ -792,11 +792,6 @@ inline bool Client::skipPager() const return skip_pager; } -inline bool Client::keepAbove() const - { - return keep_above; - } - inline bool Client::keepBelow() const { return keep_below;