Provide visual indication of SaveYourself hang protection timer

Reduce hang protection timer to 20 seconds
This relates to Bug 760
pull/2/head
Timothy Pearson 11 years ago
parent 682dadf9bb
commit d85d82bd00

@ -580,7 +580,7 @@ extern "C" int _IceTransNoListen(const char * protocol);
#endif #endif
KSMServer::KSMServer( const TQString& windowManager, const TQString& windowManagerAddArgs, bool _only_local ) KSMServer::KSMServer( const TQString& windowManager, const TQString& windowManagerAddArgs, bool _only_local )
: DCOPObject("ksmserver"), startupNotifierIPDlg(0), shutdownNotifierIPDlg(0), sessionGroup( "" ) : DCOPObject("ksmserver"), startupNotifierIPDlg(0), shutdownNotifierIPDlg(0), sessionGroup( "" ), protectionTimerCounter(0)
{ {
the_server = this; the_server = this;
clean = false; clean = false;
@ -682,7 +682,7 @@ KSMServer::KSMServer( const TQString& windowManager, const TQString& windowManag
signal(SIGPIPE, SIG_IGN); signal(SIGPIPE, SIG_IGN);
connect( &notificationTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( notificationTimeout() ) ); connect( &notificationTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( notificationTimeout() ) );
connect( &protectionTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( protectionTimeout() ) ); connect( &protectionTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( protectionTimerTick() ) );
connect( &restoreTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( tryRestoreNext() ) ); connect( &restoreTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( tryRestoreNext() ) );
connect( &shutdownTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( timeoutQuit() ) ); connect( &shutdownTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( timeoutQuit() ) );
connect( kapp, TQT_SIGNAL( shutDown() ), this, TQT_SLOT( cleanUp() ) ); connect( kapp, TQT_SIGNAL( shutDown() ), this, TQT_SLOT( cleanUp() ) );

@ -110,6 +110,7 @@ private slots:
void restoreSessionDoneInternal(); void restoreSessionDoneInternal();
void notificationTimeout(); void notificationTimeout();
void protectionTimerTick();
void protectionTimeout(); void protectionTimeout();
void timeoutQuit(); void timeoutQuit();
void timeoutWMQuit(); void timeoutWMQuit();
@ -145,6 +146,7 @@ private:
void startProtection(); void startProtection();
void endProtection(); void endProtection();
void handleProtectionTimeout(); void handleProtectionTimeout();
void updateLogoutStatusDialog();
void startApplication( TQStringList command, void startApplication( TQStringList command,
const TQString& clientMachine = TQString::null, const TQString& clientMachine = TQString::null,
@ -250,6 +252,7 @@ private:
TDEHardwareDevices* hwDevices; TDEHardwareDevices* hwDevices;
int initialClientCount; int initialClientCount;
int phase2ClientCount; int phase2ClientCount;
int protectionTimerCounter;
}; };
#endif #endif

@ -100,7 +100,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// Time to wait after close request for graceful application termination // Time to wait after close request for graceful application termination
// If set too high running applications may be ungracefully terminated on slow machines or when many X11 applications are running // If set too high running applications may be ungracefully terminated on slow machines or when many X11 applications are running
#define KSMSERVER_SHUTDOWN_CLIENT_UNRESPONSIVE_TIMEOUT 60000 #define KSMSERVER_SHUTDOWN_CLIENT_UNRESPONSIVE_TIMEOUT 20000
// Time to wait before showing manual termination options // Time to wait before showing manual termination options
// If set too low the user may be confused by buttons briefly flashing up on the screen during an otherwise normal logout process // If set too low the user may be confused by buttons briefly flashing up on the screen during an otherwise normal logout process
@ -439,13 +439,20 @@ void KSMServer::saveYourselfDone( KSMClient* client, bool success )
} }
} }
// RAJA TEST ONLY updateLogoutStatusDialog();
}
void KSMServer::updateLogoutStatusDialog()
{
bool inPhase2 = true; bool inPhase2 = true;
bool pendingInteraction = false;
for( KSMClient* c = clients.first(); c; c = clients.next()) { for( KSMClient* c = clients.first(); c; c = clients.next()) {
if ( !c->saveYourselfDone && !c->waitForPhase2 ) { if ( !c->saveYourselfDone && !c->waitForPhase2 ) {
inPhase2 = false; inPhase2 = false;
} }
if ( c->pendingInteraction ) {
pendingInteraction = true;
}
} }
if (shutdownNotifierIPDlg) { if (shutdownNotifierIPDlg) {
@ -470,6 +477,7 @@ void KSMServer::saveYourselfDone( KSMClient* client, bool success )
} }
if (inPhase2) { if (inPhase2) {
if (phase2ClientCount > 0) { if (phase2ClientCount > 0) {
static_cast<KSMShutdownIPDlg*>(shutdownNotifierIPDlg)->setNotificationActionButtonsSkipText(i18n("Skip Notification (%1)").arg(((KSMSERVER_SHUTDOWN_CLIENT_UNRESPONSIVE_TIMEOUT - (protectionTimerCounter*1000))/1000)+1));
if (nextClientToKill == "") { if (nextClientToKill == "") {
static_cast<KSMShutdownIPDlg*>(shutdownNotifierIPDlg)->setStatusMessage(i18n("Notifying remaining applications of logout request (%1/%2)...").arg(phase2ClientCount-waitingClients).arg(phase2ClientCount)); static_cast<KSMShutdownIPDlg*>(shutdownNotifierIPDlg)->setStatusMessage(i18n("Notifying remaining applications of logout request (%1/%2)...").arg(phase2ClientCount-waitingClients).arg(phase2ClientCount));
} }
@ -479,11 +487,23 @@ void KSMServer::saveYourselfDone( KSMClient* client, bool success )
} }
} }
else { else {
if (nextClientToKill == "") { if (pendingInteraction) {
static_cast<KSMShutdownIPDlg*>(shutdownNotifierIPDlg)->setStatusMessage(i18n("Notifying applications of logout request (%1/%2)...").arg(clients.count()-waitingClients).arg(clients.count())); static_cast<KSMShutdownIPDlg*>(shutdownNotifierIPDlg)->setNotificationActionButtonsSkipText(i18n("Ignore and Resume Logout"));
if (nextClientToKill == "") {
static_cast<KSMShutdownIPDlg*>(shutdownNotifierIPDlg)->setStatusMessage(i18n("An application is requesting attention, logout paused..."));
}
else {
static_cast<KSMShutdownIPDlg*>(shutdownNotifierIPDlg)->setStatusMessage(i18n("%3 is requesting attention, logout paused...").arg(nextClientToKill));
}
} }
else { else {
static_cast<KSMShutdownIPDlg*>(shutdownNotifierIPDlg)->setStatusMessage(i18n("Notifying applications of logout request (%1/%2, %3)...").arg(clients.count()-waitingClients).arg(clients.count()).arg(nextClientToKill)); static_cast<KSMShutdownIPDlg*>(shutdownNotifierIPDlg)->setNotificationActionButtonsSkipText(i18n("Skip Notification (%1)").arg(((KSMSERVER_SHUTDOWN_CLIENT_UNRESPONSIVE_TIMEOUT - (protectionTimerCounter*1000))/1000)+1));
if (nextClientToKill == "") {
static_cast<KSMShutdownIPDlg*>(shutdownNotifierIPDlg)->setStatusMessage(i18n("Notifying applications of logout request (%1/%2)...").arg(clients.count()-waitingClients).arg(clients.count()));
}
else {
static_cast<KSMShutdownIPDlg*>(shutdownNotifierIPDlg)->setStatusMessage(i18n("Notifying applications of logout request (%1/%2, %3)...").arg(clients.count()-waitingClients).arg(clients.count()).arg(nextClientToKill));
}
} }
} }
} }
@ -583,14 +603,29 @@ void KSMServer::cancelShutdown()
void KSMServer::startProtection() void KSMServer::startProtection()
{ {
protectionTimer.start( KSMSERVER_SHUTDOWN_CLIENT_UNRESPONSIVE_TIMEOUT, true ); protectionTimerCounter = 0;
protectionTimer.start( 1000, true );
} }
void KSMServer::endProtection() void KSMServer::endProtection()
{ {
protectionTimerCounter = 0;
protectionTimer.stop(); protectionTimer.stop();
} }
void KSMServer::protectionTimerTick()
{
protectionTimerCounter++;
if ((protectionTimerCounter*1000) > KSMSERVER_SHUTDOWN_CLIENT_UNRESPONSIVE_TIMEOUT) {
protectionTimerCounter = 0;
protectionTimeout();
}
else {
protectionTimer.start( 1000, true );
}
updateLogoutStatusDialog();
}
/* /*
Internal protection slot, invoked when clients do not react during Internal protection slot, invoked when clients do not react during
shutdown. shutdown.

@ -1219,13 +1219,18 @@ void KSMShutdownIPDlg::hideNotificationActionButtons()
m_gridlayout->invalidate(); m_gridlayout->invalidate();
} }
void KSMShutdownIPDlg::setNotificationActionButtonsSkipText(TQString text)
{
m_button1->setText(text);
}
KSMShutdownIPDlg::KSMShutdownIPDlg(TQWidget* parent) KSMShutdownIPDlg::KSMShutdownIPDlg(TQWidget* parent)
: KSMModalDialog( parent ) : KSMModalDialog( parent )
{ {
setStatusMessage(i18n("Saving your settings...")); setStatusMessage(i18n("Saving your settings..."));
m_button1->setText(i18n("Skip Notification")); setNotificationActionButtonsSkipText(i18n("Skip Notification"));
m_button2->setText(i18n("Abort Logout")); m_button2->setText(i18n("Abort Logout"));
connect(m_button1, SIGNAL(clicked()), this, SIGNAL(skipNotificationClicked())); connect(m_button1, SIGNAL(clicked()), this, SIGNAL(skipNotificationClicked()));
connect(m_button2, SIGNAL(clicked()), this, SIGNAL(abortLogoutClicked())); connect(m_button2, SIGNAL(clicked()), this, SIGNAL(abortLogoutClicked()));

@ -173,6 +173,7 @@ public:
void showNotificationActionButtons(); void showNotificationActionButtons();
void hideNotificationActionButtons(); void hideNotificationActionButtons();
void setNotificationActionButtonsSkipText(TQString text);
signals: signals:
void abortLogoutClicked(); void abortLogoutClicked();

Loading…
Cancel
Save