summaryrefslogtreecommitdiffstats
path: root/kdesktop
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-11-28 17:12:06 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-11-28 17:12:06 -0600
commit2f7d50c20cebb33745c0ecea5a5b6cc3f4747d6e (patch)
tree1e5904ff6869e62def20b14ca652c3b1da3a9440 /kdesktop
parent2c1d4ad359e90360708cffe70c298b264b302e49 (diff)
downloadtdebase-2f7d50c20cebb33745c0ecea5a5b6cc3f4747d6e.tar.gz
tdebase-2f7d50c20cebb33745c0ecea5a5b6cc3f4747d6e.zip
Fix kdesktop_lock requiring a process stop/start on unlock
Attempt to fix kdesktop_lock start/stop causing dcop failures by keeping kdesktop_lock process running across lock/unlock cycles
Diffstat (limited to 'kdesktop')
-rw-r--r--kdesktop/lock/lockprocess.cc65
-rw-r--r--kdesktop/lock/lockprocess.h5
-rw-r--r--kdesktop/lock/main.cc55
-rw-r--r--kdesktop/lock/main.h2
4 files changed, 78 insertions, 49 deletions
diff --git a/kdesktop/lock/lockprocess.cc b/kdesktop/lock/lockprocess.cc
index 3dacc7ff3..9612f5cca 100644
--- a/kdesktop/lock/lockprocess.cc
+++ b/kdesktop/lock/lockprocess.cc
@@ -159,15 +159,14 @@ extern bool trinity_desktop_lock_hide_active_windows;
extern bool trinity_desktop_lock_hide_cancel_button;
extern bool trinity_desktop_lock_forced;
+extern LockProcess* trinity_desktop_lock_process;
+
extern bool argb_visual;
extern pid_t kdesktop_pid;
extern TQXLibWindowList trinity_desktop_lock_hidden_window_list;
bool trinity_desktop_lock_autohide_lockdlg = TRUE;
-bool trinity_desktop_lock_closing_windows = FALSE;
-bool trinity_desktop_lock_in_sec_dlg = FALSE;
-bool trinity_desktop_hack_active = FALSE;
#define ENABLE_CONTINUOUS_LOCKDLG_DISPLAY \
if (!mForceContinualLockDisplayTimer->isActive()) mForceContinualLockDisplayTimer->start(100, FALSE); \
@@ -213,6 +212,9 @@ LockProcess::LockProcess()
mOverrideHackStartupEnabled(false),
mResizingDesktopLock(false),
mFullyOnlineSent(false),
+ mClosingWindows(false),
+ mInSecureDialog(false),
+ mHackActive(false),
m_rootPixmap(NULL),
mBackingStartupDelayTimer(0),
m_startupStatusDialog(NULL),
@@ -418,7 +420,7 @@ static int signal_pipe[2];
static void sigterm_handler(int)
{
- if (!trinity_desktop_lock_in_sec_dlg) {
+ if ((!trinity_desktop_lock_process) || (!trinity_desktop_lock_process->inSecureDialog())) {
// Exit uncleanly
char tmp = 'U';
if (::write( signal_pipe[1], &tmp, 1) == -1) {
@@ -437,7 +439,7 @@ static void sighup_handler(int)
bool LockProcess::closeCurrentWindow()
{
- trinity_desktop_lock_closing_windows = TRUE;
+ mClosingWindows = TRUE;
if (currentDialog != NULL) {
mForceReject = true;
if (dynamic_cast<SAKDlg*>(currentDialog)) {
@@ -452,12 +454,12 @@ bool LockProcess::closeCurrentWindow()
}
if( mDialogs.isEmpty() ) {
- trinity_desktop_lock_closing_windows = FALSE;
+ mClosingWindows = FALSE;
mForceReject = false;
return false;
}
else {
- trinity_desktop_lock_closing_windows = TRUE;
+ mClosingWindows = TRUE;
return true;
}
}
@@ -621,9 +623,9 @@ void LockProcess::startSecureDialog()
if (forcecontdisp) {
DISABLE_CONTINUOUS_LOCKDLG_DISPLAY
}
- trinity_desktop_lock_in_sec_dlg = false;
+ mInSecureDialog = false;
if (ret == 0) {
- trinity_desktop_lock_closing_windows = 1;
+ mClosingWindows = 1;
kapp->quit();
}
if (ret == 1) {
@@ -669,14 +671,14 @@ void LockProcess::startSecureDialog()
return;
}
if (ret == 2) {
- trinity_desktop_lock_closing_windows = 1;
+ mClosingWindows = 1;
if (system("ksysguard &") == -1) {
// Error handler to shut up gcc warnings
}
kapp->quit();
}
if (ret == 3) {
- trinity_desktop_lock_closing_windows = 1;
+ mClosingWindows = 1;
DCOPRef("ksmserver","ksmserver").send("logout", (int)TDEApplication::ShutdownConfirmYes, (int)TDEApplication::ShutdownTypeNone, (int)TDEApplication::ShutdownModeInteractive);
kapp->quit();
}
@@ -699,7 +701,7 @@ bool LockProcess::runSecureDialog()
tqApp->processEvents();
#endif
- trinity_desktop_lock_in_sec_dlg = true;
+ mInSecureDialog = true;
if (startSaver()) {
mBackingStartupDelayTimer = 0;
TQTimer::singleShot(0, this, TQT_SLOT(startSecureDialog()));
@@ -710,6 +712,11 @@ bool LockProcess::runSecureDialog()
}
}
+bool LockProcess::inSecureDialog()
+{
+ return mInSecureDialog;
+}
+
//---------------------------------------------------------------------------
//
// Read and apply configuration.
@@ -1223,7 +1230,7 @@ bool LockProcess::grabKeyboard()
bool LockProcess::grabMouse()
{
HANDLE cursorHandle;
- if (trinity_desktop_hack_active) {
+ if (mHackActive) {
cursorHandle = TQCursor(tqblankCursor).handle();
}
else {
@@ -1351,7 +1358,7 @@ bool LockProcess::startSaver(bool notify_ready)
slotPaintBackground(rootWinSnapShot);
}
- if (((!(trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_forced)) && (!trinity_desktop_lock_in_sec_dlg)) && (mHackStartupEnabled || mOverrideHackStartupEnabled)) {
+ if (((!(trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_forced)) && (!mInSecureDialog)) && (mHackStartupEnabled || mOverrideHackStartupEnabled)) {
if (argb_visual) {
setTransparentBackgroundARGB();
}
@@ -1377,7 +1384,7 @@ bool LockProcess::startSaver(bool notify_ready)
}
}
- if (trinity_desktop_lock_in_sec_dlg == FALSE) {
+ if (mInSecureDialog == FALSE) {
if (trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_forced && trinity_desktop_lock_use_system_modal_dialogs) {
ENABLE_CONTINUOUS_LOCKDLG_DISPLAY
if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE);
@@ -1554,7 +1561,7 @@ void LockProcess::repaintRootWindowIfNeeded()
bool LockProcess::startHack()
{
- trinity_desktop_hack_active = TRUE;
+ mHackActive = TRUE;
if ((mEnsureVRootWindowSecurityTimer) && (!mEnsureVRootWindowSecurityTimer->isActive())) mEnsureVRootWindowSecurityTimer->start(250, FALSE);
@@ -1715,7 +1722,7 @@ void LockProcess::stopHack()
}
setCursor( tqarrowCursor );
- trinity_desktop_hack_active = FALSE;
+ mHackActive = FALSE;
}
//---------------------------------------------------------------------------
@@ -1724,7 +1731,7 @@ void LockProcess::hackExited(TDEProcess *)
{
// Hack exited while we're supposed to be saving the screen.
// Make sure the saver window is black.
- trinity_desktop_hack_active = FALSE;
+ mHackActive = FALSE;
usleep(100);
TQApplication::syncX();
if (!trinity_desktop_lock_use_system_modal_dialogs) {
@@ -1771,13 +1778,13 @@ void LockProcess::displayLockDialogIfNeeded()
m_startupStatusDialog->closeSMDialog();
m_startupStatusDialog = NULL;
}
- if (!trinity_desktop_lock_in_sec_dlg) {
+ if (!mInSecureDialog) {
if (trinity_desktop_lock_use_system_modal_dialogs) {
if (!mBusy) {
mBusy = true;
if (mLocked) {
if (checkPass()) {
- trinity_desktop_lock_closing_windows = true;
+ mClosingWindows = true;
stopSaver();
kapp->quit();
}
@@ -1886,7 +1893,7 @@ bool LockProcess::checkPass()
// Make sure we never launch the SAK or login dialog if windows are being closed down
// Otherwise we can get stuck in an irrecoverable state where any attempt to show the login screen is instantly aborted
- if (trinity_desktop_lock_closing_windows) {
+ if (mClosingWindows) {
return 0;
}
@@ -1906,7 +1913,7 @@ bool LockProcess::checkPass()
// Wait for SAK press before continuing...
SAKDlg inDlg( this );
execDialog( &inDlg );
- if (trinity_desktop_lock_closing_windows) {
+ if (mClosingWindows) {
return 0;
}
}
@@ -1995,7 +2002,7 @@ int LockProcess::execDialog( TQDialog *dlg )
mDialogs.remove( dlg );
if( mDialogs.isEmpty() ) {
HANDLE cursorHandle;
- if (trinity_desktop_hack_active) {
+ if (mHackActive) {
cursorHandle = TQCursor(tqblankCursor).handle();
}
else {
@@ -2179,7 +2186,7 @@ bool LockProcess::x11Event(XEvent *event)
ENABLE_CONTINUOUS_LOCKDLG_DISPLAY
if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE);
}
- if ((!mLocked) && (!trinity_desktop_lock_in_sec_dlg))
+ if ((!mLocked) && (!mInSecureDialog))
{
stopSaver();
kapp->quit();
@@ -2193,7 +2200,7 @@ bool LockProcess::x11Event(XEvent *event)
else {
if (!mLocked || checkPass())
{
- trinity_desktop_lock_closing_windows = true;
+ mClosingWindows = true;
stopSaver();
kapp->quit();
}
@@ -2704,7 +2711,7 @@ void LockProcess::processInputPipeCommand(TQString inputcommand) {
closeCurrentWindow();
}
}
- trinity_desktop_lock_closing_windows = false;
+ mClosingWindows = false;
mInfoMessageDisplayed = false;
mDialogControlLock = false;
}
@@ -2728,7 +2735,7 @@ void LockProcess::processInputPipeCommand(TQString inputcommand) {
inDlg.setUnlockIcon();
execDialog( &inDlg );
mForceReject = false;
- trinity_desktop_lock_closing_windows = false;
+ mClosingWindows = false;
return;
}
if ((command[0] == 'E') || (command[0] == 'W') || (command[0] == 'I') || (command[0] == 'K')) {
@@ -2754,7 +2761,7 @@ void LockProcess::processInputPipeCommand(TQString inputcommand) {
if (command[0] == 'E') inDlg.setErrorIcon();
execDialog( &inDlg );
mForceReject = false;
- trinity_desktop_lock_closing_windows = false;
+ mClosingWindows = false;
return;
}
if (command[0] == 'Q') {
@@ -2790,7 +2797,7 @@ void LockProcess::processInputPipeCommand(TQString inputcommand) {
}
}
mForceReject = false;
- trinity_desktop_lock_closing_windows = false;
+ mClosingWindows = false;
return;
}
}
diff --git a/kdesktop/lock/lockprocess.h b/kdesktop/lock/lockprocess.h
index 85e9cdd31..e063b9669 100644
--- a/kdesktop/lock/lockprocess.h
+++ b/kdesktop/lock/lockprocess.h
@@ -86,6 +86,7 @@ public:
bool dontLock();
bool runSecureDialog();
+ bool inSecureDialog();
void setChildren(TQValueList<int> children) { child_sockets = children; }
void setParent(int fd) { mParent = fd; }
@@ -226,6 +227,10 @@ private:
bool mResizingDesktopLock;
bool mFullyOnlineSent;
+ bool mClosingWindows;
+ bool mInSecureDialog;
+ bool mHackActive;
+
TQPixmap backingPixmap;
KRootPixmap *m_rootPixmap;
int mBackingStartupDelayTimer;
diff --git a/kdesktop/lock/main.cc b/kdesktop/lock/main.cc
index d5f037f56..ce3be3f14 100644
--- a/kdesktop/lock/main.cc
+++ b/kdesktop/lock/main.cc
@@ -73,6 +73,8 @@ bool trinity_desktop_lock_hide_active_windows = FALSE;
bool trinity_desktop_lock_hide_cancel_button = FALSE;
bool trinity_desktop_lock_forced = FALSE;
+LockProcess* trinity_desktop_lock_process = NULL;
+
bool signalled_forcelock;
bool signalled_dontlock;
bool signalled_securedialog;
@@ -82,6 +84,7 @@ bool in_internal_mode = FALSE;
bool argb_visual = FALSE;
pid_t kdesktop_pid = -1;
+bool trinity_desktop_lock_settings_initialized = FALSE;
static void sigusr1_handler(int)
{
@@ -241,6 +244,8 @@ int main( int argc, char **argv )
XSetErrorHandler(trapXErrors);
+ MyApp* app = NULL;
+
while (1 == 1) {
signalled_forcelock = FALSE;
signalled_dontlock = FALSE;
@@ -311,12 +316,14 @@ int main( int argc, char **argv )
}
}
+ if (!app) {
#ifdef COMPOSITE
- MyApp app(TDEApplication::openX11RGBADisplay());
- argb_visual = app.isX11CompositionAvailable();
+ app = new MyApp(TDEApplication::openX11RGBADisplay());
+ argb_visual = app->isX11CompositionAvailable();
#else
- MyApp app;
+ app = new MyApp;
#endif
+ }
TDELockFile lock(locateLocal("tmp", "kdesktop_lock_lockfile"));
lock.setStaleTime(0);
@@ -357,17 +364,17 @@ int main( int argc, char **argv )
}
kdDebug() << "app " << kdesktop_screen_number << " " << starting_screen << " " << child << " " << child_sockets.count() << " " << parent_connection << endl;
- app.disableSessionManagement();
+ app->disableSessionManagement();
TDEGlobal::locale()->insertCatalogue("libdmctl");
struct stat st;
KSimpleConfig* tdmconfig;
OPEN_TDMCONFIG_AND_SET_GROUP
- LockProcess process;
+ trinity_desktop_lock_process = new LockProcess;
// Start loading core functions, such as the desktop wallpaper interface
- app.processEvents();
+ app->processEvents();
if (args->isSet( "internal" )) {
kdesktop_pid = atoi(args->getOption( "internal" ));
@@ -428,7 +435,7 @@ int main( int argc, char **argv )
// Disable reception of all X11 events on the root window
XSelectInput( tqt_xdisplay(), tqt_xrootwin(), 0 );
- app.processEvents();
+ app->processEvents();
// wait for SIGUSR1, SIGUSR2, SIGWINCH, SIGTTIN, or SIGTTOU
sigsuspend(&new_mask);
@@ -438,10 +445,15 @@ int main( int argc, char **argv )
}
}
- // load settings here so that they actually reflect reality
- // there is no way to force a reload once KDesktopSettings::instance has been called!
+ // (re)load settings here so that they actually reflect reality
// we need to read from the right rc file - possibly taking screen number in account
- KDesktopSettings::instance("kdesktoprc");
+ if (!trinity_desktop_lock_settings_initialized) {
+ KDesktopSettings::instance("kdesktoprc");
+ trinity_desktop_lock_settings_initialized = true;
+ }
+ else {
+ KDesktopSettings::self()->readConfig();
+ }
trinity_desktop_lock_use_system_modal_dialogs = !KDesktopSettings::useUnmanagedLockWindows();
trinity_desktop_lock_delay_screensaver_start = KDesktopSettings::delaySaverStart();
if (trinity_desktop_lock_use_system_modal_dialogs) {
@@ -464,32 +476,32 @@ int main( int argc, char **argv )
trinity_desktop_lock_forced = TRUE;
}
- process.init(child, (args->isSet( "blank" ) || (signalled_blank == TRUE)));
+ trinity_desktop_lock_process->init(child, (args->isSet( "blank" ) || (signalled_blank == TRUE)));
if (!child) {
- process.setChildren(child_sockets);
+ trinity_desktop_lock_process->setChildren(child_sockets);
}
else {
- process.setParent(parent_connection);
+ trinity_desktop_lock_process->setParent(parent_connection);
}
bool rt;
if( (((!child) && (args->isSet( "forcelock" ))) || (signalled_forcelock == TRUE))) {
- rt = process.lock();
+ rt = trinity_desktop_lock_process->lock();
}
else if( child || (args->isSet( "dontlock" ) || (signalled_dontlock == TRUE))) {
- rt = process.dontLock();
+ rt = trinity_desktop_lock_process->dontLock();
}
else if( child || (args->isSet( "securedialog" ) || (signalled_securedialog == TRUE))) {
int retcode = tde_sak_verify_calling_process();
if (retcode == 0) {
- rt = process.runSecureDialog();
+ rt = trinity_desktop_lock_process->runSecureDialog();
}
else {
return 1;
}
}
else {
- rt = process.defaultSave();
+ rt = trinity_desktop_lock_process->defaultSave();
}
if (!rt) {
return 0;
@@ -497,7 +509,7 @@ int main( int argc, char **argv )
if (in_internal_mode == FALSE) {
trinity_desktop_lock_hidden_window_list.clear();
- int ret = app.exec();
+ int ret = app->exec();
restore_hidden_override_redirect_windows();
return ret;
}
@@ -507,18 +519,23 @@ int main( int argc, char **argv )
return 12;
}
trinity_desktop_lock_hidden_window_list.clear();
- app.exec();
+ app->exec();
restore_hidden_override_redirect_windows();
if (kill(kdesktop_pid, SIGUSR1) < 0) {
// The controlling kdesktop process probably died. Commit suicide...
return 12;
}
+ delete trinity_desktop_lock_process;
+ trinity_desktop_lock_process = NULL;
+
+#if 0
// FIXME
// We should not have to return (restart) at all,
// but it seems that some X11 connections are left active,
// preventing the lock process from restarting properly in the while() loop above.
return 0;
+#endif
}
}
}
diff --git a/kdesktop/lock/main.h b/kdesktop/lock/main.h
index 6caaa0898..da3accda2 100644
--- a/kdesktop/lock/main.h
+++ b/kdesktop/lock/main.h
@@ -36,6 +36,6 @@ signals:
void mouseInteraction(XEvent *event);
private:
time_t lastTick;
-};
+};
#endif