diff options
-rw-r--r-- | kdesktop/lock/lockprocess.cpp | 20 | ||||
-rw-r--r-- | kdesktop/lock/lockprocess.h | 6 | ||||
-rw-r--r-- | kdesktop/lock/main.cpp | 14 |
3 files changed, 37 insertions, 3 deletions
diff --git a/kdesktop/lock/lockprocess.cpp b/kdesktop/lock/lockprocess.cpp index 0a343d88e..234327001 100644 --- a/kdesktop/lock/lockprocess.cpp +++ b/kdesktop/lock/lockprocess.cpp @@ -4,7 +4,7 @@ // // Copyright (c) 1999 Martin R. Jones <[email protected]> // Copyright (c) 2003 Oswald Buddenhagen <[email protected]> -// Copyright (c) 2010 - 2015 Timothy Pearson <[email protected]> +// Copyright (c) 2010 - 2024 Timothy Pearson <[email protected]> // //kdesktop keeps running and checks user inactivity @@ -193,6 +193,9 @@ mHackDelayStartupTimer->stop(); // LockProcess::LockProcess() : TQWidget(0L, "saver window", ((WFlags)(WStyle_StaysOnTop|WStyle_Customize|WStyle_NoBorder))), + mInitialized(FALSE), + mLockPending(FALSE), + mLocked(FALSE), mOpenGLVisual(0), mParent(0), mShowLockDateTime(false), @@ -438,6 +441,8 @@ void LockProcess::init(bool child, bool useBlankOnly) TQObject::connect(mControlPipeHandler, TQ_SIGNAL(processCommand(TQString)), this, TQ_SLOT(processInputPipeCommand(TQString))); TQTimer::singleShot(0, mControlPipeHandler, TQ_SLOT(run())); mControlPipeHandlerThread->start(); + + mInitialized = TRUE; } static int signal_pipe[2]; @@ -1477,6 +1482,13 @@ i18n("<i>kcheckpass</i> is unable to operate. Possibly it is not SetUID root."); // bool LockProcess::startLock() { + mLockPending = TRUE; + + if (!mInitialized) { + // Don't hang if we're not even initialized yet -- startLock() was triggered prematurely + return false; + } + for (TQStringList::ConstIterator it = mPlugins.begin(); it != mPlugins.end(); ++it) { GreeterPluginHandle plugin; TQString path = KLibLoader::self()->findLibrary( ((*it)[0] == '/' ? *it : "kgreet_" + *it ).latin1() ); @@ -1507,6 +1519,7 @@ bool LockProcess::startLock() kdDebug(KDESKTOP_DEBUG_ID) << "GreeterPlugin " << *it << " (" << plugin.info->method << ", " << plugin.info->name << ") loaded" << endl; greetPlugin = plugin; mLocked = true; + mLockPending = FALSE; DM().setLock( true ); return true; } @@ -1973,6 +1986,11 @@ static void fakeFocusIn( WId window ) XSendEvent( tqt_xdisplay(), window, False, NoEventMask, &ev ); } +bool LockProcess::lockPending() +{ + return mLockPending; +} + void LockProcess::resumeUnforced() { resume( false ); diff --git a/kdesktop/lock/lockprocess.h b/kdesktop/lock/lockprocess.h index bfe1fe420..e2a761963 100644 --- a/kdesktop/lock/lockprocess.h +++ b/kdesktop/lock/lockprocess.h @@ -4,7 +4,7 @@ // // Copyright (c) 1999 Martin R. Jones <[email protected]> // Copyright (c) 2003 Oswald Buddenhagen <[email protected]> -// Copyright (c) 2010 - 2015 Timothy Pearson <[email protected]> +// Copyright (c) 2010 - 2024 Timothy Pearson <[email protected]> // #ifndef __LOCKENG_H__ @@ -104,6 +104,8 @@ class LockProcess : public TQWidget void msgBox( TQMessageBox::Icon type, const TQString &txt ); int execDialog( TQDialog* dlg ); + bool lockPending(); + TDECryptographicCardDevice* cryptographicCardDevice(); signals: @@ -181,6 +183,8 @@ class LockProcess : public TQWidget void generateBackingImages(); void fullyOnline(); + bool mInitialized; + bool mLockPending; bool mLocked; int mLockGrace; int mPriority; diff --git a/kdesktop/lock/main.cpp b/kdesktop/lock/main.cpp index f80f406a1..1abb107ad 100644 --- a/kdesktop/lock/main.cpp +++ b/kdesktop/lock/main.cpp @@ -1,7 +1,7 @@ /* This file is part of the TDE project Copyright (C) 1999 David Faure Copyright (c) 2003 Oswald Buddenhagen <[email protected]> - Copyright (c) 2010-2015 Timothy Pearson <[email protected]> + Copyright (c) 2010-2024 Timothy Pearson <[email protected]> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -103,6 +103,12 @@ static void sigusr5_handler(int) signalled_run = TRUE; } +static void sighup_handler(int) +{ + signalled_forcelock = TRUE; + signalled_run = TRUE; +} + static int trapXErrors(Display *, XErrorEvent *) { return 0; @@ -428,6 +434,12 @@ int main( int argc, char **argv ) sigaddset(&(act.sa_mask), SIGTTOU); act.sa_flags = 0; sigaction(SIGTTOU, &act, 0L); + // handle SIGHUP (force lock, fallback handler) + act.sa_handler= sighup_handler; + sigemptyset(&(act.sa_mask)); + sigaddset(&(act.sa_mask), SIGHUP); + act.sa_flags = 0; + sigaction(SIGHUP, &act, 0L); // initialize the signal masks sigemptyset(&new_mask); |