summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2013-08-03 17:10:10 -0500
committerTimothy Pearson <[email protected]>2013-08-03 17:10:10 -0500
commitd85d82bd00b3a5f49569bf99fd0ad8a3df0dc234 (patch)
treeab8841a32934f6b8f1b7eb043dca4221853d6074
parent682dadf9bbd25d76c524a35263e89b93afe97580 (diff)
downloadtdebase-d85d82bd00b3a5f49569bf99fd0ad8a3df0dc234.tar.gz
tdebase-d85d82bd00b3a5f49569bf99fd0ad8a3df0dc234.zip
Provide visual indication of SaveYourself hang protection timer
Reduce hang protection timer to 20 seconds This relates to Bug 760
-rw-r--r--ksmserver/server.cpp4
-rw-r--r--ksmserver/server.h3
-rw-r--r--ksmserver/shutdown.cpp47
-rw-r--r--ksmserver/shutdowndlg.cpp7
-rw-r--r--ksmserver/shutdowndlg.h1
5 files changed, 53 insertions, 9 deletions
diff --git a/ksmserver/server.cpp b/ksmserver/server.cpp
index e69ebbbe9..068246305 100644
--- a/ksmserver/server.cpp
+++ b/ksmserver/server.cpp
@@ -580,7 +580,7 @@ extern "C" int _IceTransNoListen(const char * protocol);
#endif
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;
clean = false;
@@ -682,7 +682,7 @@ KSMServer::KSMServer( const TQString& windowManager, const TQString& windowManag
signal(SIGPIPE, SIG_IGN);
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( &shutdownTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( timeoutQuit() ) );
connect( kapp, TQT_SIGNAL( shutDown() ), this, TQT_SLOT( cleanUp() ) );
diff --git a/ksmserver/server.h b/ksmserver/server.h
index 9f9630f4d..8f17af231 100644
--- a/ksmserver/server.h
+++ b/ksmserver/server.h
@@ -110,6 +110,7 @@ private slots:
void restoreSessionDoneInternal();
void notificationTimeout();
+ void protectionTimerTick();
void protectionTimeout();
void timeoutQuit();
void timeoutWMQuit();
@@ -145,6 +146,7 @@ private:
void startProtection();
void endProtection();
void handleProtectionTimeout();
+ void updateLogoutStatusDialog();
void startApplication( TQStringList command,
const TQString& clientMachine = TQString::null,
@@ -250,6 +252,7 @@ private:
TDEHardwareDevices* hwDevices;
int initialClientCount;
int phase2ClientCount;
+ int protectionTimerCounter;
};
#endif
diff --git a/ksmserver/shutdown.cpp b/ksmserver/shutdown.cpp
index 0eb4ff668..c519d8b88 100644
--- a/ksmserver/shutdown.cpp
+++ b/ksmserver/shutdown.cpp
@@ -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
// 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
// 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 pendingInteraction = false;
for( KSMClient* c = clients.first(); c; c = clients.next()) {
if ( !c->saveYourselfDone && !c->waitForPhase2 ) {
inPhase2 = false;
}
+ if ( c->pendingInteraction ) {
+ pendingInteraction = true;
+ }
}
if (shutdownNotifierIPDlg) {
@@ -470,6 +477,7 @@ void KSMServer::saveYourselfDone( KSMClient* client, bool success )
}
if (inPhase2) {
if (phase2ClientCount > 0) {
+ 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 remaining applications of logout request (%1/%2)...").arg(phase2ClientCount-waitingClients).arg(phase2ClientCount));
}
@@ -479,11 +487,23 @@ void KSMServer::saveYourselfDone( KSMClient* client, bool success )
}
}
else {
- if (nextClientToKill == "") {
- static_cast<KSMShutdownIPDlg*>(shutdownNotifierIPDlg)->setStatusMessage(i18n("Notifying applications of logout request (%1/%2)...").arg(clients.count()-waitingClients).arg(clients.count()));
+ if (pendingInteraction) {
+ 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 {
- 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()
{
- protectionTimer.start( KSMSERVER_SHUTDOWN_CLIENT_UNRESPONSIVE_TIMEOUT, true );
+ protectionTimerCounter = 0;
+ protectionTimer.start( 1000, true );
}
void KSMServer::endProtection()
{
+ protectionTimerCounter = 0;
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
shutdown.
diff --git a/ksmserver/shutdowndlg.cpp b/ksmserver/shutdowndlg.cpp
index 6526bc4b8..e171170fa 100644
--- a/ksmserver/shutdowndlg.cpp
+++ b/ksmserver/shutdowndlg.cpp
@@ -1219,13 +1219,18 @@ void KSMShutdownIPDlg::hideNotificationActionButtons()
m_gridlayout->invalidate();
}
+void KSMShutdownIPDlg::setNotificationActionButtonsSkipText(TQString text)
+{
+ m_button1->setText(text);
+}
+
KSMShutdownIPDlg::KSMShutdownIPDlg(TQWidget* parent)
: KSMModalDialog( parent )
{
setStatusMessage(i18n("Saving your settings..."));
- m_button1->setText(i18n("Skip Notification"));
+ setNotificationActionButtonsSkipText(i18n("Skip Notification"));
m_button2->setText(i18n("Abort Logout"));
connect(m_button1, SIGNAL(clicked()), this, SIGNAL(skipNotificationClicked()));
connect(m_button2, SIGNAL(clicked()), this, SIGNAL(abortLogoutClicked()));
diff --git a/ksmserver/shutdowndlg.h b/ksmserver/shutdowndlg.h
index 5ab9d7c3e..d92bd5644 100644
--- a/ksmserver/shutdowndlg.h
+++ b/ksmserver/shutdowndlg.h
@@ -173,6 +173,7 @@ public:
void showNotificationActionButtons();
void hideNotificationActionButtons();
+ void setNotificationActionButtonsSkipText(TQString text);
signals:
void abortLogoutClicked();